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


PHP bb_update_option函数代码示例

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


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

示例1: em_options

/**
 * Makes a settings page for the plugin
 * 
 * @uses bb_option_form_element() to generate the page
 */
function em_options()
{
    global $em_plugopts;
    if ($_POST['em_opts_submit'] == 1) {
        /* Settings have been received, now save them! */
        bb_check_admin_referer('em-save-chk');
        /* Security Check */
        /* Checks on options, and then save them */
        $em_plugopts['link-tags'] = intval($_POST['link-tags']) == 1 ? 1 : 0;
        $em_plugopts['link-users'] = intval($_POST['link-users']) == 1 ? 1 : 0;
        $em_plugopts['link-user-to'] = $_POST['link-user-to'] == 'website' ? 'website' : 'profile';
        $em_plugopts['reply-link'] = intval($_POST['reply-link']) == 1 ? 1 : 0;
        $em_plugopts['reply-text'] = esc_attr($_POST['reply-text']);
        bb_update_option(EM_OPTIONS, $em_plugopts);
        bb_admin_notice(__('The options were successfully saved!', 'easy-mentions'));
    }
    if ($ver = em_update_check()) {
        /* Check for Updates and if available, then notify */
        bb_admin_notice(sprintf(__('New version (%1$s) of Easy Mentions is available! Please download the latest version from <a href="%2$s">here</a>.', 'easy-mentions'), $ver, 'http://bbpress.org/plugins/topic/easy-mentions/'));
    }
    /* Options in an array to be printed */
    $options = array('link-tags' => array('title' => __('Link the Tags?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['link-tags'] == 1 ? '1' : '0', 'note' => sprintf(__('Check this option if you want the tags to be linked (by using %s) in the posts.', 'easy-mentions'), '<code>#tag</code>'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'link-users' => array('title' => __('Link the Users?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['link-users'] == 1 ? '1' : '0', 'note' => sprintf(__('Check this option if you want the users to be linked (by using %s) in the posts.', 'easy-mentions'), '<code>@user</code>'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'link-user-to' => array('title' => __('Link the user to profile or website?', 'easy-mentions'), 'type' => 'radio', 'value' => $em_plugopts['link-user-to'] == 'website' ? 'website' : 'profile', 'note' => __('If you selected the website option and the user\'s website does not exist, then the user will be linked to his or her profile page.', 'easy-mentions'), 'options' => array('profile' => __('Profile', 'easy-mentions'), 'website' => __('Website', 'easy-mentions'))), 'reply-link' => array('title' => __('Add a reply link below each post?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['reply-link'] == 1 ? '1' : '0', 'note' => sprintf(__('Before checking this option, please verify that there is a post form below the topic on each page. (<a href="%s">Help</a>)', 'easy-mentions'), 'http://bbpress.org/plugins/topic/easy-mentions/faq/'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'reply-text' => array('title' => __('Reply Text', 'easy-mentions'), 'class' => array('long'), 'value' => $em_plugopts['reply-text'] ? stripslashes($em_plugopts['reply-text']) : '<em>Replying to @%%USERNAME%%\'s <a href="%%POSTLINK%%">post</a>:</em>', 'after' => '<div style="clear:both;"></div>' . sprintf(__('Some HTML is allowed. The following keys can also be used:%1$s - Post\'s author\'s name%2$s - Post\'s link', 'after-the-deadline'), '<br /><strong>%%USERNAME%%</strong>', '<br /><strong>%%POSTLINK%%</strong>') . '<br />'));
    if ($em_plugopts['link-users'] != 1) {
        $options['link-user-to']['attributes'] = array('disabled' => 'disabled');
    }
    if ($em_plugopts['reply-link'] != 1) {
        $options['reply-text']['attributes'] = array('disabled' => 'disabled');
    }
    ?>
	
	<h2><?php 
    _e('Easy Mentions', 'easy-mentions');
    ?>
</h2>
	<?php 
    do_action('bb_admin_notices');
    ?>
	<form method="post" class="settings options">
		<fieldset>
			<?php 
    foreach ($options as $option => $args) {
        bb_option_form_element($option, $args);
    }
    ?>
		</fieldset>
		<fieldset class="submit">
			<?php 
    bb_nonce_field('em-save-chk');
    ?>
			<input type="hidden" name="em_opts_submit" value="1"></input>
			<input class="submit" type="submit" name="submit" value="Save Changes" />
		</fieldset>
		<p><?php 
    printf(__('Happy with the plugin? Why not <a href="%1$s">buy the author a cup of coffee or two</a> or get him something from his <a href="%2$s">wishlist</a>?', 'easy-mentions'), 'http://gaut.am/donate/EM/', 'http://gaut.am/wishlist/');
    ?>
</p>
	</form>
<?php 
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:64,代码来源:admin.php

示例2: topic_icons_admin_page_process

function topic_icons_admin_page_process()
{
    if (isset($_POST['topic-icons-submit'])) {
        bb_update_option('topic-icons-active-icon-set', $_POST['icon-set']);
        bb_update_option('topic-icons-active-status-interpreter', $_POST['status-interpreter']);
        bb_update_option('topic-icons-active-status-renderer', $_POST['status-renderer']);
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:8,代码来源:bb-topic-icons-admin.php

示例3: recaptcha_bbpress_admin_page_process

function recaptcha_bbpress_admin_page_process()
{
    if (isset($_POST['submit'])) {
        if ('rcpbbp_update' == $_POST['action']) {
            bb_update_option('recaptcha_bbpress_public_key', $_POST['rcpbbp_public']);
            bb_update_option('recaptcha_bbpress_private_key', $_POST['rcpbbp_private']);
        }
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:9,代码来源:recaptcha-bbpress.php

示例4: bb_language_switcher_update

function bb_language_switcher_update()
{
    // reads the .mo files and looks for the formal language name automagically
    if (!bb_current_user_can('administrate')) {
        return;
    }
    $bb_language_switcher_iso639 = array('aa' => 'Afar', 'ab' => 'Abkhazian', 'ae' => 'Avestan', 'af' => 'Afrikaans', 'ak' => 'Akan', 'am' => 'Amharic', 'an' => 'Aragonese', 'ar' => 'Arabic', 'as' => 'Assamese', 'av' => 'Avaric', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'be' => 'Belarusian', 'bg' => 'Bulgarian', 'bh' => 'Bihari', 'bi' => 'Bislama', 'bm' => 'Bambara', 'bn' => 'Bengali', 'bo' => 'Tibetan', 'br' => 'Breton', 'bs' => 'Bosnian', 'ca' => 'Catalan', 'ca' => 'Valencian', 'ce' => 'Chechen', 'ch' => 'Chamorro', 'co' => 'Corsican', 'cr' => 'Cree', 'cs' => 'Czech', 'cu' => 'Church Slavic', 'cv' => 'Chuvash', 'cy' => 'Welsh', 'da' => 'Danish', 'de' => 'German', 'dv' => 'Dhivehi', 'dv' => 'Divehi', 'dv' => 'Maldivian', 'dz' => 'Dzongkha', 'ee' => 'Ewe', 'el' => 'Greek', 'en' => 'English', 'eo' => 'Esperanto', 'es' => 'Castilian', 'es' => 'Spanish', 'et' => 'Estonian', 'eu' => 'Basque', 'fa' => 'Persian', 'ff' => 'Fulah', 'fi' => 'Finnish', 'fj' => 'Fijian', 'fo' => 'Faroese', 'fr' => 'French', 'fy' => 'Western Frisian', 'ga' => 'Irish', 'gd' => 'Gaelic', 'gd' => 'Scottish Gaelic', 'gl' => 'Galician', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'gv' => 'Manx', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hr' => 'Croatian', 'ht' => 'Haitian Creole', 'hu' => 'Hungarian', 'hy' => 'Armenian', 'hz' => 'Herero', 'id' => 'Indonesian', 'ie' => 'Interlingue', 'ie' => 'Occidental', 'ig' => 'Igbo', 'ii' => 'Nuosu', 'ii' => 'Sichuan Yi', 'ik' => 'Inupiaq', 'io' => 'Ido', 'is' => 'Icelandic', 'it' => 'Italian', 'iu' => 'Inuktitut', 'ja' => 'Japanese', 'jv' => 'Javanese', 'ka' => 'Georgian', 'kg' => 'Kongo', 'ki' => 'Gikuyu', 'ki' => 'Kikuyu', 'kj' => 'Kuanyama', 'kk' => 'Kazakh', 'kl' => 'Greenlandic', 'kl' => 'Kalaallisut', 'km' => 'Central Khmer', 'kn' => 'Kannada', 'ko' => 'Korean', 'kr' => 'Kanuri', 'ks' => 'Kashmiri', 'ku' => 'Kurdish', 'kv' => 'Komi', 'kw' => 'Cornish', 'ky' => 'Kirghiz', 'ky' => 'Kyrgyz', 'la' => 'Latin', 'lb' => 'Letzeburgesch', 'lb' => 'Luxembourgish', 'lg' => 'Ganda', 'li' => 'Limburgan', 'li' => 'Limburger', 'li' => 'Limburgish', 'ln' => 'Lingala', 'lo' => 'Lao', 'lt' => 'Lithuanian', 'lu' => 'Luba-Katanga', 'lv' => 'Latvian', 'mg' => 'Malagasy', 'mh' => 'Marshallese', 'mi' => 'Maori', 'mk' => 'Macedonian', 'ml' => 'Malayalam', 'mn' => 'Mongolian', 'mr' => 'Marathi', 'ms' => 'Malay', 'mt' => 'Maltese', 'my' => 'Burmese', 'na' => 'Nauru', 'nb' => 'Norwegian Bokmål', 'nd' => 'North Ndebele', 'ne' => 'Nepali', 'ng' => 'Ndonga', 'nl' => 'Dutch', 'nl' => 'Flemish', 'nn' => 'Norwegian Nynorsk', 'no' => 'Norwegian', 'nr' => 'South Ndebele', 'nv' => 'Navajo', 'ny' => 'Chewa', 'ny' => 'Chichewa', 'ny' => 'Nyanja', 'oc' => 'Occitan', 'oj' => 'Ojibwa', 'om' => 'Oromo', 'or' => 'Oriya', 'os' => 'Ossetian', 'os' => 'Ossetic', 'pa' => 'Panjabi', 'pi' => 'Pali', 'pl' => 'Polish', 'ps' => 'Pushto', 'pt' => 'Portuguese', 'qu' => 'Quechua', 'rm' => 'Romansh', 'rn' => 'Rundi', 'ro' => 'Moldavian', 'ro' => 'Moldovan', 'ro' => 'Romanian', 'ru' => 'Russian', 'rw' => 'Kinyarwanda', 'sa' => 'Sanskrit', 'sc' => 'Sardinian', 'sd' => 'Sindhi', 'se' => 'Northern Sami', 'sg' => 'Sango', 'si' => 'Sinhala', 'si' => 'Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'sm' => 'Samoan', 'sn' => 'Shona', 'so' => 'Somali', 'sq' => 'Albanian', 'sr' => 'Serbian', 'ss' => 'Swati', 'st' => 'Sotho, Southern', 'su' => 'Sundanese', 'sv' => 'Swedish', 'sw' => 'Swahili', 'ta' => 'Tamil', 'te' => 'Telugu', 'tg' => 'Tajik', 'th' => 'Thai', 'ti' => 'Tigrinya', 'tk' => 'Turkmen', 'tl' => 'Tagalog', 'tn' => 'Tswana', 'to' => 'Tonga', 'tr' => 'Turkish', 'ts' => 'Tsonga', 'tt' => 'Tatar', 'tw' => 'Twi', 'ty' => 'Tahitian', 'ug' => 'Uighur', 'ug' => 'Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'wa' => 'Walloon', 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Chuang', 'za' => 'Zhuang', 'zh' => 'Chinese', 'zu' => 'Zulu');
    $languages = bb_glob(BB_LANG_DIR . '*.mo');
    // might have problem in safe mode
    if (empty($languages)) {
        return;
    }
    // no .mo files?
    foreach ($languages as $language) {
        if (BB_LANG_USE_FILE_META) {
            unset($match);
            $content = "";
            $handle = fopen($language, "rb");
            // should work even under windows
            while (!feof($handle)) {
                $content .= fread($handle, 8192);
                if (preg_match("/X\\-Poedit\\-Language\\:(.+?)\n/i", $content, $match)) {
                    continue;
                }
                // language name in English from poedit meta data
                if (strlen($content) > 81920) {
                    $content = substr($content, -8192);
                }
                // trim buffer size
            }
            unset($content);
            fclose($handle);
        }
        preg_match("/.*[\\/](.+?)\\.mo\$/i", $language, $lang);
        // filename becomes key
        $lang = trim($lang[1]);
        if (strlen($lang) == 5) {
            $cn = " (" . strtoupper(substr($lang, -2)) . ") ";
        } else {
            $cn = "";
        }
        if (!empty($match[1])) {
            $list[$lang] = ucwords(trim($match[1])) . $cn;
        } elseif (BB_LANG_USE_FILE_META != 'only' && BB_LANG_USE_FILE_META != 'force') {
            $list[$lang] = utf8_encode($bb_language_switcher_iso639[strtolower(substr($lang, 0, 2))]) . $cn;
            // fallback if name can't be found in meta
        }
    }
    if (!empty($list)) {
        $list[' '] = "English";
        // add default
        asort($list);
        // make alphabetical
        bb_update_option('bb_language_switcher', $list);
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:56,代码来源:bb-language-switcher-admin.php

示例5: thanks_admin_page_process

function thanks_admin_page_process()
{
    global $_POST;
    if (isset($_POST['thanks_option_submit'])) {
        bb_update_option('thanks_voting', $_POST['thanks_voting']);
        bb_update_option('thanks_output_none', $_POST['thanks_output_none']);
        bb_update_option('thanks_output_one', $_POST['thanks_output_one']);
        bb_update_option('thanks_output_many', $_POST['thanks_output_many']);
        bb_update_option('thanks_position', $_POST['thanks_position']);
        bb_update_option('thanks_voters', $_POST['thanks_voters']);
        bb_update_option('thanks_voters_prefix', $_POST['thanks_voters_prefix']);
        bb_update_option('thanks_voters_suffix', $_POST['thanks_voters_suffix']);
    }
    if (isset($_POST['thanks_option_reset'])) {
        bb_delete_option('thanks_voting');
        bb_delete_option('thanks_output_none');
        bb_delete_option('thanks_output_one');
        bb_delete_option('thanks_output_many');
        bb_delete_option('thanks_success');
        bb_delete_option('thanks_position');
        bb_delete_option('thanks_voters');
        bb_delete_option('thanks_voters_prefix');
        bb_delete_option('thanks_voters_suffix');
    }
    if (isset($_POST['thanks_remove_all'])) {
        $opt = bb_get_option("thanks_posts");
        for ($i = 0; $i < count($opt); $i++) {
            $post_id = $opt[$i];
            bb_delete_postmeta($post_id, "thanks");
        }
        bb_delete_option("thanks_posts");
        bb_delete_option('thanks_voting');
        bb_delete_option('thanks_output_none');
        bb_delete_option('thanks_output_one');
        bb_delete_option('thanks_output_many');
        bb_delete_option('thanks_success');
        bb_delete_option('thanks_position');
        bb_delete_option('thanks_voters');
        bb_delete_option('thanks_voters_prefix');
        bb_delete_option('thanks_voters_suffix');
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:42,代码来源:thanks-admin.php

示例6: blocklist_process_post

function blocklist_process_post()
{
    if (!bb_current_user_can('administrate')) {
        return;
    }
    global $blocklist;
    if (isset($_POST['submit']) && isset($_POST['blocklist'])) {
        $options = array('data', 'email');
        foreach ($options as $option) {
            if (!empty($_POST[$option])) {
                (array) ($data = explode("\n", trim($_POST[$option])));
                array_walk($data, create_function('&$arr', '$arr=trim($arr);'));
                $blocklist[$option] = implode("\r\n", $data) . "\r\n";
            } else {
                $blocklist[$option] = "";
            }
        }
        bb_update_option('blocklist', $blocklist);
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:20,代码来源:blocklist-admin.php

示例7: bp_forums_load_bbpress


//.........这里部分代码省略.........
    $bp = buddypress();
    define('BB_PATH', $bp->plugin_dir . '/bp-forums/bbpress/');
    define('BACKPRESS_PATH', $bp->plugin_dir . '/bp-forums/bbpress/bb-includes/backpress/');
    define('BB_URL', $bp->plugin_url . 'bp-forums/bbpress/');
    define('BB_INC', 'bb-includes/');
    require BB_PATH . BB_INC . 'class.bb-query.php';
    require BB_PATH . BB_INC . 'class.bb-walker.php';
    require BB_PATH . BB_INC . 'functions.bb-core.php';
    require BB_PATH . BB_INC . 'functions.bb-forums.php';
    require BB_PATH . BB_INC . 'functions.bb-topics.php';
    require BB_PATH . BB_INC . 'functions.bb-posts.php';
    require BB_PATH . BB_INC . 'functions.bb-topic-tags.php';
    require BB_PATH . BB_INC . 'functions.bb-capabilities.php';
    require BB_PATH . BB_INC . 'functions.bb-meta.php';
    require BB_PATH . BB_INC . 'functions.bb-pluggable.php';
    require BB_PATH . BB_INC . 'functions.bb-formatting.php';
    require BB_PATH . BB_INC . 'functions.bb-template.php';
    require BACKPRESS_PATH . 'class.wp-taxonomy.php';
    require BB_PATH . BB_INC . 'class.bb-taxonomy.php';
    require BB_PATH . 'bb-admin/includes/functions.bb-admin.php';
    $bb = new stdClass();
    require bp_get_option('bb-config-location');
    // Setup the global database connection
    $bbdb = new BPDB(BBDB_USER, BBDB_PASSWORD, BBDB_NAME, BBDB_HOST);
    // Set the table names
    $bbdb->forums = $bb_table_prefix . 'forums';
    $bbdb->meta = $bb_table_prefix . 'meta';
    $bbdb->posts = $bb_table_prefix . 'posts';
    $bbdb->terms = $bb_table_prefix . 'terms';
    $bbdb->term_relationships = $bb_table_prefix . 'term_relationships';
    $bbdb->term_taxonomy = $bb_table_prefix . 'term_taxonomy';
    $bbdb->topics = $bb_table_prefix . 'topics';
    if (isset($bb->custom_user_table)) {
        $bbdb->users = $bb->custom_user_table;
    } else {
        $bbdb->users = $wpdb->users;
    }
    if (isset($bb->custom_user_meta_table)) {
        $bbdb->usermeta = $bb->custom_user_meta_table;
    } else {
        $bbdb->usermeta = $wpdb->usermeta;
    }
    $bbdb->prefix = $bb_table_prefix;
    define('BB_INSTALLING', false);
    if (is_object($wp_roles)) {
        $bb_roles = $wp_roles;
        bb_init_roles($bb_roles);
    }
    /**
     * Fires during the bootstrap setup for bbPress 1.x.
     *
     * @since 1.1.0
     */
    do_action('bb_got_roles');
    /**
     * Fires during the bootstrap setup for bbPress 1.x.
     *
     * @since 1.1.0
     */
    do_action('bb_init');
    /**
     * Fires during the bootstrap setup for bbPress 1.x.
     *
     * @since 1.1.0
     */
    do_action('init_roles');
    $bb_current_user = $current_user;
    $wp_users_object = new BP_Forums_BB_Auth();
    if (!isset($wp_taxonomy_object)) {
        $wp_taxonomy_object = new BB_Taxonomy($bbdb);
    }
    $wp_taxonomy_object->register_taxonomy('bb_topic_tag', 'bb_topic');
    // Set a site id if there isn't one already
    if (!isset($bb->site_id)) {
        $bb->site_id = bp_get_root_blog_id();
    }
    // Check if the tables are installed, if not, install them
    if (!($tables_installed = (bool) $bbdb->get_results('DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A))) {
        require BB_PATH . 'bb-admin/includes/defaults.bb-schema.php';
        // Backticks and "IF NOT EXISTS" break the dbDelta function.
        bp_bb_dbDelta(str_replace(' IF NOT EXISTS', '', str_replace('`', '', $bb_queries)));
        require BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php';
        bb_update_db_version();
        // Set the site admins as the keymasters
        $site_admins = get_site_option('site_admins', array('admin'));
        foreach ((array) $site_admins as $site_admin) {
            bp_update_user_meta(bp_core_get_userid($site_admin), $bb_table_prefix . 'capabilities', array('keymaster' => true));
        }
        // Create the first forum.
        bb_new_forum(array('forum_name' => 'Default Forum'));
        // Set the site URI
        bb_update_option('uri', BB_URL);
    }
    /**
     * Fires inside an anonymous function that is run on bbPress shutdown.
     *
     * @since 1.1.0
     */
    register_shutdown_function(create_function('', 'do_action("bb_shutdown");'));
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:101,代码来源:bp-forums-bbpress-sa.php

示例8: process_form_finalise_installation

 /**
  * Finalises the installation by creating the database and writing all the supplied data to the database.
  *
  * @return void
  **/
 function process_form_finalise_installation()
 {
     require_once BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php';
     require_once BB_PATH . 'bb-admin/includes/functions.bb-admin.php';
     $this->inject_form_values_into_data(2);
     $this->inject_form_values_into_data(3);
     $data2 =& $this->data[2]['form'];
     $data3 =& $this->data[3]['form'];
     $data4 =& $this->data[4]['form'];
     $error_log = array();
     $installation_log = array();
     // Check the referer
     bb_check_admin_referer('bbpress-installer');
     $installation_log[] = __('Referrer is OK, beginning installation&hellip;');
     global $bbdb;
     // Setup user table variables and constants if available
     if ($data2['toggle_2_2']['value']) {
         $installation_log[] = '>>> ' . __('Setting up custom user table constants');
         global $bb;
         global $bb_table_prefix;
         if (!empty($data2['wp_table_prefix']['value'])) {
             $bb->wp_table_prefix = $data2['wp_table_prefix']['value'];
         }
         if (!empty($data2['user_bbdb_name']['value'])) {
             $bb->user_bbdb_name = $data2['user_bbdb_name']['value'];
         }
         if (!empty($data2['user_bbdb_user']['value'])) {
             $bb->user_bbdb_user = $data2['user_bbdb_user']['value'];
         }
         if (!empty($data2['user_bbdb_password']['value'])) {
             $bb->user_bbdb_password = $data2['user_bbdb_password']['value'];
         }
         if (!empty($data2['user_bbdb_host']['value'])) {
             $bb->user_bbdb_host = $data2['user_bbdb_host']['value'];
         }
         if (!empty($data2['user_bbdb_charset']['value'])) {
             $bb->user_bbdb_charset = preg_replace('/[^a-z0-9_-]/i', '', $data2['user_bbdb_charset']['value']);
         }
         if (!empty($data2['user_bbdb_collate']['value'])) {
             $bb->user_bbdb_collate = preg_replace('/[^a-z0-9_-]/i', '', $data2['user_bbdb_collate']['value']);
         }
         bb_set_custom_user_tables();
         // Add custom user database if required
         if (isset($bb->custom_databases['user'])) {
             $bbdb->add_db_server('user', $bb->custom_databases['user']);
         }
         // Add custom tables if required
         if (isset($bb->custom_tables)) {
             $bbdb->tables = array_merge($bbdb->tables, $bb->custom_tables);
             if (is_wp_error($bbdb->set_prefix($bb_table_prefix))) {
                 die(__('Your user table prefix may only contain letters, numbers and underscores.'));
             }
         }
     }
     // Create the database
     $installation_log[] = "\n" . __('Step 1 - Creating database tables');
     if (!$this->database_tables_are_installed()) {
         // Hide db errors
         $bbdb->hide_errors();
         // Install the database
         $alterations = bb_install();
         // Show db errors
         $bbdb->show_errors();
         if (isset($alterations['errors']) && is_array($alterations['errors'])) {
             $error_log = array_merge($error_log, $alterations['errors']);
         }
         if (isset($alterations['messages']) && is_array($alterations['messages'])) {
             $installation_log = array_merge($installation_log, $alterations['messages']);
         }
         if (!$this->database_tables_are_installed()) {
             $installation_log[] = '>>> ' . __('Database installation failed!!!');
             $installation_log[] = '>>>>>> ' . __('Halting installation!');
             $error_log[] = __('Database installation failed!!!');
             $this->step_status[4] = 'incomplete';
             $this->strings[4]['h2'] = __('Installation failed!');
             $this->strings[4]['messages']['error'][] = __('The database failed to install. You may need to replace bbPress with a fresh copy and start again.');
             $data4['installation_log']['value'] = join("\n", $installation_log);
             $data4['error_log']['value'] = join("\n", $error_log);
             return 'incomplete';
         }
     } else {
         $installation_log[] = '>>> ' . __('Database is already installed!!!');
     }
     // Integration settings passed from step 2
     // These are already validated provided that the referer checks out
     $installation_log[] = "\n" . __('Step 2 - WordPress integration (optional)');
     if ($data2['toggle_2_0']['value']) {
         if ($data2['toggle_2_1']['value']) {
             bb_update_option('wp_siteurl', $data2['wp_siteurl']['value']);
             $installation_log[] = '>>> ' . __('WordPress address (URL):') . ' ' . $data2['wp_siteurl']['value'];
             bb_update_option('wp_home', $data2['wp_home']['value']);
             $installation_log[] = '>>> ' . __('Blog address (URL):') . ' ' . $data2['wp_home']['value'];
             $config_result = $this->write_lines_to_file(BB_PATH . 'bb-config.php', false, array("define( 'BB_AUTH_KEY" => array("'" . BB_AUTH_KEY . "'", "'" . $data2['wp_auth_key']['value'] . "'"), "define( 'BB_SECURE_A" => array("'" . BB_SECURE_AUTH_KEY . "'", "'" . $data2['wp_secure_auth_key']['value'] . "'"), "define( 'BB_LOGGED_I" => array("'" . BB_LOGGED_IN_KEY . "'", "'" . $data2['wp_logged_in_key']['value'] . "'")));
             switch ($config_result) {
                 case 1:
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:cartonbank,代码行数:101,代码来源:class.bb-install.php

示例9: extract

// Get plugin counts
extract(bb_get_plugin_counts());
// Get requested plugins
$requested_plugins = bb_get_plugins('all', $_plugin_type, $_plugin_status);
// Get currently active
$active_plugins = (array) bb_get_option('active_plugins');
// Check for missing plugin files and remove them from the active plugins array
$update = false;
foreach ($active_plugins as $index => $plugin) {
    if (!file_exists(bb_get_plugin_path($plugin))) {
        $update = true;
        unset($active_plugins[$index]);
    }
}
if ($update) {
    bb_update_option('active_plugins', $active_plugins);
}
unset($update, $index, $plugin);
// Set the action
$action = '';
if (isset($_GET['action']) && !empty($_GET['action'])) {
    $action = trim($_GET['action']);
}
// Set the plugin
$plugin = isset($_GET['plugin']) ? trim(stripslashes($_GET['plugin'])) : '';
// Deal with user actions
if (!empty($action)) {
    switch ($action) {
        case 'activate':
            // Activation
            bb_check_admin_referer('activate-plugin_' . $plugin);
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:plugins.php

示例10: bb_load_plugin_textdomain

 */
bb_load_plugin_textdomain('easy-mentions', dirname(__FILE__) . '/languages');
/* Create Text Domain For Translations */
/* Defines */
define('EM_VER', '0.2');
/* Version */
define('EM_OPTIONS', 'Easy-Mentions');
/* Option Name */
define('EM_PLUGPATH', bb_get_plugin_uri(bb_plugin_basename(__FILE__)));
/* Plugin URL */
/* Get the options, if not found then set them */
$em_plugopts = bb_get_option(EM_OPTIONS);
if (!is_array($em_plugopts)) {
    $em_plugopts = array('link-tags' => 1, 'link-users' => 1, 'link-user-to' => 'profile', 'reply-link' => 0, 'reply-text' => "<em>Replying to @%%USERNAME%%\\'s <a href=\"%%POSTLINK%%\">post</a>:</em>");
    bb_update_option(EM_OPTIONS, $em_plugopts);
}
if ($em_plugopts['link-to']) {
    /* Update the old options, will be removed in v0.4 */
    unset($em_plugopts['link-to']);
    $em_plugopts['link-users'] = 1;
    $em_plugopts['link-tags'] = 1;
    $em_plugopts['link-user-to'] = $em_plugopts['link-to'] == 'website' ? 'website' : 'profile';
    bb_update_option(EM_OPTIONS, $em_plugopts);
}
if (bb_is_admin()) {
    /* Load admin.php file if it is the admin area */
    require_once 'includes/admin.php';
} else {
    /* Else load public.php file if it is the public area */
    require_once 'includes/public.php';
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:31,代码来源:easy-mentions.php

示例11: bb_update_option

            echo $bbdb->usermeta;
            ?>
. Please check and re-run the script or duplicate the table yourself.</li></ol>
                <?php 
            break;
        }
        ?>
            </li>

            <?php 
        // Set the wp table prefix for sometime
        bb_update_option('wp_table_prefix', $wpdb->prefix);
        // Why don't people follow docs
        // Map the user roles, only admin = keymaster, rest = members
        if (!bb_get_option('wp_roles_map')) {
            bb_update_option('wp_roles_map', array('administrator' => 'keymaster', 'editor' => 'member', 'author' => 'member', 'contributor' => 'member', 'subscriber' => 'member'));
            ?>

                <li>User role mapping options have been automatically set. The WordPress administrator is now the keymaster, rest all WordPress roles are bbPress members.</li>

            <?php 
        }
        // Apply the bbPress roles to the new users based on their WordPress roles
        bb_apply_wp_role_map_to_orphans();
        // Get a keymaster
        $users = bb_user_search(array('roles' => 'keymaster', 'users_per_page' => 1));
        $user = $users[0];
        if (defined('W2BC_DEBUG') && W2BC_DEBUG == true) {
            ?>
                <li>Logging in as the following user:
                    <pre><?php 
开发者ID:markc,项目名称:wordpress-to-bbpress-converter,代码行数:31,代码来源:w2bc.php

示例12: array

if ($socialit_plugopts['shortyapi'] == "1") {
    //means that 1.2 ver was installed, and we have to fix some issues
    $socialit_plugopts['shortyapi'] = array('snip' => array('user' => '', 'key' => ''), 'bitly' => array('user' => '', 'key' => ''), 'supr' => array('chk' => 0, 'user' => '', 'key' => ''), 'trim' => array('chk' => 0, 'user' => '', 'pass' => ''), 'tinyarrow' => array('chk' => 0, 'user' => ''), 'cligs' => array('chk' => 0, 'key' => ''));
    bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts);
    //update with edited options
}
if ($socialit_plugopts['shorty'] == 'e7t') {
    $socialit_plugopts['shorty'] = 'b2l';
    //now, no more e7t, instead b2l.me
    bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts);
    //update with edited options
}
//fix for Social It 1.3, will be removed after the release of 1.5
if (!is_array($socialit_plugopts['bookmark'])) {
    $socialit_plugopts['bookmark'] = array_keys($socialit_bookmarks_data);
    bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts);
    //update with edited options
}
//add actions/filters
add_action('bb_admin_menu_generator', 'socialit_menu_link', -998);
//link in settings
add_action('bb_admin_head', 'socialit_admin', 997);
//admin css
add_action('bb_head', 'socialit_public', 997);
//public css
if (bb_is_topic() && $_GET['socialit_hide_show'] == "1") {
    add_action('bb_init', 'socialit_hide_show_do', 997);
    //do the function of hide/show socialit
}
add_filter('post_text', 'socialit_insert_in_post', 997);
//to insert social it automatically below the first post of every topic
开发者ID:billerby,项目名称:Surdeg,代码行数:31,代码来源:social-it.php

示例13: li_configuration_page_process

function li_configuration_page_process()
{
    if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && $_POST['action'] == 'update-li-settings') {
        bb_check_admin_referer('options-liconnect-update');
        $li_app_id = trim($_POST['li_app_id']);
        $li_secret = trim($_POST['li_secret']);
        bb_update_option('li_app_id', $li_app_id);
        bb_update_option('li_secret', $li_secret);
        if (!isset($_POST['li_displayname_from']) || $_POST['li_displayname_from'] < 0 || $_POST['li_displayname_from'] > 2) {
            $_POST['li_displayname_from'] = 0;
        }
        bb_update_option('li_displayname_from', intval($_POST['li_displayname_from']));
        if (!isset($_POST['li_get_jquery']) || true !== (bool) $_POST['li_get_jquery']) {
            bb_delete_option('li_get_jquery');
        } else {
            bb_update_option('li_get_jquery', 1);
        }
        if (!isset($_POST['li_allow_useredit']) || true !== (bool) $_POST['li_allow_useredit']) {
            bb_delete_option('li_allow_useredit');
        } else {
            bb_update_option('li_allow_useredit', 1);
        }
        if (!isset($_POST['li_request_email']) || true !== (bool) $_POST['li_request_email']) {
            bb_delete_option('li_request_email');
        } else {
            bb_update_option('li_request_email', 1);
        }
        if (!isset($_POST['li_hide_post_login']) || true !== (bool) $_POST['li_hide_post_login']) {
            bb_delete_option('li_hide_post_login');
        } else {
            bb_update_option('li_hide_post_login', 1);
        }
        bb_admin_notice(__('Configuration saved.'));
    }
}
开发者ID:nma,项目名称:linkedin-connect,代码行数:35,代码来源:connect.php

示例14: socialit_get_fetch_url

function socialit_get_fetch_url()
{
    global $socialit_plugopts;
    $perms = trim(socialit_get_current_url());
    //check if the link is already genereted or not, if yes, then return the link
    $fetch_url = trim($socialit_plugopts['shorturls'][md5($perms)]);
    if ($fetch_url) {
        return $fetch_url;
    }
    $url_more = "";
    $use_POST_method = false;
    $POST_data = null;
    // which short url service should be used?
    if ($socialit_plugopts['shorty'] == "e7t") {
        $first_url = "http://b2l.me/api.php?alias=&url=" . $perms;
        //now no e7t, instead b2l
    } elseif ($socialit_plugopts['shorty'] == "b2l") {
        $first_url = "http://b2l.me/api.php?alias=&url=" . $perms;
    } elseif ($socialit_plugopts['shorty'] == "tiny") {
        $first_url = "http://tinyurl.com/api-create.php?url=" . $perms;
    } elseif ($socialit_plugopts['shorty'] == "snip") {
        $first_url = "http://snipr.com/site/getsnip";
        $use_POST_method = true;
        $POST_data = "snipformat=simple&sniplink=" . rawurlencode($perms) . "&snipuser=" . $socialit_plugopts['shortyapi']['snip']['user'] . "&snipapi=" . $socialit_plugopts['shortyapi']['snip']['key'];
    } elseif ($socialit_plugopts['shorty'] == "cligs") {
        $first_url = "http://cli.gs/api/v1/cligs/create?url=" . urlencode($perms) . "&appid=SocialIt";
        if ($socialit_plugopts['shortyapi']['cligs']['chk'] == 1) {
            $first_url .= "&key=" . $socialit_plugopts['shortyapi']['cligs']['key'];
        }
    } elseif ($socialit_plugopts['shorty'] == "supr") {
        $first_url = "http://su.pr/api/simpleshorten?url=" . $perms;
        if ($socialit_plugopts['shortyapi']['supr']['chk'] == 1) {
            $first_url .= "&login=" . $socialit_plugopts['shortyapi']['supr']['user'] . "&apiKey=" . $socialit_plugopts['shortyapi']['supr']['key'];
        }
    } elseif ($socialit_plugopts['shorty'] == "bitly") {
        $first_url = "http://api.bit.ly/shorten?version=2.0.1&longUrl=" . $perms . "&history=1&login=" . $socialit_plugopts['shortyapi']['bitly']['user'] . "&apiKey=" . $socialit_plugopts['shortyapi']['bitly']['key'] . "&format=json";
    } elseif ($socialit_plugopts['shorty'] == "trim") {
        if ($socialit_plugopts['shortyapi']['trim']['chk'] == 1) {
            $first_url = "http://api.tr.im/api/trim_url.json?url=" . $perms . "&username=" . $socialit_plugopts['shortyapi']['trim']['user'] . "&password=" . $socialit_plugopts['shortyapi']['trim']['pass'];
        } else {
            $first_url = "http://api.tr.im/api/trim_simple?url=" . $perms;
        }
    } elseif ($socialit_plugopts['shorty'] == "tinyarrow") {
        $first_url = "http://tinyarro.ws/api-create.php?";
        if ($socialit_plugopts['shortyapi']['tinyarrow']['chk'] == 1) {
            $first_url .= "&userid=" . $socialit_plugopts['shortyapi']['tinyarrow']['user'];
        }
        $first_url .= "&url=" . $perms;
    } else {
        //default is e7t.us
        $first_url = "http://b2l.me/api.php?alias=&url=" . $perms;
    }
    // retrieve the shortened URL
    $fetch_url = socialit_nav_browse($first_url, $use_POST_method, $POST_data);
    if ($socialit_plugopts['shorty'] == "trim" && $socialit_plugopts['shortyapi']['trim']['chk'] == 1) {
        $fetch_array = json_decode($fetch_url, true);
        $fetch_url = $fetch_array['url'];
    }
    if ($socialit_plugopts['shorty'] == "bitly") {
        $fetch_array = json_decode($fetch_url, true);
        $fetch_url = $fetch_array['results'][$perms]['shortUrl'];
    }
    if ($fetch_url) {
        // remote call made and was successful
        $fetch_url = trim($fetch_url);
        $socialit_plugopts['shorturls'][md5($perms)] = $fetch_url;
        bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts);
        // update values for future use
    } else {
        //return the permalink, getting the short url was not successful
        $fetch_url = $perms;
    }
    return $fetch_url;
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:74,代码来源:functions.php

示例15: bb_check_admin_referer

if (in_array($action, array('update-users', 'update-options'))) {
    bb_check_admin_referer('options-nxtclass-' . $action);
    // Deal with advanced user database checkbox when it isn't checked
    if (!isset($_POST['user_bbdb_advanced'])) {
        $_POST['user_bbdb_advanced'] = false;
    }
    foreach ((array) $_POST as $option => $value) {
        if (!in_array($option, array('_nxtnonce', '_nxt_http_referer', 'action', 'submit'))) {
            $option = trim($option);
            $value = is_array($value) ? $value : trim($value);
            $value = stripslashes_deep($value);
            if (($option == 'nxt_siteurl' || $option == 'nxt_home') && !empty($value)) {
                $value = rtrim($value, " \t\n\r\v/") . '/';
            }
            if ($value) {
                bb_update_option($option, $value);
            } else {
                bb_delete_option($option);
            }
        }
    }
    if ($action == 'update-users') {
        bb_apply_nxt_role_map_to_orphans();
    }
    $goback = add_query_arg('updated', $action, nxt_get_referer());
    bb_safe_redirect($goback);
    exit;
}
switch (@$_GET['updated']) {
    case 'update-users':
        bb_admin_notice(__('<strong>User role mapping saved.</strong>'));
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:options-nxtclass.php


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