PluginProbe
Meow Gallery / 4.2.2
Meow Gallery v4.2.2
5.5.5 5.5.4 5.5.3 5.5.2 5.5.1 5.5.0 5.4.9 5.4.8 5.4.7 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 All 157 releases
← All changes | classes/admin.php +6 -15 4.2.9 → 4.2.2 View file →
@@ -1,26 +1,18 @@
1 1 <?php
2 2
3 3 class Meow_MGL_Admin extends MeowCommon_Admin {
4 4
5 - private $core;
6 - public function __construct($core) {
5 + public function __construct() {
7 6 parent::__construct( MGL_PREFIX, MGL_ENTRY, MGL_DOMAIN, class_exists( 'MeowPro_MGL_Core' ) );
8 - $this->core = $core;
9 7 add_action( 'admin_menu', array( $this, 'app_menu' ) );
10 8 $blocks_enabled = function_exists( 'register_block_type' );
11 9 if ( $blocks_enabled ) {
12 10 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
13 11 }
14 - $options = $this->core->get_all_options();
15 - if ( ( $options['captions'] ?? 'notset' ) === 'notset' ) {
16 - // MEOMO: mgl_captions_enabled option is used only here. Also, it deletes soon after being used.
17 - // So we keep this option what it is (not migrated to the mgl_options).
12 + if ( get_option( 'mgl_captions', 'notset' ) === 'notset' ) {
18 13 $captions_enabled = get_option( 'mgl_captions_enabled' );
19 - $this->core->update_options( array_merge(
20 - $options,
21 - [ 'captions' => $captions_enabled ? 'hover-only' : false ]
22 - ) );
14 + update_option( 'mgl_captions', $captions_enabled ? 'hover-only' : false );
23 15 delete_option( 'mgl_captions_enabled' );
24 16 }
25 17 }
26 18
@@ -33,9 +25,9 @@
33 25 // Javascript for gallery
34 26 $physical_file = MGL_PATH . '/app/galleries.js';
35 27 $cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : MGL_VERSION;
36 28 wp_register_script( 'mgl-gallery-js', plugins_url( '/app/galleries.js', __DIR__ ),
37 - array(), $cache_buster, false );
29 + array( 'jquery' ), $cache_buster, false );
38 30
39 31 // Load the "admin" scripts
40 32 $physical_file = MGL_PATH . '/app/admin.js';
41 33 $cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : MGL_VERSION;
@@ -48,9 +40,9 @@
48 40 wp_enqueue_style( 'meow-neko-ui-lato-font' );
49 41
50 42 // Localize and options
51 43 global $wplr;
52 - wp_localize_script( 'mgl-admin-js', 'mgl_meow_gallery', [
44 + wp_localize_script( 'mgl-admin-js', 'mgl_meow_gallery', array_merge( [
53 45 //'api_nonce' => wp_create_nonce( 'mfrh_media_file_renamer' ),
54 46 'api_url' => get_rest_url( null, '/meow-gallery/v1/' ),
55 47 'rest_url' => get_rest_url(),
56 48 'plugin_url' => MGL_URL,
@@ -59,10 +51,9 @@
59 51 'is_pro' => class_exists( 'MeowPro_MGL_Core' ),
60 52 'is_registered' => !!$this->is_registered(),
61 53 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
62 54 'wplr_collections' => $wplr ? $wplr->read_collections_recursively() : [],
63 - 'options' => $this->core->get_all_options(),
64 - ] );
55 + ] ) );
65 56
66 57 wp_enqueue_script( 'mgl-admin-js' );
67 58 }
68 59