PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.2
Elementor Website Builder – more than just a page builder v3.19.2
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | includes/controls/media.php +40 -108 4.2.33.19.2 View file →
@@ -1,7 +1,8 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 +use Elementor\Core\Files\Uploads_Manager;
4 5 use Elementor\Core\Utils\Hints;
5 6 use Elementor\Modules\DynamicTags\Module as TagsModule;
6 7
7 8 if ( ! defined( 'ABSPATH' ) ) {
@@ -50,16 +51,8 @@
50 51 'size' => '',
51 52 ];
52 53 }
53 54
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 55 /**
63 56 * Import media images.
64 57 *
65 58 * Used to import media control files from external sites while importing
@@ -67,9 +60,9 @@
67 60 *
68 61 * @since 1.0.0
69 62 * @access public
70 63 *
71 - * @param array $settings Control settings.
64 + * @param array $settings Control settings
72 65 *
73 66 * @return array Control settings.
74 67 */
75 68 public function on_import( $settings ) {
@@ -76,19 +69,8 @@
76 69 if ( empty( $settings['url'] ) ) {
77 70 return $settings;
78 71 }
79 72
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 73 $settings = Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings );
92 74
93 75 if ( ! $settings ) {
94 76 $settings = [
@@ -107,9 +89,9 @@
107 89 *
108 90 * @since 3.4.6
109 91 * @deprecated 3.5.0
110 92 *
111 - * @param mixed $mimes
93 + * @param $mimes
112 94 * @return mixed
113 95 */
114 96 public function support_svg_and_json_import( $mimes ) {
115 97 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
@@ -128,9 +110,9 @@
128 110 */
129 111 public function enqueue() {
130 112 global $wp_version;
131 113
132 - $suffix = Utils::is_script_debug() ? '' : '.min';
114 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
133 115 wp_enqueue_media();
134 116
135 117 wp_enqueue_style(
136 118 'media',
@@ -230,9 +212,9 @@
230 212 #>
231 213 <div class="{{{ inputWrapperClasses }}}">
232 214 <div class="elementor-control-media__content elementor-control-tag-area elementor-control-preview-area">
233 215 <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' ); ?>">
216 + <div class="elementor-control-media__remove elementor-control-media__content__remove" title="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>">
235 217 <i class="eicon-trash-o" aria-hidden="true"></i>
236 218 <span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span>
237 219 </div>
238 220 <#
@@ -265,24 +247,41 @@
265 247 } );
266 248 #>
267 249 </div>
268 250 </div>
269 -
270 - <?php
271 - /*
272 - ?>
273 - <div class="elementor-control-media__warnings" role="alert" style="display: none;">
251 + <?php if ( ! Hints::should_display_hint( 'image-optimization-once' ) && ! Hints::should_display_hint( 'image-optimization' ) ) { ?>
252 + <div class="elementor-control-media__warnings elementor-descriptor" role="alert" style="display: none;">
274 253 <?php
275 - Hints::get_notice_template( [
276 - 'type' => 'warning',
277 - 'content' => esc_html__( 'This image doesn’t contain ALT text - which is necessary for accessibility and SEO.', 'elementor' ),
278 - 'icon' => true,
279 - ] );
254 + Hints::get_notice_template( [
255 + 'type' => 'warning',
256 + 'content' => __( 'This image doesn’t contain ALT text - which is necessary for accessibility and SEO.', 'elementor' ),
257 + 'icon' => true,
258 + ] );
280 259 ?>
281 260 </div>
282 - <?php
283 - */ ?>
284 - <?php $this->maybe_display_io_hints(); ?>
261 + <?php } ?>
262 + <?php if ( Hints::should_display_hint( 'image-optimization-once' ) || Hints::should_display_hint( 'image-optimization' ) ) { ?>
263 + <div class="elementor-control-media__promotions elementor-descriptor" role="alert" style="display: none;">
264 + <?php
265 + $once_dismissed = Hints::is_dismissed( 'image-optimization-once' );
266 + $content = $once_dismissed ?
267 + __( 'Whoa! This image is quite large and might slow things down. Use Image Optimizer to reduce size without losing quality.', 'elementor' ) :
268 + __( "Don't let unoptimized images be the downfall of your site's performance. Use Image Optimizer!", 'elementor' );
269 + $dismissible = $once_dismissed ? 'image_optimizer_hint' : 'image-optimization-once';
270 + Hints::get_notice_template( [
271 + 'display' => ! $once_dismissed,
272 + 'type' => $once_dismissed ? 'warning' : 'info',
273 + 'content' => $content,
274 + 'icon' => true,
275 + 'dismissible' => $dismissible,
276 + 'button_text' => Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate Plugin', 'elementor' ) : __( 'Install Plugin', 'elementor' ),
277 + 'button_event' => $dismissible,
278 + 'button_data' => [
279 + 'action_url' => Hints::get_plugin_action_url( 'image-optimization' ),
280 + ],
281 + ] ); ?>
282 + </div>
283 + <?php } ?>
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>
@@ -321,10 +320,8 @@
321 320 <?php endforeach; ?>
322 321 </select>
323 322 </div>
324 323 </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 324 </div>
328 325 <# } #>
329 326
330 327 <input type="hidden" data-setting="{{ data.name }}"/>
@@ -331,70 +328,9 @@
331 328 </div>
332 329 <?php
333 330 }
334 331
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 - private function get_image_sizes(): array {
332 + private function get_image_sizes() : array {
397 333 $wp_image_sizes = Group_Control_Image_Size::get_all_image_sizes();
398 334
399 335 $image_sizes = [];
400 336
@@ -493,12 +429,8 @@
493 429 }
494 430
495 431 $alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
496 432 if ( ! $alt ) {
497 - if ( Utils::has_invalid_post_permissions( $attachment ) ) {
498 - return '';
499 - }
500 -
501 433 $alt = $attachment->post_excerpt;
502 434 if ( ! $alt ) {
503 435 $alt = $attachment->post_title;
504 436 }
@@ -517,8 +449,8 @@
517 449
518 450 return wp_get_attachment_image_url( $control_value['id'], $control_value['size'] );
519 451 }
520 452
521 - public static function sanitise_text( $text ) {
522 - return esc_attr( strip_tags( $text ) );
453 + public static function sanitise_text( $string ) {
454 + return esc_attr( strip_tags( $string ) );
523 455 }
524 456 }