예제 #1
0
파일: plugin.php 프로젝트: abegit/harmony
function ajax_test_enqueue_scripts()
{
    if (bp_is_members_directory() || bp_is_user_profile()) {
        wp_enqueue_style('love', plugins_url('/style.css', __FILE__));
    }
    wp_enqueue_script('love', plugins_url('/love-basic-ajax.js', __FILE__), '1.0', true);
    wp_localize_script('love', 'postlove', array('ajax_url' => admin_url('admin-ajax.php')));
    wp_enqueue_script('parse', '//www.parsecdn.com/js/parse-1.6.0.min.js', '1.0', true);
    wp_enqueue_script('veri', plugins_url('/veri.js', __FILE__), '1.0', true);
}
 /**
  * Lazy load CSS/JS files?
  *
  * @package s2Member\CSS_JS
  * @since 131028
  *
  * @return boolean TRUE if we should load; else FALSE.
  */
 public static function lazy_load_css_js()
 {
     static $load;
     // Static cache var.
     if (isset($load)) {
         return $load;
     }
     $null = NULL;
     // Needed below in earlier versions of WP.
     if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['lazy_load_css_js']) {
         $load = TRUE;
     } else {
         if (c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()) {
             $load = TRUE;
         } else {
             if (!empty($_GET[apply_filters('ws_plugin__s2member_check_force_ssl_get_var_name', 's2-ssl', array())])) {
                 $load = TRUE;
             } else {
                 if (c_ws_plugin__s2member_utils_conds::bp_is_installed() && (bp_is_register_page() || bp_is_activation_page() || bp_is_user_profile())) {
                     $load = TRUE;
                 } else {
                     if (is_singular() && ($post = get_post($null)) && (stripos($post->post_content, 's2member') !== FALSE || stripos($post->post_content, '[s2') !== FALSE)) {
                         $load = TRUE;
                     } else {
                         if (preg_match('/\\/wp\\-signup\\.php|\\/wp\\-login\\.php|\\/wp\\-admin\\/(?:user\\/)?profile\\.php|[?&]s2member/', $_SERVER['REQUEST_URI'])) {
                             $load = TRUE;
                         }
                     }
                 }
             }
         }
     }
     if (!isset($load)) {
         $load = FALSE;
     }
     // Make sure it's set; always.
     return $load = apply_filters('ws_plugin__s2member_lazy_load_css_js', $load);
 }
 /**
  * Lazy load CSS/JS files?
  *
  * @package s2Member\CSS_JS
  * @since 131028
  *
  * @return boolean TRUE if we should load; else FALSE.
  */
 public static function lazy_load_css_js()
 {
     static $load;
     // Static cache var.
     if (isset($load)) {
         return $load;
     }
     if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["lazy_load_css_js"]) {
         $load = TRUE;
     } else {
         if (c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()) {
             $load = TRUE;
         } else {
             if (!empty($_GET[apply_filters("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", array())])) {
                 $load = TRUE;
             } else {
                 if (c_ws_plugin__s2member_utils_conds::bp_is_installed() && (bp_is_register_page() || bp_is_activation_page() || bp_is_user_profile())) {
                     $load = TRUE;
                 } else {
                     if (is_singular() && ($post = get_post(NULL)) && (stripos($post->post_content, "s2member") !== FALSE || stripos($post->post_content, "[s2") !== FALSE)) {
                         $load = TRUE;
                     } else {
                         if (preg_match("/\\/wp\\-signup\\.php" . "|\\/wp\\-login\\.php" . "|\\/wp\\-admin\\/(?:user\\/)?profile\\.php" . "|[?&]s2member/", $_SERVER["REQUEST_URI"])) {
                             $load = TRUE;
                         }
                     }
                 }
             }
         }
     }
     if (!isset($load)) {
         $load = FALSE;
     }
     // Make sure it's set; always.
     return $load = apply_filters("ws_plugin__s2member_lazy_load_css_js", $load);
 }
예제 #4
0
 function bp_displayed_user_is_friend()
 {
     global $bp;
     $friend_privacy_enable = get_option('tn_wpmu_friend_privacy_status');
     $friend_privacy_redirect = get_option('tn_wpmu_friend_privacy_redirect');
     if ($friend_privacy_enable == "enable") {
         if (bp_is_user_activity() || bp_is_user_profile() || bp_is_user()) {
             if ('is_friend' != BP_Friends_Friendship::check_is_friend($bp->loggedin_user->id, $bp->displayed_user->id) && bp_loggedin_user_id() != bp_displayed_user_id()) {
                 if (!is_super_admin(bp_loggedin_user_id())) {
                     if ($friend_privacy_redirect == '') {
                         bp_core_redirect($bp->root_domain);
                     } else {
                         bp_core_redirect($friend_privacy_redirect);
                     }
                 }
             }
         }
     }
     //enable
 }
예제 #5
0
파일: app.php 프로젝트: schiz/scrollax
 /**
  *
  */
 function miss_is_bp()
 {
     if (function_exists('bp_is_group') && (bp_is_blog_page() || bp_is_my_profile() || bp_is_my_profile() || is_front_page() || bp_is_component_front_page('activity') || bp_is_directory() || bp_is_profile_component() || bp_is_activity_component() || bp_is_blogs_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_groups_component() || bp_is_settings_component() || bp_is_user_activity() || bp_is_user_friends_activity() || bp_is_activity_permalink() || bp_is_user_profile() || bp_is_profile_edit() || bp_is_change_avatar() || bp_is_user_groups() || bp_is_group() || bp_is_group_home() || bp_is_group_create() || bp_is_group_admin_page() || bp_is_group_forum() || bp_is_group_activity() || bp_is_group_forum_topic() || bp_is_group_forum_topic_edit() || bp_is_group_members() || bp_is_group_invites() || bp_is_group_membership_request() || bp_is_group_leave() || bp_is_group_single() || bp_is_user_blogs() || bp_is_user_recent_posts() || bp_is_user_recent_commments() || bp_is_create_blog() || bp_is_user_friends() || bp_is_friend_requests() || bp_is_user_messages() || bp_is_messages_inbox() || bp_is_messages_sentbox() || bp_is_notices() || bp_is_messages_compose_screen() || bp_is_activation_page() || bp_is_register_page())) {
         return true;
     }
     return false;
 }
예제 #6
0
function amt_buddypress_jsonld_schemaorg($metadata_arr, $post, $options, $attachments, $embedded_media)
{
    // User Profiles
    // Determines if a BuddyPress user profile has been requested
    if (bp_is_user_profile()) {
        // https://codex.buddypress.org/developer/the-bp-global/
        global $bp;
        // $user_id = $bp->displayed_user->id;
        $user_id = bp_displayed_user_id();
        // $user_domain = $bp->displayed_user->domain;
        // bp_core_get_user_domain( bp_displayed_user_id() )
        $user_domain = bp_displayed_user_domain();
        $user_profile_url = trailingslashit(bp_displayed_user_domain() . amt_bp_get_profile_slug());
        $user_fullname = $bp->displayed_user->fullname;
        // $user_fullname = bp_displayed_user_fullname();
        // $user_username = $bp->displayed_user->user_login;
        $user_username = bp_get_displayed_user_username();
        //$wp_user_obj = get_user_by( 'id', $user_id );
        $wp_user_obj = get_userdata($user_id);
        //var_dump($wp_user_obj);
        // Context
        $metadata_arr['@context'] = 'http://schema.org';
        // Schema.org type
        $metadata_arr['@type'] = 'Person';
        // name
        $metadata_arr['name'] = esc_attr($user_fullname);
        // URL
        $metadata_arr['url'] = esc_url($user_profile_url, array('http', 'https'));
        // mainEntityOfPage
        $metadata_arr['mainEntityOfPage'] = esc_url($user_profile_url, array('http', 'https'));
        // Related resources as sameAs
        $metadata_arr['sameAs'] = array();
        // Facebook Profile
        //$fb_author_url = get_the_author_meta('amt_facebook_author_profile_url', $user_id);
        $fb_author_url = get_user_meta($user_id, 'amt_facebook_author_profile_url', true);
        if (!empty($fb_author_url)) {
            $metadata_arr['sameAs'][] = esc_url($fb_author_url, array('http', 'https'));
        }
        // Twitter
        //$twitter_author_username = get_the_author_meta('amt_twitter_author_username', $user_id);
        $twitter_author_username = get_user_meta($user_id, 'amt_twitter_author_username', true);
        if (!empty($twitter_author_username)) {
            $metadata_arr['sameAs'][] = 'https://twitter.com/' . esc_attr($twitter_author_username);
        }
        // Google+
        //$googleplus_author_url = get_the_author_meta('amt_googleplus_author_profile_url', $wp_user_obj);
        $googleplus_author_url = get_user_meta($user_id, 'amt_googleplus_author_profile_url', true);
        if (!empty($googleplus_author_url)) {
            $metadata_arr['sameAs'][] = esc_url($googleplus_author_url, array('http', 'https'));
        }
        // Determines if Extended Profiles component is active.
        if (!bp_is_active('xprofile')) {
            // Website
            //$website_url = get_user_meta($user_id, 'amt_googleplus_author_profile_url', true);
            $website_url = get_the_author_meta('user_url', $user_id);
            if (!empty($website_url)) {
                $metadata_arr['sameAs'][] = esc_url($website_url, array('http', 'https'));
            }
            // Description
            $author_description = sanitize_text_field(amt_sanitize_description($wp_user_obj->description));
            if (empty($author_description)) {
                $metadata_arr['description'] = esc_attr(__('Profile of', 'add-meta-tags') . ' ' . $wp_user_obj->display_name);
            } else {
                $metadata_arr['description'] = esc_attr($author_description);
            }
            // Profile Image
            $author_email = sanitize_email($wp_user_obj->user_email);
            $avatar_size = apply_filters('amt_bp_avatar_size', array('width' => 50, 'height' => 50));
            $avatar_url = '';
            // First try to get the avatar link by using get_avatar().
            // Important: for this to work the "Show Avatars" option should be enabled in Settings > Discussion.
            $avatar_img = get_avatar(get_the_author_meta('ID', $wp_user_obj->ID), $avatar_size, '', get_the_author_meta('display_name', $wp_user_obj->ID));
            if (!empty($avatar_img)) {
                if (preg_match("#src=['\"]([^'\"]+)['\"]#", $avatar_img, $matches)) {
                    $avatar_url = $matches[1];
                }
            } elseif (!empty($author_email)) {
                // If the user has provided an email, we use it to construct a gravatar link.
                $avatar_url = "http://www.gravatar.com/avatar/" . md5($author_email) . "?s=" . $avatar_size;
            }
            if (!empty($avatar_url)) {
                //$avatar_url = html_entity_decode($avatar_url, ENT_NOQUOTES, 'UTF-8');
                $metadata_arr['image'] = esc_url($avatar_url);
            }
            // familyName
            $last_name = $wp_user_obj->last_name;
            if (!empty($last_name)) {
                $metadata_arr['familyName'] = esc_attr($last_name);
            }
            // givenName
            $first_name = $wp_user_obj->first_name;
            if (!empty($first_name)) {
                $metadata_arr['givenName'] = esc_attr($first_name);
            }
            // Extended Profiles
        } else {
            // https://codex.buddypress.org/themes/guides/displaying-extended-profile-fields-on-member-profiles/
            $xprofile_field_map = amt_buddypress_get_xprofile_field_map();
            // Get list of IDs of public fields
            $xprofile_public_fields = bp_xprofile_get_fields_by_visibility_levels($user_id, array('public'));
            // Website
            $field_value = amt_bp_get_profile_field_data('website', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['sameAs'][] = esc_url($field_value, array('http', 'https'));
            }
            // Description
            $field_value = amt_bp_get_profile_field_data('description', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field(amt_sanitize_description($field_value));
            if (!empty($field_value)) {
                $metadata_arr['description'] = esc_attr($field_value);
            } else {
                $metadata_arr['description'] = esc_attr(__('Profile of', 'add-meta-tags') . ' ' . $user_fullname);
            }
            // Profile Image
            // Important: for this to work the "Show Avatars" option should be enabled in Settings > Discussion.
            $avatar_size = apply_filters('amt_bp_avatar_size', array('width' => 50, 'height' => 50));
            $avatar_url = '';
            $avatar_args = array('item_id' => $user_id, 'width' => $avatar_size['width'], 'height' => $avatar_size['height']);
            $avatar_img = bp_core_fetch_avatar($avatar_args);
            if (!empty($avatar_img)) {
                if (preg_match("#src=['\"]([^'\"]+)['\"]#", $avatar_img, $matches)) {
                    $avatar_url = $matches[1];
                }
            }
            if (!empty($avatar_url)) {
                //$avatar_url = html_entity_decode($avatar_url, ENT_NOQUOTES, 'UTF-8');
                $metadata_arr['image'] = esc_url($avatar_url);
            }
            // familyName
            $has_last_name = false;
            $field_value = amt_bp_get_profile_field_data('last_name', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['familyName'] = esc_attr($field_value);
                $has_last_name = true;
            }
            // givenName
            $has_first_name = false;
            $field_value = amt_bp_get_profile_field_data('first_name', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['givenName'] = esc_attr($field_value);
                $has_first_name = true;
            }
            // Generate first and last name from full name if needed.
            if (!$has_last_name && !$has_first_name && !empty($user_fullname)) {
                $parts = explode(' ', $user_fullname);
                $last_name = sanitize_text_field(array_pop($parts));
                // Removes and returns the element off the end of array
                if (!empty($last_name)) {
                    $metadata_arr['familyName'] = esc_attr($last_name);
                }
                $first_name = sanitize_text_field(implode(' ', $parts));
                if (!empty($first_name)) {
                    $metadata_arr['givenName'] = esc_attr($first_name);
                }
            }
            // alternateName
            $field_value = amt_bp_get_profile_field_data('nickname', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['alternateName'] = esc_attr($field_value);
            }
            // additionalName
            $field_value = amt_bp_get_profile_field_data('additional_name', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['additionalName'] = esc_attr($field_value);
            }
            // honorificPrefix
            $field_value = amt_bp_get_profile_field_data('honorific_prefix', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['honorificPrefix'] = esc_attr($field_value);
            }
            // honorificSuffix
            $field_value = amt_bp_get_profile_field_data('honorific_suffix', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['honorificSuffix'] = esc_attr($field_value);
            }
            // gender
            $field_value = amt_bp_get_profile_field_data('gender', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['gender'] = esc_attr($field_value);
            }
            // nationality
            $field_value = amt_bp_get_profile_field_data('nationality', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['nationality'] = array();
                $metadata_arr['nationality']['@type'] = 'Country';
                $metadata_arr['nationality']['name'] = esc_attr($field_value);
            }
            // telephone
            $field_value = amt_bp_get_profile_field_data('telephone', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['telephone'] = esc_attr($field_value);
            }
            // faxNumber
            $field_value = amt_bp_get_profile_field_data('fax', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['faxNumber'] = esc_attr($field_value);
            }
            // email
            $field_value = amt_bp_get_profile_field_data('email', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['email'] = 'mailto:' . esc_attr($field_value);
            }
            // jobTitle
            $field_value = amt_bp_get_profile_field_data('job_title', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['jobTitle'] = esc_attr($field_value);
            }
            // worksFor
            $field_value = amt_bp_get_profile_field_data('works_for', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $metadata_arr['worksFor'] = array();
                $metadata_arr['worksFor']['@type'] = 'Organization';
                $metadata_arr['worksFor']['name'] = esc_attr($field_value);
            }
            // worksFor URL
            $field_value = amt_bp_get_profile_field_data('works_for_url', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                if (!array_key_exists('worksFor', $metadata_arr) || !is_array($metadata_arr['worksFor'])) {
                    $metadata_arr['worksFor'] = array();
                    $metadata_arr['worksFor']['@type'] = 'Organization';
                }
                $metadata_arr['worksFor']['url'] = esc_attr($field_value);
            }
            // Home Location Geo Coordinates
            // home latitude
            $latitude = '';
            $field_value = amt_bp_get_profile_field_data('home_latitude', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $latitude = esc_attr($field_value);
            }
            // home longitude
            $longitude = '';
            $field_value = amt_bp_get_profile_field_data('home_longitude', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $longitude = esc_attr($field_value);
            }
            if (!empty($latitude) && !empty($longitude)) {
                $metadata_arr['homeLocation'] = array();
                $metadata_arr['homeLocation']['@type'] = 'Place';
                $metadata_arr['homeLocation']['latitude'] = esc_attr($latitude);
                $metadata_arr['homeLocation']['longitude'] = esc_attr($longitude);
            }
            // Work Location Geo Coordinates
            // work latitude
            $latitude = '';
            $field_value = amt_bp_get_profile_field_data('work_latitude', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $latitude = esc_attr($field_value);
            }
            // work longitude
            $longitude = '';
            $field_value = amt_bp_get_profile_field_data('work_longitude', $user_id, $xprofile_field_map, $xprofile_public_fields);
            $field_value = sanitize_text_field($field_value);
            if (!empty($field_value)) {
                $longitude = esc_attr($field_value);
            }
            if (!empty($latitude) && !empty($longitude)) {
                $metadata_arr['workLocation'] = array();
                $metadata_arr['workLocation']['@type'] = 'Place';
                $metadata_arr['workLocation']['latitude'] = esc_attr($latitude);
                $metadata_arr['workLocation']['longitude'] = esc_attr($longitude);
            }
        }
    }
    // Allow filtering of the generated metadata
    // Customize with: add_filter('amt_buddypress_jsonld_schemaorg_extra', 'my_function', 10, 5);
    $metadata_arr = apply_filters('amt_buddypress_jsonld_schemaorg_extra', $metadata_arr, $post, $options, $attachments, $embedded_media);
    return $metadata_arr;
}
예제 #7
0
	function bp_get_the_body_class( $wp_classes, $custom_classes = false ) {
		global $bp;

		if ( bp_is_front_page() )
			$bp_classes[] = 'home-page';

		if ( bp_is_directory() )
			$bp_classes[] = 'directory';

		if ( bp_is_user_profile() && !bp_is_blog_page() )
			$bp_classes[] = 'profile';

		if ( bp_is_activity_component() && !bp_is_blog_page() || ( bp_is_activity_front_page() && bp_is_front_page() ) )
			$bp_classes[] = 'activity';

		if ( bp_is_blogs_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'blogs';

		if ( bp_is_messages_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'messages';

		if ( bp_is_friends_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'friends';

		if ( bp_is_groups_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'groups';

		if ( bp_is_settings_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'settings';

		if ( bp_is_single_item() )
			$bp_classes[] = 'single-item';

		if ( bp_is_messages_inbox() )
			$bp_classes[] = 'inbox';

		if ( bp_is_messages_sentbox() )
			$bp_classes[] = 'sentbox';

		if ( bp_is_messages_compose_screen() )
			$bp_classes[] = 'compose';

		if ( bp_is_notices() )
			$bp_classes[] = 'notices';

		if ( bp_is_friend_requests() )
			$bp_classes[] = 'friend-requests';

		if ( bp_is_user_friends() )
			$bp_classes[] = 'my-friends';

		if ( bp_is_create_blog() )
			$bp_classes[] = 'create-blog';

		if ( bp_is_user_recent_commments() )
			$bp_classes[] = 'recent-comments';

		if ( bp_is_user_recent_posts() )
			$bp_classes[] = 'recent-posts';

		if ( bp_is_user_blogs() && !bp_is_directory() )
			$bp_classes[] = 'my-blogs';

		if ( bp_is_user_groups() && !bp_is_directory() )
			$bp_classes[] = 'my-groups';

		if ( bp_is_group_leave() )
			$bp_classes[] = 'leave-group';

		if ( bp_is_group_invites() )
			$bp_classes[] = 'group-invites';

		if ( bp_is_group_members() )
			$bp_classes[] = 'group-members';

		if ( bp_is_group_forum_topic() )
			$bp_classes[] = 'group-forum-topic';

		if ( bp_is_group_forum_topic_edit() )
			$bp_classes[] = 'group-forum-topic-edit';

		if ( bp_is_group_forum() )
			$bp_classes[] = 'group-forum';

		if ( bp_is_group_admin_page() )
			$bp_classes[] = 'group-admin';

		if ( bp_is_group_create() )
			$bp_classes[] = 'group-create';

		if ( bp_is_group_home() )
			$bp_classes[] = 'group-home';

		if ( bp_is_change_avatar() )
			$bp_classes[] = 'change-avatar';

		if ( bp_is_profile_edit() )
			$bp_classes[] = 'profile-edit';

		if ( bp_is_user_friends_activity() )
			$bp_classes[] = 'friends-activity';

		if ( bp_is_user_activity() && !bp_is_directory() )
			$bp_classes[] = 'my-activity';

		if ( bp_is_activity_permalink() )
			$bp_classes[] = 'activity-permalink';

		if ( bp_is_register_page() )
			$bp_classes[] = 'registration';

		if ( bp_is_activation_page() )
			$bp_classes[] = 'activation';

		if ( is_user_logged_in() )
			$bp_classes[] = 'logged-in';

		/* Add the current_component, current_action into the bp classes */
		if ( !bp_is_blog_page() ) {
			if ( !empty( $bp->current_component ) )
				$bp_classes[] = $bp->current_component;

			if ( !empty( $bp->current_action ) )
				$bp_classes[] = $bp->current_action;
		}

		/* We don't want WordPress blog classes to appear on non-blog pages. */
		if ( !bp_is_blog_page() || is_home() ) {
			/* Preserve any custom classes already set */
			if ( !empty( $custom_classes ) )
				$wp_classes = (array) $custom_classes;
			else
				$wp_classes = array();
		}

		/* Merge WP classes with BP classes */
		$classes = array_merge( (array) $bp_classes, (array) $wp_classes );

		/* Remove any duplicates */
		$classes = array_unique( $classes );

		return apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes );
	}
예제 #8
0
 /**
  * Adds Custom Fields to BuddyPress Profiles in public view.
  *
  * @package s2Member\Custom_Reg_Fields
  * @since 110524RC
  *
  * @attaches-to ``add_action("bp_profile_field_item");``
  *
  * @return null
  */
 public static function custom_profile_field_items_4bp()
 {
     global $bp;
     static $processed = false;
     do_action("ws_plugin__s2member_before_custom_profile_field_items_4bp", get_defined_vars());
     if (!$processed && in_array("profile-view", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"])) {
         if (apply_filters("ws_plugin__s2member_custom_profile_field_items_4bp_display", true, get_defined_vars())) {
             if (bp_is_user_profile() && (function_exists("bp_is_user_profile_edit") && !bp_is_user_profile_edit() || function_exists("bp_is_profile_edit") && !bp_is_profile_edit()) && (int) bp_get_the_profile_group_id() === 1) {
                 if (isset($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id)) {
                     if ($processed = true) {
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars());
                         unset($__refs, $__v);
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
                             if (($level = c_ws_plugin__s2member_user_access::user_access_level(new WP_User($user_id))) >= 0) {
                                 if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, "profile-view")) {
                                     $fields = get_user_option("s2member_custom_fields", $user_id);
                                     foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
                                         foreach (array_keys(get_defined_vars()) as $__v) {
                                             $__refs[$__v] =& ${$__v};
                                         }
                                         do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars());
                                         unset($__refs, $__v);
                                         if (in_array($field["id"], $fields_applicable)) {
                                             $field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
                                             $field_id_class = preg_replace("/_/", "-", $field_var);
                                             foreach (array_keys(get_defined_vars()) as $__v) {
                                                 $__refs[$__v] =& ${$__v};
                                             }
                                             if (apply_filters("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars())) {
                                                 if (!empty($field["section"]) && $field["section"] === "yes") {
                                                     echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
                                                     echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . '">' . (!empty($field["sectitle"]) ? $field["sectitle"] : '') . '</div></td>' . "\n";
                                                     echo '</tr>' . "\n";
                                                 }
                                                 echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . '">' . "\n";
                                                 echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' label"><span>' . $field["label"] . '</span></td>' . "\n";
                                                 echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile-view") . '</td>' . "\n";
                                                 echo '</tr>' . "\n";
                                             }
                                             unset($__refs, $__v);
                                         }
                                         foreach (array_keys(get_defined_vars()) as $__v) {
                                             $__refs[$__v] =& ${$__v};
                                         }
                                         do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars());
                                         unset($__refs, $__v);
                                     }
                                 }
                             }
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars());
                         unset($__refs, $__v);
                     }
                 }
             }
         }
     }
     do_action("ws_plugin__s2member_after_custom_profile_field_items_4bp", get_defined_vars());
     return;
 }
