1024, 'm' => 1048576, 'g' => 1073741824, ]; $memory_last_char = substr( $memory, -1 ); if ( array_key_exists( strtolower( $memory_last_char ), $memory_shorthands ) ) { $memory = (int) str_replace( $memory_last_char, '', $memory ) * $memory_shorthands[ strtolower( $memory_last_char ) ]; } if ( 268435456 > $memory ) { wp_raise_memory_limit(); } $time_limit = ini_get( 'max_execution_time' ); if ( 300 > $time_limit && 0 != $time_limit ) { @set_time_limit( 0 ); } } $this->available_languages = Fusion_Multilingual::get_available_languages(); $this->active_language = Fusion_Multilingual::get_active_language(); $this->default_language = Fusion_Multilingual::get_default_language(); // If English is used then make this first in array order. Also set starting language so that it is migrated first. if ( in_array( 'en', $this->available_languages ) ) { $en_array = [ 'en' ]; $en_key = array_search( 'en', $this->available_languages ); $available_languages_no_en = $this->available_languages; unset( $available_languages_no_en[ $en_key ] ); $this->available_languages = array_merge( $en_array, $available_languages_no_en ); $this->starting_language = 'en'; } else { // If not English then make default language first in array order. Also set it to be starting language for migration. $default_array = [ $this->default_language ]; $default_key = array_search( $this->default_language, $this->available_languages ); $available_languages_no_default = $this->available_languages; unset( $available_languages_no_default[ $default_key ] ); $this->available_languages = array_merge( $default_array, $available_languages_no_default ); $this->starting_language = $this->default_language; } if ( $_GET && isset( $_GET['avada_update'] ) ) { // Only continue if the URL is ?avada_update=1. if ( '1' != $_GET['avada_update'] ) { return; } // Only continue if we're updating to version 4.0.0. if ( ! isset( $_GET['ver'] ) || ( $this->version != $_GET['ver'] ) ) { return; } // Get the current step. if ( ! isset( $_GET['step'] ) ) { $this->step = 0; } else { $this->step = intval( $_GET['step'] ); } if ( isset( $_GET['proceed'] ) && '0' == $_GET['proceed'] ) { $this->proceed = false; } $_get_lang = ( isset( $_GET['lang'] ) ) ? sanitize_text_field( wp_unslash( $_GET['lang'] ) ) : ''; if ( isset( $_GET['lang'] ) && ! in_array( $_get_lang, [ '', 'en', 'all', null ] ) ) { Fusion_Multilingual::set_active_language( $_get_lang ); } $this->options = get_option( Avada::get_option_name(), [] ); $this->fields = Avada_Options::get_option_fields(); add_action( 'admin_init', [ $this, 'migrate_page' ] ); } } /** * The migration page. * * @access public */ public function migrate_page() { ob_start(); $this->setup_wizard_template(); if ( isset( $this->steps[ $this->step ] ) && isset( $this->steps[ $this->step ]['callback'] ) ) { call_user_func( $this->steps[ $this->step ]['callback'] ); } // Make sure we have not finished. if ( $this->step >= count( $this->steps ) - 1 ) { if ( empty( $this->available_languages ) || count( $this->available_languages ) == array_search( $this->active_language, $this->available_languages ) + 1 ) { $this->finished(); } } exit; } /** * Output the content for the current step. */ public function setup_wizard_template() { $current_step = intval( $this->step ); ?> >
available_languages ) ); ?>
steps ) && isset( $this->steps[ $this->step ] ) ) : ?>step + 1 ), count( $this->steps ) ); ?>