X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/6c8f14c09105d0afa4c1574215c59b5021040e76..dc1231b7312fbdca99e9e887cc2bb35a28f85cdc:/wp-admin/includes/template.php?ds=sidebyside
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 788a4bd5..a0b248f9 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -13,59 +13,139 @@
//
/**
- * Walker to output an unordered list of category checkbox elements.
+ * Walker to output an unordered list of category checkbox input elements.
+ *
+ * @since 2.5.1
*
* @see Walker
* @see wp_category_checklist()
* @see wp_terms_checklist()
- * @since 2.5.1
*/
class Walker_Category_Checklist extends Walker {
- var $tree_type = 'category';
- var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
+ public $tree_type = 'category';
+ public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
- function start_lvl( &$output, $depth = 0, $args = array() ) {
+ /**
+ * Starts the list before the elements are added.
+ *
+ * @see Walker:start_lvl()
+ *
+ * @since 2.5.1
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of category. Used for tab indentation.
+ * @param array $args An array of arguments. @see wp_terms_checklist()
+ */
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
\n";
}
- function end_lvl( &$output, $depth = 0, $args = array() ) {
+ /**
+ * Ends the list of after the elements are added.
+ *
+ * @see Walker::end_lvl()
+ *
+ * @since 2.5.1
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of category. Used for tab indentation.
+ * @param array $args An array of arguments. @see wp_terms_checklist()
+ */
+ public function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
\n";
}
- function start_el( &$output, $category, $depth, $args, $id = 0 ) {
- extract($args);
- if ( empty($taxonomy) )
+ /**
+ * Start the element output.
+ *
+ * @see Walker::start_el()
+ *
+ * @since 2.5.1
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param object $category The current term object.
+ * @param int $depth Depth of the term in reference to parents. Default 0.
+ * @param array $args An array of arguments. @see wp_terms_checklist()
+ * @param int $id ID of the current term.
+ */
+ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
+ if ( empty( $args['taxonomy'] ) ) {
$taxonomy = 'category';
+ } else {
+ $taxonomy = $args['taxonomy'];
+ }
- if ( $taxonomy == 'category' )
+ if ( $taxonomy == 'category' ) {
$name = 'post_category';
- else
- $name = 'tax_input['.$taxonomy.']';
+ } else {
+ $name = 'tax_input[' . $taxonomy . ']';
+ }
+
+ $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
+
+ $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
+
+ /** This filter is documented in wp-includes/category-template.php */
+ if ( ! empty( $args['list_only'] ) ) {
+ $aria_cheched = 'false';
+ $inner_class = 'category';
- $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
- $output .= "\n