예제 #9
0
function gconnect_member_single_template()
{
    $template = 'activity.php';
    if (bp_is_user_blogs()) {
        $template = 'blogs.php';
    } elseif (bp_is_user_friends()) {
        $template = 'friends.php';
    } elseif (bp_is_user_groups()) {
        $template = 'groups.php';
    } elseif (bp_is_user_messages()) {
        $template = 'messages.php';
    } elseif (bp_is_user_profile()) {
        $template = 'profile.php';
    }
    do_action('bp_before_member_body');
    gconnect_locate_template(array("members/single/{$template}"), true);
    do_action('bp_after_member_body');
}
예제 #10
0
function bp_get_the_body_class($nxt_classes, $custom_classes = false)
{
    $bp_classes = array();
    /** Pages *************************************************************/
    if (is_front_page()) {
        $bp_classes[] = 'home-page';
    }
    if (bp_is_directory()) {
        $bp_classes[] = 'directory';
    }
    if (bp_is_single_item()) {
        $bp_classes[] = 'single-item';
    }
    /** Components ********************************************************/
    if (!bp_is_blog_page()) {
        if (bp_is_user_profile()) {
            $bp_classes[] = 'xprofile';
        }
        if (bp_is_activity_component()) {
            $bp_classes[] = 'activity';
        }
        if (bp_is_blogs_component()) {
            $bp_classes[] = 'blogs';
        }
        if (bp_is_messages_component()) {
            $bp_classes[] = 'messages';
        }
        if (bp_is_friends_component()) {
            $bp_classes[] = 'friends';
        }
        if (bp_is_groups_component()) {
            $bp_classes[] = 'groups';
        }
        if (bp_is_settings_component()) {
            $bp_classes[] = 'settings';
        }
    }
    /** User **************************************************************/
    if (!bp_is_directory()) {
        if (bp_is_user_blogs()) {
            $bp_classes[] = 'my-blogs';
        }
        if (bp_is_user_groups()) {
            $bp_classes[] = 'my-groups';
        }
        if (bp_is_user_activity()) {
            $bp_classes[] = 'my-activity';
        }
    }
    if (bp_is_my_profile()) {
        $bp_classes[] = 'my-account';
    }
    if (bp_is_user_profile()) {
        $bp_classes[] = 'my-profile';
    }
    if (bp_is_user_friends()) {
        $bp_classes[] = 'my-friends';
    }
    if (bp_is_user_messages()) {
        $bp_classes[] = 'my-messages';
    }
    if (bp_is_user_recent_commments()) {
        $bp_classes[] = 'recent-comments';
    }
    if (bp_is_user_recent_posts()) {
        $bp_classes[] = 'recent-posts';
    }
    if (bp_is_user_change_avatar()) {
        $bp_classes[] = 'change-avatar';
    }
    if (bp_is_user_profile_edit()) {
        $bp_classes[] = 'profile-edit';
    }
    if (bp_is_user_friends_activity()) {
        $bp_classes[] = 'friends-activity';
    }
    if (bp_is_user_groups_activity()) {
        $bp_classes[] = 'groups-activity';
    }
    if (is_user_logged_in()) {
        $bp_classes[] = 'logged-in';
    }
    /** Messages **********************************************************/
    if (bp_is_messages_inbox()) {
        $bp_classes[] = 'inbox';
    }
    if (bp_is_messages_sentbox()) {
        $bp_classes[] = 'sentbox';
    }
    if (bp_is_messages_compose_screen()) {
        $bp_classes[] = 'compose';
    }
    if (bp_is_notices()) {
        $bp_classes[] = 'notices';
    }
    if (bp_is_user_friend_requests()) {
        $bp_classes[] = 'friend-requests';
    }
    if (bp_is_create_blog()) {
        $bp_classes[] = 'create-blog';
    }
    /** Groups ************************************************************/
    if (bp_is_group_leave()) {
        $bp_classes[] = 'leave-group';
    }
    if (bp_is_group_invites()) {
        $bp_classes[] = 'group-invites';
    }
    if (bp_is_group_members()) {
        $bp_classes[] = 'group-members';
    }
    if (bp_is_group_forum_topic()) {
        $bp_classes[] = 'group-forum-topic';
    }
    if (bp_is_group_forum_topic_edit()) {
        $bp_classes[] = 'group-forum-topic-edit';
    }
    if (bp_is_group_forum()) {
        $bp_classes[] = 'group-forum';
    }
    if (bp_is_group_admin_page()) {
        $bp_classes[] = 'group-admin';
    }
    if (bp_is_group_create()) {
        $bp_classes[] = 'group-create';
    }
    if (bp_is_group_home()) {
        $bp_classes[] = 'group-home';
    }
    if (bp_is_single_activity()) {
        $bp_classes[] = 'activity-permalink';
    }
    /** Registration ******************************************************/
    if (bp_is_register_page()) {
        $bp_classes[] = 'registration';
    }
    if (bp_is_activation_page()) {
        $bp_classes[] = 'activation';
    }
    /** Current Component & Action ****************************************/
    if (!bp_is_blog_page()) {
        $bp_classes[] = bp_current_component();
        $bp_classes[] = bp_current_action();
    }
    /** Clean up***********************************************************/
    // We don't want NXTClass blog classes to appear on non-blog pages.
    if (!bp_is_blog_page()) {
        // Preserve any custom classes already set
        if (!empty($custom_classes)) {
            $nxt_classes = (array) $custom_classes;
        } else {
            $nxt_classes = array();
        }
    }
    // Merge nxt classes with BP classes
    $classes = array_merge((array) $bp_classes, (array) $nxt_classes);
    // Remove any duplicates
    $classes = array_unique($classes);
    return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $nxt_classes, $custom_classes);
}
 /**
  * Adds Custom Fields to BuddyPress Profiles in public view.
  *
  * @package s2Member\Custom_Reg_Fields
  * @since 110524RC
  *
  * @attaches-to ``add_action('bp_profile_field_item');``
  */
 public static function custom_profile_field_items_4bp()
 {
     global $bp;
     // Global reference to the BuddyPress object.
     static $processed = FALSE;
     // Process this routine only one time.
     do_action('ws_plugin__s2member_before_custom_profile_field_items_4bp', get_defined_vars());
     if (!$processed && in_array('profile-view', $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields_4bp'])) {
         if (apply_filters('ws_plugin__s2member_custom_profile_field_items_4bp_display', TRUE, get_defined_vars())) {
             if (bp_is_user_profile() && !bp_is_user_profile_edit() && (int) bp_get_the_profile_group_id() === 1) {
                 if (isset($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id) && ($processed = TRUE)) {
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_before', get_defined_vars());
                     unset($__refs, $__v);
                     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
                         if (($level = c_ws_plugin__s2member_user_access::user_access_level(new WP_User($user_id))) >= 0) {
                             if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, 'profile-view')) {
                                 $fields = get_user_option('s2member_custom_fields', $user_id);
                                 foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
                                     foreach (array_keys(get_defined_vars()) as $__v) {
                                         $__refs[$__v] =& ${$__v};
                                     }
                                     do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields', get_defined_vars());
                                     unset($__refs, $__v);
                                     if (in_array($field['id'], $fields_applicable)) {
                                         $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
                                         $field_id_class = preg_replace('/_/', '-', $field_var);
                                         foreach (array_keys(get_defined_vars()) as $__v) {
                                             $__refs[$__v] =& ${$__v};
                                         }
                                         if (apply_filters('ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display', TRUE, get_defined_vars())) {
                                             if (!empty($field['section']) && $field['section'] === 'yes') {
                                                 echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
                                                 echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . '">' . (!empty($field['sectitle']) ? $field['sectitle'] : '') . '</div></td>' . "\n";
                                                 echo '</tr>' . "\n";
                                             }
                                             echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . '">' . "\n";
                                             echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' label"><span>' . $field['label'] . '</span></td>' . "\n";
                                             echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'ws_plugin__s2member_profile_4bp_', 'ws-plugin--s2member-profile-4bp-', 'ws-plugin--s2member-profile-field-4bp', '', '', '', $fields, @$fields[$field_var], 'profile-view') . '</td>' . "\n";
                                             echo '</tr>' . "\n";
                                         }
                                         unset($__refs, $__v);
                                     }
                                     foreach (array_keys(get_defined_vars()) as $__v) {
                                         $__refs[$__v] =& ${$__v};
                                     }
                                     do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields', get_defined_vars());
                                     unset($__refs, $__v);
                                 }
                             }
                         }
                     }
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_after', get_defined_vars());
                     unset($__refs, $__v);
                 }
             }
         }
     }
     do_action('ws_plugin__s2member_after_custom_profile_field_items_4bp', get_defined_vars());
 }
/**
 * Check if on an allowed BuddyPress component
 *
 * @since  4.2.0
 *
 * @return boolean  true if an allowed component, false otherwise
 */
function bp_registration_buddypress_allowed_areas()
{
    if (!function_exists('bp_is_my_profile')) {
        return false;
    }
    global $bp;
    if (bp_is_my_profile() || bp_is_user_profile() || bp_is_user_profile_edit() || $bp->current_component == 'register' || $bp->current_component == 'activate') {
        return true;
    }
    return false;
}
예제 #13
0
/**
 * Check if this is a BuddyPress page or not.
 * Returns true or false (boolean)
 */
function shoestrap_is_bp()
{
    $bp = false;
    /** Pages *************************************************************/
    if (!$bp && bp_is_directory()) {
        $bp = true;
    } elseif (!$bp && bp_is_single_item()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_profile()) {
        $bp = true;
    } elseif (!$bp && bp_is_activity_component()) {
        $bp = true;
    } elseif (!$bp && bp_is_blogs_component()) {
        $bp = true;
    } elseif (!$bp && bp_is_messages_component()) {
        $bp = true;
    } elseif (!$bp && bp_is_friends_component()) {
        $bp = true;
    } elseif (!$bp && bp_is_groups_component()) {
        $bp = true;
    } elseif (!$bp && bp_is_settings_component()) {
        $bp = true;
    } elseif (!$bp && bp_is_user()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_blogs()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_groups()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_activity()) {
        $bp = true;
    } elseif (!$bp && bp_is_my_profile()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_profile()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_friends()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_messages()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_recent_commments()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_recent_posts()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_change_avatar()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_profile_edit()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_friends_activity()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_groups_activity()) {
        $bp = true;
    } elseif (!$bp && is_user_logged_in()) {
        $bp = true;
    } elseif (!$bp && bp_is_messages_inbox()) {
        $bp = true;
    } elseif (!$bp && bp_is_messages_sentbox()) {
        $bp = true;
    } elseif (!$bp && bp_is_messages_compose_screen()) {
        $bp = true;
    } elseif (!$bp && bp_is_notices()) {
        $bp = true;
    } elseif (!$bp && bp_is_user_friend_requests()) {
        $bp = true;
    } elseif (!$bp && bp_is_create_blog()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_leave()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_invites()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_members()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_forum_topic()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_forum_topic_edit()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_forum()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_admin_page()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_create()) {
        $bp = true;
    } elseif (!$bp && bp_is_group_home()) {
        $bp = true;
    } elseif (!$bp && bp_is_single_activity()) {
        $bp = true;
    } elseif (!$bp && bp_is_register_page()) {
        $bp = true;
    } elseif (!$bp && bp_is_activation_page()) {
        $bp = true;
    } elseif (!$bp && !bp_is_blog_page()) {
        $bp = true;
    }
    return $bp;
}
예제 #14
0
 function test_member_profile()
 {
     $this->go_to(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_profile_slug());
     $this->assertTrue(bp_is_user_profile());
 }
 function modify_profile_loop($has_profile)
 {
     global $profile_template;
     // We only want to modify the loop if this is a public profile
     if (!bp_is_user_profile() || bp_is_user_profile_edit()) {
         return $has_profile;
     }
     $this->load_fieldmeta();
     // While we're looping through, grab the ids and put them in a property for later
     // access
     $this_user_data_ids = array();
     foreach ($profile_template->groups as $group_key => $group) {
         foreach ($group->fields as $field_key => $field) {
             $this_field_id = (int) $field->id;
             if (isset($this->fieldmeta[$this_field_id])) {
                 unset($profile_template->groups[$group_key]->fields[$field_key]);
             }
             $this_user_data_ids[] = $this_field_id;
         }
         // If we've emptied the group, remove it now
         if (empty($group->fields)) {
             unset($profile_template->groups[$group_key]);
         }
     }
     if (empty($this->this_user_data_ids)) {
         $this->this_user_data_ids = $this_user_data_ids;
     }
     // Reset indexes
     $profile_template->groups = array_values($profile_template->groups);
     return $has_profile;
 }
예제 #16
0
 /**
  * Similar to the post_class() function, but for BP. This is NOT used by core Suffusion, but is useful for child themes using BP.
  * This might be defined by the Suffusion BuddyPress Pack for BP users of Suffusion, but is included conditionally here so
  * that the theme and the plugin can be used independently of each other and so that one version of Suffusion can work with an older
  * version of the BP pack.
  *
  * @since 3.6.7
  * @param bool $custom
  * @param bool $echo
  * @return bool|string
  */
 function suffusion_bp_content_class($custom = false, $echo = true)
 {
     if (!function_exists('bp_is_group')) {
         return false;
     }
     $css = array();
     $css[] = 'post';
     if (function_exists('bp_is_profile_component') && bp_is_profile_component()) {
         $css[] = 'profile-component';
     }
     if (function_exists('bp_is_activity_component') && bp_is_activity_component()) {
         $css[] = 'activity-component';
     }
     if (function_exists('bp_is_blogs_component') && bp_is_blogs_component()) {
         $css[] = 'blogs-component';
     }
     if (function_exists('bp_is_messages_component') && bp_is_messages_component()) {
         $css[] = 'messages-component';
     }
     if (function_exists('bp_is_friends_component') && bp_is_friends_component()) {
         $css[] = 'friends-component';
     }
     if (function_exists('bp_is_groups_component') && bp_is_groups_component()) {
         $css[] = 'groups-component';
     }
     if (function_exists('bp_is_settings_component') && bp_is_settings_component()) {
         $css[] = 'settings-component';
     }
     if (function_exists('bp_is_member') && bp_is_member()) {
         $css[] = 'member';
     }
     if (function_exists('bp_is_user_activity') && bp_is_user_activity()) {
         $css[] = 'user-activity';
     }
     if (function_exists('bp_is_user_friends_activity') && bp_is_user_friends_activity()) {
         $css[] = 'user-friends-activity';
     }
     if (function_exists('bp_is_activity_permalink') && bp_is_activity_permalink()) {
         $css[] = 'activity-permalink';
     }
     if (function_exists('bp_is_user_profile') && bp_is_user_profile()) {
         $css[] = 'user-profile';
     }
     if (function_exists('bp_is_profile_edit') && bp_is_profile_edit()) {
         $css[] = 'profile-edit';
     }
     if (function_exists('bp_is_change_avatar') && bp_is_change_avatar()) {
         $css[] = 'change-avatar';
     }
     if (function_exists('bp_is_user_groups') && bp_is_user_groups()) {
         $css[] = 'user-groups';
     }
     if (function_exists('bp_is_group') && bp_is_group()) {
         $css[] = 'group';
     }
     if (function_exists('bp_is_group_home') && bp_is_group_home()) {
         $css[] = 'group-home';
     }
     if (function_exists('bp_is_group_create') && bp_is_group_create()) {
         $css[] = 'group-create';
     }
     if (function_exists('bp_is_group_admin_page') && bp_is_group_admin_page()) {
         $css[] = 'group-admin-page';
     }
     if (function_exists('bp_is_group_forum') && bp_is_group_forum()) {
         $css[] = 'group-forum';
     }
     if (function_exists('bp_is_group_activity') && bp_is_group_activity()) {
         $css[] = 'group-activity';
     }
     if (function_exists('bp_is_group_forum_topic') && bp_is_group_forum_topic()) {
         $css[] = 'group-forum-topic';
     }
     if (function_exists('bp_is_group_forum_topic_edit') && bp_is_group_forum_topic_edit()) {
         $css[] = 'group-forum-topic-edit';
     }
     if (function_exists('bp_is_group_members') && bp_is_group_members()) {
         $css[] = 'group-members';
     }
     if (function_exists('bp_is_group_invites') && bp_is_group_invites()) {
         $css[] = 'group-invites';
     }
     if (function_exists('bp_is_group_membership_request') && bp_is_group_membership_request()) {
         $css[] = 'group-membership-request';
     }
     if (function_exists('bp_is_group_leave') && bp_is_group_leave()) {
         $css[] = 'group-leave';
     }
     if (function_exists('bp_is_group_single') && bp_is_group_single()) {
         $css[] = 'group-single';
     }
     if (function_exists('bp_is_user_blogs') && bp_is_user_blogs()) {
         $css[] = 'user-blogs';
     }
     if (function_exists('bp_is_user_recent_posts') && bp_is_user_recent_posts()) {
         $css[] = 'user-recent-posts';
     }
     if (function_exists('bp_is_user_recent_commments') && bp_is_user_recent_commments()) {
         $css[] = 'user-recent-commments';
     }
     if (function_exists('bp_is_create_blog') && bp_is_create_blog()) {
         $css[] = 'create-blog';
     }
     if (function_exists('bp_is_user_friends') && bp_is_user_friends()) {
         $css[] = 'user-friends';
     }
     if (function_exists('bp_is_friend_requests') && bp_is_friend_requests()) {
         $css[] = 'friend-requests';
     }
     if (function_exists('bp_is_user_messages') && bp_is_user_messages()) {
         $css[] = 'user-messages';
     }
     if (function_exists('bp_is_messages_inbox') && bp_is_messages_inbox()) {
         $css[] = 'messages-inbox';
     }
     if (function_exists('bp_is_messages_sentbox') && bp_is_messages_sentbox()) {
         $css[] = 'messages-sentbox';
     }
     if (function_exists('bp_is_notices') && bp_is_notices()) {
         $css[] = 'notices';
     }
     if (function_exists('bp_is_messages_compose_screen') && bp_is_messages_compose_screen()) {
         $css[] = 'messages-compose-screen';
     }
     if (function_exists('bp_is_single_item') && bp_is_single_item()) {
         $css[] = 'single-item';
     }
     if (function_exists('bp_is_activation_page') && bp_is_activation_page()) {
         $css[] = 'activation-page';
     }
     if (function_exists('bp_is_register_page') && bp_is_register_page()) {
         $css[] = 'register-page';
     }
     $css[] = 'fix';
     if (is_array($custom)) {
         foreach ($custom as $class) {
             if (!in_array($class, $css)) {
                 $css[] = esc_attr($class);
             }
         }
     } else {
         if ($custom != false) {
             $css[] = $custom;
         }
     }
     $css_class = implode(' ', $css);
     if ($echo) {
         echo ' class="' . $css_class . '" ';
     }
     return ' class="' . $css_class . '" ';
 }
예제 #17
0
 function body_class($wp_classes, $custom_classes = false)
 {
     global $bp;
     $bp_classes = array();
     if (bp_is_directory()) {
         $bp_classes[] = 'directory';
     } elseif (bp_is_single_item()) {
         $bp_classes[] = 'single-item';
     } elseif (bp_is_activity_component() || $this->show_activity_page) {
         $bp_classes[] = 'activity';
     }
     if ($this->adminbar && $this->theme->have_adminbar()) {
         $bp_classes[] = 'adminbar';
     }
     if (!is_page() && is_front_page() && is_file(CHILD_DIR . '/home.php')) {
         $bp_classes[] = 'home';
     }
     if ($this->show_activity_page) {
         $bp_classes[] = 'internal-page';
     } elseif (!bp_is_blog_page()) {
         $wp_classes = array();
         if (!bp_is_directory()) {
             $bp_classes[] = 'internal-page';
         }
         if (bp_is_user_profile()) {
             $bp_classes[] = 'profile';
         } elseif (bp_is_blogs_component()) {
             $bp_classes[] = 'blogs';
         } elseif (bp_is_messages_component()) {
             $bp_classes[] = 'messages';
         } elseif (bp_is_friends_component()) {
             $bp_classes[] = 'friends';
         } elseif (bp_is_groups_component()) {
             $bp_classes[] = 'groups';
         } elseif (bp_is_settings_component()) {
             $bp_classes[] = 'settings';
         }
     }
     if (is_user_logged_in()) {
         $bp_classes[] = 'logged-in';
         if (!bp_is_directory()) {
             if (bp_is_user_friends()) {
                 $bp_classes[] = 'my-friends';
             } elseif (bp_is_user_activity()) {
                 $bp_classes[] = 'my-activity';
             } elseif (bp_is_user_blogs()) {
                 $bp_classes[] = 'my-blogs';
             } elseif (bp_is_user_groups()) {
                 $bp_classes[] = 'my-groups';
             } elseif (bp_is_messages_inbox()) {
                 $bp_classes[] = 'inbox';
             } elseif (bp_is_messages_sentbox()) {
                 $bp_classes[] = 'sentbox';
             } elseif (bp_is_messages_compose_screen()) {
                 $bp_classes[] = 'compose';
             } elseif (bp_is_notices()) {
                 $bp_classes[] = 'notices';
             } elseif (bp_is_user_friend_requests()) {
                 $bp_classes[] = 'friend-requests';
             } elseif (bp_is_create_blog()) {
                 $bp_classes[] = 'create-blog';
             } elseif (bp_is_group_leave()) {
                 $bp_classes[] = 'leave-group';
             } elseif (bp_is_group_invites()) {
                 $bp_classes[] = 'group-invites';
             } elseif (bp_is_group_forum_topic_edit()) {
                 $bp_classes[] = 'group-forum-topic-edit';
             } elseif (bp_is_group_admin_page()) {
                 $bp_classes[] = 'group-admin';
             } elseif (bp_is_group_create()) {
                 $bp_classes[] = 'group-create';
             } elseif (bp_is_user_change_avatar()) {
                 $bp_classes[] = 'change-avatar';
             } elseif (bp_is_user_profile_edit()) {
                 $bp_classes[] = 'profile-edit';
             }
         }
     } else {
         $bp_classes[] = 'visitor';
     }
     if (bp_is_group_members()) {
         $bp_classes[] = 'group-members';
     } elseif (bp_is_group_home()) {
         $bp_classes[] = 'group-home';
     } elseif (bp_is_group_forum()) {
         $bp_classes[] = 'group-forum';
         if (bp_is_group_forum_topic()) {
             $bp_classes[] = 'group-forum-topic';
         }
     } else {
         if (bp_is_user_recent_commments()) {
             $bp_classes[] = 'recent-comments';
         }
         if (bp_is_user_recent_posts()) {
             $bp_classes[] = 'recent-posts';
         }
         if (bp_is_user_friends_activity()) {
             $bp_classes[] = 'friends-activity';
         } elseif (bp_is_single_activity()) {
             $bp_classes[] = 'activity-permalink';
         } elseif (bp_is_register_page()) {
             $bp_classes[] = 'registration';
         } elseif (bp_is_activation_page()) {
             $bp_classes[] = 'activation';
         }
     }
     /* Add the current_component, current_action into the bp classes */
     if (!bp_is_blog_page()) {
         if (!empty($bp->current_component)) {
             $bp_classes[] = $bp->current_component;
         }
         if (!empty($bp->current_action)) {
             $bp_classes[] = $bp->current_action;
         }
     }
     if ((!bp_is_blog_page() || is_home()) && !empty($custom_classes)) {
         $wp_classes = (array) $custom_classes;
     }
     /* Merge WP classes with BP classes */
     $classes = array_merge((array) $bp_classes, (array) $wp_classes);
     /* Remove any duplicates */
     $classes = array_unique($classes);
     return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes);
 }
예제 #18
0
 /**
  * Get the page context
  * @version 2.0
  */
 function get_context()
 {
     // Setup placeholders
     $title = SITENAME;
     $desc = get_bloginfo('description');
     $classes = get_body_class();
     $crumbs = array();
     // Get some data
     $id = $this->queried_object_id;
     $object = $this->queried_object;
     $sep = " &bull; ";
     /*--------------------------------------------
     			DEFAULT CONTEXT
     		---------------------------------------------*/
     $classes[] = 0 == get_current_user_id() ? 'logged-out' : 'logged-in';
     $crumbs[] = '<a href="' . SITEURL . '" title="' . SITENAME . '" rel="home" class="trail-home">Home</a>';
     // Homepage
     if (is_home()) {
         $title = SITENAME . $sep . 'Home';
         $classes[] = 'home';
         $classes[] = 'sidebar';
         $classes[] = 'archive';
         /*--------------------------------------------
         			BUDDYPRESS CONTEXT
         		---------------------------------------------*/
     } elseif (class_exists('BuddyPress') && is_buddypress()) {
         // BuddyPress Defaults
         $title = "BuddyPress Page";
         $desc = "This is a BuddyPress page.";
         $classes[] = 'buddypress';
         // User Profiles
         if (bp_is_user()) {
             $title = bp_get_displayed_user_fullname() . $sep . "User Profile";
             $desc = SITENAME . " user profile for member " . bp_get_displayed_user_fullname();
             // Your own profile
             if (bp_is_my_profile()) {
                 $crumbs[] = 'Your Profile';
             } else {
                 $crumbs[] = '<a href="' . bp_get_members_directory_permalink() . '" title="Members Directory">Members</a>';
                 $crumbs[] = '<a href="' . bp_displayed_user_domain() . '" title="' . bp_get_displayed_user_fullname() . '">' . bp_get_displayed_user_fullname() . '</a>';
             }
             // Display the profile component if it isnt the profile home
             if (!bp_is_user_profile()) {
                 $crumbs[] = ucfirst(bp_current_component());
             }
             // Display the current action if it is not the default public profile
             if (!in_array(bp_current_action(), array('public', 'just-me', 'my-friends'))) {
                 $crumbs[] = ucfirst(bp_current_action());
             }
             // Single Group
         } elseif (bp_is_group() || bp_is_group_create()) {
             // Group Creation
             if (bp_is_group_create()) {
                 $title = 'Submit New Group';
                 $desc = 'Submit a new user group for listing on the ' . SITENAME . ' community groups directory.';
                 $crumbs[] = '<a href="' . SITEURL . '/' . bp_get_groups_root_slug() . '" title="Groups Directory">Groups</a>';
                 $crumbs[] = 'Create Group';
             } elseif (bp_is_group()) {
                 // Default entries
                 $title = bp_get_group_name();
                 $desc = SITENAME . ' guild profile for ' . bp_get_group_name();
                 $classes = array_diff($classes, array('page', 'page-template-default'));
                 $crumbs[] = '<a href="' . bp_get_groups_directory_permalink() . '" title="Groups Directory">Groups</a>';
                 // Group Profile Home
                 if (bp_is_group_home()) {
                     $title = $title . $sep . 'Profile';
                     $crumbs[] = bp_get_group_name();
                     // Advanced Component
                 } else {
                     // Link back to group profile
                     $crumbs[] = '<a href="' . bp_get_group_permalink() . '" title="Return to Group Profile">' . bp_get_group_name() . '</a>';
                     // Members
                     if (bp_is_group_members()) {
                         $title = $title . $sep . 'Members';
                         $crumbs[] = 'Members';
                         // Activity
                     } elseif (bp_is_group_activity()) {
                         $title = $title . $sep . 'Activity';
                         $crumbs[] = 'Activity';
                         // Invites
                     } elseif (bp_is_group_invites()) {
                         $title = $title . $sep . 'Invitations';
                         $crumbs[] = 'Invitations';
                         // Admin
                     } elseif (bp_is_group_admin_page()) {
                         $title = $title . $sep . 'Admin';
                         $crumbs[] = 'Admin';
                         // Forum
                     } else {
                         // Forum Root
                         if (NULL == bp_action_variable()) {
                             $title = $title . $sep . 'Forum';
                             $crumbs[] = 'Forum';
                             // Sub-Component
                         } else {
                             $crumbs[] = '<a href="' . bp_get_group_permalink() . 'forum/" title="Group Forum">Forum</a>';
                             // Retrieve topic information from the database
                             global $bp;
                             global $wpdb;
                             // Single Topic
                             if (bp_is_action_variable('topic', 0)) {
                                 // Get the topic
                                 $topic = $wpdb->get_row($wpdb->prepare("SELECT post_title AS title, post_name AS url\n\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->posts} \n\t\t\t\t\t\t\t\t\t\tWHERE post_name = %s", $bp->action_variables[1]));
                                 $title = $topic->title;
                                 $crumbs[] = $topic->title;
                                 // Replies
                             } elseif (bp_is_action_variable('reply', 0)) {
                                 // Get the reply parent topic
                                 $topic = $wpdb->get_row($wpdb->prepare("SELECT post_title AS title, post_name AS url\n\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->posts} \n\t\t\t\t\t\t\t\t\t\tWHERE ID = ( \n\t\t\t\t\t\t\t\t\t\t\tSELECT post_parent\n\t\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->posts}\n\t\t\t\t\t\t\t\t\t\t\tWHERE post_name = %s \n\t\t\t\t\t\t\t\t\t\t)", $bp->action_variables[1]));
                                 $title = $topic->title;
                                 $crumbs[] = $topic->title;
                             }
                             // Topic and Reply Edits
                             if (bp_is_action_variable('edit', 2)) {
                                 $crumbs[] = 'Edit';
                             }
                         }
                     }
                 }
             }
             // Directories
         } elseif (bp_is_directory()) {
             // Sitewide Activity
             if (bp_is_activity_component()) {
                 $title = SITENAME . ' Sitewide Activity Feed';
                 $desc = 'A listing of all recent activity happening throughout the ' . SITENAME . ' community.';
                 $crumbs[] = 'Sitewide Activity';
                 // Members Directory
             } elseif (bp_is_members_component()) {
                 $title = SITENAME . ' Members Directory';
                 $desc = 'A listing of all registered members in the ' . SITENAME . ' community.';
                 $crumbs[] = 'Members Directory';
                 // Groups Directory
             } elseif (bp_is_groups_component()) {
                 $title = SITENAME . ' Guilds Directory';
                 $desc = 'A directory listing of guilds active within in the ' . SITENAME . ' community.';
                 $crumbs[] = 'Guilds Directory';
             }
             // Registration
         } elseif (bp_is_register_page()) {
             $title = SITENAME . ' User Registration';
             $desc = "Register to join the " . SITENAME . " community.";
             $crumbs[] = "User Registration";
             // Activation
         } elseif (bp_is_activation_page()) {
             $title = SITENAME . ' Account Activation';
             $desc = "Activate a pending " . SITENAME . " user account.";
             $crumbs[] = "Account Activation";
         }
         /*--------------------------------------------
         			BBPRESS CONTEXT
         		---------------------------------------------*/
     } elseif (class_exists('bbPress') && is_bbpress()) {
         // bbPress Defaults
         $classes[] = 'bbpress';
         $classes[] = 'forums';
         $crumbs[] = bbp_is_forum_archive() ? "Forums" : '<a href="' . get_post_type_archive_link('forum') . '">Forums</a>';
         // Main Forum Archive
         if (bbp_is_forum_archive()) {
             $title = SITENAME . " Forums";
             $desc = "Get involved in the community on the " . SITENAME . " forums.";
             // Recent Topics
         } elseif (bbp_is_topic_archive()) {
             $title = "Recent Topics in the " . SITENAME . " Forums";
             $desc = "Browse a list of the most recent topics in the " . SITENAME . " Forums.";
             $crumbs[] = "Recent Topics";
             // Single Forum
         } elseif (bbp_is_single_forum()) {
             $title = $object->post_title;
             $desc = $object->post_content;
             // Loop through parent forums
             $parent_id = bbp_get_forum_parent_id($id);
             if (0 != $parent_id) {
                 $crumbs = array_merge($crumbs, $this->parent_crumbs($parent_id));
             }
             $crumbs[] = $object->post_title;
             // Single Topic
         } elseif (bbp_is_single_topic()) {
             $title = $object->post_title;
             $desc = bbp_get_topic_excerpt($id);
             $crumbs = array_merge($crumbs, $this->parent_crumbs(bbp_get_topic_forum_id($id)));
             $crumbs[] = $object->post_title;
             // Edit Topic
         } elseif (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
             $title = 'Edit Topic' . $sep . $object->post_title;
             $desc = bbp_get_topic_excerpt($id);
             $crumbs = array_merge($crumbs, $this->parent_crumbs($id));
             // Tag the specific task
             if (bbp_is_topic_split()) {
                 $crumbs[] = 'Split Topic';
             } elseif (bbp_is_topic_merge()) {
                 $crumbs[] = 'Merge Topic';
             } elseif (bbp_is_topic_edit()) {
                 $crumbs[] = 'Edit Topic';
             }
             // Edit Reply
         } elseif (bbp_is_reply_edit()) {
             $title = 'Edit Reply' . $sep . bbp_get_reply_topic_title($id);
             $desc = bbp_get_reply_excerpt($id);
             $crumbs = array_merge($crumbs, $this->parent_crumbs(bbp_get_reply_topic_id($id)));
             $crumbs[] = 'Edit Reply';
         }
         /*--------------------------------------------
         			WORDPRESS CONTEXT
         		---------------------------------------------*/
     } else {
         // Singular Posts and Pages
         if (is_singular()) {
             $title = $object->post_title;
             $desc = get_post_meta($id, 'description', true);
             // If no description is found, use an excerpt
             if (empty($desc)) {
                 $desc = get_post_field('post_excerpt', $id);
             }
             // Check for custom template
             $template = get_post_meta($id, "_wp_{$object->post_type}_template", true);
             if ('' != $template) {
                 $template = str_replace(array("{$object->post_type}-template-", "{$object->post_type}-"), '', basename($template, '.php'));
                 $classes[] = "{$template}-template";
             }
             // Generate breadcrumbs by post type
             switch ($object->post_type) {
                 // Single Posts
                 case 'post':
                     // Is the post in a category?
                     $categories = get_the_category();
                     if ($categories) {
                         // Start with the first category
                         $term = $categories[0];
                         // If the category has a parent, add it to the trail.
                         if (0 != $term->parent) {
                             $crumbs = array_merge($crumbs, $this->parent_crumbs($term->parent, 'category'));
                         }
                         // Add the category archive link to the trail.
                         $crumbs[] = '<a href="' . get_term_link($term) . '" title="' . esc_attr($term->name) . '">' . $term->name . '</a>';
                     }
                     // Does the post have an ancestor?
                     if ($object->post_parent) {
                         $crumbs = array_merge($crumbs, $this->parent_crumbs($object->post_parent));
                     }
                     // Editing a comment on this post
                     if (is_comment_edit()) {
                         $crumbs[] = '<a href="' . get_permalink() . '" title="Return to article">' . get_the_title() . '</a>';
                         $crumbs[] = 'Edit Comment';
                         // Reading the post
                     } else {
                         $crumbs[] = get_the_title();
                     }
                     break;
                     // Pages
                 // Pages
                 case 'page':
                     // Does the page have an ancestor?
                     if ($object->post_parent) {
                         $crumbs = array_merge($crumbs, $this->parent_crumbs($object->post_parent));
                     }
                     // Otherwise, viewing the page
                     $crumbs[] = get_the_title();
                     break;
                     // Events
                 // Events
                 case 'event':
                     // Get the calendar the event belongs to
                     $calendar = get_the_terms($object->ID, 'calendar');
                     $calendar = array_shift($calendar);
                     $desc = 'Upcoming event on the ' . $calendar->name . ' calendar.';
                     $crumbs[] = '<a href="' . SITEURL . '/calendar/' . $calendar->slug . '" title="' . $calendar->name . ' Calendar">' . $calendar->name . ' Calendar</a>';
                     $crumbs[] = get_the_title();
                     break;
             }
             // Archives
         } elseif (is_archive()) {
             // Category Archives
             if (is_category()) {
                 $crumbs[] = 'Category';
                 // If the category has a parent, add it to the trail.
                 if ($object->parent != 0) {
                     $crumbs = array_merge($crumbs, $this->trail_parents($object->parent));
                 }
                 // Finish up with the term name
                 $crumbs[] = $object->name;
                 // Author Archive
             } elseif (is_author()) {
                 $title = 'Author Archive' . $sep . $object->display_name;
                 $desc = 'An archive of articles written by ' . $object->display_name;
                 $crumbs[] = 'Author';
                 $crumbs[] = $object->display_name;
                 // Advanced Search Page
             } elseif (is_search()) {
                 $title = SITENAME . " Advanced Search";
                 $desc = "Search for a variety of content types throughout " . SITENAME;
                 $crumbs[] = 'Advanced Search';
                 $classes[] = 'page';
                 // Calendar
             } elseif (is_calendar()) {
                 $title = $object->name . " Calendar";
                 $desc = "Upcoming events on the " . $object->name . " calendar.";
                 $crumbs[] = $object->name . " Calendar";
             }
             // 404
         } elseif (is_404()) {
             $title = "Error" . $sep . "Page Not Found";
             $desc = "Sorry, but this page does not exist, or is not accessible at this time.";
             $classes[] = 'page';
             $crumbs[] = '404 Page Not Found';
         }
     }
     /*--------------------------------------------
     			RETURN DATA
     		---------------------------------------------*/
     $this->title = html_entity_decode($title);
     $this->description = html_entity_decode($desc);
     $this->classes = $classes;
     $this->crumbs = $crumbs;
 }
