function uninstall() { delete_option('k2headerimage'); delete_option('k2hometab'); delete_option('k2hometabcustom'); remove_theme_mods(); }
public function reset_sanitize_callback($input) { if ('reset' == strtolower($input)) { remove_theme_mods(); } return ''; }
/** * Sanitization callback * * @since 1.6.0 */ public static function sanitize($options) { // Import the imported options if ($options) { // Delete options if import set to -1 if ('-1' == $options['reset']) { // Get menu locations $locations = get_theme_mod('nav_menu_locations'); $save_menus = array(); if ($locations) { foreach ($locations as $key => $val) { $save_menus[$key] = $val; } } // Get sidebars $widget_areas = get_theme_mod('widget_areas'); // Remove all mods remove_theme_mods(); // Remove CSS cache delete_option('wpex_customizer_inline_css_cache'); // Re-add the menus set_theme_mod('nav_menu_locations', array_map('absint', $save_menus)); set_theme_mod('widget_areas', $widget_areas); // Error messages $error_msg = __('All settings have been reset.', 'wpex'); $error_type = 'updated'; } elseif (!empty($options['import'])) { // Decode input data $theme_mods = json_decode($options['import'], true); // Validate json file then set new theme options if (function_exists('json_last_error')) { if ('0' == json_last_error()) { // Delete CSS cache delete_option('wpex_customizer_inline_css_cache'); // Loop through mods and add them foreach ($theme_mods as $theme_mod => $value) { set_theme_mod($theme_mod, $value); } // Success message $error_msg = __('Settings imported successfully.', 'wpex'); $error_type = 'updated'; } else { $error_msg = __('Invalid Import Data.', 'wpex'); $error_type = 'error'; } } } else { $error_msg = __('No import data found.', 'wpex'); $error_type = 'error'; } // Make sure the settings data is reset! $options = array('import' => '', 'reset' => ''); } // Display message add_settings_error('wpex-customizer-notices', esc_attr('settings_updated'), $error_msg, $error_type); // Return options return $options; }
/** * Reset all settings to default * @param $input entered value * @return sanitized output * */ function the_wp_reset_all_settings($input) { if ($input == 1) { //Remove all set values remove_theme_mods(); } else { return ''; } }
function wptouch_customizer_reset_settings() { // Called when the user resets WPtouch settings. WPtouch handles the settings object side, but we also need to clear out the data structures used by the Customizer. Settings defaults will be applied as normal. global $wptouch_pro; // Delete site option structures; no need to restrict these to the known options domains (n.b.: others should not exist at this point). $domains = $wptouch_pro->get_active_setting_domains(); foreach ($domains as $domain) { delete_option('wptouch_customizer_options_' . $domain); } // Rebuild settings and objects from the WPtouch objects (e.g., defaults) $current_theme = wptouch_get_current_theme_name(); delete_option('wptouch_customizer_initialized_' . $current_theme); // Delete theme mods – because we're not actively customizing here, WP believes the desktop theme is active, so override the value for the duration of the action. Disable the override once we're done so later requests execute normally. wptouch_customizer_begin_theme_override(); remove_theme_mods(); wptouch_customizer_end_theme_override(); }
function take_action() { if (isset($_POST['textcolor'])) { check_admin_referer('custom-header'); if ('blank' == $_POST['textcolor']) { set_theme_mod('header_textcolor', 'blank'); } else { $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']); if (strlen($color) == 6 || strlen($color) == 3) { set_theme_mod('header_textcolor', $color); } } } if (isset($_POST['resetheader'])) { check_admin_referer('custom-header'); remove_theme_mods(); } }
function aaron_sanitize_reset($input) { $input = sanitize_text_field($input); if ($input == 'YES') { remove_theme_mods(); } else { return; } }
protected function _reset_settings($arrSettings = false) { $return = false; if (empty($arrSettings)) { // early abort return $return; } foreach ($arrSettings as $strDataItemID => $arrItemAttributes) { switch ($strDataItemID) { case 'theme_mods': // customizer / theme-specific settings set_theme_mod('theme_mods_reset', time()); remove_theme_mods(); set_theme_mod('color_scheme', 'default'); if (get_theme_mod('theme_mods_reset', true) == true) { // has been set BEFORE removing all theme_mods .. should return true, instead of an integer! $resetStatus = true; } break; case 'slideshows': // alias for another option name $resetStatus = delete_option('cc_slider_options'); break; default: $resetStatus = delete_option($arrItemAttributes['option_name']); break; } $arrReturn[$strDataItemID] = array('title' => $arrItemAttributes['title'], 'status' => $resetStatus); unset($resetStatus); } if (!empty($arrReturn)) { $return = $arrReturn; } return $return; }
/* UU 2014 - Image Selection ========================================================================== */ $wp_customize->add_section('uu2014_choose_images_section', array('title' => __('UU 2014 - Image Selection', 'uu2014'), 'priority' => 100030, 'description' => __('You can choose what style of UU image to display in the theme.', 'uu2014'))); $wp_customize->add_setting('uu2014_title_image', array('default' => 'Symbol_Gradient_77_110.png', 'sanitize_callback' => 'sanitize_file_name')); $wp_customize->add_control('uu2014_title_image_dropdown', array('label' => __('Which image should be displayed near the title?', 'uu2014'), 'section' => 'uu2014_choose_images_section', 'settings' => 'uu2014_title_image', 'type' => 'select', 'choices' => array('chalice.png' => 'Silver Chalice', 'Symbol_Metal_77_110.png' => __('Silver UUA Symbol', 'uu2014'), 'Symbol_Metal_77_71.png' => __('Smaller Silver UUA Symbol', 'uu2014'), 'Symbol_Gradient_77_110.png' => __('Red UUA Symbol', 'uu2014'), 'Symbol_Gradient_77_71.png' => __('Smaller Red UUA Symbol', 'uu2014')))); $wp_customize->add_setting('uu2014_footer_image', array('default' => 'UUA_Symbol_dark_148_200.png', 'sanitize_callback' => 'sanitize_file_name')); $wp_customize->add_control('uu2014_footer_image_dropdown', array('label' => __('Which image should be displayed in the footer?', 'uu2014'), 'section' => 'uu2014_choose_images_section', 'settings' => 'uu2014_footer_image', 'type' => 'select', 'choices' => array('chalice-watermark-dark.gif' => __('Dark Chalice', 'uu2014'), 'UUA_Symbol_dark_148_200.png' => __('Dark UUA Symbol', 'uu2014')))); $wp_customize->add_setting('uu2014_favicon', array('default' => 'favicon.ico', 'sanitize_callback' => 'sanitize_file_name')); $wp_customize->add_control('uu2014_favicon_dropdown', array('label' => __('Which image should be used for the website icon(favicon)?', 'uu2014'), 'section' => 'uu2014_choose_images_section', 'settings' => 'uu2014_favicon', 'type' => 'select', 'choices' => array('favicon.ico' => __('New Red UUA Symbol', 'uu2014'), 'chalice-favicon.ico' => __('Previous Chalice UUA Symbol', 'uu2014')))); /* ========================================================================== */ } add_action('customize_register', 'uu2014_customize_register'); // If the user clicked the reset button, remove all theme modifications // It is important that the default is false or you would reset every time if (get_theme_mod('uu2014_theme_reset_setting', 0)) { remove_theme_mods(); } //We have a small amount of dynamic CSS that is output in the header function uu2014_customize_css() { ?> <style type="text/css" id="uu2014_customize_css"> <?php $uu2014_font_size_settings = uu2014_get_font_size_settings(); foreach ($uu2014_font_size_settings as $font_size_setting => $value) { ?> <?php echo $value['selector']; ?> { <?php echo get_theme_mod($font_size_setting, $value['font-size-default']);
function uninstall() { delete_option('k2headerimage'); delete_option('k2blogornoblog'); remove_theme_mods(); }
/** * Execute custom header modification. * * @since 2.6.0 */ function take_action() { if (!current_user_can('switch_themes')) { return; } if (isset($_POST['textcolor'])) { check_admin_referer('custom-header'); if ('blank' == $_POST['textcolor']) { set_theme_mod('header_textcolor', 'blank'); } else { $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']); if (strlen($color) == 6 || strlen($color) == 3) { set_theme_mod('header_textcolor', $color); } } } if (isset($_POST['resetheader'])) { check_admin_referer('custom-header'); remove_theme_mods(); } if (isset($_POST['default-header'])) { check_admin_referer('custom-header'); $this->process_default_headers(); if (isset($this->default_headers[$_POST['default-header']])) { set_theme_mod('header_image', esc_url($this->default_headers[$_POST['default-header']]['url'])); } } }
/** * Trigger the compiler and reset cached CSS on save. * This is necessary for the imports to properly work. */ function validate($settings) { // Import the imported options if (isset($settings['import_data']) && !empty($settings['import_data'])) { if ('RESET' == $settings['import_data']) { remove_theme_mods(); } else { $theme_mods = json_decode($settings['import_data'], true); foreach ($theme_mods as $theme_mod => $value) { set_theme_mod($theme_mod, $value); } } // The import data should not be saved, save the field as empty. $settings['import_data'] = ''; } do_action('maera/admin/save'); return $settings; }
/** * Remove theme modification name from current theme list. * * If removing the name also removes all elements, then the entire option will * be removed. * * @since 2.1.0 * * @param string $name Theme modification name. * @return null */ function remove_theme_mod($name) { $mods = get_theme_mods(); if (!isset($mods[$name])) { return; } unset($mods[$name]); if (empty($mods)) { return remove_theme_mods(); } $theme = get_option('stylesheet'); update_option("theme_mods_{$theme}", $mods); }
function raindrops_delete_all_options() { if (current_user_can('delete_themes')) { delete_option('raindrops_theme_settings'); remove_theme_mods(); delete_option('widget_raindrops_pinup_entry_widget'); delete_option('widget_raindrops_entrywidget'); $allposts = get_posts('numberposts=0&post_type=post&post_status='); foreach ($allposts as $postinfo) { delete_post_meta($postinfo->ID, '_web_fonts_styles'); delete_post_meta($postinfo->ID, '_web_fonts_link_element'); delete_post_meta($postinfo->ID, '_css'); delete_post_meta($postinfo->ID, 'css'); delete_post_meta($postinfo->ID, '_add-to-front'); delete_post_meta($postinfo->ID, '_raindrops_this_header_image'); delete_post_meta($postinfo->ID, 'meta'); if (RAINDROPS_CUSTOM_FIELD_SCRIPT == true) { delete_post_meta($postinfo->ID, 'javascript'); } } $allposts = get_posts('numberposts=0&post_type=page&post_status='); foreach ($allposts as $postinfo) { delete_post_meta($postinfo->ID, '_web_fonts_styles'); delete_post_meta($postinfo->ID, '_web_fonts_link_element'); delete_post_meta($postinfo->ID, '_css'); delete_post_meta($postinfo->ID, 'css'); delete_post_meta($postinfo->ID, '_add-to-front'); delete_post_meta($postinfo->ID, '_raindrops_this_header_image'); delete_post_meta($postinfo->ID, 'meta'); if (RAINDROPS_CUSTOM_FIELD_SCRIPT == true) { delete_post_meta($postinfo->ID, 'javascript'); } } } }
/** * Remove theme modification name from current theme list. * * If removing the name also removes all elements, then the entire option will * be removed. * * @since 2.1.0 * * @param string $name Theme modification name. * @return null */ function remove_theme_mod($name) { $theme = get_current_theme(); $mods = get_option("mods_{$theme}"); if (!isset($mods[$name])) { return; } unset($mods[$name]); if (empty($mods)) { return remove_theme_mods(); } update_option("mods_{$theme}", $mods); wp_cache_delete("mods_{$theme}", 'options'); }
/** * Execute custom background modification. * * @since 3.0.0 */ function take_action() { if (empty($_POST)) { return; } check_admin_referer('custom-background'); // @TODO: No UI entry point for this: if (isset($_POST['reset-background'])) { remove_theme_mods(); return; } if (isset($_POST['remove-background'])) { // @TODO: Uploaded files are not removed here. set_theme_mod('background_image', ''); } if (isset($_POST['background-repeat'])) { if (in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y'))) { $repeat = $_POST['background-repeat']; } else { $repeat = 'repeat'; } set_theme_mod('background_repeat', $repeat); } if (isset($_POST['background-position'])) { if (in_array($_POST['background-position'], array('center', 'right', 'left'))) { $position = $_POST['background-position']; } else { $position = 'left'; } set_theme_mod('background_position', $position); } if (isset($_POST['background-attachment'])) { if (in_array($_POST['background-attachment'], array('fixed', 'scroll'))) { $attachment = $_POST['background-attachment']; } else { $attachment = 'fixed'; } set_theme_mod('background_attachment', $attachment); } if (isset($_POST['background-color'])) { $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); if (strlen($color) == 6 || strlen($color) == 3) { set_theme_mod('background_color', $color); } else { set_theme_mod('background_color', ''); } } $this->updated = true; }
/** * Reset all theme settings to defaults */ function clear_basicbootstrap_mods() { remove_theme_mods(); }
/** * Sanitization callback */ function sanitize($options) { $skin = isset($options['skin']) ? $options['skin'] : 'base'; if (isset($options['toggle']) && 'on' == $options['toggle']) { $confirm = isset($options['confirm']) ? true : false; // Clear theme mods and set defaults if ('on' == $confirm && $skin) { // Get menu locations $locations = get_theme_mod('nav_menu_locations'); $save_menus = array(); foreach ($locations as $key => $val) { $save_menus[$key] = $val; } // Get sidebars $widget_areas = get_theme_mod('widget_areas'); // Remove all mods remove_theme_mods(); // Re-add the menus set_theme_mod('nav_menu_locations', array_map('absint', $save_menus)); set_theme_mod('widget_areas', $widget_areas); // Base if ('base' == $options['skin']) { set_theme_mod('header_height', '40px'); set_theme_mod('menu_dropdown_top_border', '1'); } elseif ('neat' == $options['skin']) { set_theme_mod('body_typography', array('font-family' => 'Open Sans')); set_theme_mod('headings_typography', array('font-family' => 'Roboto Slab')); set_theme_mod('menu_font_size', '14px'); set_theme_mod('menu_font_size', '14px'); set_theme_mod('footer_widget_title_font_size', '16px'); set_theme_mod('header_height', ''); set_theme_mod('menu_dropdown_top_border', ''); set_theme_mod('top_bar_content', '[font_awesome icon="check" size="16px" margin_right="8px"]Call Today For A Consultation: 1-800-987-6543'); } elseif ('agent' == $options['skin']) { } elseif ('flat' == $options['skin']) { set_theme_mod('header_style', 'three'); set_theme_mod('menu_font_family', 'Lato'); set_theme_mod('body_font_family', 'Roboto Slab'); set_theme_mod('main_search_toggle_style', 'overlay'); set_theme_mod('woo_menu_icon_style', 'overlay'); } $error_msg = __('Skin and recommended settings successfully updated.', 'wpex'); } else { $error_msg = __('Skin updated and settings kept intact.', 'wpex'); } } else { $error_msg = __('Skin successfully updated.', 'wpex'); } // Update theme mod with skin value if ($skin) { set_theme_mod('theme_skin', $skin); } // Display message add_settings_error('wpex-skins-notices', esc_attr('settings_updated'), $error_msg, 'updated'); // Clear options $options = ''; }
function sfpaper_customizer($wp_customize) { global $wp_customize; if (isset($_GET['resetmods'])) { remove_theme_mods(); } /* Add a custom class for reset button */ class sfpaper_Customize_Reset_Control extends WP_Customize_Control { public $type = 'reset_button'; public function render_content() { ?> <form action="customize.php" method="get"> <label> <span style="font-weight:normal;margin-bottom:10px;" class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <input type="submit" class="reset-button button-secondary" name="resetmods" value="<?php esc_attr_e('Reset Theme Mods', 'sfpaper'); ?> " onclick="return confirm( '<?php print esc_js(__('Click OK to reset. Any theme mods you have set in the Theme Customizer will be lost!', 'sfpaper')); ?> ' );" /> </label> </form> <?php } } /* Add a custom class for support tab */ class sfpaper_Customize_Support_Control extends WP_Customize_Control { public $type = 'support_tab'; public function render_content() { ?> <h3><?php esc_attr_e('Welcome to Storefront Paper!', 'chronology'); ?> </h3> <p><?php esc_attr_e('We\'ve released this theme as a free theme and have a video tutorial to help you get up and running with it. To watch the video, simply visit the theme\'s homepage using the button below.', 'chronology'); ?> </p> <a class="button-secondary" href="http://storefrontthemes.com/themes/paper"><?php esc_attr_e('Learn More', 'sfpaper'); ?> </a> <p><?php esc_attr_e('We also offer premium level support for a low cost which includes access to our support forums and additional video tutorials to help you with WP e-Commerce and WooThemes setup. Simply click on the button below to learn more.', 'chronology'); ?> </p> <a class="button-primary" href="http://storefrontthemes.com/membership-signup/"><?php esc_attr_e('Get Support', 'sfpaper'); ?> </a> <?php } } do_action('sfpaper_add_to_customizer'); }
/** * Reset all settings to default * @param $input entered value * @return sanitized output * * @since Create 2.1 */ function create_reset_all_settings($input) { if ($input == 1) { //Remove all set values remove_theme_mods(); // Flush out all transients //create_flush_transients(); } else { return ''; } }
/** * Don't remember theme setting when reloading theme. */ function moscow_reset_options() { remove_theme_mods(); }
function js() { if ( isset( $_POST['textcolor'] ) ) { if ( 'blank' == $_POST['textcolor'] ) { set_theme_mod('header_textcolor', 'blank'); } else { $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']); if ( strlen($color) == 6 || strlen($color) == 3 ) set_theme_mod('header_textcolor', $color); } } if ( isset($_POST['resetheader']) ) remove_theme_mods(); ?> <script type="text/javascript"> function onEndCrop( coords, dimensions ) { $( 'x1' ).value = coords.x1; $( 'y1' ).value = coords.y1; $( 'x2' ).value = coords.x2; $( 'y2' ).value = coords.y2; $( 'width' ).value = dimensions.width; $( 'height' ).value = dimensions.height; } // with a supplied ratio Event.observe( window, 'load', function() { var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>; var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>; var ratio = xinit / yinit; var ximg = $('upload').width; var yimg = $('upload').height; if ( yimg < yinit || ximg < xinit ) { if ( ximg / yimg > ratio ) { yinit = yimg; xinit = yinit * ratio; } else { xinit = ximg; yinit = xinit / ratio; } } new Cropper.Img( 'upload', { ratioDim: { x: xinit, y: yinit }, displayOnInit: true, onEndCrop: onEndCrop } ) } ); var cp = new ColorPicker(); function pickColor(color) { $('name').style.color = color; $('desc').style.color = color; $('textcolor').value = color; } function PopupWindow_hidePopup(magicword) { if ( magicword != 'prettyplease' ) return false; if (this.divName != null) { if (this.use_gebi) { document.getElementById(this.divName).style.visibility = "hidden"; } else if (this.use_css) { document.all[this.divName].style.visibility = "hidden"; } else if (this.use_layers) { document.layers[this.divName].visibility = "hidden"; } } else { if (this.popupWindow && !this.popupWindow.closed) { this.popupWindow.close(); this.popupWindow = null; } } return false; } function colorSelect(t,p) { if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" ) { cp.hidePopup('prettyplease'); } else { cp.p = p; cp.select(t,p); } } function colorDefault() { pickColor('<?php echo HEADER_TEXTCOLOR; ?>'); } function hide_text() { $('name').style.display = 'none'; $('desc').style.display = 'none'; $('pickcolor').style.display = 'none'; $('defaultcolor').style.display = 'none'; $('textcolor').value = 'blank'; $('hidetext').value = '<?php _e('Show Text'); ?>'; // $('hidetext').onclick = 'show_text()'; Event.observe( $('hidetext'), 'click', show_text ); } function show_text() { $('name').style.display = 'block'; $('desc').style.display = 'block'; $('pickcolor').style.display = 'inline'; $('defaultcolor').style.display = 'inline'; $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>'; $('hidetext').value = '<?php _e('Hide Text'); ?>'; Event.stopObserving( $('hidetext'), 'click', show_text ); Event.observe( $('hidetext'), 'click', hide_text ); } <?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?> Event.observe( window, 'load', hide_text ); <?php } ?> </script> <?php }
/** * Remove one or more theme mods. * * ## OPTIONS * * [<mod>...] * : One or more mods to remove. * * [--all] * : Remove all theme mods. * * ## EXAMPLES * * # Remove all theme mods. * $ wp theme mod remove --all * Success: Theme mods removed. * * # Remove single theme mod. * $ wp theme mod remove background_color * Success: 1 mod removed. * * # Remove multiple theme mods. * $ wp theme mod remove background_color header_textcolor * Success: 2 mods removed. */ public function remove($args = array(), $assoc_args = array()) { if (!\WP_CLI\Utils\get_flag_value($assoc_args, 'all') && empty($args)) { WP_CLI::error("You must specify at least one mod or use --all."); } if (\WP_CLI\Utils\get_flag_value($assoc_args, 'all')) { remove_theme_mods(); WP_CLI::success('Theme mods removed.'); return; } foreach ($args as $mod) { remove_theme_mod($mod); } $count = count($args); $success_message = 1 === $count ? '%d mod removed.' : '%d mods removed.'; WP_CLI::success(sprintf($success_message, $count)); }
/** * Remove theme mod(s). * * ## OPTIONS * * [<mod>...] * : One or more mods to remove. * * [--all] * : Remove all theme mods * * ## EXAMPLES * * wp theme mod remove --all * wp theme mod remove background_color * wp theme mod remove background_color header_textcolor */ public function remove($args = array(), $assoc_args = array()) { if (!isset($assoc_args['all']) && empty($args)) { WP_CLI::error("You must specify at least one mod or use --all."); } if (isset($assoc_args['all']) && $assoc_args['all']) { remove_theme_mods(); WP_CLI::success('Theme mods removed.'); return; } foreach ($args as $mod) { remove_theme_mod($mod); } WP_CLI::success(sprintf('%d mods removed.', count($args))); }
function cmo_reset_customizer_settings() { remove_theme_mods(); }
function ct_apex_reset_customizer_options() { // validate name and value if (empty($_POST['apex_reset_customizer']) || 'apex_reset_customizer_settings' !== $_POST['apex_reset_customizer']) { return; } // validate nonce if (!wp_verify_nonce($_POST['apex_reset_customizer_nonce'], 'apex_reset_customizer_nonce')) { return; } // validate user permissions if (!current_user_can('manage_options')) { return; } // delete customizer mods remove_theme_mods(); $redirect = admin_url('themes.php?page=apex-options'); $redirect = add_query_arg('apex_status', 'deleted', $redirect); // safely redirect wp_safe_redirect($redirect); exit; }
function uninstall() { delete_option('unwakeable_headerimage'); delete_option('unwakeable_blogornoblog'); remove_theme_mods(); }