| @@ -1,8 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Utils\Hints; | |
| 5 | 4 | use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 6 | 5 | |
| 7 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 7 | exit; // Exit if accessed directly. |
| @@ -31,18 +30,8 @@ | ||
| 31 | 30 | public function get_type() { |
| 32 | 31 | return 'gallery'; |
| 33 | 32 | } |
| 34 | 33 | |
| 35 | - public function on_export( $settings ) { | |
| 36 | - foreach ( $settings as $attachment ) { | |
| 37 | - if ( ! empty( $attachment['url'] ) ) { | |
| 38 | - do_action( 'elementor/templates/collect_media_url', $attachment['url'], $attachment ); | |
| 39 | - } | |
| 40 | - } | |
| 41 | - | |
| 42 | - return $settings; | |
| 43 | - } | |
| 44 | - | |
| 45 | 34 | /** |
| 46 | 35 | * Import gallery images. |
| 47 | 36 | * |
| 48 | 37 | * Used to import gallery control files from external sites while importing |
| @@ -50,9 +39,9 @@ | ||
| 50 | 39 | * |
| 51 | 40 | * @since 1.0.0 |
| 52 | 41 | * @access public |
| 53 | 42 | * |
| 54 | - * @param array $settings Control settings. | |
| 43 | + * @param array $settings Control settings | |
| 55 | 44 | * |
| 56 | 45 | * @return array Control settings. |
| 57 | 46 | */ |
| 58 | 47 | public function on_import( $settings ) { |
| @@ -60,20 +49,9 @@ | ||
| 60 | 49 | if ( empty( $attachment['url'] ) ) { |
| 61 | 50 | continue; |
| 62 | 51 | } |
| 63 | 52 | |
| 64 | - $local_file_path = \Elementor\TemplateLibrary\Classes\Media_Mapper::get_local_file_path( $attachment['url'] ); | |
| 65 | - $imported_attachment = false; | |
| 66 | - | |
| 67 | - if ( $local_file_path !== $attachment['url'] && file_exists( $local_file_path ) ) { | |
| 68 | - $imported_attachment = Plugin::$instance->templates_manager->get_import_images_instance()->import_local_file( $local_file_path ); | |
| 69 | - } | |
| 70 | - | |
| 71 | - if ( ! $imported_attachment ) { | |
| 72 | - $imported_attachment = Plugin::$instance->templates_manager->get_import_images_instance()->import( $attachment ); | |
| 73 | - } | |
| 74 | - | |
| 75 | - $attachment = $imported_attachment; | |
| 53 | + $attachment = Plugin::$instance->templates_manager->get_import_images_instance()->import( $attachment ); | |
| 76 | 54 | } |
| 77 | 55 | |
| 78 | 56 | // Filter out attachments that don't exist |
| 79 | 57 | $settings = array_filter( $settings ); |
| @@ -101,105 +79,21 @@ | ||
| 101 | 79 | <# } #> |
| 102 | 80 | <div class="elementor-control-media__content elementor-control-tag-area"> |
| 103 | 81 | <div class="elementor-control-gallery-status elementor-control-dynamic-switcher-wrapper"> |
| 104 | 82 | <span class="elementor-control-gallery-status-title"></span> |
| 105 | - <button class="elementor-control-gallery-clear elementor-control-unit-1 tooltip-target" data-tooltip="<?php echo esc_attr__( 'Clear gallery', 'elementor' ); ?>" aria-label="<?php echo esc_attr__( 'Clear gallery', 'elementor' ); ?>"> | |
| 106 | - <i class="eicon-trash-o" aria-hidden="true"></i> | |
| 107 | - </button> | |
| 83 | + <span class="elementor-control-gallery-clear elementor-control-unit-1"><i class="eicon-trash-o" aria-hidden="true"></i></span> | |
| 108 | 84 | </div> |
| 109 | 85 | <div class="elementor-control-gallery-content"> |
| 110 | - <div class="elementor-control-gallery-thumbnails" tabindex="0"></div> | |
| 111 | - <div class="elementor-control-gallery-edit"> | |
| 112 | - <span><i class="eicon-pencil" aria-hidden="true"></i></span> | |
| 113 | - <span class="elementor-screen-only"><?php echo esc_html__( 'Edit gallery', 'elementor' ); ?></span> | |
| 114 | - </div> | |
| 115 | - <button class="elementor-button elementor-control-gallery-add tooltip-target" data-tooltip="<?php echo esc_attr__( 'Add Images', 'elementor' ); ?>" aria-label="<?php echo esc_attr__( 'Add Images', 'elementor' ); ?>"> | |
| 116 | - <i class="eicon-plus-circle" aria-hidden="true"></i> | |
| 117 | - </button> | |
| 86 | + <div class="elementor-control-gallery-thumbnails"></div> | |
| 87 | + <div class="elementor-control-gallery-edit"><span><i class="eicon-pencil" aria-hidden="true"></i></span></div> | |
| 88 | + <button class="elementor-button elementor-control-gallery-add" aria-label="<?php echo esc_html__( 'Add Images', 'elementor' ); ?>"><i class="eicon-plus-circle" aria-hidden="true"></i></button> | |
| 118 | 89 | </div> |
| 119 | 90 | </div> |
| 120 | - | |
| 121 | - <?php | |
| 122 | - /* | |
| 123 | - ?> | |
| 124 | - <div class="elementor-control-media__warnings" role="alert" style="display: none;"> | |
| 125 | - <?php | |
| 126 | - Hints::get_notice_template( [ | |
| 127 | - 'type' => 'warning', | |
| 128 | - 'content' => esc_html__( 'This image doesn’t contain ALT text - which is necessary for accessibility and SEO.', 'elementor' ), | |
| 129 | - 'icon' => true, | |
| 130 | - ] ); | |
| 131 | - ?> | |
| 132 | - </div> | |
| 133 | - <?php | |
| 134 | - */ ?> | |
| 135 | - <?php $this->maybe_display_io_hints(); ?> | |
| 136 | 91 | </div> |
| 137 | 92 | </div> |
| 138 | 93 | <?php |
| 139 | 94 | } |
| 140 | 95 | |
| 141 | - private function maybe_display_io_hints() { | |
| 142 | - $plugin_slug = 'image-optimization'; | |
| 143 | - | |
| 144 | - if ( ! Hints::should_display_hint( $plugin_slug ) ) { | |
| 145 | - return; | |
| 146 | - } | |
| 147 | - | |
| 148 | - $one_subscription = Hints::is_plugin_connected_to_one_subscription(); | |
| 149 | - $is_installed = Hints::is_plugin_installed( 'image-optimization' ); | |
| 150 | - $is_active = Hints::is_plugin_active( 'image-optimization' ); | |
| 151 | - | |
| 152 | - if ( $is_active ) { | |
| 153 | - return; | |
| 154 | - } | |
| 155 | - | |
| 156 | - if ( $one_subscription ) { | |
| 157 | - if ( ! $is_installed ) { | |
| 158 | - $content = esc_html__( 'Optimize your images to improve site speed and performance. Image Optimization is included in your ONE subscription.', 'elementor' ); | |
| 159 | - $button_text = esc_html__( 'Install now', 'elementor' ); | |
| 160 | - $button_url = Hints::get_plugin_install_url( $plugin_slug ); | |
| 161 | - $source = 'io-editor-gallery-one-install'; | |
| 162 | - } elseif ( ! $is_active ) { | |
| 163 | - $content = esc_html__( 'Image Optimization is installed and included in your ONE subscription. Activate it to optimize images and improve site performance.', 'elementor' ); | |
| 164 | - $button_text = esc_html__( 'Activate now', 'elementor' ); | |
| 165 | - $button_url = Hints::get_plugin_activate_url( $plugin_slug ); | |
| 166 | - $source = 'io-editor-gallery-one-activate'; | |
| 167 | - } | |
| 168 | - } else { | |
| 169 | - $content = esc_html__( 'Optimize your images to enhance site performance by using Image Optimization.', 'elementor' ); | |
| 170 | - if ( ! $is_installed ) { | |
| 171 | - $button_text = esc_html__( 'Install now', 'elementor' ); | |
| 172 | - $button_url = Hints::get_plugin_install_url( $plugin_slug ); | |
| 173 | - $source = 'io-editor-gallery-install'; | |
| 174 | - } elseif ( ! $is_active ) { | |
| 175 | - $button_text = esc_html__( 'Activate now', 'elementor' ); | |
| 176 | - $button_url = Hints::get_plugin_activate_url( $plugin_slug ); | |
| 177 | - $source = 'io-editor-gallery-activate'; | |
| 178 | - } | |
| 179 | - } | |
| 180 | - ?> | |
| 181 | - <div class="elementor-control-media__promotions" role="alert"> | |
| 182 | - <?php | |
| 183 | - Hints::get_notice_template( [ | |
| 184 | - 'display' => ! Hints::is_dismissed( $plugin_slug ), | |
| 185 | - 'type' => 'info', | |
| 186 | - 'icon' => true, | |
| 187 | - 'heading' => '', | |
| 188 | - 'content' => $content, | |
| 189 | - 'dismissible' => 'image_optimizer_hint', | |
| 190 | - 'button_text' => $button_text, | |
| 191 | - 'button_event' => 'image_optimizer_hint', | |
| 192 | - 'button_data' => [ | |
| 193 | - 'action_url' => $button_url, | |
| 194 | - 'source' => $source, | |
| 195 | - ], | |
| 196 | - ] ); | |
| 197 | - ?> | |
| 198 | - </div> | |
| 199 | - <?php | |
| 200 | - } | |
| 201 | - | |
| 202 | 96 | /** |
| 203 | 97 | * Get gallery control default settings. |
| 204 | 98 | * |
| 205 | 99 | * Retrieve the default settings of the gallery control. Used to return the |
| @@ -212,8 +106,9 @@ | ||
| 212 | 106 | */ |
| 213 | 107 | protected function get_default_settings() { |
| 214 | 108 | return [ |
| 215 | 109 | 'label_block' => true, |
| 110 | + 'separator' => 'none', | |
| 216 | 111 | 'dynamic' => [ |
| 217 | 112 | 'categories' => [ TagsModule::GALLERY_CATEGORY ], |
| 218 | 113 | 'returnType' => 'object', |
| 219 | 114 | ], |