function initalize_theme() { $pages = array(OP_SN, OP_SN . '-setup-wizard'); $reinit_theme = $reinit_page_theme = false; $disable_theme = false; if (isset($_GET['page'])) { if ($_GET['page'] == OP_SN || $_GET['page'] == OP_SN . '-setup-wizard') { $cur = op_get_option('theme', 'dir'); if (isset($_GET['theme_switch']) && $_GET['theme_switch'] != $cur && ($conf = op_load_theme_config($_GET['theme_switch'])) !== false) { $theme = array('name' => $conf['name'], 'screenshot' => $conf['screenshot'], 'screenshot_thumbnail' => $conf['screenshot_thumbnail'], 'description' => $conf['description'], 'dir' => $_GET['theme_switch']); op_update_option('theme', $theme); $reinit_theme = true; } } elseif ($_GET['page'] == OP_SN . '-page-builder') { $disable_theme = true; } } elseif (defined('DOING_AJAX')) { $action = ''; if (!($action = op_get('action'))) { $action = op_post('action'); } $chk = OP_SN . '-live-editor'; if (is_string($action) && substr($action, 0, strlen($chk)) == $chk) { $disable_theme = true; } } if ($disable_theme === false) { op_init_theme(); define('OP_REINIT_THEME', $reinit_theme); if ($reinit_theme) { define('OP_SHOW_THEME_MSG', $cur !== false); do_action(OP_SN . '-reinit_theme'); } } }
function save_theme() { if (isset($_POST['theme_id'])) { if (op_get_option('theme', 'dir') != $_POST['theme_id'] && ($conf = op_load_theme_config($_POST['theme_id'])) !== false) { op_update_option('theme', 'dir', $_POST['theme_id']); wp_redirect(menu_page_url(OP_SN . '-theme-settings', false) . '&theme_switch=' . $_POST['theme_id']); } } }
function save_step_1() { if (isset($_POST['theme_id'])) { $ext = ''; if (op_get_option('theme', 'dir') != $_POST['theme_id'] && ($conf = op_load_theme_config($_POST['theme_id'])) !== false) { $ext .= '&theme_switch=' . $_POST['theme_id']; } wp_redirect(menu_page_url(OP_SN . '-setup-wizard', false) . '&step=2' . $ext); } }