-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbox.php
More file actions
64 lines (61 loc) · 2.85 KB
/
box.php
File metadata and controls
64 lines (61 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/*
Name: Last Updated Date
Author: Pabelog.com
Description: Last Updated Date Box
Version: 1.0
Class: pabelog_last_updated_date
*/
class pabelog_last_updated_date extends thesis_box {
protected function translate() {
$this->title = __('Last Updated Date', $this->_class);
}
protected function html_options() {
global $thesis;
$html = $thesis->api->html_options();
$html['class']['tooltip'] = sprintf(__('This box already contains a %1$s of <code>updated_post_date</code>. If you’d like to supply another %1$s, you can do that here.%2$s', $this->_class), $thesis->api->base['class'], $thesis->api->strings['class_note']);
unset($html['id'], $html['class']);
return array_merge($html, array(
'format' => array(
'type' => 'text',
'width' => 'short',
'code' => true,
'label' => __('Updated Date Format', $this->_class),
'tooltip' => $thesis->api->strings['date_tooltip'],
'default' => get_option('date_format')),
'post_date_intro' => array(
'type' => 'text',
'width' => 'short',
'label' => __('Post Date Intro Text', $this->_class),
'tooltip' => sprintf(__('Any text you supply here will be wrapped in %s, like so:<br /><code><span class="post_date_intro"></code>your text<code></span></code>.', $this->_class), $thesis->api->base['html'])),
'updated_post_date_intro' => array(
'type' => 'text',
'width' => 'short',
'label' => __('Updated Date Intro Text', $this->_class),
'tooltip' => sprintf(__('Any text you supply here will be wrapped in %s, like so:<br /><code><span class="updated_post_date_intro"></code>your text<code></span></code>.', $this->_class), $thesis->api->base['html'])))
);
}
public function html($args = array()) {
global $thesis;
extract($args = is_array($args) ? $args : array());
$tab = str_repeat("\t", !empty($depth) ? $depth : 0);
$time = get_the_time('Y-m-d');
$format = strip_tags(!empty($this->options['format']) ?
stripslashes($this->options['format']) :
apply_filters("{$this->_class}_format", get_option('date_format')));
if ( get_the_modified_date() != get_the_date() ) {
echo
(!empty($this->options['updated_post_date_intro']) ?
'<span class="updated_post_date_intro">'. $thesis->api->esch($this->options['updated_post_date_intro']). '</span> ' : '').
"<span class=\"updated_post_date". (!empty($this->options['class']) ? ' '. trim($thesis->api->esc($this->options['class'])) : ''). "\" title=\"$time\">".
get_the_modified_date($format).
"</span>\n";
} else
echo
(!empty($this->options['post_date_intro']) ?
'<span class="post_date_intro">'. $thesis->api->esch($this->options['post_date_intro']). '</span> ' : '').
"<span class=\"post_date". (!empty($this->options['class']) ? ' '. trim($thesis->api->esc($this->options['class'])) : ''). "\" title=\"$time\">".
get_the_date($format).
"</span>\n";
}
}