1 | <?php |
||
8 | class Menu { |
||
9 | |||
10 | /** |
||
11 | * Menu ID |
||
12 | * @var int |
||
13 | */ |
||
14 | public $ID; |
||
15 | |||
16 | /** |
||
17 | * Items |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $items; |
||
21 | |||
22 | /** |
||
23 | * Main constructor. Tries to find menu id based on provided arg (or not) and inits menu |
||
24 | * |
||
25 | * @param string $arg it can be menu id, slug or full name |
||
26 | */ |
||
27 | public function __construct( $arg = null ) { |
||
54 | |||
55 | /** |
||
56 | * Inits menu |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | protected function init() { |
||
87 | |||
88 | /** |
||
89 | * Retuns first menu id or false if there are no menus |
||
90 | * |
||
91 | * @return int |
||
92 | */ |
||
93 | protected function get_first_menu_id() { |
||
109 | |||
110 | /** |
||
111 | * Checks if the provided menu id exists |
||
112 | * |
||
113 | * @param int $menu_id |
||
114 | * @return int|boolean |
||
115 | */ |
||
116 | protected function check_menu_id( $menu_id ) { |
||
135 | |||
136 | /** |
||
137 | * Returns menu id by menu name/slug |
||
138 | * |
||
139 | * @param string $slug |
||
140 | * @return int |
||
141 | */ |
||
142 | protected function get_menu_id_by_name( $slug = null ) { |
||
158 | |||
159 | /** |
||
160 | * Returns menu items |
||
161 | * |
||
162 | * @return array |
||
163 | */ |
||
164 | public function get_items() { |
||
169 | } |
||
170 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: