本文整理汇总了PHP中delete_option函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_option函数的具体用法?PHP delete_option怎么用?PHP delete_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mytheme_add_admin
function mytheme_add_admin()
{
global $themename, $options;
if ($_GET['page'] == basename(__FILE__)) {
if ('save' == $_REQUEST['action']) {
foreach ($options as $value) {
update_option($value['id'], $_REQUEST[$value['id']]);
}
/*
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
else { delete_option( $value['id'] ); }
}
*/
header("Location: admin.php?page=themeset.php&saved=true");
die;
} else {
if ('reset' == $_REQUEST['action']) {
foreach ($options as $value) {
delete_option($value['id']);
}
header("Location: admin.php?page=themeset.php&reset=true");
die;
}
}
}
add_theme_page($themename . " Options", $themename . "设置", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
示例2: mytheme_add_admin
function mytheme_add_admin()
{
global $themename, $shortname, $options;
if ($_GET['page'] == basename(__FILE__)) {
if ('save' == $_REQUEST['action']) {
foreach ($options as $value) {
if ($value['type'] != 'header') {
update_option($value['id'], $_REQUEST[$value['id']]);
}
}
foreach ($options as $value) {
if (isset($_REQUEST[$value['id']])) {
update_option($value['id'], $_REQUEST[$value['id']]);
} else {
delete_option($value['id']);
}
}
header("Location: themes.php?page=settings.php&saved=true");
die;
} else {
if ('reset' == $_REQUEST['action']) {
foreach ($options as $value) {
delete_option($value['id']);
}
header("Location: themes.php?page=settings.php&reset=true");
die;
}
}
}
add_theme_page($themename . " Settings", "Theme Settings", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
示例3: run_update
static function run_update()
{
$updates_run = get_option('wpml-package-translation-db-updates-run', array());
if (defined('WPML_PT_VERSION_DEV')) {
delete_option('wpml-package-translation-string-packages-table-updated');
if (($key = array_search(WPML_PT_VERSION_DEV, $updates_run)) !== false) {
unset($updates_run[$key]);
}
}
if (!in_array('0.0.2', $updates_run)) {
// We need to make sure we build everything for 0.0.2 because users may
// only be updating the string translation plugin and may not do an
// activation.
self::build_icl_string_packages_table();
self::build_icl_string_packages_columns_if_required();
self::fix_icl_string_packages_ID_column();
self::build_icl_strings_columns_if_required();
$updates_run[] = '0.0.2';
update_option('wpml-package-translation-db-updates-run', $updates_run);
}
if (!in_array('fix_string_names_with_package_id', $updates_run)) {
//TODO: [WPML 3.3] delete this in 3.3.
// It's only needed for very early users of Layouts
self::fix_string_names_with_package_id();
$updates_run[] = 'fix_string_names_with_package_id';
update_option('wpml-package-translation-db-updates-run', $updates_run);
}
}
示例4: bfa_ata_add_admin
function bfa_ata_add_admin()
{
global $options, $bfa_ata;
if (isset($_GET['page'])) {
if ($_GET['page'] == "atahualpa-options") {
if (isset($_REQUEST['action'])) {
if ('save' == $_REQUEST['action']) {
foreach ($options as $value) {
if ($value['category'] == $_REQUEST['category']) {
if (isset($value['escape'])) {
if (isset($_REQUEST[$value['id']])) {
// Since 3.6.8 removed bfa_escape
//$bfa_ata[ $value['id'] ] = stripslashes(bfa_escape($_REQUEST[ $value['id'] ] ));
$bfa_ata[$value['id']] = stripslashes($_REQUEST[$value['id']]);
} else {
unset($bfa_ata[$value['id']]);
}
} elseif (isset($value['stripslashes'])) {
if ($value['stripslashes'] == "no") {
if (isset($_REQUEST[$value['id']])) {
$bfa_ata[$value['id']] = $_REQUEST[$value['id']];
} else {
unset($bfa_ata[$value['id']]);
}
}
} else {
if (isset($_REQUEST[$value['id']])) {
$bfa_ata[$value['id']] = stripslashes($_REQUEST[$value['id']]);
} else {
unset($bfa_ata[$value['id']]);
}
}
}
}
update_option('bfa_ata4', $bfa_ata);
header("Location: themes.php?page=atahualpa-options&saved=true");
die;
} else {
if ('reset' == $_REQUEST['action']) {
if ("reset-all" == $_REQUEST['category']) {
delete_option('bfa_ata4');
} else {
foreach ($options as $value) {
if ($value['category'] == $_REQUEST['category']) {
$bfa_ata[$value['id']] = $value['std'];
}
}
update_option('bfa_ata4', $bfa_ata);
}
header("Location: themes.php?page=atahualpa-options&reset=true");
die;
}
}
}
}
}
$atapage = add_theme_page("Atahualpa Options", "Atahualpa Theme Options", 'edit_theme_options', 'atahualpa-options', 'bfa_ata_admin');
// Since 3.6.8:
add_action("admin_print_styles-{$atapage}", 'bfa_ata_admin_enqueue');
}
示例5: __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');
}
}
}
}
示例6: wpga_uninstallPlugin
/**
* Remove plugin data from database
*/
function wpga_uninstallPlugin()
{
/* Plugin main options */
delete_option(WPGA_PREFIX . '_options');
delete_option(WPGA_PREFIX . '_used_totp');
$args = array('meta_query' => array('relation' => 'OR', array('key' => 'wpga_attempts', 'value' => '', 'compare' => '!='), array('key' => 'wpga_secret', 'value' => '', 'compare' => '!=')));
$users = new WP_User_Query($args);
/* Delete all user metas */
if (!empty($users->results)) {
foreach ($users->results as $key => $user) {
delete_user_meta($user->ID, 'wpga_active');
delete_user_meta($user->ID, 'wpga_attempts');
delete_user_meta($user->ID, 'wpga_secret');
delete_user_meta($user->ID, 'wpga_backup_key');
delete_user_meta($user->ID, 'wpga_backup_key_time');
delete_user_meta($user->ID, 'wpga_apps_passwords');
delete_user_meta($user->ID, 'wpga_apps_passwords_log');
}
}
/**
* Remove cron task
*/
$timestamp = wp_next_scheduled('wpas_clean_totps');
wp_unschedule_event($timestamp, 'wpas_clean_totps');
}
示例7: form_add_admin
function form_add_admin()
{
global $form_name, $form_shortname, $form;
$form_options = form_options();
if (isset($_GET['page']) && $_GET['page'] == "form") {
if (isset($_REQUEST['action']) && 'install' == $_REQUEST['action']) {
delete_option('form_log');
foreach ($form_options as $value) {
if (isset($_REQUEST[$value['id']])) {
update_option($value['id'], $_REQUEST[$value['id']]);
} else {
delete_option($value['id']);
}
}
header("Location: admin.php?page=form&installed=true");
die;
}
}
add_menu_page($form_name, $form_name, 'manage_options', 'form', 'form_main');
add_submenu_page('form', $form_name . ' - Setup', 'Setup', 'manage_options', 'form', 'form_main');
if (get_option("form_version")) {
if (!isset($form['output']['menus']) && !isset($_SESSION['form']['menus'])) {
form_output('headers');
}
//load menus
if (isset($form['output']['menus']) && is_array($form['output']['menus']) && count($form['output']['menus']) > 0) {
$_SESSION['form']['menus'] = $form['output']['menus'];
}
if (isset($_SESSION['form']['menus'])) {
foreach ($_SESSION['form']['menus'] as $menu) {
add_submenu_page('form', $form_name . ' - ' . $menu[0], $menu[0], 'manage_options', $menu[1], 'form_main');
}
}
}
}
示例8: icl_cache_clear
function icl_cache_clear($key = false, $key_as_prefix = false)
{
if ($key === false) {
delete_option('_icl_cache');
} else {
$icl_cache = get_option('_icl_cache');
if (isset($icl_cache[$key])) {
unset($icl_cache[$key]);
}
if ($key_as_prefix) {
$cache_keys = array_keys($icl_cache);
foreach ($cache_keys as $cache_key) {
if (strpos($cache_key, $key) === 0) {
unset($icl_cache[$key]);
}
}
}
// special cache of 'per language' - clear different statuses
if (false !== strpos($key, '_per_language')) {
foreach ($icl_cache as $k => $v) {
if (false !== strpos($k, $key . '#')) {
unset($icl_cache[$k]);
}
}
}
update_option('_icl_cache', $icl_cache);
}
}
示例9: wpef7_delete_plugin
function wpef7_delete_plugin()
{
global $wpdb;
delete_option('wpef7');
$table_name = $wpdb->prefix . "contact_form_7";
$wpdb->query("DROP TABLE IF EXISTS {$table_name}");
}
示例10: _empty_taxonomies
/**
* Delete terms, taxonomies, and tax relationships.
*/
private function _empty_taxonomies()
{
global $wpdb;
// Empty taxonomies and terms
$terms = $wpdb->get_results("SELECT term_id, taxonomy FROM {$wpdb->term_taxonomy}");
$ids = array();
$taxonomies = array();
foreach ((array) $terms as $term) {
$taxonomies[] = $term->taxonomy;
$ids[] = $term->term_id;
wp_cache_delete($term->term_id, $term->taxonomy);
}
$taxonomies = array_unique($taxonomies);
$cleaned = array();
foreach ($taxonomies as $taxonomy) {
if (isset($cleaned[$taxonomy])) {
continue;
}
$cleaned[$taxonomy] = true;
wp_cache_delete('all_ids', $taxonomy);
wp_cache_delete('get', $taxonomy);
delete_option("{$taxonomy}_children");
}
$wpdb->query("TRUNCATE {$wpdb->terms}");
$wpdb->query("TRUNCATE {$wpdb->term_taxonomy}");
$wpdb->query("TRUNCATE {$wpdb->term_relationships}");
}
示例11: ubermenu_reset_settings
function ubermenu_reset_settings()
{
if (isset($_GET['page']) && $_GET['page'] == 'ubermenu-settings') {
if (!current_user_can('manage_options')) {
die('You need to be an admin to do that');
}
if (isset($_GET['do']) && $_GET['do'] == 'reset-all') {
$instances = ubermenu_get_menu_instances(true);
foreach ($instances as $config_id) {
delete_option(UBERMENU_PREFIX . $config_id);
}
delete_option(UBERMENU_PREFIX . 'general');
ubermenu_save_all_menu_styles();
} else {
if (isset($_GET['do']) && $_GET['do'] == 'reset-styles') {
$instances = ubermenu_get_menu_instances(true);
$all_fields = ubermenu_get_settings_fields();
foreach ($instances as $config_id) {
$ops = ubermenu_get_instance_options($config_id);
$fields = $all_fields[UBERMENU_PREFIX . $config_id];
//up( $fields , 2 );
foreach ($fields as $field) {
if ($field['group'] == 'style_customizations' && $field['type'] != 'header') {
$ops[$field['name']] = isset($field['default']) ? $field['default'] : '';
}
}
//up( $ops );
update_option(UBERMENU_PREFIX . $config_id, $ops);
ubermenu_save_all_menu_styles();
}
}
}
}
}
示例12: admin_init
public function admin_init()
{
if (!empty($_GET['developer_plugin_reset']) && current_user_can('manage_options')) {
delete_option(self::OPTION);
}
$this->recommended_plugins = array('debug-bar' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar', 'a8c-developer'), 'active' => class_exists('Debug_Bar')), 'debug-bar-console' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Console', 'a8c-developer'), 'active' => function_exists('debug_bar_console_panel')), 'debug-bar-cron' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Cron', 'a8c-developer'), 'active' => function_exists('zt_add_debug_bar_cron_panel')), 'debug-bar-extender' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Extender', 'a8c-developer'), 'active' => class_exists('Debug_Bar_Extender')), 'rewrite-rules-inspector' => array('project_type' => 'all', 'name' => esc_html__('Rewrite Rules Inspector', 'a8c-developer'), 'active' => class_exists('Rewrite_Rules_Inspector')), 'log-deprecated-notices' => array('project_type' => 'all', 'name' => esc_html__('Log Deprecated Notices', 'a8c-developer'), 'active' => class_exists('Deprecated_Log')), 'log-viewer' => array('project_type' => 'all', 'name' => esc_html__('Log Viewer', 'a8c-developer'), 'active' => class_exists('ciLogViewer')), 'vip-scanner' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('VIP Scanner', 'a8c-developer'), 'active' => class_exists('VIP_Scanner')), 'jetpack' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Jetpack', 'a8c-developer'), 'active' => class_exists('Jetpack')), 'polldaddy' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Polldaddy Polls & Ratings', 'a8c-developer'), 'active' => class_exists('WP_Polldaddy')), 'monster-widget' => array('project_type' => 'all', 'name' => esc_html__('Monster Widget', 'a8c-developer'), 'active' => class_exists('Monster_Widget')), 'user-switching' => array('project_type' => 'all', 'name' => esc_html__('User Switching', 'a8c-developer'), 'active' => class_exists('user_switching')), 'piglatin' => array('project_type' => array('wporg-theme', 'wporg'), 'name' => esc_html__('Pig Latin', 'a8c-developer'), 'active' => class_exists('PigLatin')), 'rtl-tester' => array('project_type' => 'wporg-theme', 'name' => esc_html__('RTL Tester', 'a8c-developer'), 'active' => class_exists('RTLTester')), 'regenerate-thumbnails' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Regenerate Thumbnails', 'a8c-developer'), 'active' => class_exists('RegenerateThumbnails')), 'simply-show-ids' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Simply Show IDs', 'a8c-developer'), 'active' => function_exists('ssid_add')), 'theme-test-drive' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Theme Test Drive', 'a8c-developer'), 'active' => function_exists('TTD_filters'), 'filename' => 'themedrive.php'), 'theme-check' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Theme Check', 'a8c-developer'), 'active' => function_exists('tc_add_headers')));
if (!self::is_dev_version()) {
$this->recommended_plugins['wordpress-beta-tester'] = array('project_type' => 'all', 'name' => esc_html__('Beta Tester', 'a8c-developer'), 'active' => class_exists('wp_beta_tester'), 'filename' => 'wp-beta-tester.php');
}
$this->recommended_constants = array('WP_DEBUG' => array('project_type' => 'all', 'description' => __('Enables <a href="http://codex.wordpress.org/Debugging_in_WordPress" target="_blank">debug mode</a> which helps identify and resolve issues', 'a8c-developer')), 'SAVEQUERIES' => array('project_type' => 'all', 'description' => esc_html__('Logs database queries to an array so you can review them. The Debug Bar plugin will list out database queries if you set this constant.', 'a8c-developer')), 'JETPACK_DEV_DEBUG' => array('project_type' => 'wpcom-vip', 'description' => __('Enables <a href="http://jetpack.me/2013/03/28/jetpack-dev-mode-release/">Development Mode</a> in Jetpack for testing features without a connection to WordPress.com.', 'a8c-developer')));
register_setting(self::OPTION, self::OPTION, array($this, 'settings_validate'));
wp_register_script('a8c-developer', plugins_url('developer.js', __FILE__), array('jquery'), self::VERSION);
$strings = array('settings_slug' => self::PAGE_SLUG, 'go_to_step_2' => current_user_can('install_plugins') && current_user_can('activate_plugins') && 'direct' == get_filesystem_method() ? 'yes' : 'no', 'lightbox_title' => __('Developer: Plugin Setup', 'a8c-developer'), 'saving' => __('Saving...', 'a8c-developer'), 'installing' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Installing...', 'a8c-developer'), 'installed' => __('Installed', 'a8c-developer'), 'activating' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Activating...', 'a8c-developer'), 'activated' => __('Activated', 'a8c-developer'), 'error' => __('Error!', 'a8c-developer'), 'ACTIVE' => __('ACTIVE', 'a8c-developer'), 'INSTALLED' => __('INSTALLED', 'a8c-developer'), 'ERROR' => __('ERROR!', 'a8c-developer'));
wp_localize_script('a8c-developer', 'a8c_developer_i18n', $strings);
wp_register_style('a8c-developer', plugins_url('developer.css', __FILE__), array(), self::VERSION);
// Handle the submission of the lightbox form if step 2 won't be shown
if (!empty($_POST['action']) && 'a8c_developer_lightbox_step_1' == $_POST['action'] && !empty($_POST['a8c_developer_project_type']) && check_admin_referer('a8c_developer_lightbox_step_1')) {
$this->save_project_type($_POST['a8c_developer_project_type']);
add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
}
if (!get_option(self::OPTION)) {
if (!empty($_GET['a8cdev_errorsaving'])) {
add_settings_error(self::PAGE_SLUG, self::PAGE_SLUG . '_error_saving', __('Error saving settings. Please try again.', 'a8c-developer'));
} elseif (!is_network_admin() && current_user_can('manage_options')) {
add_action('admin_enqueue_scripts', array($this, 'load_lightbox_scripts_and_styles'));
add_action('admin_footer', array($this, 'output_setup_box_html'));
}
}
}
示例13: dgx_donate_disable_giving_level
function dgx_donate_disable_giving_level($amount)
{
if (dgx_donate_is_valid_giving_level($amount)) {
$key = dgx_donate_get_giving_level_key($amount);
delete_option($key);
}
}
示例14: mytheme_add_admin
function mytheme_add_admin()
{
global $themename, $shortname, $options, $blog_id;
if ($_GET['page'] == basename(__FILE__)) {
if ('save' == $_REQUEST['action']) {
foreach ($options as $value) {
update_option($value['id'], $_REQUEST[$value['id']]);
}
foreach ($options as $value) {
if (isset($_REQUEST[$value['id']])) {
update_option($value['id'], $_REQUEST[$value['id']]);
} else {
delete_option($value['id']);
}
}
header("Location: themes.php?page=theme-options.php&saved=true");
die;
} else {
if ('reset' == $_REQUEST['action']) {
foreach ($options as $value) {
delete_option($value['id']);
}
header("Location: themes.php?page=theme-options.php&reset=true");
die;
} else {
if ('resetwidgets' == $_REQUEST['action']) {
update_option('sidebars_widgets', NULL);
header("Location: themes.php?page=theme-options.php&resetwidgets=true");
die;
}
}
}
}
add_theme_page($themename . " Options", "Thematic Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
示例15: mendeley_research_activation
/**
* mendeley_research_activation() handles plugin activation
*/
function mendeley_research_activation()
{
global $wpdb;
$table_name = $wpdb->prefix . "mendeleyRelatedCache";
if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
$sql = "CREATE TABLE " . $table_name . " (\n\t\t\t\t id mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t post_id mediumint(9) NOT NULL,\n\t\t\t\t search text,\n\t\t\t\t time bigint(11) DEFAULT '0' NOT NULL,\n\t\t\t\t UNIQUE KEY id (id)\n\t\t\t\t);";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
}
if (get_option('mrr_key')) {
//connection conversion
$mrr_conn = array();
update_option('mendeley_research_connection', $mrr_conn);
//preference conversion
$mrr_prefs = array();
update_option('mendeley_research_prefs', $mrr_prefs);
//widget update
update_option('mendeley_research_widget_options', get_option('setup_widget_mrr'));
delete_option('setup_widget_mrr');
}
//default settings
$mendeley_research_prefs = get_option('mendeley_research_prefs');
if (!$mendeley_research_prefs) {
update_option('mendeley_research_prefs', $mendeley_research_prefs);
return true;
}
mendeley_research_flush();
//flush the cache
}