| @@ -21,9 +21,8 @@ | ||
| 21 | 21 | abstract function inline_css(); |
| 22 | 22 | |
| 23 | 23 | public function __construct( $atts, $infinite, $isPreview = false ) { |
| 24 | 24 | $wpUploadDir = wp_upload_dir(); |
| 25 | - $options = get_option( Meow_MGL_Core::get_plugin_option_name(), null ); | |
| 26 | 25 | $this->id = uniqid(); |
| 27 | 26 | $this->size = isset( $atts['size'] ) ? $atts['size'] : $this->size; |
| 28 | 27 | $this->size = apply_filters( 'mgl_media_size', $this->size ); |
| 29 | 28 | $this->infinite = $infinite; |
| @@ -33,14 +32,14 @@ | ||
| 33 | 32 | $this->align = isset( $atts['align'] ) ? $atts['align'] : $this->align; |
| 34 | 33 | $this->isPreview = $isPreview; |
| 35 | 34 | $this->class_id = 'mgl-gallery-' . $this->id; |
| 36 | 35 | $this->updir = trailingslashit( $wpUploadDir['baseurl'] ); |
| 37 | - $this->captions = isset( $atts['captions'] ) ? $atts['captions'] : ( $options['captions'] ?? 'none' ); | |
| 36 | + $this->captions = isset( $atts['captions'] ) ? $atts['captions'] : get_option( 'mgl_captions', 'none' ); | |
| 38 | 37 | $this->animation = null; |
| 39 | 38 | if ( isset( $atts['animation'] ) && $atts['animation'] != 'default' ) |
| 40 | 39 | $this->animation = $atts['animation']; |
| 41 | 40 | else |
| 42 | - $this->animation = $options['animation'] ?? null; | |
| 41 | + $this->animation = get_option( 'mgl_animation', null ); | |
| 43 | 42 | } |
| 44 | 43 | |
| 45 | 44 | function build_inline_attributes( $id, $data ) { |
| 46 | 45 | return ''; |
| @@ -76,22 +75,20 @@ | ||
| 76 | 75 | $src = $this->updir . $data['meta']['file']; |
| 77 | 76 | $data['caption'] = apply_filters( 'mgl_caption', $data['caption'], $id ); |
| 78 | 77 | $caption = $this->captions ? $data['caption'] : ''; |
| 79 | 78 | |
| 80 | - $image_size = Meow_MGL_Core::get_plugin_option( 'image_size', 'srcset' ); | |
| 79 | + $image_size = get_option( 'mgl_image_size', 'srcset' ); | |
| 81 | 80 | $imgSrc = null; |
| 82 | 81 | if ( empty( $image_size ) || $image_size === 'srcset' ) { |
| 83 | 82 | $imgSrc = wp_get_attachment_image( $id, $this->size, false, |
| 84 | - $this->layout === 'carousel' ? | |
| 85 | - [ 'class' => 'skip-lazy' ] : | |
| 86 | - [ 'class' => 'wp-image-' . $id ], | |
| 87 | - ); | |
| 83 | + $this->layout === 'carousel' ? array( 'class' => 'skip-lazy' ) : array( 'class' => 'wp-image-' . $id ) ); | |
| 88 | 84 | } |
| 89 | 85 | else { |
| 90 | 86 | $info = wp_get_attachment_image_src( $id, $image_size ); |
| 91 | - $imgSrc = '<img loading="lazy" src="' . $info[0] . '" class="' . | |
| 87 | + $imgSrc = '<img src="' . $info[0] . '" class="' . | |
| 92 | 88 | ( $this->layout === 'carousel' ? 'skip-lazy' : ( 'wp-image-' . $id ) ) . '" />'; |
| 93 | 89 | } |
| 90 | + | |
| 94 | 91 | $attributes = $this->build_inline_attributes( $id, $data ); |
| 95 | 92 | if ( !empty( $attributes ) ) { |
| 96 | 93 | $attributes = ' ' . $attributes; |
| 97 | 94 | } |