当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_get_option函数代码示例

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


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

示例1: bp_core_set_avatar_constants

/**
 * Set up the constants we need for avatar support.
 */
function bp_core_set_avatar_constants()
{
    $bp = buddypress();
    if (!defined('BP_AVATAR_THUMB_WIDTH')) {
        define('BP_AVATAR_THUMB_WIDTH', 100);
    }
    if (!defined('BP_AVATAR_THUMB_HEIGHT')) {
        define('BP_AVATAR_THUMB_HEIGHT', 100);
    }
    if (!defined('BP_AVATAR_FULL_WIDTH')) {
        define('BP_AVATAR_FULL_WIDTH', 150);
    }
    if (!defined('BP_AVATAR_FULL_HEIGHT')) {
        define('BP_AVATAR_FULL_HEIGHT', 150);
    }
    if (!defined('BP_AVATAR_ORIGINAL_MAX_WIDTH')) {
        define('BP_AVATAR_ORIGINAL_MAX_WIDTH', 450);
    }
    if (!defined('BP_AVATAR_ORIGINAL_MAX_FILESIZE')) {
        define('BP_AVATAR_ORIGINAL_MAX_FILESIZE', bp_attachments_get_max_upload_file_size('avatar'));
    }
    if (!defined('BP_SHOW_AVATARS')) {
        define('BP_SHOW_AVATARS', bp_get_option('show_avatars'));
    }
}
开发者ID:toby-bushell,项目名称:triumph,代码行数:28,代码来源:bp-core-avatars.php

示例2: init

 /**
  * Initializes the class when called upon.
  */
 public function init()
 {
     /** Settings *****************************************************/
     $this->settings = bp_get_option('bp-rbe');
     /** Includes *****************************************************/
     $this->includes();
     /** Constants ****************************************************/
     $this->constants();
     /** Localization *************************************************/
     // we place this here instead of in hooks() because we want to
     // localize even before our requirements are fulfilled
     $this->localization();
     /** Requirements check *******************************************/
     // If requirements are not fulfilled, then throw an admin notice and stop now!
     if (!bp_rbe_is_required_completed($this->settings)) {
         add_action('admin_notices', array(&$this, 'admin_notice'));
         return;
     }
     /** Post-requirements routine ************************************/
     // load inbound provider
     if (bp_rbe_is_inbound()) {
         $this->load_inbound_provider();
     }
     // load the hooks!
     $this->hooks();
 }
开发者ID:r-a-y,项目名称:bp-reply-by-email,代码行数:29,代码来源:bp-rbe-core.php

