theme_name . '_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) { add_filter( $this->theme_name . '_theme_setup_wizard_content', array( $this, 'theme_setup_wizard_content' ) ); add_filter( $this->theme_name . '_theme_setup_wizard_steps', array( $this, 'theme_setup_wizard_steps' ) ); } parent::init_actions(); } public function theme_setup_wizard_steps($steps){ //unset($steps['design']); // this removes the "logo" step return $steps; } public function theme_setup_wizard_content($content){ if($this->is_possible_upgrade()){ array_unshift_assoc($content,'upgrade',array( 'title' => esc_html__( 'Upgrade', 'taskereasy' ), 'description' => esc_html__( 'Upgrade Content and Settings', 'taskereasy' ), 'pending' => esc_html__( 'Pending.', 'taskereasy' ), 'installing' => esc_html__( 'Installing Updates.', 'taskereasy' ), 'success' => esc_html__( 'Success.', 'taskereasy' ), 'install_callback' => array( $this,'_content_install_updates' ), 'checked' => 1 )); } return $content; } public function is_possible_upgrade(){ $widget = get_option('widget_text'); if(is_array($widget)) { foreach($widget as $item){ if(isset($item['dtbwp_widget_bg'])){ return true; } } } // check if shop page is already installed? $shoppage = get_page_by_title( 'Shop' ); if ( $shoppage || get_option( 'page_on_front', false ) ) { return true; } return false; } public function _content_install_updates(){ // replace old line shortcode with new one. global $wpdb; $sql = "UPDATE ".$wpdb->posts." SET post_content = REPLACE ( post_content, 'boutique_line', 'dtbaker_line');"; $wpdb->query($sql); $sql = "UPDATE ".$wpdb->posts." SET post_content = REPLACE ( post_content, 'boutique_banner', 'dtbaker_banner');"; $wpdb->query($sql); $sql = "UPDATE ".$wpdb->posts." SET post_content = REPLACE ( post_content, 'boutique_icon', 'dtbaker_icon');"; $wpdb->query($sql); $sql = "UPDATE ".$wpdb->posts." SET post_content = REPLACE ( post_content, 'google_map', 'dtbaker_google_map');"; $wpdb->query($sql); $widget = get_option('widget_text'); if(is_array($widget)) { foreach ( $widget as $key => $val ) { if ( ! empty( $val['text'] ) ) { $widget[ $key ]['text'] = str_replace( '[dtbaker_icon icon="truck"]', '
', $val['text'] ); } } update_option( 'widget_text', $widget ); } return true; } } dtbwp_Envato_Theme_Setup_Wizard::get_instance(); }else{ // log error? } } endif;