form.php
238 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 $this->get_field_id('title'); ?>"><?php _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 _e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small> <br /> |
| 8 | <input type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" class="widefat" /> |
| 9 | </p> |
| 10 | |
| 11 | <!-- Limit --> |
| 12 | <p> |
| 13 | <label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Show up to', 'wordpress-popular-posts'); ?>:</label><br /> |
| 14 | <input type="text" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" value="<?php echo $instance['limit']; ?>" class="widefat" style="width:50px!important" /> <?php _e('posts', 'wordpress-popular-posts'); ?> |
| 15 | </p> |
| 16 | |
| 17 | <!-- Order by --> |
| 18 | <p> |
| 19 | <label for="<?php echo $this->get_field_id('order_by'); ?>"><?php _e('Sort posts by', 'wordpress-popular-posts'); ?>:</label><br /> |
| 20 | <select id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>" class="widefat"> |
| 21 | <option value="comments" <?php if ('comments' == $instance['order_by'] ) echo 'selected="selected"'; ?>><?php _e('Comments', 'wordpress-popular-posts'); ?></option> |
| 22 | <option value="views" <?php if ('views' == $instance['order_by'] ) echo 'selected="selected"'; ?>><?php _e('Total views', 'wordpress-popular-posts'); ?></option> |
| 23 | <option value="avg" <?php if ('avg' == $instance['order_by'] ) echo 'selected="selected"'; ?>><?php _e('Avg. daily views', 'wordpress-popular-posts'); ?></option> |
| 24 | </select> |
| 25 | </p> |
| 26 | |
| 27 | <!-- Filters --> |
| 28 | <br /><hr /><br /> |
| 29 | |
| 30 | <legend><strong><?php _e('Filters', 'wordpress-popular-posts'); ?></strong></legend><br /> |
| 31 | |
| 32 | <label for="<?php echo $this->get_field_id('range'); ?>"><?php _e('Time Range', 'wordpress-popular-posts'); ?>:</label><br /> |
| 33 | <select id="<?php echo $this->get_field_id('range'); ?>" name="<?php echo $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 _e('Last 24 hours', 'wordpress-popular-posts'); ?></option> |
| 35 | <option value="weekly" <?php if ('weekly' == $instance['range'] || 'last7days' == $instance['range'] ) echo 'selected="selected"'; ?>><?php _e('Last 7 days', 'wordpress-popular-posts'); ?></option> |
| 36 | <option value="monthly" <?php if ('monthly' == $instance['range'] || 'last30days' == $instance['range'] ) echo 'selected="selected"'; ?>><?php _e('Last 30 days', 'wordpress-popular-posts'); ?></option> |
| 37 | <option value="all" <?php if ('all' == $instance['range'] ) echo 'selected="selected"'; ?>><?php _e('All-time', 'wordpress-popular-posts'); ?></option> |
| 38 | <option value="custom" <?php if ('custom' == $instance['range'] ) echo 'selected="selected"'; ?>><?php _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 $this->get_field_id('time_quantity'); ?>" name="<?php echo $this->get_field_name('time_quantity'); ?>" value="<?php echo $instance['time_quantity']; ?>" style="display: inline; float: left; width: 50px!important;" /> |
| 43 | |
| 44 | <select id="<?php echo $this->get_field_id('time_unit'); ?>" name="<?php echo $this->get_field_name('time_unit'); ?>" style="margin-bottom: 5px;"> |
| 45 | <option <?php if ($instance['time_unit'] == "minute") {?>selected="selected"<?php } ?> value="minute"><?php _e("Minute(s)", 'wordpress-popular-posts'); ?></option> |
| 46 | <option <?php if ($instance['time_unit'] == "hour") {?>selected="selected"<?php } ?> value="hour"><?php _e("Hour(s)", 'wordpress-popular-posts'); ?></option> |
| 47 | <option <?php if ($instance['time_unit'] == "day") {?>selected="selected"<?php } ?> value="day"><?php _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 $this->get_field_id('freshness'); ?>" name="<?php echo $this->get_field_name('freshness'); ?>" /> <label for="<?php echo $this->get_field_id('freshness'); ?>"><small><?php _e('Display only posts published within the selected Time Range', 'wordpress-popular-posts'); ?></small></label><br /><br /> |
| 53 | |
| 54 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _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 _e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small> |
| 55 | <input type="text" id="<?php echo $this->get_field_id('post_type'); ?>" name="<?php echo $this->get_field_name('post_type'); ?>" value="<?php echo $instance['post_type']; ?>" class="widefat" /><br /><br /> |
| 56 | |
| 57 | <label for="<?php echo $this->get_field_id('pid'); ?>"><?php _e('Post ID(s) to exclude', 'wordpress-popular-posts'); ?>:</label> |
| 58 | <input type="text" id="<?php echo $this->get_field_id('pid'); ?>" name="<?php echo $this->get_field_name('pid'); ?>" value="<?php echo $instance['pid']; ?>" class="widefat" /><br /><br /> |
| 59 | |
| 60 | <label for="<?php echo $this->get_field_id('tax_id'); ?>"><?php _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 _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 | if ( $taxonomies = get_taxonomies(['public' => true], 'objects') ) { |
| 76 | foreach ( $taxonomies as $taxonomy ) { |
| 77 | if ( 'post_format' == $taxonomy->name ) |
| 78 | continue; |
| 79 | echo '<label><input type="checkbox" name="' . $this->get_field_name('taxonomy') . '[names][]" value="' . $taxonomy->name . '"' . ( isset($tax_filter[$taxonomy->name]) ? ' checked' : '') . '> ' . $taxonomy->labels->singular_name . ' <small>('. $taxonomy->name .')</small></label><br>'; |
| 80 | echo '<input type="text" name="' . $this->get_field_name('taxonomy') . '[terms][' . $taxonomy->name . ']" value="' . ( isset($tax_filter[$taxonomy->name]) ? esc_attr($tax_filter[$taxonomy->name]) : '') . '" class="widefat" style="margin-top: 4px;" /><br />'; |
| 81 | /* translators: %s here represents the singular name of the taxonomy (eg. Category) */ |
| 82 | $taxonomy_instructions = __('%s IDs, separated by comma (prefix a minus sign to exclude)', 'wordpress-popular-posts'); |
| 83 | echo '<small>' . sprintf($taxonomy_instructions, $taxonomy->labels->singular_name) . '</small><br /><br />'; |
| 84 | } |
| 85 | } |
| 86 | ?> |
| 87 | |
| 88 | <label for="<?php echo $this->get_field_id('uid'); ?>"><?php _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 _e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small> |
| 89 | <input type="text" id="<?php echo $this->get_field_id('uid'); ?>" name="<?php echo $this->get_field_name('uid'); ?>" value="<?php echo $instance['author']; ?>" class="widefat" /><br /><br /> |
| 90 | |
| 91 | <!-- Post features --> |
| 92 | <br /><hr /><br /> |
| 93 | |
| 94 | <legend><strong><?php _e('Posts settings', 'wordpress-popular-posts'); ?></strong></legend> |
| 95 | <br /> |
| 96 | |
| 97 | <div style="display:<?php if ( function_exists('the_ratings_results') ) : ?>block<?php else: ?>none<?php endif; ?>;"> |
| 98 | <input type="checkbox" class="checkbox" <?php echo ($instance['rating']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('rating'); ?>" name="<?php echo $this->get_field_name('rating'); ?>" /> <label for="<?php echo $this->get_field_id('rating'); ?>"><?php _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 _e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small> |
| 99 | </div> |
| 100 | |
| 101 | <input type="checkbox" class="checkbox" <?php echo ($instance['shorten_title']['active']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('shorten_title-active'); ?>" name="<?php echo $this->get_field_name('shorten_title-active'); ?>" /> <label for="<?php echo $this->get_field_id('shorten_title-active'); ?>"><?php _e('Shorten title', 'wordpress-popular-posts'); ?></label><br /> |
| 102 | |
| 103 | <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;"> |
| 104 | <label for="<?php echo $this->get_field_id('shorten_title-length'); ?>"><?php _e('Shorten title to', 'wordpress-popular-posts'); ?> <input type="text" id="<?php echo $this->get_field_id('shorten_title-length'); ?>" name="<?php echo $this->get_field_name('shorten_title-length'); ?>" value="<?php echo $instance['shorten_title']['length']; ?>" class="widefat" style="width:50px!important" /></label><br /> |
| 105 | <label><input type="radio" name="<?php echo $this->get_field_name('shorten_title-words'); ?>" value="0" <?php echo (!isset($instance['shorten_title']['words']) || !$instance['shorten_title']['words']) ? 'checked="checked"' : ''; ?> /> <?php _e('characters', 'wordpress-popular-posts'); ?></label><br /> |
| 106 | <label><input type="radio" name="<?php echo $this->get_field_name('shorten_title-words'); ?>" value="1" <?php echo (isset($instance['shorten_title']['words']) && $instance['shorten_title']['words']) ? 'checked="checked"' : ''; ?> /> <?php _e('words', 'wordpress-popular-posts'); ?></label> |
| 107 | </div> |
| 108 | |
| 109 | <input type="checkbox" class="checkbox" <?php echo ($instance['post-excerpt']['active']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('post-excerpt-active'); ?>" name="<?php echo $this->get_field_name('post-excerpt-active'); ?>" /> <label for="<?php echo $this->get_field_id('post-excerpt-active'); ?>"><?php _e('Display post excerpt', 'wordpress-popular-posts'); ?></label><br /> |
| 110 | |
| 111 | <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;"> |
| 112 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('post-excerpt-format'); ?>" name="<?php echo $this->get_field_name('post-excerpt-format'); ?>" <?php echo ($instance['post-excerpt']['keep_format']) ? 'checked="checked"' : ''; ?> /> <label for="<?php echo $this->get_field_id('post-excerpt-format'); ?>"><?php _e('Keep text format and links', 'wordpress-popular-posts'); ?></label><br /><br /> |
| 113 | <label for="<?php echo $this->get_field_id('post-excerpt-length'); ?>"><?php _e('Excerpt length', 'wordpress-popular-posts'); ?>: <input type="text" id="<?php echo $this->get_field_id('post-excerpt-length'); ?>" name="<?php echo $this->get_field_name('post-excerpt-length'); ?>" value="<?php echo $instance['post-excerpt']['length']; ?>" class="widefat" style="width:50px!important" /></label><br /> |
| 114 | |
| 115 | <label><input type="radio" name="<?php echo $this->get_field_name('post-excerpt-words'); ?>" value="0" <?php echo (!isset($instance['post-excerpt']['words']) || !$instance['post-excerpt']['words']) ? 'checked="checked"' : ''; ?> /> <?php _e('characters', 'wordpress-popular-posts'); ?></label><br /> |
| 116 | <label><input type="radio" name="<?php echo $this->get_field_name('post-excerpt-words'); ?>" value="1" <?php echo (isset($instance['post-excerpt']['words']) && $instance['post-excerpt']['words']) ? 'checked="checked"' : ''; ?> /> <?php _e('words', 'wordpress-popular-posts'); ?></label> |
| 117 | </div> |
| 118 | |
| 119 | <input type="checkbox" class="checkbox" <?php echo ($instance['thumbnail']['active']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('thumbnail-active'); ?>" name="<?php echo $this->get_field_name('thumbnail-active'); ?>" /> <label for="<?php echo $this->get_field_id('thumbnail-active'); ?>"><?php _e('Display post thumbnail', 'wordpress-popular-posts'); ?></label> |
| 120 | |
| 121 | <div style="display:<?php if ($instance['thumbnail']['active']) : ?>block<?php else: ?>none<?php endif; ?>; width:90%; margin:10px 0; padding:3% 5%; background:#f5f5f5;"> |
| 122 | <label><input type='radio' id='thumbnail-predefined-size' name='<?php echo $this->get_field_name('thumbnail-size-source'); ?>' value='predefined' <?php echo ($instance['thumbnail']['build'] == 'predefined') ? 'checked="checked"' : ''; ?> /><?php _e('Use predefined size', 'wordpress-popular-posts'); ?></label><br /> |
| 123 | |
| 124 | <select id="<?php echo $this->get_field_id('thumbnail-size'); ?>" name="<?php echo $this->get_field_name('thumbnail-size'); ?>" class="widefat" style="margin:5px 0;"> |
| 125 | <?php |
| 126 | foreach ( $this->thumbnail->get_sizes() as $name => $attr ) : |
| 127 | echo '<option value="' . $name . '"' . ( ($instance['thumbnail']['build'] == 'predefined' && $attr['width'] == $instance['thumbnail']['width'] && $attr['height'] == $instance['thumbnail']['height'] ) ? ' selected="selected"' : '') . '>' . $name . ' (' . $attr['width'] . ' x ' . $attr['height'] . ( $attr['crop'] ? ', hard crop' : ', soft crop') . ')</option>'; |
| 128 | endforeach; |
| 129 | ?> |
| 130 | </select> |
| 131 | |
| 132 | <hr /> |
| 133 | |
| 134 | <label><input type='radio' id='thumbnail-manual-size' name='<?php echo $this->get_field_name('thumbnail-size-source'); ?>' value='manual' <?php echo ($instance['thumbnail']['build'] == 'manual') ? 'checked="checked"' : ''; ?> /><?php _e('Set size manually', 'wordpress-popular-posts'); ?></label><br /> |
| 135 | |
| 136 | <label for="<?php echo $this->get_field_id('thumbnail-width'); ?>"><?php _e('Width', 'wordpress-popular-posts'); ?>:</label> |
| 137 | <input type="text" id="<?php echo $this->get_field_id('thumbnail-width'); ?>" name="<?php echo $this->get_field_name('thumbnail-width'); ?>" value="<?php echo $instance['thumbnail']['width']; ?>" class="widefat" style="margin:3px 0; width:50px!important" /> px<br /> |
| 138 | |
| 139 | <label for="<?php echo $this->get_field_id('thumbnail-height'); ?>"><?php _e('Height', 'wordpress-popular-posts'); ?>:</label> |
| 140 | <input type="text" id="<?php echo $this->get_field_id('thumbnail-height'); ?>" name="<?php echo $this->get_field_name('thumbnail-height'); ?>" value="<?php echo $instance['thumbnail']['height']; ?>" class="widefat" style="width:50px!important" /> px |
| 141 | </div><br /> |
| 142 | |
| 143 | <!-- Stats tag options --> |
| 144 | <br /><hr /><br /> |
| 145 | |
| 146 | <legend><strong><?php _e('Stats Tag settings', 'wordpress-popular-posts'); ?></strong></legend><br /> |
| 147 | |
| 148 | <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['comment_count']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('comment_count'); ?>" name="<?php echo $this->get_field_name('comment_count'); ?>" /> <label for="<?php echo $this->get_field_id('comment_count'); ?>"><?php _e('Display comment count', 'wordpress-popular-posts'); ?></label><br /> |
| 149 | |
| 150 | <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['views']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('views'); ?>" name="<?php echo $this->get_field_name('views'); ?>" /> <label for="<?php echo $this->get_field_id('views'); ?>"><?php _e('Display views', 'wordpress-popular-posts'); ?></label><br /> |
| 151 | |
| 152 | <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['author']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('author'); ?>" name="<?php echo $this->get_field_name('author'); ?>" /> <label for="<?php echo $this->get_field_id('author'); ?>"><?php _e('Display author', 'wordpress-popular-posts'); ?></label><br /> |
| 153 | |
| 154 | <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['date']['active']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('date'); ?>" name="<?php echo $this->get_field_name('date'); ?>" /> <label for="<?php echo $this->get_field_id('date'); ?>"><?php _e('Display date', 'wordpress-popular-posts'); ?></label><br /> |
| 155 | |
| 156 | <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;"> |
| 157 | <legend><strong><?php _e('Date Format', 'wordpress-popular-posts'); ?></strong></legend><br /> |
| 158 | |
| 159 | <label title='m/d/Y'><input type='radio' name='<?php echo $this->get_field_name('date_format'); ?>' value='relative' <?php echo ($instance['stats_tag']['date']['format'] == 'relative') ? 'checked="checked"' : ''; ?> /><?php _e('Relative', 'wordpress-popular-posts'); ?></label><br /> |
| 160 | <label title='<?php echo get_option('date_format'); ?>'><input type='radio' name='<?php echo $this->get_field_name('date_format'); ?>' value='<?php echo get_option('date_format'); ?>' <?php echo ($instance['stats_tag']['date']['format'] == get_option('date_format')) ? 'checked="checked"' : ''; ?> /><?php echo date_i18n(get_option('date_format'), time()); ?></label> <small>(<a href="<?php echo admin_url('options-general.php'); ?>" title="<?php _e('WordPress Date Format', 'wordpress-popular-posts'); ?>" target="_blank"><?php _e('WordPress Date Format', 'wordpress-popular-posts'); ?></a>)</small><br /> |
| 161 | <label title='F j, Y'><input type='radio' name='<?php echo $this->get_field_name('date_format'); ?>' value='F j, Y' <?php echo ($instance['stats_tag']['date']['format'] == 'F j, Y') ? 'checked="checked"' : ''; ?> /><?php echo date_i18n('F j, Y', time()); ?></label><br /> |
| 162 | <label title='Y/m/d'><input type='radio' name='<?php echo $this->get_field_name('date_format'); ?>' value='Y/m/d' <?php echo ($instance['stats_tag']['date']['format'] == 'Y/m/d') ? 'checked="checked"' : ''; ?> /><?php echo date_i18n('Y/m/d', time()); ?></label><br /> |
| 163 | <label title='m/d/Y'><input type='radio' name='<?php echo $this->get_field_name('date_format'); ?>' value='m/d/Y' <?php echo ($instance['stats_tag']['date']['format'] == 'm/d/Y') ? 'checked="checked"' : ''; ?> /><?php echo date_i18n('m/d/Y', time()); ?></label><br /> |
| 164 | <label title='d/m/Y'><input type='radio' name='<?php echo $this->get_field_name('date_format'); ?>' value='d/m/Y' <?php echo ($instance['stats_tag']['date']['format'] == 'd/m/Y') ? 'checked="checked"' : ''; ?> /><?php echo date_i18n('d/m/Y', time()); ?></label> |
| 165 | </div> |
| 166 | |
| 167 | <input type="checkbox" class="checkbox" <?php echo ($instance['stats_tag']['taxonomy']['active'] || $instance['stats_tag']['category']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('stats_taxonomy'); ?>" name="<?php echo $this->get_field_name('stats_taxonomy'); ?>" /> <label for="<?php echo $this->get_field_id('stats_taxonomy'); ?>"><?php _e('Display taxonomy', 'wordpress-popular-posts'); ?></label><br /> |
| 168 | <?php |
| 169 | if ( $taxonomies ) { |
| 170 | ?> |
| 171 | <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;"> |
| 172 | <?php |
| 173 | foreach ( $taxonomies as $taxonomy ) { |
| 174 | if ('post_format' == $taxonomy->name ) |
| 175 | continue; |
| 176 | |
| 177 | echo '<label><input type="radio" name="' . $this->get_field_name('stats_taxonomy_name') . '" value="' . $taxonomy->name . '"' . ( ( $instance['stats_tag']['taxonomy']['name'] == $taxonomy->name ) ? ' checked' : '') . '> ' . $taxonomy->labels->singular_name . '</label><br>'; |
| 178 | } |
| 179 | ?> |
| 180 | </div> |
| 181 | <?php |
| 182 | } |
| 183 | ?> |
| 184 | |
| 185 | <!-- HTML Markup options --> |
| 186 | <br /><hr /><br /> |
| 187 | |
| 188 | <legend><strong><?php _e('HTML Markup settings', 'wordpress-popular-posts'); ?></strong></legend><br /> |
| 189 | |
| 190 | <input type="checkbox" class="checkbox" <?php echo ($instance['markup']['custom_html']) ? 'checked="checked"' : ''; ?> id="<?php echo $this->get_field_id('custom_html'); ?>" name="<?php echo $this->get_field_name('custom_html'); ?>" /> <label for="<?php echo $this->get_field_id('custom_html'); ?>"><?php _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 _e('What is this?', 'wordpress-popular-posts'); ?>" target="_blank">?</a>]</small><br /> |
| 191 | |
| 192 | <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;"> |
| 193 | <?php |
| 194 | if ( |
| 195 | $current_sidebar |
| 196 | && ! $instance['markup']['custom_html'] |
| 197 | ) { |
| 198 | $wpp_title_start = htmlspecialchars($current_sidebar_data['before_title'], ENT_QUOTES); |
| 199 | $wpp_title_end = htmlspecialchars($current_sidebar_data['after_title'], ENT_QUOTES); |
| 200 | } else { |
| 201 | $wpp_title_start = $instance['markup']['title-start']; |
| 202 | $wpp_title_end = $instance['markup']['title-end']; |
| 203 | } |
| 204 | ?> |
| 205 | <p style="font-size:11px"><label for="<?php echo $this->get_field_id('title-start'); ?>"><?php _e('Before / after title', 'wordpress-popular-posts'); ?>:</label> <br /> |
| 206 | <input type="text" id="<?php echo $this->get_field_id('title-start'); ?>" name="<?php echo $this->get_field_name('title-start'); ?>" value="<?php echo $wpp_title_start; ?>" class="widefat" style="width:49%!important" /> <input type="text" id="<?php echo $this->get_field_id('title-end'); ?>" name="<?php echo $this->get_field_name('title-end'); ?>" value="<?php echo $wpp_title_end; ?>" class="widefat" style="width:49%!important" /></p> |
| 207 | |
| 208 | <p style="font-size:11px"><label for="<?php echo $this->get_field_id('wpp-start'); ?>"><?php _e('Before / after Popular Posts', 'wordpress-popular-posts'); ?>:</label> <br /> |
| 209 | <input type="text" id="<?php echo $this->get_field_id('wpp-start'); ?>" name="<?php echo $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 $this->get_field_id('wpp-end'); ?>" name="<?php echo $this->get_field_name('wpp-end'); ?>" value="<?php echo $instance['markup']['wpp-end']; ?>" class="widefat" style="width:49%!important" /></p> |
| 210 | |
| 211 | <p style="font-size:11px"><label for="<?php echo $this->get_field_id('post-html'); ?>"><?php _e('Post HTML Markup', 'wordpress-popular-posts'); ?>:</label> <br /> |
| 212 | <textarea class="widefat" rows="10" id="<?php echo $this->get_field_id('post-html'); ?>" name="<?php echo $this->get_field_name('post-html'); ?>"><?php echo $instance['markup']['post-html']; ?></textarea> |
| 213 | </div> |
| 214 | |
| 215 | <!-- Theme --> |
| 216 | <br /><hr /><br /> |
| 217 | |
| 218 | <legend style="display: inline;"><strong><?php _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'); ?>)</small><br /><br /> |
| 219 | |
| 220 | <?php |
| 221 | $registered_themes = $this->themer->get_themes(); |
| 222 | ksort($registered_themes); |
| 223 | ?> |
| 224 | |
| 225 | <select id="<?php echo $this->get_field_id('theme'); ?>" name="<?php echo $this->get_field_name('theme'); ?>" class="widefat" style="margin-bottom: 5px;"<?php echo ( ! $current_sidebar ) ? ' disabled="disabled"' : ''; ?>> |
| 226 | <option value="" <?php if ( '' == $instance['theme']['name'] || ! $current_sidebar ) echo 'selected="selected"'; ?>><?php _e("None", 'wordpress-popular-posts'); ?></option> |
| 227 | <?php foreach ($registered_themes as $theme => $data) : ?> |
| 228 | <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> |
| 229 | <?php endforeach; ?> |
| 230 | </select> |
| 231 | <input type="hidden" id="<?php echo $this->get_field_id('theme-applied'); ?>" name="<?php echo $this->get_field_name('theme-applied'); ?>" value="<?php echo ($instance['theme']['applied'] && $current_sidebar) ? 1 : 0; ?>" /> |
| 232 | |
| 233 | <?php if ( ! $current_sidebar ) : ?> |
| 234 | <p style="color: red;"><?php _e('Please save this widget (or reload this page) to enable WPP themes.', 'wordpress-popular-posts'); ?></p> |
| 235 | <?php endif; ?> |
| 236 | |
| 237 | <br /><br /> |
| 238 |