[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/classes/ -> class-bp-walker-nav-menu-checklist.php (source)

   1  <?php
   2  /**
   3   * Core component classes.
   4   *
   5   * @package BuddyPress
   6   * @subpackage Core
   7   * @since 1.9.0
   8   * @deprecated 7.0.0 This file is no longer used as of the improved way to generate BuddyPress Member's nav menu items in #8291.
   9   * @todo Remove this file as it is no longer used.
  10   */
  11  
  12  // Exit if accessed directly.
  13  defined( 'ABSPATH' ) || exit;
  14  
  15  _deprecated_file( basename( __FILE__ ), '7.0.0' );
  16  
  17  /**
  18   * Create a set of BuddyPress-specific links for use in the Menus admin UI.
  19   *
  20   * Borrowed heavily from {@link Walker_Nav_Menu_Checklist}, but modified so as not
  21   * to require an actual post type or taxonomy, and to force certain CSS classes.
  22   *
  23   * @since 1.9.0
  24   * @deprecated 7.0.0 This class is no longer used as of the improved way to generate BuddyPress Member's nav menu items in #8291.
  25   */
  26  class BP_Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
  27  
  28      /**
  29       * Constructor.
  30       *
  31       * @deprecated 7.0.0
  32       *
  33       * @see Walker_Nav_Menu::__construct() for a description of parameters.
  34       *
  35       * @param array|bool $fields See {@link Walker_Nav_Menu::__construct()}.
  36       */
  37  	public function __construct( $fields = false ) {
  38          _deprecated_function( __METHOD__, '7.0.0' );
  39          if ( $fields ) {
  40              $this->db_fields = $fields;
  41          }
  42      }
  43  
  44      /**
  45       * Create the markup to start a tree level.
  46       *
  47       * @deprecated 7.0.0
  48       *
  49       * @see Walker_Nav_Menu::start_lvl() for description of parameters.
  50       *
  51       * @param string $output See {@Walker_Nav_Menu::start_lvl()}.
  52       * @param int    $depth  See {@Walker_Nav_Menu::start_lvl()}.
  53       * @param array  $args   See {@Walker_Nav_Menu::start_lvl()}.
  54       */
  55  	public function start_lvl( &$output, $depth = 0, $args = array() ) {
  56          _deprecated_function( __METHOD__, '7.0.0' );
  57          $indent = str_repeat( "\t", $depth );
  58          $output .= "\n$indent<ul class='children'>\n";
  59      }
  60  
  61      /**
  62       * Create the markup to end a tree level.
  63       *
  64       * @deprecated 7.0.0
  65       *
  66       * @see Walker_Nav_Menu::end_lvl() for description of parameters.
  67       *
  68       * @param string $output See {@Walker_Nav_Menu::end_lvl()}.
  69       * @param int    $depth  See {@Walker_Nav_Menu::end_lvl()}.
  70       * @param array  $args   See {@Walker_Nav_Menu::end_lvl()}.
  71       */
  72  	public function end_lvl( &$output, $depth = 0, $args = array() ) {
  73          _deprecated_function( __METHOD__, '7.0.0' );
  74          $indent = str_repeat( "\t", $depth );
  75          $output .= "\n$indent</ul>";
  76      }
  77  
  78      /**
  79       * Create the markup to start an element.
  80       *
  81       * @deprecated 7.0.0
  82       *
  83       * @see Walker::start_el() for description of parameters.
  84       *
  85       * @param string       $output Passed by reference. Used to append additional
  86       *                             content.
  87       * @param object       $item   Menu item data object.
  88       * @param int          $depth  Depth of menu item. Used for padding.
  89       * @param object|array $args   See {@Walker::start_el()}.
  90       * @param int          $id     See {@Walker::start_el()}.
  91       */
  92  	function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
  93          _deprecated_function( __METHOD__, '7.0.0' );
  94          global $_nav_menu_placeholder;
  95  
  96          $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
  97          $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
  98          $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
  99  
 100          $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
 101  
 102          $output .= $indent . '<li>';
 103          $output .= '<label class="menu-item-title">';
 104          $output .= '<input type="checkbox" class="menu-item-checkbox';
 105  
 106          if ( property_exists( $item, 'label' ) ) {
 107              $title = $item->label;
 108          }
 109  
 110          $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
 111          $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title );
 112          $output .= '</label>';
 113  
 114          if ( empty( $item->url ) ) {
 115              $item->url = $item->guid;
 116          }
 117  
 118          if ( ! in_array( array( 'bp-menu', 'bp-'. $item->post_excerpt .'-nav' ), $item->classes ) ) {
 119              $item->classes[] = 'bp-menu';
 120              $item->classes[] = 'bp-'. $item->post_excerpt .'-nav';
 121          }
 122  
 123          // Menu item hidden fields.
 124          $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
 125          $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />';
 126          $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />';
 127          $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="custom" />';
 128          $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />';
 129          $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />';
 130          $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />';
 131          $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />';
 132          $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';
 133          $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';
 134      }
 135  }


Generated: Thu Dec 5 01:00:58 2024 Cross-referenced by PHPXref 0.7.1