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/run.php +3 -18 4.2.7 → 4.2.2 View file →
@@ -1,35 +1,21 @@
1 1 <?php
2 2
3 3 class Meow_MGL_Run {
4 - private $isEnqueued = false;
5 4
6 5 public function __construct( $core ) {
6 + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
7 + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
7 8 add_shortcode( 'gallery', array( $core, 'gallery' ) );
8 9 add_shortcode( 'meow-gallery', array( $core, 'gallery' ) );
9 -
10 - if ( is_admin() ) {
11 - add_action( 'init', array( $this, 'enqueue_scripts' ) );
12 - }
13 - else {
14 - add_action( 'mgl_gallery_created', array( $this, 'enqueue_scripts' ), 10, 0 );
15 - }
16 -
17 10 // Yoast: Some people really want this, but it needs to be reviewed as Yoast changed its API
18 11 //add_filter( 'wpseo_sitemap_urlimages', array( $this, 'wpseo_siteimap' ), 10, 2 );
19 12 }
20 13
21 14 function enqueue_scripts() {
22 - // Only need to load the scripts once.
23 - if ( $this->isEnqueued ) {
24 - return;
25 - }
26 - $this->isEnqueued = true;
27 -
28 - // Load the JS for Meow Gallery
29 15 $physical_file = MGL_PATH . '/app/galleries.js';
30 16 $cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : MGL_VERSION;
31 - wp_enqueue_script( 'mgl-js', plugins_url( '/app/galleries.js', __DIR__ ), array(), $cache_buster, true );
17 + wp_enqueue_script( 'mgl-js', plugins_url( '/app/galleries.js', __DIR__ ), array( 'jquery' ), $cache_buster, false );
32 18
33 19 // TODO: This should be moved in a getter (since it is also used by tiles.php)
34 20 $density = [];
35 21 if ( isset( $this->atts['density'] ) ) {
@@ -44,9 +30,8 @@
44 30 }
45 31
46 32 wp_localize_script('mgl-js', 'mgl_settings',
47 33 array(
48 - 'infinite_buffer' => get_option( 'mgl_infinite_buffer', 0 ),
49 34 'disable_right_click' => !get_option( 'mgl_right_click', false ),
50 35 'tiles' => array( 'density' => $density )
51 36 )
52 37 );