| @@ -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. |
| @@ -297,9 +287,9 @@ | ||
| 297 | 287 | |
| 298 | 288 | /** |
| 299 | 289 | * Whether the element returns dynamic content. |
| 300 | 290 | * |
| 301 | - * Set to determine whether to cache the element output or not. | |
| 291 | + * set to determine whether to cache the element output or not. | |
| 302 | 292 | * |
| 303 | 293 | * @since 3.22.0 |
| 304 | 294 | * @access protected |
| 305 | 295 | * |
| @@ -326,28 +316,8 @@ | ||
| 326 | 316 | |
| 327 | 317 | return $this->children; |
| 328 | 318 | } |
| 329 | 319 | |
| 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 | 320 | /** |
| 351 | 321 | * Get default arguments. |
| 352 | 322 | * |
| 353 | 323 | * Retrieve the element default arguments. Used to return all the default |
| @@ -426,14 +396,15 @@ | ||
| 426 | 396 | * @since 2.8.0 |
| 427 | 397 | * @access public |
| 428 | 398 | * |
| 429 | 399 | * @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. | |
| 400 | + * @param array $url_control Array of link settings. | |
| 401 | + * @param bool $overwrite Optional. Whether to overwrite existing | |
| 402 | + * attribute. Default is false, not to overwrite. | |
| 433 | 403 | * |
| 434 | 404 | * @return Element_Base Current instance of the element. |
| 435 | 405 | */ |
| 406 | + | |
| 436 | 407 | public function add_link_attributes( $element, array $url_control, $overwrite = false ) { |
| 437 | 408 | $attributes = []; |
| 438 | 409 | |
| 439 | 410 | if ( ! empty( $url_control['url'] ) ) { |
| @@ -450,9 +421,9 @@ | ||
| 450 | 421 | $attributes['rel'] = 'nofollow'; |
| 451 | 422 | } |
| 452 | 423 | |
| 453 | 424 | if ( ! empty( $url_control['custom_attributes'] ) ) { |
| 454 | - // Custom URL attributes should come as a string of comma-delimited key|value pairs. | |
| 425 | + // Custom URL attributes should come as a string of comma-delimited key|value pairs | |
| 455 | 426 | $attributes = array_merge( $attributes, Utils::parse_custom_attributes( $url_control['custom_attributes'] ) ); |
| 456 | 427 | } |
| 457 | 428 | |
| 458 | 429 | if ( $attributes ) { |
| @@ -461,16 +432,8 @@ | ||
| 461 | 432 | |
| 462 | 433 | return $this; |
| 463 | 434 | } |
| 464 | 435 | |
| 465 | - public function reset_descendant_render_state(): void { | |
| 466 | - $this->reset_render_state(); | |
| 467 | - | |
| 468 | - foreach ( $this->get_children() as $child ) { | |
| 469 | - $child->reset_descendant_render_state(); | |
| 470 | - } | |
| 471 | - } | |
| 472 | - | |
| 473 | 436 | /** |
| 474 | 437 | * Print element. |
| 475 | 438 | * |
| 476 | 439 | * Used to generate the element final HTML on the frontend and the editor. |
| @@ -481,11 +444,9 @@ | ||
| 481 | 444 | public function print_element() { |
| 482 | 445 | $element_type = $this->get_type(); |
| 483 | 446 | |
| 484 | 447 | if ( $this->should_render_shortcode() ) { |
| 485 | - $unique_id = apply_filters( 'elementor/element_cache/unique_id', '' ); | |
| 486 | - | |
| 487 | - echo '[elementor-element k="' . esc_attr( $unique_id ) . '" data="' . esc_attr( base64_encode( wp_json_encode( $this->get_raw_data() ) ) ) . '"]'; | |
| 448 | + echo '[elementor-element data="' . esc_attr( base64_encode( wp_json_encode( $this->get_raw_data() ) ) ) . '"]'; | |
| 488 | 449 | return; |
| 489 | 450 | } |
| 490 | 451 | |
| 491 | 452 | /** |
| @@ -551,10 +512,8 @@ | ||
| 551 | 512 | // PHPCS - The content has already been escaped by the `render` method. |
| 552 | 513 | echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 553 | 514 | $this->after_render(); |
| 554 | 515 | |
| 555 | - // TODO: Remove this in the future | |
| 556 | - // Since version 3.24.0 page scripts/styles are handled by `page_assets`. | |
| 557 | 516 | $this->enqueue_scripts(); |
| 558 | 517 | $this->enqueue_styles(); |
| 559 | 518 | } |
| 560 | 519 | |
| @@ -601,9 +560,9 @@ | ||
| 601 | 560 | } |
| 602 | 561 | |
| 603 | 562 | $is_dynamic_content = apply_filters( 'elementor/element/is_dynamic_content', false, $raw_data, $this ); |
| 604 | 563 | |
| 605 | - $has_dynamic_tag = $this->has_element_dynamic_tag( $raw_data['settings'] ); | |
| 564 | + $has_dynamic_tag = ! empty( $raw_data['settings']['__dynamic__'] ); | |
| 606 | 565 | |
| 607 | 566 | if ( $is_dynamic_content || $has_dynamic_tag ) { |
| 608 | 567 | return true; |
| 609 | 568 | } |
| @@ -610,26 +569,8 @@ | ||
| 610 | 569 | |
| 611 | 570 | return false; |
| 612 | 571 | } |
| 613 | 572 | |
| 614 | - private function has_element_dynamic_tag( $element_settings ): bool { | |
| 615 | - if ( is_array( $element_settings ) ) { | |
| 616 | - if ( ! empty( $element_settings['__dynamic__'] ) ) { | |
| 617 | - return true; | |
| 618 | - } | |
| 619 | - | |
| 620 | - foreach ( $element_settings as $value ) { | |
| 621 | - $has_dynamic = $this->has_element_dynamic_tag( $value ); | |
| 622 | - | |
| 623 | - if ( $has_dynamic ) { | |
| 624 | - return true; | |
| 625 | - } | |
| 626 | - } | |
| 627 | - } | |
| 628 | - | |
| 629 | - return false; | |
| 630 | - } | |
| 631 | - | |
| 632 | 573 | /** |
| 633 | 574 | * Get the element raw data. |
| 634 | 575 | * |
| 635 | 576 | * Retrieve the raw element data, including the id, type, settings, child |
| @@ -732,9 +673,9 @@ | ||
| 732 | 673 | * @param array|null $controls The available controls. |
| 733 | 674 | * |
| 734 | 675 | * @return array Element data. |
| 735 | 676 | */ |
| 736 | - public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ): array { | |
| 677 | + public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ) : array { | |
| 737 | 678 | $tags_manager = Plugin::$instance->dynamic_tags; |
| 738 | 679 | |
| 739 | 680 | if ( empty( $config['settings'][ $tags_manager::DYNAMIC_SETTING_KEY ] ) ) { |
| 740 | 681 | return $config; |
| @@ -797,9 +738,8 @@ | ||
| 797 | 738 | 'elementor-element-' . $id, |
| 798 | 739 | ], |
| 799 | 740 | 'data-id' => $id, |
| 800 | 741 | 'data-element_type' => $this->get_type(), |
| 801 | - 'data-e-type' => $this->get_type(), | |
| 802 | 742 | ] ); |
| 803 | 743 | |
| 804 | 744 | $class_settings = []; |
| 805 | 745 | |
| @@ -824,15 +764,15 @@ | ||
| 824 | 764 | } |
| 825 | 765 | |
| 826 | 766 | $_animation = ! empty( $settings['_animation'] ); |
| 827 | 767 | $animation = ! empty( $settings['animation'] ); |
| 828 | - $has_animation = ( $_animation && 'none' !== $settings['_animation'] ) || ( $animation && 'none' !== $settings['animation'] ); | |
| 768 | + $has_animation = $_animation && 'none' !== $settings['_animation'] || $animation && 'none' !== $settings['animation']; | |
| 829 | 769 | |
| 830 | 770 | if ( $has_animation ) { |
| 831 | 771 | $is_static_render_mode = Plugin::$instance->frontend->is_static_render_mode(); |
| 832 | 772 | |
| 833 | 773 | if ( ! $is_static_render_mode ) { |
| 834 | - // Hide the element until the animation begins. | |
| 774 | + // Hide the element until the animation begins | |
| 835 | 775 | $this->add_render_attribute( '_wrapper', 'class', 'elementor-invisible' ); |
| 836 | 776 | } |
| 837 | 777 | } |
| 838 | 778 | |
| @@ -860,15 +800,13 @@ | ||
| 860 | 800 | * Register the Transform controls in the advanced tab of the element. |
| 861 | 801 | * |
| 862 | 802 | * Previously registered under the Widget_Common class, but registered a more fundamental level now to enable access from other widgets. |
| 863 | 803 | * |
| 864 | - * @param string $element_selector | |
| 865 | - * @param string $transform_selector_class | |
| 866 | - * @return void | |
| 867 | 804 | * @since 3.9.0 |
| 868 | 805 | * @access protected |
| 806 | + * @return void | |
| 869 | 807 | */ |
| 870 | - protected function register_transform_section( $element_selector = '', $transform_selector_class = ' > .elementor-widget-container' ) { | |
| 808 | + protected function register_transform_section( $element_selector = '' ) { | |
| 871 | 809 | $default_unit_values_deg = []; |
| 872 | 810 | $default_unit_values_ms = []; |
| 873 | 811 | |
| 874 | 812 | // Set the default unit sizes for all active breakpoints. |
| @@ -897,8 +835,9 @@ | ||
| 897 | 835 | $this->start_controls_tabs( '_tabs_positioning' ); |
| 898 | 836 | |
| 899 | 837 | $transform_prefix_class = 'e-'; |
| 900 | 838 | $transform_return_value = 'transform'; |
| 839 | + $transform_selector_class = ' > .elementor-widget-container'; | |
| 901 | 840 | $transform_css_modifier = ''; |
| 902 | 841 | |
| 903 | 842 | if ( 'con' === $element_selector ) { |
| 904 | 843 | $transform_selector_class = '.e-' . $element_selector; |
| @@ -961,9 +900,8 @@ | ||
| 961 | 900 | ], |
| 962 | 901 | 'condition' => [ |
| 963 | 902 | "_transform_rotate_popover{$tab}!" => '', |
| 964 | 903 | ], |
| 965 | - 'frontend_available' => true, | |
| 966 | 904 | ] |
| 967 | 905 | ); |
| 968 | 906 | |
| 969 | 907 | $this->add_responsive_control( |
| @@ -1341,9 +1279,9 @@ | ||
| 1341 | 1279 | 'relation' => 'or', |
| 1342 | 1280 | 'terms' => array_merge( $transform_origin_conditions, $transform_origin_conditions_hover ), |
| 1343 | 1281 | ]; |
| 1344 | 1282 | |
| 1345 | - // Will override motion effect transform-origin. | |
| 1283 | + // Will override motion effect transform-origin | |
| 1346 | 1284 | $this->add_responsive_control( |
| 1347 | 1285 | 'motion_fx_transform_x_anchor_point', |
| 1348 | 1286 | [ |
| 1349 | 1287 | 'label' => esc_html__( 'X Anchor Point', 'elementor' ), |
| @@ -1369,9 +1307,9 @@ | ||
| 1369 | 1307 | ], |
| 1370 | 1308 | ] |
| 1371 | 1309 | ); |
| 1372 | 1310 | |
| 1373 | - // Will override motion effect transform-origin. | |
| 1311 | + // Will override motion effect transform-origin | |
| 1374 | 1312 | $this->add_responsive_control( |
| 1375 | 1313 | 'motion_fx_transform_y_anchor_point', |
| 1376 | 1314 | [ |
| 1377 | 1315 | 'label' => esc_html__( 'Y Anchor Point', 'elementor' ), |
| @@ -1522,11 +1460,8 @@ | ||
| 1522 | 1460 | |
| 1523 | 1461 | /** |
| 1524 | 1462 | * A Base method for sanitizing the settings before save. |
| 1525 | 1463 | * This method is meant to be overridden by the element. |
| 1526 | - * | |
| 1527 | - * @param array $settings | |
| 1528 | - * @return array | |
| 1529 | 1464 | */ |
| 1530 | 1465 | protected function on_save( array $settings ) { |
| 1531 | 1466 | return $settings; |
| 1532 | 1467 | } |
| @@ -1545,9 +1480,9 @@ | ||
| 1545 | 1480 | */ |
| 1546 | 1481 | private function get_child_type( $element_data ) { |
| 1547 | 1482 | $child_type = $this->_get_default_child_type( $element_data ); |
| 1548 | 1483 | |
| 1549 | - // If it's not a valid widget ( like a deactivated plugin ). | |
| 1484 | + // If it's not a valid widget ( like a deactivated plugin ) | |
| 1550 | 1485 | if ( ! $child_type ) { |
| 1551 | 1486 | return false; |
| 1552 | 1487 | } |
| 1553 | 1488 | |
| @@ -1592,12 +1527,8 @@ | ||
| 1592 | 1527 | $this->add_child( $child_data ); |
| 1593 | 1528 | } |
| 1594 | 1529 | } |
| 1595 | 1530 | |
| 1596 | - public function has_widget_inner_wrapper(): bool { | |
| 1597 | - return true; | |
| 1598 | - } | |
| 1599 | - | |
| 1600 | 1531 | /** |
| 1601 | 1532 | * Element base constructor. |
| 1602 | 1533 | * |
| 1603 | 1534 | * Initializing the element base class using `$data` and `$args`. |
| @@ -1610,9 +1541,9 @@ | ||
| 1610 | 1541 | * |
| 1611 | 1542 | * @param array $data Optional. Element data. Default is an empty array. |
| 1612 | 1543 | * @param array|null $args Optional. Element default arguments. Default is null. |
| 1613 | 1544 | **/ |
| 1614 | - public function __construct( array $data = [], ?array $args = null ) { | |
| 1545 | + public function __construct( array $data = [], array $args = null ) { | |
| 1615 | 1546 | if ( $data ) { |
| 1616 | 1547 | $this->is_type_instance = false; |
| 1617 | 1548 | } elseif ( $args ) { |
| 1618 | 1549 | $this->default_args = $args; |