bp_component :: setup_globals(数组$ args.=大批()的)

设置组件全局变量。

描述

参数

$ args.

数组的)(可选的)所有值都是可选的。

  • 'slug'
    (细绳)组件蛞蝓。用于构造特定的url,如http://example.com/members/joe/friends/中的'friends'。默认值:$this->id的值。
  • 'root_slug'
    (细绳)组件根蛞蝓。注意,如果组件有根目录(该slug将被目录页的post_name覆盖),则该值通常不会被使用。默认值:如果找到目录页的代码段,则为空字符串。
  • 'has_directory'
    (BOOL)如果组件需要关联的WordPress页面,则设置为true。
  • 'notification_callback'
    (可调用)可选的。格式化组件通知的可调用函数。
  • '搜索词'
    (细绳)可选的。组件目录搜索框中的占位符文本。例如,'搜索组...'。
  • 'global_tables'
    (数组)可选的。一系列数据库表名称。
  • “meta_tables”
    (数组)可选的。元数据表名称数组。

默认值:array()

文件:bp-core /类/ class-bp-component.php

公共函数setup_globals (args美元=数组 () ) { /** 蛞蝓  ************************************************************ */ // 如果一个WP目录页面存在的组件,/ /应该“root_slug”的默认值。$this->id}->slug ()- $this->id}->slug)buddypress() - >页面- > {$ this - > id} - >蛞蝓:”;(r = wp_parse_args美元args,阵列(“鼻涕虫”= > $ this - > id, default_root_slug美元' root_slug ' = > ' has_directory ' = > false, directory_title ' => '', ' notification_callback ' => '', ' search_string ' => '', ' global_tables ' => '', ' meta_tables ' => '', ) );/** *过滤要用于根后的永久链接URI块的slug。* * @since BuddyPress 1.5.0 * * @param string $value Slug to use in permalink URI chunk。*/ $this->slug = apply_filters('bp_'。$ this - > id。_slug, $ r(“鼻涕虫”));/** *过滤根目录使用的鼻涕虫。 * * @since BuddyPress 1.5.0 * * @param string $value Root directory slug. */ $this->root_slug = apply_filters( 'bp_' . $this->id . '_root_slug', $r['root_slug'] ); /** * Filters the component's top-level directory if available. * * @since BuddyPress 1.5.0 * * @param bool $value Whether or not there is a top-level directory. */ $this->has_directory = apply_filters( 'bp_' . $this->id . '_has_directory', $r['has_directory'] ); /** * Filters the component's directory title. * * @since BuddyPress 2.0.0 * * @param string $value Title to use for the directory. */ $this->directory_title = apply_filters( 'bp_' . $this->id . '_directory_title', $r['directory_title'] ); /** * Filters the placeholder text for search inputs for component. * * @since BuddyPress 1.5.0 * * @param string $value Name to use in search input placeholders. */ $this->search_string = apply_filters( 'bp_' . $this->id . '_search_string', $r['search_string'] ); /** * Filters the callable function that formats the component's notifications. * * @since BuddyPress 1.5.0 * * @param string $value Function callback. */ $this->notification_callback = apply_filters( 'bp_' . $this->id . '_notification_callback', $r['notification_callback'] ); // Set the global table names, if applicable. if ( ! empty( $r['global_tables'] ) ) { $this->register_global_tables( $r['global_tables'] ); } // Set the metadata table, if applicable. if ( ! empty( $r['meta_tables'] ) ) { $this->register_meta_tables( $r['meta_tables'] ); } /** BuddyPress ******************************************************* */ // Register this component in the loaded components array. buddypress()->loaded_components[$this->slug] = $this->id; /** * Fires at the end of the setup_globals method inside BP_Component. * * This is a dynamic hook that is based on the component string ID. * * @since BuddyPress 1.5.0 */ do_action( 'bp_' . $this->id . '_setup_globals' ); }

变更乐

变更乐
版本 描述
Buddypress 1.5.0. 介绍了。

问题?

我们总是很乐意帮助您可能拥有的代码或其他问题!搜索我们开发人员文档联络支持,或与我们联系销售团队