本文整理汇总了PHP中bp_current_component函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_current_component函数的具体用法?PHP bp_current_component怎么用?PHP bp_current_component使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_current_component函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: friends_screen_requests
/**
* Catch and process the Requests page.
*/
function friends_screen_requests()
{
if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_accept_friendship');
if (friends_accept_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship accepted', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
} elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_reject_friendship');
if (friends_reject_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship rejected', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
} elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_withdraw_friendship');
if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
} else {
bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
}
do_action('friends_screen_requests');
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例2: friends_screen_requests
function friends_screen_requests()
{
if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_accept_friendship');
if (friends_accept_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship accepted', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
}
bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
} elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_reject_friendship');
if (friends_reject_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship rejected', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
}
bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
}
do_action('friends_screen_requests');
if (isset($_GET['new'])) {
bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
}
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例3: bp_course_add_js
function bp_course_add_js()
{
global $bp;
if (!function_exists('vibe_logo_url')) {
return;
}
// Checks if WPLMS is active in current site in WP Multisite
wp_enqueue_script('bp-extras-js', plugins_url('/vibe-course-module/includes/js/course-module-js.min.js'), array('jquery'), bp_course_version(), true);
if (function_exists('vibe_get_option')) {
if (is_singular('unit') || is_singular('question') || is_singular('quiz') || is_singular('wplms-assignment') || is_page(vibe_get_option('take_course_page')) || is_page(vibe_get_option('create_course')) || isset($_GET['edit'])) {
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-ui-droppable');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
}
}
if (function_exists('bp_is_directory')) {
if (bp_is_directory() && bp_current_component() == 'course') {
wp_enqueue_script('jquery-ui-datepicker');
}
}
$action = bp_current_action();
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (in_array($action, array('admin', 'submissions', 'stats'))) {
wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
}
wp_enqueue_script('bp-course-js', plugins_url('/vibe-course-module/includes/js/course.js'), array('jquery', 'wp-mediaelement', 'buddypress-js'), bp_course_version(), true);
$color = bp_wplms_get_theme_color();
$single_dark_color = bp_wplms_get_theme_single_dark_color();
$translation_array = array('too_fast_answer' => _x('Too Fast or Answer not marked.', 'Quiz answer being marked very fast', 'vibe'), 'answer_saved' => _x('Answer Saved.', 'Save answer on every question, confirmation message', 'vibe'), 'processing' => _x('Processing...', 'Quiz question anwer save under progress', 'vibe'), 'saving_answer' => _x('Saving Answer...please wait', 'Saving quiz answers under progress', 'vibe'), 'remove_user_text' => __('This step is irreversible. Are you sure you want to remove the User from the course ?', 'vibe'), 'remove_user_button' => __('Confirm, Remove User from Course', 'vibe'), 'confirm' => _x('Confirm', 'Confirm button for various popup confirmation messages', 'vibe'), 'cancel' => _x('Cancel', 'Cancel button for various popup confirmation messages', 'vibe'), 'reset_user_text' => __('This step is irreversible. All Units, Quiz results would be reset for this user. Are you sure you want to Reset the Course for this User?', 'vibe'), 'reset_user_button' => __('Confirm, Reset Course for this User', 'vibe'), 'quiz_reset' => __('This step is irreversible. All Questions answers would be reset for this user. Are you sure you want to Reset the Quiz for this User? ', 'vibe'), 'quiz_reset_button' => __('Confirm, Reset Quiz for this User', 'vibe'), 'marks_saved' => __('Marks Saved', 'vibe'), 'quiz_marks_saved' => __('Quiz Marks Saved', 'vibe'), 'submit_quiz' => __('Submit Quiz', 'vibe'), 'sending_messages' => __('Sending Messages ...', 'vibe'), 'adding_students' => __('Adding Students to Course ...', 'vibe'), 'successfuly_added_students' => __('Students successfully added to Course', 'vibe'), 'unable_add_students' => __('Unable to Add students to Course', 'vibe'), 'select_fields' => __('Please select fields to download', 'vibe'), 'download' => __('Download', 'vibe'), 'timeout' => __('TIMEOUT', 'vibe'), 'theme_color' => $color, 'single_dark_color' => $single_dark_color, 'for_course' => __('for Course', 'vibe'), 'active_filters' => __('Active Filters', 'vibe'), 'clear_filters' => __('Clear all filters', 'vibe'), 'remove_comment' => __('Are you sure you want to remove this note?', 'vibe'), 'remove_comment_button' => __('Confirm, remove note', 'vibe'), 'private_comment' => __('Make Private', 'vibe'), 'add_comment' => __('Add your note', 'vibe'), 'submit_quiz_error' => __('Please add questions or retake the quiz !', 'vibe'), 'remove_announcement' => __('Are you sure you want to remove this Annoucement?', 'vibe'), 'start_quiz_notification' => __('You\'re about to start the Quiz. Please click confirm to begin the quiz.', 'vibe'), 'submit_quiz_notification' => __('Are you sure you want to submit the quiz. Submitting the quiz will freeze all your answers, you can not change them. Please confirm.', 'vibe'), 'check_results' => __('Check results', 'vibe'), 'correct' => __('Correct', 'vibe'), 'incorrect' => __('Incorrect', 'vibe'), 'confirm_apply' => _x('Are you sure you want to apply for this Course ?', 'confirmation message when user clicks on apply for course', 'vibe'), 'instructor_uncomplete_unit' => _x('Are you sure you want mark this unit "uncomplete" for the user ?', 'Popup confirmation message when instructor marks the unit uncomplete for the user.', 'vibe'), 'instructor_complete_unit' => _x('Are you sure you want to mark this unit "complete" for the user ?', 'Popup confirmation message ', 'vibe'), 'unanswered_questions' => __('You have few unanswered questions. Are you sure you want to continue ?', 'vibe'));
wp_localize_script('bp-course-js', 'vibe_course_module_strings', $translation_array);
}
示例4: has_access
/**
* Verify access to the current content.
*
* Related:
* A reference of available BuddyPress template tags
* https://codex.buddypress.org/developer/template-tag-reference/
*
* @since 1.0.0
*
* @param int $id The content post ID to verify access.
* @return bool|null True if has access, false otherwise.
* Null means: Rule not relevant for current page.
*/
public function has_access($id, $admin_has_access = true)
{
global $bp;
$has_access = null;
if (!function_exists('bp_current_component')) {
return null;
}
if (is_buddypress()) {
// Check if access to *all* BuddyPress pages is restricted
$has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_ALL, $admin_has_access);
}
if ($has_access) {
// General BuddyPress access is either *allowed* or *not denied*
$component = bp_current_component();
if (!empty($component)) {
if ('members' == $component || bp_is_user()) {
// Member listing or member profile access.
$has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_MEMBERS, $admin_has_access);
} elseif ('messages' == $component) {
// Private messaging direct access.
if ('compose' == $bp->current_action) {
$has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_PRIVATE_MSG, $admin_has_access);
}
} elseif ('messages' == $component) {
// Don't modify, handled by MS_Addon_Buddypress_Rule_Group
} else {
// Other BP pages can be handled by other rules.
$has_access = null;
}
}
}
return apply_filters('ms_rule_buddypress_has_access', $has_access, $id, $this);
}
示例5: bp_media_delete_button_handler
function bp_media_delete_button_handler($link)
{
if (bp_current_component() == 'media') {
$link = str_replace('delete-activity ', 'delete-activity-single ', $link);
}
return $link;
}
示例6: tie_register
function tie_register()
{
## Register Main style.css file
wp_register_style('tie-style', get_stylesheet_uri(), array(), '', 'all');
wp_enqueue_style('tie-style');
## Register All Scripts
wp_register_script('tie-scripts', get_template_directory_uri() . '/js/tie-scripts.js', array('jquery'), false, true);
wp_register_script('tie-tabs', get_template_directory_uri() . '/js/tabs.min.js', array('jquery'), false, true);
wp_register_script('tie-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.js', array('jquery'), false, true);
wp_register_script('tie-validation', get_template_directory_uri() . '/js/validation.js', array('jquery'), false, true);
wp_register_script('tie-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), false, true);
## Get Global Scripts
wp_enqueue_script('tie-scripts');
## Register WooCommerce css file
wp_register_style('tie-woocommerce', get_template_directory_uri() . '/css/woocommerce.css', array(), '', 'all');
if (class_exists('Woocommerce')) {
wp_enqueue_style('tie-woocommerce');
}
## Get Validation Script
if (tie_get_option('comment_validation') && (is_page() || is_single()) && comments_open()) {
wp_enqueue_script('tie-validation');
}
## For facebook & Google + share
if (is_singular() && tie_get_option('post_og_cards') && (!function_exists('bp_current_component') || function_exists('bp_current_component') && !bp_current_component())) {
tie_og_data();
}
}
示例7: mpp_is_component_gallery
/**
* Are we on component gallery
*
* Is gallery associated to a component(groups/events etc)
*
* @return boolean
*/
function mpp_is_component_gallery()
{
$is_gallery = false;
if (bp_is_current_action(MPP_GALLERY_SLUG) && mpp_is_active_component(bp_current_component())) {
$is_gallery = true;
}
return apply_filters('mpp_is_component_gallery', $is_gallery);
}
示例8: tie_register
function tie_register()
{
## Register Main style.css file
wp_register_style('tie-style', get_stylesheet_uri(), array(), '', 'all');
wp_enqueue_style('tie-style');
## Register All Scripts
wp_register_script('tie-scripts', get_template_directory_uri() . '/js/tie-scripts.js', array('jquery'), false, true);
wp_register_script('tie-tabs', get_template_directory_uri() . '/js/tabs.min.js', array('jquery'), false, true);
wp_register_script('tie-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.js', array('jquery'), false, true);
wp_register_script('tie-validation', get_template_directory_uri() . '/js/validation.js', array('jquery'), false, true);
wp_register_script('tie-masonry', get_template_directory_uri() . '/js/isotope.js', array('jquery'), false, true);
wp_register_script('tie-ilightbox', get_template_directory_uri() . '/js/ilightbox.packed.js', array('jquery'), false, true);
## Get Global Scripts
wp_enqueue_script('tie-scripts');
wp_enqueue_script('tie-ilightbox');
## Register WooCommerce css file
wp_register_style('tie-woocommerce', get_template_directory_uri() . '/css/woocommerce.css', array(), '', 'all');
if (class_exists('Woocommerce')) {
wp_enqueue_style('tie-woocommerce');
}
## Register bbPress css file
wp_register_style('tie-bbpress', get_template_directory_uri() . '/css/bbpress.css', array(), '', 'all');
if (class_exists('bbpress')) {
wp_enqueue_style('tie-bbpress');
}
## Register buddyPress css file
wp_register_style('tie-buddypress', get_template_directory_uri() . '/css/buddypress.css', array(), '', 'all');
if (class_exists('buddypress')) {
wp_enqueue_style('tie-buddypress');
}
## Get Validation Script
if (tie_get_option('comment_validation') && is_singular() && comments_open()) {
wp_enqueue_script('tie-validation');
}
$lightbox_skin = 'dark';
if (tie_get_option('lightbox_skin')) {
$lightbox_skin = tie_get_option('lightbox_skin');
}
wp_enqueue_style('tie-ilightbox-skin', get_template_directory_uri() . '/css/ilightbox/' . $lightbox_skin . '-skin/skin.css');
## For facebook & Google + share
if (is_singular() && tie_get_option('post_og_cards') && (!function_exists('bp_current_component') || function_exists('bp_current_component') && !bp_current_component())) {
tie_og_data();
}
## Sticky Sidebars
$sticky_sidebar = false;
if (tie_get_option('sticky_sidebar')) {
$sticky_sidebar = true;
if ((is_home() || is_front_page()) && tie_get_option('sticky_sidebar_disable_homepage') || is_page() && tie_get_option('sticky_sidebar_disable_pages') || is_single() && tie_get_option('sticky_sidebar_disable_posts') || is_tag() && tie_get_option('sticky_sidebar_disable_tag') || is_category() && tie_get_option('sticky_sidebar_disable_cat')) {
$sticky_sidebar = false;
}
}
## Inline Vars
$tie_js_vars = array("mobile_menu_active" => tie_get_option('mobile_menu_active'), "mobile_menu_top" => tie_get_option('mobile_menu_top'), "lightbox_all" => tie_get_option('lightbox_all'), "lightbox_gallery" => tie_get_option('lightbox_gallery'), "woocommerce_lightbox" => get_option('woocommerce_enable_lightbox'), "lightbox_skin" => $lightbox_skin, "lightbox_thumb" => tie_get_option('lightbox_thumbs'), "lightbox_arrows" => tie_get_option('lightbox_arrows'), "sticky_sidebar" => $sticky_sidebar, "is_singular" => is_singular(), "reading_indicator" => tie_get_option('reading_indicator'), "lang_no_results" => __ti('No Results'), "lang_results_found" => __ti('Results Found'));
wp_localize_script('tie-scripts', 'tie', $tie_js_vars);
}
示例9: bp_docs_is_bp_docs_page
/**
* Determine whether you are viewing a BuddyPress Docs page
*
* @package BuddyPress Docs
* @since 1.0-beta
*
* @return bool
*/
function bp_docs_is_bp_docs_page()
{
global $bp;
$is_bp_docs_page = false;
// This is intentionally ambiguous and generous, to account for BP Docs is different
// components. Probably should be cleaned up at some point
if ($bp->bp_docs->slug == bp_current_component() || $bp->bp_docs->slug == bp_current_action()) {
$is_bp_docs_page = true;
}
return apply_filters('bp_docs_is_bp_docs_page', $is_bp_docs_page);
}
示例10: test_group_access_test_no_group_during_group_creation
/**
* @group invite_anyone_group_invite_access_test
*/
public function test_group_access_test_no_group_during_group_creation()
{
$cc = bp_current_component();
$ca = bp_current_action();
buddypress()->current_component = buddypress()->groups->id;
buddypress()->current_action = 'create';
$u = $this->factory->user->create();
$this->assertSame('anyone', invite_anyone_group_invite_access_test(0, $u));
buddypress()->current_component = $cc;
buddypress()->current_action = $ca;
}
示例11: setup_globals
/**
* Setup globals
*
* The BP_MEMBERS_SLUG constant is deprecated, and only used here for
* backwards compatibility.
*
* @since 1.5
* @global obj $bp
*/
function setup_globals()
{
global $bp, $current_user, $displayed_user_id;
// Define a slug, if necessary
if (!defined('BP_MEMBERS_SLUG')) {
define('BP_MEMBERS_SLUG', $this->id);
}
$globals = array('path' => BP_PLUGIN_DIR, 'slug' => BP_MEMBERS_SLUG, 'root_slug' => isset($bp->pages->members->slug) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 'has_directory' => true, 'search_string' => __('Search Members...', 'buddypress'));
parent::setup_globals($globals);
/** Logged in user ****************************************************/
// Fetch the full name for the logged in user
$bp->loggedin_user->fullname = bp_core_get_user_displayname(bp_loggedin_user_id());
// Hits the DB on single WP installs so get this separately
$bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin(bp_loggedin_user_id());
// The domain for the user currently logged in. eg: http://domain.com/members/andy
$bp->loggedin_user->domain = bp_core_get_user_domain(bp_loggedin_user_id());
// The core userdata of the user who is currently logged in.
$bp->loggedin_user->userdata = bp_core_get_core_userdata(bp_loggedin_user_id());
/** Displayed user ****************************************************/
// The domain for the user currently being displayed
$bp->displayed_user->domain = bp_core_get_user_domain(bp_displayed_user_id());
// The core userdata of the user who is currently being displayed
$bp->displayed_user->userdata = bp_core_get_core_userdata(bp_displayed_user_id());
// Fetch the full name displayed user
$bp->displayed_user->fullname = bp_core_get_user_displayname(bp_displayed_user_id());
/** Profiles Fallback *************************************************/
if (!bp_is_active('xprofile')) {
$bp->profile->slug = 'profile';
$bp->profile->id = 'profile';
}
/** Default Profile Component *****************************************/
if (!defined('BP_DEFAULT_COMPONENT')) {
if (bp_is_active('activity') && isset($bp->pages->activity)) {
$bp->default_component = bp_get_activity_slug();
} else {
$bp->default_component = 'xprofile' == $bp->profile->id ? 'profile' : $bp->profile->id;
}
} else {
$bp->default_component = BP_DEFAULT_COMPONENT;
}
if (!bp_current_component() && bp_displayed_user_id()) {
/**
* BuddyPress will attempt to resolve to the most specific URL possible,
* to avoid search-engine-unfriendly content reduplication. Filter
* bp_guarantee_unique_uris (and return false) to avoid this behavior
*/
if (apply_filters('bp_guarantee_unique_uris', true)) {
bp_core_redirect(bp_displayed_user_domain() . $bp->default_component);
} else {
$bp->current_component = $bp->default_component;
}
}
}
示例12: __construct
public function __construct(&$plugin)
{
$this->p =& $plugin;
$this->p->debug->mark();
if (is_admin() || bp_current_component()) {
$this->p->util->add_plugin_filters($this, array('post_types' => 3));
// load sharing buttons code if sharing features exist and are enabled
if (array_key_exists('ssb', $this->p->is_avail) && $this->p->is_avail['ssb'] === true) {
$classname = __CLASS__ . 'Sharing';
$this->sharing = new $classname($this->p);
}
}
}
示例13: breadcrumb_bp_current_item
function breadcrumb_bp_current_item($item)
{
$params = array('bp_component' => bp_current_component(), 'bp_item' => bp_current_item(), 'bp_action' => bp_current_action(), 'bp_action_variables' => bp_action_variables());
switch (bp_current_component()) {
case false:
return $item;
break;
case 'groups':
return new Breadcrumb_BP_Component_Group($item, $params);
break;
default:
return new Breadcrumb_BP_Component($item, $params);
}
}
示例14: dt_theme_bbpress_title
function dt_theme_bbpress_title(){
global $bp;
$doctitle = "";
$separator = dttheme_option ( 'seo', 'title-delimiter' );
$id = 0;
if ( !empty( $bp->displayed_user->fullname ) ) {
$blog_title = preg_replace ( "~(?:\[/?)[^/\]]+/?\]~s", '', get_option ( 'blogname' ));
$title = bp_current_component() === "profile" ? __("Profile","dt_themes") : __("Member","dt_themes");
$subtitle = strip_tags( $bp->displayed_user->fullname );
$doctitle = $blog_title.' '.$separator.' '.$title.' '.$separator.' '.$subtitle.' '.$separator;
} elseif( bp_is_members_component() ) {
$id = $bp->pages->members->id;
}elseif( bp_is_activity_component() ){
$id = $bp->pages->activity->id;
}elseif( bp_current_component() === "groups" ) {
$id = $bp->pages->groups->id;
}elseif( bp_current_component() === "register" ) {
$id = $bp->pages->register->id;
}elseif( bp_current_component() === "activate" ) {
$id = $bp->pages->activate->id;
}
if( $id > 0 ){
global $post;
$args = array (
"blog_title" => preg_replace ( "~(?:\[/?)[^/\]]+/?\]~s", '', get_option ( 'blogname' ) ),
"blog_description" => get_bloginfo ( 'description' ),
"post_title" => ! empty ( $post ) ? $post->post_title : NULL,
"post_author_nicename" => ! empty ( $nickname ) ? ucwords ( $nickname ) : NULL,
"post_author_firstname" => ! empty ( $first_name ) ? ucwords ( $first_name ) : NULL,
"post_author_lastname" => ! empty ( $last_name ) ? ucwords ( $last_name ) : NULL,
"post_author_dsiplay" => ! empty ( $display_name ) ? ucwords ( $display_name ) : NULL );
$args = array_filter ( $args );
$doctitle = get_post_meta ( $id, '_seo_title', true );
if (empty ( $doctitle )) :
$options = is_array ( dttheme_option ( 'seo', 'page-title-format' ) ) ? dttheme_option ( 'seo', 'page-title-format' ) : array ();
foreach ( $options as $option ) :
if (array_key_exists ( $option, $args ))
$doctitle .= $args [$option] . ' ' . $separator . ' ';
endforeach;
endif;
}
return $doctitle;
}
示例15: __construct
public function __construct(&$plugin)
{
$this->p =& $plugin;
if ($this->p->debug->enabled) {
$this->p->debug->mark();
}
if (is_admin() || bp_current_component()) {
if (!empty($this->p->is_avail['ssb'])) {
$classname = __CLASS__ . 'Sharing';
if (class_exists($classname)) {
$this->sharing = new $classname($this->p);
}
}
}
}