includes(); add_action('admin_menu', array($this, 'add_ocean_wizard_menu')); add_action('admin_init', array($this, 'ocean_wizard_setup'), 99); add_action('wp_loaded', array($this, 'remove_notice')); add_action('admin_print_styles', array($this, 'add_notice')); add_action("add_second_notice", array($this, "install")); } public static function install() { if (!get_option("owp_wizard")) { update_option("owp_wizard", "un-setup"); (wp_safe_redirect(admin_url('admin.php?page=owp_setup'))); } else{ // first run for automatic message after first 24 hour if (!get_option("automatic_2nd_notice")) { update_option("automatic_2nd_notice", "second-time"); } else { // clear cronjob after second 24 hour wp_clear_scheduled_hook('add_second_notice'); delete_option("automatic_2nd_notice"); delete_option("2nd_notice"); delete_option("owp_wizard"); wp_safe_redirect(admin_url()); exit; } } } // clear cronjob when deactivate plugin public static function uninstall() { wp_clear_scheduled_hook('add_second_notice'); delete_option("automatic_2nd_notice"); delete_option("2nd_notice"); delete_option("owp_wizard"); } public function remove_notice() { if (isset($_GET['owp_wizard_hide_notice']) && $_GET['owp_wizard_hide_notice'] == "install") { // WPCS: input var ok, CSRF ok. // when finish install delete_option("owp_wizard"); //clear cronjob when finish install wp_clear_scheduled_hook('add_second_notice'); delete_option("2nd_notice"); if (isset($_GET['show'])) { wp_safe_redirect(home_url()); exit; } } else if(isset($_GET['owp_wizard_hide_notice']) && $_GET['owp_wizard_hide_notice'] == "2nd_notice") { // WPCS: input var ok, CSRF ok. //when skip install delete_option("owp_wizard"); if (!get_option("2nd_notice")) { update_option("2nd_notice", "second-time"); $timezone_string = get_option( 'timezone_string' ); if ( ! $timezone_string ) { return false; } date_default_timezone_set($timezone_string); // set time for next day $new_time_format = time() + (24 * 60 * 60 ); //add "add_second_notice" cronjob if (!wp_next_scheduled('add_second_notice')) { wp_schedule_event($new_time_format, 'daily', 'add_second_notice'); } } else { //clear cronjob when skip for second time wp_clear_scheduled_hook('add_second_notice'); } if(isset($_GET['show'])){ wp_safe_redirect(home_url()); exit; } else { wp_safe_redirect(admin_url()); exit; } } } public function add_notice() { if ((get_option("owp_wizard") == "un-setup") && (empty($_GET['page']) || 'owp_setup' !== $_GET['page'])) { if (!get_option("2nd_notice")&&!get_option("automatic_2nd_notice")) {?>

Welcome to OceanWP - Are you ready to create an amazing website?', 'ocean-extra'); ?>

array( 'name' => __('Welcome', 'ocean-extra'), 'view' => array($this, 'ocean_welcome'), ), 'demo' => array( 'name' => __('Choosing Demo', 'ocean-extra'), 'view' => array($this, 'ocean_demo_setup'), ), 'customize' => array( 'name' => __('Customize', 'ocean-extra'), 'view' => array($this, 'ocean_customize_setup'), ), 'ready' => array( 'name' => __('Ready', 'ocean-extra'), 'view' => array($this, 'ocean_ready_setup'), ) ); $this->steps = apply_filters('owp_setup_wizard_steps', $default_steps); $this->step = isset($_GET['step']) ? sanitize_key($_GET['step']) : current(array_keys($this->steps)); // WPCS: CSRF ok, input var ok. // CSS wp_enqueue_style('owp-wizard-style', plugins_url('/assets/css/style.min.css', __FILE__)); // RTL if (is_RTL()) { wp_enqueue_style('owp-wizard-rtl', plugins_url('/assets/css/rtl.min.css', __FILE__)); } // JS wp_enqueue_script('owp-wizard-js', plugins_url('/assets/js/wizard.min.js', __FILE__), array('jquery', 'wp-util', 'updates')); wp_localize_script('owp-wizard-js', 'owpDemos', array( 'ajaxurl' => admin_url('admin-ajax.php'), 'demo_data_nonce' => wp_create_nonce('get-demo-data'), 'owp_import_data_nonce' => wp_create_nonce('owp_import_data_nonce'), 'content_importing_error' => esc_html__('There was a problem during the importing process resulting in the following error from your server:', 'ocean-extra'), 'button_activating' => esc_html__('Activating', 'ocean-extra') . '…', 'button_active' => esc_html__('Active', 'ocean-extra'), )); global $current_screen, $hook_suffix, $wp_locale; if (empty($current_screen)) set_current_screen(); $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix); ob_start(); ?> > <?php esc_html_e('OceanWP › Setup Wizard', 'ocean-extra'); ?> step == 'demo' || $this->step == "welcome" || $this->step == 'customize') { wp_print_styles('themes'); wp_print_styles('buttons'); wp_print_styles('dashboard'); wp_print_styles('common'); } if ($this->step == 'customize') { wp_print_styles('media'); wp_enqueue_media(); wp_enqueue_style('wp-color-picker'); wp_enqueue_script('wp-color-picker'); } //add admin styles do_action('admin_print_styles'); do_action('admin_head'); ?> OceanWP'); ?> setup_wizard_steps(); $this->setup_wizard_content(); _wp_footer_scripts(); do_action('admin_footer'); ?> steps; ?>
    $step) { $is_completed = array_search($this->step, array_keys($this->steps), true) > array_search($step_key, array_keys($this->steps), true); if ($step_key === $this->step) { ?>
'; if (!empty($this->steps[$this->step]['view'])) { call_user_func($this->steps[$this->step]['view'], $this); } echo ''; } /** * Get Next Step * @param type $step * @return string */ public function get_next_step_link($step = '') { if (!$step) { $step = $this->step; } $keys = array_keys($this->steps); if (end($keys) === $step) { return admin_url(); } $step_index = array_search($step, $keys, true); if (false === $step_index) { return ''; } return add_query_arg('step', $keys[$step_index + 1], remove_query_arg('activate_error')); } /** * Get Previous Step * @param type $step * @return string */ public function get_previous_step_link($step = '') { if (!$step) { $step = $this->step; } $keys = array_keys($this->steps); $step_index = array_search($step, $keys, true); if (false === $step_index) { return ''; } $url = FALSE; if (isset($keys[$step_index - 1])) { $url = add_query_arg('step', $keys[$step_index - 1], remove_query_arg('activate_error')); } return $url; } /** * Helper method to retrieve the current user's email address. * * @return string Email address */ protected function get_current_user_email() { $current_user = wp_get_current_user(); $user_email = $current_user->user_email; return $user_email; } /** * Step 1 Welcome */ public function ocean_welcome() { // Image $img = plugins_url('/assets/img/jack.png', __FILE__); // Button icon if (is_RTL()) { $icon = 'left'; } else { $icon = 'right'; } ?>

Jack the Shark

', '' ); ?>

$key) { // Vars $item_categories = OceanWP_Demos::get_demo_item_categories($key); ?>

save_ocean_customize(); } // Button icon if (is_RTL()) { $icon = 'left'; } else { $icon = 'right'; } ?>

">

">

">

">

">

">

">
get_next_step_link()); exit; }else { print 'Your are not authorized to submit this form'; exit; } } /** * Step 4 ready step */ public function ocean_ready_setup() { $user_email = $this->get_current_user_email(); ?>

', '', '', '' ); ?>