[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/classes/ -> class-bp-component.php (source)

   1  <?php
   2  /**
   3   * Component classes.
   4   *
   5   * @package BuddyPress
   6   * @subpackage Core
   7   * @since 1.5.0
   8   */
   9  
  10  // Exit if accessed directly.
  11  defined( 'ABSPATH' ) || exit;
  12  
  13  if ( !class_exists( 'BP_Component' ) ) :
  14  
  15  /**
  16   * BuddyPress Component Class.
  17   *
  18   * The BuddyPress component class is responsible for simplifying the creation
  19   * of components that share similar behaviors and routines. It is used
  20   * internally by BuddyPress to create the bundled components, but can be
  21   * extended to create other really neat things.
  22   *
  23   * @since 1.5.0
  24   */
  25  class BP_Component {
  26  
  27      /** Variables *************************************************************/
  28  
  29      /**
  30       * Translatable name for the component.
  31       *
  32       * @internal
  33       * @var string $name
  34       */
  35      public $name = '';
  36  
  37      /**
  38       * Unique ID for the component.
  39       *
  40       * @since 1.5.0
  41       * @var string $id
  42       */
  43      public $id = '';
  44  
  45      /**
  46       * Unique slug for the component, for use in query strings and URLs.
  47       *
  48       * @since 1.5.0
  49       * @var string $slug
  50       */
  51      public $slug = '';
  52  
  53      /**
  54       * Does the component need a top-level directory?
  55       *
  56       * @since 1.5.0
  57       * @var bool $has_directory
  58       */
  59      public $has_directory = false;
  60  
  61      /**
  62       * The path to the component's files.
  63       *
  64       * @since 1.5.0
  65       * @var string $path
  66       */
  67      public $path = '';
  68  
  69      /**
  70       * The WP_Query loop for this component.
  71       *
  72       * @since 1.5.0
  73       * @var WP_Query $query
  74       */
  75      public $query = false;
  76  
  77      /**
  78       * The current ID of the queried object.
  79       *
  80       * @since 1.5.0
  81       * @var string $current_id
  82       */
  83      public $current_id = '';
  84  
  85      /**
  86       * Callback for formatting notifications.
  87       *
  88       * @since 1.5.0
  89       * @var callable $notification_callback
  90       */
  91      public $notification_callback = '';
  92  
  93      /**
  94       * WordPress Toolbar links.
  95       *
  96       * @since 1.5.0
  97       * @var array $admin_menu
  98       */
  99      public $admin_menu = '';
 100  
 101      /**
 102       * Placeholder text for component directory search box.
 103       *
 104       * @since 1.6.0
 105       * @var string $search_string
 106       */
 107      public $search_string = '';
 108  
 109      /**
 110       * Root slug for the component.
 111       *
 112       * @since 1.6.0
 113       * @var string $root_slug
 114       */
 115      public $root_slug = '';
 116  
 117      /**
 118       * Metadata tables for the component (if applicable).
 119       *
 120       * @since 2.0.0
 121       *
 122       * @var array
 123       */
 124      public $meta_tables = array();
 125  
 126      /**
 127       * Global tables for the component (if applicable).
 128       *
 129       * @since 2.0.0
 130       *
 131       * @var array
 132       */
 133      public $global_tables = array();
 134  
 135      /**
 136       * Query argument for component search URLs.
 137       *
 138       * @since 2.4.0
 139       * @var string
 140       */
 141      public $search_query_arg = 's';
 142  
 143      /** Methods ***************************************************************/
 144  
 145      /**
 146       * Component loader.
 147       *
 148       * @since 1.5.0
 149       * @since 1.9.0 Added $params as a parameter.
 150       * @since 2.3.0 Added $params['features'] as a configurable value.
 151       * @since 2.4.0 Added $params['search_query_arg'] as a configurable value.
 152       *
 153       * @param string $id   Unique ID. Letters, numbers, and underscores only.
 154       * @param string $name Unique name. This should be a translatable name, eg.
 155       *                     __( 'Groups', 'buddypress' ).
 156       * @param string $path The file path for the component's files. Used by {@link BP_Component::includes()}.
 157       * @param array  $params {
 158       *     Additional parameters used by the component.
 159       *     @type int    $adminbar_myaccount_order Set the position for our menu under the WP Toolbar's "My Account menu".
 160       *     @type array  $features                 An array of feature names. This is used to load additional files from your
 161       *                                            component directory and for feature active checks. eg. array( 'awesome' )
 162       *                                            would look for a file called "bp-{$this->id}-awesome.php" and you could use
 163       *                                            bp_is_active( $this->id, 'awesome' ) to determine if the feature is active.
 164       *     @type string $search_query_arg         String to be used as the query argument in component search URLs.
 165       * }
 166       */
 167  	public function start( $id = '', $name = '', $path = '', $params = array() ) {
 168  
 169          // Internal identifier of component.
 170          $this->id   = $id;
 171  
 172          // Internal component name.
 173          $this->name = $name;
 174  
 175          // Path for includes.
 176          $this->path = $path;
 177  
 178          // Miscellaneous component parameters that need to be set early on.
 179          if ( ! empty( $params ) ) {
 180              // Sets the position for our menu under the WP Toolbar's "My Account" menu.
 181              if ( ! empty( $params['adminbar_myaccount_order'] ) ) {
 182                  $this->adminbar_myaccount_order = (int) $params['adminbar_myaccount_order'];
 183              }
 184  
 185              // Register features.
 186              if ( ! empty( $params['features'] ) ) {
 187                  $this->features = array_map( 'sanitize_title', (array) $params['features'] );
 188              }
 189  
 190              if ( ! empty( $params['search_query_arg'] ) ) {
 191                  $this->search_query_arg = sanitize_title( $params['search_query_arg'] );
 192              }
 193  
 194          // Set defaults if not passed.
 195          } else {
 196              // New component menus are added before the settings menu if not set.
 197              $this->adminbar_myaccount_order = 90;
 198          }
 199  
 200          // Move on to the next step.
 201          $this->setup_actions();
 202      }
 203  
 204      /**
 205       * Set up component global variables.
 206       *
 207       * @since 1.5.0
 208       *
 209       *
 210       * @param array $args {
 211       *     All values are optional.
 212       *     @type string   $slug                  The component slug. Used to construct certain URLs, such as 'friends' in
 213       *                                           http://example.com/members/joe/friends/. Default: the value of $this->id.
 214       *     @type string   $root_slug             The component root slug. Note that this value is generally unused if the
 215       *                                           component has a root directory (the slug will be overridden by the
 216       *                                           post_name of the directory page). Default: the slug of the directory page
 217       *                                           if one is found, otherwise an empty string.
 218       *     @type bool     $has_directory         Set to true if the component requires an associated WordPress page.
 219       *     @type callable $notification_callback Optional. The callable function that formats the component's notifications.
 220       *     @type string   $search_term           Optional. The placeholder text in the component directory search box. Eg,
 221       *                                           'Search Groups...'.
 222       *     @type array    $global_tables         Optional. An array of database table names.
 223       *     @type array    $meta_tables           Optional. An array of metadata table names.
 224       * }
 225       */
 226  	public function setup_globals( $args = array() ) {
 227  
 228          /** Slugs ************************************************************
 229           */
 230  
 231          // If a WP directory page exists for the component, it should
 232          // be the default value of 'root_slug'.
 233          $default_root_slug = isset( buddypress()->pages->{$this->id}->slug ) ? buddypress()->pages->{$this->id}->slug : '';
 234  
 235          $r = wp_parse_args( $args, array(
 236              'slug'                  => $this->id,
 237              'root_slug'             => $default_root_slug,
 238              'has_directory'         => false,
 239              'directory_title'       => '',
 240              'notification_callback' => '',
 241              'search_string'         => '',
 242              'global_tables'         => '',
 243              'meta_tables'           => '',
 244          ) );
 245  
 246          /**
 247           * Filters the slug to be used for the permalink URI chunk after root.
 248           *
 249           * @since 1.5.0
 250           *
 251           * @param string $value Slug to use in permalink URI chunk.
 252           */
 253          $this->slug                  = apply_filters( 'bp_' . $this->id . '_slug',                  $r['slug']                  );
 254  
 255          /**
 256           * Filters the slug used for root directory.
 257           *
 258           * @since 1.5.0
 259           *
 260           * @param string $value Root directory slug.
 261           */
 262          $this->root_slug             = apply_filters( 'bp_' . $this->id . '_root_slug',             $r['root_slug']             );
 263  
 264          /**
 265           * Filters the component's top-level directory if available.
 266           *
 267           * @since 1.5.0
 268           *
 269           * @param bool $value Whether or not there is a top-level directory.
 270           */
 271          $this->has_directory         = apply_filters( 'bp_' . $this->id . '_has_directory',         $r['has_directory']         );
 272  
 273          /**
 274           * Filters the component's directory title.
 275           *
 276           * @since 2.0.0
 277           *
 278           * @param string $value Title to use for the directory.
 279           */
 280          $this->directory_title       = apply_filters( 'bp_' . $this->id . '_directory_title',       $r['directory_title']         );
 281  
 282          /**
 283           * Filters the placeholder text for search inputs for component.
 284           *
 285           * @since 1.5.0
 286           *
 287           * @param string $value Name to use in search input placeholders.
 288           */
 289          $this->search_string         = apply_filters( 'bp_' . $this->id . '_search_string',         $r['search_string']         );
 290  
 291          /**
 292           * Filters the callable function that formats the component's notifications.
 293           *
 294           * @since 1.5.0
 295           *
 296           * @param string $value Function callback.
 297           */
 298          $this->notification_callback = apply_filters( 'bp_' . $this->id . '_notification_callback', $r['notification_callback'] );
 299  
 300          // Set the global table names, if applicable.
 301          if ( ! empty( $r['global_tables'] ) ) {
 302              $this->register_global_tables( $r['global_tables'] );
 303          }
 304  
 305          // Set the metadata table, if applicable.
 306          if ( ! empty( $r['meta_tables'] ) ) {
 307              $this->register_meta_tables( $r['meta_tables'] );
 308          }
 309  
 310          /** BuddyPress *******************************************************
 311           */
 312  
 313          // Register this component in the loaded components array.
 314          buddypress()->loaded_components[$this->slug] = $this->id;
 315  
 316          /**
 317           * Fires at the end of the setup_globals method inside BP_Component.
 318           *
 319           * This is a dynamic hook that is based on the component string ID.
 320           *
 321           * @since 1.5.0
 322           */
 323          do_action( 'bp_' . $this->id . '_setup_globals' );
 324      }
 325  
 326      /**
 327       * Include required files.
 328       *
 329       * Please note that, by default, this method is fired on the bp_include
 330       * hook, with priority 8. This is necessary so that core components are
 331       * loaded in time to be available to third-party plugins. However, this
 332       * load order means that third-party plugins whose main files are
 333       * loaded at bp_include with priority 10 (as recommended), will not be
 334       * loaded in time for their includes() method to fire automatically.
 335       *
 336       * For this reason, it is recommended that your plugin has its own
 337       * method or function for requiring necessary files. If you must use
 338       * this method, you will have to call it manually in your constructor
 339       * class, ie
 340       *   $this->includes();
 341       *
 342       * Note that when you pass an array value like 'actions' to includes,
 343       * it looks for the following three files (assuming your component is
 344       * called 'my_component'):
 345       *   - ./actions
 346       *   - ./bp-my_component/actions
 347       *   - ./bp-my_component/bp-my_component-actions.php
 348       *
 349       * @since 1.5.0
 350       *
 351       *
 352       * @param array $includes An array of file names, or file name chunks,
 353       *                        to be parsed and then included.
 354       */
 355  	public function includes( $includes = array() ) {
 356  
 357          // Bail if no files to include.
 358          if ( ! empty( $includes ) ) {
 359              $slashed_path = trailingslashit( $this->path );
 360  
 361              // Loop through files to be included.
 362              foreach ( (array) $includes as $file ) {
 363  
 364                  $paths = array(
 365  
 366                      // Passed with no extension.
 367                      'bp-' . $this->id . '/bp-' . $this->id . '-' . $file  . '.php',
 368                      'bp-' . $this->id . '-' . $file . '.php',
 369                      'bp-' . $this->id . '/' . $file . '.php',
 370  
 371                      // Passed with extension.
 372                      $file,
 373                      'bp-' . $this->id . '-' . $file,
 374                      'bp-' . $this->id . '/' . $file,
 375                  );
 376  
 377                  foreach ( $paths as $path ) {
 378                      if ( @is_file( $slashed_path . $path ) ) {
 379                          require( $slashed_path . $path );
 380                          break;
 381                      }
 382                  }
 383              }
 384          }
 385  
 386          /**
 387           * Fires at the end of the includes method inside BP_Component.
 388           *
 389           * This is a dynamic hook that is based on the component string ID.
 390           *
 391           * @since 1.5.0
 392           */
 393          do_action( 'bp_' . $this->id . '_includes' );
 394      }
 395  
 396      /**
 397       * Late includes method.
 398       *
 399       * Components should include files here only on specific pages using
 400       * conditionals such as {@link bp_is_current_component()}. Intentionally left
 401       * empty.
 402       *
 403       * @since 3.0.0
 404       */
 405  	public function late_includes() {}
 406  
 407      /**
 408       * Set up the actions.
 409       *
 410       * @since 1.5.0
 411       *
 412       */
 413  	public function setup_actions() {
 414  
 415          // Setup globals.
 416          add_action( 'bp_setup_globals',          array( $this, 'setup_globals'          ), 10 );
 417  
 418          // Set up canonical stack.
 419          add_action( 'bp_setup_canonical_stack',  array( $this, 'setup_canonical_stack'  ), 10 );
 420  
 421          // Include required files. Called early to ensure that BP core
 422          // components are loaded before plugins that hook their loader functions
 423          // to bp_include with the default priority of 10. This is for backwards
 424          // compatibility; henceforth, plugins should register themselves by
 425          // extending this base class.
 426          add_action( 'bp_include',                array( $this, 'includes'               ), 8 );
 427  
 428          // Load files conditionally, based on certain pages.
 429          add_action( 'bp_late_include',           array( $this, 'late_includes'          ) );
 430  
 431          // Setup navigation.
 432          add_action( 'bp_setup_nav',              array( $this, 'setup_nav'              ), 10 );
 433  
 434          // Setup WP Toolbar menus.
 435          add_action( 'bp_setup_admin_bar',        array( $this, 'setup_admin_bar'        ), $this->adminbar_myaccount_order );
 436  
 437          // Setup component title.
 438          add_action( 'bp_setup_title',            array( $this, 'setup_title'            ), 10 );
 439  
 440          // Setup cache groups.
 441          add_action( 'bp_setup_cache_groups',     array( $this, 'setup_cache_groups'     ), 10 );
 442  
 443          // Register post types.
 444          add_action( 'bp_register_post_types',    array( $this, 'register_post_types'    ), 10 );
 445  
 446          // Register taxonomies.
 447          add_action( 'bp_register_taxonomies',    array( $this, 'register_taxonomies'    ), 10 );
 448  
 449          // Add the rewrite tags.
 450          add_action( 'bp_add_rewrite_tags',       array( $this, 'add_rewrite_tags'       ), 10 );
 451  
 452          // Add the rewrite rules.
 453          add_action( 'bp_add_rewrite_rules',      array( $this, 'add_rewrite_rules'      ), 10 );
 454  
 455          // Add the permalink structure.
 456          add_action( 'bp_add_permastructs',       array( $this, 'add_permastructs'       ), 10 );
 457  
 458          // Allow components to parse the main query.
 459          add_action( 'bp_parse_query',            array( $this, 'parse_query'            ), 10 );
 460  
 461          // Generate rewrite rules.
 462          add_action( 'bp_generate_rewrite_rules', array( $this, 'generate_rewrite_rules' ), 10 );
 463  
 464          /**
 465           * Fires at the end of the setup_actions method inside BP_Component.
 466           *
 467           * This is a dynamic hook that is based on the component string ID.
 468           *
 469           * @since 1.5.0
 470           */
 471          do_action( 'bp_' . $this->id . '_setup_actions' );
 472      }
 473  
 474      /**
 475       * Set up the canonical URL stack for this component.
 476       *
 477       * @since 2.1.0
 478       */
 479  	public function setup_canonical_stack() {}
 480  
 481      /**
 482       * Set up component navigation.
 483       *
 484       * @since 1.5.0
 485       *
 486       * @see bp_core_new_nav_item() For a description of the $main_nav
 487       *      parameter formatting.
 488       * @see bp_core_new_subnav_item() For a description of how each item
 489       *      in the $sub_nav parameter array should be formatted.
 490       *
 491       * @param array $main_nav Optional. Passed directly to bp_core_new_nav_item().
 492       *                        See that function for a description.
 493       * @param array $sub_nav  Optional. Multidimensional array, each item in
 494       *                        which is passed to bp_core_new_subnav_item(). See that
 495       *                        function for a description.
 496       */
 497  	public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
 498  
 499          // No sub nav items without a main nav item.
 500          if ( !empty( $main_nav ) ) {
 501              // Always set the component ID.
 502              $main_nav['component_id'] = $this->id;
 503  
 504              bp_core_new_nav_item( $main_nav, 'members' );
 505  
 506              // Sub nav items are not required.
 507              if ( !empty( $sub_nav ) ) {
 508                  foreach( (array) $sub_nav as $nav ) {
 509                      bp_core_new_subnav_item( $nav, 'members' );
 510                  }
 511              }
 512          }
 513  
 514          /**
 515           * Fires at the end of the setup_nav method inside BP_Component.
 516           *
 517           * This is a dynamic hook that is based on the component string ID.
 518           *
 519           * @since 1.5.0
 520           */
 521          do_action( 'bp_' . $this->id . '_setup_nav' );
 522      }
 523  
 524      /**
 525       * Set up the component entries in the WordPress Admin Bar.
 526       *
 527       * @since 1.5.0
 528       *
 529       * @see WP_Admin_Bar::add_menu() for a description of the syntax
 530       *      required by each item in the $wp_admin_nav parameter array.
 531       * @global object $wp_admin_bar
 532       *
 533       * @param array $wp_admin_nav An array of nav item arguments. Each item in this parameter
 534       *                            array is passed to {@link WP_Admin_Bar::add_menu()}.
 535       *                            See that method for a description of the required syntax for
 536       *                            each item.
 537       */
 538  	public function setup_admin_bar( $wp_admin_nav = array() ) {
 539  
 540          // Bail if this is an ajax request.
 541          if ( defined( 'DOING_AJAX' ) ) {
 542              return;
 543          }
 544  
 545          // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false.
 546          if ( ! bp_use_wp_admin_bar() ) {
 547              return;
 548          }
 549  
 550          /**
 551           * Filters the admin navigation passed into setup_admin_bar.
 552           *
 553           * This is a dynamic hook that is based on the component string ID.
 554           *
 555           * @since 1.9.0
 556           *
 557           * @param array $wp_admin_nav Array of navigation items to add.
 558           */
 559          $wp_admin_nav = apply_filters( 'bp_' . $this->id . '_admin_nav', $wp_admin_nav );
 560  
 561          // Do we have Toolbar menus to add?
 562          if ( !empty( $wp_admin_nav ) ) {
 563              // Fill in position if one wasn't passed for backpat.
 564              $pos = 0;
 565              $not_set_pos = 1;
 566              foreach( $wp_admin_nav as $key => $nav ) {
 567                  if ( ! isset( $nav['position'] ) ) {
 568                      $wp_admin_nav[$key]['position'] = $pos + $not_set_pos;
 569  
 570                      if ( 9 !== $not_set_pos ) {
 571                          ++$not_set_pos;
 572                      }
 573                  } else {
 574                      $pos = $nav['position'];
 575  
 576                      // Reset not set pos to 1
 577                      if ( $pos % 10 === 0 ) {
 578                          $not_set_pos = 1;
 579                      }
 580                  }
 581              }
 582  
 583              // Sort admin nav by position.
 584              $wp_admin_nav = bp_sort_by_key( $wp_admin_nav, 'position', 'num' );
 585  
 586              // Set this objects menus.
 587              $this->admin_menu = $wp_admin_nav;
 588  
 589              // Define the WordPress global.
 590              global $wp_admin_bar;
 591  
 592              // Add each admin menu.
 593              foreach( $this->admin_menu as $admin_menu ) {
 594                  $wp_admin_bar->add_menu( $admin_menu );
 595              }
 596          }
 597  
 598          /**
 599           * Fires at the end of the setup_admin_bar method inside BP_Component.
 600           *
 601           * This is a dynamic hook that is based on the component string ID.
 602           *
 603           * @since 1.5.0
 604           */
 605          do_action( 'bp_' . $this->id . '_setup_admin_bar' );
 606      }
 607  
 608      /**
 609       * Set up the component title.
 610       *
 611       * @since 1.5.0
 612       *
 613       */
 614  	public function setup_title() {
 615  
 616          /**
 617           * Fires in the setup_title method inside BP_Component.
 618           *
 619           * This is a dynamic hook that is based on the component string ID.
 620           *
 621           * @since 1.5.0
 622           */
 623          do_action(  'bp_' . $this->id . '_setup_title' );
 624      }
 625  
 626      /**
 627       * Setup component-specific cache groups.
 628       *
 629       * @since 2.2.0
 630       *
 631       */
 632  	public function setup_cache_groups() {
 633  
 634          /**
 635           * Fires in the setup_cache_groups method inside BP_Component.
 636           *
 637           * This is a dynamic hook that is based on the component string ID.
 638           *
 639           * @since 2.2.0
 640           */
 641          do_action( 'bp_' . $this->id . '_setup_cache_groups' );
 642      }
 643  
 644      /**
 645       * Register global tables for the component, so that it may use WordPress's database API.
 646       *
 647       * @since 2.0.0
 648       *
 649       * @param array $tables Table names to register.
 650       */
 651  	public function register_global_tables( $tables = array() ) {
 652  
 653          /**
 654           * Filters the global tables for the component, so that it may use WordPress' database API.
 655           *
 656           * This is a dynamic hook that is based on the component string ID.
 657           * It allows for component-specific filtering of table names. To filter
 658           * *all* tables, use the 'bp_core_get_table_prefix' filter instead.
 659           *
 660           * @since 1.6.0
 661           */
 662          $tables = apply_filters( 'bp_' . $this->id . '_global_tables', $tables );
 663  
 664          // Add to the BuddyPress global object.
 665          if ( !empty( $tables ) && is_array( $tables ) ) {
 666              foreach ( $tables as $global_name => $table_name ) {
 667                  $this->{$global_name} = $table_name;
 668              }
 669  
 670              // Keep a record of the metadata tables in the component.
 671              $this->global_tables = $tables;
 672          }
 673  
 674          /**
 675           * Fires at the end of the register_global_tables method inside BP_Component.
 676           *
 677           * This is a dynamic hook that is based on the component string ID.
 678           *
 679           * @since 2.0.0
 680           */
 681          do_action( 'bp_' . $this->id . '_register_global_tables' );
 682      }
 683  
 684      /**
 685       * Register component metadata tables.
 686       *
 687       * Metadata tables are registered in the $wpdb global, for
 688       * compatibility with the WordPress metadata API.
 689       *
 690       * @since 2.0.0
 691       *
 692       * @param array $tables Table names to register.
 693       */
 694  	public function register_meta_tables( $tables = array() ) {
 695          global $wpdb;
 696  
 697          /**
 698           * Filters the global meta_tables for the component.
 699           *
 700           * This is a dynamic hook that is based on the component string ID.
 701           * It allows for component-specific filtering of table names. To filter
 702           * *all* tables, use the 'bp_core_get_table_prefix' filter instead.
 703           *
 704           * @since 2.0.0
 705           */
 706          $tables = apply_filters( 'bp_' . $this->id . '_meta_tables', $tables );
 707  
 708          /**
 709           * Add the name of each metadata table to WPDB to allow BuddyPress
 710           * components to play nicely with the WordPress metadata API.
 711           */
 712          if ( !empty( $tables ) && is_array( $tables ) ) {
 713              foreach( $tables as $meta_prefix => $table_name ) {
 714                  $wpdb->{$meta_prefix . 'meta'} = $table_name;
 715              }
 716  
 717              // Keep a record of the metadata tables in the component.
 718              $this->meta_tables = $tables;
 719          }
 720  
 721          /**
 722           * Fires at the end of the register_meta_tables method inside BP_Component.
 723           *
 724           * This is a dynamic hook that is based on the component string ID.
 725           *
 726           * @since 2.0.0
 727           */
 728          do_action( 'bp_' . $this->id . '_register_meta_tables' );
 729      }
 730  
 731      /**
 732       * Set up the component post types.
 733       *
 734       * @since 1.5.0
 735       *
 736       */
 737  	public function register_post_types() {
 738  
 739          /**
 740           * Fires in the register_post_types method inside BP_Component.
 741           *
 742           * This is a dynamic hook that is based on the component string ID.
 743           *
 744           * @since 1.5.0
 745           */
 746          do_action( 'bp_' . $this->id . '_register_post_types' );
 747      }
 748  
 749      /**
 750       * Register component-specific taxonomies.
 751       *
 752       * @since 1.5.0
 753       *
 754       */
 755  	public function register_taxonomies() {
 756  
 757          /**
 758           * Fires in the register_taxonomies method inside BP_Component.
 759           *
 760           * This is a dynamic hook that is based on the component string ID.
 761           *
 762           * @since 1.5.0
 763           */
 764          do_action( 'bp_' . $this->id . '_register_taxonomies' );
 765      }
 766  
 767      /**
 768       * Add any additional rewrite tags.
 769       *
 770       * @since 1.5.0
 771       *
 772       */
 773  	public function add_rewrite_tags() {
 774  
 775          /**
 776           * Fires in the add_rewrite_tags method inside BP_Component.
 777           *
 778           * This is a dynamic hook that is based on the component string ID.
 779           *
 780           * @since 1.5.0
 781           */
 782          do_action( 'bp_' . $this->id . '_add_rewrite_tags' );
 783      }
 784  
 785      /**
 786       * Add any additional rewrite rules.
 787       *
 788       * @since 1.9.0
 789       *
 790       */
 791  	public function add_rewrite_rules() {
 792  
 793          /**
 794           * Fires in the add_rewrite_rules method inside BP_Component.
 795           *
 796           * This is a dynamic hook that is based on the component string ID.
 797           *
 798           * @since 1.9.0
 799           */
 800          do_action( 'bp_' . $this->id . '_add_rewrite_rules' );
 801      }
 802  
 803      /**
 804       * Add any permalink structures.
 805       *
 806       * @since 1.9.0
 807       *
 808       */
 809  	public function add_permastructs() {
 810  
 811          /**
 812           * Fires in the add_permastructs method inside BP_Component.
 813           *
 814           * This is a dynamic hook that is based on the component string ID.
 815           *
 816           * @since 1.9.0
 817           */
 818          do_action( 'bp_' . $this->id . '_add_permastructs' );
 819      }
 820  
 821      /**
 822       * Allow components to parse the main query.
 823       *
 824       * @since 1.9.0
 825       *
 826       *
 827       * @param object $query The main WP_Query.
 828       */
 829  	public function parse_query( $query ) {
 830  
 831          /**
 832           * Fires in the parse_query method inside BP_Component.
 833           *
 834           * This is a dynamic hook that is based on the component string ID.
 835           *
 836           * @since 1.9.0
 837           *
 838           * @param object $query Main WP_Query object. Passed by reference.
 839           */
 840          do_action_ref_array( 'bp_' . $this->id . '_parse_query', array( &$query ) );
 841      }
 842  
 843      /**
 844       * Generate any additional rewrite rules.
 845       *
 846       * @since 1.5.0
 847       *
 848       */
 849  	public function generate_rewrite_rules() {
 850  
 851          /**
 852           * Fires in the generate_rewrite_rules method inside BP_Component.
 853           *
 854           * This is a dynamic hook that is based on the component string ID.
 855           *
 856           * @since 1.5.0
 857           */
 858          do_action( 'bp_' . $this->id . '_generate_rewrite_rules' );
 859      }
 860  }
 861  endif; // BP_Component.


Generated: Mon Jul 22 01:01:43 2019 Cross-referenced by PHPXref 0.7.1