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


PHP et_update_option函数代码示例

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


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

示例1: et_assign_category_color_upon_activation

/**
 * Automatically assign category color when the theme is activated
 * @return void
 */
function et_assign_category_color_upon_activation()
{
    if (et_get_option('has_auto_assign_category_color')) {
        return;
    }
    // Get category
    $categories = get_categories(array('hide_empty' => 0));
    // Available colors
    $colors = et_default_category_colors();
    // Loop categories data
    $color_index = 0;
    foreach ($categories as $category) {
        $category_id = $category->term_id;
        // Check for saved color
        $category_color = et_get_taxonomy_meta($category_id, 'color', true);
        // Skip if the category already has color
        if (!empty($category_color)) {
            continue;
        }
        $color = $colors[$color_index];
        // Set category color
        et_update_taxonomy_meta($category_id, 'color', $color);
        // Setup $color_index for next loop iteration
        $color_index++;
        if ($color_index >= count($colors)) {
            $color_index = 0;
        }
    }
    et_update_option('has_auto_assign_category_color', true);
}
开发者ID:rthburke,项目名称:fltHub,代码行数:34,代码来源:category.php

示例2: extra_update_woocommerce_images

function extra_update_woocommerce_images()
{
    if (et_get_option('extra_update_woocommerce_images')) {
        return;
    }
    $catalog = extra_woocommerce_get_image_size_shop_catalog();
    $single = extra_woocommerce_get_image_size_shop_single();
    $thumbnail = extra_woocommerce_get_image_size_shop_thumbnail();
    update_option('shop_catalog_image_size', $catalog);
    update_option('shop_single_image_size', $single);
    update_option('shop_thumbnail_image_size', $thumbnail);
    et_update_option('extra_update_woocommerce_images', true);
}
开发者ID:rthburke,项目名称:fltHub,代码行数:13,代码来源:admin.php

示例3: et_assign_social_network_url_upon_activation

/**
 * Automatically assign social network values in popular social network so
 * top header displays social media icon by default
 * @return void
 */
function et_assign_social_network_url_upon_activation()
{
    $popular_social_networks = apply_filters('social_network_url_upon_activation', array('facebook' => 'https://facebook.com', 'twitter' => 'https://twitter.com', 'instagram' => 'https://instagram.com'));
    if (!empty($popular_social_networks)) {
        foreach ($popular_social_networks as $id => $url) {
            $key = sprintf('%s_url', $id);
            $saved_url = et_get_option($key, false);
            // Do not overwrite existing value
            if (!empty($saved_url)) {
                continue;
            }
            et_update_option($key, esc_url($url));
        }
    }
}
开发者ID:rthburke,项目名称:fltHub,代码行数:20,代码来源:activation.php

示例4: et_aweber_submit_authorization_code

