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


PHP add_option函数代码示例

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


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

示例1: memberlite_getUpdateInfo

/**
 * Get theme update information from the PMPro server.
 *
 * @since  2.0
 */
function memberlite_getUpdateInfo()
{
    //check if forcing a pull from the server
    $update_info = get_option("memberlite_update_info", false);
    $update_info_timestamp = get_option("memberlite_update_info_timestamp", 0);
    //if no update_infos locally, we need to hit the server
    if (empty($update_info) || !empty($_REQUEST['force-check']) || current_time('timestamp') > $update_info_timestamp + 86400) {
        /**
         * Filter to change the timeout for this wp_remote_get() request.
         *
         * @since 2.0.1
         *
         * @param int $timeout The number of seconds before the request times out
         */
        $timeout = apply_filters("memberlite_get_update_info_timeout", 5);
        //get em
        $remote_info = wp_remote_get(PMPRO_LICENSE_SERVER . "/themes/memberlite", $timeout);
        //test response
        if (is_wp_error($remote_info) || empty($remote_info['response']) || $remote_info['response']['code'] != '200') {
            //error
            pmpro_setMessage("Could not connect to the PMPro License Server to get update information. Try again later.", "error");
        } else {
            //update update_infos in cache
            $update_info = json_decode(wp_remote_retrieve_body($remote_info), true);
            delete_option('memberlite_update_info');
            add_option("memberlite_update_info", $update_info, NULL, 'no');
        }
        //save timestamp of last update
        delete_option('memberlite_update_info_timestamp');
        add_option("memberlite_update_info_timestamp", current_time('timestamp'), NULL, 'no');
    }
    return $update_info;
}
开发者ID:greathmaster,项目名称:memberlite,代码行数:38,代码来源:updates.php

示例2: ue_closeDefaultEditor

 /**
  * 当开启UEditor插件时,关闭默认的编辑器
  */
 function ue_closeDefaultEditor()
 {
     if (!get_option("close_default_editor")) {
         add_option("close_default_editor");
     }
     update_option("close_default_editor", "true");
 }
开发者ID:hjm8809,项目名称:xsphp.com,代码行数:10,代码来源:ueditor.class.php

示例3: activate

 function activate()
 {
     $data = array('gtranslate_title' => 'Website Translator');
     $data = get_option('GTranslate');
     GTranslate::load_defaults($data);
     add_option('GTranslate', $data);
 }
开发者ID:shubham777,项目名称:opinionpost,代码行数:7,代码来源:gtranslate.php

示例4: wpua_options

 /**
  * Settings saved to wp_options
  * @since 1.4
  * @uses add_option()
  */
 public function wpua_options()
 {
     add_option('avatar_default_wp_user_avatar', "");
     add_option('wp_user_avatar_allow_upload', '0');
     add_option('wp_user_avatar_disable_gravatar', '0');
     add_option('wp_user_avatar_edit_avatar', '1');
     add_option('wp_user_avatar_resize_crop', '0');
     add_option('wp_user_avatar_resize_h', '96');
     add_option('wp_user_avatar_resize_upload', '0');
     add_option('wp_user_avatar_resize_w', '96');
     add_option('wp_user_avatar_tinymce', '1');
     add_option('wp_user_avatar_upload_size_limit', '0');
     if (wp_next_scheduled('wpua_has_gravatar_cron_hook')) {
         $cron = get_option('cron');
         $new_cron = '';
         foreach ($cron as $key => $value) {
             if (is_array($value)) {
                 if (array_key_exists('wpua_has_gravatar_cron_hook', $value)) {
                     unset($cron[$key]);
                 }
             }
         }
         update_option('cron', $cron);
     }
 }
开发者ID:tuanlibra,项目名称:thptxuanang,代码行数:30,代码来源:class-wp-user-avatar-admin.php

示例5: rewrite_rule_endpoints

 function rewrite_rule_endpoints($call, $data)
 {
     if ($call == 'icl_st_save_translation' && in_array($data['icl_st_string_id'], $this->endpoints_strings)) {
         $this->add_endpoints();
         add_option('flush_rules_for_endpoints_translations', true);
     }
 }
开发者ID:helgatheviking,项目名称:woocommerce-multilingual,代码行数:7,代码来源:endpoints.class.php

示例6: cp_siteoffline_activate

function cp_siteoffline_activate()
{
    $options = array('enabled' => false, 'content' => NULL, 'version' => 1.0);
    if (get_option('sp_siteoffline_options') === false) {
        add_option('sp_siteoffline_options', $options);
    }
}
开发者ID:namwoody,项目名称:curry,代码行数:7,代码来源:main.php

