Changeset 13900 for trunk/src/bp-core/classes/class-bp-core-nav.php
- Timestamp:
- 06/02/2024 07:12:25 PM (2 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/classes/class-bp-core-nav.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-core-nav.php
r13878 r13900 19 19 */ 20 20 class BP_Core_Nav { 21 21 22 /** 22 23 * An associative array containing the nav items for the object ID. 23 24 * 24 25 * @since 2.6.0 26 * 25 27 * @var array 26 28 */ … … 31 33 * 32 34 * @since 2.6.0 35 * 33 36 * @var int 34 37 */ … … 39 42 * 40 43 * @since 12.0.0 44 * 41 45 * @var string 42 46 */ … … 48 52 * @since 2.6.0 49 53 * 50 * @param int $object_id The item ID to build the nav for. Default is the displayed user ID. 54 * @param int $object_id The item ID to build the nav for. Default is the displayed user ID. 55 * @param string $component_id Optional. The component ID. Default is 'members'. 51 56 */ 52 57 public function __construct( $object_id = 0, $component_id = 'members' ) { … … 114 119 * 115 120 * @param string $key The nav item slug to get. Optional. 116 * @return mixed An array of nav item, a single nav item, or null if none found.121 * @return mixed An array of nav item, a single nav item, or null if none found. 117 122 */ 118 123 public function get( $key = '' ) { … … 127 132 } 128 133 129 // Return all nav item items.134 // Return all nav item items. 130 135 } else { 131 136 $return = $this->nav[ $this->object_id ]; … … 159 164 $args['secondary'] = true; 160 165 161 // This is a parent.166 // This is a parent. 162 167 } else { 163 168 $slug = $args['slug']; … … 180 185 181 186 $chunk = 'single_item_action'; 182 if ( $path_chunks['single_item'] . '_manage' === $path_chunks['single_item_component'] ) {187 if ( $path_chunks['single_item'] . '_manage' === $path_chunks['single_item_component'] ) { 183 188 $chunk = 'single_item_action_variables'; 184 189 $path_chunks[ $chunk ] = $path_chunks['single_item_action']; 185 190 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ); 186 $group_screens = bp_get_group_screens( 'manage' );191 $group_screens = bp_get_group_screens( 'manage' ); 187 192 } else { 188 193 $group_screens = bp_get_group_screens( 'read' ); … … 259 264 return $this->nav[ $this->object_id ][ $slug ]; 260 265 261 // We're editing a child.266 // We're editing a child. 262 267 } else { 263 $sub_items = $this->get_secondary( array( 'parent_slug' => $parent_slug, 'slug' => $slug ), false ); 268 $sub_items = $this->get_secondary( 269 array( 270 'parent_slug' => $parent_slug, 271 'slug' => $slug, 272 ), 273 false 274 ); 264 275 265 276 if ( ! $sub_items ) { … … 305 316 306 317 // Validate the subnav. 307 $sub_items = $this->get_secondary( array( 'parent_slug' => $parent_slug, 'slug' => $slug ), false ); 318 $sub_items = $this->get_secondary( 319 array( 320 'parent_slug' => $parent_slug, 321 'slug' => $slug, 322 ), 323 false 324 ); 308 325 309 326 if ( ! $sub_items ) { … … 323 340 return array( $sub_item->screen_function ); 324 341 325 // We're deleting a parent.342 // We're deleting a parent. 326 343 } else { 327 344 // Validate the nav. … … 340 357 $screen_functions = array( $nav_item->screen_function ); 341 358 342 // Life's unfair, children won't survive the parent :(359 // Life's unfair, children won't survive the parent. 343 360 $sub_items = $this->get_secondary( array( 'parent_slug' => $nav_item->slug ), false ); 344 361 … … 384 401 385 402 do { 386 $position += 1;387 } while ( in_array( $position, $sorted_keys ) );403 ++$position; 404 } while ( in_array( $position, $sorted_keys, true ) ); 388 405 } 389 406 … … 392 409 393 410 ksort( $sorted ); 411 394 412 return $sorted; 395 413 } … … 478 496 foreach ( $primary_nav_items as $key_nav => $primary_nav ) { 479 497 // Try to get the children. 480 $children = $this->get_secondary( array( 'parent_slug' => $primary_nav->slug, 'user_has_access' => true ) ); 498 $children = $this->get_secondary( 499 array( 500 'parent_slug' => $primary_nav->slug, 501 'user_has_access' => true, 502 ) 503 ); 481 504 482 505 if ( $children ) { 483 $primary_nav_items[ $key_nav ] = clone $primary_nav;506 $primary_nav_items[ $key_nav ] = clone $primary_nav; 484 507 $primary_nav_items[ $key_nav ]->children = $children; 485 508 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)