if (x_demo_content_stage_not_completed('update-home-content')) { $existing_home_page = x_demo_content_home_page(); if ($existing_home_page) { wp_delete_post($existing_home_page, true); } x_demo_content_set_stage_completed('update-home-content'); } // Update Customizer Settings // ============================================================================= if (x_demo_content_stage_not_completed('xcs-import')) { foreach ($customizer_settings as $key => $value) { update_option($key, $value); } require_once 'xcs.php'; x_demo_content_set_stage_completed('xcs-import'); x_bust_google_fonts_cache(); } // Require Data Files // ============================================================================= require_once 'data-pages.php'; require_once 'data-posts.php'; require_once 'data-portfolio-items.php'; // Process Data Files // ============================================================================= if (x_demo_content_stage_not_completed('process-data-files')) { // // Form array of all entries to be added and process them if it isn't empty. // $entries = array_merge($pages, $posts, $portfolio_items); if (!empty($entries)) { foreach ($entries as $key => $entry) {
function x_addons_customizer_reset_functionality() { if (isset($_POST['reset']) && check_admin_referer('x-addons-customizer-manager-reset')) { global $customizer_settings_data; foreach ($customizer_settings_data as $option => $default) { delete_option($option); } x_bust_google_fonts_cache(); echo '<div class="updated"><p>All Customizer settings were successfully reset.</p></div>'; } }
function x_bust_caches() { if (isset($_GET['x-bust-caches'])) { x_bust_google_fonts_cache(); } }
public function importOptions($data) { if (isset($data['page_on_front'])) { $postID = $key = $this->registry->get('post', $data['page_on_front']); if (!is_null($postID)) { update_option('page_on_front', $postID); } unset($data['page_on_front']); } if (isset($data['page_for_posts'])) { $postID = $this->registry->get('post', $data['page_for_posts']); if (!is_null($postID)) { update_option('page_for_posts', $postID); } unset($data['page_for_posts']); } foreach ($data as $key => $value) { if (false === update_option($key, maybe_unserialize($this->normalizeContentURLs($value)))) { $this->debugMessage = "Could not set meta key ({$key}) to post: {$value}"; } } $this->message = __('Setting Customizer values...', '__x__'); x_bust_google_fonts_cache(); return true; }
function x_version_migration() { $prior = get_option('x_version', X_VERSION); if (version_compare($prior, X_VERSION, '<')) { // // If $prior is less than 2.2.0. // if (version_compare($prior, '2.2.0', '<')) { $mods = get_theme_mods(); foreach ($mods as $key => $value) { update_option($key, $value); } } // // If $prior is less than 3.1.0. // if (version_compare($prior, '3.1.0', '<')) { $stack = get_option('x_stack'); $design = $stack == 'integrity' ? '_' . get_option('x_integrity_design') : ''; $stack_safe = $stack == 'icon' ? 'integrity' : $stack; $updated = array('x_layout_site' => get_option('x_' . $stack . '_layout_site'), 'x_layout_site_max_width' => get_option('x_' . $stack . '_sizing_site_max_width'), 'x_layout_site_width' => get_option('x_' . $stack . '_sizing_site_width'), 'x_layout_content' => get_option('x_' . $stack . '_layout_content'), 'x_layout_content_width' => get_option('x_' . $stack_safe . '_sizing_content_width'), 'x_layout_sidebar_width' => get_option('x_icon_sidebar_width'), 'x_design_bg_color' => get_option('x_' . $stack . $design . '_bg_color'), 'x_design_bg_image_pattern' => get_option('x_' . $stack . $design . '_bg_image_pattern'), 'x_design_bg_image_full' => get_option('x_' . $stack . $design . '_bg_image_full'), 'x_design_bg_image_full_fade' => get_option('x_' . $stack . $design . '_bg_image_full_fade')); foreach ($updated as $key => $value) { update_option($key, $value); } } // // If $prior is less than 4.0.0. // if (version_compare($prior, '4.0.0', '<')) { $updated = array('x_pre_v4' => true); foreach ($updated as $key => $value) { update_option($key, $value); } } // // If $prior is less than 4.0.4. // if (version_compare($prior, '4.0.4', '<')) { $stack = get_option('x_stack'); $navbar_font_size = get_option('x_navbar_font_size', 12); if ($stack == 'integrity') { $link_spacing = round(intval($navbar_font_size) * 1.429); $link_letter_spacing = 2; } else { if ($stack == 'renew') { $link_spacing = intval($navbar_font_size); $link_letter_spacing = 1; } else { if ($stack == 'icon') { $link_spacing = 5; $link_letter_spacing = 1; } else { if ($stack == 'ethos') { $link_spacing = get_option('x_ethos_navbar_desktop_link_side_padding'); $link_letter_spacing = 1; } } } } $updated = array('x_navbar_adjust_links_top_spacing' => $link_spacing, 'x_navbar_letter_spacing' => $link_letter_spacing); foreach ($updated as $key => $value) { update_option($key, $value); } } // // If $prior is less than 4.2.0. // if (version_compare($prior, '4.2.0', '<')) { $stack = get_option('x_stack'); $design = get_option('x_integrity_design'); $h_base = (intval(get_option('x_body_font_size', 14)) + intval(get_option('x_content_font_size', 14))) / 2; $h1_font_size = $h_base * 4; $h2_font_size = $h_base * 2.857; $h3_font_size = $h_base * 2.285; $h4_font_size = $h_base * 1.714; $h5_font_size = $h_base * 1.5; $h6_font_size = $h_base * 1; if ($stack == 'integrity' && $design == 'dark') { $logo_font_color = '#ffffff'; $headings_font_color = '#ffffff'; $body_font_color = '#666666'; } else { if ($stack == 'renew') { $logo_font_color = '#ffffff'; $headings_font_color = '#2c3e50'; $body_font_color = '#28323f'; } else { if ($stack == 'icon') { $logo_font_color = '#566471'; $headings_font_color = '#566471'; $body_font_color = '#566471'; } else { if ($stack == 'ethos') { $logo_font_color = '#ffffff'; $headings_font_color = '#333333'; $body_font_color = '#7a7a7a'; } else { $logo_font_color = '#272727'; $headings_font_color = '#272727'; $body_font_color = '#7a7a7a'; } } } } $logo_font_color = get_option('x_logo_font_color_enable') == '1' ? get_option('x_logo_font_color') : $logo_font_color; $headings_font_color = get_option('x_headings_font_color_enable') == '1' ? get_option('x_headings_font_color') : $headings_font_color; $body_font_color = get_option('x_body_font_color_enable') == '1' ? get_option('x_body_font_color') : $body_font_color; $px_to_em_letter_spacing_logo = round(intval(get_option('x_logo_letter_spacing', 1)) / intval(get_option('x_logo_font_size', 54)), 3); $px_to_em_letter_spacing_navbar = round(intval(get_option('x_navbar_letter_spacing', 1)) / intval(get_option('x_navbar_font_size', 12)), 3); $px_to_em_letter_spacing_h1 = round(intval(get_option('x_headings_letter_spacing', 1)) / $h1_font_size, 3); $px_to_em_letter_spacing_h2 = round(intval(get_option('x_headings_letter_spacing', 1)) / $h2_font_size, 3); $px_to_em_letter_spacing_h3 = round(intval(get_option('x_headings_letter_spacing', 1)) / $h3_font_size, 3); $px_to_em_letter_spacing_h4 = round(intval(get_option('x_headings_letter_spacing', 1)) / $h4_font_size, 3); $px_to_em_letter_spacing_h5 = round(intval(get_option('x_headings_letter_spacing', 1)) / $h5_font_size, 3); $px_to_em_letter_spacing_h6 = round(intval(get_option('x_headings_letter_spacing', 1)) / $h6_font_size, 3); $updated = array('x_google_fonts_subsets' => get_option('x_custom_font_subsets'), 'x_google_fonts_subset_cyrillic' => get_option('x_custom_font_subset_cyrillic'), 'x_google_fonts_subset_greek' => get_option('x_custom_font_subset_greek'), 'x_google_fonts_subset_vietnamese' => get_option('x_custom_font_subset_vietnamese'), 'x_logo_font_color' => $logo_font_color, 'x_logo_letter_spacing' => $px_to_em_letter_spacing_logo, 'x_navbar_letter_spacing' => $px_to_em_letter_spacing_navbar, 'x_headings_font_color' => $headings_font_color, 'x_h1_letter_spacing' => $px_to_em_letter_spacing_h1, 'x_h2_letter_spacing' => $px_to_em_letter_spacing_h2, 'x_h3_letter_spacing' => $px_to_em_letter_spacing_h3, 'x_h4_letter_spacing' => $px_to_em_letter_spacing_h4, 'x_h5_letter_spacing' => $px_to_em_letter_spacing_h5, 'x_h6_letter_spacing' => $px_to_em_letter_spacing_h6, 'x_body_font_color' => $body_font_color); foreach ($updated as $key => $value) { update_option($key, $value); } } // // Update stored version number. // update_option('x_version', X_VERSION); // // Turn on the version migration notice. // update_option('x_version_migration_notice', true); // // Bust caches. // x_bust_google_fonts_cache(); } }