PluginProbe
Meow Gallery / 5.5.5
Meow Gallery v5.5.5
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 +7 -39 5.4.85.5.5 View file →
@@ -9,9 +9,9 @@
9 9 $this->core = $core;
10 10 add_action( 'admin_menu', array( $this, 'app_menu' ) );
11 11 $blocks_enabled = function_exists( 'register_block_type' );
12 12 if ( $blocks_enabled ) {
13 - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
13 + add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
14 14 }
15 15 $options = $this->core->get_all_options();
16 16 if ( ( $options['captions'] ?? 'notset' ) === 'notset' ) {
17 17 // MEOMO: mgl_captions_enabled option is used only here. Also, it deletes soon after being used.
@@ -28,46 +28,14 @@
28 28 public function mgl_settings() {
29 29 echo '<div id="mgl-admin-settings"></div>';
30 30 }
31 31
32 - function enqueue_scripts() {
33 -
34 - // Javascript for gallery
35 - $physical_file = MGL_PATH . '/app/galleries.js';
36 - $cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : MGL_VERSION;
37 - wp_register_script( 'mgl-gallery-js', plugins_url( '/app/galleries.js', __DIR__ ),
38 - array(), $cache_buster, false );
39 -
40 - // Load the "admin" scripts
41 - $physical_file = MGL_PATH . '/app/admin.js';
42 - $cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : MGL_VERSION;
43 - wp_register_script( 'mgl-admin-js', MGL_URL . '/app/admin.js',
44 - array( 'mgl-gallery-js', 'wp-editor', 'wp-i18n', 'wp-element' ), $cache_buster );
45 - register_block_type( 'meow-gallery/gallery', array( 'editor_script' => 'mgl-admin-js' ));
46 -
47 - // Load the fonts
48 - wp_register_style( 'meow-neko-ui-lato-font', '//fonts.googleapis.com/css2?family=Lato:wght@100;300;400;700;900&display=swap');
49 - wp_enqueue_style( 'meow-neko-ui-lato-font' );
50 -
51 - // Localize and options
52 - global $wplr;
53 - wp_localize_script( 'mgl-admin-js', 'mgl_meow_gallery', [
54 - //'api_nonce' => wp_create_nonce( 'mfrh_media_file_renamer' ),
55 - 'api_url' => get_rest_url( null, '/meow-gallery/v1/' ),
56 - 'rest_url' => get_rest_url(),
57 - 'plugin_url' => MGL_URL,
58 - 'prefix' => MGL_PREFIX,
59 - 'domain' => MGL_DOMAIN,
60 - 'is_pro' => class_exists( 'MeowPro_MGL_Core' ),
61 - 'is_registered' => !!$this->is_registered(),
62 - 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
63 - '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 - ] );
68 -
69 - wp_enqueue_script( 'mgl-admin-js' );
32 + // The scripts and styles are all handled by Meow_MGL_Run; the block only needs to point at
33 + // the admin bundle it registers.
34 + function register_block() {
35 + register_block_type( 'meow-gallery/gallery', array(
36 + 'editor_script' => Meow_MGL_Run::ADMIN_SCRIPT_HANDLE,
37 + ) );
70 38 }
71 39
72 40 function app_menu() {
73 41 add_submenu_page( 'meowapps-main-menu', __( 'Gallery', MGL_DOMAIN ), __( 'Gallery', MGL_DOMAIN ),