/**
 * Customize the body class, according to the currently displayed BP content.
 *
 * Uses the above is_() functions to output a body class for each scenario.
 *
 * @since 1.1.0
 *
 * @param array      $wp_classes     The body classes coming from WP.
 * @param array|bool $custom_classes Classes that were passed to get_body_class().
 * @return array $classes The BP-adjusted body classes.
 */
function bp_get_the_body_class($wp_classes = array(), $custom_classes = false)
{
    $bp_classes = array();
    /* Pages *************************************************************/
    if (is_front_page()) {
        $bp_classes[] = 'home-page';
    }
    if (bp_is_directory()) {
        $bp_classes[] = 'directory';
    }
    if (bp_is_single_item()) {
        $bp_classes[] = 'single-item';
    }
    /* Components ********************************************************/
    if (!bp_is_blog_page()) {
        if (bp_is_user_profile()) {
            $bp_classes[] = 'xprofile';
        }
        if (bp_is_activity_component()) {
            $bp_classes[] = 'activity';
        }
        if (bp_is_blogs_component()) {
            $bp_classes[] = 'blogs';
        }
        if (bp_is_messages_component()) {
            $bp_classes[] = 'messages';
        }
        if (bp_is_friends_component()) {
            $bp_classes[] = 'friends';
        }
        if (bp_is_groups_component()) {
            $bp_classes[] = 'groups';
        }
        if (bp_is_settings_component()) {
            $bp_classes[] = 'settings';
        }
    }
    /* User **************************************************************/
    if (bp_is_user()) {
        $bp_classes[] = 'bp-user';
        // Add current user member types.
        if ($member_types = bp_get_member_type(bp_displayed_user_id(), false)) {
            foreach ($member_types as $member_type) {
                $bp_classes[] = sprintf('member-type-%s', esc_attr($member_type));
            }
        }
    }
    if (!bp_is_directory()) {
        if (bp_is_user_blogs()) {
            $bp_classes[] = 'my-blogs';
        }
        if (bp_is_user_groups()) {
            $bp_classes[] = 'my-groups';
        }
        if (bp_is_user_activity()) {
            $bp_classes[] = 'my-activity';
        }
    } else {
        if (bp_get_current_member_type()) {
            $bp_classes[] = 'type';
        }
    }
    if (bp_is_my_profile()) {
        $bp_classes[] = 'my-account';
    }
    if (bp_is_user_profile()) {
        $bp_classes[] = 'my-profile';
    }
    if (bp_is_user_friends()) {
        $bp_classes[] = 'my-friends';
    }
    if (bp_is_user_messages()) {
        $bp_classes[] = 'my-messages';
    }
    if (bp_is_user_recent_commments()) {
        $bp_classes[] = 'recent-comments';
    }
    if (bp_is_user_recent_posts()) {
        $bp_classes[] = 'recent-posts';
    }
    if (bp_is_user_change_avatar()) {
        $bp_classes[] = 'change-avatar';
    }
    if (bp_is_user_profile_edit()) {
        $bp_classes[] = 'profile-edit';
    }
    if (bp_is_user_friends_activity()) {
        $bp_classes[] = 'friends-activity';
    }
    if (bp_is_user_groups_activity()) {
        $bp_classes[] = 'groups-activity';
    }
    /* Messages **********************************************************/
    if (bp_is_messages_inbox()) {
        $bp_classes[] = 'inbox';
    }
    if (bp_is_messages_sentbox()) {
        $bp_classes[] = 'sentbox';
    }
    if (bp_is_messages_compose_screen()) {
        $bp_classes[] = 'compose';
    }
    if (bp_is_notices()) {
        $bp_classes[] = 'notices';
    }
    if (bp_is_user_friend_requests()) {
        $bp_classes[] = 'friend-requests';
    }
    if (bp_is_create_blog()) {
        $bp_classes[] = 'create-blog';
    }
    /* Groups ************************************************************/
    if (bp_is_group()) {
        $bp_classes[] = 'group-' . groups_get_current_group()->slug;
        // Add current group types.
        if ($group_types = bp_groups_get_group_type(bp_get_current_group_id(), false)) {
            foreach ($group_types as $group_type) {
                $bp_classes[] = sprintf('group-type-%s', esc_attr($group_type));
            }
        }
    }
    if (bp_is_group_leave()) {
        $bp_classes[] = 'leave-group';
    }
    if (bp_is_group_invites()) {
        $bp_classes[] = 'group-invites';
    }
    if (bp_is_group_members()) {
        $bp_classes[] = 'group-members';
    }
    if (bp_is_group_forum_topic()) {
        $bp_classes[] = 'group-forum-topic';
    }
    if (bp_is_group_forum_topic_edit()) {
        $bp_classes[] = 'group-forum-topic-edit';
    }
    if (bp_is_group_forum()) {
        $bp_classes[] = 'group-forum';
    }
    if (bp_is_group_admin_page()) {
        $bp_classes[] = 'group-admin';
        $bp_classes[] = bp_get_group_current_admin_tab();
    }
    if (bp_is_group_create()) {
        $bp_classes[] = 'group-create';
        $bp_classes[] = bp_get_groups_current_create_step();
    }
    if (bp_is_group_home()) {
        $bp_classes[] = 'group-home';
    }
    if (bp_is_single_activity()) {
        $bp_classes[] = 'activity-permalink';
    }
    /* Registration ******************************************************/
    if (bp_is_register_page()) {
        $bp_classes[] = 'registration';
    }
    if (bp_is_activation_page()) {
        $bp_classes[] = 'activation';
    }
    /* Current Component & Action ****************************************/
    if (!bp_is_blog_page()) {
        $bp_classes[] = bp_current_component();
        $bp_classes[] = bp_current_action();
    }
    /* Clean up ***********************************************************/
    // Add BuddyPress class if we are within a BuddyPress page.
    if (!bp_is_blog_page()) {
        $bp_classes[] = 'buddypress';
    }
    // Merge WP classes with BuddyPress classes and remove any duplicates.
    $classes = array_unique(array_merge((array) $bp_classes, (array) $wp_classes));
    /**
     * Filters the BuddyPress classes to be added to body_class()
     *
     * @since 1.1.0
     *
     * @param array $classes        Array of body classes to add.
     * @param array $bp_classes     Array of BuddyPress-based classes.
     * @param array $wp_classes     Array of WordPress-based classes.
     * @param array $custom_classes Array of classes that were passed to get_body_class().
     */
    return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes);
}
예제 #20
0
function bp_get_the_body_class($wp_classes = array(), $custom_classes = false)
{
    $bp_classes = array();
    /** Pages *************************************************************/
    if (is_front_page()) {
        $bp_classes[] = 'home-page';
    }
    if (bp_is_directory()) {
        $bp_classes[] = 'directory';
    }
    if (bp_is_single_item()) {
        $bp_classes[] = 'single-item';
    }
    /** Components ********************************************************/
    if (!bp_is_blog_page()) {
        if (bp_is_user_profile()) {
            $bp_classes[] = 'xprofile';
        }
        if (bp_is_activity_component()) {
            $bp_classes[] = 'activity';
        }
        if (bp_is_blogs_component()) {
            $bp_classes[] = 'blogs';
        }
        if (bp_is_messages_component()) {
            $bp_classes[] = 'messages';
        }
        if (bp_is_friends_component()) {
            $bp_classes[] = 'friends';
        }
        if (bp_is_groups_component()) {
            $bp_classes[] = 'groups';
        }
        if (bp_is_settings_component()) {
            $bp_classes[] = 'settings';
        }
    }
    /** User **************************************************************/
    if (bp_is_user()) {
        $bp_classes[] = 'bp-user';
    }
    if (!bp_is_directory()) {
        if (bp_is_user_blogs()) {
            $bp_classes[] = 'my-blogs';
        }
        if (bp_is_user_groups()) {
            $bp_classes[] = 'my-groups';
        }
        if (bp_is_user_activity()) {
            $bp_classes[] = 'my-activity';
        }
    }
    if (bp_is_my_profile()) {
        $bp_classes[] = 'my-account';
    }
    if (bp_is_user_profile()) {
        $bp_classes[] = 'my-profile';
    }
    if (bp_is_user_friends()) {
        $bp_classes[] = 'my-friends';
    }
    if (bp_is_user_messages()) {
        $bp_classes[] = 'my-messages';
    }
    if (bp_is_user_recent_commments()) {
        $bp_classes[] = 'recent-comments';
    }
    if (bp_is_user_recent_posts()) {
        $bp_classes[] = 'recent-posts';
    }
    if (bp_is_user_change_avatar()) {
        $bp_classes[] = 'change-avatar';
    }
    if (bp_is_user_profile_edit()) {
        $bp_classes[] = 'profile-edit';
    }
    if (bp_is_user_friends_activity()) {
        $bp_classes[] = 'friends-activity';
    }
    if (bp_is_user_groups_activity()) {
        $bp_classes[] = 'groups-activity';
    }
    /** Messages **********************************************************/
    if (bp_is_messages_inbox()) {
        $bp_classes[] = 'inbox';
    }
    if (bp_is_messages_sentbox()) {
        $bp_classes[] = 'sentbox';
    }
    if (bp_is_messages_compose_screen()) {
        $bp_classes[] = 'compose';
    }
    if (bp_is_notices()) {
        $bp_classes[] = 'notices';
    }
    if (bp_is_user_friend_requests()) {
        $bp_classes[] = 'friend-requests';
    }
    if (bp_is_create_blog()) {
        $bp_classes[] = 'create-blog';
    }
    /** Groups ************************************************************/
    if (bp_is_group()) {
        $bp_classes[] = 'group-' . groups_get_current_group()->slug;
    }
    if (bp_is_group_leave()) {
        $bp_classes[] = 'leave-group';
    }
    if (bp_is_group_invites()) {
        $bp_classes[] = 'group-invites';
    }
    if (bp_is_group_members()) {
        $bp_classes[] = 'group-members';
    }
    if (bp_is_group_forum_topic()) {
        $bp_classes[] = 'group-forum-topic';
    }
    if (bp_is_group_forum_topic_edit()) {
        $bp_classes[] = 'group-forum-topic-edit';
    }
    if (bp_is_group_forum()) {
        $bp_classes[] = 'group-forum';
    }
    if (bp_is_group_admin_page()) {
        $bp_classes[] = 'group-admin';
        $bp_classes[] = bp_get_group_current_admin_tab();
    }
    if (bp_is_group_create()) {
        $bp_classes[] = 'group-create';
        $bp_classes[] = bp_get_groups_current_create_step();
    }
    if (bp_is_group_home()) {
        $bp_classes[] = 'group-home';
    }
    if (bp_is_single_activity()) {
        $bp_classes[] = 'activity-permalink';
    }
    /** Registration ******************************************************/
    if (bp_is_register_page()) {
        $bp_classes[] = 'registration';
    }
    if (bp_is_activation_page()) {
        $bp_classes[] = 'activation';
    }
    /** Current Component & Action ****************************************/
    if (!bp_is_blog_page()) {
        $bp_classes[] = bp_current_component();
        $bp_classes[] = bp_current_action();
    }
    /** Clean up ***********************************************************/
    // Add BuddyPress class if we are within a BuddyPress page
    if (!bp_is_blog_page()) {
        $bp_classes[] = 'buddypress';
    }
    // Merge WP classes with BuddyPress classes and remove any duplicates
    $classes = array_unique(array_merge((array) $bp_classes, (array) $wp_classes));
    return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes);
}
예제 #21
0
파일: home.php 프로젝트: quyip8818/wps
      <div id="item-body" role="main" class="col-sm-12">


          <?php 
