| @@ -1,9 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Frontend\Performance; | |
| 5 | - | |
| 6 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | 5 | exit; // Exit if accessed directly. |
| 8 | 6 | } |
| 9 | 7 | |
| @@ -93,23 +91,13 @@ | ||
| 93 | 91 | */ |
| 94 | 92 | const RAW_HTML = 'raw_html'; |
| 95 | 93 | |
| 96 | 94 | /** |
| 97 | - * Notice control. | |
| 98 | - */ | |
| 99 | - const NOTICE = 'notice'; | |
| 100 | - | |
| 101 | - /** | |
| 102 | 95 | * Deprecated Notice control. |
| 103 | 96 | */ |
| 104 | 97 | const DEPRECATED_NOTICE = 'deprecated_notice'; |
| 105 | 98 | |
| 106 | 99 | /** |
| 107 | - * Alert control. | |
| 108 | - */ | |
| 109 | - const ALERT = 'alert'; | |
| 110 | - | |
| 111 | - /** | |
| 112 | 100 | * Popover Toggle control. |
| 113 | 101 | */ |
| 114 | 102 | const POPOVER_TOGGLE = 'popover_toggle'; |
| 115 | 103 | |
| @@ -158,13 +146,8 @@ | ||
| 158 | 146 | */ |
| 159 | 147 | const CHOOSE = 'choose'; |
| 160 | 148 | |
| 161 | 149 | /** |
| 162 | - * Visual_Choice control. | |
| 163 | - */ | |
| 164 | - const VISUAL_CHOICE = 'visual_choice'; | |
| 165 | - | |
| 166 | - /** | |
| 167 | 150 | * WYSIWYG control. |
| 168 | 151 | */ |
| 169 | 152 | const WYSIWYG = 'wysiwyg'; |
| 170 | 153 | |
| @@ -307,21 +290,8 @@ | ||
| 307 | 290 | */ |
| 308 | 291 | private static $tabs; |
| 309 | 292 | |
| 310 | 293 | /** |
| 311 | - * Has stacks cache been cleared. | |
| 312 | - * | |
| 313 | - * Boolean flag used to determine whether the controls manager stack cache has been cleared once during the current runtime. | |
| 314 | - * | |
| 315 | - * @since 3.13.0 | |
| 316 | - * @access private | |
| 317 | - * @static | |
| 318 | - * | |
| 319 | - * @var array | |
| 320 | - */ | |
| 321 | - private $has_stacks_cache_been_cleared = false; | |
| 322 | - | |
| 323 | - /** | |
| 324 | 294 | * Init tabs. |
| 325 | 295 | * |
| 326 | 296 | * Initialize control tabs. |
| 327 | 297 | * |
| @@ -417,10 +387,8 @@ | ||
| 417 | 387 | self::TAB, |
| 418 | 388 | self::TABS, |
| 419 | 389 | self::DIVIDER, |
| 420 | 390 | self::DEPRECATED_NOTICE, |
| 421 | - self::ALERT, | |
| 422 | - self::NOTICE, | |
| 423 | 391 | |
| 424 | 392 | self::COLOR, |
| 425 | 393 | self::MEDIA, |
| 426 | 394 | self::SLIDER, |
| @@ -425,9 +393,8 @@ | ||
| 425 | 393 | self::MEDIA, |
| 426 | 394 | self::SLIDER, |
| 427 | 395 | self::DIMENSIONS, |
| 428 | 396 | self::CHOOSE, |
| 429 | - self::VISUAL_CHOICE, | |
| 430 | 397 | self::WYSIWYG, |
| 431 | 398 | self::CODE, |
| 432 | 399 | self::FONT, |
| 433 | 400 | self::IMAGE_DIMENSIONS, |
| @@ -494,14 +461,14 @@ | ||
| 494 | 461 | * |
| 495 | 462 | * @param Controls_Manager $this The controls manager. |
| 496 | 463 | */ |
| 497 | 464 | // TODO: Uncomment when Pro uses the new hook. |
| 498 | - // Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->do_deprecated_action( | |
| 499 | - // 'elementor/controls/controls_registered', | |
| 500 | - // [ $this ], | |
| 501 | - // '3.5.0', | |
| 502 | - // 'elementor/controls/register' | |
| 503 | - // ); | |
| 465 | + //Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->do_deprecated_action( | |
| 466 | + // 'elementor/controls/controls_registered', | |
| 467 | + // [ $this ], | |
| 468 | + // '3.5.0', | |
| 469 | + // 'elementor/controls/register' | |
| 470 | + //); | |
| 504 | 471 | |
| 505 | 472 | do_action( 'elementor/controls/controls_registered', $this ); |
| 506 | 473 | |
| 507 | 474 | /** |
| @@ -523,9 +490,9 @@ | ||
| 523 | 490 | * control to any given control instance. |
| 524 | 491 | * |
| 525 | 492 | * @since 1.0.0 |
| 526 | 493 | * @access public |
| 527 | - * @deprecated 3.5.0 Use `register()` method instead. | |
| 494 | + * @deprecated 3.5.0 Use `$this->register()` instead. | |
| 528 | 495 | * |
| 529 | 496 | * @param string $control_id Control ID. |
| 530 | 497 | * @param Base_Control $control_instance Control instance, usually the |
| 531 | 498 | * current instance. |
| @@ -531,13 +498,13 @@ | ||
| 531 | 498 | * current instance. |
| 532 | 499 | */ |
| 533 | 500 | public function register_control( $control_id, Base_Control $control_instance ) { |
| 534 | 501 | // TODO: Uncomment when Pro uses the new hook. |
| 535 | - // Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( | |
| 536 | - // __METHOD__, | |
| 537 | - // '3.5.0', | |
| 538 | - // 'register()' | |
| 539 | - // ); | |
| 502 | + //Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( | |
| 503 | + // __METHOD__, | |
| 504 | + // '3.5.0', | |
| 505 | + // 'register' | |
| 506 | + //); | |
| 540 | 507 | |
| 541 | 508 | $this->register( $control_instance, $control_id ); |
| 542 | 509 | } |
| 543 | 510 | |
| @@ -575,9 +542,9 @@ | ||
| 575 | 542 | * This method removes control from the controls list. |
| 576 | 543 | * |
| 577 | 544 | * @since 1.0.0 |
| 578 | 545 | * @access public |
| 579 | - * @deprecated 3.5.0 Use `unregister()` method instead. | |
| 546 | + * @deprecated 3.5.0 Use `$this->unregister()` instead. | |
| 580 | 547 | * |
| 581 | 548 | * @param string $control_id Control ID. |
| 582 | 549 | * |
| 583 | 550 | * @return bool True if the control was removed, False otherwise. |
| @@ -585,9 +552,9 @@ | ||
| 585 | 552 | public function unregister_control( $control_id ) { |
| 586 | 553 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( |
| 587 | 554 | __METHOD__, |
| 588 | 555 | '3.5.0', |
| 589 | - 'unregister()' | |
| 556 | + 'unregister' | |
| 590 | 557 | ); |
| 591 | 558 | |
| 592 | 559 | return $this->unregister( $control_id ); |
| 593 | 560 | } |
| @@ -765,10 +732,8 @@ | ||
| 765 | 732 | |
| 766 | 733 | $this->stacks[ $stack_id ] = [ |
| 767 | 734 | 'tabs' => [], |
| 768 | 735 | 'controls' => [], |
| 769 | - 'style_controls' => [], | |
| 770 | - 'responsive_control_duplication_mode' => Plugin::$instance->breakpoints->get_responsive_control_duplication_mode(), | |
| 771 | 736 | ]; |
| 772 | 737 | } |
| 773 | 738 | |
| 774 | 739 | /** |
| @@ -806,13 +771,8 @@ | ||
| 806 | 771 | 'overwrite' => false, |
| 807 | 772 | 'index' => null, |
| 808 | 773 | ]; |
| 809 | 774 | |
| 810 | - $control_type = 'controls'; | |
| 811 | - if ( Performance::should_optimize_controls() && $this->is_style_control( $control_data ) ) { | |
| 812 | - $control_type = 'style_controls'; | |
| 813 | - } | |
| 814 | - | |
| 815 | 775 | $options = array_merge( $default_options, $options ); |
| 816 | 776 | |
| 817 | 777 | $default_args = [ |
| 818 | 778 | 'type' => self::TEXT, |
| @@ -829,17 +789,8 @@ | ||
| 829 | 789 | _doing_it_wrong( sprintf( '%1$s::%2$s', __CLASS__, __FUNCTION__ ), sprintf( 'Control type "%s" not found.', esc_html( $control_data['type'] ) ), '1.0.0' ); |
| 830 | 790 | return false; |
| 831 | 791 | } |
| 832 | 792 | |
| 833 | - if ( $control_type_instance instanceof Has_Validation ) { | |
| 834 | - try { | |
| 835 | - $control_type_instance->validate( $control_data ); | |
| 836 | - } catch ( \Exception $e ) { | |
| 837 | - _doing_it_wrong( sprintf( '%1$s::%2$s', __CLASS__, __FUNCTION__ ), esc_html( $e->getMessage() ), '3.23.0' ); | |
| 838 | - return false; | |
| 839 | - } | |
| 840 | - } | |
| 841 | - | |
| 842 | 793 | if ( $control_type_instance instanceof Base_Data_Control ) { |
| 843 | 794 | $control_default_value = $control_type_instance->get_default_value(); |
| 844 | 795 | |
| 845 | 796 | if ( is_array( $control_default_value ) ) { |
| @@ -850,9 +801,9 @@ | ||
| 850 | 801 | } |
| 851 | 802 | |
| 852 | 803 | $stack_id = $element->get_unique_name(); |
| 853 | 804 | |
| 854 | - if ( ! $options['overwrite'] && isset( $this->stacks[ $stack_id ][ $control_type ][ $control_id ] ) ) { | |
| 805 | + if ( ! $options['overwrite'] && isset( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) { | |
| 855 | 806 | _doing_it_wrong( sprintf( '%1$s::%2$s', __CLASS__, __FUNCTION__ ), sprintf( 'Cannot redeclare control with same name "%s".', esc_html( $control_id ) ), '1.0.0' ); |
| 856 | 807 | |
| 857 | 808 | return false; |
| 858 | 809 | } |
| @@ -864,18 +815,18 @@ | ||
| 864 | 815 | } |
| 865 | 816 | |
| 866 | 817 | $this->stacks[ $stack_id ]['tabs'][ $control_data['tab'] ] = $tabs[ $control_data['tab'] ]; |
| 867 | 818 | |
| 868 | - $this->stacks[ $stack_id ][ $control_type ][ $control_id ] = $control_data; | |
| 819 | + $this->stacks[ $stack_id ]['controls'][ $control_id ] = $control_data; | |
| 869 | 820 | |
| 870 | 821 | if ( null !== $options['index'] ) { |
| 871 | - $controls = $this->stacks[ $stack_id ][ $control_type ]; | |
| 822 | + $controls = $this->stacks[ $stack_id ]['controls']; | |
| 872 | 823 | |
| 873 | 824 | $controls_keys = array_keys( $controls ); |
| 874 | 825 | |
| 875 | 826 | array_splice( $controls_keys, $options['index'], 0, $control_id ); |
| 876 | 827 | |
| 877 | - $this->stacks[ $stack_id ][ $control_type ] = array_merge( array_flip( $controls_keys ), $controls ); | |
| 828 | + $this->stacks[ $stack_id ]['controls'] = array_merge( array_flip( $controls_keys ), $controls ); | |
| 878 | 829 | } |
| 879 | 830 | |
| 880 | 831 | return true; |
| 881 | 832 | } |
| @@ -887,9 +838,9 @@ | ||
| 887 | 838 | * |
| 888 | 839 | * @since 1.0.0 |
| 889 | 840 | * @access public |
| 890 | 841 | * |
| 891 | - * @param string $stack_id Stack ID. | |
| 842 | + * @param string $stack_id Stack ID. | |
| 892 | 843 | * @param array|string $control_id The ID of the control to remove. |
| 893 | 844 | * |
| 894 | 845 | * @return bool|\WP_Error True if the stack was removed, False otherwise. |
| 895 | 846 | */ |
| @@ -911,31 +862,8 @@ | ||
| 911 | 862 | return true; |
| 912 | 863 | } |
| 913 | 864 | |
| 914 | 865 | /** |
| 915 | - * Has Stacks Cache Been Cleared. | |
| 916 | - * | |
| 917 | - * @since 3.13.0 | |
| 918 | - * @access public | |
| 919 | - * @return bool True if the CSS requires to clear the controls stack cache, False otherwise. | |
| 920 | - */ | |
| 921 | - public function has_stacks_cache_been_cleared() { | |
| 922 | - return $this->has_stacks_cache_been_cleared; | |
| 923 | - } | |
| 924 | - | |
| 925 | - /** | |
| 926 | - * Clear stack. | |
| 927 | - * This method clears the stack. | |
| 928 | - * | |
| 929 | - * @since 3.13.0 | |
| 930 | - * @access public | |
| 931 | - */ | |
| 932 | - public function clear_stack_cache() { | |
| 933 | - $this->stacks = []; | |
| 934 | - $this->has_stacks_cache_been_cleared = true; | |
| 935 | - } | |
| 936 | - | |
| 937 | - /** | |
| 938 | 866 | * Get control from stack. |
| 939 | 867 | * |
| 940 | 868 | * Retrieve a specific control for a given a specific stack. |
| 941 | 869 | * |
| @@ -951,19 +879,13 @@ | ||
| 951 | 879 | * |
| 952 | 880 | * @return array|\WP_Error The control, or an error. |
| 953 | 881 | */ |
| 954 | 882 | public function get_control_from_stack( $stack_id, $control_id ) { |
| 955 | - $stack_data = $this->get_stacks( $stack_id ); | |
| 956 | - | |
| 957 | - if ( ! empty( $stack_data['controls'][ $control_id ] ) ) { | |
| 958 | - return $stack_data['controls'][ $control_id ]; | |
| 883 | + if ( empty( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) { | |
| 884 | + return new \WP_Error( 'Cannot get a not-exists control.' ); | |
| 959 | 885 | } |
| 960 | 886 | |
| 961 | - if ( ! empty( $stack_data['style_controls'][ $control_id ] ) ) { | |
| 962 | - return $stack_data['style_controls'][ $control_id ]; | |
| 963 | - } | |
| 964 | - | |
| 965 | - return new \WP_Error( 'Cannot get a not-exists control.' ); | |
| 887 | + return $this->stacks[ $stack_id ]['controls'][ $control_id ]; | |
| 966 | 888 | } |
| 967 | 889 | |
| 968 | 890 | /** |
| 969 | 891 | * Update control in stack. |
| @@ -1036,9 +958,9 @@ | ||
| 1036 | 958 | * @access public |
| 1037 | 959 | * |
| 1038 | 960 | * @param Controls_Stack $controls_stack Controls stack. |
| 1039 | 961 | * |
| 1040 | - * @return null|array Stack data if it exists, `null` otherwise. | |
| 962 | + * @return null|array Stack data if it exist, `null` otherwise. | |
| 1041 | 963 | */ |
| 1042 | 964 | public function get_element_stack( Controls_Stack $controls_stack ) { |
| 1043 | 965 | $stack_id = $controls_stack->get_unique_name(); |
| 1044 | 966 | |
| @@ -1045,13 +967,8 @@ | ||
| 1045 | 967 | if ( ! isset( $this->stacks[ $stack_id ] ) ) { |
| 1046 | 968 | return null; |
| 1047 | 969 | } |
| 1048 | 970 | |
| 1049 | - if ( $this->should_clean_stack( $this->stacks[ $stack_id ] ) ) { | |
| 1050 | - $this->delete_stack( $controls_stack ); | |
| 1051 | - return null; | |
| 1052 | - } | |
| 1053 | - | |
| 1054 | 971 | return $this->stacks[ $stack_id ]; |
| 1055 | 972 | } |
| 1056 | 973 | |
| 1057 | 974 | /** |
| @@ -1064,10 +981,11 @@ | ||
| 1064 | 981 | * @since 1.0.0 |
| 1065 | 982 | * @access public |
| 1066 | 983 | * |
| 1067 | 984 | * @param Controls_Stack $controls_stack . |
| 1068 | - * @param string $tab | |
| 1069 | - * @param array $additional_messages | |
| 985 | + * @param string $tab | |
| 986 | + * @param array $additional_messages | |
| 987 | + * | |
| 1070 | 988 | */ |
| 1071 | 989 | public function add_custom_css_controls( Controls_Stack $controls_stack, $tab = self::TAB_ADVANCED, $additional_messages = [] ) { |
| 1072 | 990 | $controls_stack->start_controls_section( |
| 1073 | 991 | 'section_custom_css_pro', |
| @@ -1107,10 +1025,10 @@ | ||
| 1107 | 1025 | * version of elementor uses this method to display an upgrade message to |
| 1108 | 1026 | * Elementor Pro. |
| 1109 | 1027 | * |
| 1110 | 1028 | * @param Controls_Stack $controls_stack . |
| 1111 | - * @param string $tab | |
| 1112 | - * @param array $additional_messages | |
| 1029 | + * @param string $tab | |
| 1030 | + * @param array $additional_messages | |
| 1113 | 1031 | * |
| 1114 | 1032 | * @return void |
| 1115 | 1033 | */ |
| 1116 | 1034 | public function add_page_transitions_controls( Controls_Stack $controls_stack, $tab = self::TAB_ADVANCED, $additional_messages = [] ) { |
| @@ -1148,9 +1066,9 @@ | ||
| 1148 | 1066 | public function get_teaser_template( $texts ) { |
| 1149 | 1067 | ob_start(); |
| 1150 | 1068 | ?> |
| 1151 | 1069 | <div class="elementor-nerd-box"> |
| 1152 | - <img class="elementor-nerd-box-icon" src="<?php echo esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ); ?>" loading="lazy" alt="<?php echo esc_attr__( 'Upgrade', 'elementor' ); ?>" /> | |
| 1070 | + <img class="elementor-nerd-box-icon" src="<?php echo esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ); ?>" loading="lazy" /> | |
| 1153 | 1071 | <div class="elementor-nerd-box-title"><?php Utils::print_unescaped_internal_string( $texts['title'] ); ?></div> |
| 1154 | 1072 | <?php foreach ( $texts['messages'] as $message ) { ?> |
| 1155 | 1073 | <div class="elementor-nerd-box-message"><?php Utils::print_unescaped_internal_string( $message ); ?></div> |
| 1156 | 1074 | <?php } |
| @@ -1191,19 +1109,19 @@ | ||
| 1191 | 1109 | * This method adds a new control for the "Custom Attributes" feature. The free |
| 1192 | 1110 | * version of elementor uses this method to display an upgrade message to |
| 1193 | 1111 | * Elementor Pro. |
| 1194 | 1112 | * |
| 1195 | - * @param Controls_Stack $controls_stack . | |
| 1196 | - * @param string $tab | |
| 1197 | 1113 | * @since 2.8.3 |
| 1198 | 1114 | * @access public |
| 1115 | + * | |
| 1116 | + * @param Controls_Stack $controls_stack. | |
| 1199 | 1117 | */ |
| 1200 | - public function add_custom_attributes_controls( Controls_Stack $controls_stack, string $tab = self::TAB_ADVANCED ) { | |
| 1118 | + public function add_custom_attributes_controls( Controls_Stack $controls_stack ) { | |
| 1201 | 1119 | $controls_stack->start_controls_section( |
| 1202 | 1120 | 'section_custom_attributes_pro', |
| 1203 | 1121 | [ |
| 1204 | 1122 | 'label' => esc_html__( 'Attributes', 'elementor' ), |
| 1205 | - 'tab' => $tab, | |
| 1123 | + 'tab' => self::TAB_ADVANCED, | |
| 1206 | 1124 | ] |
| 1207 | 1125 | ); |
| 1208 | 1126 | |
| 1209 | 1127 | $controls_stack->add_control( |
| @@ -1220,181 +1138,6 @@ | ||
| 1220 | 1138 | ] |
| 1221 | 1139 | ); |
| 1222 | 1140 | |
| 1223 | 1141 | $controls_stack->end_controls_section(); |
| 1224 | - } | |
| 1225 | - | |
| 1226 | - /** | |
| 1227 | - * Check if a stack should be cleaned by the current responsive control duplication mode. | |
| 1228 | - * | |
| 1229 | - * @param array $stack | |
| 1230 | - * @return bool | |
| 1231 | - */ | |
| 1232 | - private function should_clean_stack( $stack ): bool { | |
| 1233 | - if ( ! isset( $stack['responsive_control_duplication_mode'] ) ) { | |
| 1234 | - return false; | |
| 1235 | - } | |
| 1236 | - | |
| 1237 | - $stack_duplication_mode = $stack['responsive_control_duplication_mode']; | |
| 1238 | - | |
| 1239 | - // This array provides a convenient way to map human-readable mode names to numeric values for comparison. | |
| 1240 | - // If the current stack's mode is greater than or equal to the current mode, then we shouldn't clean the stack. | |
| 1241 | - $modes = [ | |
| 1242 | - 'off' => 1, | |
| 1243 | - 'dynamic' => 2, | |
| 1244 | - 'on' => 3, | |
| 1245 | - ]; | |
| 1246 | - | |
| 1247 | - if ( ! isset( $modes[ $stack_duplication_mode ] ) ) { | |
| 1248 | - return false; | |
| 1249 | - } | |
| 1250 | - | |
| 1251 | - $current_duplication_mode = Plugin::$instance->breakpoints->get_responsive_control_duplication_mode(); | |
| 1252 | - | |
| 1253 | - if ( $modes[ $stack_duplication_mode ] >= $modes[ $current_duplication_mode ] ) { | |
| 1254 | - return false; | |
| 1255 | - } | |
| 1256 | - | |
| 1257 | - return true; | |
| 1258 | - } | |
| 1259 | - | |
| 1260 | - public function add_display_conditions_controls( Controls_Stack $controls_stack ) { | |
| 1261 | - if ( Utils::has_pro() ) { | |
| 1262 | - return; | |
| 1263 | - } | |
| 1264 | - | |
| 1265 | - ob_start(); | |
| 1266 | - ?> | |
| 1267 | - <div class="e-control-display-conditions-promotion__wrapper"> | |
| 1268 | - <div class="e-control-display-conditions-promotion__description"> | |
| 1269 | - <span class="e-control-display-conditions-promotion__text"> | |
| 1270 | - <?php echo esc_html__( 'Display Conditions', 'elementor' ); ?> | |
| 1271 | - </span> | |
| 1272 | - <span class="e-control-display-conditions-promotion__lock-wrapper"> | |
| 1273 | - <i class="eicon-upgrade-crown-full e-control-display-conditions-promotion"></i> | |
| 1274 | - </span> | |
| 1275 | - </div> | |
| 1276 | - <i class="eicon-flow e-control-display-conditions-promotion"></i> | |
| 1277 | - </div> | |
| 1278 | - <?php | |
| 1279 | - $control_template = ob_get_clean(); | |
| 1280 | - | |
| 1281 | - $controls_stack->add_control( | |
| 1282 | - 'display_conditions_pro', | |
| 1283 | - [ | |
| 1284 | - 'type' => self::RAW_HTML, | |
| 1285 | - 'separator' => 'before', | |
| 1286 | - 'raw' => $control_template, | |
| 1287 | - ] | |
| 1288 | - ); | |
| 1289 | - } | |
| 1290 | - | |
| 1291 | - public function add_motion_effects_promotion_control( Controls_Stack $controls_stack ) { | |
| 1292 | - if ( Utils::has_pro() ) { | |
| 1293 | - return; | |
| 1294 | - } | |
| 1295 | - | |
| 1296 | - $controls_stack->add_control( | |
| 1297 | - 'scrolling_effects_pro', | |
| 1298 | - [ | |
| 1299 | - 'type' => self::RAW_HTML, | |
| 1300 | - 'separator' => 'before', | |
| 1301 | - 'raw' => $this->promotion_switcher_control( esc_html__( 'Scrolling Effects', 'elementor' ), 'scrolling-effects' ), | |
| 1302 | - ] | |
| 1303 | - ); | |
| 1304 | - | |
| 1305 | - $controls_stack->add_control( | |
| 1306 | - 'mouse_effects_pro', | |
| 1307 | - [ | |
| 1308 | - 'type' => self::RAW_HTML, | |
| 1309 | - 'separator' => 'before', | |
| 1310 | - 'raw' => $this->promotion_switcher_control( esc_html__( 'Mouse Effects', 'elementor' ), 'mouse-effects' ), | |
| 1311 | - ] | |
| 1312 | - ); | |
| 1313 | - | |
| 1314 | - $controls_stack->add_control( | |
| 1315 | - 'sticky_pro', | |
| 1316 | - [ | |
| 1317 | - 'type' => self::RAW_HTML, | |
| 1318 | - 'separator' => 'before', | |
| 1319 | - 'raw' => $this->promotion_select_control( esc_html__( 'Sticky', 'elementor' ), 'sticky-effects' ), | |
| 1320 | - ] | |
| 1321 | - ); | |
| 1322 | - | |
| 1323 | - $controls_stack->add_control( | |
| 1324 | - 'motion_effects_promotion_divider', | |
| 1325 | - [ | |
| 1326 | - 'type' => self::DIVIDER, | |
| 1327 | - ] | |
| 1328 | - ); | |
| 1329 | - } | |
| 1330 | - | |
| 1331 | - private function promotion_switcher_control( $title, $id ): string { | |
| 1332 | - return '<div class="elementor-control-type-switcher elementor-label-inline e-control-motion-effects-promotion__wrapper"> | |
| 1333 | - <div class="elementor-control-content"> | |
| 1334 | - <div class="elementor-control-field"> | |
| 1335 | - <label> | |
| 1336 | - ' . $title . ' | |
| 1337 | - </label> | |
| 1338 | - <span class="e-control-motion-effects-promotion__lock-wrapper"> | |
| 1339 | - <i class="eicon-upgrade-crown-full"></i> | |
| 1340 | - </span> | |
| 1341 | - <div class="elementor-control-input-wrapper"> | |
| 1342 | - <label class="elementor-switch elementor-control-unit-2 e-control-' . $id . '-promotion"> | |
| 1343 | - <input type="checkbox" class="elementor-switch-input" disabled> | |
| 1344 | - <span class="elementor-switch-label" data-off="Off"></span> | |
| 1345 | - <span class="elementor-switch-handle"></span> | |
| 1346 | - </label> | |
| 1347 | - </div> | |
| 1348 | - </div> | |
| 1349 | - </div> | |
| 1350 | - </div>'; | |
| 1351 | - } | |
| 1352 | - | |
| 1353 | - private function promotion_select_control( $title, $id ): string { | |
| 1354 | - return '<div class="elementor-control-type-select elementor-label-inline e-control-motion-effects-promotion__wrapper"> | |
| 1355 | - <div class="elementor-control-content"> | |
| 1356 | - <div class="elementor-control-field "> | |
| 1357 | - <label for="sticky-motion-effect-pro"> | |
| 1358 | - ' . $title . ' | |
| 1359 | - </label> | |
| 1360 | - <span class="e-control-motion-effects-promotion__lock-wrapper"> | |
| 1361 | - <i class="eicon-upgrade-crown-full"></i> | |
| 1362 | - </span> | |
| 1363 | - <div class="elementor-control-input-wrapper elementor-control-unit-5 e-control-' . $id . '-promotion"> | |
| 1364 | - <div class="select-promotion elementor-control-unit-5">' . esc_html__( 'None', 'elementor' ) . '</div> | |
| 1365 | - </div> | |
| 1366 | - </div> | |
| 1367 | - </div> | |
| 1368 | - </div>'; | |
| 1369 | - } | |
| 1370 | - | |
| 1371 | - private function is_style_control( $control_data ): bool { | |
| 1372 | - $frontend_available = $control_data['frontend_available'] ?? false; | |
| 1373 | - if ( $frontend_available ) { | |
| 1374 | - return false; | |
| 1375 | - } | |
| 1376 | - | |
| 1377 | - if ( ! empty( $control_data['control_type'] ) && 'content' === $control_data['control_type'] ) { | |
| 1378 | - return false; | |
| 1379 | - } | |
| 1380 | - | |
| 1381 | - if ( ! empty( $control_data['prefix_class'] ) ) { | |
| 1382 | - return false; | |
| 1383 | - } | |
| 1384 | - | |
| 1385 | - $render_type = $control_data['render_type'] ?? ''; | |
| 1386 | - if ( 'template' === $render_type ) { | |
| 1387 | - return false; | |
| 1388 | - } | |
| 1389 | - | |
| 1390 | - if ( 'ui' === $render_type ) { | |
| 1391 | - return true; | |
| 1392 | - } | |
| 1393 | - | |
| 1394 | - if ( ! empty( $control_data['selectors'] ) ) { | |
| 1395 | - return true; | |
| 1396 | - } | |
| 1397 | - | |
| 1398 | - return false; | |
| 1399 | 1142 | } |
| 1400 | 1143 | } |