| @@ -50,16 +50,8 @@ | ||
| 50 | 50 | 'size' => '', |
| 51 | 51 | ]; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function on_export( $settings ) { | |
| 55 | - if ( ! empty( $settings['url'] ) ) { | |
| 56 | - do_action( 'elementor/templates/collect_media_url', $settings['url'], $settings ); | |
| 57 | - } | |
| 58 | - | |
| 59 | - return $settings; | |
| 60 | - } | |
| 61 | - | |
| 62 | 54 | /** |
| 63 | 55 | * Import media images. |
| 64 | 56 | * |
| 65 | 57 | * Used to import media control files from external sites while importing |
| @@ -67,9 +59,9 @@ | ||
| 67 | 59 | * |
| 68 | 60 | * @since 1.0.0 |
| 69 | 61 | * @access public |
| 70 | 62 | * |
| 71 | - * @param array $settings Control settings. | |
| 63 | + * @param array $settings Control settings | |
| 72 | 64 | * |
| 73 | 65 | * @return array Control settings. |
| 74 | 66 | */ |
| 75 | 67 | public function on_import( $settings ) { |
| @@ -76,19 +68,8 @@ | ||
| 76 | 68 | if ( empty( $settings['url'] ) ) { |
| 77 | 69 | return $settings; |
| 78 | 70 | } |
| 79 | 71 | |
| 80 | - $local_file_path = \Elementor\TemplateLibrary\Classes\Media_Mapper::get_local_file_path( $settings['url'] ); | |
| 81 | - $imported_attachment = false; | |
| 82 | - | |
| 83 | - if ( $local_file_path !== $settings['url'] && file_exists( $local_file_path ) ) { | |
| 84 | - $imported_attachment = Plugin::$instance->templates_manager->get_import_images_instance()->import_local_file( $local_file_path ); | |
| 85 | - } | |
| 86 | - | |
| 87 | - if ( $imported_attachment ) { | |
| 88 | - return $imported_attachment; | |
| 89 | - } | |
| 90 | - | |
| 91 | 72 | $settings = Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings ); |
| 92 | 73 | |
| 93 | 74 | if ( ! $settings ) { |
| 94 | 75 | $settings = [ |
| @@ -107,9 +88,9 @@ | ||
| 107 | 88 | * |
| 108 | 89 | * @since 3.4.6 |
| 109 | 90 | * @deprecated 3.5.0 |
| 110 | 91 | * |
| 111 | - * @param mixed $mimes | |
| 92 | + * @param $mimes | |
| 112 | 93 | * @return mixed |
| 113 | 94 | */ |
| 114 | 95 | public function support_svg_and_json_import( $mimes ) { |
| 115 | 96 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' ); |
| @@ -128,9 +109,9 @@ | ||
| 128 | 109 | */ |
| 129 | 110 | public function enqueue() { |
| 130 | 111 | global $wp_version; |
| 131 | 112 | |
| 132 | - $suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 113 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 133 | 114 | wp_enqueue_media(); |
| 134 | 115 | |
| 135 | 116 | wp_enqueue_style( |
| 136 | 117 | 'media', |
| @@ -230,9 +211,9 @@ | ||
| 230 | 211 | #> |
| 231 | 212 | <div class="{{{ inputWrapperClasses }}}"> |
| 232 | 213 | <div class="elementor-control-media__content elementor-control-tag-area elementor-control-preview-area"> |
| 233 | 214 | <div class="elementor-control-media-area"> |
| 234 | - <div class="elementor-control-media__remove elementor-control-media__content__remove" data-tooltip="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>"> | |
| 215 | + <div class="elementor-control-media__remove elementor-control-media__content__remove" title="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>"> | |
| 235 | 216 | <i class="eicon-trash-o" aria-hidden="true"></i> |
| 236 | 217 | <span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span> |
| 237 | 218 | </div> |
| 238 | 219 | <# |
| @@ -266,11 +247,9 @@ | ||
| 266 | 247 | #> |
| 267 | 248 | </div> |
| 268 | 249 | </div> |
| 269 | 250 | |
| 270 | - <?php | |
| 271 | - /* | |
| 272 | - ?> | |
| 251 | + <?php /* ?> | |
| 273 | 252 | <div class="elementor-control-media__warnings" role="alert" style="display: none;"> |
| 274 | 253 | <?php |
| 275 | 254 | Hints::get_notice_template( [ |
| 276 | 255 | 'type' => 'warning', |
| @@ -278,11 +257,28 @@ | ||
| 278 | 257 | 'icon' => true, |
| 279 | 258 | ] ); |
| 280 | 259 | ?> |
| 281 | 260 | </div> |
| 282 | - <?php | |
| 283 | - */ ?> | |
| 284 | - <?php $this->maybe_display_io_hints(); ?> | |
| 261 | + <?php */ ?> | |
| 262 | + | |
| 263 | + <?php if ( Hints::should_display_hint( 'image-optimization' ) ) : ?> | |
| 264 | + <div class="elementor-control-media__promotions" role="alert" style="display: none;"> | |
| 265 | + <?php | |
| 266 | + Hints::get_notice_template( [ | |
| 267 | + 'display' => ! Hints::is_dismissed( 'image-optimization' ), | |
| 268 | + 'type' => 'info', | |
| 269 | + 'content' => __( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ), | |
| 270 | + 'icon' => true, | |
| 271 | + 'dismissible' => 'image_optimizer_hint', | |
| 272 | + 'button_text' => Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate Plugin', 'elementor' ) : __( 'Install Plugin', 'elementor' ), | |
| 273 | + 'button_event' => 'image_optimizer_hint', | |
| 274 | + 'button_data' => [ | |
| 275 | + 'action_url' => Hints::get_plugin_action_url( 'image-optimization' ), | |
| 276 | + ], | |
| 277 | + ] ); ?> | |
| 278 | + </div> | |
| 279 | + <?php endif; ?> | |
| 280 | + | |
| 285 | 281 | </div> |
| 286 | 282 | <# } /* endif isViewable() */ else { #> |
| 287 | 283 | <div class="elementor-control-media__file elementor-control-preview-area"> |
| 288 | 284 | <div class="elementor-control-media__file__content"> |
| @@ -294,13 +290,13 @@ | ||
| 294 | 290 | <div class="elementor-control-media__file__content__info__name"></div> |
| 295 | 291 | </div> |
| 296 | 292 | </div> |
| 297 | 293 | <div class="elementor-control-media__file__controls"> |
| 298 | - <div class="elementor-control-media__remove elementor-control-media__file__controls__remove" data-tooltip="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>"> | |
| 294 | + <div class="elementor-control-media__remove elementor-control-media__file__controls__remove" title="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>"> | |
| 299 | 295 | <i class="eicon-trash-o" aria-hidden="true"></i> |
| 300 | 296 | <span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span> |
| 301 | 297 | </div> |
| 302 | - <div class="elementor-control-media__file__controls__upload-button elementor-control-media-upload-button" data-tooltip="<?php echo esc_attr__( 'Upload', 'elementor' ); ?>"> | |
| 298 | + <div class="elementor-control-media__file__controls__upload-button elementor-control-media-upload-button" title="<?php echo esc_attr__( 'Upload', 'elementor' ); ?>"> | |
| 303 | 299 | <i class="eicon-upload" aria-hidden="true"></i> |
| 304 | 300 | <span class="elementor-screen-only"><?php echo esc_html__( 'Upload', 'elementor' ); ?></span> |
| 305 | 301 | </div> |
| 306 | 302 | </div> |
| @@ -321,10 +317,8 @@ | ||
| 321 | 317 | <?php endforeach; ?> |
| 322 | 318 | </select> |
| 323 | 319 | </div> |
| 324 | 320 | </div> |
| 325 | - | |
| 326 | - <div class="elementor-control-field-description"><?php echo esc_html__( 'Image size settings don’t apply to Dynamic Images.', 'elementor' ); ?></div> | |
| 327 | 321 | </div> |
| 328 | 322 | <# } #> |
| 329 | 323 | |
| 330 | 324 | <input type="hidden" data-setting="{{ data.name }}"/> |
| @@ -331,70 +325,9 @@ | ||
| 331 | 325 | </div> |
| 332 | 326 | <?php |
| 333 | 327 | } |
| 334 | 328 | |
| 335 | - private function maybe_display_io_hints() { | |
| 336 | - $plugin_slug = 'image-optimization'; | |
| 337 | - | |
| 338 | - if ( ! Hints::should_display_hint( $plugin_slug ) ) { | |
| 339 | - return; | |
| 340 | - } | |
| 341 | - | |
| 342 | - $one_subscription = Hints::is_plugin_connected_to_one_subscription(); | |
| 343 | - $is_installed = Hints::is_plugin_installed( $plugin_slug ); | |
| 344 | - $is_active = Hints::is_plugin_active( $plugin_slug ); | |
| 345 | - | |
| 346 | - if ( $is_active ) { | |
| 347 | - return; | |
| 348 | - } | |
| 349 | - | |
| 350 | - if ( $one_subscription ) { | |
| 351 | - if ( ! $is_installed ) { | |
| 352 | - $content = esc_html__( 'Optimize your images to improve site speed and performance. Image Optimizer is included in your ONE subscription.', 'elementor' ); | |
| 353 | - $button_text = esc_html__( 'Install now', 'elementor' ); | |
| 354 | - $button_url = Hints::get_plugin_install_url( $plugin_slug ); | |
| 355 | - $source = 'io-editor-image-one-install'; | |
| 356 | - } elseif ( ! $is_active ) { | |
| 357 | - $content = esc_html__( 'Your ONE subscription includes Image Optimizer. Activate it to optimize images and improve site performance.', 'elementor' ); | |
| 358 | - $button_text = esc_html__( 'Activate now', 'elementor' ); | |
| 359 | - $button_url = Hints::get_plugin_activate_url( $plugin_slug ); | |
| 360 | - $source = 'io-editor-image-one-activate'; | |
| 361 | - } | |
| 362 | - } else { | |
| 363 | - $content = esc_html__( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ); | |
| 364 | - if ( ! $is_installed ) { | |
| 365 | - $button_text = esc_html__( 'Install now', 'elementor' ); | |
| 366 | - $button_url = Hints::get_plugin_install_url( $plugin_slug ); | |
| 367 | - $source = 'io-editor-image-install'; | |
| 368 | - } elseif ( ! $is_active ) { | |
| 369 | - $button_text = esc_html__( 'Activate now', 'elementor' ); | |
| 370 | - $button_url = Hints::get_plugin_activate_url( $plugin_slug ); | |
| 371 | - $source = 'io-editor-image-activate'; | |
| 372 | - } | |
| 373 | - } | |
| 374 | - ?> | |
| 375 | - <div class="elementor-control-media__promotions" role="alert"> | |
| 376 | - <?php | |
| 377 | - Hints::get_notice_template( [ | |
| 378 | - 'display' => ! Hints::is_dismissed( $plugin_slug ), | |
| 379 | - 'type' => 'info', | |
| 380 | - 'icon' => true, | |
| 381 | - 'heading' => '', | |
| 382 | - 'content' => $content, | |
| 383 | - 'dismissible' => 'image_optimizer_hint', | |
| 384 | - 'button_text' => $button_text, | |
| 385 | - 'button_event' => 'image_optimizer_hint', | |
| 386 | - 'button_data' => [ | |
| 387 | - 'action_url' => $button_url, | |
| 388 | - 'source' => $source, | |
| 389 | - ], | |
| 390 | - ] ); | |
| 391 | - ?> | |
| 392 | - </div> | |
| 393 | - <?php | |
| 394 | - } | |
| 395 | - | |
| 396 | - private function get_image_sizes(): array { | |
| 329 | + private function get_image_sizes() : array { | |
| 397 | 330 | $wp_image_sizes = Group_Control_Image_Size::get_all_image_sizes(); |
| 398 | 331 | |
| 399 | 332 | $image_sizes = []; |
| 400 | 333 | |
| @@ -517,8 +450,8 @@ | ||
| 517 | 450 | |
| 518 | 451 | return wp_get_attachment_image_url( $control_value['id'], $control_value['size'] ); |
| 519 | 452 | } |
| 520 | 453 | |
| 521 | - public static function sanitise_text( $text ) { | |
| 522 | - return esc_attr( strip_tags( $text ) ); | |
| 454 | + public static function sanitise_text( $string ) { | |
| 455 | + return esc_attr( strip_tags( $string ) ); | |
| 523 | 456 | } |
| 524 | 457 | } |