wp/wp-includes/widgets/class-wp-widget-categories.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    90 			 */
    90 			 */
    91 			wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ) );
    91 			wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ) );
    92 
    92 
    93 			echo '</form>';
    93 			echo '</form>';
    94 
    94 
    95 			$type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
    95 			ob_start();
    96 			?>
    96 			?>
    97 
    97 
    98 <script<?php echo $type_attr; ?>>
    98 <script>
    99 /* <![CDATA[ */
       
   100 (function() {
    99 (function() {
   101 	var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
   100 	var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
   102 	function onCatChange() {
   101 	function onCatChange() {
   103 		if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) {
   102 		if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) {
   104 			dropdown.parentNode.submit();
   103 			dropdown.parentNode.submit();
   105 		}
   104 		}
   106 	}
   105 	}
   107 	dropdown.onchange = onCatChange;
   106 	dropdown.onchange = onCatChange;
   108 })();
   107 })();
   109 /* ]]> */
       
   110 </script>
   108 </script>
   111 
   109 
   112 			<?php
   110 			<?php
       
   111 			wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
   113 		} else {
   112 		} else {
   114 			$format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml';
   113 			$format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml';
   115 
   114 
   116 			/** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */
   115 			/** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */
   117 			$format = apply_filters( 'navigation_widgets_format', $format );
   116 			$format = apply_filters( 'navigation_widgets_format', $format );
   201 			<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'hierarchical' ); ?>" name="<?php echo $this->get_field_name( 'hierarchical' ); ?>"<?php checked( $hierarchical ); ?> />
   200 			<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'hierarchical' ); ?>" name="<?php echo $this->get_field_name( 'hierarchical' ); ?>"<?php checked( $hierarchical ); ?> />
   202 			<label for="<?php echo $this->get_field_id( 'hierarchical' ); ?>"><?php _e( 'Show hierarchy' ); ?></label>
   201 			<label for="<?php echo $this->get_field_id( 'hierarchical' ); ?>"><?php _e( 'Show hierarchy' ); ?></label>
   203 		</p>
   202 		</p>
   204 		<?php
   203 		<?php
   205 	}
   204 	}
   206 
       
   207 }
   205 }