| @@ -10,12 +10,21 @@ | ||
| 10 | 10 | if ( is_admin() ) { |
| 11 | 11 | add_action( 'admin_menu', array( $this, 'app_menu' ) ); |
| 12 | 12 | |
| 13 | 13 | // Load the scripts only if they are needed by the current screen |
| 14 | - $page = isset( $_GET["page"] ) ? sanitize_text_field( $_GET["page"] ) : null; | |
| 15 | - $is_mwcode_screen = in_array( $page, [ 'mwcode_settings' ] ); | |
| 16 | - $is_meowapps_dashboard = $page === 'meowapps-main-menu'; | |
| 17 | - if ( $is_meowapps_dashboard || $is_mwcode_screen ) { | |
| 14 | + // $page = isset( $_GET["page"] ) ? sanitize_text_field( $_GET["page"] ) : null; | |
| 15 | + // $is_mwcode_screen = in_array( $page, [ 'mwcode_settings' ] ); | |
| 16 | + // $is_meowapps_dashboard = $page === 'meowapps-main-menu'; | |
| 17 | + | |
| 18 | + | |
| 19 | + // if ( $is_meowapps_dashboard || $is_mwcode_screen ) { | |
| 20 | + // add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); | |
| 21 | + // } | |
| 22 | + | |
| 23 | + $can_access_settings = $this->core->can_access_settings(); | |
| 24 | + $can_access_features = $this->core->can_access_features(); | |
| 25 | + | |
| 26 | + if ( $can_access_settings || $can_access_features ) { | |
| 18 | 27 | add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
| 19 | 28 | } |
| 20 | 29 | } |
| 21 | 30 | } |