|
@@ 166-177 (lines=12) @@
|
| 163 |
|
} |
| 164 |
|
|
| 165 |
|
// recursively ensure item lists are contiguous |
| 166 |
|
protected function remove_item_keys( &$item ) { |
| 167 |
|
if ( ! isset( $item['items'] ) || ! is_array( $item['items'] ) ) { |
| 168 |
|
return; |
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
|
| 172 |
|
foreach( $item['items'] as &$it ) { |
| 173 |
|
$this->remove_item_keys( $it ); |
| 174 |
|
} |
| 175 |
|
|
| 176 |
|
$item['items'] = array_values( $item['items'] ); |
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
protected function whitelist_and_rename_keys( $menus ) { |
| 180 |
|
$transformed_menus = array(); |
|
@@ 327-335 (lines=9) @@
|
| 324 |
|
* These fields will be used when creating |
| 325 |
|
* new items with wp_update_nav_menu_item(). |
| 326 |
|
*/ |
| 327 |
|
private function set_tmp_id( &$item, $tmp_id ) { |
| 328 |
|
$item['tmp_id'] = $tmp_id; |
| 329 |
|
if ( ! isset( $item['items'] ) || ! is_array( $item['items'] ) ) { |
| 330 |
|
return; |
| 331 |
|
} |
| 332 |
|
foreach ( $item['items'] as &$child ) { |
| 333 |
|
$child['tmp_parent'] = $tmp_id; |
| 334 |
|
} |
| 335 |
|
} |
| 336 |
|
|
| 337 |
|
protected function whitelist_and_rename_keys( $menus ) { |
| 338 |
|
$transformed_menus = array(); |