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