1 | <?php |
||
7 | class ClassyMenuItem extends ClassyBasis { |
||
|
|||
8 | |||
9 | /** |
||
10 | * Children |
||
11 | * @var array |
||
12 | */ |
||
13 | protected $children = array(); |
||
14 | |||
15 | /** |
||
16 | * CSS Classes |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $classes = array(); |
||
20 | |||
21 | /** |
||
22 | * If item has child |
||
23 | * @var boolean |
||
24 | */ |
||
25 | protected $has_child = false; |
||
26 | |||
27 | /** |
||
28 | * Nesting level |
||
29 | * @var integer |
||
30 | */ |
||
31 | public $level = 0; |
||
32 | |||
33 | /** |
||
34 | * Item title |
||
35 | * @var string |
||
36 | */ |
||
37 | public $title; |
||
38 | |||
39 | /** |
||
40 | * Checks if provided arg is instance of WP_Post and inits it |
||
41 | * |
||
42 | * @param WP_Post $item |
||
43 | */ |
||
44 | public function __construct($item) { |
||
54 | |||
55 | /** |
||
56 | * Returns item title |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | public function get_title() { |
||
65 | |||
66 | /** |
||
67 | * Returns item slug |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function get_slug() { |
||
76 | |||
77 | /** |
||
78 | * Returns item link (url) |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function get_link() { |
||
87 | |||
88 | /** |
||
89 | * Retuns item children, if there are any |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | public function get_children() { |
||
98 | |||
99 | /** |
||
100 | * Returns menu item classes |
||
101 | * @return string |
||
102 | */ |
||
103 | public function get_classes() { |
||
108 | |||
109 | /** |
||
110 | * Adds css class to classes array |
||
111 | * |
||
112 | * @param string $class_name |
||
113 | */ |
||
114 | public function add_class($class_name) { |
||
119 | |||
120 | /** |
||
121 | * Adds child to current ClassyMenuItem |
||
122 | * |
||
123 | * @param ClassyMenuItem $item |
||
124 | */ |
||
125 | public function add_child($item) { |
||
144 | |||
145 | /** |
||
146 | * Applies filters for item classes |
||
147 | * |
||
148 | * @return void |
||
149 | */ |
||
150 | protected function filter_classes() { |
||
155 | |||
156 | /** |
||
157 | * Updates children nesting level param |
||
158 | * |
||
159 | * @return boolean |
||
160 | */ |
||
161 | protected function update_child_levels() { |
||
177 | |||
178 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.