function et_aweber_submit_authorization_code()
{
    if (!wp_verify_nonce($_POST['et_load_nonce'], 'et_load_nonce')) {
        die(__('Nonce failed.', 'Divi'));
    }
    $et_authorization_code = $_POST['et_authorization_code'];
    if ('' === $et_authorization_code) {
        die(__('Authorization code is empty.', 'Divi'));
    }
    if (!class_exists('AWeberAPI')) {
        require_once get_template_directory() . '/includes/subscription/aweber/aweber_api.php';
    }
    try {
        $auth = AWeberAPI::getDataFromAweberID($et_authorization_code);
        if (!(is_array($auth) && 4 === count($auth))) {
            die(__('Authorization code is invalid. Try regenerating it and paste in the new code.', 'Divi'));
        }
        list($consumer_key, $consumer_secret, $access_key, $access_secret) = $auth;
        et_update_option('divi_aweber_consumer_key', $consumer_key);
        et_update_option('divi_aweber_consumer_secret', $consumer_secret);
        et_update_option('divi_aweber_access_key', $access_key);
        et_update_option('divi_aweber_access_secret', $access_secret);
        die('success');
    } catch (AWeberAPIException $exc) {
        printf('<p>AWeberAPIException.</p>
			<ul>
				<li>Type: %1$s</li>
				<li>Message: %2$s</li>
				<li>Documentation: %3$s</li>
			</ul>', esc_html($exc->type), esc_html($exc->message), esc_html($exc->documentation_url));
    }
    die;
}
开发者ID:ahmedghazi,项目名称:tpls,代码行数:33,代码来源:functions.php

示例5: epanel_save_data


//.........这里部分代码省略.........
                                     $et_option_new_value = stripslashes(wp_filter_nohtml_kses($_POST[$value['id']]));
                                 }
                             } else {
                                 // use html allowed for posts if the validation type isn't provided
                                 $et_option_new_value = wp_kses_post(stripslashes($_POST[$value['id']]));
                             }
                         } elseif ('select' == $value['type']) {
                             // select boxes that list pages / categories should save page/category ID ( as integer )
                             if (isset($value['et_array_for']) && in_array($value['et_array_for'], array('pages', 'categories'))) {
                                 $et_option_new_value = intval(stripslashes($_POST[$value['id']]));
                             } else {
                                 // html is not allowed in select boxes
                                 $et_option_new_value = sanitize_text_field(stripslashes($_POST[$value['id']]));
                             }
                         } elseif (in_array($value['type'], array('checkbox', 'checkbox2'))) {
                             // saves 'on' value to the database, if the option is enabled
                             $et_option_new_value = 'on';
                         } elseif ('upload' == $value['type']) {
                             // makes sure the option is a url
                             $et_option_new_value = esc_url_raw(stripslashes($_POST[$value['id']]));
                         } elseif (in_array($value['type'], array('textcolorpopup', 'et_color_palette'))) {
                             // the color value
                             $et_option_new_value = sanitize_text_field(stripslashes($_POST[$value['id']]));
                         } elseif ('textarea' == $value['type']) {
                             if (isset($value['validation_type'])) {
                                 // html is not allowed
                                 if ('nohtml' == $value['validation_type']) {
                                     if ($value['id'] === $shortname . '_custom_css') {
                                         // don't strip slashes from custom css, it should be possible to use \ for icon fonts
                                         $et_option_new_value = wp_strip_all_tags($_POST[$value['id']]);
                                     } else {
                                         $et_option_new_value = wp_strip_all_tags(stripslashes($_POST[$value['id']]));
                                     }
                                 }
                             } else {
                                 if (current_user_can('unfiltered_html')) {
                                     $et_option_new_value = stripslashes($_POST[$value['id']]);
                                 } else {
                                     $et_option_new_value = stripslashes(wp_filter_post_kses(addslashes($_POST[$value['id']])));
                                     // wp_filter_post_kses() expects slashed value
                                 }
                             }
                         } elseif ('checkboxes' == $value['type']) {
                             if ('sanitize_text_field' == $value['value_sanitize_function']) {
                                 // strings
                                 $et_option_new_value = array_map('sanitize_text_field', stripslashes_deep($_POST[$value['id']]));
                             } else {
                                 // saves categories / pages IDs
                                 $et_option_new_value = array_map('intval', stripslashes_deep($_POST[$value['id']]));
                             }
                         } elseif ('different_checkboxes' == $value['type']) {
                             // saves 'author/date/categories/comments' options
                             $et_option_new_value = array_map('intval', array_map('wp_strip_all_tags', stripslashes_deep($_POST[$value['id']])));
                         }
                     } else {
                         if (in_array($value['type'], array('checkbox', 'checkbox2'))) {
                             $et_option_new_value = 'false';
                         } else {
                             if ('different_checkboxes' == $value['type']) {
                                 $et_option_new_value = array();
                             } else {
                                 et_delete_option($value['id']);
                             }
                         }
                     }
                     if (false !== $et_option_name && false !== $et_option_new_value) {
                         $is_new_global_setting = false;
                         $global_setting_main_name = $global_setting_sub_name = '';
                         if (isset($value['is_global']) && $value['is_global']) {
                             $is_new_global_setting = true;
                             $global_setting_main_name = isset($value['main_setting_name']) ? sanitize_text_field($value['main_setting_name']) : '';
                             $global_setting_sub_name = isset($value['sub_setting_name']) ? sanitize_text_field($value['sub_setting_name']) : '';
                         }
                         et_update_option($et_option_name, $et_option_new_value, $is_new_global_setting, $global_setting_main_name, $global_setting_sub_name);
                     }
                 }
             }
             $redirect_url = add_query_arg('saved', 'true', $redirect_url);
             if ('js_disabled' == $source) {
                 header("Location: " . $redirect_url);
             }
             die('1');
         } else {
             if ('reset' == $_POST['action']) {
                 check_admin_referer('et-nojs-reset_epanel', '_wpnonce_reset');
                 foreach ($options as $value) {
                     if (isset($value['id'])) {
                         et_delete_option($value['id']);
                         if (isset($value['std'])) {
                             et_update_option($value['id'], $value['std']);
                         }
                     }
                 }
                 $redirect_url = add_query_arg('reset', 'true', $redirect_url);
                 header("Location: " . $redirect_url);
                 die('1');
             }
         }
     }
 }
