PluginProbe ʕ •ᴥ•ʔ
WP Popular Posts / 6.2.1
WP Popular Posts v6.2.1
4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 5.0.0 5.0.1 5.0.2 5.1.0 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.4.0 5.4.1 5.4.2 5.5.0 5.5.1 6.0.0 6.0.1 6.0.2 6.0.3 6.0.4 6.0.5 6.1.0 6.1.1 6.1.2 6.1.3 6.1.4 6.2.0 6.2.1 6.3.0 6.3.1 6.3.2 6.3.3 6.3.4 6.4.0 6.4.1 6.4.2 7.0.0 7.0.1 7.1.0 7.2.0 7.3.0 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.3.7 7.3.8 7.4.0 trunk 2.3.7 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.2 4.0.3 4.0.5 4.0.6
wordpress-popular-posts / src / Widget / form.php
wordpress-popular-posts / src / Widget Last commit date
Widget.php 2 years ago form.php 2 years ago
form.php
243 lines
1 <?php
2 $current_sidebar_data = $this->get_sidebar_data();
3 $current_sidebar = $current_sidebar_data ? $current_sidebar_data['id'] : null;
4 ?>
5 <!-- Widget title -->
6 <p>
7 <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title', 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#what-does-title-do" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" target="_blank">?</a>]</small> <br />
8 <input type="text" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="widefat" />
9 </p>
10
11 <!-- Limit -->
12 <p>
13 <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php esc_html_e('Show up to', 'wordpress-popular-posts'); ?>:</label><br />
14 <input type="text" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" style="width:50px!important" /> <?php esc_html_e('posts', 'wordpress-popular-posts'); ?>
15 </p>
16
17 <!-- Order by -->
18 <p>
19 <label for="<?php echo esc_attr($this->get_field_id('order_by')); ?>"><?php esc_html_e('Sort posts by', 'wordpress-popular-posts'); ?>:</label><br />
20 <select id="<?php echo esc_attr($this->get_field_id('order_by')); ?>" name="<?php echo esc_attr($this->get_field_name('order_by')); ?>" class="widefat">
21 <option value="comments" <?php if ('comments' == $instance['order_by'] ) { echo 'selected="selected"'; } ?>><?php esc_html_e('Comments', 'wordpress-popular-posts'); ?></option>
22 <option value="views" <?php if ('views' == $instance['order_by'] ) { echo 'selected="selected"'; } ?>><?php esc_html_e('Total views', 'wordpress-popular-posts'); ?></option>
23 <option value="avg" <?php if ('avg' == $instance['order_by'] ) { echo 'selected="selected"'; } ?>><?php esc_html_e('Avg. daily views', 'wordpress-popular-posts'); ?></option>
24 </select>
25 </p>
26
27 <!-- Filters -->
28 <br /><hr /><br />
29
30 <legend><strong><?php esc_html_e('Filters', 'wordpress-popular-posts'); ?></strong></legend><br />
31
32 <label for="<?php echo esc_attr($this->get_field_id('range')); ?>"><?php esc_html_e('Time Range', 'wordpress-popular-posts'); ?>:</label><br />
33 <select id="<?php echo esc_attr($this->get_field_id('range')); ?>" name="<?php echo esc_attr($this->get_field_name('range')); ?>" class="widefat" style="margin-bottom:5px;">
34 <option value="daily" <?php if ('daily' == $instance['range'] || 'last24hours' == $instance['range'] ) { echo 'selected="selected"'; } ?>><?php esc_html_e('Last 24 hours', 'wordpress-popular-posts'); ?></option>
35 <option value="weekly" <?php if ('weekly' == $instance['range'] || 'last7days' == $instance['range'] ) { echo 'selected="selected"'; } ?>><?php esc_html_e('Last 7 days', 'wordpress-popular-posts'); ?></option>
36 <option value="monthly" <?php if ('monthly' == $instance['range'] || 'last30days' == $instance['range'] ) { echo 'selected="selected"'; } ?>><?php esc_html_e('Last 30 days', 'wordpress-popular-posts'); ?></option>
37 <option value="all" <?php if ('all' == $instance['range'] ) { echo 'selected="selected"'; } ?>><?php esc_html_e('All-time', 'wordpress-popular-posts'); ?></option>
38 <option value="custom" <?php if ('custom' == $instance['range'] ) { echo 'selected="selected"'; } ?>><?php esc_html_e('Custom', 'wordpress-popular-posts'); ?></option>
39 </select><br />
40
41 <div style="display: <?php echo ('custom' == $instance['range'] ) ? 'block' : 'none'; ?>">
42 <input type="text" id="<?php echo esc_attr($this->get_field_id('time_quantity')); ?>" name="<?php echo esc_attr($this->get_field_name('time_quantity')); ?>" value="<?php echo esc_attr($instance['time_quantity']); ?>" style="display: inline; float: left; width: 50px!important;" />
43
44 <select id="<?php echo esc_attr($this->get_field_id('time_unit')); ?>" name="<?php echo esc_attr($this->get_field_name('time_unit')); ?>" style="margin-bottom: 5px;">
45 <option <?php if ($instance['time_unit'] == 'minute') { ?>selected="selected"<?php } ?> value="minute"><?php esc_html_e('Minute(s)', 'wordpress-popular-posts'); ?></option>
46 <option <?php if ($instance['time_unit'] == 'hour') { ?>selected="selected"<?php } ?> value="hour"><?php esc_html_e('Hour(s)', 'wordpress-popular-posts'); ?></option>
47 <option <?php if ($instance['time_unit'] == 'day') { ?>selected="selected"<?php } ?> value="day"><?php esc_html_e('Day(s)', 'wordpress-popular-posts'); ?></option>
48 </select>
49 </div>
50 <div class="clearfix"></div>
51
52 <input type="checkbox" class="checkbox" <?php echo ($instance['freshness']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('freshness')); ?>" name="<?php echo esc_attr($this->get_field_name('freshness')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('freshness')); ?>"><small><?php esc_html_e('Display only posts published within the selected Time Range', 'wordpress-popular-posts'); ?></small></label><br /><br />
53
54 <label for="<?php echo esc_attr($this->get_field_id('post_type')); ?>"><?php esc_html_e('Post type(s)', 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#what-is-post-type-for" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small>
55 <input type="text" id="<?php echo esc_attr($this->get_field_id('post_type')); ?>" name="<?php echo esc_attr($this->get_field_name('post_type')); ?>" value="<?php echo esc_attr($instance['post_type']); ?>" class="widefat" /><br /><br />
56
57 <label for="<?php echo esc_attr($this->get_field_id('pid')); ?>"><?php esc_html_e('Post ID(s) to exclude', 'wordpress-popular-posts'); ?>:</label>
58 <input type="text" id="<?php echo esc_attr($this->get_field_id('pid')); ?>" name="<?php echo esc_attr($this->get_field_name('pid')); ?>" value="<?php echo esc_attr($instance['pid']); ?>" class="widefat" /><br /><br />
59
60 <label for="<?php echo esc_attr($this->get_field_id('tax_id')); ?>"><?php esc_html_e('Taxonomy', 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#what-is-taxonomy-for" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small><br style="margin-bottom: 0.5rem" />
61 <?php
62 $selected_taxonomies = explode(';', $instance['taxonomy']);
63 $selected_terms = explode(';', $instance['term_id']);
64 $tax_filter = [];
65
66 if ( ! empty($selected_taxonomies) ) {
67 foreach( $selected_taxonomies as $index => $selected_taxonomy ) {
68 if ( isset($selected_terms[$index]) ) {
69 $tax_filter[$selected_taxonomy] = $selected_terms[$index];
70 }
71 }
72 }
73
74 // Taxonomy filter
75 $_taxonomies = get_taxonomies(['public' => true], 'objects');
76
77 if ( $_taxonomies ) {
78 foreach ( $_taxonomies as $_taxonomy ) {
79 if ( 'post_format' == $_taxonomy->name ) {
80 continue;
81 }
82 echo '<label><input type="checkbox" name="' . esc_attr($this->get_field_name('taxonomy')) . '[names][]" value="' . esc_attr($_taxonomy->name) . '"' . ( isset($tax_filter[$_taxonomy->name]) ? ' checked' : '') . '> ' . esc_html($_taxonomy->labels->singular_name) . ' <small>(' . esc_html($_taxonomy->name) . ')</small></label><br>';
83 echo '<input type="text" name="' . esc_attr($this->get_field_name('taxonomy')) . '[terms][' . esc_attr($_taxonomy->name) . ']" value="' . ( isset($tax_filter[$_taxonomy->name]) ? esc_attr($tax_filter[$_taxonomy->name]) : '') . '" class="widefat" style="margin-top: 4px;" /><br />';
84 /* translators: %s here represents the singular name of the taxonomy (eg. Category) */
85 $taxonomy_instructions = __('%s IDs, separated by comma (prefix a minus sign to exclude)', 'wordpress-popular-posts');
86 echo '<small>' . sprintf($taxonomy_instructions, esc_html($_taxonomy->labels->singular_name)) . '</small><br /><br />';
87 }
88 }
89 ?>
90
91 <label for="<?php echo esc_attr($this->get_field_id('uid')); ?>"><?php esc_html_e('Author ID(s)', 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#what-is-author-ids-for" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small>
92 <input type="text" id="<?php echo esc_attr($this->get_field_id('uid')); ?>" name="<?php echo esc_attr($this->get_field_name('uid')); ?>" value="<?php echo esc_attr($instance['author']); ?>" class="widefat" /><br /><br />
93
94 <!-- Post features -->
95 <br /><hr /><br />
96
97 <legend><strong><?php esc_html_e('Posts settings', 'wordpress-popular-posts'); ?></strong></legend>
98 <br />
99
100 <div style="display:<?php if ( function_exists('the_ratings_results') ) : ?>block<?php else: ?>none<?php endif; ?>;">
101 <input type="checkbox" class="checkbox" <?php echo ($instance['rating']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('rating')); ?>" name="<?php echo esc_attr($this->get_field_name('rating')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('rating')); ?>"><?php esc_html_e('Display post rating', 'wordpress-popular-posts'); ?></label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#what-does-display-post-rating-do" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small>
102 </div>
103
104 <input type="checkbox" class="checkbox" <?php echo ($instance['shorten_title']['active']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('shorten_title-active')); ?>" name="<?php echo esc_attr($this->get_field_name('shorten_title-active')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('shorten_title-active')); ?>"><?php esc_html_e('Shorten title', 'wordpress-popular-posts'); ?></label><br />
105
106 <div style="display:<?php if ($instance['shorten_title']['active']) : ?>block<?php else: ?>none<?php endif; ?>; width:90%; margin:10px 0; padding:3% 5%; background:#f5f5f5;">
107 <label for="<?php echo esc_attr($this->get_field_id('shorten_title-length')); ?>"><?php esc_html_e('Shorten title to', 'wordpress-popular-posts'); ?> <input type="text" id="<?php echo esc_attr($this->get_field_id('shorten_title-length')); ?>" name="<?php echo esc_attr($this->get_field_name('shorten_title-length')); ?>" value="<?php echo esc_attr($instance['shorten_title']['length']); ?>" class="widefat" style="width:50px!important" /></label><br />
108 <label><input type="radio" name="<?php echo esc_attr($this->get_field_name('shorten_title-words')); ?>" value="0" <?php echo (! isset($instance['shorten_title']['words']) || ! $instance['shorten_title']['words']) ? 'checked="checked"' : ''; ?> /> <?php esc_html_e('characters', 'wordpress-popular-posts'); ?></label><br />
109 <label><input type="radio" name="<?php echo esc_attr($this->get_field_name('shorten_title-words')); ?>" value="1" <?php echo (isset($instance['shorten_title']['words']) && $instance['shorten_title']['words']) ? 'checked="checked"' : ''; ?> /> <?php esc_html_e('words', 'wordpress-popular-posts'); ?></label>
110 </div>
111
112 <input type="checkbox" class="checkbox" <?php echo ($instance['post-excerpt']['active']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('post-excerpt-active')); ?>" name="<?php echo esc_attr($this->get_field_name('post-excerpt-active')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('post-excerpt-active')); ?>"><?php esc_html_e('Display post excerpt', 'wordpress-popular-posts'); ?></label><br />
113
114 <div style="display:<?php if ($instance['post-excerpt']['active']) : ?>block<?php else: ?>none<?php endif; ?>; width:90%; margin:10px 0; padding:3% 5%; background:#f5f5f5;">
115 <input type="checkbox" class="checkbox" id="<?php echo esc_attr($this->get_field_id('post-excerpt-format')); ?>" name="<?php echo esc_attr($this->get_field_name('post-excerpt-format')); ?>" <?php echo ($instance['post-excerpt']['keep_format']) ? 'checked="checked"' : ''; ?> /> <label for="<?php echo esc_attr($this->get_field_id('post-excerpt-format')); ?>"><?php esc_html_e('Keep text format and links', 'wordpress-popular-posts'); ?></label><br /><br />
116 <label for="<?php echo esc_attr($this->get_field_id('post-excerpt-length')); ?>"><?php esc_html_e('Excerpt length', 'wordpress-popular-posts'); ?>: <input type="text" id="<?php echo esc_attr($this->get_field_id('post-excerpt-length')); ?>" name="<?php echo esc_attr($this->get_field_name('post-excerpt-length')); ?>" value="<?php echo esc_attr($instance['post-excerpt']['length']); ?>" class="widefat" style="width:50px!important" /></label><br />
117
118 <label><input type="radio" name="<?php echo esc_attr($this->get_field_name('post-excerpt-words')); ?>" value="0" <?php echo (! isset($instance['post-excerpt']['words']) || ! $instance['post-excerpt']['words']) ? 'checked="checked"' : ''; ?> /> <?php esc_html_e('characters', 'wordpress-popular-posts'); ?></label><br />
119 <label><input type="radio" name="<?php echo esc_attr($this->get_field_name('post-excerpt-words')); ?>" value="1" <?php echo (isset($instance['post-excerpt']['words']) && $instance['post-excerpt']['words']) ? 'checked="checked"' : ''; ?> /> <?php esc_html_e('words', 'wordpress-popular-posts'); ?></label>
120 </div>
121
122 <input type="checkbox" class="checkbox" <?php echo ($instance['thumbnail']['active']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('thumbnail-active')); ?>" name="<?php echo esc_attr($this->get_field_name('thumbnail-active')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('thumbnail-active')); ?>"><?php esc_html_e('Display post thumbnail', 'wordpress-popular-posts'); ?></label>
123
124 <div style="display:<?php if ($instance['thumbnail']['active']) : ?>block<?php else: ?>none<?php endif; ?>; width:90%; margin:10px 0; padding:3% 5%; background:#f5f5f5;">
125 <label><input type='radio' id='thumbnail-predefined-size' name='<?php echo esc_attr($this->get_field_name('thumbnail-size-source')); ?>' value='predefined' <?php echo ($instance['thumbnail']['build'] == 'predefined') ? 'checked="checked"' : ''; ?> /><?php esc_html_e('Use predefined size', 'wordpress-popular-posts'); ?></label><br />
126
127 <select id="<?php echo esc_attr($this->get_field_id('thumbnail-size')); ?>" name="<?php echo esc_attr($this->get_field_name('thumbnail-size')); ?>" class="widefat" style="margin:5px 0;">
128 <?php
129 foreach ( $this->thumbnail->get_sizes(null) as $name => $attr ) :
130 $option_label = $name . ' (' . $attr['width'] . ' x ' . $attr['height'] . ( $attr['crop'] ? ', hard crop' : ', soft crop') . ')';
131 echo '<option value="' . esc_attr($name) . '"' . ( ($instance['thumbnail']['build'] == 'predefined' && $attr['width'] == $instance['thumbnail']['width'] && $attr['height'] == $instance['thumbnail']['height'] ) ? ' selected="selected"' : '') . '>' . esc_html($option_label) . '</option>';
132 endforeach;
133 ?>
134 </select>
135
136 <hr />
137
138 <label><input type='radio' id='thumbnail-manual-size' name='<?php echo esc_attr($this->get_field_name('thumbnail-size-source')); ?>' value='manual' <?php echo ($instance['thumbnail']['build'] == 'manual') ? 'checked="checked"' : ''; ?> /><?php esc_html_e('Set size manually', 'wordpress-popular-posts'); ?></label><br />
139
140 <label for="<?php echo esc_attr($this->get_field_id('thumbnail-width')); ?>"><?php esc_html_e('Width', 'wordpress-popular-posts'); ?>:</label>
141 <input type="text" id="<?php echo esc_attr($this->get_field_id('thumbnail-width')); ?>" name="<?php echo esc_attr($this->get_field_name('thumbnail-width')); ?>" value="<?php echo esc_attr($instance['thumbnail']['width']); ?>" class="widefat" style="margin:3px 0; width:50px!important" /> px<br />
142
143 <label for="<?php echo esc_attr($this->get_field_id('thumbnail-height')); ?>"><?php esc_html_e('Height', 'wordpress-popular-posts'); ?>:</label>
144 <input type="text" id="<?php echo esc_attr($this->get_field_id('thumbnail-height')); ?>" name="<?php echo esc_attr($this->get_field_name('thumbnail-height')); ?>" value="<?php echo esc_attr($instance['thumbnail']['height']); ?>" class="widefat" style="width:50px!important" /> px
145 </div><br />
146
147 <!-- Stats tag options -->
148 <br /><hr /><br />
149
150 <legend><strong><?php esc_html_e('Stats Tag settings', 'wordpress-popular-posts'); ?></strong></legend><br />
151
152 <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['comment_count']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('comment_count')); ?>" name="<?php echo esc_attr($this->get_field_name('comment_count')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('comment_count')); ?>"><?php esc_html_e('Display comment count', 'wordpress-popular-posts'); ?></label><br />
153
154 <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['views']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('views')); ?>" name="<?php echo esc_attr($this->get_field_name('views')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('views')); ?>"><?php esc_html_e('Display views', 'wordpress-popular-posts'); ?></label><br />
155
156 <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['author']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('author')); ?>" name="<?php echo esc_attr($this->get_field_name('author')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('author')); ?>"><?php esc_html_e('Display author', 'wordpress-popular-posts'); ?></label><br />
157
158 <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['date']['active']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('date')); ?>" name="<?php echo esc_attr($this->get_field_name('date')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('date')); ?>"><?php esc_html_e('Display date', 'wordpress-popular-posts'); ?></label><br />
159
160 <div style="display:<?php if ($instance['stats_tag']['date']['active']) : ?>block<?php else: ?>none<?php endif; ?>; width:90%; margin:10px 0; padding:3% 5%; background:#f5f5f5;">
161 <legend><strong><?php esc_html_e('Date Format', 'wordpress-popular-posts'); ?></strong></legend><br />
162
163 <label title='m/d/Y'><input type='radio' name='<?php echo esc_attr($this->get_field_name('date_format')); ?>' value='relative' <?php echo ($instance['stats_tag']['date']['format'] == 'relative') ? 'checked="checked"' : ''; ?> /><?php esc_html_e('Relative', 'wordpress-popular-posts'); ?></label><br />
164 <label title='<?php echo esc_attr(get_option('date_format')); ?>'><input type='radio' name='<?php echo esc_attr($this->get_field_name('date_format')); ?>' value='wp_date_format' <?php echo ($instance['stats_tag']['date']['format'] == 'wp_date_format') ? 'checked="checked"' : ''; ?> /><?php echo esc_html(date_i18n(get_option('date_format'), time())); ?></label> <small>(<a href="<?php echo esc_url(admin_url('options-general.php')); ?>" title="<?php esc_attr_e('WordPress Date Format', 'wordpress-popular-posts'); ?>" target="_blank"><?php esc_html_e('WordPress Date Format', 'wordpress-popular-posts'); ?></a>)</small><br />
165 <label title='F j, Y'><input type='radio' name='<?php echo esc_attr($this->get_field_name('date_format')); ?>' value='F j, Y' <?php echo ($instance['stats_tag']['date']['format'] == 'F j, Y') ? 'checked="checked"' : ''; ?> /><?php echo esc_html(date_i18n('F j, Y', time())); ?></label><br />
166 <label title='Y/m/d'><input type='radio' name='<?php echo esc_attr($this->get_field_name('date_format')); ?>' value='Y/m/d' <?php echo ($instance['stats_tag']['date']['format'] == 'Y/m/d') ? 'checked="checked"' : ''; ?> /><?php echo esc_html(date_i18n('Y/m/d', time())); ?></label><br />
167 <label title='m/d/Y'><input type='radio' name='<?php echo esc_attr($this->get_field_name('date_format')); ?>' value='m/d/Y' <?php echo ($instance['stats_tag']['date']['format'] == 'm/d/Y') ? 'checked="checked"' : ''; ?> /><?php echo esc_html(date_i18n('m/d/Y', time())); ?></label><br />
168 <label title='d/m/Y'><input type='radio' name='<?php echo esc_attr($this->get_field_name('date_format')); ?>' value='d/m/Y' <?php echo ($instance['stats_tag']['date']['format'] == 'd/m/Y') ? 'checked="checked"' : ''; ?> /><?php echo esc_html(date_i18n('d/m/Y', time())); ?></label>
169 </div>
170
171 <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['taxonomy']['active'] || $instance['stats_tag']['category']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('stats_taxonomy')); ?>" name="<?php echo esc_attr($this->get_field_name('stats_taxonomy')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('stats_taxonomy')); ?>"><?php esc_html_e('Display taxonomy', 'wordpress-popular-posts'); ?></label><br />
172 <?php
173 if ( $_taxonomies ) {
174 ?>
175 <div style="display:<?php if ($instance['stats_tag']['taxonomy']['active'] || $instance['stats_tag']['category']) : ?>block<?php else: ?>none<?php endif; ?>; width:90%; margin:10px 0; padding:3% 5%; background:#f5f5f5;">
176 <?php
177 foreach ( $_taxonomies as $_taxonomy ) {
178 if ('post_format' == $_taxonomy->name ) {
179 continue;
180 }
181
182 echo '<label><input type="radio" name="' . esc_attr($this->get_field_name('stats_taxonomy_name')) . '" value="' . esc_attr($_taxonomy->name) . '"' . ( ( $instance['stats_tag']['taxonomy']['name'] == $_taxonomy->name ) ? ' checked' : '') . '> ' . esc_html($_taxonomy->labels->singular_name) . '</label><br>';
183 }
184 ?>
185 </div>
186 <?php
187 }
188 ?>
189
190 <!-- HTML Markup options -->
191 <br /><hr /><br />
192
193 <legend><strong><?php esc_html_e('HTML Markup settings', 'wordpress-popular-posts'); ?></strong></legend><br />
194
195 <input type="checkbox" class="checkbox" <?php echo ($instance['markup']['custom_html']) ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr($this->get_field_id('custom_html')); ?>" name="<?php echo esc_attr($this->get_field_name('custom_html')); ?>" /> <label for="<?php echo esc_attr($this->get_field_id('custom_html')); ?>"><?php esc_html_e('Use custom HTML Markup', 'wordpress-popular-posts'); ?></label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#what-does-use-custom-html-markup-do" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small><br />
196
197 <div style="display:<?php if ($instance['markup']['custom_html']) : ?>block<?php else: ?>none<?php endif; ?>; width:90%; margin:10px 0; padding:3% 5%; background:#f5f5f5;">
198 <?php
199 if (
200 $current_sidebar
201 && ! $instance['markup']['custom_html']
202 ) {
203 $wpp_title_start = htmlspecialchars($current_sidebar_data['before_title'], ENT_QUOTES);
204 $wpp_title_end = htmlspecialchars($current_sidebar_data['after_title'], ENT_QUOTES);
205 } else {
206 $wpp_title_start = $instance['markup']['title-start'];
207 $wpp_title_end = $instance['markup']['title-end'];
208 }
209 ?>
210 <p style="font-size:11px"><label for="<?php echo esc_attr($this->get_field_id('title-start')); ?>"><?php esc_html_e('Before / after title', 'wordpress-popular-posts'); ?>:</label> <br />
211 <input type="text" id="<?php echo esc_attr($this->get_field_id('title-start')); ?>" name="<?php echo esc_attr($this->get_field_name('title-start')); ?>" value="<?php echo esc_attr($wpp_title_start); ?>" class="widefat" style="width:49%!important" /> <input type="text" id="<?php echo esc_attr($this->get_field_id('title-end')); ?>" name="<?php echo esc_attr($this->get_field_name('title-end')); ?>" value="<?php echo esc_attr($wpp_title_end); ?>" class="widefat" style="width:49%!important" /></p>
212
213 <p style="font-size:11px"><label for="<?php echo esc_attr($this->get_field_id('wpp-start')); ?>"><?php esc_html_e('Before / after Popular Posts', 'wordpress-popular-posts'); ?>:</label> <br />
214 <input type="text" id="<?php echo esc_attr($this->get_field_id('wpp-start')); ?>" name="<?php echo esc_attr($this->get_field_name('wpp-start')); ?>" value="<?php echo esc_attr($instance['markup']['wpp-start']); ?>" class="widefat" style="width:49%!important" /> <input type="text" id="<?php echo esc_attr($this->get_field_id('wpp-end')); ?>" name="<?php echo esc_attr($this->get_field_name('wpp-end')); ?>" value="<?php echo esc_attr($instance['markup']['wpp-end']); ?>" class="widefat" style="width:49%!important" /></p>
215
216 <p style="font-size:11px"><label for="<?php echo esc_attr($this->get_field_id('post-html')); ?>"><?php esc_html_e('Post HTML Markup', 'wordpress-popular-posts'); ?>:</label> <br />
217 <textarea class="widefat" rows="10" id="<?php echo esc_attr($this->get_field_id('post-html')); ?>" name="<?php echo esc_attr($this->get_field_name('post-html')); ?>"><?php echo $instance['markup']['post-html']; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This has been already sanitized/escaped at this point ?></textarea>
218 </div>
219
220 <!-- Theme -->
221 <br /><hr /><br />
222
223 <legend style="display: inline;"><strong><?php esc_html_e('Theme', 'wordpress-popular-posts'); ?></strong></legend><small>(<?php printf(__('see a <a href="%s">list of supported browsers</a>'), 'https://caniuse.com/#feat=shadowdomv1'); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>)</small><br /><br />
224
225 <?php
226 $registered_themes = $this->themer->get_themes();
227 ksort($registered_themes);
228 ?>
229
230 <select id="<?php echo esc_attr($this->get_field_id('theme')); ?>" name="<?php echo esc_attr($this->get_field_name('theme')); ?>" class="widefat" style="margin-bottom: 5px;"<?php echo ( ! $current_sidebar ) ? ' disabled="disabled"' : ''; ?>>
231 <option value="" <?php if ( '' == $instance['theme']['name'] || ! $current_sidebar ) { echo 'selected="selected"'; } ?>><?php esc_html_e('None', 'wordpress-popular-posts'); ?></option>
232 <?php foreach ($registered_themes as $theme => $data) : ?>
233 <option value="<?php echo esc_attr($theme); ?>" <?php if ( $theme == $instance['theme']['name'] && $current_sidebar ) { echo 'selected="selected"'; } ?>><?php echo esc_html($data['json']['name']); ?></option>
234 <?php endforeach; ?>
235 </select>
236 <input type="hidden" id="<?php echo esc_attr($this->get_field_id('theme-applied')); ?>" name="<?php echo esc_attr($this->get_field_name('theme-applied')); ?>" value="<?php echo ($instance['theme']['applied'] && $current_sidebar) ? 1 : 0; ?>" />
237
238 <?php if ( ! $current_sidebar ) : ?>
239 <p style="color: red;"><?php esc_html_e('Please save this widget (or reload this page) to enable WPP themes.', 'wordpress-popular-posts'); ?></p>
240 <?php endif; ?>
241
242 <br /><br />
243