• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_parse_args函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中bp_parse_args函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_parse_args函数的具体用法?PHP bp_parse_args怎么用?PHP bp_parse_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bp_parse_args函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: user_admin_profile_metaboxes

        /**
         * Render the xprofile metabox for Community Profile screen.
         *
         * @since 2.0.0
         *
         * @param WP_User|null $user The WP_User object for the user being edited.
         * @param array        $args Aray of arguments for metaboxes.
         */
        public function user_admin_profile_metaboxes($user = null, $args = array())
        {
            // Bail if no user ID.
            if (empty($user->ID)) {
                return;
            }
            $r = bp_parse_args($args['args'], array('profile_group_id' => 0, 'user_id' => $user->ID), 'bp_xprofile_user_admin_profile_loop_args');
            // We really need these args.
            if (empty($r['profile_group_id']) || empty($r['user_id'])) {
                return;
            }
            // Bail if no profile fields are available.
            if (!bp_has_profile($r)) {
                return;
            }
            // Loop through profile groups & fields.
            while (bp_profile_groups()) {
                bp_the_profile_group();
                ?>

			<input type="hidden" name="field_ids[]" id="<?php 
                echo esc_attr('field_ids_' . bp_get_the_profile_group_slug());
                ?>
" value="<?php 
                echo esc_attr(bp_get_the_profile_group_field_ids());
                ?>
" />

			<?php 
                if (bp_get_the_profile_group_description()) {
                    ?>

				<p class="description"><?php 
                    bp_the_profile_group_description();
                    ?>
</p>

			<?php 
                }
                ?>

			<?php 
                while (bp_profile_fields()) {
                    bp_the_profile_field();
                    ?>

				<div<?php 
                    bp_field_css_class('bp-profile-field');
                    ?>
>

					<?php 
                    $field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type());
                    $field_type->edit_field_html(array('user_id' => $r['user_id']));
                    if (bp_get_the_profile_field_description()) {
                        ?>

						<p class="description"><?php 
                        bp_the_profile_field_description();
                        ?>
</p>

					<?php 
                    }
                    /**
                     * Fires before display of visibility form elements for profile metaboxes.
                     *
                     * @since 1.7.0
                     */
                    do_action('bp_custom_profile_edit_fields_pre_visibility');
                    $can_change_visibility = bp_current_user_can('bp_xprofile_change_field_visibility');
                    ?>

					<p class="field-visibility-settings-<?php 
                    echo $can_change_visibility ? 'toggle' : 'notoggle';
                    ?>
" id="field-visibility-settings-toggle-<?php 
                    bp_the_profile_field_id();
                    ?>
">

						<?php 
                    printf(__('This field can be seen by: %s', 'buddypress'), '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>');
                    ?>

						<?php 
                    if ($can_change_visibility) {
                        ?>

							<a href="#" class="button visibility-toggle-link"><?php 
                        esc_html_e('Change', 'buddypress');
                        ?>
//.........这里部分代码省略.........
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:101,代码来源:class-bp-xprofile-user-admin.php


示例2: rendez_vous_ajax_get_users

/**
 * Returns the available members
 *
 * @package Rendez Vous
 * @subpackage Ajax
 *
 * @since Rendez Vous (1.0.0)
 */
function rendez_vous_ajax_get_users()
{
    check_ajax_referer('rendez-vous-editor');
    $query_args = isset($_REQUEST['query']) ? (array) $_REQUEST['query'] : array();
    $args = bp_parse_args($query_args, array('user_id' => false, 'type' => 'alphabetical', 'per_page' => 20, 'page' => 1, 'search_terms' => false, 'member_type' => false, 'exclude' => array(bp_loggedin_user_id())), 'rendez_vous_get_users');
    if (!empty($args['group_id'])) {
        // Get all type of group users
        $args['group_role'] = array('admin', 'mod', 'member');
        $query = new BP_Group_Member_Query($args);
    } else {
        $query = new BP_User_Query($args);
    }
    $response = new stdClass();
    $response->meta = array('total_page' => 0, 'current_page' => 0);
    if (empty($query->results)) {
        wp_send_json_error($response);
    }
    $users = array_map('rendez_vous_prepare_user_for_js', array_values($query->results));
    $users = array_filter($users);
    if (!empty($args['per_page'])) {
        $response->meta = array('total_page' => ceil((int) $query->total_users / (int) $args['per_page']), 'current_page' => (int) $args['page']);
    }
    $response->items = $users;
    wp_send_json_success($response);
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:33,代码来源:rendez-vous-ajax.php


示例3: bp_blogs_get_blogs

/**
 * Retrieve a set of blogs
 *
 * @see BP_Blogs_Blog::get() for a description of arguments and return value.
 *
 * @param array $args {
 *     Arguments are listed here with their default values. For more
 *     information about the arguments, see {@link BP_Blogs_Blog::get()}.
 *     @type string $type Default: 'active'.
 *     @type int|bool $user_id Default: false.
 *     @type array $include_blog_ids Default: false.
 *     @type string|bool $search_terms Default: false.
 *     @type int $per_page Default: 20.
 *     @type int $page Default: 1.
 *     @type bool $update_meta_cache Whether to pre-fetch blogmeta. Default: true.
 * }
 * @return array See {@link BP_Blogs_Blog::get()}.
 */
function bp_blogs_get_blogs($args = '')
{
    // Parse query arguments
    $r = bp_parse_args($args, array('type' => 'active', 'include_blog_ids' => false, 'user_id' => false, 'search_terms' => false, 'per_page' => 20, 'page' => 1, 'update_meta_cache' => true), 'blogs_get_blogs');
    // Get the blogs
    $blogs = BP_Blogs_Blog::get($r['type'], $r['per_page'], $r['page'], $r['user_id'], $r['search_terms'], $r['update_meta_cache'], $r['include_blog_ids']);
    // Filter and return
    return apply_filters('bp_blogs_get_blogs', $blogs, $r);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:27,代码来源:bp-blogs-functions.php


示例4: xprofile_insert_field_group

/**
 * Insert a new profile field group
 *
 * @since BuddyPress (1.0.0)
 *
 * @param type $args
 * @return boolean
 */
function xprofile_insert_field_group($args = '')
{
    // Parse the arguments
    $r = bp_parse_args($args, array('field_group_id' => false, 'name' => false, 'description' => '', 'can_delete' => true), 'xprofile_insert_field_group');
    // Bail if no group name
    if (empty($r['name'])) {
        return false;
    }
    // Create new field group object, maybe using an existing ID
    $field_group = new BP_XProfile_Group($r['field_group_id']);
    $field_group->name = $r['name'];
    $field_group->description = $r['description'];
    $field_group->can_delete = $r['can_delete'];
    return $field_group->save();
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:23,代码来源:bp-xprofile-functions.php


示例5: humcore_has_deposits

/**
 * Initialize the deposits loop.
 *
 * @param array $args
 *
 * @return bool Returns true when deposits are found, otherwise false.
 */
function humcore_has_deposits($args = '')
{
    global $deposits_results;
    // Note: any params used for filtering can be a single value, or multiple values comma separated.
    $defaults = array('page_arg' => 'dpage', 'sort' => 'date', 'page' => 1, 'per_page' => 25, 'max' => false, 'include' => false, 'search_tag' => false, 'search_terms' => false, 'search_facets' => false);
    $params = bp_parse_args($args, $defaults, 'has_deposits');
    if (empty($params['search_tag']) && !empty($params['tag'])) {
        $params['search_tag'] = $params['tag'];
    }
    if (empty($params['search_tag']) && !empty($_REQUEST['tag'])) {
        $params['search_tag'] = $_REQUEST['tag'];
    }
    if (empty($params['search_terms']) && !empty($params['s'])) {
        $params['search_terms'] = $params['s'];
    }
    if (empty($params['search_terms']) && !empty($_REQUEST['s'])) {
        $params['search_terms'] = $_REQUEST['s'];
    }
    // TODO figure out how to remove this hack (copy date_issued to text in solr?).
    $params['search_terms'] = preg_replace('/^(\\d{4})$/', 'date_issued:$1', $params['search_terms']);
    if (empty($params['search_facets']) && !empty($params['facets'])) {
        $params['search_facets'] = $params['facets'];
    }
    if (empty($params['search_facets']) && !empty($_REQUEST['facets'])) {
        $params['search_facets'] = $_REQUEST['facets'];
    }
    if (!empty($_REQUEST['sort'])) {
        $params['sort'] = esc_attr($_REQUEST['sort']);
    }
    // Do not exceed the maximum per page.
    if (!empty($params['max']) && (int) $params['per_page'] > (int) $params['max']) {
        $params['per_page'] = $params['max'];
    }
    $search_args = array('page' => $params['page'], 'per_page' => $params['per_page'], 'page_arg' => $params['page_arg'], 'max' => $params['max'], 'sort' => $params['sort'], 'include' => $params['include'], 'search_tag' => $params['search_tag'], 'search_terms' => $params['search_terms'], 'search_facets' => $params['search_facets']);
    $deposits_results = new Humcore_Deposit_Search_Results($search_args);
    return apply_filters('humcore_has_deposits', $deposits_results->has_deposits(), $deposits_results, $search_args);
}
开发者ID:MartinPaulEve,项目名称:humcore,代码行数:44,代码来源:template.php


示例6: bp_notifications_add_notification

/**
 * Add a notification for a specific user, from a specific component.
 *
 * @since 1.9.0
 *
 * @param array $args {
 *     Array of arguments describing the notification. All are optional.
 *     @type int    $user_id           ID of the user to associate the notification with.
 *     @type int    $item_id           ID of the item to associate the notification with.
 *     @type int    $secondary_item_id ID of the secondary item to associate the
 *                                     notification with.
 *     @type string $component_name    Name of the component to associate the
 *                                     notification with.
 *     @type string $component_action  Name of the action to associate the
 *                                     notification with.
 *     @type string $date_notified     Timestamp for the notification.
 * }
 * @return int|bool ID of the newly created notification on success, false
 *         on failure.
 */
function bp_notifications_add_notification($args = array())
{
    $r = bp_parse_args($args, array('user_id' => 0, 'item_id' => 0, 'secondary_item_id' => 0, 'component_name' => '', 'component_action' => '', 'date_notified' => bp_core_current_time(), 'is_new' => 1, 'allow_duplicate' => false), 'notifications_add_notification');
    // Check for existing duplicate notifications
    if (!$r['allow_duplicate']) {
        // date_notified, allow_duplicate don't count toward
        // duplicate status
        $existing = BP_Notifications_Notification::get(array('user_id' => $r['user_id'], 'item_id' => $r['item_id'], 'secondary_item_id' => $r['secondary_item_id'], 'component_name' => $r['component_name'], 'component_action' => $r['component_action'], 'is_new' => $r['is_new']));
        if (!empty($existing)) {
            return false;
        }
    }
    // Setup the new notification
    $notification = new BP_Notifications_Notification();
    $notification->user_id = $r['user_id'];
    $notification->item_id = $r['item_id'];
    $notification->secondary_item_id = $r['secondary_item_id'];
    $notification->component_name = $r['component_name'];
    $notification->component_action = $r['component_action'];
    $notification->date_notified = $r['date_notified'];
    $notification->is_new = $r['is_new'];
    // Save the new notification
    return $notification->save();
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:44,代码来源:bp-notifications-functions.php


示例7: bp_attachments_cover_image_ajax_upload

/**
 * Ajax Upload and set a cover image
 *
 * @since  2.4.0
 *
 * @return  string|null A json object containing success data if the upload succeeded
 *                      error message otherwise.
 */
function bp_attachments_cover_image_ajax_upload()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        wp_die();
    }
    /**
     * Sending the json response will be different if
     * the current Plupload runtime is html4
     */
    $is_html4 = false;
    if (!empty($_POST['html4'])) {
        $is_html4 = true;
    }
    // Check the nonce
    check_admin_referer('bp-uploader');
    // Init the BuddyPress parameters
    $bp_params = array();
    // We need it to carry on
    if (!empty($_POST['bp_params'])) {
        $bp_params = bp_parse_args($_POST['bp_params'], array('object' => 'user', 'item_id' => bp_loggedin_user_id()), 'attachments_cover_image_ajax_upload');
    } else {
        bp_attachments_json_response(false, $is_html4);
    }
    // We need the object to set the uploads dir filter
    if (empty($bp_params['object'])) {
        bp_attachments_json_response(false, $is_html4);
    }
    // Capability check
    if (!bp_attachments_current_user_can('edit_cover_image', $bp_params)) {
        bp_attachments_json_response(false, $is_html4);
    }
    $bp = buddypress();
    $needs_reset = array();
    // Member's cover image
    if ('user' === $bp_params['object']) {
        $object_data = array('dir' => 'members', 'component' => 'xprofile');
        if (!bp_displayed_user_id() && !empty($bp_params['item_id'])) {
            $needs_reset = array('key' => 'displayed_user', 'value' => $bp->displayed_user);
            $bp->displayed_user->id = $bp_params['item_id'];
        }
        // Group's cover image
    } elseif ('group' === $bp_params['object']) {
        $object_data = array('dir' => 'groups', 'component' => 'groups');
        if (!bp_get_current_group_id() && !empty($bp_params['item_id'])) {
            $needs_reset = array('component' => 'groups', 'key' => 'current_group', 'value' => $bp->groups->current_group);
            $bp->groups->current_group = groups_get_group(array('group_id' => $bp_params['item_id'], 'populate_extras' => false));
        }
        // Other object's cover image
    } else {
        $object_data = apply_filters('bp_attachments_cover_image_object_dir', array(), $bp_params['object']);
    }
    // Stop here in case of a missing parameter for the object
    if (empty($object_data['dir']) || empty($object_data['component'])) {
        bp_attachments_json_response(false, $is_html4);
    }
    $cover_image_attachment = new BP_Attachment_Cover_Image();
    $uploaded = $cover_image_attachment->upload($_FILES);
    // Reset objects
    if (!empty($needs_reset)) {
        if (!empty($needs_reset['component'])) {
            $bp->{$needs_reset['component']}->{$needs_reset['key']} = $needs_reset['value'];
        } else {
            $bp->{$needs_reset['key']} = $needs_reset['value'];
        }
    }
    if (!empty($uploaded['error'])) {
        // Upload error response
        bp_attachments_json_response(false, $is_html4, array('type' => 'upload_error', 'message' => sprintf(__('Upload Failed! Error was: %s', 'buddypress'), $uploaded['error'])));
    }
    // Default error message
    $error_message = __('There was a problem uploading the cover image.', 'buddypress');
    // Get BuddyPress Attachments Uploads Dir datas
    $bp_attachments_uploads_dir = bp_attachments_uploads_dir_get();
    // The BP Attachments Uploads Dir is not set, stop.
    if (!$bp_attachments_uploads_dir) {
        bp_attachments_json_response(false, $is_html4, array('type' => 'upload_error', 'message' => $error_message));
    }
    $cover_subdir = $object_data['dir'] . '/' . $bp_params['item_id'] . '/cover-image';
    $cover_dir = trailingslashit($bp_attachments_uploads_dir['basedir']) . $cover_subdir;
    if (!is_dir($cover_dir)) {
        // Upload error response
        bp_attachments_json_response(false, $is_html4, array('type' => 'upload_error', 'message' => $error_message));
    }
    /**
     * Generate the cover image so that it fit to feature's dimensions
     *
     * Unlike the Avatar, Uploading and generating the cover image is happening during
     * the same Ajax request, as we already instantiated the BP_Attachment_Cover_Image
     * class, let's use it.
     */
    $cover = bp_attachments_cover_image_generate_file(array('file' => $uploaded['file'], 'component' => $object_data['component'], 'cover_image_dir' => $cover_dir), $cover_image_attachment);
//.........这里部分代码省略.........
开发者ID:mawilliamson,项目名称:wordpress,代码行数:101,代码来源:bp-core-attachments.php


示例8: bp_register_member_type

/**
 * Register a member type.
 *
 * @since 2.2.0
 *
 * @param string $member_type Unique string identifier for the member type.
 * @param array  $args {
 *     Array of arguments describing the member type.
 *
 *     @type array       $labels {
 *         Array of labels to use in various parts of the interface.
 *
 *         @type string $name          Default name. Should typically be plural.
 *         @type string $singular_name Singular name.
 *     }
 *     @type bool|string $has_directory Whether the member type should have its own type-specific directory.
 *                                      Pass `true` to use the `$member_type` string as the type's slug.
 *                                      Pass a string to customize the slug. Pass `false` to disable.
 *                                      Default: true.
 * }
 * @return object|WP_Error Member type object on success, WP_Error object on failure.
 */
function bp_register_member_type($member_type, $args = array())
{
    $bp = buddypress();
    if (isset($bp->members->types[$member_type])) {
        return new WP_Error('bp_member_type_exists', __('Member type already exists.', 'buddypress'), $member_type);
    }
    $r = bp_parse_args($args, array('labels' => array(), 'has_directory' => true), 'register_member_type');
    $member_type = sanitize_key($member_type);
    /**
     * Filters the list of illegal member type names.
     *
     * - 'any' is a special pseudo-type, representing items unassociated with any member type.
     * - 'null' is a special pseudo-type, representing users without any type.
     * - '_none' is used internally to denote an item that should not apply to any member types.
     *
     * @since 2.4.0
     *
     * @param array $illegal_names Array of illegal names.
     */
    $illegal_names = apply_filters('bp_member_type_illegal_names', array('any', 'null', '_none'));
    if (in_array($member_type, $illegal_names, true)) {
        return new WP_Error('bp_member_type_illegal_name', __('You may not register a member type with this name.', 'buddypress'), $member_type);
    }
    // Store the post type name as data in the object (not just as the array key).
    $r['name'] = $member_type;
    // Make sure the relevant labels have been filled in.
    $default_name = isset($r['labels']['name']) ? $r['labels']['name'] : ucfirst($r['name']);
    $r['labels'] = array_merge(array('name' => $default_name, 'singular_name' => $default_name), $r['labels']);
    // Directory slug.
    if ($r['has_directory']) {
        // A string value is intepreted as the directory slug. Otherwise fall back on member type.
        if (is_string($r['has_directory'])) {
            $directory_slug = $r['has_directory'];
        } else {
            $directory_slug = $member_type;
        }
        // Sanitize for use in URLs.
        $r['directory_slug'] = sanitize_title($directory_slug);
        $r['has_directory'] = true;
    } else {
        $r['directory_slug'] = '';
        $r['has_directory'] = false;
    }
    $bp->members->types[$member_type] = $type = (object) $r;
    /**
     * Fires after a member type is registered.
     *
     * @since 2.2.0
     *
     * @param string $member_type Member type identifier.
     * @param object $type        Member type object.
     */
    do_action('bp_registered_member_type', $member_type, $type);
    return $type;
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:77,代码来源:bp-members-functions.php


示例9: admin_field_html

    /**
     * Output HTML for this field type on the wp-admin Profile Fields screen.
     *
     * Must be used inside the {@link bp_profile_fields()} template loop.
     *
     * @since 2.0.0
     *
     * @param array $raw_properties Optional key/value array of permitted attributes that you want to add.
     */
    public function admin_field_html(array $raw_properties = array())
    {
        $day_r = bp_parse_args($raw_properties, array('id' => bp_get_the_profile_field_input_name() . '_day', 'name' => bp_get_the_profile_field_input_name() . '_day'));
        $month_r = bp_parse_args($raw_properties, array('id' => bp_get_the_profile_field_input_name() . '_month', 'name' => bp_get_the_profile_field_input_name() . '_month'));
        $year_r = bp_parse_args($raw_properties, array('id' => bp_get_the_profile_field_input_name() . '_year', 'name' => bp_get_the_profile_field_input_name() . '_year'));
        ?>

		<label for="<?php 
        bp_the_profile_field_input_name();
        ?>
_day" class="screen-reader-text"><?php 
        esc_html_e('Select day', 'buddypress');
        ?>
</label>
		<select <?php 
        echo $this->get_edit_field_html_elements($day_r);
        ?>
>
			<?php 
        bp_the_profile_field_options(array('type' => 'day'));
        ?>
		</select>

		<label for="<?php 
        bp_the_profile_field_input_name();
        ?>
_month" class="screen-reader-text"><?php 
        esc_html_e('Select month', 'buddypress');
        ?>
</label>
		<select <?php 
        echo $this->get_edit_field_html_elements($month_r);
        ?>
>
			<?php 
        bp_the_profile_field_options(array('type' => 'month'));
        ?>
		</select>

		<label for="<?php 
        bp_the_profile_field_input_name();
        ?>
_year" class="screen-reader-text"><?php 
        esc_html_e('Select year', 'buddypress');
        ?>
</label>
		<select <?php 
        echo $this->get_edit_field_html_elements($year_r);
        ?>
>
			<?php 
        bp_the_profile_field_options(array('type' => 'year'));
        ?>
		</select>

	<?php 
    }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:66,代码来源:class-bp-xprofile-field-type-datebox.php


示例10: bp_friends_get_profile_stats

/**
 * Return the number of friends in user's profile.
 *
 * @since 2.0.0
 *
 * @param array|string $args before|after|user_id.
 * @return string HTML for stats output.
 */
function bp_friends_get_profile_stats($args = '')
{
    // Parse the args.
    $r = bp_parse_args($args, array('before' => '<li class="bp-friends-profile-stats">', 'after' => '</li>', 'user_id' => bp_displayed_user_id(), 'friends' => 0, 'output' => ''), 'friends_get_profile_stats');
    // Allow completely overloaded output.
    if (empty($r['output'])) {
        // Only proceed if a user ID was passed.
        if (!empty($r['user_id'])) {
            // Get the user's friends.
            if (empty($r['friends'])) {
                $r['friends'] = absint(friends_get_total_friend_count($r['user_id']));
            }
            // If friends exist, show some formatted output.
            $r['output'] = $r['before'] . sprintf(_n('%s friend', '%s friends', $r['friends'], 'buddypress'), '<strong>' . $r['friends'] . '</strong>') . $r['after'];
        }
    }
    /**
     * Filters the number of friends in user's profile.
     *
     * @since 2.0.0
     *
     * @param string $value Formatted string displaying total friends count.
     * @param array  $r     Array of arguments for string formatting and output.
     */
    return apply_filters('bp_friends_get_profile_stats', $r['output'], $r);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:34,代码来源:bp-friends-template.php


示例11: bp_has_forum_topic_posts

/**
 * Initiate the loop for a single topic's posts.
 *
 * @param array $args {
 *     Arguments for limiting the contents of the topic posts loop.
 *     @type int $topic_id ID of the topic to which the posts belong.
 *     @type int $per_page Number of items to return per page. Default: 15.
 *     @type int $max Max items to return. Default: false.
 *     @type string $order 'ASC' or 'DESC'.
 * }
 * @return bool True when posts are found corresponding to the args,
 *         otherwise false.
 */
function bp_has_forum_topic_posts($args = '')
{
    global $topic_template;
    $defaults = array('topic_id' => false, 'per_page' => 15, 'max' => false, 'order' => 'ASC');
    $r = bp_parse_args($args, $defaults, 'has_forum_topic_posts');
    extract($r, EXTR_SKIP);
    if (empty($topic_id) && bp_is_groups_component() && bp_is_current_action('forum') && bp_is_action_variable('topic', 0) && bp_action_variable(1)) {
        $topic_id = bp_forums_get_topic_id_from_slug(bp_action_variable(1));
    } elseif (empty($topic_id) && bp_is_forums_component() && bp_is_current_action('topic') && bp_action_variable(0)) {
        $topic_id = bp_forums_get_topic_id_from_slug(bp_action_variable(0));
    }
    if (empty($topic_id)) {
        return false;
    } else {
        $topic_template = new BP_Forums_Template_Topic((int) $topic_id, $per_page, $max, $order);
        // Current topic forum_id needs to match current_group forum_id
        if (bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta(bp_get_current_group_id(), 'forum_id')) {
            return false;
        }
    }
    return apply_filters('bp_has_topic_posts', $topic_template->has_posts(), $topic_template);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:35,代码来源:bp-forums-template.php


示例12: get_edit_field_html_elements

 /**
  * Get a sanitised and escaped string of the edit field's HTML elements and attributes.
  *
  * Must be used inside the {@link bp_profile_fields()} template loop.
  * This method was intended to be static but couldn't be because php.net/lsb/ requires PHP >= 5.3.
  *
  * @since 2.0.0
  *
  * @param array $properties Optional key/value array of attributes for this edit field.
  *
  * @return string
  */
 protected function get_edit_field_html_elements(array $properties = array())
 {
     $r = bp_parse_args($properties, array('id' => bp_get_the_profile_field_input_name(), 'name' => bp_get_the_profile_field_input_name()));
     if (bp_get_the_profile_field_is_required()) {
         $r['aria-required'] = 'true';
     }
     /**
      * Filters the edit html elements and attributes.
      *
      * @since 2.0.0
      *
      * @param array  $r     Array of parsed arguments.
      * @param string $value Class name for the current class instance.
      */
     $r = (array) apply_filters('bp_xprofile_field_edit_html_elements', $r, get_class($this));
     return bp_get_form_field_attributes(sanitize_key(bp_get_the_profile_field_name()), $r);
 }
开发者ID:sourabh-mehra,项目名称:ASVYS-Charity-Foundation,代码行数:29,代码来源:class-bp-xprofile-field-type.php


示例13: bp_core_get_suggestions

/**
 * BuddyPress Suggestions API for types of at-mentions.
 *
 * This is used to power BuddyPress' at-mentions suggestions, but it is flexible enough to be used
 * for similar kinds of future requirements, or those implemented by third-party developers.
 *
 * @param array $args
 * @return array|WP_Error Array of results. If there were any problems, returns a WP_Error object.
 * @since BuddyPress (2.1.0)
 */
function bp_core_get_suggestions($args)
{
    $args = bp_parse_args($args, array(), 'get_suggestions');
    if (!$args['type']) {
        return new WP_Error('missing_parameter');
    }
    // Members @name suggestions.
    if ($args['type'] === 'members') {
        $class = 'BP_Members_Suggestions';
        // Members @name suggestions for users in a specific Group.
        if (isset($args['group_id'])) {
            $class = 'BP_Groups_Member_Suggestions';
        }
    } else {
        // If you've built a custom suggestions service, use this to tell BP the name of your class.
        $class = apply_filters('bp_suggestions_services', '', $args);
    }
    if (!$class || !class_exists($class)) {
        return new WP_Error('missing_parameter');
    }
    $suggestions = new $class($args);
    $validation = $suggestions->validate();
    if (is_wp_error($validation)) {
        $retval = $validation;
    } else {
        $retval = $suggestions->get_suggestions();
    }
    return apply_filters('bp_core_get_suggestions', $retval, $args);
}
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:39,代码来源:bp-core-functions.php


示例14: bp_activity_delete_by_item_id

/**
 * Delete an activity item by activity id.
 *
 * You should use bp_activity_delete() instead.
 *
 * @since BuddyPress (1.1.0)
 * @deprecated BuddyPress (1.2)
 *
 * @uses wp_parse_args()
 * @uses bp_activity_delete()
 *
 * @param array $args See BP_Activity_Activity::get for a description
 *                    of accepted arguments.
 *
 * @return bool True on success, false on failure.
 */
function bp_activity_delete_by_item_id($args = '')
{
    $r = bp_parse_args($args, array('item_id' => false, 'component' => false, 'type' => false, 'user_id' => false, 'secondary_item_id' => false));
    return bp_activity_delete($r);
}
开发者ID:eresyyl,项目名称:mk,代码行数:21,代码来源:bp-activity-functions.php


示例15: bp_get_member_last_active

/**
 * Return the current member's last active time.
 *
 * @param array $args {
 *     Array of optional arguments.
 *     @type mixed $active_format If true, formatted "active 5 minutes
 *                                ago". If false, formatted "5 minutes ago".
 *                                If string, should be sprintf'able like
 *                                'last seen %s ago'.
 * }
 * @return string
 */
function bp_get_member_last_active($args = array())
{
    global $members_template;
    // Parse the activity format.
    $r = bp_parse_args($args, array('active_format' => true));
    // Backwards compatibility for anyone forcing a 'true' active_format.
    if (true === $r['active_format']) {
        $r['active_format'] = __('active %s', 'buddypress');
    }
    // Member has logged in at least one time.
    if (isset($members_template->member->last_activity)) {
        // Backwards compatibility for pre 1.5 'ago' strings.
        $last_activity = !empty($r['active_format']) ? bp_core_get_last_activity($members_template->member->last_activity, $r['active_format']) : bp_core_time_since($members_template->member->last_activity);
        // Member has never logged in or been active.
    } else {
        $last_activity = __('Never active', 'buddypress');
    }
    /**
     * Filters the current members last active time.
     *
     * @since 1.2.0
     *
     * @param string $last_activity Formatted time since last activity.
     * @param array  $r             Array of parsed arguments for query.
     */
    return apply_filters('bp_member_last_active', $last_activity, $r);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:39,代码来源:bp-members-template.php


示例16: parse_settings

 /**
  * Merge the widget settings into defaults array.
  *
  * @since 2.3.0
  *
  * @uses bp_parse_args() To merge widget settings into defaults.
  *
  * @param array $instance Widget instance settings.
  * @return array
  */
 public function parse_settings($instance = array())
 {
     return bp_parse_args($instance, array('title' => __('Recently Active Members', 'buddypress'), 'max_members' => 15), 'recently_active_members_widget_settings');
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:14,代码来源:class-bp-core-recently-active-widget.php


示例17: buddydrive_has_items

/**
 * BuddyDrive Loop : do we have items for the query asked
 *
 * @param  array $args the arguments of the query
 * @global object $buddydrive_template
 * @uses buddydrive_get_folder_post_type() to get BuddyFolder post type
 * @uses buddydrive_get_file_post_type() to get BuddyFile post type
 * @uses bp_displayed_user_id() to default to current displayed user
 * @uses bp_current_action() to get the current action ( files / friends / admin)
 * @uses bp_is_active() to check if groups component is active
 * @uses buddydrive_is_group() are we on a group's BuddyDrive ?
 * @uses wp_parse_args() to merge defaults and args
 * @uses BuddyDrive_Item::get() to request the DB
 * @uses BuddyDrive_Item::have_posts to know if BuddyItems matched the query
 * @return the result of the query
 */
function buddydrive_has_items($args = '')
{
    global $buddydrive_template;
    // This keeps us from firing the query more than once
    if (empty($buddydrive_template)) {
        $defaulttype = array(buddydrive_get_folder_post_type(), buddydrive_get_file_post_type());
        $user = $group_id = $buddyscope = false;
        if (bp_displayed_user_id()) {
            $user = bp_displayed_user_id();
        }
        $buddyscope = bp_current_action();
        if ($buddyscope == buddydrive_get_friends_subnav_slug()) {
            $buddyscope = 'friends';
        }
        if (is_admin()) {
            $buddyscope = 'admin';
        }
        if (bp_is_active('groups') && buddydrive_is_group()) {
            $group = groups_get_current_group();
            $group_id = $group->id;
            $buddyscope = 'groups';
        }
        /***
         * Set the defaults for the parameters you are accepting via the "buddydrive_has_items()"
         * function call
         */
        $defaults = array('id' => false, 'name' => false, 'group_id' => $group_id, 'user_id' => $user, 'per_page' => 10, 'paged' => 1, 'type' => $defaulttype, 'buddydrive_scope' => $buddyscope, 'search' => false, 'buddydrive_parent' => 0, 'exclude' => 0, 'orderby' => 'title', 'order' => 'ASC');
        $r = bp_parse_args($args, $defaults, 'buddydrive_has_items');
        if ('admin' === $r['buddydrive_scope'] && !bp_current_user_can('bp_moderate')) {
            $r['buddydrive_scope'] = 'files';
        }
        $buddydrive_template = new BuddyDrive_Item();
        if (!empty($search)) {
            $buddydrive_template->get(array('per_page' => $r['per_page'], 'paged' => $r['paged'], 'type' => $r['type'], 'buddydrive_scope' => $r['buddydrive_scope'], 'search' => $r['search'], 'orderby' => $r['orderby'], 'order' => $r['order']));
        } else {
            $buddydrive_template->get(array('id' => $r['id'], 'name' => $r['name'], 'group_id' => $r['group_id'], 'user_id' => $r['user_id'], 'per_page' => $r['per_page'], 'paged' => $r['paged'], 'type' => $r['type'], 'buddydrive_scope' => $r['buddydrive_scope'], 'buddydrive_parent' => $r['buddydrive_parent'], 'exclude' => $r['exclude'], 'orderby' => $r['orderby'], 'order' => $r['order']));
        }
        do_action('buddydrive_has_items_catch_total_count', $buddydrive_template->query->found_posts);
    }
    return apply_filters('buddydrive_has_items', $buddydrive_template->have_posts());
}
开发者ID:MrVibe,项目名称:buddydrive,代码行数:57,代码来源:buddydrive-item-template.php


示例18: bp_get_email_subject

/**
 * Retrieve a client friendly version of the root blog name.
 *
 * The blogname option is escaped with esc_html on the way into the database in
 * sanitize_option, we want to reverse this for the plain text arena of emails.
 *
 * @since 1.7.0
 * @since 2.5.0 No longer used by BuddyPress, but not deprecated in case any existing plugins use it.
 *
 * @see https://buddypress.trac.wordpress.org/ticket/4401
 *
 * @param array $args {
 *     Array of optional parameters.
 *     @type string $before  String to appear before the site name in the
 *                           email subject. Default: '['.
 *     @type string $after   String to appear after the site name in the
 *                           email subject. Default: ']'.
 *     @type string $default The default site name, to be used when none is
 *                           found in the database. Default: 'Community'.
 *     @type string $text    Text to append to the site name (ie, the main text of
 *                           the email subject).
 * }
 * @return string Sanitized email subject.
 */
function bp_get_email_subject($args = array())
{
    $r = bp_parse_args($args, array('before' => '[', 'after' => ']', 'default' => __('Community', 'buddypress'), 'text' => ''), 'get_email_subject');
    $subject = $r['before'] . wp_specialchars_decode(bp_get_option('blogname', $r['default']), ENT_QUOTES) . $r['after'] . ' ' . $r['text'];
    /**
     * Filters a client friendly version of the root blog name.
     *
     * @since 1.7.0
     *
     * @param string $subject Client friendy version of the root blog name.
     * @param array  $r       Array of arguments for the email subject.
     */
    return apply_filters('bp_get_email_subject', $subject, $r);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:38,代码来源:bp-core-template.php


示例19: xprofile_delete_activity

/**
 * Deletes activity for a user within the profile component so that it will be
 * removed from the users activity stream and sitewide stream (if installed).
 *
 * @since 1.0.0
 *
 * @uses bp_activity_delete() Deletes an entry to the activity component tables
 *                            for a specific activity.
 *
 * @param array|string $args Containing all variables used after bp_parse_args() call.
 *
 * @return bool
 */
function xprofile_delete_activity($args = '')
{
    // Bail if activity component is not active.
    if (!bp_is_active('activity')) {
        return false;
    }
    // Parse the arguments.
    $r = bp_parse_args($args, array('component' => buddypress()->profile->id), 'xprofile_delete_activity');
    // Delete the activity item.
    bp_activity_delete_by_item_id($r);
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:24,代码来源:bp-xprofile-activity.php


示例20: get_edit_field_html_elements

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_profile_fields函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_notifications_mark_notifications_by_item_id函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap