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.9.7 6.9.8 6.9.9 7.0.0 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.0.6 7.0.7
media-cleaner / classes / admin.php
media-cleaner / classes Last commit date
parsers 1 month ago admin.php 1 month ago buffers.php 2 weeks ago core.php 2 weeks ago engine.php 1 month ago init.php 9 months ago mcp.php 1 month ago parsers.php 1 month ago rest.php 2 weeks ago runs.php 1 month ago support.php 1 month ago ui.php 1 month ago
admin.php
89 lines
1 <?php
2
3 class Meow_WPMC_Admin extends MeowKit_WPMC_Admin {
4
5 private $core = null;
6
7 public function __construct( $core ) {
8 $this->core = $core;
9 parent::__construct( WPMC_PREFIX, WPMC_ENTRY, WPMC_DOMAIN, class_exists( 'MeowPro_WPMC_Core' ) );
10 add_action( 'admin_menu', array( $this, 'app_menu' ) );
11
12 // Load the scripts only if they are needed by the current screen
13 $page = isset( $_GET["page"] ) ? sanitize_text_field( $_GET["page"] ) : null;
14 $is_wpmc_screen = in_array( $page, [ 'wpmc_dashboard', 'wpmc_settings' ] );
15 $is_meowapps_dashboard = $page === 'meowapps-main-menu';
16 if ( $is_meowapps_dashboard || $is_wpmc_screen ) {
17 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
18 }
19 }
20
21 function admin_enqueue_scripts() {
22
23 // Load the scripts
24 $physical_file = WPMC_PATH . '/app/index.js';
25 $cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : WPMC_VERSION;
26 wp_register_script( 'wpmc_media_cleaner-vendor', WPMC_URL . 'app/vendor.js',
27 ['wp-element', 'wp-i18n'], $cache_buster
28 );
29 wp_register_script( 'wpmc_media_cleaner', WPMC_URL . 'app/index.js',
30 ['wpmc_media_cleaner-vendor', 'wp-i18n'], $cache_buster
31 );
32 if ( function_exists( 'wp_set_script_translations' ) ) {
33 wp_set_script_translations( 'wpmc_media_cleaner', 'media-cleaner' );
34 }
35 wp_enqueue_script('wpmc_media_cleaner' );
36
37 // Load the fonts
38 wp_register_style( 'meow-neko-ui-lato-font', '//fonts.googleapis.com/css2?family=Lato:wght@100;300;400;700;900&display=swap');
39 wp_enqueue_style( 'meow-neko-ui-lato-font' );
40
41 // Options
42 $options = array_merge( $this->core->get_all_options(), [
43 'incompatible_plugins' => Meow_WPMC_Support::get_issues(),
44 'native_plugins' => Meow_WPMC_Support::get_natives(),
45 'scan_progress' => $this->core->get_progress(),
46 ] );
47
48 // Localize and options
49 wp_localize_script( 'wpmc_media_cleaner', 'wpmc_media_cleaner', [
50 'api_url' => rest_url( 'media-cleaner/v1' ),
51 'rest_url' => rest_url(),
52 'admin_url' => admin_url(),
53 'plugin_url' => WPMC_URL,
54 'prefix' => WPMC_PREFIX,
55 'domain' => WPMC_DOMAIN,
56 'is_pro' => class_exists( 'MeowPro_WPMC_Core' ),
57 'is_registered' => !!$this->is_registered(),
58 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
59 'cleanup_allowed' => $this->core->runs ? $this->core->runs->cleanup_allowed() : false,
60 'cleanup_status' => $this->core->runs ? $this->core->runs->cleanup_status() : null,
61 'schema_ready' => $this->core->runs ? $this->core->runs->tables_exist() : false,
62 'options' => $options
63 ] );
64 }
65
66 function app_menu() {
67 if ( !$this->core->can_access_settings() ) {
68 return;
69 }
70 add_submenu_page( 'meowapps-main-menu', 'Media Cleaner', 'Media Cleaner', 'read', 'wpmc_settings',
71 array( $this, 'admin_settings' )
72 );
73 }
74
75 public function admin_settings() {
76 if ( !$this->core->can_access_settings() ) {
77 return;
78 }
79 echo '<div id="wpmc-admin-settings"></div>';
80 }
81
82 function is_pro_user() {
83 return class_exists( 'MeowPro_WPMC_Core' ) && !!$this->is_registered();
84 }
85
86 }
87
88 ?>
89