示例7: wpr_set_schedule

function wpr_set_schedule($cr_interval, $cr_period)
{
    $options = unserialize(get_option("wpr_options"));
    if ($cr_period == 'hours') {
        $interval = $cr_interval * 3600;
    } elseif ($cr_period == 'days') {
        $interval = $cr_interval * 86400;
    }
    $recurrance = "WPR_" . $cr_interval . "_" . $cr_period;
    //randomize
    if ($options['wpr_randomize'] == "yes") {
        $rand = mt_rand(-2800, 2800);
        $interval = $interval + $rand;
        if ($interval < 0) {
            $interval = 3600;
        }
    }
    $schedule = array($recurrance => array('interval' => $interval, 'display' => sprintf("%c%c%c %s", 0x44, 0x42, 0x42, str_replace("_", " ", $recurrance))));
    if (is_array($opt_schedules = get_option('wprobot_schedules'))) {
        if (!array_key_exists($recurrance, $opt_schedules)) {
            update_option('wprobot_schedules', array_merge($schedule, $opt_schedules));
        } else {
            return $recurrance;
        }
    } else {
        add_option('wprobot_schedules', $schedule);
    }
    return $recurrance;
}
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:29,代码来源:func.php

示例8: wso_activation

function wso_activation()
{
    $opts = array('version' => WSO_VERSION, 'pict' => WSO_PLUGIN_URL . "medias/wso.jpg", 'pictret' => "");
    // add the configuration options
    add_option(WSO_OPTIONS, $opts);
    wso_create_db();
}
开发者ID:sontv1003,项目名称:vtcacademy,代码行数:7,代码来源:wordsocial.php

示例9: es_synctables

 public static function es_synctables()
 {
     $es_c_email_subscribers_ver = get_option('email-subscribers');
     if ($es_c_email_subscribers_ver != "2.9") {
         global $wpdb;
         // loading the sql file, load it and separate the queries
         $sql_file = ES_DIR . 'sql' . DS . 'es-createdb.sql';
         $prefix = $wpdb->prefix;
         $handle = fopen($sql_file, 'r');
         $query = fread($handle, filesize($sql_file));
         fclose($handle);
         $query = str_replace('CREATE TABLE IF NOT EXISTS ', 'CREATE TABLE ' . $prefix, $query);
         $query = str_replace('ENGINE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci*/', '', $query);
         $queries = explode('-- SQLQUERY ---', $query);
         // includes db upgrade file
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         // run the queries one by one
         foreach ($queries as $sSql) {
             dbDelta($sSql);
         }
         $guid = es_cls_common::es_generate_guid(60);
         $home_url = home_url('/');
         $cronurl = $home_url . "?es=cron&guid=" . $guid;
         add_option('es_c_cronurl', $cronurl);
         add_option('es_cron_mailcount', "50");
         add_option('es_cron_adminmail', "Hi Admin, \r\n\r\nCron URL has been triggered successfully on ###DATE### for the mail ###SUBJECT###. And it sent mail to ###COUNT### recipient. \r\n\r\nThank You");
         update_option('email-subscribers', "2.9");
     }
 }
开发者ID:tccyp001,项目名称:onemore-wordpress,代码行数:29,代码来源:es-register.php

示例10: wpfc_em_install

function wpfc_em_install()
{
    //check for updates - try adding one option, if it works then it's a first time install so add more
    if (current_user_can('list_users') && add_option('dbem_emfc_full_calendar_event_format', '#_EVENTTIMES - #_EVENTNAME')) {
        add_option('dbem_emfc_qtips_format', '{has_image}<div style="float:left; margin:0px 5px 5px 0px;">#_EVENTIMAGE{75,75}</div>{/has_image}#_EVENTEXCERPT');
    }
}
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:7,代码来源:wpfc-admin.php

示例11: wpcs_slide_activate

function wpcs_slide_activate()
{
    global $content_slider_defaults, $values;
    $default_settings = get_option('wpcs_options');
    $default_settings = wp_parse_args($default_settings, $content_slider_defaults);
    add_option('wpcs_options', $default_settings);
}
开发者ID:rtgibbons,项目名称:bya.org,代码行数:7,代码来源:content_slide.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     $this->client = $this->getMockBuilder('\\AudioTheme_Agent_Client')->setMethods(array('deauthorize', 'refresh_access_token', 'wp_remote_request'))->getMock();
     add_option(AudioTheme_Agent_Client::CLIENT_OPTION_NAME, array('client_id' => '123456789', 'client_secret' => '987654321'));
     add_option(AudioTheme_Agent_Client::TOKEN_OPTION_NAME, array('access_token' => 'abcdef', 'refresh_token' => 'zyxwvu', 'expires_at' => time() + 300, 'token_type' => 'bearer'));
 }