示例3: bootstrap

 private function bootstrap()
 {
     global $bp;
     /**
      * At this point in the stack, BuddyPress core has been loaded but
      * individual components (friends/activity/groups/etc...) have not.
      *
      * The 'bp_core_loaded' action lets you execute code ahead of the
      * other components.
      */
     do_action('bp_core_loaded');
     /** Components ********************************************************/
     // Set the included and optional components.
     $bp->optional_components = apply_filters('bp_optional_components', array('activity', 'blogs', 'forums', 'friends', 'groups', 'messages', 'settings', 'xprofile'));
     // Set the required components
     $bp->required_components = apply_filters('bp_required_components', array('members'));
     // Get a list of activated components
     if ($active_components = bp_get_option('bp-active-components')) {
         $bp->active_components = apply_filters('bp_active_components', $active_components);
         $bp->deactivated_components = apply_filters('bp_deactivated_components', array_values(array_diff(array_values(array_merge($bp->optional_components, $bp->required_components)), array_keys($bp->active_components))));
         // Pre 1.5 Backwards compatibility
     } elseif ($deactivated_components = bp_get_option('bp-deactivated-components')) {
         // Trim off namespace and filename
         foreach ((array) $deactivated_components as $component => $value) {
             $trimmed[] = str_replace('.php', '', str_replace('bp-', '', $component));
         }
         // Set globals
         $bp->deactivated_components = apply_filters('bp_deactivated_components', $trimmed);
         // Setup the active components
         $active_components = array_flip(array_diff(array_values(array_merge($bp->optional_components, $bp->required_components)), array_values($bp->deactivated_components)));
         // Loop through active components and set the values
         $bp->active_components = array_map('__return_true', $active_components);
         // Set the active component global
         $bp->active_components = apply_filters('bp_active_components', $bp->active_components);
         // Default to all components active
     } else {
         // Set globals
         $bp->deactivated_components = array();
         // Setup the active components
         $active_components = array_flip(array_values(array_merge($bp->optional_components, $bp->required_components)));
         // Loop through active components and set the values
         $bp->active_components = array_map('__return_true', $active_components);
         // Set the active component global
         $bp->active_components = apply_filters('bp_active_components', $bp->active_components);
     }
     // Loop through optional components
     foreach ($bp->optional_components as $component) {
         if (bp_is_active($component) && file_exists(BP_PLUGIN_DIR . '/bp-' . $component . '/bp-' . $component . '-loader.php')) {
             include BP_PLUGIN_DIR . '/bp-' . $component . '/bp-' . $component . '-loader.php';
         }
     }
     // Loop through required components
     foreach ($bp->required_components as $component) {
         if (file_exists(BP_PLUGIN_DIR . '/bp-' . $component . '/bp-' . $component . '-loader.php')) {
             include BP_PLUGIN_DIR . '/bp-' . $component . '/bp-' . $component . '-loader.php';
         }
     }
     // Add Core to required components
     $bp->required_components[] = 'core';
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:60,代码来源:bp-core-loader.php

示例4: test_group_access_test_friends

 /**
  * @group invite_anyone_group_invite_access_test
  *
  * Using this as a proxy for testing every possible combination
  */
 public function test_group_access_test_friends()
 {
     $settings = bp_get_option('invite_anyone');
     bp_update_option('invite_anyone', array('group_invites_can_admin' => 'friends', 'group_invites_can_group_admin' => 'friends', 'group_invites_can_group_mod' => 'friends', 'group_invites_can_group_member' => 'friends'));
     unset($GLOBALS['iaoptions']);
     $g = $this->factory->group->create();
     $u1 = $this->factory->user->create(array('role' => 'administrator'));
     $this->add_user_to_group($u1, $g);
     $u2 = $this->factory->user->create();
     $this->add_user_to_group($u2, $g);
     $u3 = $this->factory->user->create();
     $this->add_user_to_group($u3, $g);
     $m3 = new BP_Groups_Member($u3, $g);
     $m3->promote('mod');
     $u4 = $this->factory->user->create();
     $this->add_user_to_group($u4, $g);
     $m4 = new BP_Groups_Member($u4, $g);
     $m4->promote('admin');
     $user = new WP_User($u1);
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u1));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u2));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u3));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u4));
     bp_update_option('invite_anyone', $settings);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:30,代码来源:test-sample.php

