
if ( !class_exists( "ReduxFramework" ) ) {
	return;
}

if ( !class_exists( "Redux_Framework_{{opt_name}}_{{uuid}}" ) ) {
	class Redux_Framework_{{opt_name}}_{{uuid}} {
		public function __construct( ) {

			// Your base config file for Redux
			add_action( 'after_setup_theme', array($this, 'loadConfig') );
			
			// Data migration
			{{^migrate_data}}//{{/migrate_data}}add_action("after_switch_theme", array($this, "migrate_old_data"), 10 ,  2);	
			
		}

		public function loadConfig() {

			$sections = {{sections}};

			// Change your opt_name to match where you want the data saved.
			$args = array(
				"opt_name"=>"{{opt_name}}", // Where your data is stored. Use a different name or use the same name as your current theme. Must match the $database_newName variable in the converter code.
				{{^menu_title}}//{{/menu_title}}"menu_title" => "{{menu_title}}", // Title for your menu item
				"page_slug" => "{{opt_name}}", // Make this the same as your opt_name unless you care otherwise
				{{^global_variable}}//{{/global_variable}}"global_variable" => "{{global_variable}}", // By default Redux sets your global variable to be the opt_name you set above. This is what the newest SMOF uses as it's variable name. You can change, but you may need to update your files.
				//"intro_text" => "<p>This theme is now using Redux</p>" // Extra header info
				{{^google_api_key}}//{{/google_api_key}}"google_api_key" => "{{google_api_key}}", // You must acquire a Google Web Fonts API key if you want Google Fonts to work
			);
			// Use this section if this is for a theme. Replace with plugin specific data if it is for a plugin.
			$theme = wp_get_theme();
			$args["display_name"] = $theme->get("Name");
			$args["display_version"] = $theme->get("Version");

			$ReduxFramework = new ReduxFramework($sections, $args);
						
		}

		function migrate_old_data($oldname, $oldtheme=false) {
			$database_newName = "{{opt_name}}"; // Where your data will now be saved. Must match your opt_name in the ReduxFramework $args array.
			$this->convertDataClass = new {{framework}}2Redux_Data();
			$this->convertDataClass->init();
			update_option($database_newName, $this->convertDataClass->converted_data); // Update the database				
		}
				
	}
	new Redux_Framework_{{opt_name}}_{{uuid}}();
}


{{#migrate_data}}
{{migrate_data_class}}
{{/migrate_data}}