PluginProbe
FeedWordPress / 2011.0512
FeedWordPress v2011.0512
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
feedwordpress / feedwordpress-walker-category-checklist.class.php

feedwordpress-walker-category-checklist.class.php in FeedWordPress 2011.0512, at feedwordpress-walker-category-checklist.class.php

57 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * FeedWordPress_Walker_Category_Checklist
4 *
5 * @version 2010.0531
6 *
7 * This is the fucking stupidest thing ever.
8 */
9
10 require_once(ABSPATH.'/wp-admin/includes/template.php');
11 // Fucking fuck.
12
13 class FeedWordPress_Walker_Category_Checklist extends Walker_Category_Checklist {
14 var $prefix = ''; var $taxonomy = 'category';
15 var $checkbox_name = NULL;
16 function FeedWordPress_Walker_Category_Checklist ($params = array()) {
17 $this->set_taxonomy('category');
18
19 if (isset($params['checkbox_name'])) :
20 $this->checkbox_name = $params['checkbox_name'];
21 endif;
22 }
23
24 function set_prefix ($prefix) {
25 $this->prefix = $prefix;
26 }
27 function set_taxonomy ($taxonomy) {
28 $this->taxonomy = $taxonomy;
29 }
30
31 function start_el (&$output, $category, $depth, $args) {
32 extract($args);
33 if ( empty($taxonomy) ) :
34 $taxonomy = 'category';
35 endif;
36
37 if (!is_null($this->checkbox_name)) :
38 $name = $this->checkbox_name;
39 elseif ($taxonomy=='category') :
40 $name = 'post_category';
41 else :
42 $name = 'tax_input['.$taxonomy.']';
43 endif;
44
45 $unit = array();
46 if (strlen($this->prefix) > 0) :
47 $unit[] = $this->prefix;
48 endif;
49 $unit[] = $taxonomy;
50 $unit[] = $category->term_id;
51 $unitId = implode("-", $unit);
52
53 $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category category-checkbox"' : ' class="category-checkbox"';
54 $output .= "\n<li id='{$unitId}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$unitId. '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
55 } /* FeedWordPress_Walker_Category_Checklist::start_el() */
56 } /* FeedWordPress_Walker_Category_Checklist */
57