| @@ -49,9 +49,9 @@ | ||
| 49 | 49 | * |
| 50 | 50 | * @return string Widget title. |
| 51 | 51 | */ |
| 52 | 52 | public function get_title() { |
| 53 | - return esc_html__( 'SoundCloud', 'elementor' ); | |
| 53 | + return __( 'SoundCloud', 'elementor' ); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Get widget icon. |
| @@ -80,29 +80,21 @@ | ||
| 80 | 80 | public function get_keywords() { |
| 81 | 81 | return [ 'audio', 'player', 'soundcloud', 'embed' ]; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - protected function is_dynamic_content(): bool { | |
| 85 | - return false; | |
| 86 | - } | |
| 87 | - | |
| 88 | - public function has_widget_inner_wrapper(): bool { | |
| 89 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 90 | - } | |
| 91 | - | |
| 92 | 84 | /** |
| 93 | 85 | * Register audio widget controls. |
| 94 | 86 | * |
| 95 | 87 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 96 | 88 | * |
| 97 | - * @since 3.1.0 | |
| 89 | + * @since 1.0.0 | |
| 98 | 90 | * @access protected |
| 99 | 91 | */ |
| 100 | - protected function register_controls() { | |
| 92 | + protected function _register_controls() { | |
| 101 | 93 | $this->start_controls_section( |
| 102 | 94 | 'section_audio', |
| 103 | 95 | [ |
| 104 | - 'label' => esc_html__( 'SoundCloud', 'elementor' ), | |
| 96 | + 'label' => __( 'SoundCloud', 'elementor' ), | |
| 105 | 97 | ] |
| 106 | 98 | ); |
| 107 | 99 | |
| 108 | 100 | $this->add_control( |
| @@ -107,9 +99,9 @@ | ||
| 107 | 99 | |
| 108 | 100 | $this->add_control( |
| 109 | 101 | 'link', |
| 110 | 102 | [ |
| 111 | - 'label' => esc_html__( 'Link', 'elementor' ), | |
| 103 | + 'label' => __( 'Link', 'elementor' ), | |
| 112 | 104 | 'type' => Controls_Manager::URL, |
| 113 | 105 | 'dynamic' => [ |
| 114 | 106 | 'active' => true, |
| 115 | 107 | 'categories' => [ |
| @@ -126,14 +118,14 @@ | ||
| 126 | 118 | |
| 127 | 119 | $this->add_control( |
| 128 | 120 | 'visual', |
| 129 | 121 | [ |
| 130 | - 'label' => esc_html__( 'Visual Player', 'elementor' ), | |
| 122 | + 'label' => __( 'Visual Player', 'elementor' ), | |
| 131 | 123 | 'type' => Controls_Manager::SELECT, |
| 132 | 124 | 'default' => 'no', |
| 133 | 125 | 'options' => [ |
| 134 | - 'yes' => esc_html__( 'Yes', 'elementor' ), | |
| 135 | - 'no' => esc_html__( 'No', 'elementor' ), | |
| 126 | + 'yes' => __( 'Yes', 'elementor' ), | |
| 127 | + 'no' => __( 'No', 'elementor' ), | |
| 136 | 128 | ], |
| 137 | 129 | ] |
| 138 | 130 | ); |
| 139 | 131 | |
| @@ -139,9 +131,9 @@ | ||
| 139 | 131 | |
| 140 | 132 | $this->add_control( |
| 141 | 133 | 'sc_options', |
| 142 | 134 | [ |
| 143 | - 'label' => esc_html__( 'Additional Options', 'elementor' ), | |
| 135 | + 'label' => __( 'Additional Options', 'elementor' ), | |
| 144 | 136 | 'type' => Controls_Manager::HEADING, |
| 145 | 137 | 'separator' => 'before', |
| 146 | 138 | ] |
| 147 | 139 | ); |
| @@ -148,9 +140,9 @@ | ||
| 148 | 140 | |
| 149 | 141 | $this->add_control( |
| 150 | 142 | 'sc_auto_play', |
| 151 | 143 | [ |
| 152 | - 'label' => esc_html__( 'Autoplay', 'elementor' ), | |
| 144 | + 'label' => __( 'Autoplay', 'elementor' ), | |
| 153 | 145 | 'type' => Controls_Manager::SWITCHER, |
| 154 | 146 | ] |
| 155 | 147 | ); |
| 156 | 148 | |
| @@ -156,12 +148,12 @@ | ||
| 156 | 148 | |
| 157 | 149 | $this->add_control( |
| 158 | 150 | 'sc_buying', |
| 159 | 151 | [ |
| 160 | - 'label' => esc_html__( 'Buy Button', 'elementor' ), | |
| 152 | + 'label' => __( 'Buy Button', 'elementor' ), | |
| 161 | 153 | 'type' => Controls_Manager::SWITCHER, |
| 162 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 163 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 154 | + 'label_off' => __( 'Hide', 'elementor' ), | |
| 155 | + 'label_on' => __( 'Show', 'elementor' ), | |
| 164 | 156 | 'default' => 'yes', |
| 165 | 157 | ] |
| 166 | 158 | ); |
| 167 | 159 | |
| @@ -167,12 +159,12 @@ | ||
| 167 | 159 | |
| 168 | 160 | $this->add_control( |
| 169 | 161 | 'sc_liking', |
| 170 | 162 | [ |
| 171 | - 'label' => esc_html__( 'Like Button', 'elementor' ), | |
| 163 | + 'label' => __( 'Like Button', 'elementor' ), | |
| 172 | 164 | 'type' => Controls_Manager::SWITCHER, |
| 173 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 174 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 165 | + 'label_off' => __( 'Hide', 'elementor' ), | |
| 166 | + 'label_on' => __( 'Show', 'elementor' ), | |
| 175 | 167 | 'default' => 'yes', |
| 176 | 168 | ] |
| 177 | 169 | ); |
| 178 | 170 | |
| @@ -178,12 +170,12 @@ | ||
| 178 | 170 | |
| 179 | 171 | $this->add_control( |
| 180 | 172 | 'sc_download', |
| 181 | 173 | [ |
| 182 | - 'label' => esc_html__( 'Download Button', 'elementor' ), | |
| 174 | + 'label' => __( 'Download Button', 'elementor' ), | |
| 183 | 175 | 'type' => Controls_Manager::SWITCHER, |
| 184 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 185 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 176 | + 'label_off' => __( 'Hide', 'elementor' ), | |
| 177 | + 'label_on' => __( 'Show', 'elementor' ), | |
| 186 | 178 | 'default' => 'yes', |
| 187 | 179 | ] |
| 188 | 180 | ); |
| 189 | 181 | |
| @@ -189,12 +181,12 @@ | ||
| 189 | 181 | |
| 190 | 182 | $this->add_control( |
| 191 | 183 | 'sc_show_artwork', |
| 192 | 184 | [ |
| 193 | - 'label' => esc_html__( 'Artwork', 'elementor' ), | |
| 185 | + 'label' => __( 'Artwork', 'elementor' ), | |
| 194 | 186 | 'type' => Controls_Manager::SWITCHER, |
| 195 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 196 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 187 | + 'label_off' => __( 'Hide', 'elementor' ), | |
| 188 | + 'label_on' => __( 'Show', 'elementor' ), | |
| 197 | 189 | 'default' => 'yes', |
| 198 | 190 | 'condition' => [ |
| 199 | 191 | 'visual' => 'no', |
| 200 | 192 | ], |
| @@ -203,12 +195,12 @@ | ||
| 203 | 195 | |
| 204 | 196 | $this->add_control( |
| 205 | 197 | 'sc_sharing', |
| 206 | 198 | [ |
| 207 | - 'label' => esc_html__( 'Share Button', 'elementor' ), | |
| 199 | + 'label' => __( 'Share Button', 'elementor' ), | |
| 208 | 200 | 'type' => Controls_Manager::SWITCHER, |
| 209 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 210 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 201 | + 'label_off' => __( 'Hide', 'elementor' ), | |
| 202 | + 'label_on' => __( 'Show', 'elementor' ), | |
| 211 | 203 | 'default' => 'yes', |
| 212 | 204 | ] |
| 213 | 205 | ); |
| 214 | 206 | |
| @@ -214,12 +206,12 @@ | ||
| 214 | 206 | |
| 215 | 207 | $this->add_control( |
| 216 | 208 | 'sc_show_comments', |
| 217 | 209 | [ |
| 218 | - 'label' => esc_html__( 'Comments', 'elementor' ), | |
| 210 | + 'label' => __( 'Comments', 'elementor' ), | |
| 219 | 211 | 'type' => Controls_Manager::SWITCHER, |
| 220 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 221 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 212 | + 'label_off' => __( 'Hide', 'elementor' ), | |
| 213 | + 'label_on' => __( 'Show', 'elementor' ), | |
| 222 | 214 | 'default' => 'yes', |
| 223 | 215 | ] |
| 224 | 216 | ); |
| 225 | 217 | |
| @@ -225,12 +217,12 @@ | ||
| 225 | 217 | |
| 226 | 218 | $this->add_control( |
| 227 | 219 | 'sc_show_playcount', |
| 228 | 220 | [ |
| 229 | - 'label' => esc_html__( 'Play Counts', 'elementor' ), | |
| 221 | + 'label' => __( 'Play Counts', 'elementor' ), | |
| 230 | 222 | 'type' => Controls_Manager::SWITCHER, |
| 231 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 232 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 223 | + 'label_off' => __( 'Hide', 'elementor' ), | |
| 224 | + 'label_on' => __( 'Show', 'elementor' ), | |
| 233 | 225 | 'default' => 'yes', |
| 234 | 226 | ] |
| 235 | 227 | ); |
| 236 | 228 | |
| @@ -236,12 +228,12 @@ | ||
| 236 | 228 | |
| 237 | 229 | $this->add_control( |
| 238 | 230 | 'sc_show_user', |
| 239 | 231 | [ |
| 240 | - 'label' => esc_html__( 'Username', 'elementor' ), | |
| 232 | + 'label' => __( 'Username', 'elementor' ), | |
| 241 | 233 | 'type' => Controls_Manager::SWITCHER, |
| 242 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 243 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 234 | + 'label_off' => __( 'Hide', 'elementor' ), | |
| 235 | + 'label_on' => __( 'Show', 'elementor' ), | |
| 244 | 236 | 'default' => 'yes', |
| 245 | 237 | ] |
| 246 | 238 | ); |
| 247 | 239 | |
| @@ -247,14 +239,24 @@ | ||
| 247 | 239 | |
| 248 | 240 | $this->add_control( |
| 249 | 241 | 'sc_color', |
| 250 | 242 | [ |
| 251 | - 'label' => esc_html__( 'Controls Color', 'elementor' ), | |
| 243 | + 'label' => __( 'Controls Color', 'elementor' ), | |
| 252 | 244 | 'type' => Controls_Manager::COLOR, |
| 253 | 245 | ] |
| 254 | 246 | ); |
| 255 | 247 | |
| 248 | + $this->add_control( | |
| 249 | + 'view', | |
| 250 | + [ | |
| 251 | + 'label' => __( 'View', 'elementor' ), | |
| 252 | + 'type' => Controls_Manager::HIDDEN, | |
| 253 | + 'default' => 'soundcloud', | |
| 254 | + ] | |
| 255 | + ); | |
| 256 | + | |
| 256 | 257 | $this->end_controls_section(); |
| 258 | + | |
| 257 | 259 | } |
| 258 | 260 | |
| 259 | 261 | /** |
| 260 | 262 | * Render audio widget output on the frontend. |
| @@ -278,9 +280,9 @@ | ||
| 278 | 280 | remove_filter( 'oembed_result', [ $this, 'filter_oembed_result' ], 50 ); |
| 279 | 281 | |
| 280 | 282 | if ( $video_html ) : ?> |
| 281 | 283 | <div class="elementor-soundcloud-wrapper"> |
| 282 | - <?php Utils::print_wp_kses_extended( $video_html, [ 'iframe' ] ); ?> | |
| 284 | + <?php echo $video_html; ?> | |
| 283 | 285 | </div> |
| 284 | 286 | <?php |
| 285 | 287 | endif; |
| 286 | 288 | } |
| @@ -341,14 +343,5 @@ | ||
| 341 | 343 | * @since 2.9.0 |
| 342 | 344 | * @access protected |
| 343 | 345 | */ |
| 344 | 346 | protected function content_template() {} |
| 345 | - | |
| 346 | - public function render_markdown(): string { | |
| 347 | - $settings = $this->get_settings_for_display(); | |
| 348 | - $url = $settings['link']['url'] ?? ''; | |
| 349 | - if ( empty( $url ) ) { | |
| 350 | - return ''; | |
| 351 | - } | |
| 352 | - return '[Audio](' . esc_url( $url ) . ')'; | |
| 353 | - } | |
| 354 | 347 | } |