Changeset 3071992
- Timestamp:
- 04/16/2024 11:01:59 PM (2 years ago)
- Location:
- list-custom-taxonomy-widget
- Files:
-
- 3 added
- 2 edited
-
tags/4.2 (added)
-
tags/4.2/list-custom-taxonomy-widget.php (added)
-
tags/4.2/readme.txt (added)
-
trunk/list-custom-taxonomy-widget.php (modified) (11 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
list-custom-taxonomy-widget/trunk/list-custom-taxonomy-widget.php
r1603696 r3071992 4 4 * Plugin URI: http://celloexpressions.com/plugins/list-custom-taxonomy-widget 5 5 * Description: Widget that displays category listings for custom post types (custom taxonomies). 6 * Version: 4. 16 * Version: 4.2 7 7 * Author: Nick Halsey 8 8 * Author URI: http://celloexpressions.com/ … … 12 12 13 13 ===================================================================================== 14 Copyright (C) 20 17Nick Halsey14 Copyright (C) 2024 Nick Halsey 15 15 16 16 This program is free software; you can redistribute it and/or … … 60 60 $this_taxonomy = ''; 61 61 } 62 $hierarchical = !empty( $instance['hierarchical'] ) ? '1' : '0';62 $hierarchical = !empty( $instance['hierarchical'] ) ? 1 : 0; 63 63 $inv_empty = !empty( $instance['empty'] ) ? '0' : '1'; // invert to go from UI's "show empty" to WP's "hide empty" 64 64 $showcount = !empty( $instance['count'] ) ? '1' : '0'; … … 99 99 } 100 100 // Output 101 $tax = $this_taxonomy;101 $tax = esc_html( $this_taxonomy ); 102 102 echo $before_widget; 103 103 echo '<div id="lct-widget-'.$tax.'-container" class="list-custom-taxonomy-widget">'; 104 if ( $title ) echo $before_title . $title. $after_title;104 if ( $title ) echo $before_title . esc_html( $title ) . $after_title; 105 105 if($dropdown){ 106 106 $taxonomy_object = get_taxonomy( $tax ); … … 130 130 'walker' => $walker, 131 131 ); 132 echo '<form action="'. get_bloginfo('url'). '" method="get">';133 wp_dropdown_categories( $args);132 echo '<form action="'. esc_attr( get_bloginfo('url') ) . '" method="get">'; 133 wp_dropdown_categories( $args ); 134 134 $dropdown_submit_text = apply_filters( 'list_custom_taxonomy_widget_dropdown_submit_text', __( 'go »', 'list-custom-taxonomy-widget' ) ); 135 135 echo '<input type="submit" value"' . esc_attr( $dropdown_submit_text ) . '" /></form>'; … … 163 163 ); 164 164 echo '<ul id="lct-widget-'.$tax.'">'; 165 wp_list_categories( $args);165 wp_list_categories( $args ); 166 166 echo '</ul>'; 167 167 } … … 173 173 $instance = $old_instance; 174 174 175 $instance['title'] = s trip_tags( $new_instance['title'] );176 $instance['taxonomy'] = s trip_tags( $new_instance['taxonomy'] );177 $instance['orderby'] = $new_instance['orderby'];178 $instance['ascdsc'] = $new_instance['ascdsc'];179 $instance['exclude'] = $new_instance['exclude'];180 $instance['expandoptions'] = $new_instance['expandoptions'];181 $instance['childof'] = $new_instance['childof'];175 $instance['title'] = sanitize_text_field( $new_instance['title'] ); 176 $instance['taxonomy'] = sanitize_text_field( $new_instance['taxonomy'] ); 177 $instance['orderby'] = sanitize_text_field( $new_instance['orderby'] ); 178 $instance['ascdsc'] = sanitize_text_field( $new_instance['ascdsc'] ); 179 $instance['exclude'] = sanitize_text_field( $new_instance['exclude'] ); 180 $instance['expandoptions'] = sanitize_text_field( $new_instance['expandoptions'] ); 181 $instance['childof'] = sanitize_text_field( $new_instance['childof'] ); 182 182 $instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0; 183 183 $instance['empty'] = !empty($new_instance['empty']) ? 1 : 0; … … 192 192 **/ 193 193 function form( $instance ) { 194 //for showing/hiding advanced options; wordpress moves this script to where it needs to go195 wp_enqueue_script('jquery');196 ?><script>197 jQuery(document).ready(function(){198 var status = jQuery('#<?php echo $this->get_field_id('expandoptions'); ?>').val();199 if ( status === 'expand' ) {200 jQuery('.lctw-expand-options').hide();201 jQuery('.lctw-all-options').show();202 } else {203 jQuery('.lctw-all-options').hide();204 }205 });206 function lctwExpand(id){207 jQuery('#' + id).val('expand');208 jQuery('.lctw-all-options').show(500);209 jQuery('.lctw-expand-options').hide(500);210 }211 function lctwContract(id){212 jQuery('#' + id).val('contract');213 jQuery('.lctw-all-options').hide(500);214 jQuery('.lctw-expand-options').show(500);215 }216 </script><?php217 194 // instance exist? if not set defaults 218 195 if ( $instance ) { … … 242 219 $dropdown = false; 243 220 } 221 //for showing/hiding advanced options; wordpress moves this script to where it needs to go 222 wp_enqueue_script('jquery'); 223 ?><script> 224 jQuery(document).ready(function(){ 225 var status = jQuery('#<?php echo esc_js( $expandoptions ); ?>').val(); 226 if ( status === 'expand' ) { 227 jQuery('.lctw-expand-options').hide(); 228 jQuery('.lctw-all-options').show(); 229 } else { 230 jQuery('.lctw-all-options').hide(); 231 } 232 }); 233 function lctwExpand(id){ 234 jQuery('#' + id).val('expand'); 235 jQuery('.lctw-all-options').show(500); 236 jQuery('.lctw-expand-options').hide(500); 237 } 238 function lctwContract(id){ 239 jQuery('#' + id).val('contract'); 240 jQuery('.lctw-all-options').hide(500); 241 jQuery('.lctw-expand-options').show(500); 242 } 243 </script><?php 244 244 245 245 // The widget form ?> 246 246 <p> 247 247 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'list-custom-taxonomy-widget' ); ?></label> 248 <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" class="widefat" />248 <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" class="widefat" /> 249 249 </p> 250 250 <p> … … 267 267 </select> 268 268 </p> 269 <h4 class="lctw-expand-options" ><a href="javascript:void(0)" onclick="lctwExpand('<?php echo $this->get_field_id('expandoptions'); ?>')" ><?php _e( 'More Options…', 'list-custom-taxonomy-widget' ); ?></a></h4>270 <div class="lctw-all-options" >269 <h4 class="lctw-expand-options" <?php if ( 'contract' !== $expandoptions ) { echo 'style="display:none"'; } ?>><a href="javascript:void(0)" onclick="lctwExpand('<?php echo $this->get_field_id('expandoptions'); ?>')" ><?php _e( 'More Options…', 'list-custom-taxonomy-widget' ); ?></a></h4> 270 <div class="lctw-all-options" <?php if ( 'contract' === $expandoptions ) { echo 'style="display:none"'; } ?>> 271 271 <h4 class="lctw-contract-options"><a href="javascript:void(0)" onclick="lctwContract('<?php echo $this->get_field_id('expandoptions'); ?>')" ><?php _e( 'Hide Extended Options', 'list-custom-taxonomy-widget' ); ?></a></h4> 272 272 <input type="hidden" value="<?php echo $expandoptions; ?>" id="<?php echo $this->get_field_id('expandoptions'); ?>" name="<?php echo $this->get_field_name('expandoptions'); ?>" /> … … 295 295 <p> 296 296 <label for="<?php echo $this->get_field_id('exclude'); ?>">Exclude (comma-separated list of ids to exclude)</label><br/> 297 <input type="text" class="widefat" name="<?php echo $this->get_field_name('exclude'); ?>" value="<?php echo $exclude; ?>" />297 <input type="text" class="widefat" name="<?php echo $this->get_field_name('exclude'); ?>" value="<?php echo esc_attr( $exclude ); ?>" /> 298 298 </p> 299 299 <p> 300 300 <label for="<?php echo $this->get_field_id('exclude'); ?>">Only Show Children of (category id)</label><br/> 301 <input type="text" class="widefat" name="<?php echo $this->get_field_name('childof'); ?>" value="<?php echo $childof; ?>" />301 <input type="text" class="widefat" name="<?php echo $this->get_field_name('childof'); ?>" value="<?php echo esc_attr( $childof ); ?>" /> 302 302 </p> 303 303 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>"<?php checked( $dropdown ); ?> /> -
list-custom-taxonomy-widget/trunk/readme.txt
r2968084 r3071992 3 3 Tags: custom taxonomy, custom tax, widget, sidebar, category, categories, taxonomy, custom category, custom categories, post types, custom post types, custom post type categories 4 4 Requires at least: 3.3 5 Tested up to: 6. 36 Stable tag: 4. 15 Tested up to: 6.5 6 Stable tag: 4.2 7 7 Description: Widget that list terms in a custom taxonomy (often used as categories or category types for a custom post type). 8 8 License: GPLv2 … … 29 29 30 30 == Changelog == 31 = 4.2 = 32 * Fix default extended options display. 33 * Add additional escaping and sanitization. 34 31 35 = 4.1 = 32 36 * Add support for selective refresh in the customizer, available in WordPress 4.5.
Note: See TracChangeset
for help on using the changeset viewer.