本文整理汇总了PHP中BP_Component::start方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Component::start方法的具体用法?PHP BP_Component::start怎么用?PHP BP_Component::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Component
的用法示例。
在下文中一共展示了BP_Component::start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Constructor
*
* @package CollabPress
* @subpackage CP BP
* @since 1.2
*/
function __construct()
{
global $bp;
parent::start('collabpress', __('CollabPress', 'collabpress'), COLLABPRESS_PLUGIN_DIR);
// Register ourselves as an active BP component
$bp->active_components['collabpress'] = '1';
add_filter('bp_get_template_stack', array($this, 'add_cp_to_template_stack'));
// Register BP-specific taxonomies
$this->register_taxonomies();
// Set up the CP query
add_action('cp_bp_setup_item', array(&$this, 'do_cp_query'), 5);
// Load the notification framework
require_once COLLABPRESS_PLUGIN_DIR . 'includes/cp-bp-notifications.php';
// Load the Groups integration, if active
if (bp_is_active('groups')) {
require_once COLLABPRESS_PLUGIN_DIR . 'includes/cp-bp-groups.php';
bp_register_group_extension('CP_BP_Group_Extension');
}
// Add the admin menus
add_action('cp_after_advanced_settings', array(&$this, 'render_settings'));
// Todo: this MUST check to see whether we're in a BP context!!
add_filter('cp_calendar_permalink', array($this, 'filter_cp_calendar_permalink'), 10, 4);
add_filter('post_type_link', array(&$this, 'filter_permalinks'), 10, 4);
add_filter('cp_task_list_link', array(&$this, 'filter_item_link'), 10, 3);
add_filter('cp_task_link', array(&$this, 'filter_item_link'), 10, 3);
add_action('cp_project_added', array(&$this, 'mark_post_in_group'));
add_action('wp_print_styles', array(&$this, 'enqueue_styles'));
}
示例2: define
/**
* Constructor method
*
* You can do all sorts of stuff in your constructor, but it's recommended that, at the
* very least, you call the parent::start() function. This tells the parent BP_Component
* to begin its setup routine.
*
* BP_Component::start() takes three parameters:
* (1) $id - A unique identifier for the component. Letters, numbers, and underscores
* only.
* (2) $name - This is a translatable name for your component, which will be used in
* various places through the BuddyPress admin screens to identify it.
* (3) $path - The path to your plugin directory. Primarily, this is used by
* BP_Component::includes(), to include your plugin's files. See loader.php
* to see how BP_course_PLUGIN_DIR was defined.
*
* @package BuddyPress_Course_Component
* @since 1.6
*/
function __construct()
{
global $bp;
parent::start(BP_COURSE_SLUG, __('Course', 'vibe'), BP_COURSE_MOD_PLUGIN_DIR);
if (!defined('BP_COURSE_RESULTS_SLUG')) {
define('BP_COURSE_RESULTS_SLUG', 'course-results');
}
if (!defined('BP_COURSE_STATS_SLUG ')) {
define('BP_COURSE_STATS_SLUG', 'course-stats');
}
/**
* BuddyPress-dependent plugins are loaded too late to depend on BP_Component's
* hooks, so we must call the function directly.
*/
$this->includes();
/**
* Put your component into the active components array, so that
* bp_is_active( 'course' );
* returns true when appropriate. We have to do this manually, because non-core
* components are not saved as active components in the database.
*/
$bp->active_components[$this->id] = '2';
/**
* Hook the register_post_types() method. If you're using custom post types to store
* data (which is recommended), you will need to hook your function manually to
* 'init'.
*/
add_action('init', array(&$this, 'register_post_types'));
}
示例3:
function __construct()
{
global $bp;
parent::start('social_articles', __('Social Articles', 'articles'), SA_BASE_PATH);
$this->includes();
$bp->active_components[$this->id] = '1';
}
示例4:
/**
* Constructor
*
* @since 1.2
*/
function __construct()
{
global $bp;
parent::start('bp_docs', __('BuddyPress Docs', 'bp-docs'), BP_DOCS_INSTALL_PATH);
$bp->active_components[$this->id] = '1';
$this->setup_hooks();
}
示例5: buddypress
/**
* Constructor method
*
* @package BP Reshare
* @subpackage Component
* @since 1.0
*
* @uses buddyreshare_get_component_id() to get the id of the component
* @uses buddyreshare_get_component_name() to get the name of the component
* @uses buddyreshare_get_includes_dir() to get plugin's include dir
* @uses buddypress() to get BuddyPress main instance
*/
function __construct()
{
parent::start(buddyreshare_get_component_id(), buddyreshare_get_component_name(), buddyreshare_get_includes_dir());
buddypress()->active_components[$this->id] = '1';
$this->includes();
$this->setup_hooks();
}
示例6: __construct
/**
* Start the site subscriber component creation process
*/
public function __construct()
{
parent::start('site_subscriber', __('Site Subscriber', 'bp-site-subscriber'), BP_PLUGIN_DIR);
// Wordpress init
add_action('init', array($this, 'init'));
/**
* Actions and filters for notification adding and deleting
*/
// Add new notification when a new post is published
add_action('publish_post', array($this, 'add_notification'), 10, 2);
// Mark users notification connected to a post as read
add_action('the_post', array($this, 'mark_notification_as_read'));
// Delete notifications if post is deleted
add_action('delete_post', array($this, 'delete_notifications'));
// Delete notifications if post is trashed
add_action('wp_trash_post', array($this, 'delete_notifications'));
/**
* Actions and filters for subscribing
*/
add_action('wp_ajax_bp_site_subscriber_subscribe', array($this, 'change_subscription'));
/**
* Actions and filters for settings
*/
// Action run when displaying notification settings (enable or disable emails)
add_action('bp_notification_settings', array($this, 'settings_screen'));
}
示例7: __construct
/**
* Initialize component
*/
public function __construct()
{
parent::start('buddyblog', __('BuddyBlog', 'buddyblog'), untrailingslashit(plugin_dir_path(__FILE__)));
$this->includes();
//load files
buddypress()->active_components[$this->id] = 1;
}
示例8: __construct
/**
* Initiate the class
*
* @package BuddyForms
* @since 0.1 beta
*/
public function __construct()
{
global $bp;
parent::start($this->id, 'BuddyForms', BUDDYFORMS_MEMBERS_INSTALL_PATH);
$bp->active_components[$this->id] = '1';
$this->setup_hooks();
}
示例9:
function __construct()
{
global $bp;
parent::start('buatp', __('User Account Type', 'buatp'), BUATP_ROOT . '_inc');
$this->includes();
$bp->active_components[$this->id] = '1';
}
示例10: buddypress
function __construct()
{
parent::start('links', _x('User Links', 'Link screen page <title>', 'buddypress-links'), BP_LINKS_PLUGIN_DIR);
$this->includes();
bp_links_init_settings();
buddypress()->active_components[$this->id] = '1';
}
示例11: dirname
/**
* Start the creation process.
*
* @since 1.0.0
* @access public
*/
function __construct()
{
global $bp;
parent::start('mute', __('Mute', 'buddypress-mute'), dirname(dirname(__FILE__)));
$this->includes();
$bp->active_components[$this->id] = '1';
}
示例12: __construct
/**
* Initialize the component
*/
public function __construct()
{
global $bp;
parent::start('portfolio', __('Portfolio', 'bp-portfolio'), BP_PORTFOLIO_PLUGIN_DIR);
$this->includes();
$bp->active_components[$this->id] = '1';
// add_action('init', array(&$this, 'register_post_types'));
}
示例13:
function __construct()
{
global $bp;
parent::start('events', __('Events', 'dbem'), EM_DIR);
$this->includes();
//TODO make BP component optional
$bp->active_components[$this->id] = '1';
}
示例14: array
/**
* Constructor for the BuddyPress Media Component
*
* @since BP Media 2.0
*/
function __construct()
{
global $bp;
parent::start(BP_MEDIA_SLUG, BP_MEDIA_LABEL, BP_MEDIA_PLUGIN_DIR);
$this->includes();
$bp->active_components[$this->id] = '1';
add_action('init', array(&$this, 'register_post_types'));
}
示例15: __construct
/**
* Start the forums component creation process
*
* @since bbPress (r3552)
*/
public function __construct()
{
parent::start('forums', __('Forums', 'bbpress'), bbpress()->includes_dir . 'extend/buddypress/');
$this->includes();
$this->setup_globals();
$this->setup_actions();
$this->fully_loaded();
}