/** * Get a value of the nav array at the specified offset. * * @since 2.6.0 * * @param mixed $offset Array offset. * @return BP_Core_BP_Nav_BackCompat */ public function offsetGet($offset) { _doing_it_wrong('bp_nav', __('These globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddypress'), '2.6.0'); if (empty($this->backcompat_nav[$offset])) { $nav = $this->get_nav($offset); if ($nav) { $subnavs = $this->get_component_nav($offset)->get_secondary(array('parent_slug' => $offset)); $subnav_keyed = array(); if ($subnavs) { foreach ($subnavs as $subnav) { $subnav_keyed[$subnav->slug] = (array) $subnav; } } $subnav_object = new self($subnav_keyed); $subnav_object->set_component($this->get_component()); $subnav_object->set_parent_slug($offset); $this->backcompat_nav[$offset] = $subnav_object; } } if (isset($this->backcompat_nav[$offset])) { return $this->backcompat_nav[$offset]; } return false; }