PluginProbe
Elementor Website Builder – more than just a page builder / 3.20.2
Elementor Website Builder – more than just a page builder v3.20.2
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 4.0.7 All 451 releases
← All changes | includes/base/element-base.php +16 -124 4.1.53.20.2 View file →
@@ -119,12 +119,8 @@
119 119 public function get_script_depends() {
120 120 return $this->depended_scripts;
121 121 }
122 122
123 - public function get_global_scripts() {
124 - return [ 'elementor-frontend' ];
125 - }
126 -
127 123 /**
128 124 * Enqueue scripts.
129 125 *
130 126 * Registers all the scripts defined as element dependencies and enqueues
@@ -134,9 +130,9 @@
134 130 * @access public
135 131 */
136 132 final public function enqueue_scripts() {
137 133 $deprecated_scripts = [
138 - // Insert here when you have a deprecated script.
134 + //Insert here when you have a deprecated script
139 135 ];
140 136
141 137 foreach ( $this->get_script_depends() as $script ) {
142 138 if ( isset( $deprecated_scripts[ $script ] ) ) {
@@ -144,16 +140,10 @@
144 140 }
145 141
146 142 wp_enqueue_script( $script );
147 143 }
148 -
149 - foreach ( $this->get_global_scripts() as $script ) {
150 - wp_enqueue_script( $script );
151 - }
152 144 }
153 145
154 - public function register_frontend_handlers() {}
155 -
156 146 /**
157 147 * Get style dependencies.
158 148 *
159 149 * Retrieve the list of style dependencies the element requires.
@@ -295,22 +285,8 @@
295 285 return true;
296 286 }
297 287
298 288 /**
299 - * Whether the element returns dynamic content.
300 - *
301 - * Set to determine whether to cache the element output or not.
302 - *
303 - * @since 3.22.0
304 - * @access protected
305 - *
306 - * @return bool Whether to cache the element output.
307 - */
308 - protected function is_dynamic_content(): bool {
309 - return true;
310 - }
311 -
312 - /**
313 289 * Get child elements.
314 290 *
315 291 * Retrieve all the child elements of this element.
316 292 *
@@ -326,28 +302,8 @@
326 302
327 303 return $this->children;
328 304 }
329 305
330 - public function render_markdown(): string {
331 - $children = $this->get_children();
332 -
333 - if ( empty( $children ) ) {
334 - return '';
335 - }
336 -
337 - $parts = [];
338 -
339 - foreach ( $children as $child ) {
340 - $md = $child->render_markdown();
341 -
342 - if ( ! empty( trim( $md ) ) ) {
343 - $parts[] = $md;
344 - }
345 - }
346 -
347 - return implode( "\n\n", $parts );
348 - }
349 -
350 306 /**
351 307 * Get default arguments.
352 308 *
353 309 * Retrieve the element default arguments. Used to return all the default
@@ -426,14 +382,15 @@
426 382 * @since 2.8.0
427 383 * @access public
428 384 *
429 385 * @param array|string $element The HTML element.
430 - * @param array $url_control Array of link settings.
431 - * @param bool $overwrite Optional. Whether to overwrite existing
432 - * attribute. Default is false, not to overwrite.
386 + * @param array $url_control Array of link settings.
387 + * @param bool $overwrite Optional. Whether to overwrite existing
388 + * attribute. Default is false, not to overwrite.
433 389 *
434 390 * @return Element_Base Current instance of the element.
435 391 */
392 +
436 393 public function add_link_attributes( $element, array $url_control, $overwrite = false ) {
437 394 $attributes = [];
438 395
439 396 if ( ! empty( $url_control['url'] ) ) {
@@ -450,9 +407,9 @@
450 407 $attributes['rel'] = 'nofollow';
451 408 }
452 409
453 410 if ( ! empty( $url_control['custom_attributes'] ) ) {
454 - // Custom URL attributes should come as a string of comma-delimited key|value pairs.
411 + // Custom URL attributes should come as a string of comma-delimited key|value pairs
455 412 $attributes = array_merge( $attributes, Utils::parse_custom_attributes( $url_control['custom_attributes'] ) );
456 413 }
457 414
458 415 if ( $attributes ) {
@@ -472,15 +429,8 @@
472 429 */
473 430 public function print_element() {
474 431 $element_type = $this->get_type();
475 432
476 - if ( $this->should_render_shortcode() ) {
477 - $unique_id = apply_filters( 'elementor/element_cache/unique_id', '' );
478 -
479 - echo '[elementor-element k="' . esc_attr( $unique_id ) . '" data="' . esc_attr( base64_encode( wp_json_encode( $this->get_raw_data() ) ) ) . '"]';
480 - return;
481 - }
482 -
483 433 /**
484 434 * Before frontend element render.
485 435 *
486 436 * Fires before Elementor element is rendered in the frontend.
@@ -543,10 +493,8 @@
543 493 // PHPCS - The content has already been escaped by the `render` method.
544 494 echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
545 495 $this->after_render();
546 496
547 - // TODO: Remove this in the future
548 - // Since version 3.24.0 page scripts/styles are handled by `page_assets`.
549 497 $this->enqueue_scripts();
550 498 $this->enqueue_styles();
551 499 }
552 500
@@ -574,54 +522,8 @@
574 522 */
575 523 do_action( 'elementor/frontend/after_render', $this );
576 524 }
577 525
578 - protected function should_render_shortcode() {
579 - $should_render_shortcode = apply_filters( 'elementor/element/should_render_shortcode', false );
580 -
581 - if ( ! $should_render_shortcode ) {
582 - return false;
583 - }
584 -
585 - $raw_data = $this->get_raw_data();
586 -
587 - if ( ! empty( $raw_data['settings']['_element_cache'] ) ) {
588 - return 'yes' === $raw_data['settings']['_element_cache'];
589 - }
590 -
591 - if ( $this->is_dynamic_content() ) {
592 - return true;
593 - }
594 -
595 - $is_dynamic_content = apply_filters( 'elementor/element/is_dynamic_content', false, $raw_data, $this );
596 -
597 - $has_dynamic_tag = $this->has_element_dynamic_tag( $raw_data['settings'] );
598 -
599 - if ( $is_dynamic_content || $has_dynamic_tag ) {
600 - return true;
601 - }
602 -
603 - return false;
604 - }
605 -
606 - private function has_element_dynamic_tag( $element_settings ): bool {
607 - if ( is_array( $element_settings ) ) {
608 - if ( ! empty( $element_settings['__dynamic__'] ) ) {
609 - return true;
610 - }
611 -
612 - foreach ( $element_settings as $value ) {
613 - $has_dynamic = $this->has_element_dynamic_tag( $value );
614 -
615 - if ( $has_dynamic ) {
616 - return true;
617 - }
618 - }
619 - }
620 -
621 - return false;
622 - }
623 -
624 526 /**
625 527 * Get the element raw data.
626 528 *
627 529 * Retrieve the raw element data, including the id, type, settings, child
@@ -724,9 +626,9 @@
724 626 * @param array|null $controls The available controls.
725 627 *
726 628 * @return array Element data.
727 629 */
728 - public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ): array {
630 + public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ) : array {
729 631 $tags_manager = Plugin::$instance->dynamic_tags;
730 632
731 633 if ( empty( $config['settings'][ $tags_manager::DYNAMIC_SETTING_KEY ] ) ) {
732 634 return $config;
@@ -789,9 +691,8 @@
789 691 'elementor-element-' . $id,
790 692 ],
791 693 'data-id' => $id,
792 694 'data-element_type' => $this->get_type(),
793 - 'data-e-type' => $this->get_type(),
794 695 ] );
795 696
796 697 $class_settings = [];
797 698
@@ -816,15 +717,15 @@
816 717 }
817 718
818 719 $_animation = ! empty( $settings['_animation'] );
819 720 $animation = ! empty( $settings['animation'] );
820 - $has_animation = ( $_animation && 'none' !== $settings['_animation'] ) || ( $animation && 'none' !== $settings['animation'] );
721 + $has_animation = $_animation && 'none' !== $settings['_animation'] || $animation && 'none' !== $settings['animation'];
821 722
822 723 if ( $has_animation ) {
823 724 $is_static_render_mode = Plugin::$instance->frontend->is_static_render_mode();
824 725
825 726 if ( ! $is_static_render_mode ) {
826 - // Hide the element until the animation begins.
727 + // Hide the element until the animation begins
827 728 $this->add_render_attribute( '_wrapper', 'class', 'elementor-invisible' );
828 729 }
829 730 }
830 731
@@ -852,15 +753,13 @@
852 753 * Register the Transform controls in the advanced tab of the element.
853 754 *
854 755 * Previously registered under the Widget_Common class, but registered a more fundamental level now to enable access from other widgets.
855 756 *
856 - * @param string $element_selector
857 - * @param string $transform_selector_class
858 - * @return void
859 757 * @since 3.9.0
860 758 * @access protected
759 + * @return void
861 760 */
862 - protected function register_transform_section( $element_selector = '', $transform_selector_class = ' > .elementor-widget-container' ) {
761 + protected function register_transform_section( $element_selector = '' ) {
863 762 $default_unit_values_deg = [];
864 763 $default_unit_values_ms = [];
865 764
866 765 // Set the default unit sizes for all active breakpoints.
@@ -889,8 +788,9 @@
889 788 $this->start_controls_tabs( '_tabs_positioning' );
890 789
891 790 $transform_prefix_class = 'e-';
892 791 $transform_return_value = 'transform';
792 + $transform_selector_class = ' > .elementor-widget-container';
893 793 $transform_css_modifier = '';
894 794
895 795 if ( 'con' === $element_selector ) {
896 796 $transform_selector_class = '.e-' . $element_selector;
@@ -953,9 +853,8 @@
953 853 ],
954 854 'condition' => [
955 855 "_transform_rotate_popover{$tab}!" => '',
956 856 ],
957 - 'frontend_available' => true,
958 857 ]
959 858 );
960 859
961 860 $this->add_responsive_control(
@@ -1333,9 +1232,9 @@
1333 1232 'relation' => 'or',
1334 1233 'terms' => array_merge( $transform_origin_conditions, $transform_origin_conditions_hover ),
1335 1234 ];
1336 1235
1337 - // Will override motion effect transform-origin.
1236 + // Will override motion effect transform-origin
1338 1237 $this->add_responsive_control(
1339 1238 'motion_fx_transform_x_anchor_point',
1340 1239 [
1341 1240 'label' => esc_html__( 'X Anchor Point', 'elementor' ),
@@ -1361,9 +1260,9 @@
1361 1260 ],
1362 1261 ]
1363 1262 );
1364 1263
1365 - // Will override motion effect transform-origin.
1264 + // Will override motion effect transform-origin
1366 1265 $this->add_responsive_control(
1367 1266 'motion_fx_transform_y_anchor_point',
1368 1267 [
1369 1268 'label' => esc_html__( 'Y Anchor Point', 'elementor' ),
@@ -1514,11 +1413,8 @@
1514 1413
1515 1414 /**
1516 1415 * A Base method for sanitizing the settings before save.
1517 1416 * This method is meant to be overridden by the element.
1518 - *
1519 - * @param array $settings
1520 - * @return array
1521 1417 */
1522 1418 protected function on_save( array $settings ) {
1523 1419 return $settings;
1524 1420 }
@@ -1537,9 +1433,9 @@
1537 1433 */
1538 1434 private function get_child_type( $element_data ) {
1539 1435 $child_type = $this->_get_default_child_type( $element_data );
1540 1436
1541 - // If it's not a valid widget ( like a deactivated plugin ).
1437 + // If it's not a valid widget ( like a deactivated plugin )
1542 1438 if ( ! $child_type ) {
1543 1439 return false;
1544 1440 }
1545 1441
@@ -1584,12 +1480,8 @@
1584 1480 $this->add_child( $child_data );
1585 1481 }
1586 1482 }
1587 1483
1588 - public function has_widget_inner_wrapper(): bool {
1589 - return true;
1590 - }
1591 -
1592 1484 /**
1593 1485 * Element base constructor.
1594 1486 *
1595 1487 * Initializing the element base class using `$data` and `$args`.
@@ -1602,9 +1494,9 @@
1602 1494 *
1603 1495 * @param array $data Optional. Element data. Default is an empty array.
1604 1496 * @param array|null $args Optional. Element default arguments. Default is null.
1605 1497 **/
1606 - public function __construct( array $data = [], ?array $args = null ) {
1498 + public function __construct( array $data = [], array $args = null ) {
1607 1499 if ( $data ) {
1608 1500 $this->is_type_instance = false;
1609 1501 } elseif ( $args ) {
1610 1502 $this->default_args = $args;