← All changes
|
includes/widgets/Auto_Scrolling_Text/Auto_Scrolling_Text.php
+8
-20
51.1.76
→
51.1.83
View file →
| @@ -42,8 +42,13 @@ | ||
| 42 | 42 | { |
| 43 | 43 | return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-auto-scrolling-text-style']; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | + public function get_script_depends(): array | |
| 47 | + { | |
| 48 | + return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-auto-scrolling-text-script']; | |
| 49 | + } | |
| 50 | + | |
| 46 | 51 | public function get_categories(): array |
| 47 | 52 | { |
| 48 | 53 | return ['king-addons']; |
| 49 | 54 | } |
| @@ -76,9 +81,8 @@ | ||
| 76 | 81 | 'kng_auto_scroll_txt_content_section_content', |
| 77 | 82 | [ |
| 78 | 83 | 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Content', 'king-addons'), |
| 79 | 84 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 80 | - 'frontend_available' => true, | |
| 81 | 85 | ] |
| 82 | 86 | ); |
| 83 | 87 | |
| 84 | 88 | $repeater = new Repeater(); |
| @@ -1022,14 +1026,15 @@ | ||
| 1022 | 1026 | } |
| 1023 | 1027 | |
| 1024 | 1028 | protected function render(): void |
| 1025 | 1029 | { |
| 1026 | - $settings = $this->get_settings(); | |
| 1030 | + $settings = Core::displaySettings($this); | |
| 1027 | 1031 | $this_ID = $this->get_id(); |
| 1028 | 1032 | ?> |
| 1029 | 1033 | <div class="king-addons-auto-scrolling-text-items-wrapper"> |
| 1030 | 1034 | <div class="king-addons-auto-scrolling-text-items king-addons-auto-scrolling-text-items-<?php echo esc_attr($this_ID); ?>"> |
| 1031 | 1035 | <div class="king-addons-auto-scrolling-text-wrapper king-addons-auto-scrolling-text-wrapper-<?php echo esc_attr($this_ID); ?>"> |
| 1036 | + <div class="king-addons-auto-scrolling-text-group"> | |
| 1032 | 1037 | <?php |
| 1033 | 1038 | |
| 1034 | 1039 | $item_count = 0; |
| 1035 | 1040 | |
| @@ -1130,28 +1135,11 @@ | ||
| 1130 | 1135 | /** END: Image Item ===================== */ |
| 1131 | 1136 | |
| 1132 | 1137 | $item_count++; |
| 1133 | 1138 | } ?> |
| 1139 | + </div> | |
| 1134 | 1140 | </div> |
| 1135 | 1141 | </div> |
| 1136 | 1142 | </div> |
| 1137 | 1143 | <?php |
| 1138 | - | |
| 1139 | - // Security fix: Escape content before using innerHTML | |
| 1140 | - $escaped_content = esc_js($settings['auto_scroll_text']); | |
| 1141 | - $js_auto_scroll_text = "if (document.readyState === 'complete') { | |
| 1142 | - const marquee = document.querySelector('.king-addons-auto-scrolling-text-wrapper-" . esc_attr($this_ID) . "'); | |
| 1143 | - const texts = '{$escaped_content}'; | |
| 1144 | - marquee.innerHTML += texts; | |
| 1145 | - marquee.innerHTML += texts; | |
| 1146 | - } else { | |
| 1147 | - window.addEventListener('load', function () { | |
| 1148 | - const marquee = document.querySelector('.king-addons-auto-scrolling-text-wrapper-" . esc_attr($this_ID) . "'); | |
| 1149 | - const texts = '{$escaped_content}'; | |
| 1150 | - marquee.innerHTML += texts; | |
| 1151 | - marquee.innerHTML += texts; | |
| 1152 | - }); | |
| 1153 | - }"; | |
| 1154 | - | |
| 1155 | - wp_print_inline_script_tag($js_auto_scroll_text); | |
| 1156 | 1144 | } |
| 1157 | 1145 | } |