Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/25/2023 05:18:41 PM (2 years ago)
Author:
imath
Message:

Fully deprecate bp_nav & bp_options_nav BP globals

These back compatibility mechanism, which was in BP since version 2.6, has moved to the BP Classic plugin.

Fixes #8927
Closes https://github.com/buddypress/buddypress/pull/121

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-core-bp-options-nav-backcompat.php

    r13504 r13507  
    44 *
    55 * @since 2.6.0
     6 * @deprecated 12.0.0
    67 */
    78
     
    1617 *
    1718 * @since 2.6.0
     19 * @deprecated 12.0.0
    1820 */
    1921class BP_Core_BP_Options_Nav_BackCompat extends BP_Core_BP_Nav_BackCompat {
     
    3133     *
    3234     * @since 2.6.0
     35     * @deprecated 12.0.0
    3336     *
    3437     * @param mixed $offset Array offset.
     
    4144            '2.6.0'
    4245        );
    43 
    44         if ( empty( $this->backcompat_nav[ $offset ] ) ) {
    45             $nav = $this->get_nav( $offset );
    46             if ( $nav ) {
    47                 $subnavs = $this->get_component_nav( $offset )->get_secondary( array( 'parent_slug' => $offset ) );
    48                 $subnav_keyed = array();
    49                 if ( $subnavs ) {
    50                     foreach ( $subnavs as $subnav ) {
    51                         $subnav_keyed[ $subnav->slug ] = (array) $subnav;
    52                     }
    53                 }
    54 
    55                 $subnav_object = new self( $subnav_keyed );
    56                 $subnav_object->set_component( $this->get_component() );
    57                 $subnav_object->set_parent_slug( $offset );
    58 
    59                 $this->backcompat_nav[ $offset ] = $subnav_object;
    60             }
    61         }
    62 
    63         if ( isset( $this->backcompat_nav[ $offset ] ) ) {
    64             return $this->backcompat_nav[ $offset ];
    65         }
    66 
    67         return false;
     46        _deprecated_function( __METHOD__, '12.0.0' );
    6847    }
    6948
     
    7251     *
    7352     * @since 2.6.0
     53     * @deprecated 12.0.0
    7454     *
    7555     * @param mixed $offset Array offset.
     
    8161            '2.6.0'
    8262        );
    83 
    84         $this->get_component_nav( $offset )->delete_nav( $offset, $this->get_parent_slug() );
    85 
    86         // Clear the cached nav.
    87         unset( $this->backcompat_nav[ $offset ] );
     63        _deprecated_function( __METHOD__, '12.0.0' );
    8864    }
    8965
     
    9268     *
    9369     * @since 2.6.0
     70     * @deprecated 12.0.0
    9471     *
    9572     * @return string
    9673     */
    9774    public function get_parent_slug() {
    98         return $this->parent_slug;
     75        _deprecated_function( __METHOD__, '12.0.0' );
    9976    }
    10077
     
    10380     *
    10481     * @since 2.6.0
     82     * @deprecated 12.0.0
    10583     */
    10684    public function set_parent_slug( $slug ) {
    107         $this->parent_slug = $slug;
     85        _deprecated_function( __METHOD__, '12.0.0' );
    10886    }
    10987
     
    11290     *
    11391     * @since 2.6.0
     92     * @deprecated 12.0.0
    11493     *
    11594     * @param mixed $offset Array offset.
     
    11796     */
    11897    public function get_nav( $offset ) {
    119         $nav = parent::get_nav( $offset );
    120 
    121         if ( ! $nav ) {
    122             $component_nav = $this->get_component_nav( $offset );
    123             $secondary_nav = $component_nav->get_secondary( array( 'slug' => $offset ), false );
    124 
    125             $nav = array();
    126 
    127             if ( empty( $secondary_nav ) ) {
    128                 return $nav;
    129             }
    130 
    131             foreach ( $secondary_nav as $item ) {
    132                 $nav[ $item->slug ] = (array) $item;
    133             }
    134         }
    135 
    136         return $nav;
     98        _deprecated_function( __METHOD__, '12.0.0' );
    13799    }
    138100}
Note: See TracChangeset for help on using the changeset viewer.