| @@ -6,9 +6,8 @@ | ||
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 9 | 9 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 10 | -use Elementor\Modules\Promotions\Controls\Promotion_Control; | |
| 11 | 10 | |
| 12 | 11 | /** |
| 13 | 12 | * Elementor testimonial widget. |
| 14 | 13 | * |
| @@ -42,9 +41,9 @@ | ||
| 42 | 41 | * |
| 43 | 42 | * @return string Widget title. |
| 44 | 43 | */ |
| 45 | 44 | public function get_title() { |
| 46 | - return esc_html__( 'Testimonial', 'elementor' ); | |
| 45 | + return __( 'Testimonial', 'elementor' ); | |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | 48 | /** |
| 50 | 49 | * Get widget icon. |
| @@ -73,64 +72,21 @@ | ||
| 73 | 72 | public function get_keywords() { |
| 74 | 73 | return [ 'testimonial', 'blockquote' ]; |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | - protected function is_dynamic_content(): bool { | |
| 78 | - return false; | |
| 79 | - } | |
| 80 | - | |
| 81 | 76 | /** |
| 82 | - * Get style dependencies. | |
| 83 | - * | |
| 84 | - * Retrieve the list of style dependencies the widget requires. | |
| 85 | - * | |
| 86 | - * @since 3.24.0 | |
| 87 | - * @access public | |
| 88 | - * | |
| 89 | - * @return array Widget style dependencies. | |
| 90 | - */ | |
| 91 | - public function get_style_depends(): array { | |
| 92 | - return [ 'widget-testimonial' ]; | |
| 93 | - } | |
| 94 | - | |
| 95 | - public function has_widget_inner_wrapper(): bool { | |
| 96 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * Get widget upsale data. | |
| 101 | - * | |
| 102 | - * Retrieve the widget promotion data. | |
| 103 | - * | |
| 104 | - * @since 3.18.0 | |
| 105 | - * @access protected | |
| 106 | - * | |
| 107 | - * @return array Widget promotion data. | |
| 108 | - */ | |
| 109 | - protected function get_upsale_data() { | |
| 110 | - return [ | |
| 111 | - 'condition' => ! Utils::has_pro(), | |
| 112 | - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ), | |
| 113 | - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ), | |
| 114 | - 'description' => esc_html__( 'Use interesting masonry layouts and other overlay features with Elementor\'s Pro Gallery widget.', 'elementor' ), | |
| 115 | - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-testimonial-widget/' ), | |
| 116 | - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ), | |
| 117 | - ]; | |
| 118 | - } | |
| 119 | - | |
| 120 | - /** | |
| 121 | 77 | * Register testimonial widget controls. |
| 122 | 78 | * |
| 123 | 79 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 124 | 80 | * |
| 125 | - * @since 3.1.0 | |
| 81 | + * @since 1.0.0 | |
| 126 | 82 | * @access protected |
| 127 | 83 | */ |
| 128 | - protected function register_controls() { | |
| 84 | + protected function _register_controls() { | |
| 129 | 85 | $this->start_controls_section( |
| 130 | 86 | 'section_testimonial', |
| 131 | 87 | [ |
| 132 | - 'label' => esc_html__( 'Testimonial', 'elementor' ), | |
| 88 | + 'label' => __( 'Testimonial', 'elementor' ), | |
| 133 | 89 | ] |
| 134 | 90 | ); |
| 135 | 91 | |
| 136 | 92 | $this->add_control( |
| @@ -135,15 +91,15 @@ | ||
| 135 | 91 | |
| 136 | 92 | $this->add_control( |
| 137 | 93 | 'testimonial_content', |
| 138 | 94 | [ |
| 139 | - 'label' => esc_html__( 'Content', 'elementor' ), | |
| 95 | + 'label' => __( 'Content', 'elementor' ), | |
| 140 | 96 | 'type' => Controls_Manager::TEXTAREA, |
| 141 | 97 | 'dynamic' => [ |
| 142 | 98 | 'active' => true, |
| 143 | 99 | ], |
| 144 | 100 | 'rows' => '10', |
| 145 | - 'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ), | |
| 101 | + 'default' => __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ), | |
| 146 | 102 | ] |
| 147 | 103 | ); |
| 148 | 104 | |
| 149 | 105 | $this->add_control( |
| @@ -148,9 +104,9 @@ | ||
| 148 | 104 | |
| 149 | 105 | $this->add_control( |
| 150 | 106 | 'testimonial_image', |
| 151 | 107 | [ |
| 152 | - 'label' => esc_html__( 'Choose Image', 'elementor' ), | |
| 108 | + 'label' => __( 'Choose Image', 'elementor' ), | |
| 153 | 109 | 'type' => Controls_Manager::MEDIA, |
| 154 | 110 | 'dynamic' => [ |
| 155 | 111 | 'active' => true, |
| 156 | 112 | ], |
| @@ -164,8 +120,9 @@ | ||
| 164 | 120 | Group_Control_Image_Size::get_type(), |
| 165 | 121 | [ |
| 166 | 122 | 'name' => 'testimonial_image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `testimonial_image_size` and `testimonial_image_custom_dimension`. |
| 167 | 123 | 'default' => 'full', |
| 124 | + 'separator' => 'none', | |
| 168 | 125 | ] |
| 169 | 126 | ); |
| 170 | 127 | |
| 171 | 128 | $this->add_control( |
| @@ -170,17 +127,14 @@ | ||
| 170 | 127 | |
| 171 | 128 | $this->add_control( |
| 172 | 129 | 'testimonial_name', |
| 173 | 130 | [ |
| 174 | - 'label' => esc_html__( 'Name', 'elementor' ), | |
| 131 | + 'label' => __( 'Name', 'elementor' ), | |
| 175 | 132 | 'type' => Controls_Manager::TEXT, |
| 176 | 133 | 'dynamic' => [ |
| 177 | 134 | 'active' => true, |
| 178 | 135 | ], |
| 179 | - 'ai' => [ | |
| 180 | - 'active' => false, | |
| 181 | - ], | |
| 182 | - 'default' => esc_html__( 'John Doe', 'elementor' ), | |
| 136 | + 'default' => 'John Doe', | |
| 183 | 137 | ] |
| 184 | 138 | ); |
| 185 | 139 | |
| 186 | 140 | $this->add_control( |
| @@ -185,17 +139,14 @@ | ||
| 185 | 139 | |
| 186 | 140 | $this->add_control( |
| 187 | 141 | 'testimonial_job', |
| 188 | 142 | [ |
| 189 | - 'label' => esc_html__( 'Title', 'elementor' ), | |
| 143 | + 'label' => __( 'Title', 'elementor' ), | |
| 190 | 144 | 'type' => Controls_Manager::TEXT, |
| 191 | 145 | 'dynamic' => [ |
| 192 | 146 | 'active' => true, |
| 193 | 147 | ], |
| 194 | - 'ai' => [ | |
| 195 | - 'active' => false, | |
| 196 | - ], | |
| 197 | - 'default' => esc_html__( 'Designer', 'elementor' ), | |
| 148 | + 'default' => 'Designer', | |
| 198 | 149 | ] |
| 199 | 150 | ); |
| 200 | 151 | |
| 201 | 152 | $this->add_control( |
| @@ -200,13 +151,14 @@ | ||
| 200 | 151 | |
| 201 | 152 | $this->add_control( |
| 202 | 153 | 'link', |
| 203 | 154 | [ |
| 204 | - 'label' => esc_html__( 'Link', 'elementor' ), | |
| 155 | + 'label' => __( 'Link', 'elementor' ), | |
| 205 | 156 | 'type' => Controls_Manager::URL, |
| 206 | 157 | 'dynamic' => [ |
| 207 | 158 | 'active' => true, |
| 208 | 159 | ], |
| 160 | + 'placeholder' => __( 'https://your-link.com', 'elementor' ), | |
| 209 | 161 | ] |
| 210 | 162 | ); |
| 211 | 163 | |
| 212 | 164 | $this->add_control( |
| @@ -211,63 +163,56 @@ | ||
| 211 | 163 | |
| 212 | 164 | $this->add_control( |
| 213 | 165 | 'testimonial_image_position', |
| 214 | 166 | [ |
| 215 | - 'label' => esc_html__( 'Image Position', 'elementor' ), | |
| 216 | - 'type' => Controls_Manager::CHOOSE, | |
| 167 | + 'label' => __( 'Image Position', 'elementor' ), | |
| 168 | + 'type' => Controls_Manager::SELECT, | |
| 217 | 169 | 'default' => 'aside', |
| 218 | 170 | 'options' => [ |
| 219 | - 'aside' => [ | |
| 220 | - 'title' => esc_html__( 'Aside', 'elementor' ), | |
| 221 | - 'icon' => 'eicon-h-align-left', | |
| 222 | - ], | |
| 223 | - 'top' => [ | |
| 224 | - 'title' => esc_html__( 'Top', 'elementor' ), | |
| 225 | - 'icon' => 'eicon-v-align-top', | |
| 226 | - ], | |
| 171 | + 'aside' => __( 'Aside', 'elementor' ), | |
| 172 | + 'top' => __( 'Top', 'elementor' ), | |
| 227 | 173 | ], |
| 228 | - 'toggle' => false, | |
| 229 | 174 | 'condition' => [ |
| 230 | 175 | 'testimonial_image[url]!' => '', |
| 231 | 176 | ], |
| 232 | 177 | 'separator' => 'before', |
| 233 | - 'classes' => 'elementor-control-start-end', | |
| 234 | 178 | 'style_transfer' => true, |
| 235 | 179 | ] |
| 236 | 180 | ); |
| 237 | 181 | |
| 238 | - $this->add_responsive_control( | |
| 182 | + $this->add_control( | |
| 239 | 183 | 'testimonial_alignment', |
| 240 | 184 | [ |
| 241 | - 'label' => esc_html__( 'Alignment', 'elementor' ), | |
| 185 | + 'label' => __( 'Alignment', 'elementor' ), | |
| 242 | 186 | 'type' => Controls_Manager::CHOOSE, |
| 243 | 187 | 'default' => 'center', |
| 244 | 188 | 'options' => [ |
| 245 | - 'start' => [ | |
| 246 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 189 | + 'left' => [ | |
| 190 | + 'title' => __( 'Left', 'elementor' ), | |
| 247 | 191 | 'icon' => 'eicon-text-align-left', |
| 248 | 192 | ], |
| 249 | 193 | 'center' => [ |
| 250 | - 'title' => esc_html__( 'Center', 'elementor' ), | |
| 194 | + 'title' => __( 'Center', 'elementor' ), | |
| 251 | 195 | 'icon' => 'eicon-text-align-center', |
| 252 | 196 | ], |
| 253 | - 'end' => [ | |
| 254 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 197 | + 'right' => [ | |
| 198 | + 'title' => __( 'Right', 'elementor' ), | |
| 255 | 199 | 'icon' => 'eicon-text-align-right', |
| 256 | 200 | ], |
| 257 | 201 | ], |
| 258 | - 'classes' => 'elementor-control-start-end', | |
| 259 | - 'selectors_dictionary' => [ | |
| 260 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 261 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 262 | - ], | |
| 263 | - 'selectors' => [ | |
| 264 | - '{{WRAPPER}} .elementor-testimonial-wrapper' => 'text-align: {{VALUE}}', | |
| 265 | - ], | |
| 266 | 202 | 'style_transfer' => true, |
| 267 | 203 | ] |
| 268 | 204 | ); |
| 269 | 205 | |
| 206 | + $this->add_control( | |
| 207 | + 'view', | |
| 208 | + [ | |
| 209 | + 'label' => __( 'View', 'elementor' ), | |
| 210 | + 'type' => Controls_Manager::HIDDEN, | |
| 211 | + 'default' => 'traditional', | |
| 212 | + ] | |
| 213 | + ); | |
| 214 | + | |
| 270 | 215 | $this->end_controls_section(); |
| 271 | 216 | |
| 272 | 217 | // Content. |
| 273 | 218 | $this->start_controls_section( |
| @@ -272,9 +217,9 @@ | ||
| 272 | 217 | // Content. |
| 273 | 218 | $this->start_controls_section( |
| 274 | 219 | 'section_style_testimonial_content', |
| 275 | 220 | [ |
| 276 | - 'label' => esc_html__( 'Content', 'elementor' ), | |
| 221 | + 'label' => __( 'Content', 'elementor' ), | |
| 277 | 222 | 'tab' => Controls_Manager::TAB_STYLE, |
| 278 | 223 | ] |
| 279 | 224 | ); |
| 280 | 225 | |
| @@ -280,9 +225,9 @@ | ||
| 280 | 225 | |
| 281 | 226 | $this->add_control( |
| 282 | 227 | 'content_content_color', |
| 283 | 228 | [ |
| 284 | - 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 229 | + 'label' => __( 'Text Color', 'elementor' ), | |
| 285 | 230 | 'type' => Controls_Manager::COLOR, |
| 286 | 231 | 'global' => [ |
| 287 | 232 | 'default' => Global_Colors::COLOR_TEXT, |
| 288 | 233 | ], |
| @@ -303,16 +248,8 @@ | ||
| 303 | 248 | 'selector' => '{{WRAPPER}} .elementor-testimonial-content', |
| 304 | 249 | ] |
| 305 | 250 | ); |
| 306 | 251 | |
| 307 | - $this->add_group_control( | |
| 308 | - Group_Control_Text_Shadow::get_type(), | |
| 309 | - [ | |
| 310 | - 'name' => 'content_shadow', | |
| 311 | - 'selector' => '{{WRAPPER}} .elementor-testimonial-content', | |
| 312 | - ] | |
| 313 | - ); | |
| 314 | - | |
| 315 | 252 | $this->end_controls_section(); |
| 316 | 253 | |
| 317 | 254 | // Image. |
| 318 | 255 | $this->start_controls_section( |
| @@ -317,9 +254,9 @@ | ||
| 317 | 254 | // Image. |
| 318 | 255 | $this->start_controls_section( |
| 319 | 256 | 'section_style_testimonial_image', |
| 320 | 257 | [ |
| 321 | - 'label' => esc_html__( 'Image', 'elementor' ), | |
| 258 | + 'label' => __( 'Image', 'elementor' ), | |
| 322 | 259 | 'tab' => Controls_Manager::TAB_STYLE, |
| 323 | 260 | 'condition' => [ |
| 324 | 261 | 'testimonial_image[url]!' => '', |
| 325 | 262 | ], |
| @@ -325,14 +262,14 @@ | ||
| 325 | 262 | ], |
| 326 | 263 | ] |
| 327 | 264 | ); |
| 328 | 265 | |
| 329 | - $this->add_responsive_control( | |
| 266 | + $this->add_control( | |
| 330 | 267 | 'image_size', |
| 331 | 268 | [ |
| 332 | - 'label' => esc_html__( 'Image Resolution', 'elementor' ), | |
| 269 | + 'label' => __( 'Image Size', 'elementor' ), | |
| 333 | 270 | 'type' => Controls_Manager::SLIDER, |
| 334 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], | |
| 271 | + 'size_units' => [ 'px' ], | |
| 335 | 272 | 'range' => [ |
| 336 | 273 | 'px' => [ |
| 337 | 274 | 'min' => 20, |
| 338 | 275 | 'max' => 200, |
| @@ -352,14 +289,14 @@ | ||
| 352 | 289 | 'separator' => 'before', |
| 353 | 290 | ] |
| 354 | 291 | ); |
| 355 | 292 | |
| 356 | - $this->add_responsive_control( | |
| 293 | + $this->add_control( | |
| 357 | 294 | 'image_border_radius', |
| 358 | 295 | [ |
| 359 | - 'label' => esc_html__( 'Border Radius', 'elementor' ), | |
| 296 | + 'label' => __( 'Border Radius', 'elementor' ), | |
| 360 | 297 | 'type' => Controls_Manager::DIMENSIONS, |
| 361 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], | |
| 298 | + 'size_units' => [ 'px', '%' ], | |
| 362 | 299 | 'selectors' => [ |
| 363 | 300 | '{{WRAPPER}} .elementor-testimonial-wrapper .elementor-testimonial-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 364 | 301 | ], |
| 365 | 302 | ] |
| @@ -370,9 +307,9 @@ | ||
| 370 | 307 | // Name. |
| 371 | 308 | $this->start_controls_section( |
| 372 | 309 | 'section_style_testimonial_name', |
| 373 | 310 | [ |
| 374 | - 'label' => esc_html__( 'Name', 'elementor' ), | |
| 311 | + 'label' => __( 'Name', 'elementor' ), | |
| 375 | 312 | 'tab' => Controls_Manager::TAB_STYLE, |
| 376 | 313 | ] |
| 377 | 314 | ); |
| 378 | 315 | |
| @@ -378,9 +315,9 @@ | ||
| 378 | 315 | |
| 379 | 316 | $this->add_control( |
| 380 | 317 | 'name_text_color', |
| 381 | 318 | [ |
| 382 | - 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 319 | + 'label' => __( 'Text Color', 'elementor' ), | |
| 383 | 320 | 'type' => Controls_Manager::COLOR, |
| 384 | 321 | 'global' => [ |
| 385 | 322 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 386 | 323 | ], |
| @@ -401,16 +338,8 @@ | ||
| 401 | 338 | 'selector' => '{{WRAPPER}} .elementor-testimonial-name', |
| 402 | 339 | ] |
| 403 | 340 | ); |
| 404 | 341 | |
| 405 | - $this->add_group_control( | |
| 406 | - Group_Control_Text_Shadow::get_type(), | |
| 407 | - [ | |
| 408 | - 'name' => 'name_shadow', | |
| 409 | - 'selector' => '{{WRAPPER}} .elementor-testimonial-name', | |
| 410 | - ] | |
| 411 | - ); | |
| 412 | - | |
| 413 | 342 | $this->end_controls_section(); |
| 414 | 343 | |
| 415 | 344 | // Job. |
| 416 | 345 | $this->start_controls_section( |
| @@ -415,9 +344,9 @@ | ||
| 415 | 344 | // Job. |
| 416 | 345 | $this->start_controls_section( |
| 417 | 346 | 'section_style_testimonial_job', |
| 418 | 347 | [ |
| 419 | - 'label' => esc_html__( 'Title', 'elementor' ), | |
| 348 | + 'label' => __( 'Title', 'elementor' ), | |
| 420 | 349 | 'tab' => Controls_Manager::TAB_STYLE, |
| 421 | 350 | ] |
| 422 | 351 | ); |
| 423 | 352 | |
| @@ -423,9 +352,9 @@ | ||
| 423 | 352 | |
| 424 | 353 | $this->add_control( |
| 425 | 354 | 'job_text_color', |
| 426 | 355 | [ |
| 427 | - 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 356 | + 'label' => __( 'Text Color', 'elementor' ), | |
| 428 | 357 | 'type' => Controls_Manager::COLOR, |
| 429 | 358 | 'global' => [ |
| 430 | 359 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 431 | 360 | ], |
| @@ -446,16 +375,8 @@ | ||
| 446 | 375 | 'selector' => '{{WRAPPER}} .elementor-testimonial-job', |
| 447 | 376 | ] |
| 448 | 377 | ); |
| 449 | 378 | |
| 450 | - $this->add_group_control( | |
| 451 | - Group_Control_Text_Shadow::get_type(), | |
| 452 | - [ | |
| 453 | - 'name' => 'job_shadow', | |
| 454 | - 'selector' => '{{WRAPPER}} .elementor-testimonial-job', | |
| 455 | - ] | |
| 456 | - ); | |
| 457 | - | |
| 458 | 379 | $this->end_controls_section(); |
| 459 | 380 | } |
| 460 | 381 | |
| 461 | 382 | /** |
| @@ -468,19 +389,14 @@ | ||
| 468 | 389 | */ |
| 469 | 390 | protected function render() { |
| 470 | 391 | $settings = $this->get_settings_for_display(); |
| 471 | 392 | |
| 472 | - $has_content = ! empty( $settings['testimonial_content'] ); | |
| 473 | - $has_image = ! empty( $settings['testimonial_image']['url'] ); | |
| 474 | - $has_name = ! empty( $settings['testimonial_name'] ); | |
| 475 | - $has_job = ! empty( $settings['testimonial_job'] ); | |
| 393 | + $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' ); | |
| 476 | 394 | |
| 477 | - if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) { | |
| 478 | - return; | |
| 395 | + if ( $settings['testimonial_alignment'] ) { | |
| 396 | + $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-text-align-' . $settings['testimonial_alignment'] ); | |
| 479 | 397 | } |
| 480 | 398 | |
| 481 | - $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' ); | |
| 482 | - | |
| 483 | 399 | $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-meta' ); |
| 484 | 400 | |
| 485 | 401 | if ( $settings['testimonial_image']['url'] ) { |
| 486 | 402 | $this->add_render_attribute( 'meta', 'class', 'elementor-has-image' ); |
| @@ -489,23 +405,32 @@ | ||
| 489 | 405 | if ( $settings['testimonial_image_position'] ) { |
| 490 | 406 | $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-image-position-' . $settings['testimonial_image_position'] ); |
| 491 | 407 | } |
| 492 | 408 | |
| 409 | + $has_content = ! ! $settings['testimonial_content']; | |
| 410 | + $has_image = ! ! $settings['testimonial_image']['url']; | |
| 411 | + $has_name = ! ! $settings['testimonial_name']; | |
| 412 | + $has_job = ! ! $settings['testimonial_job']; | |
| 413 | + | |
| 414 | + if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) { | |
| 415 | + return; | |
| 416 | + } | |
| 417 | + | |
| 493 | 418 | if ( ! empty( $settings['link']['url'] ) ) { |
| 494 | 419 | $this->add_link_attributes( 'link', $settings['link'] ); |
| 495 | 420 | } |
| 496 | 421 | ?> |
| 497 | - <div <?php $this->print_render_attribute_string( 'wrapper' ); ?>> | |
| 422 | + <div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> | |
| 498 | 423 | <?php |
| 499 | 424 | if ( $has_content ) : |
| 500 | 425 | $this->add_render_attribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 501 | 426 | $this->add_inline_editing_attributes( 'testimonial_content' ); |
| 502 | 427 | ?> |
| 503 | - <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php echo wp_kses_post( $settings['testimonial_content'] ); ?></div> | |
| 428 | + <div <?php echo $this->get_render_attribute_string( 'testimonial_content' ); ?>><?php echo $settings['testimonial_content']; ?></div> | |
| 504 | 429 | <?php endif; ?> |
| 505 | 430 | |
| 506 | 431 | <?php if ( $has_image || $has_name || $has_job ) : ?> |
| 507 | - <div <?php $this->print_render_attribute_string( 'meta' ); ?>> | |
| 432 | + <div <?php echo $this->get_render_attribute_string( 'meta' ); ?>> | |
| 508 | 433 | <div class="elementor-testimonial-meta-inner"> |
| 509 | 434 | <?php if ( $has_image ) : ?> |
| 510 | 435 | <div class="elementor-testimonial-image"> |
| 511 | 436 | <?php |
| @@ -512,9 +437,9 @@ | ||
| 512 | 437 | $image_html = Group_Control_Image_Size::get_attachment_image_html( $settings, 'testimonial_image' ); |
| 513 | 438 | if ( ! empty( $settings['link']['url'] ) ) : |
| 514 | 439 | $image_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $image_html . '</a>'; |
| 515 | 440 | endif; |
| 516 | - echo wp_kses_post( $image_html ); | |
| 441 | + echo $image_html; | |
| 517 | 442 | ?> |
| 518 | 443 | </div> |
| 519 | 444 | <?php endif; ?> |
| 520 | 445 | |
| @@ -524,15 +449,17 @@ | ||
| 524 | 449 | if ( $has_name ) : |
| 525 | 450 | $this->add_render_attribute( 'testimonial_name', 'class', 'elementor-testimonial-name' ); |
| 526 | 451 | $this->add_inline_editing_attributes( 'testimonial_name', 'none' ); |
| 527 | 452 | |
| 453 | + $testimonial_name_html = $settings['testimonial_name']; | |
| 454 | + | |
| 528 | 455 | if ( ! empty( $settings['link']['url'] ) ) : |
| 529 | 456 | ?> |
| 530 | - <a <?php $this->print_render_attribute_string( 'testimonial_name' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></a> | |
| 457 | + <a <?php echo $this->get_render_attribute_string( 'testimonial_name' ) . ' ' . $this->get_render_attribute_string( 'link' ); ?>><?php echo $testimonial_name_html; ?></a> | |
| 531 | 458 | <?php |
| 532 | 459 | else : |
| 533 | 460 | ?> |
| 534 | - <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></div> | |
| 461 | + <div <?php echo $this->get_render_attribute_string( 'testimonial_name' ); ?>><?php echo $testimonial_name_html; ?></div> | |
| 535 | 462 | <?php |
| 536 | 463 | endif; |
| 537 | 464 | endif; ?> |
| 538 | 465 | <?php |
| @@ -540,15 +467,17 @@ | ||
| 540 | 467 | $this->add_render_attribute( 'testimonial_job', 'class', 'elementor-testimonial-job' ); |
| 541 | 468 | |
| 542 | 469 | $this->add_inline_editing_attributes( 'testimonial_job', 'none' ); |
| 543 | 470 | |
| 471 | + $testimonial_job_html = $settings['testimonial_job']; | |
| 472 | + | |
| 544 | 473 | if ( ! empty( $settings['link']['url'] ) ) : |
| 545 | 474 | ?> |
| 546 | - <a <?php $this->print_render_attribute_string( 'testimonial_job' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></a> | |
| 475 | + <a <?php echo $this->get_render_attribute_string( 'testimonial_job' ) . ' ' . $this->get_render_attribute_string( 'link' ); ?>><?php echo $testimonial_job_html; ?></a> | |
| 547 | 476 | <?php |
| 548 | 477 | else : |
| 549 | 478 | ?> |
| 550 | - <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></div> | |
| 479 | + <div <?php echo $this->get_render_attribute_string( 'testimonial_job' ); ?>><?php echo $testimonial_job_html; ?></div> | |
| 551 | 480 | <?php |
| 552 | 481 | endif; |
| 553 | 482 | endif; ?> |
| 554 | 483 | </div> |
| @@ -567,41 +496,11 @@ | ||
| 567 | 496 | * |
| 568 | 497 | * @since 2.9.0 |
| 569 | 498 | * @access protected |
| 570 | 499 | */ |
| 571 | - public function render_markdown(): string { | |
| 572 | - $settings = $this->get_settings_for_display(); | |
| 573 | - | |
| 574 | - $content = Utils::html_to_plain_text( $settings['testimonial_content'] ?? '' ); | |
| 575 | - $name = Utils::html_to_plain_text( $settings['testimonial_name'] ?? '' ); | |
| 576 | - $job = Utils::html_to_plain_text( $settings['testimonial_job'] ?? '' ); | |
| 577 | - | |
| 578 | - if ( empty( $content ) && empty( $name ) ) { | |
| 579 | - return ''; | |
| 580 | - } | |
| 581 | - | |
| 582 | - $md = ''; | |
| 583 | - | |
| 584 | - if ( ! empty( $content ) ) { | |
| 585 | - $md = '> "' . $content . '"'; | |
| 586 | - } | |
| 587 | - | |
| 588 | - $attribution = array_filter( [ $name, $job ] ); | |
| 589 | - | |
| 590 | - if ( ! empty( $attribution ) ) { | |
| 591 | - $md .= "\n>\n> -- " . implode( ', ', $attribution ); | |
| 592 | - } | |
| 593 | - | |
| 594 | - return $md; | |
| 595 | - } | |
| 596 | - | |
| 597 | 500 | protected function content_template() { |
| 598 | 501 | ?> |
| 599 | 502 | <# |
| 600 | - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) { | |
| 601 | - return; | |
| 602 | - } | |
| 603 | - | |
| 604 | 503 | var image = { |
| 605 | 504 | id: settings.testimonial_image.id, |
| 606 | 505 | url: settings.testimonial_image.url, |
| 607 | 506 | size: settings.testimonial_image_size, |
| @@ -613,32 +512,24 @@ | ||
| 613 | 512 | if ( '' !== settings.testimonial_image.url ) { |
| 614 | 513 | imageUrl = elementor.imagesManager.getImageUrl( image ); |
| 615 | 514 | hasImage = ' elementor-has-image'; |
| 616 | 515 | |
| 617 | - var imageHtml = '<img src="' + _.escape( imageUrl ) + '" alt="testimonial" />'; | |
| 618 | - if ( settings.link?.url ) { | |
| 619 | - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + imageHtml + '</a>'; | |
| 516 | + var imageHtml = '<img src="' + imageUrl + '" alt="testimonial" />'; | |
| 517 | + if ( settings.link.url ) { | |
| 518 | + imageHtml = '<a href="' + settings.link.url + '">' + imageHtml + '</a>'; | |
| 620 | 519 | } |
| 621 | 520 | } |
| 622 | 521 | |
| 522 | + var testimonial_alignment = settings.testimonial_alignment ? ' elementor-testimonial-text-align-' + settings.testimonial_alignment : ''; | |
| 623 | 523 | var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : ''; |
| 624 | 524 | #> |
| 625 | - <div class="elementor-testimonial-wrapper"> | |
| 525 | + <div class="elementor-testimonial-wrapper{{ testimonial_alignment }}"> | |
| 626 | 526 | <# if ( '' !== settings.testimonial_content ) { |
| 627 | - view.addRenderAttribute( 'testimonial_content', { | |
| 628 | - 'data-binding-type': 'content', | |
| 629 | - 'data-binding-setting': 'testimonial_content', | |
| 630 | - 'data-binding-config': JSON.stringify({ | |
| 631 | - 'testimonial_content': { | |
| 632 | - editType: "text" | |
| 633 | - } | |
| 634 | - }) | |
| 635 | - } ); | |
| 636 | 527 | view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 637 | 528 | |
| 638 | 529 | view.addInlineEditingAttributes( 'testimonial_content' ); |
| 639 | 530 | #> |
| 640 | - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div> | |
| 531 | + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div> | |
| 641 | 532 | <# } #> |
| 642 | 533 | <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}"> |
| 643 | 534 | <div class="elementor-testimonial-meta-inner"> |
| 644 | 535 | <# if ( imageUrl ) { #> |
| @@ -660,15 +551,15 @@ | ||
| 660 | 551 | view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' ); |
| 661 | 552 | |
| 662 | 553 | view.addInlineEditingAttributes( 'testimonial_name', 'none' ); |
| 663 | 554 | |
| 664 | - if ( settings.link?.url ) { | |
| 555 | + if ( settings.link.url ) { | |
| 665 | 556 | #> |
| 666 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a> | |
| 557 | + <a href="{{{ settings.link.url }}}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a> | |
| 667 | 558 | <# |
| 668 | 559 | } else { |
| 669 | 560 | #> |
| 670 | - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div> | |
| 561 | + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div> | |
| 671 | 562 | <# |
| 672 | 563 | } |
| 673 | 564 | } |
| 674 | 565 | |
| @@ -676,15 +567,15 @@ | ||
| 676 | 567 | view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' ); |
| 677 | 568 | |
| 678 | 569 | view.addInlineEditingAttributes( 'testimonial_job', 'none' ); |
| 679 | 570 | |
| 680 | - if ( settings.link?.url ) { | |
| 571 | + if ( settings.link.url ) { | |
| 681 | 572 | #> |
| 682 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a> | |
| 573 | + <a href="{{{ settings.link.url }}}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a> | |
| 683 | 574 | <# |
| 684 | 575 | } else { |
| 685 | 576 | #> |
| 686 | - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div> | |
| 577 | + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div> | |
| 687 | 578 | <# |
| 688 | 579 | } |
| 689 | 580 | } |
| 690 | 581 | #> |