示例5: includes

 /**
  * Include component files.
  *
  * @since 1.5.0
  *
  * @see BP_Component::includes() for a description of arguments.
  *
  * @param array $includes See BP_Component::includes() for a description.
  */
 public function includes($includes = array())
 {
     // Files to include.
     $includes = array('cssjs', 'actions', 'screens', 'filters', 'adminbar', 'template', 'functions', 'cache');
     // Notifications support.
     if (bp_is_active('notifications')) {
         $includes[] = 'notifications';
     }
     if (!buddypress()->do_autoload) {
         $includes[] = 'classes';
     }
     // Load Akismet support if Akismet is configured.
     $akismet_key = bp_get_option('wordpress_api_key');
     /** This filter is documented in bp-activity/bp-activity-akismet.php */
     if (defined('AKISMET_VERSION') && class_exists('Akismet') && (!empty($akismet_key) || defined('WPCOM_API_KEY')) && apply_filters('bp_activity_use_akismet', bp_is_akismet_active())) {
         $includes[] = 'akismet';
     }
     // Embeds - only applicable for WP 4.5+
     if (version_compare($GLOBALS['wp_version'], '4.5', '>=') && bp_is_active($this->id, 'embeds')) {
         $includes[] = 'embeds';
     }
     if (is_admin()) {
         $includes[] = 'admin';
     }
     parent::includes($includes);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:35,代码来源:class-bp-activity-component.php

示例6: cfbgr_register_member_types

/**
 * Register member types.
 *
 * If the field type is set and has options. These options will dynamically build the member type
 * Use the name to set options into the xProfile Field Admin UI eg: Has CF
 *
 * @since 1.0.0
 */
function cfbgr_register_member_types()
{
    $saved_option = (int) bp_get_option('cfbgr_xfield_id', 0);
    if (empty($saved_option)) {
        return;
    }
    $field = xprofile_get_field($saved_option);
    // This case means the option was not deleted when it oughts to be
    if (empty($field->type_obj) || !is_a($field->type_obj, 'CF_BG_Member_Type_Field_Type')) {
        bp_delete_option('cfbgr_xfield_id');
        return;
    }
    // Object cache this field
    buddypress()->groups->restrictions->member_type_field = $field;
    $options = $field->get_children(true);
    if (!is_array($options)) {
        return;
    }
    foreach ($options as $member_type) {
        if (empty($member_type->name)) {
            continue;
        }
        bp_register_member_type(sanitize_key($member_type->name), array('labels' => array('name' => $member_type->name)));
    }
}
开发者ID:WeFoster,项目名称:buddypress-group-restrictions,代码行数:33,代码来源:register.php

示例7: bp_avatar_is_disable

 private function bp_avatar_is_disable()
 {
     if (!function_exists('bp-disable-avatar-uploads')) {
         return get_option('bp-disable-avatar-uploads');
     }
     return bp_get_option('bp-disable-avatar-uploads');
 }
开发者ID:andyUA,项目名称:kabmin-new,代码行数:7,代码来源:class-wp-user-bp.php

示例8: __construct

 function __construct()
 {
     global $bp;
     $this->client_id = bp_get_option('foursquare-client-id');
     $this->client_secret = bp_get_option('foursquare-client-secret');
     $this->redirect_uri = isset($bp->pages->{BP_CHECKINS_SLUG}->slug) ? site_url($bp->pages->{BP_CHECKINS_SLUG}->slug) : site_url(BP_CHECKINS_SLUG);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:7,代码来源:bp-checkins-foursquare-api.php

示例9: cfbgr_migrate_xprofile_as_member_types

function cfbgr_migrate_xprofile_as_member_types()
{
    global $wpdb;
    $buddypress = buddypress();
    // Description of this tool, displayed to the user
    $statement = __('Migrating/Resetting xProfile data as member types: %s', 'buddypress-group-restrictions');
    // Default to failure text
    $result = __('No xProfile data needs to be migrated or reset.', 'buddypress-group-restrictions');
    // Default to unrepaired
    $repair = 0;
    $field = (int) bp_get_option('cfbgr_xfield_id', 0);
    if (empty($field)) {
        return array(0, sprintf($statement, $result));
    }
    $member_types = bp_get_member_types();
    // Walk through all users on the site
    $user_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->users}");
    foreach ($user_ids as $user_id) {
        $value = sanitize_key(xprofile_get_field_data($field, $user_id));
        // Do we have a matching member type ?
        if (isset($member_types[$value])) {
            // Set member types if empty or different
            if ($value !== bp_get_member_type($user_id)) {
                bp_set_member_type($user_id, $value);
                $repair += 1;
            }
        }
    }
    $result = sprintf(__('%d migrated or reset', 'buddypress-group-restrictions'), $repair);
    // All done!
    return array(0, sprintf($statement, $result));
}
开发者ID:WeFoster,项目名称:buddypress-group-restrictions,代码行数:32,代码来源:migrate.php

示例10: bp_core_set_avatar_constants

function bp_core_set_avatar_constants()
{
    $bp = buddypress();
    if (!defined('BP_AVATAR_THUMB_WIDTH')) {
        define('BP_AVATAR_THUMB_WIDTH', 50);
    }
    if (!defined('BP_AVATAR_THUMB_HEIGHT')) {
        define('BP_AVATAR_THUMB_HEIGHT', 50);
    }
    if (!defined('BP_AVATAR_FULL_WIDTH')) {
        define('BP_AVATAR_FULL_WIDTH', 150);
    }
    if (!defined('BP_AVATAR_FULL_HEIGHT')) {
        define('BP_AVATAR_FULL_HEIGHT', 150);
    }
    if (!defined('BP_AVATAR_ORIGINAL_MAX_WIDTH')) {
        define('BP_AVATAR_ORIGINAL_MAX_WIDTH', 450);
    }
    if (!defined('BP_AVATAR_ORIGINAL_MAX_FILESIZE')) {
        if (!isset($bp->site_options['fileupload_maxk'])) {
            define('BP_AVATAR_ORIGINAL_MAX_FILESIZE', 5120000);
            // 5mb
        } else {
            define('BP_AVATAR_ORIGINAL_MAX_FILESIZE', $bp->site_options['fileupload_maxk'] * 1024);
        }
    }
    if (!defined('BP_SHOW_AVATARS')) {
        define('BP_SHOW_AVATARS', bp_get_option('show_avatars'));
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:30,代码来源:bp-core-avatars.php

示例11: bp_core_install_extended_profiles

function bp_core_install_extended_profiles()
{
    global $nxtdb;
    $charset_collate = bp_core_set_charset();
    $bp_prefix = bp_core_get_table_prefix();
    // These values should only be updated if they are not already present
    if (!($base_group_name = bp_get_option('bp-xprofile-base-group-name'))) {
        bp_update_option('bp-xprofile-base-group-name', _x('Base', 'First XProfile group name', 'buddypress'));
    }
    if (!($fullname_field_name = bp_get_option('bp-xprofile-fullname-field-name'))) {
        bp_update_option('bp-xprofile-fullname-field-name', _x('Name', 'XProfile fullname field name', 'buddypress'));
    }
    $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_groups (\n\t\t\t    id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t    name varchar(150) NOT NULL,\n\t\t\t    description mediumtext NOT NULL,\n\t\t\t    group_order bigint(20) NOT NULL DEFAULT '0',\n\t\t\t    can_delete tinyint(1) NOT NULL,\n\t\t\t    KEY can_delete (can_delete)\n\t\t\t   ) {$charset_collate};";
    $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_fields (\n\t\t\t    id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t    group_id bigint(20) unsigned NOT NULL,\n\t\t\t    parent_id bigint(20) unsigned NOT NULL,\n\t\t\t    type varchar(150) NOT NULL,\n\t\t\t    name varchar(150) NOT NULL,\n\t\t\t    description longtext NOT NULL,\n\t\t\t    is_required tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t    is_default_option tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t    field_order bigint(20) NOT NULL DEFAULT '0',\n\t\t\t    option_order bigint(20) NOT NULL DEFAULT '0',\n\t\t\t    order_by varchar(15) NOT NULL DEFAULT '',\n\t\t\t    can_delete tinyint(1) NOT NULL DEFAULT '1',\n\t\t\t    KEY group_id (group_id),\n\t\t\t    KEY parent_id (parent_id),\n\t\t\t    KEY field_order (field_order),\n\t\t\t    KEY can_delete (can_delete),\n\t\t\t    KEY is_required (is_required)\n\t\t\t   ) {$charset_collate};";
    $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_data (\n\t\t\t    id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t    field_id bigint(20) unsigned NOT NULL,\n\t\t\t    user_id bigint(20) unsigned NOT NULL,\n\t\t\t    value longtext NOT NULL,\n\t\t\t    last_updated datetime NOT NULL,\n\t\t\t    KEY field_id (field_id),\n\t\t\t    KEY user_id (user_id)\n\t\t\t   ) {$charset_collate};";
    $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_meta (\n\t\t\t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\tobject_id bigint(20) NOT NULL,\n\t\t\t\tobject_type varchar(150) NOT NULL,\n\t\t\t\tmeta_key varchar(255) DEFAULT NULL,\n\t\t\t\tmeta_value longtext DEFAULT NULL,\n\t\t\t\tKEY object_id (object_id),\n\t\t\t\tKEY meta_key (meta_key)\n\t\t   \t   ) {$charset_collate};";
    dbDelta($sql);
    // Insert the default group and fields
    $insert_sql = array();
    if (!$nxtdb->get_var("SELECT id FROM {$bp_prefix}bp_xprofile_groups WHERE id = 1")) {
        $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_groups ( name, description, can_delete ) VALUES ( " . $nxtdb->prepare('%s', stripslashes(bp_get_option('bp-xprofile-base-group-name'))) . ", '', 0 );";
    }
    if (!$nxtdb->get_var("SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE id = 1")) {
        $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_fields ( group_id, parent_id, type, name, description, is_required, can_delete ) VALUES ( 1, 0, 'textbox', " . $nxtdb->prepare('%s', stripslashes(bp_get_option('bp-xprofile-fullname-field-name'))) . ", '', 1, 0 );";
    }
    dbDelta($insert_sql);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:27,代码来源:bp-core-schema.php

示例12: invite_anyone_options

function invite_anyone_options()
{
    global $iaoptions;
    // We set our own options cache because of some stupid limitations in the way that page
    // loads work
    if (!empty($iaoptions)) {
        $options = $iaoptions;
    } else {
        if (function_exists('bp_update_option')) {
            $options = bp_get_option('invite_anyone');
        } else {
            $options = get_option('invite_anyone');
        }
    }
    if (!$options) {
        $options = array();
    }
    $defaults_array = array('max_invites' => 5, 'allow_email_invitations' => 'all', 'message_is_customizable' => 'yes', 'subject_is_customizable' => 'no', 'can_send_group_invites_email' => 'yes', 'bypass_registration_lock' => 'yes', 'email_visibility_toggle' => 'nolimit', 'email_since_toggle' => 'no', 'days_since' => 0, 'email_role_toggle' => 'no', 'minimum_role' => 'subscriber', 'email_blacklist_toggle' => 'no', 'email_blacklist' => '', 'group_invites_can_admin' => 'anyone', 'group_invites_can_group_admin' => 'anyone', 'group_invites_can_group_mod' => 'anyone', 'group_invites_can_group_member' => 'anyone', 'cloudsponge_enabled' => 'off', 'email_limit_invites_toggle' => 'no', 'limit_invites_per_user' => 10);
    foreach ($defaults_array as $key => $value) {
        if (!isset($options[$key])) {
            $options[$key] = $value;
        }
    }
    $iaoptions = $options;
    return apply_filters('invite_anyone_options', $options);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:26,代码来源:functions.php

示例13: bp_is_update

/**
 * Compare the BuddyPress version to the DB version to determine if updating
 *
 * @since BuddyPress (1.6)
 *
 * @uses get_option()
 * @uses bp_get_db_version() To get BuddyPress's database version
 * @return bool True if update, False if not
 */
function bp_is_update()
{
    // Current DB version of this site (per site in a multisite network)
    $current_db = bp_get_option('_bp_db_version');
    $current_live = bp_get_db_version();
    // Compare versions (cast as int and bool to be safe)
    $is_update = (bool) ((int) $current_db < (int) $current_live);
    // Return the product of version comparison
    return $is_update;
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:19,代码来源:bp-core-update.php

示例14: bpchat_get_all_options

/**
 * @todo make independent of BP
 * 
 * @since 1.1.0
 * 
 * @return array
 */
function bpchat_get_all_options()
{
    $default = array('notification_volume' => 20, 'notification_enabled' => true, 'notification_sound_enabled' => true, 'allow_prefernce_change' => true, 'default_chat_preference' => 'all', 'is_disabled' => false);
    if (function_exists('bp_get_option')) {
        $options = bp_get_option('bpchat-settings', $default);
    } else {
        $options = get_option('bpchat-settings', $default);
    }
    return apply_filters('bpchat_settings', $options);
}
开发者ID:Lady1178,项目名称:bp-chat,代码行数:17,代码来源:functions.php

示例15: setup_settings

 /**
  * Setup settings
  */
 function setup_settings()
 {
     // Save a query if we can help it
     if (!bp_is_user()) {
         return;
     }
     // Pull up the existing values
     $settings = bp_get_option('bp_smp_settings');
     $defaults = array('display' => array('inline'), 'label' => __('Follow me online: ', 'bp-smp'));
     $this->settings = wp_parse_args($settings, $defaults);
 }
开发者ID:rjbaniel,项目名称:bp-social-media-profiles,代码行数:14,代码来源:bp-social-media-profiles.php


注:本文中的bp_get_option函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。