| @@ -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 = [ |
| @@ -332,64 +313,35 @@ | ||
| 332 | 313 | <?php |
| 333 | 314 | } |
| 334 | 315 | |
| 335 | 316 | private function maybe_display_io_hints() { |
| 336 | - $plugin_slug = 'image-optimization'; | |
| 337 | - | |
| 338 | - if ( ! Hints::should_display_hint( $plugin_slug ) ) { | |
| 317 | + if ( Hints::should_display_hint( 'image-optimization' ) ) { | |
| 318 | + $content_text = esc_html__( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ); | |
| 319 | + $button_text = Hints::is_plugin_installed( 'image-optimization' ) ? esc_html__( 'Activate Plugin', 'elementor' ) : esc_html__( 'Install Plugin', 'elementor' ); | |
| 320 | + $action_url = Hints::get_plugin_action_url( 'image-optimization' ); | |
| 321 | + } elseif ( Hints::should_display_hint( 'image-optimization-connect' ) ) { | |
| 322 | + $content_text = esc_html__( "This image isn't optimized. You need to connect your Image Optimizer account first.", 'elementor' ); | |
| 323 | + $button_text = esc_html__( 'Connect Now', 'elementor' ); | |
| 324 | + $action_url = admin_url( 'admin.php?page=image-optimization-settings' ); | |
| 325 | + } else { | |
| 339 | 326 | return; |
| 340 | 327 | } |
| 341 | 328 | |
| 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 | 329 | ?> |
| 375 | - <div class="elementor-control-media__promotions" role="alert"> | |
| 330 | + <div class="elementor-control-media__promotions" role="alert" style="display: none;"> | |
| 376 | 331 | <?php |
| 377 | 332 | Hints::get_notice_template( [ |
| 378 | - 'display' => ! Hints::is_dismissed( $plugin_slug ), | |
| 333 | + 'display' => ! Hints::is_dismissed( 'image-optimization' ), | |
| 379 | 334 | 'type' => 'info', |
| 335 | + 'content' => $content_text, | |
| 380 | 336 | 'icon' => true, |
| 381 | - 'heading' => '', | |
| 382 | - 'content' => $content, | |
| 383 | 337 | 'dismissible' => 'image_optimizer_hint', |
| 384 | 338 | 'button_text' => $button_text, |
| 385 | 339 | 'button_event' => 'image_optimizer_hint', |
| 386 | 340 | 'button_data' => [ |
| 387 | - 'action_url' => $button_url, | |
| 388 | - 'source' => $source, | |
| 341 | + 'action_url' => $action_url, | |
| 389 | 342 | ], |
| 390 | - ] ); | |
| 391 | - ?> | |
| 343 | + ] ); ?> | |
| 392 | 344 | </div> |
| 393 | 345 | <?php |
| 394 | 346 | } |
| 395 | 347 | |
| @@ -517,8 +469,8 @@ | ||
| 517 | 469 | |
| 518 | 470 | return wp_get_attachment_image_url( $control_value['id'], $control_value['size'] ); |
| 519 | 471 | } |
| 520 | 472 | |
| 521 | - public static function sanitise_text( $text ) { | |
| 522 | - return esc_attr( strip_tags( $text ) ); | |
| 473 | + public static function sanitise_text( $string ) { | |
| 474 | + return esc_attr( strip_tags( $string ) ); | |
| 523 | 475 | } |
| 524 | 476 | } |