@@ -328,6 +328,8 @@ private function init() {
328328
329329 // phpcs:ignore WordPress.NamingConventions.ValidHookName
330330 self ::$ upload_url = apply_filters ( 'redux/upload_url ' , self ::$ upload_url );
331+
332+ self ::load_template_libraries ();
331333 }
332334
333335 /**
@@ -343,6 +345,28 @@ public static function core_construct( $parent, array $args ) {
343345
344346 }
345347
348+ /**
349+ * Load Redux and Extendify template libraries.
350+ *
351+ * @return void
352+ */
353+ private static function load_template_libraries (){
354+ self ::$ redux_templates_enabled = (bool ) get_option ( 'use_redux_templates ' );
355+ self ::$ extendify_templates_enabled = (bool ) get_option ( 'use_extendify_templates ' , true );
356+
357+ // Including extendify sdk.
358+ if ( true === (bool ) get_option ( 'use_extendify_templates ' , true ) ) {
359+ if ( file_exists ( dirname ( __FILE__ ) . '/extendify-sdk/loader.php ' ) ) {
360+ $ GLOBALS ['extendifySdkSourcePlugin ' ] = 'Redux ' ;
361+ require_once dirname ( __FILE__ ) . '/extendify-sdk/loader.php ' ;
362+ }
363+ }
364+
365+ if ( file_exists ( dirname ( __FILE__ ) . '/redux-templates/redux-templates.php ' ) ) {
366+ require_once dirname ( __FILE__ ) . '/redux-templates/redux-templates.php ' ;
367+ }
368+ }
369+
346370 /**
347371 * Autoregister run.
348372 *
@@ -353,9 +377,6 @@ private function includes() {
353377 self ::$ pro_loaded = true ;
354378 }
355379
356- self ::$ redux_templates_enabled = (bool ) get_option ( 'use_redux_templates ' );
357- self ::$ extendify_templates_enabled = (bool ) get_option ( 'use_extendify_templates ' , true );
358-
359380 require_once dirname ( __FILE__ ) . '/inc/classes/class-redux-path.php ' ;
360381 require_once dirname ( __FILE__ ) . '/inc/classes/class-redux-functions-ex.php ' ;
361382 require_once dirname ( __FILE__ ) . '/inc/classes/class-redux-helpers.php ' ;
@@ -368,18 +389,6 @@ private function includes() {
368389 self ::$ welcome = new Redux_Welcome ();
369390 new Redux_Rest_Api_Builder ( $ this );
370391
371- // Including extendify sdk.
372- if ( true === (bool ) get_option ( 'use_extendify_templates ' , true ) ) {
373- if ( file_exists ( dirname ( __FILE__ ) . '/extendify-sdk/loader.php ' ) ) {
374- $ GLOBALS ['extendifySdkSourcePlugin ' ] = 'Redux ' ;
375- require_once dirname ( __FILE__ ) . '/extendify-sdk/loader.php ' ;
376- }
377- }
378-
379- if ( file_exists ( dirname ( __FILE__ ) . '/redux-templates/redux-templates.php ' ) ) {
380- require_once dirname ( __FILE__ ) . '/redux-templates/redux-templates.php ' ;
381- }
382-
383392 add_action ( 'admin_init ' , array ( $ this , 'admin_init ' ) );
384393
385394 add_filter ( 'debug_information ' , array ( $ this , 'add_debug_info ' ) );
0 commit comments