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")) {?>
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(); ?> >