本文整理汇总了PHP中delete_site_option函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_site_option函数的具体用法?PHP delete_site_option怎么用?PHP delete_site_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_site_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: network_admin_save
public function network_admin_save()
{
check_admin_referer($this->parent->_token . '_settings-options');
// This is the list of registered options.
global $new_whitelist_options;
$options = $new_whitelist_options[$this->parent->_token . '_settings'];
// Go through the posted data and save only our options. This is a generic
// way to do this, but you may want to address the saving of each option
// individually.
foreach ($options as $option) {
if (isset($_POST[$option])) {
// If we registered a callback function to sanitizes the option's
// value it is where we call it (see register_setting).
$option_value = apply_filters('sanitize_option_' . $option_name, $_POST[$option]);
// And finally we save our option with the site's options.
update_site_option($option, $option_value);
} else {
// If the option is not here then delete it. It depends on how you
// want to manage your defaults however.
delete_site_option($option);
}
}
$red = array('page' => $this->parent->_token . '_settings', 'settings-updated' => 'true');
if (isset($_POST['tab']) && $_POST['tab']) {
$red['tab'] = $_POST['tab'];
}
// At last we redirect back to our options page.
wp_redirect(add_query_arg($red, network_admin_url('settings.php')));
exit;
}
示例2: activate
/**
* What to do when the plugin is activated
*
* @since 2.0.0
* @param boolean $network_wide
*/
public static function activate($network_wide)
{
if (function_exists('is_multisite') && is_multisite()) {
if ($network_wide) {
// Get all blog ids
$blog_ids = self::get_blog_ids();
foreach ($blog_ids as $blog_id) {
switch_to_blog($blog_id);
self::single_activate($network_wide);
restore_current_blog();
}
// delete old options
delete_site_option('wp-maintenance-mode');
delete_site_option('wp-maintenance-mode-msqld');
} else {
self::single_activate();
// delete old options
delete_option('wp-maintenance-mode');
delete_option('wp-maintenance-mode-msqld');
}
} else {
self::single_activate();
// delete old options
delete_option('wp-maintenance-mode');
delete_option('wp-maintenance-mode-msqld');
}
}
示例3: execute_uninstall
/**
* Execute module uninstall
*
* @return void
*/
public function execute_uninstall()
{
$this->execute_deactivate();
delete_site_option('itsec_ssl');
delete_metadata('post', null, 'itsec_enable_ssl', null, true);
delete_metadata('post', null, 'bwps_enable_ssl', null, true);
}
示例4: onp_updates_324_set_site_transient
function onp_updates_324_set_site_transient($transient, $value, $expiration = 0, $actions = false)
{
global $_wp_using_ext_object_cache;
if ($actions) {
$value = apply_filters('pre_set_site_transient_' . $transient, $value);
}
if ($_wp_using_ext_object_cache) {
$result = wp_cache_set($transient, $value, 'site-transient', $expiration);
} else {
$transient_timeout = '_site_transient_timeout_' . $transient;
$transient = '_site_transient_' . $transient;
if (false === get_site_option($transient)) {
if ($expiration) {
add_site_option($transient_timeout, time() + $expiration);
}
$result = add_site_option($transient, $value);
} else {
if ($expiration) {
update_site_option($transient_timeout, time() + $expiration);
}
delete_site_option($transient);
$result = update_site_option($transient, $value);
}
}
if ($result && $actions) {
do_action('set_site_transient_' . $transient);
do_action('setted_site_transient', $transient);
}
return $result;
}
示例5: ub_admin_menu_uninstall
function ub_admin_menu_uninstall() {
if (is_multisite() && is_plugin_active_for_network(plugin_basename(__FILE__))) {
delete_site_option('ub_admin_menu');
} else {
delete_option('ub_admin_menu');
}
}
示例6: __construct
function __construct()
{
if (is_admin() && get_site_option('itsec_free_just_activated') && (!isset($_SERVER['HTTP_REFERER']) || strpos(sanitize_text_field($_SERVER['HTTP_REFERER']), 'action=upload-plugin') === false && strpos(sanitize_text_field($_SERVER['HTTP_REFERER']), 'action=install-plugin') === false)) {
add_action('admin_init', array($this, 'deactivate_extra'));
delete_site_option('itsec_free_just_activated');
}
}
示例7: kigo_plugin_deactivation
function kigo_plugin_deactivation()
{
if (!Kigo_Single_Sign_On::drop_table()) {
wp_die('Error deactivating Kigo Sites plugin');
}
delete_site_option('wp_plugin_kigo_sites_current_version');
}
示例8: uninstall
static function uninstall()
{
global $wpdb;
if (is_multisite()) {
// Cleanup Network install
foreach (wp_get_sites(array('limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) {
switch_to_blog($blog['blog_id']);
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_ga_dash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_ga_dash%%'");
delete_option('gadash_options');
delete_transient('ga_dash_lasterror');
delete_transient('ga_dash_refresh_token');
delete_transient('ga_dash_gapi_errors');
restore_current_blog();
}
delete_site_option('gadash_network_options');
delete_site_transient('ga_dash_refresh_token');
} else {
// Cleanup Single install
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_ga_dash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_ga_dash%%'");
delete_option('gadash_options');
delete_transient('ga_dash_lasterror');
delete_transient('ga_dash_refresh_token');
delete_transient('ga_dash_gapi_errors');
}
}
示例9: update_mu_htaccess
function update_mu_htaccess($include_rs_rules = true)
{
//rs_errlog( "update_mu_htaccess: arg = $include_rs_rules" );
if (defined('SCOPER_NO_HTACCESS')) {
return;
}
$include_rs_rules = $include_rs_rules && get_site_option('scoper_file_filtering');
// scoper_get_option is not reliable for initial execution following plugin activation
if (!$include_rs_rules) {
delete_site_option('scoper_file_filtered_sites');
}
//rs_errlog( "update_mu_htaccess: $include_rs_rules" );
if (file_exists(ABSPATH . '/wp-admin/includes/file.php')) {
include_once ABSPATH . '/wp-admin/includes/file.php';
}
$home_path = get_home_path();
$htaccess_path = $home_path . '.htaccess';
if (!file_exists($htaccess_path)) {
return;
}
$contents = file_get_contents($htaccess_path);
if ($pos_def = ScoperRewriteMU::default_file_rule_pos($contents)) {
$fp = fopen($htaccess_path, 'w');
if ($pos_rs_start = strpos($contents, "\n# BEGIN Role Scoper")) {
fwrite($fp, substr($contents, 0, $pos_rs_start));
} else {
fwrite($fp, substr($contents, 0, $pos_def));
}
if ($include_rs_rules) {
fwrite($fp, ScoperRewrite::build_site_rules(false));
}
fwrite($fp, substr($contents, $pos_def));
fclose($fp);
}
}
示例10: network_uninstall
public static function network_uninstall()
{
$sitewide = true;
$lca = WpssoConfig::get_config('lca');
delete_site_option($lca . '_site_options');
self::do_multisite($sitewide, array(__CLASS__, 'uninstall_plugin'));
}
示例11: vaa_uninstall
function vaa_uninstall($blog_id = false)
{
// Delete all View Admin As options
$option_keys = array('vaa_view_admin_as', 'vaa_role_defaults');
if ($blog_id) {
if ($blog_id == 'site') {
foreach ($option_keys as $option_key) {
delete_site_option($option_key);
}
} else {
foreach ($option_keys as $option_key) {
delete_blog_option($blog_id, $option_key);
}
}
} else {
foreach ($option_keys as $option_key) {
delete_option($option_key);
}
// Delete all View Admin As user metadata
$user_meta_keys = array('vaa-view-admin-as');
// Older (not used anymore) keys
$user_meta_keys[] = 'view-admin-as';
global $wpdb;
$all_users = $wpdb->get_results("SELECT ID FROM {$wpdb->users}");
foreach ($all_users as $user) {
foreach ($user_meta_keys as $user_meta_key) {
delete_user_meta($user->ID, $user_meta_key);
}
}
}
}
示例12: remote_request
public static function remote_request($args)
{
$name = x_addons_get_api_key_option_name();
$api_key = esc_attr(get_option($name));
if ($api_key == '') {
$api_key = 'unverified';
}
$args = wp_parse_args($args, array('action' => 'autoupdates', 'api-key' => $api_key, 'siteurl' => preg_replace('#(https?:)?//#', '', esc_attr(untrailingslashit(network_home_url()))), 'xversion' => X_VERSION));
$request_url = self::$base_url . trailingslashit($args['action']) . trailingslashit($args['api-key']);
unset($args['action']);
unset($args['api-key']);
$uri = add_query_arg($args, $request_url);
$request = wp_remote_get($uri, array('timeout' => 15));
$connection_error = array('code' => 4, 'message' => __('Could not establish connection. For assistance, please start by reviewing our article on troubleshooting <a href="https://community.theme.co/kb/connection-issues/">connection issues.</a>', '__x__'));
if (is_wp_error($request) || $request['response']['code'] != 200) {
self::store_error($request);
return $connection_error;
}
$data = json_decode($request['body'], true);
if (!isset($data['code'])) {
return $connection_error;
}
//
// Key was good but is now invalid (revoked).
//
if ($api_key != '' && $data['code'] == 3) {
delete_option($name);
delete_site_option('x_addon_list_cache');
}
return $data;
}
示例13: multisite_uninstall
private static function multisite_uninstall()
{
delete_site_option(CLEF_OPTIONS_NAME);
require_once CLEF_PATH . 'includes/class.clef-internal-settings.php';
delete_site_option(ClefInternalSettings::MS_OVERRIDE_OPTION);
delete_site_option(ClefInternalSettings::MS_ENABLED_OPTION);
}
示例14: googlefontmgr_check_api_key
function googlefontmgr_check_api_key($google_api_key)
{
global $is_networkactive;
$message = "";
$api_url = "https://www.googleapis.com/webfonts/v1/webfonts?key=";
$api_data = wp_remote_get($api_url . $google_api_key);
//return codes if valid or not
if (200 === $api_data['response']['code']) {
if ($is_networkactive) {
update_site_option('wp_googlefontmgr_globalkey', $google_api_key);
} else {
update_option('wp_googlefontmgr_apikey', $google_api_key);
}
echo "<div class='updated message'><p><strong>Success!</strong> Valid Google API Key...</p></div>";
return true;
} else {
$body = json_decode($api_data['body'], true);
$response = $api_data['response'];
$headers = $api_data['headers'];
foreach ($body['error']['errors'] as $error) {
if ("keyInvalid" == $error['reason']) {
$message = "<div class='error message'><p><strong>ERROR:</strong> Invalid Google API Key</p></div>";
}
}
if ($message) {
delete_site_option('wp_googlefontmgr_apikey');
delete_option('wp_googlefontmgr_apikey');
echo $message;
return false;
}
}
}
示例15: rt_wp_nginx_helper_uninstall
function rt_wp_nginx_helper_uninstall()
{
wp_clear_scheduled_hook('rt_wp_nginx_helper_check_log_file_size_daily');
delete_site_option('rt_wp_nginx_helper_options');
rt_wp_nginx_helper_remove_capability('Nginx Helper | Config');
rt_wp_nginx_helper_remove_capability('Nginx Helper | Purge cache');
}