开发者ID:audiotheme,项目名称:audiotheme-agent,代码行数:7,代码来源:ClientRequestTest.php

示例13: flipping_team_install

/** Setup database and sample data */
function flipping_team_install()
{
    global $wpdb;
    $table_name = $wpdb->prefix . "team";
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
        $sql = "CREATE TABLE " . $table_name . " (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime bigint(11) DEFAULT '0' NOT NULL,\n\t\t\tname tinytext NOT NULL,\n\t\t\turl VARCHAR(200) NOT NULL,\n\t\t\timageloc VARCHAR(300) NOT NULL,\n\t\t\tinfo text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        add_option("flipping_team_db_version", $flipping_team_db_version);
        $table_name = $wpdb->prefix . "team";
        $name = "Abhishek Gupta";
        $website = "http://abhishek.cc";
        $info = "Student at IIT Delhi. More about on his website abhishek.cc or his startup zumbl.com .";
        $imageloc = get_site_url() . "/wp-content/plugins/flipping-team/images/images.jpeg";
        $rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $name, 'url' => $website, 'imageloc' => $imageloc, 'info' => $info));
        $table_name = $wpdb->prefix . "team";
        $name = "Scii";
        $website = "http://scil.coop";
        $info = "More about on his website.";
        $imageloc = get_site_url() . "/wp-content/plugins/flipping-team/images/images.jpeg";
        $rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $name, 'url' => $website, 'imageloc' => $imageloc, 'info' => $info));
    }
    $installed_ver = get_option("flipping_team_db_version");
    if ($installed_ver != $jal_db_version) {
        $sql = "CREATE TABLE " . $table_name . " (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime bigint(11) DEFAULT '0' NOT NULL,\n\t\t\tname tinytext NOT NULL,\n\t\t\turl VARCHAR(200) NOT NULL,\n\t\t\timageloc VARCHAR(300) NOT NULL,\n\t\t\tinfo text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        update_option("flipping_team_db_version", $flipping_team_db_version);
    }
}
开发者ID:joasssko,项目名称:schk,代码行数:31,代码来源:flipping_team.php

示例14: __construct

 /**
  * Plugin initialization.
  *
  * @param  string $plugin_path Path to plugin folder.
  * @param  string $plugin_url  URL to plugin folder.
  * @return void
  */
 public function __construct($plugin_path, $plugin_url)
 {
     $this->plugin_path = $plugin_path;
     $this->plugin_url = $plugin_url;
     add_action('after_setup_theme', array($this, 'after_setup_theme'));
     add_filter('terms_clauses', array($this, 'terms_clauses'), 10, 3);
     add_action('registered_taxonomy', array($this, 'registered_taxonomy'), 10, 3);
     add_action('wpmu_new_blog', array($this, 'wpmu_new_blog'), 10, 6);
     if (is_admin()) {
         // admin
         if (defined('DOING_AJAX')) {
             // ajax
             add_action('wp_ajax_i-order-terms', array($this, 'ajax_order_terms'));
         } else {
             // no ajax
             add_action('admin_init', array($this, 'admin_init'));
             add_action('admin_notices', array($this, 'admin_notices'));
             add_action('admin_menu', array($this, 'admin_menu'));
             add_action('admin_enqueue_scripts', array($this, 'admin_assets'));
             add_filter('plugin_action_links_' . self::PLUGIN_BASENAME, array($this, 'action_links'));
             // update option name because of WP sanitation bug
             $option = get_option('iorderterms.general', null);
             if (isset($option)) {
                 add_option('iorderterms_general', $option, '', 'yes');
                 delete_option('iorderterms.general');
             }
         }
     }
 }
开发者ID:SirDingus,项目名称:andyducett,代码行数:36,代码来源:class-i-order-terms.php

示例15: roots_theme_options_init

function roots_theme_options_init()
{
    if (false === roots_get_theme_options()) {
        add_option('roots_theme_options', roots_get_default_theme_options());
    }
    register_setting('roots_options', 'roots_theme_options', 'roots_theme_options_validate');
}
开发者ID:nuresponse,项目名称:roots,代码行数:7,代码来源:roots-options.php


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