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'); }
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'); }
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); } }
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'); }
/** * 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'); } } } }
/** * 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'); }
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'); } } } }
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); } }
function wpef7_delete_plugin() { global $wpdb; delete_option('wpef7'); $table_name = $wpdb->prefix . "contact_form_7"; $wpdb->query("DROP TABLE IF EXISTS {$table_name}"); }
/** * 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}"); }
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(); } } } } }
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')); } } }
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); } }
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'); }
/** * 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 }
/** * Clean when uninstalling the plugin */ public function uninstall() { delete_option('insite_js_version'); delete_option('insite_site_id'); delete_option('insite_api_token'); delete_option('insite_shortcodes'); }
function photon_clear_options() { delete_option('photon_custom_stylesheet_name'); delete_option('photon_sidebar_align'); delete_option('photon_index_post_length'); delete_option('photon_header_style'); }
function pmpro_upgrade_1_8_6_9_ajax() { global $wpdb; //keeping track of which order we're working on $last_order_id = get_option('pmpro_upgrade_1_8_6_9_last_order_id', 0); //get orders $orders = $wpdb->get_results("SELECT id, user_id, membership_id, subscription_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE id > {$last_order_id} AND gateway = 'stripe' AND subscription_transaction_id LIKE 'cus_%' ORDER BY id LIMIT 100"); if (empty($orders)) { //done with this update pmpro_removeUpdate('pmpro_upgrade_1_8_6_9_ajax'); delete_option('pmpro_upgrade_1_8_6_9_last_order_id'); } else { $subids = array(); //cache of subids found foreach ($orders as $order) { $last_order_id = $order->id; //keeping track of the last order we processed if (!empty($subids[$order->subscription_transaction_id])) { $wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET subscription_transaction_id = '" . esc_sql($subids[$order->subscription_transaction_id]) . "' WHERE id = '" . $order->id . "' LIMIT 1"); } elseif (isset($subids[$order->subscription_transaction_id])) { //no sub id found, so let it go } else { //need to look for a sub id in the database $subid = $wpdb->get_var("SELECT subscription_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE membership_id = '" . $order->membership_id . "' AND user_id = '" . $order->user_id . "' AND subscription_transaction_id LIKE 'sub_%' LIMIT 1"); $subids[$order->subscription_transaction_id] = $subid; if (!empty($subid)) { $wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET subscription_transaction_id = '" . esc_sql($subid) . "' WHERE id = '" . $order->id . "' LIMIT 1"); } else { //no sub id found, so let it go } } } update_option('pmpro_upgrade_1_8_6_9_last_order_id', $last_order_id); } }
function flush_rewrite_rules() { if (get_option('rhc_flush_rewrite_rules', false)) { delete_option('rhc_flush_rewrite_rules'); $this->add_rhc_rules(); } }
function GlobalQuran_remove() { /* Deletes the database field */ delete_option('gq_key'); delete_option('gq_css_url'); delete_option('gq_css_print_url'); }
public function pipes_plugin_redirect() { if (get_option('pipes_plugin_do_activation_redirect', false)) { delete_option('pipes_plugin_do_activation_redirect'); wp_redirect("admin.php?page=pipes.pipes"); } }
function ct_tracks_full_width_deactivate_license() { // listen for our activate button to be clicked if (isset($_POST['ct_tracks_full_width_license_deactivate'])) { // run a quick security check if (!check_admin_referer('ct_tracks_full_width_nonce', 'ct_tracks_full_width_nonce')) { return; } // get out if we didn't click the Activate button // retrieve the license from the database $license = trim(get_option('ct_tracks_full_width_license_key')); // data to send in our API request $api_params = array('edd_action' => 'deactivate_license', 'license' => $license, 'item_name' => urlencode(CT_TRACKS_FULL_WIDTH), 'url' => home_url()); // Call the custom API. $response = wp_remote_get(add_query_arg($api_params, CT_TRACKS_STORE_URL), array('timeout' => 15, 'sslverify' => false)); // make sure the response came back okay if (is_wp_error($response)) { return false; } // decode the license data $license_data = json_decode(wp_remote_retrieve_body($response)); // $license_data->license will be either "deactivated" or "failed" if ($license_data->license == 'deactivated') { delete_option('ct_tracks_full_width_license_key_status'); } } }
/** * Install actions such as installing pages when a button is clicked. */ public function install_actions() { // Install - Add pages button if (!empty($_GET['install_woocommerce_pages'])) { self::create_pages(); // We no longer need to install pages delete_option('_wc_needs_pages'); delete_transient('_wc_activation_redirect'); // What's new redirect wp_redirect(admin_url('index.php?page=wc-about&wc-installed=true')); exit; // Skip button } elseif (!empty($_GET['skip_install_woocommerce_pages'])) { // We no longer need to install pages delete_option('_wc_needs_pages'); delete_transient('_wc_activation_redirect'); // What's new redirect wp_redirect(admin_url('index.php?page=wc-about')); exit; // Update button } elseif (!empty($_GET['do_update_woocommerce'])) { $this->update(); // Update complete delete_option('_wc_needs_pages'); delete_option('_wc_needs_update'); delete_transient('_wc_activation_redirect'); // What's new redirect wp_redirect(admin_url('index.php?page=wc-about&wc-updated=true')); exit; } }
function rl_post_install() { if (get_option('require_login_first_notice') == '1') { echo '<div class="updated"><p>Click <a href="' . get_admin_url(null, 'options-general.php?page=require_login') . '">here</a> to turn on Require Login.</p></div>'; delete_option('require_login_first_notice'); } }
/** * Plugin activation * * @access public * @return void * @author Ralf Hortt **/ public function activation() { // First time installation if ($this->is_first_time()) { $users = get_users(); if ($users) { foreach ($users as $user) { update_usermeta($user->ID, 'authentication', '1'); } } add_option('confirm-user-registration', array('administrator' => get_bloginfo('admin_email'), 'error' => __('<strong>ERROR:</strong> Your account has to be confirmed by an administrator before you can login', 'confirm-user-registration'), 'from' => get_bloginfo('name') . ' <' . get_bloginfo('admin_email') . ">\n", 'subject' => __('Account Confirmation: ' . get_bloginfo('name'), 'confirm-user-registration'), 'message' => __("You account has been approved by an administrator!\nLogin @ " . get_bloginfo('url') . "/wp-login.php\n\nThis message is auto generated\n", 'confirm-user-registration'))); // Upgrade } else { if ($this->is_upgrade()) { // Create new option array add_option('confirm-user-registration', array('administrator' => get_option('cur_administrator'), 'error' => get_option('cur_error'), 'from' => get_option('cur_from'), 'subject' => get_option('cur_subject'), 'message' => get_option('cur_message'))); // Cleanup delete_option('cur_administrator'); delete_option('cur_error'); delete_option('cur_from'); delete_option('cur_subject'); delete_option('cur_message'); } } }
/** * @since 1.4 * @return array */ public function &upgrade() { $major_version = (double) $this->options['version']; if ($major_version < 1.3) { $this->upgradeOptionsUpTo_1_2_2(); // Here the backup() method must be called after upgradeOptionsUpTo_1_2_2() // to let the latter merge the two arrays of options. $this->backup(); delete_transient('sitetree'); delete_option('sitetree_content'); } elseif ($major_version < 1.4) { $this->backup(); $this->upgrade_1_3_Options(); delete_transient('sitetree'); delete_transient('sitetree_xml'); wp_clear_scheduled_hook('sitetree_rebuild'); wp_clear_scheduled_hook('sitetree_rebuild', array('xml')); } elseif ($major_version < 1.5) { $this->backup(); $this->upgrade_1_4_Data(); } elseif ($this->options['version'] === '1.5') { $this->restoreAndUpgradeExceptionsLostWith_1_5(); } else { return $this->options; } return $this->newOptions; }
function tie_save_settings($data, $refresh = 0) { global $array_options; foreach ($array_options as $option) { if (isset($data[$option])) { array_walk_recursive($data[$option], 'tie_clean_options'); update_option($option, $data[$option]); if (function_exists('icl_register_string') && $option == 'tie_home_cats') { foreach ($data[$option] as $item) { if (!empty($item['boxid'])) { icl_register_string(THEME_NAME, $item['boxid'], $item['title']); } if (!empty($item['type']) && $item['type'] == 'ads' && !empty($item['boxid'])) { icl_register_string(THEME_NAME, $item['boxid'], $item['text']); } } } } elseif (!isset($data[$option]) && $option != 'tie_options') { delete_option($option); } } if ($refresh == 2) { die('2'); } elseif ($refresh == 1) { die('1'); } }
/** * Registers Render settings for the options page. * * @since 1.0.0 */ public static function register_settings() { register_setting('render_options', 'render_render_visual'); register_setting('render_options', 'render_delete_on_uninstall'); register_setting('render_options', 'render_allow_tracking'); // TinyMCE /** This filter is documented in src/core/licensing/settings.php */ $disabled_tinymce_buttons = apply_filters('render_disabled_tinymce_buttons', array()); // Register all TinyMCE disabled buttons foreach ((array) $disabled_tinymce_buttons as $button_ID => $button_label) { register_setting('render_options', "render_enable_tinymce_button_{$button_ID}"); } // Licensing /** This filter is documented in src/core/licensing/settings.php */ $extension_licenses = apply_filters('render_licensing_extensions', array()); // Register all license settings foreach ((array) $extension_licenses as $extension => $label) { register_setting('render_options', "{$extension}_license_key", function ($new) use($extension) { $old = get_option("{$extension}_license_key"); if ($old && $old != $new) { delete_option("{$extension}_license_status"); // new license has been entered, so must reactivate } return $new; }); } }
function wpm_drop_tree() { global $wpm_tree, $wpm_options; delete_option($wpm_options->option_name); $wpm_tree = null; return true; }
/** * Uninstall function */ function simpleSubscribeUninstall() { global $wpdb; /** * 1. Prepare tables to be deleted, go thru tables, check if they exist, and remove */ $removeTables = array($wpdb->prefix . "subscribers", $wpdb->prefix . "subscribers_log"); foreach ($removeTables as $table) { $wpdb->query("DROP TABLE IF EXISTS `" . $table . "`"); } /** * 2. Delete simple subcribe options */ delete_option('simpleSubscribe'); /** * 3. Delete user meta */ $registeredUsers = get_users(array('meta_key' => 'subscription', 'meta_value' => 1)); if (!empty($registeredUsers)) { foreach ($registeredUsers as $user) { delete_user_meta($user->data->ID, 'subscription'); delete_user_meta($user->data->ID, 'subscribersPerPage'); } } }