do_action('bp_before_member_body');
if (bp_is_user_activity() || !bp_current_component()) {
    bp_get_template_part('members/single/activity');
} elseif (bp_is_user_blogs()) {
    bp_get_template_part('members/single/blogs');
} elseif (bp_is_user_friends()) {
    bp_get_template_part('members/single/friends');
} elseif (bp_is_user_groups()) {
    bp_get_template_part('members/single/groups');
} elseif (bp_is_user_messages()) {
    bp_get_template_part('members/single/messages');
} elseif (bp_is_user_profile()) {
    bp_get_template_part('members/single/profile');
} elseif (bp_is_user_forums()) {
    bp_get_template_part('members/single/forums');
} elseif (bp_is_user_notifications()) {
    bp_get_template_part('members/single/notifications');
} elseif (bp_is_user_settings()) {
    bp_get_template_part('members/single/settings');
    // If nothing sticks, load a generic template
} else {
    bp_get_template_part('members/single/plugins');
}
do_action('bp_after_member_body');
?>

      </div>
예제 #22
0
파일: home.php 프로젝트: n-sane/zaroka
				<?php if ( bp_is_user_activity() || !bp_current_component() ) : ?>
					<?php locate_template( array( 'members/single/activity.php' ), true ) ?>

				<?php elseif ( bp_is_user_blogs() ) : ?>
					<?php locate_template( array( 'members/single/blogs.php' ), true ) ?>

				<?php elseif ( bp_is_user_friends() ) : ?>
					<?php locate_template( array( 'members/single/friends.php' ), true ) ?>

				<?php elseif ( bp_is_user_groups() ) : ?>
					<?php locate_template( array( 'members/single/groups.php' ), true ) ?>

				<?php elseif ( bp_is_user_messages() ) : ?>
					<?php locate_template( array( 'members/single/messages.php' ), true ) ?>

				<?php elseif ( bp_is_user_profile() ) : ?>
					<?php locate_template( array( 'members/single/profile.php' ), true ) ?>

				<?php else : ?>
					<?php
						/* If nothing sticks, just load a member front template if one exists. */
						locate_template( array( 'members/single/front.php' ), true );
					?>
				<?php endif; ?>

				<?php do_action( 'bp_after_member_body' ) ?>

			</div><!-- #item-body -->

			<?php do_action( 'bp_after_member_home_content' ) ?>
예제 #23
0
파일: theme.php 프로젝트: schiz/scrollax
 function miss_bp_document_title()
 {
     global $page, $paged, $wp_query;
     /* Set up some default variables. */
     $domain = MISS_TEXTDOMAIN;
     $doctitle = get_bloginfo('name');
     $separator = ' | ';
     $description = get_bloginfo('description', 'display');
     /* bp */
     if (function_exists('bp_is_user_friends') && bp_is_user_friends()) {
         $prefix = __('Friends', MISS_TEXTDOMAIN);
     } elseif (function_exists('bp_is_user_profile_edit') && bp_is_user_profile_edit()) {
         $prefix = __('Edit Profile', MISS_TEXTDOMAIN);
     } elseif (function_exists('bp_is_user_profile') && bp_is_user_profile()) {
         $prefix = __('User Profile', MISS_TEXTDOMAIN);
     } elseif (function_exists('bp_is_activity_component') && bp_is_activity_component() && is_numeric($bp->current_action)) {
         $activity = bp_activity_get_specific(array('activity_ids' => $bp->current_action));
         if ($activity = $activity['activities'][0]) {
             if (!empty($activity->content)) {
                 $prefix = mb_strimwidth(preg_replace("/[^A-Za-z0-9\\s\\s+\\-]/", "", strip_tags($activity->content)), 0, 70 - 3 - 3 - strlen($blog_title), '...');
             }
         }
     }
     /* If the current page is a paged page. */
     if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
         $prefix = sprintf(__('%1$sPage %2$s', MISS_TEXTDOMAIN), $prefix . $separator, number_format_i18n($page));
     }
     $doctitle = $prefix . $separator . $doctitle;
     /* Apply the wp_title filters so we're compatible with plugins. */
     //	$doctitle = apply_filters( 'bp_page_title', $doctitle, '', '' );
     //	echo apply_atomic( 'bp_page_title', esc_attr( $doctitle ) );
     return $doctitle;
 }
예제 #24
0
/**
 * Fixes directory titles
 */
function thatcamp_filter_title($full_title, $title, $sep, $sep_location)
{
    if (bp_is_groups_component() && bp_is_directory()) {
        return 'THATCamp Directory | THATCamp';
    } else {
        if (bp_is_members_component() && bp_is_directory()) {
            return 'People Directory | THATCamp';
        } else {
            if (bp_is_activity_component() && bp_is_directory()) {
                return 'THATCamp Activity | THATCamp';
            } else {
                if (bp_is_register_page()) {
                    return 'Sign up for an account | THATCamp';
                } else {
                    if (bp_displayed_user_id()) {
                        if (bp_is_user_profile()) {
                            return str_replace('Extended Profiles', 'Profile', $title);
                        } else {
                            if (bp_is_user_activity()) {
                                $atype = thatcamp_activity_type();
                                switch ($atype) {
                                    case 'blog_posts':
                                        $tag = 'Blog Posts';
                                        break;
                                    case 'blog_comments':
                                        $tag = 'Blog Comments';
                                        break;
                                    case 'forums':
                                        $tag = 'Forum Posts';
                                        break;
                                    default:
                                        return str_replace(' Streams', '', $title);
                                        break;
                                }
                                return str_replace(' Streams', '', $full_title) . ' ' . $tag;
                            } else {
                                return $title;
                            }
                        }
                    } else {
                        return $full_title;
                    }
                }
            }
        }
    }
}