开发者ID:michaeldyrynda,项目名称:SaxonHyde,代码行数:101,代码来源:core_functions.php

示例6: et_divi_check_woocommerce_images

/**
 * Default values for WooCommerce images changed in version 1.3
 * Checks if WooCommerce image dimensions have been updated already.
 */
function et_divi_check_woocommerce_images()
{
    if ('checked' === et_get_option('divi_1_3_images')) {
        return;
    }
    et_divi_woocommerce_image_dimensions();
    et_update_option('divi_1_3_images', 'checked');
}
开发者ID:welearncodes,项目名称:traktern,代码行数:12,代码来源:functions.php

示例7: et_pb_maybe_flush_rewrite_rules

/**
 * Flush rewrite rules to fix the issue "preg_match" issue with 2.5
 * @return void
 */
function et_pb_maybe_flush_rewrite_rules()
{
    $setting_name = '2_5_flush_rewrite_rules';
    if (et_get_option($setting_name)) {
        return;
    }
    flush_rewrite_rules();
    et_update_option($setting_name, 'done');
}
开发者ID:iinspiration,项目名称:theme,代码行数:13,代码来源:functions.php

示例8: epanel_save_data

 function epanel_save_data($source)
 {
     global $options, $shortname;
     if (!current_user_can('switch_themes')) {
         die('-1');
     }
     // load theme settings array
     et_load_core_options();
     $epanel = basename(__FILE__);
     if (isset($_POST['action'])) {
         do_action('et_epanel_changing_options');
         if ('save_epanel' == $_POST['action']) {
             if ('ajax' != $source) {
                 check_admin_referer('epanel_nonce');
             }
             foreach ($options as $value) {
                 if (isset($value['id'])) {
                     if (isset($_POST[$value['id']])) {
                         if (in_array($value['type'], array('text', 'textlimit'))) {
                             if (isset($value['validation_type'])) {
                                 // saves the value as integer
                                 if ('number' == $value['validation_type']) {
                                     et_update_option($value['id'], intval(stripslashes($_POST[$value['id']])));
                                 }
                                 // makes sure the option is a url
                                 if ('url' == $value['validation_type']) {
                                     et_update_option($value['id'], esc_url_raw(stripslashes($_POST[$value['id']])));
                                 }
                                 /*
                                  * html is not allowed
                                  * wp_strip_all_tags can't be used here, because it returns trimmed text, some options need spaces ( e.g 'character to separate BlogName and Post title' option )
                                  */
                                 if ('nohtml' == $value['validation_type']) {
                                     et_update_option($value['id'], stripslashes(wp_filter_nohtml_kses($_POST[$value['id']])));
                                 }
                             } else {
                                 // use html allowed for posts if the validation type isn't provided
                                 et_update_option($value['id'], wp_kses_post(stripslashes($_POST[$value['id']])));
                             }
                         } elseif ('select' == $value['type']) {
                             // select boxes that list pages / categories should save page/category ID ( as integer )
                             if (isset($value['et_array_for']) && in_array($value['et_array_for'], array('pages', 'categories'))) {
                                 et_update_option($value['id'], intval(stripslashes($_POST[$value['id']])));
                             } else {
                                 // html is not allowed in select boxes
                                 et_update_option($value['id'], sanitize_text_field(stripslashes($_POST[$value['id']])));
                             }
                         } elseif (in_array($value['type'], array('checkbox', 'checkbox2'))) {
                             // saves 'on' value to the database, if the option is enabled
                             et_update_option($value['id'], 'on');
                         } elseif ('upload' == $value['type']) {
                             // makes sure the option is a url
                             et_update_option($value['id'], esc_url_raw(stripslashes($_POST[$value['id']])));
                         } elseif ('textcolorpopup' == $value['type']) {
                             // the color value
                             et_update_option($value['id'], sanitize_text_field(stripslashes($_POST[$value['id']])));
                         } elseif ('textarea' == $value['type']) {
                             if (isset($value['validation_type'])) {
                                 // html is not allowed
                                 if ('nohtml' == $value['validation_type']) {
                                     if ($value['id'] === $shortname . '_custom_css') {
                                         // don't strip slashes from custom css, it should be possible to use \ for icon fonts
                                         et_update_option($value['id'], wp_strip_all_tags($_POST[$value['id']]));
                                     } else {
                                         et_update_option($value['id'], wp_strip_all_tags(stripslashes($_POST[$value['id']])));
                                     }
                                 }
                             } else {
                                 if (current_user_can('unfiltered_html')) {
                                     et_update_option($value['id'], stripslashes($_POST[$value['id']]));
                                 } else {
                                     et_update_option($value['id'], stripslashes(wp_filter_post_kses(addslashes($_POST[$value['id']]))));
                                 }
                                 // wp_filter_post_kses() expects slashed
                             }
                         } elseif ('checkboxes' == $value['type']) {
                             // saves categories / pages IDs,
                             et_update_option($value['id'], array_map('intval', stripslashes_deep($_POST[$value['id']])));
                         } elseif ('different_checkboxes' == $value['type']) {
                             // saves 'author/date/categories/comments' options
                             et_update_option($value['id'], array_map('wp_strip_all_tags', stripslashes_deep($_POST[$value['id']])));
                         }
                     } else {
                         if (in_array($value['type'], array('checkbox', 'checkbox2'))) {
                             et_update_option($value['id'], 'false');
                         } elseif ('different_checkboxes' == $value['type']) {
                             et_update_option($value['id'], array());
                         } else {
                             et_delete_option($value['id']);
                         }
                     }
                 }
             }
             if ('js_disabled' == $source) {
                 header("Location: themes.php?page={$epanel}&saved=true");
             }
             die('1');
         } else {
             if ('reset' == $_POST['action']) {
                 check_admin_referer('et-nojs-reset_epanel', '_wpnonce_reset');
//.........这里部分代码省略.........
开发者ID:iinspiration,项目名称:theme,代码行数:101,代码来源:core_functions.php

示例9: epanel_save_data

 function epanel_save_data($source)
 {
     global $options;
     if (!current_user_can('switch_themes')) {
         die('-1');
     }
     $epanel = basename(__FILE__);
     if (isset($_POST['action'])) {
         do_action('et_epanel_changing_options');
         if ('save_epanel' == $_POST['action']) {
             if ('ajax' != $source) {
                 check_admin_referer('epanel_nonce');
             }
             foreach ($options as $value) {
                 if (isset($value['id'])) {
                     if (isset($_POST[$value['id']])) {
                         if (in_array($value['type'], array('text', 'textlimit', 'select', 'textcolorpopup', 'checkbox', 'checkbox2'))) {
                             et_update_option($value['id'], stripslashes(wp_kses_post($_POST[$value['id']])));
                         } elseif ('upload' == $value['type']) {
                             et_update_option($value['id'], stripslashes(esc_url_raw($_POST[$value['id']])));
                         } elseif ('textarea' == $value['type']) {
                             et_update_option($value['id'], stripslashes($_POST[$value['id']]));
                         } elseif (in_array($value['type'], array('checkboxes', 'different_checkboxes'))) {
                             et_update_option($value['id'], stripslashes_deep(array_map('wp_kses_post', $_POST[$value['id']])));
                         }
                     } else {
                         if (in_array($value['type'], array('checkbox', 'checkbox2'))) {
                             et_update_option($value['id'], 'false');
                         } elseif ('different_checkboxes' == $value['type']) {
                             et_update_option($value['id'], array());
                         } else {
                             et_delete_option($value['id']);
                         }
                     }
                 }
             }
             if ('js_disabled' == $source) {
                 header("Location: themes.php?page={$epanel}&saved=true");
             }
             die('1');
         } else {
             if ('reset' == $_POST['action']) {
                 check_admin_referer('et-nojs-reset_epanel', '_wpnonce_reset');
                 foreach ($options as $value) {
                     if (isset($value['id'])) {
                         et_delete_option($value['id']);
                         if (isset($value['std'])) {
                             et_update_option($value['id'], $value['std']);
                         }
                     }
                 }
                 header("Location: themes.php?page={$epanel}&reset=true");
                 die('1');
             }
         }
     }
 }
开发者ID:dfc643,项目名称:ARCHIVE-2014-wordpress-theme-backup,代码行数:57,代码来源:core_functions.php

示例10: et_pb_force_regenerate_templates

function et_pb_force_regenerate_templates()
{
    // add option to indicate that templates cache should be updated in case of term added/removed/updated
    et_update_option('et_pb_clear_templates_cache', 'on');
}
开发者ID:pacificano,项目名称:pacificano,代码行数:5,代码来源:core.php

示例11: update

 public function update($new_instance, $old_instance)
 {
     $instance = array();
     $instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
     $social_follow_api = et_get_option('social_follow_api', array());
     $api_data_changed = false;
     $networks = ET_Social_Followers::get_networks();
     foreach ($networks as $network) {
         $instance[$network->slug . '-enabled'] = isset($new_instance[$network->slug . '-enabled']) ? true : false;
         $instance[$network->slug . '-url'] = sanitize_text_field($new_instance[$network->slug . '-url']);
         foreach ($network->get_fields() as $field_name => $field) {
             $original_field_name = $field_name;
             $field_name = $network->slug . '-' . $field_name;
             $instance[$field_name] = sanitize_text_field($new_instance[$field_name]);
             // update follow api default fields if needed
             if (isset($field['authorization_field']) && $field['authorization_field']) {
                 $social_follow_api[$network->slug . '_' . $original_field_name] = sanitize_text_field($new_instance[$field_name]);
                 $api_data_changed = true;
             }
         }
     }
     // update social_follow_api option if it was changed
     if ($api_data_changed) {
         et_update_option('social_follow_api', $social_follow_api);
     }
     return $instance;
 }
开发者ID:rthburke,项目名称:fltHub,代码行数:27,代码来源:widgets.php

示例12: get_access_token

 function get_access_token($code = '')
 {
     $access_token_url = 'https://api.instagram.com/oauth/access_token';
     $redirect_url = admin_url('widgets.php');
     $social_follow_api = et_get_option('social_follow_api', array());
     // Exchange an authotization code for an access token
     $request = wp_remote_post($access_token_url, array('method' => 'POST', 'timeout' => 30, 'body' => array('client_id' => sanitize_text_field(isset($social_follow_api['instagram_id']) ? $social_follow_api['instagram_id'] : ''), 'client_secret' => sanitize_text_field(isset($social_follow_api['instagram_secret']) ? $social_follow_api['instagram_secret'] : ''), 'grant_type' => 'authorization_code', 'code' => sanitize_text_field($code), 'redirect_uri' => esc_url($redirect_url))));
     if (!is_wp_error($request) && wp_remote_retrieve_response_code($request) == 200) {
         $response = json_decode(wp_remote_retrieve_body($request));
         // If we received a valid access token, update the access_token option
         if (isset($response->access_token)) {
             $social_follow_api['instagram_access_token'] = sanitize_text_field($response->access_token);
             et_update_option('social_follow_api', $social_follow_api);
         }
     }
 }
开发者ID:rthburke,项目名称:fltHub,代码行数:16,代码来源:et-social-followers.php

示例13: et_builder_maybe_flush_rewrite_rules

 function et_builder_maybe_flush_rewrite_rules($setting_name)
 {
     if (et_get_option($setting_name)) {
         return;
     }
     flush_rewrite_rules();
     et_update_option($setting_name, 'done');
 }
开发者ID:pacificano,项目名称:pacificano,代码行数:8,代码来源:functions.php

示例14: et_theme_epanel_reminder

function et_theme_epanel_reminder()
{
    global $shortname;
    $documentation_url = 'http://www.elegantthemes.com/gallery/extra/documentation/';
    $documentation_option_name = $shortname . '_documentation_message';
    if (false === et_get_option($shortname . '_logo') && false === et_get_option($documentation_option_name)) {
        $message = sprintf(__('Welcome to Extra! Before diving in to your new theme, please visit the <a style="color: #fff; font-weight: bold;" href="%1$s" target="_blank">Extra Documentation</a> page for access to dozens of in-depth tutorials.', 'extra'), esc_url($documentation_url));
        printf('<div class="notice is-dismissible" style="background-color: #46EA9E; color: #fff; border-left: none;">
				<p>%1$s</p>
			</div>', $message);
        et_update_option($documentation_option_name, 'triggered');
    }
}
开发者ID:rthburke,项目名称:fltHub,代码行数:13,代码来源:core.php


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