| @@ -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 |
| @@ -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 = [ |
| @@ -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 | <# |
| @@ -280,9 +261,27 @@ | ||
| 280 | 261 | ?> |
| 281 | 262 | </div> |
| 282 | 263 | <?php |
| 283 | 264 | */ ?> |
| 284 | - <?php $this->maybe_display_io_hints(); ?> | |
| 265 | + | |
| 266 | + <?php if ( Hints::should_display_hint( 'image-optimization' ) ) : ?> | |
| 267 | + <div class="elementor-control-media__promotions" role="alert" style="display: none;"> | |
| 268 | + <?php | |
| 269 | + Hints::get_notice_template( [ | |
| 270 | + 'display' => ! Hints::is_dismissed( 'image-optimization' ), | |
| 271 | + 'type' => 'info', | |
| 272 | + 'content' => __( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ), | |
| 273 | + 'icon' => true, | |
| 274 | + 'dismissible' => 'image_optimizer_hint', | |
| 275 | + 'button_text' => Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate Plugin', 'elementor' ) : __( 'Install Plugin', 'elementor' ), | |
| 276 | + 'button_event' => 'image_optimizer_hint', | |
| 277 | + 'button_data' => [ | |
| 278 | + 'action_url' => Hints::get_plugin_action_url( 'image-optimization' ), | |
| 279 | + ], | |
| 280 | + ] ); ?> | |
| 281 | + </div> | |
| 282 | + <?php endif; ?> | |
| 283 | + | |
| 285 | 284 | </div> |
| 286 | 285 | <# } /* endif isViewable() */ else { #> |
| 287 | 286 | <div class="elementor-control-media__file elementor-control-preview-area"> |
| 288 | 287 | <div class="elementor-control-media__file__content"> |
| @@ -294,13 +293,13 @@ | ||
| 294 | 293 | <div class="elementor-control-media__file__content__info__name"></div> |
| 295 | 294 | </div> |
| 296 | 295 | </div> |
| 297 | 296 | <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' ); ?>"> | |
| 297 | + <div class="elementor-control-media__remove elementor-control-media__file__controls__remove" title="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>"> | |
| 299 | 298 | <i class="eicon-trash-o" aria-hidden="true"></i> |
| 300 | 299 | <span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span> |
| 301 | 300 | </div> |
| 302 | - <div class="elementor-control-media__file__controls__upload-button elementor-control-media-upload-button" data-tooltip="<?php echo esc_attr__( 'Upload', 'elementor' ); ?>"> | |
| 301 | + <div class="elementor-control-media__file__controls__upload-button elementor-control-media-upload-button" title="<?php echo esc_attr__( 'Upload', 'elementor' ); ?>"> | |
| 303 | 302 | <i class="eicon-upload" aria-hidden="true"></i> |
| 304 | 303 | <span class="elementor-screen-only"><?php echo esc_html__( 'Upload', 'elementor' ); ?></span> |
| 305 | 304 | </div> |
| 306 | 305 | </div> |
| @@ -331,69 +330,8 @@ | ||
| 331 | 330 | </div> |
| 332 | 331 | <?php |
| 333 | 332 | } |
| 334 | 333 | |
| 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 Optimization 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 Optimization. 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 Optimization.', '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 | 334 | private function get_image_sizes(): array { |
| 397 | 335 | $wp_image_sizes = Group_Control_Image_Size::get_all_image_sizes(); |
| 398 | 336 | |
| 399 | 337 | $image_sizes = []; |
| @@ -517,8 +455,8 @@ | ||
| 517 | 455 | |
| 518 | 456 | return wp_get_attachment_image_url( $control_value['id'], $control_value['size'] ); |
| 519 | 457 | } |
| 520 | 458 | |
| 521 | - public static function sanitise_text( $text ) { | |
| 522 | - return esc_attr( strip_tags( $text ) ); | |
| 459 | + public static function sanitise_text( $string ) { | |
| 460 | + return esc_attr( strip_tags( $string ) ); | |
| 523 | 461 | } |
| 524 | 462 | } |