@@ -82,25 +82,27 @@ public function __construct( $args = array() ) {
8282 ) ) );
8383
8484 //** Set available screens */
85- $ screens = array ();
86- if ( $ this ->type == 'theme ' ) {
87- $ screens =array_filter ( array (
88- 'licenses ' => __ ( 'License ' , $ this ->domain ),
89- 'more_products ' => false ,
90- ) );
91- } elseif ( $ this ->type == 'plugin ' ) {
92- $ screens =array_filter ( array (
93- 'licenses ' => __ ( 'Licenses ' , $ this ->domain ),
94- 'more_products ' => __ ( 'More Products ' , $ this ->domain ),
95- ) );
96- }
97-
98- //** UI */
99- $ this ->ui = new UI ( array_merge ( $ args , array (
100- 'token ' => $ this ->token ,
101- 'screens ' => $ screens ,
102- ) ) );
103-
85+ add_action ('init ' , function () use ($ args ) {
86+ $ screens = array ();
87+ if ( $ this ->type == 'theme ' ) {
88+ $ screens =array_filter ( array (
89+ 'licenses ' => __ ( 'License ' , $ this ->domain ),
90+ 'more_products ' => false ,
91+ ) );
92+ } elseif ( $ this ->type == 'plugin ' ) {
93+ $ screens =array_filter ( array (
94+ 'licenses ' => __ ( 'Licenses ' , $ this ->domain ),
95+ 'more_products ' => __ ( 'More Products ' , $ this ->domain ),
96+ ) );
97+ }
98+
99+ // Initialize UI
100+ $ this ->ui = new UI ( array_merge ( $ args , array (
101+ 'token ' => $ this ->token ,
102+ 'screens ' => $ screens ,
103+ ) ) );
104+ }, 20 );
105+
104106 $ path = wp_normalize_path ( dirname ( dirname ( __DIR__ ) ) );
105107 $ this ->screens_path = trailingslashit ( $ path . '/static/templates ' );
106108 if ( $ this ->type == 'theme ' && strpos ( $ path , wp_normalize_path ( WP_PLUGIN_DIR ) ) === false ) {
0 commit comments