| @@ -1,18 +1,16 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Base\App; |
| 5 | -use Elementor\Core\Base\Elements_Iteration_Actions\Assets; | |
| 6 | -use Elementor\Core\Files\Fonts\Google_Font; | |
| 5 | +use Elementor\Core\Base\Document; | |
| 7 | 6 | use Elementor\Core\Frontend\Render_Mode_Manager; |
| 8 | 7 | use Elementor\Core\Responsive\Files\Frontend as FrontendFile; |
| 8 | +use Elementor\Core\Files\CSS\Global_CSS; | |
| 9 | 9 | use Elementor\Core\Files\CSS\Post as Post_CSS; |
| 10 | 10 | use Elementor\Core\Files\CSS\Post_Preview; |
| 11 | 11 | use Elementor\Core\Responsive\Responsive; |
| 12 | 12 | use Elementor\Core\Settings\Manager as SettingsManager; |
| 13 | -use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; | |
| 14 | -use Elementor\Modules\FloatingButtons\Module; | |
| 15 | 13 | |
| 16 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | 15 | exit; // Exit if accessed directly. |
| 18 | 16 | } |
| @@ -32,13 +30,8 @@ | ||
| 32 | 30 | */ |
| 33 | 31 | const THE_CONTENT_FILTER_PRIORITY = 9; |
| 34 | 32 | |
| 35 | 33 | /** |
| 36 | - * The priority of the frontend enqueued styles. | |
| 37 | - */ | |
| 38 | - const ENQUEUED_STYLES_PRIORITY = 20; | |
| 39 | - | |
| 40 | - /** | |
| 41 | 34 | * Post ID. |
| 42 | 35 | * |
| 43 | 36 | * Holds the ID of the current post. |
| 44 | 37 | * |
| @@ -171,12 +164,8 @@ | ||
| 171 | 164 | |
| 172 | 165 | // Hack to avoid enqueue post CSS while it's a `the_excerpt` call. |
| 173 | 166 | add_filter( 'get_the_excerpt', [ $this, 'start_excerpt_flag' ], 1 ); |
| 174 | 167 | add_filter( 'get_the_excerpt', [ $this, 'end_excerpt_flag' ], 20 ); |
| 175 | - | |
| 176 | - if ( version_compare( get_bloginfo( 'version' ), '6.9', '>=' ) ) { | |
| 177 | - add_filter( 'wp_should_output_buffer_template_for_enhancement', '__return_false', 1 ); | |
| 178 | - } | |
| 179 | 168 | } |
| 180 | 169 | |
| 181 | 170 | /** |
| 182 | 171 | * Get module name. |
| @@ -230,12 +219,10 @@ | ||
| 230 | 219 | } |
| 231 | 220 | |
| 232 | 221 | $this->post_id = get_the_ID(); |
| 233 | 222 | |
| 234 | - $document = Plugin::$instance->documents->get( $this->post_id ); | |
| 235 | - | |
| 236 | - if ( is_singular() && $document && $document->is_built_with_elementor() ) { | |
| 237 | - add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ], self::ENQUEUED_STYLES_PRIORITY ); | |
| 223 | + if ( is_singular() && Plugin::$instance->db->is_built_with_elementor( $this->post_id ) ) { | |
| 224 | + add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ] ); | |
| 238 | 225 | } |
| 239 | 226 | |
| 240 | 227 | // Priority 7 to allow google fonts in header template to load in <head> tag |
| 241 | 228 | add_action( 'wp_head', [ $this, 'print_fonts_links' ], 7 ); |
| @@ -245,15 +232,15 @@ | ||
| 245 | 232 | |
| 246 | 233 | /** |
| 247 | 234 | * @since 2.0.12 |
| 248 | 235 | * @access public |
| 249 | - * @param string|array $class_name | |
| 236 | + * @param string|array $class | |
| 250 | 237 | */ |
| 251 | - public function add_body_class( $class_name ) { | |
| 252 | - if ( is_array( $class_name ) ) { | |
| 253 | - $this->body_classes = array_merge( $this->body_classes, $class_name ); | |
| 238 | + public function add_body_class( $class ) { | |
| 239 | + if ( is_array( $class ) ) { | |
| 240 | + $this->body_classes = array_merge( $this->body_classes, $class ); | |
| 254 | 241 | } else { |
| 255 | - $this->body_classes[] = $class_name; | |
| 242 | + $this->body_classes[] = $class; | |
| 256 | 243 | } |
| 257 | 244 | } |
| 258 | 245 | |
| 259 | 246 | /** |
| @@ -263,13 +250,13 @@ | ||
| 263 | 250 | * @access public |
| 264 | 251 | */ |
| 265 | 252 | public function add_theme_color_meta_tag() { |
| 266 | 253 | $kit = Plugin::$instance->kits_manager->get_active_kit_for_frontend(); |
| 267 | - $mobile_theme_color = $kit->get_settings( 'mobile_browser_background' ); | |
| 254 | + $mobile_theme_color = $kit->get_settings( 'mobile_theme_color' ); | |
| 268 | 255 | |
| 269 | 256 | if ( ! empty( $mobile_theme_color ) ) { |
| 270 | 257 | ?> |
| 271 | - <meta name="theme-color" content="<?php echo esc_attr( $mobile_theme_color ); ?>"> | |
| 258 | + <meta name="theme-color" content="<?php echo $mobile_theme_color; ?>"> | |
| 272 | 259 | <?php |
| 273 | 260 | } |
| 274 | 261 | } |
| 275 | 262 | |
| @@ -292,24 +279,12 @@ | ||
| 292 | 279 | $classes = array_merge( $classes, $this->body_classes ); |
| 293 | 280 | |
| 294 | 281 | $id = get_the_ID(); |
| 295 | 282 | |
| 296 | - $document = Plugin::$instance->documents->get( $id ); | |
| 297 | - | |
| 298 | - if ( is_singular() && $document && $document->is_built_with_elementor() ) { | |
| 283 | + if ( is_singular() && Plugin::$instance->db->is_built_with_elementor( $id ) ) { | |
| 299 | 284 | $classes[] = 'elementor-page elementor-page-' . $id; |
| 300 | 285 | } |
| 301 | 286 | |
| 302 | - if ( Plugin::$instance->preview->is_preview_mode() ) { | |
| 303 | - $editor_preferences = SettingsManager::get_settings_managers( 'editorPreferences' ); | |
| 304 | - | |
| 305 | - $show_hidden_elements = $editor_preferences->get_model()->get_settings( 'show_hidden_elements' ); | |
| 306 | - | |
| 307 | - if ( 'yes' === $show_hidden_elements ) { | |
| 308 | - $classes[] = 'e-preview--show-hidden-elements'; | |
| 309 | - } | |
| 310 | - } | |
| 311 | - | |
| 312 | 287 | return $classes; |
| 313 | 288 | } |
| 314 | 289 | |
| 315 | 290 | /** |
| @@ -357,20 +332,11 @@ | ||
| 357 | 332 | */ |
| 358 | 333 | do_action( 'elementor/frontend/before_register_scripts' ); |
| 359 | 334 | |
| 360 | 335 | wp_register_script( |
| 361 | - 'elementor-webpack-runtime', | |
| 362 | - $this->get_js_assets_url( 'webpack.runtime', 'assets/js/' ), | |
| 363 | - [], | |
| 364 | - ELEMENTOR_VERSION, | |
| 365 | - true | |
| 366 | - ); | |
| 367 | - | |
| 368 | - wp_register_script( | |
| 369 | 336 | 'elementor-frontend-modules', |
| 370 | 337 | $this->get_js_assets_url( 'frontend-modules' ), |
| 371 | 338 | [ |
| 372 | - 'elementor-webpack-runtime', | |
| 373 | 339 | 'jquery', |
| 374 | 340 | ], |
| 375 | 341 | ELEMENTOR_VERSION, |
| 376 | 342 | true |
| @@ -376,12 +342,14 @@ | ||
| 376 | 342 | true |
| 377 | 343 | ); |
| 378 | 344 | |
| 379 | 345 | wp_register_script( |
| 380 | - 'swiper', | |
| 381 | - $this->get_js_assets_url( 'swiper', 'assets/lib/swiper/v8/' ), | |
| 382 | - [], | |
| 383 | - '8.4.5', | |
| 346 | + 'elementor-waypoints', | |
| 347 | + $this->get_js_assets_url( 'waypoints', 'assets/lib/waypoints/' ), | |
| 348 | + [ | |
| 349 | + 'jquery', | |
| 350 | + ], | |
| 351 | + '4.0.2', | |
| 384 | 352 | true |
| 385 | 353 | ); |
| 386 | 354 | |
| 387 | 355 | wp_register_script( |
| @@ -389,9 +357,9 @@ | ||
| 389 | 357 | $this->get_js_assets_url( 'flatpickr', 'assets/lib/flatpickr/' ), |
| 390 | 358 | [ |
| 391 | 359 | 'jquery', |
| 392 | 360 | ], |
| 393 | - '4.6.13', | |
| 361 | + '4.1.4', | |
| 394 | 362 | true |
| 395 | 363 | ); |
| 396 | 364 | |
| 397 | 365 | wp_register_script( |
| @@ -414,14 +382,35 @@ | ||
| 414 | 382 | true |
| 415 | 383 | ); |
| 416 | 384 | |
| 417 | 385 | wp_register_script( |
| 386 | + 'swiper', | |
| 387 | + $this->get_js_assets_url( 'swiper', 'assets/lib/swiper/' ), | |
| 388 | + [], | |
| 389 | + '5.3.6', | |
| 390 | + true | |
| 391 | + ); | |
| 392 | + | |
| 393 | + /** | |
| 394 | + * @deprecated since 2.7.0 Use Swiper instead | |
| 395 | + */ | |
| 396 | + wp_register_script( | |
| 397 | + 'jquery-slick', | |
| 398 | + $this->get_js_assets_url( 'slick', 'assets/lib/slick/' ), | |
| 399 | + [ | |
| 400 | + 'jquery', | |
| 401 | + ], | |
| 402 | + '1.8.1', | |
| 403 | + true | |
| 404 | + ); | |
| 405 | + | |
| 406 | + wp_register_script( | |
| 418 | 407 | 'elementor-dialog', |
| 419 | 408 | $this->get_js_assets_url( 'dialog', 'assets/lib/dialog/' ), |
| 420 | 409 | [ |
| 421 | 410 | 'jquery-ui-position', |
| 422 | 411 | ], |
| 423 | - '4.9.4', | |
| 412 | + '4.8.1', | |
| 424 | 413 | true |
| 425 | 414 | ); |
| 426 | 415 | |
| 427 | 416 | wp_register_script( |
| @@ -448,16 +437,17 @@ | ||
| 448 | 437 | 'elementor-frontend', |
| 449 | 438 | $this->get_js_assets_url( 'frontend' ), |
| 450 | 439 | [ |
| 451 | 440 | 'elementor-frontend-modules', |
| 452 | - 'jquery-ui-position', | |
| 441 | + 'elementor-dialog', | |
| 442 | + 'elementor-waypoints', | |
| 443 | + 'swiper', | |
| 444 | + 'share-link', | |
| 453 | 445 | ], |
| 454 | 446 | ELEMENTOR_VERSION, |
| 455 | 447 | true |
| 456 | 448 | ); |
| 457 | 449 | |
| 458 | - $this->register_frontend_handlers(); | |
| 459 | - | |
| 460 | 450 | /** |
| 461 | 451 | * After frontend register scripts. |
| 462 | 452 | * |
| 463 | 453 | * Fires after Elementor frontend scripts are registered. |
| @@ -477,12 +467,8 @@ | ||
| 477 | 467 | * @since 1.2.0 |
| 478 | 468 | * @access public |
| 479 | 469 | */ |
| 480 | 470 | public function register_styles() { |
| 481 | - $min_suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 482 | - $direction_suffix = is_rtl() ? '-rtl' : ''; | |
| 483 | - $has_custom_breakpoints = Plugin::$instance->breakpoints->has_custom_breakpoints(); | |
| 484 | - | |
| 485 | 471 | /** |
| 486 | 472 | * Before frontend register styles. |
| 487 | 473 | * |
| 488 | 474 | * Fires before Elementor frontend styles are registered. |
| @@ -501,16 +487,23 @@ | ||
| 501 | 487 | wp_register_style( |
| 502 | 488 | 'elementor-icons', |
| 503 | 489 | $this->get_css_assets_url( 'elementor-icons', 'assets/lib/eicons/css/' ), |
| 504 | 490 | [], |
| 505 | - Icons_Manager::ELEMENTOR_ICONS_VERSION | |
| 491 | + '5.9.1' | |
| 506 | 492 | ); |
| 507 | 493 | |
| 508 | 494 | wp_register_style( |
| 495 | + 'elementor-animations', | |
| 496 | + $this->get_css_assets_url( 'animations', 'assets/lib/animations/', true ), | |
| 497 | + [], | |
| 498 | + ELEMENTOR_VERSION | |
| 499 | + ); | |
| 500 | + | |
| 501 | + wp_register_style( | |
| 509 | 502 | 'flatpickr', |
| 510 | 503 | $this->get_css_assets_url( 'flatpickr', 'assets/lib/flatpickr/' ), |
| 511 | 504 | [], |
| 512 | - '4.6.13' | |
| 505 | + '4.1.4' | |
| 513 | 506 | ); |
| 514 | 507 | |
| 515 | 508 | wp_register_style( |
| 516 | 509 | 'elementor-gallery', |
| @@ -518,69 +511,50 @@ | ||
| 518 | 511 | [], |
| 519 | 512 | '1.2.0' |
| 520 | 513 | ); |
| 521 | 514 | |
| 522 | - wp_register_style( | |
| 523 | - 'e-apple-webkit', | |
| 524 | - $this->get_frontend_file_url( 'apple-webkit.min.css', $has_custom_breakpoints, 'conditionals/' ), | |
| 525 | - [], | |
| 526 | - $has_custom_breakpoints ? null : ELEMENTOR_VERSION | |
| 527 | - ); | |
| 515 | + $min_suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 528 | 516 | |
| 529 | - wp_register_style( | |
| 530 | - 'e-swiper', | |
| 531 | - $this->get_css_assets_url( 'e-swiper', 'assets/css/conditionals/' ), | |
| 532 | - [ 'swiper' ], | |
| 533 | - ELEMENTOR_VERSION | |
| 534 | - ); | |
| 517 | + $direction_suffix = is_rtl() ? '-rtl' : ''; | |
| 535 | 518 | |
| 536 | - wp_register_style( | |
| 537 | - 'swiper', | |
| 538 | - $this->get_css_assets_url( 'swiper', 'assets/lib/swiper/v8/css/' ), | |
| 539 | - [], | |
| 540 | - '8.4.5' | |
| 541 | - ); | |
| 519 | + $frontend_file_name = 'frontend' . $direction_suffix . $min_suffix . '.css'; | |
| 542 | 520 | |
| 543 | - wp_register_style( | |
| 544 | - 'elementor-wp-admin-bar', | |
| 545 | - $this->get_css_assets_url( 'admin-bar', 'assets/css/' ), | |
| 546 | - [], | |
| 547 | - ELEMENTOR_VERSION | |
| 548 | - ); | |
| 521 | + $has_custom_file = Responsive::has_custom_breakpoints(); | |
| 549 | 522 | |
| 550 | - wp_register_style( | |
| 551 | - 'e-lightbox', | |
| 552 | - $this->get_frontend_file_url( 'lightbox.min.css', $has_custom_breakpoints, 'conditionals/' ), | |
| 553 | - [], | |
| 554 | - $has_custom_breakpoints ? null : ELEMENTOR_VERSION | |
| 555 | - ); | |
| 523 | + if ( $has_custom_file ) { | |
| 524 | + $frontend_file = new FrontendFile( 'custom-' . $frontend_file_name, Responsive::get_stylesheet_templates_path() . $frontend_file_name ); | |
| 556 | 525 | |
| 557 | - wp_register_style( | |
| 558 | - 'elementor-frontend', | |
| 559 | - $this->get_frontend_file_url( "frontend{$min_suffix}.css", $has_custom_breakpoints ), | |
| 560 | - [], | |
| 561 | - $has_custom_breakpoints ? null : ELEMENTOR_VERSION | |
| 562 | - ); | |
| 526 | + $time = $frontend_file->get_meta( 'time' ); | |
| 563 | 527 | |
| 564 | - $widgets_with_styles = Plugin::$instance->widgets_manager->widgets_with_styles(); | |
| 565 | - foreach ( $widgets_with_styles as $widget_name ) { | |
| 528 | + if ( ! $time ) { | |
| 529 | + $frontend_file->update(); | |
| 530 | + } | |
| 531 | + | |
| 532 | + $frontend_file_url = $frontend_file->get_url(); | |
| 533 | + } else { | |
| 534 | + $frontend_file_url = ELEMENTOR_ASSETS_URL . 'css/' . $frontend_file_name; | |
| 535 | + } | |
| 536 | + | |
| 537 | + $frontend_dependencies = []; | |
| 538 | + | |
| 539 | + if ( Plugin::instance()->get_legacy_mode( 'elementWrappers' ) ) { | |
| 540 | + // If The Markup Legacy Mode is active, register the legacy CSS | |
| 566 | 541 | wp_register_style( |
| 567 | - "widget-{$widget_name}", | |
| 568 | - $this->get_css_assets_url( "widget-{$widget_name}", null, true, true ), | |
| 569 | - [ 'elementor-frontend' ], | |
| 542 | + 'elementor-frontend-legacy', | |
| 543 | + ELEMENTOR_ASSETS_URL . 'css/frontend-legacy' . $direction_suffix . $min_suffix . '.css', | |
| 544 | + [], | |
| 570 | 545 | ELEMENTOR_VERSION |
| 571 | 546 | ); |
| 547 | + | |
| 548 | + $frontend_dependencies[] = 'elementor-frontend-legacy'; | |
| 572 | 549 | } |
| 573 | 550 | |
| 574 | - $widgets_with_responsive_styles = Plugin::$instance->widgets_manager->widgets_with_responsive_styles(); | |
| 575 | - foreach ( $widgets_with_responsive_styles as $widget_name ) { | |
| 576 | - wp_register_style( | |
| 577 | - "widget-{$widget_name}", | |
| 578 | - $this->get_frontend_file_url( "widget-{$widget_name}{$direction_suffix}.min.css", $has_custom_breakpoints ), | |
| 579 | - [ 'elementor-frontend' ], | |
| 580 | - $has_custom_breakpoints ? null : ELEMENTOR_VERSION | |
| 581 | - ); | |
| 582 | - } | |
| 551 | + wp_register_style( | |
| 552 | + 'elementor-frontend', | |
| 553 | + $frontend_file_url, | |
| 554 | + $frontend_dependencies, | |
| 555 | + $has_custom_file ? null : ELEMENTOR_VERSION | |
| 556 | + ); | |
| 583 | 557 | |
| 584 | 558 | /** |
| 585 | 559 | * After frontend register styles. |
| 586 | 560 | * |
| @@ -591,23 +565,8 @@ | ||
| 591 | 565 | do_action( 'elementor/frontend/after_register_styles' ); |
| 592 | 566 | } |
| 593 | 567 | |
| 594 | 568 | /** |
| 595 | - * Register frontend handlers. | |
| 596 | - * | |
| 597 | - * Registers all the frontend handlers for widgets and elements. | |
| 598 | - * | |
| 599 | - * Fired by `wp_enqueue_scripts` action. | |
| 600 | - * | |
| 601 | - * @since 3.25.0 | |
| 602 | - * @access public | |
| 603 | - */ | |
| 604 | - public function register_frontend_handlers() { | |
| 605 | - Plugin::$instance->widgets_manager->register_frontend_handlers(); | |
| 606 | - Plugin::$instance->elements_manager->register_frontend_handlers(); | |
| 607 | - } | |
| 608 | - | |
| 609 | - /** | |
| 610 | 569 | * Enqueue scripts. |
| 611 | 570 | * |
| 612 | 571 | * Enqueue all the frontend scripts. |
| 613 | 572 | * |
| @@ -623,12 +582,12 @@ | ||
| 623 | 582 | * @since 1.0.0 |
| 624 | 583 | */ |
| 625 | 584 | do_action( 'elementor/frontend/before_enqueue_scripts' ); |
| 626 | 585 | |
| 586 | + wp_enqueue_script( 'elementor-frontend' ); | |
| 587 | + | |
| 627 | 588 | $this->print_config(); |
| 628 | 589 | |
| 629 | - $this->enqueue_conditional_assets(); | |
| 630 | - | |
| 631 | 590 | /** |
| 632 | 591 | * After frontend enqueue scripts. |
| 633 | 592 | * |
| 634 | 593 | * Fires after Elementor frontend scripts are enqueued. |
| @@ -648,185 +607,43 @@ | ||
| 648 | 607 | * @since 1.0.0 |
| 649 | 608 | * @access public |
| 650 | 609 | */ |
| 651 | 610 | public function enqueue_styles() { |
| 652 | - static $is_enqueue_styles_already_triggered; | |
| 611 | + /** | |
| 612 | + * Before frontend styles enqueued. | |
| 613 | + * | |
| 614 | + * Fires before Elementor frontend styles are enqueued. | |
| 615 | + * | |
| 616 | + * @since 1.0.0 | |
| 617 | + */ | |
| 618 | + do_action( 'elementor/frontend/before_enqueue_styles' ); | |
| 653 | 619 | |
| 654 | - if ( ! $is_enqueue_styles_already_triggered ) { | |
| 655 | - $is_enqueue_styles_already_triggered = true; | |
| 620 | + wp_enqueue_style( 'elementor-icons' ); | |
| 621 | + wp_enqueue_style( 'elementor-animations' ); | |
| 622 | + wp_enqueue_style( 'elementor-frontend' ); | |
| 656 | 623 | |
| 657 | - /** | |
| 658 | - * Before frontend styles enqueued. | |
| 659 | - * | |
| 660 | - * Fires before Elementor frontend styles are enqueued. | |
| 661 | - * | |
| 662 | - * @since 1.0.0 | |
| 663 | - */ | |
| 664 | - do_action( 'elementor/frontend/before_enqueue_styles' ); | |
| 624 | + /** | |
| 625 | + * After frontend styles enqueued. | |
| 626 | + * | |
| 627 | + * Fires after Elementor frontend styles are enqueued. | |
| 628 | + * | |
| 629 | + * @since 1.0.0 | |
| 630 | + */ | |
| 631 | + do_action( 'elementor/frontend/after_enqueue_styles' ); | |
| 665 | 632 | |
| 666 | - // The e-icons are needed in preview mode for the editor icons (plus-icon for new section, folder-icon for the templates library etc.). | |
| 667 | - if ( ! Plugin::$instance->experiments->is_feature_active( 'e_font_icon_svg' ) || Plugin::$instance->preview->is_preview_mode() ) { | |
| 668 | - wp_enqueue_style( 'elementor-icons' ); | |
| 669 | - } | |
| 633 | + if ( ! Plugin::$instance->preview->is_preview_mode() ) { | |
| 634 | + $this->parse_global_css_code(); | |
| 670 | 635 | |
| 671 | - wp_enqueue_style( 'elementor-frontend' ); | |
| 672 | - | |
| 673 | - if ( is_admin_bar_showing() ) { | |
| 674 | - wp_enqueue_style( 'elementor-wp-admin-bar' ); | |
| 636 | + $post_id = get_the_ID(); | |
| 637 | + // Check $post_id for virtual pages. check is singular because the $post_id is set to the first post on archive pages. | |
| 638 | + if ( $post_id && is_singular() ) { | |
| 639 | + $css_file = Post_CSS::create( get_the_ID() ); | |
| 640 | + $css_file->enqueue(); | |
| 675 | 641 | } |
| 676 | - | |
| 677 | - /** | |
| 678 | - * After frontend styles enqueued. | |
| 679 | - * | |
| 680 | - * Fires after Elementor frontend styles are enqueued. | |
| 681 | - * | |
| 682 | - * @since 1.0.0 | |
| 683 | - */ | |
| 684 | - do_action( 'elementor/frontend/after_enqueue_styles' ); | |
| 685 | - | |
| 686 | - if ( ! Plugin::$instance->preview->is_preview_mode() ) { | |
| 687 | - $post_id = get_the_ID(); | |
| 688 | - // Check $post_id for virtual pages. check is singular because the $post_id is set to the first post on archive pages. | |
| 689 | - if ( $post_id && is_singular() ) { | |
| 690 | - do_action( 'elementor/post/render', $post_id ); | |
| 691 | - $this->handle_page_assets( $post_id ); | |
| 692 | - | |
| 693 | - $css_file = Post_CSS::create( get_the_ID() ); | |
| 694 | - $css_file->enqueue(); | |
| 695 | - } | |
| 696 | - } else { | |
| 697 | - $post_id = Plugin::$instance->preview->get_post_id(); | |
| 698 | - if ( $post_id ) { | |
| 699 | - do_action( 'elementor/post/render', $post_id ); | |
| 700 | - } | |
| 701 | - } | |
| 702 | - | |
| 703 | - do_action( 'elementor/frontend/after_enqueue_post_styles' ); | |
| 704 | 642 | } |
| 705 | 643 | } |
| 706 | 644 | |
| 707 | - private function handle_page_assets( $post_id ): void { | |
| 708 | - $page_assets = get_post_meta( $post_id, Assets::ASSETS_META_KEY, true ); | |
| 709 | - if ( ! empty( $page_assets ) ) { | |
| 710 | - Plugin::$instance->assets_loader->enable_assets( $page_assets ); | |
| 711 | - return; | |
| 712 | - } | |
| 713 | - | |
| 714 | - $document = Plugin::$instance->documents->get( $post_id ); | |
| 715 | - | |
| 716 | - if ( ! $document ) { | |
| 717 | - return; | |
| 718 | - } | |
| 719 | - | |
| 720 | - $document->update_runtime_elements(); | |
| 721 | - } | |
| 722 | - | |
| 723 | 645 | /** |
| 724 | - * Get Frontend File URL | |
| 725 | - * | |
| 726 | - * Returns the URL for the CSS file to be loaded in the front end. If requested via the second parameter, a custom | |
| 727 | - * file is generated based on a passed template file name. Otherwise, the URL for the default CSS file is returned. | |
| 728 | - * | |
| 729 | - * @since 3.4.5 | |
| 730 | - * | |
| 731 | - * @access public | |
| 732 | - * | |
| 733 | - * @param string $frontend_file_name | |
| 734 | - * @param boolean $custom_file | |
| 735 | - * | |
| 736 | - * @return string frontend file URL | |
| 737 | - */ | |
| 738 | - public function get_frontend_file_url( $frontend_file_name, $custom_file, $css_subfolder = '' ) { | |
| 739 | - if ( $custom_file ) { | |
| 740 | - $frontend_file = $this->get_frontend_file( $frontend_file_name ); | |
| 741 | - | |
| 742 | - $frontend_file_url = $frontend_file->get_url(); | |
| 743 | - } else { | |
| 744 | - $frontend_file_url = ELEMENTOR_ASSETS_URL . 'css/' . $css_subfolder . $frontend_file_name; | |
| 745 | - } | |
| 746 | - | |
| 747 | - return $frontend_file_url; | |
| 748 | - } | |
| 749 | - | |
| 750 | - /** | |
| 751 | - * Get Frontend File Path | |
| 752 | - * | |
| 753 | - * Returns the path for the CSS file to be loaded in the front end. If requested via the second parameter, a custom | |
| 754 | - * file is generated based on a passed template file name. Otherwise, the path for the default CSS file is returned. | |
| 755 | - * | |
| 756 | - * @since 3.5.0 | |
| 757 | - * @access public | |
| 758 | - * | |
| 759 | - * @param string $frontend_file_name | |
| 760 | - * @param boolean $custom_file | |
| 761 | - * | |
| 762 | - * @return string frontend file path | |
| 763 | - */ | |
| 764 | - public function get_frontend_file_path( $frontend_file_name, $custom_file ) { | |
| 765 | - if ( $custom_file ) { | |
| 766 | - $frontend_file = $this->get_frontend_file( $frontend_file_name ); | |
| 767 | - | |
| 768 | - $frontend_file_path = $frontend_file->get_path(); | |
| 769 | - } else { | |
| 770 | - $frontend_file_path = ELEMENTOR_ASSETS_PATH . 'css/' . $frontend_file_name; | |
| 771 | - } | |
| 772 | - | |
| 773 | - return $frontend_file_path; | |
| 774 | - } | |
| 775 | - | |
| 776 | - /** | |
| 777 | - * Get Frontend File | |
| 778 | - * | |
| 779 | - * Returns a frontend file instance. | |
| 780 | - * | |
| 781 | - * @since 3.5.0 | |
| 782 | - * @access public | |
| 783 | - * | |
| 784 | - * @param string $frontend_file_name | |
| 785 | - * @param string $file_prefix | |
| 786 | - * @param string $template_file_path | |
| 787 | - * | |
| 788 | - * @return FrontendFile | |
| 789 | - */ | |
| 790 | - public function get_frontend_file( $frontend_file_name, $file_prefix = 'custom-', $template_file_path = '' ) { | |
| 791 | - static $cached_frontend_files = []; | |
| 792 | - | |
| 793 | - $file_name = $file_prefix . $frontend_file_name; | |
| 794 | - | |
| 795 | - if ( isset( $cached_frontend_files[ $file_name ] ) ) { | |
| 796 | - return $cached_frontend_files[ $file_name ]; | |
| 797 | - } | |
| 798 | - | |
| 799 | - if ( ! $template_file_path ) { | |
| 800 | - $template_file_path = Breakpoints_Manager::get_stylesheet_templates_path() . $frontend_file_name; | |
| 801 | - } | |
| 802 | - | |
| 803 | - $frontend_file = new FrontendFile( $file_name, $template_file_path ); | |
| 804 | - | |
| 805 | - $time = $frontend_file->get_meta( 'time' ); | |
| 806 | - | |
| 807 | - if ( ! $time ) { | |
| 808 | - $frontend_file->update(); | |
| 809 | - } | |
| 810 | - | |
| 811 | - $cached_frontend_files[ $file_name ] = $frontend_file; | |
| 812 | - | |
| 813 | - return $frontend_file; | |
| 814 | - } | |
| 815 | - | |
| 816 | - /** | |
| 817 | - * Enqueue assets conditionally. | |
| 818 | - * | |
| 819 | - * Enqueue all assets that were pre-enabled. | |
| 820 | - * | |
| 821 | - * @since 3.3.0 | |
| 822 | - * @access private | |
| 823 | - */ | |
| 824 | - private function enqueue_conditional_assets() { | |
| 825 | - Plugin::$instance->assets_loader->enqueue_assets(); | |
| 826 | - } | |
| 827 | - | |
| 828 | - /** | |
| 829 | 646 | * Elementor footer scripts and styles. |
| 830 | 647 | * |
| 831 | 648 | * Handle styles and scripts that are not printed in the header. |
| 832 | 649 | * |
| @@ -846,11 +663,18 @@ | ||
| 846 | 663 | $this->print_fonts_links(); |
| 847 | 664 | } |
| 848 | 665 | |
| 849 | 666 | /** |
| 850 | - * @return array|array[] | |
| 667 | + * Print fonts links. | |
| 668 | + * | |
| 669 | + * Enqueue all the frontend fonts by url. | |
| 670 | + * | |
| 671 | + * Fired by `wp_head` action. | |
| 672 | + * | |
| 673 | + * @since 1.9.4 | |
| 674 | + * @access public | |
| 851 | 675 | */ |
| 852 | - public function get_list_of_google_fonts_by_type(): array { | |
| 676 | + public function print_fonts_links() { | |
| 853 | 677 | $google_fonts = [ |
| 854 | 678 | 'google' => [], |
| 855 | 679 | 'early' => [], |
| 856 | 680 | ]; |
| @@ -886,36 +710,8 @@ | ||
| 886 | 710 | } |
| 887 | 711 | } |
| 888 | 712 | $this->fonts_to_enqueue = []; |
| 889 | 713 | |
| 890 | - return $google_fonts; | |
| 891 | - } | |
| 892 | - | |
| 893 | - /** | |
| 894 | - * Print fonts links. | |
| 895 | - * | |
| 896 | - * Enqueue all the frontend fonts by url. | |
| 897 | - * | |
| 898 | - * Fired by `wp_head` action. | |
| 899 | - * | |
| 900 | - * @since 1.9.4 | |
| 901 | - * @access public | |
| 902 | - */ | |
| 903 | - public function print_fonts_links() { | |
| 904 | - /** | |
| 905 | - * Register font styles. | |
| 906 | - * | |
| 907 | - * Fires before fonts are processed, allowing add-ons to register | |
| 908 | - * proper stylesheets for their custom font types via the WordPress API. | |
| 909 | - * | |
| 910 | - * @since 3.29.0 | |
| 911 | - * | |
| 912 | - * @param string[] $fonts_to_enqueue List of font families to be enqueued. | |
| 913 | - */ | |
| 914 | - do_action( 'elementor/fonts/register_styles', $this->fonts_to_enqueue ); | |
| 915 | - | |
| 916 | - $google_fonts = $this->get_list_of_google_fonts_by_type(); | |
| 917 | - | |
| 918 | 714 | $this->enqueue_google_fonts( $google_fonts ); |
| 919 | 715 | $this->enqueue_icon_fonts(); |
| 920 | 716 | } |
| 921 | 717 | |
| @@ -944,78 +740,13 @@ | ||
| 944 | 740 | wp_enqueue_style( 'elementor-icons-' . $icon_type ); |
| 945 | 741 | $this->enqueued_icon_fonts[] = $css_url; |
| 946 | 742 | } |
| 947 | 743 | |
| 948 | - // Clear enqueued icons. | |
| 744 | + //clear enqueued icons | |
| 949 | 745 | $this->icon_fonts_to_enqueue = []; |
| 950 | 746 | } |
| 951 | 747 | |
| 952 | 748 | /** |
| 953 | - * @param array $fonts Stable google fonts ($google_fonts['google']). | |
| 954 | - * @return string | |
| 955 | - */ | |
| 956 | - public function get_stable_google_fonts_url( array $fonts ): string { | |
| 957 | - foreach ( $fonts as &$font ) { | |
| 958 | - $font = str_replace( ' ', '+', $font ) . ':100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic'; | |
| 959 | - } | |
| 960 | - | |
| 961 | - // Defining a font-display type to google fonts. | |
| 962 | - $font_display_url_str = '&display=' . Fonts::get_font_display_setting(); | |
| 963 | - | |
| 964 | - $fonts_url = sprintf( 'https://fonts.googleapis.com/css?family=%1$s%2$s', implode( rawurlencode( '|' ), $fonts ), $font_display_url_str ); | |
| 965 | - | |
| 966 | - $subsets = [ | |
| 967 | - 'ru_RU' => 'cyrillic', | |
| 968 | - 'bg_BG' => 'cyrillic', | |
| 969 | - 'he_IL' => 'hebrew', | |
| 970 | - 'el' => 'greek', | |
| 971 | - 'vi' => 'vietnamese', | |
| 972 | - 'uk' => 'cyrillic', | |
| 973 | - 'cs_CZ' => 'latin-ext', | |
| 974 | - 'ro_RO' => 'latin-ext', | |
| 975 | - 'pl_PL' => 'latin-ext', | |
| 976 | - 'hr_HR' => 'latin-ext', | |
| 977 | - 'hu_HU' => 'latin-ext', | |
| 978 | - 'sk_SK' => 'latin-ext', | |
| 979 | - 'tr_TR' => 'latin-ext', | |
| 980 | - 'lt_LT' => 'latin-ext', | |
| 981 | - ]; | |
| 982 | - | |
| 983 | - /** | |
| 984 | - * Google font subsets. | |
| 985 | - * | |
| 986 | - * Filters the list of Google font subsets from which locale will be enqueued in frontend. | |
| 987 | - * | |
| 988 | - * @since 1.0.0 | |
| 989 | - * | |
| 990 | - * @param array $subsets A list of font subsets. | |
| 991 | - */ | |
| 992 | - $subsets = apply_filters( 'elementor/frontend/google_font_subsets', $subsets ); | |
| 993 | - | |
| 994 | - $locale = get_locale(); | |
| 995 | - | |
| 996 | - if ( isset( $subsets[ $locale ] ) ) { | |
| 997 | - $fonts_url .= '&subset=' . $subsets[ $locale ]; | |
| 998 | - } | |
| 999 | - | |
| 1000 | - return $fonts_url; | |
| 1001 | - } | |
| 1002 | - | |
| 1003 | - /** | |
| 1004 | - * @param array $fonts Early Access google fonts ($google_fonts['early']). | |
| 1005 | - * @return array | |
| 1006 | - */ | |
| 1007 | - public function get_early_access_google_font_urls( array $fonts ): array { | |
| 1008 | - $font_urls = []; | |
| 1009 | - | |
| 1010 | - foreach ( $fonts as $font ) { | |
| 1011 | - $font_urls[] = sprintf( 'https://fonts.googleapis.com/earlyaccess/%s.css', strtolower( str_replace( ' ', '', $font ) ) ); | |
| 1012 | - } | |
| 1013 | - | |
| 1014 | - return $font_urls; | |
| 1015 | - } | |
| 1016 | - | |
| 1017 | - /** | |
| 1018 | 749 | * Print Google fonts. |
| 1019 | 750 | * |
| 1020 | 751 | * Enqueue all the frontend Google fonts. |
| 1021 | 752 | * |
| @@ -1027,10 +758,12 @@ | ||
| 1027 | 758 | * @param array $google_fonts Optional. Google fonts to print in the frontend. |
| 1028 | 759 | * Default is an empty array. |
| 1029 | 760 | */ |
| 1030 | 761 | private function enqueue_google_fonts( $google_fonts = [] ) { |
| 1031 | - $print_google_fonts = Fonts::is_google_fonts_enabled(); | |
| 762 | + static $google_fonts_index = 0; | |
| 1032 | 763 | |
| 764 | + $print_google_fonts = true; | |
| 765 | + | |
| 1033 | 766 | /** |
| 1034 | 767 | * Print frontend google fonts. |
| 1035 | 768 | * |
| 1036 | 769 | * Filters whether to enqueue Google fonts in the frontend. |
| @@ -1044,21 +777,58 @@ | ||
| 1044 | 777 | if ( ! $print_google_fonts ) { |
| 1045 | 778 | return; |
| 1046 | 779 | } |
| 1047 | 780 | |
| 1048 | - $force_enqueue_from_cdn = Plugin::$instance->preview->is_preview_mode(); | |
| 781 | + // Print used fonts | |
| 782 | + if ( ! empty( $google_fonts['google'] ) ) { | |
| 783 | + $google_fonts_index++; | |
| 1049 | 784 | |
| 1050 | - if ( ! empty( $google_fonts['google'] ) ) { | |
| 1051 | - foreach ( $google_fonts['google'] as $current_font ) { | |
| 1052 | - Google_Font::enqueue( $current_font, Google_Font::TYPE_DEFAULT, $force_enqueue_from_cdn ); | |
| 785 | + foreach ( $google_fonts['google'] as &$font ) { | |
| 786 | + $font = str_replace( ' ', '+', $font ) . ':100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic'; | |
| 1053 | 787 | } |
| 788 | + | |
| 789 | + $fonts_url = sprintf( 'https://fonts.googleapis.com/css?family=%s', implode( rawurlencode( '|' ), $google_fonts['google'] ) ); | |
| 790 | + | |
| 791 | + $subsets = [ | |
| 792 | + 'ru_RU' => 'cyrillic', | |
| 793 | + 'bg_BG' => 'cyrillic', | |
| 794 | + 'he_IL' => 'hebrew', | |
| 795 | + 'el' => 'greek', | |
| 796 | + 'vi' => 'vietnamese', | |
| 797 | + 'uk' => 'cyrillic', | |
| 798 | + 'cs_CZ' => 'latin-ext', | |
| 799 | + 'ro_RO' => 'latin-ext', | |
| 800 | + 'pl_PL' => 'latin-ext', | |
| 801 | + 'hr_HR' => 'latin-ext', | |
| 802 | + 'hu_HU' => 'latin-ext', | |
| 803 | + 'sk_SK' => 'latin-ext', | |
| 804 | + 'tr_TR' => 'latin-ext', | |
| 805 | + 'lt_LT' => 'latin-ext', | |
| 806 | + ]; | |
| 807 | + | |
| 808 | + $subsets = apply_filters( 'elementor/frontend/google_font_subsets', $subsets ); | |
| 809 | + | |
| 810 | + $locale = get_locale(); | |
| 811 | + | |
| 812 | + if ( isset( $subsets[ $locale ] ) ) { | |
| 813 | + $fonts_url .= '&subset=' . $subsets[ $locale ]; | |
| 814 | + } | |
| 815 | + | |
| 816 | + wp_enqueue_style( 'google-fonts-' . $google_fonts_index, $fonts_url ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion | |
| 1054 | 817 | } |
| 1055 | 818 | |
| 1056 | 819 | if ( ! empty( $google_fonts['early'] ) ) { |
| 1057 | 820 | foreach ( $google_fonts['early'] as $current_font ) { |
| 1058 | - Google_Font::enqueue( $current_font, Google_Font::TYPE_EARLYACCESS, $force_enqueue_from_cdn ); | |
| 821 | + $google_fonts_index++; | |
| 822 | + | |
| 823 | + //printf( '<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/earlyaccess/%s.css">', strtolower( str_replace( ' ', '', $current_font ) ) ); | |
| 824 | + | |
| 825 | + $font_url = sprintf( 'https://fonts.googleapis.com/earlyaccess/%s.css', strtolower( str_replace( ' ', '', $current_font ) ) ); | |
| 826 | + | |
| 827 | + wp_enqueue_style( 'google-earlyaccess-' . $google_fonts_index, $font_url ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion | |
| 1059 | 828 | } |
| 1060 | 829 | } |
| 830 | + | |
| 1061 | 831 | } |
| 1062 | 832 | |
| 1063 | 833 | /** |
| 1064 | 834 | * Enqueue fonts. |
| @@ -1079,8 +849,22 @@ | ||
| 1079 | 849 | $this->registered_fonts[] = $font; |
| 1080 | 850 | } |
| 1081 | 851 | |
| 1082 | 852 | /** |
| 853 | + * Parse global CSS. | |
| 854 | + * | |
| 855 | + * Enqueue the global CSS file. | |
| 856 | + * | |
| 857 | + * @since 1.2.0 | |
| 858 | + * @access protected | |
| 859 | + */ | |
| 860 | + protected function parse_global_css_code() { | |
| 861 | + $scheme_css_file = Global_CSS::create( 'global.css' ); | |
| 862 | + | |
| 863 | + $scheme_css_file->enqueue(); | |
| 864 | + } | |
| 865 | + | |
| 866 | + /** | |
| 1083 | 867 | * Apply builder in content. |
| 1084 | 868 | * |
| 1085 | 869 | * Used to apply the Elementor page editor on the post content. |
| 1086 | 870 | * |
| @@ -1135,14 +919,14 @@ | ||
| 1135 | 919 | if ( post_password_required( $post_id ) ) { |
| 1136 | 920 | return ''; |
| 1137 | 921 | } |
| 1138 | 922 | |
| 1139 | - $document = Plugin::$instance->documents->get_doc_for_frontend( $post_id ); | |
| 1140 | - | |
| 1141 | - if ( ! $document || ! $document->is_built_with_elementor() ) { | |
| 923 | + if ( ! Plugin::$instance->db->is_built_with_elementor( $post_id ) ) { | |
| 1142 | 924 | return ''; |
| 1143 | 925 | } |
| 1144 | 926 | |
| 927 | + $document = Plugin::$instance->documents->get_doc_for_frontend( $post_id ); | |
| 928 | + | |
| 1145 | 929 | // Change the current post, so widgets can use `documents->get_current`. |
| 1146 | 930 | Plugin::$instance->documents->switch_to_document( $document ); |
| 1147 | 931 | |
| 1148 | 932 | $data = $document->get_elements_data(); |
| @@ -1147,21 +931,8 @@ | ||
| 1147 | 931 | |
| 1148 | 932 | $data = $document->get_elements_data(); |
| 1149 | 933 | |
| 1150 | 934 | /** |
| 1151 | - * Filters document elements data after loading. | |
| 1152 | - * | |
| 1153 | - * Allows modification of elements data when loading (not saving). | |
| 1154 | - * Useful for migrations, transformations, or data enrichment. | |
| 1155 | - * | |
| 1156 | - * @since 4.0.0 | |
| 1157 | - * | |
| 1158 | - * @param array $data The elements data array. | |
| 1159 | - * @param \Elementor\Core\Base\Document $document The document instance. | |
| 1160 | - */ | |
| 1161 | - $data = apply_filters( 'elementor/document/load/data', $data, $document ); | |
| 1162 | - | |
| 1163 | - /** | |
| 1164 | 935 | * Frontend builder content data. |
| 1165 | 936 | * |
| 1166 | 937 | * Filters the builder content in the frontend. |
| 1167 | 938 | * |
| @@ -1171,13 +942,9 @@ | ||
| 1171 | 942 | * @param int $post_id The post ID. |
| 1172 | 943 | */ |
| 1173 | 944 | $data = apply_filters( 'elementor/frontend/builder_content_data', $data, $post_id ); |
| 1174 | 945 | |
| 1175 | - do_action( 'elementor/frontend/before_get_builder_content', $document, $this->_is_excerpt ); | |
| 1176 | - | |
| 1177 | 946 | if ( empty( $data ) ) { |
| 1178 | - Plugin::$instance->documents->restore_document(); | |
| 1179 | - | |
| 1180 | 947 | return ''; |
| 1181 | 948 | } |
| 1182 | 949 | |
| 1183 | 950 | if ( ! $this->_is_excerpt ) { |
| @@ -1186,17 +953,8 @@ | ||
| 1186 | 953 | } else { |
| 1187 | 954 | $css_file = Post_CSS::create( $post_id ); |
| 1188 | 955 | } |
| 1189 | 956 | |
| 1190 | - /** | |
| 1191 | - * Builder Content - Before Enqueue CSS File | |
| 1192 | - * | |
| 1193 | - * Allows intervening with a document's CSS file before it is enqueued. | |
| 1194 | - * | |
| 1195 | - * @param $css_file Post_CSS|Post_Preview | |
| 1196 | - */ | |
| 1197 | - $css_file = apply_filters( 'elementor/frontend/builder_content/before_enqueue_css_file', $css_file ); | |
| 1198 | - | |
| 1199 | 957 | $css_file->enqueue(); |
| 1200 | 958 | } |
| 1201 | 959 | |
| 1202 | 960 | ob_start(); |
| @@ -1205,18 +963,8 @@ | ||
| 1205 | 963 | if ( is_customize_preview() || wp_doing_ajax() ) { |
| 1206 | 964 | $with_css = true; |
| 1207 | 965 | } |
| 1208 | 966 | |
| 1209 | - /** | |
| 1210 | - * Builder Content - With CSS | |
| 1211 | - * | |
| 1212 | - * Allows overriding the `$with_css` parameter which is a factor in determining whether to print the document's | |
| 1213 | - * CSS and font links inline in a `style` tag above the document's markup. | |
| 1214 | - * | |
| 1215 | - * @param $with_css boolean | |
| 1216 | - */ | |
| 1217 | - $with_css = apply_filters( 'elementor/frontend/builder_content/before_print_css', $with_css ); | |
| 1218 | - | |
| 1219 | 967 | if ( ! empty( $css_file ) && $with_css ) { |
| 1220 | 968 | $css_file->print_css(); |
| 1221 | 969 | } |
| 1222 | 970 | |
| @@ -1242,10 +990,8 @@ | ||
| 1242 | 990 | } |
| 1243 | 991 | |
| 1244 | 992 | Plugin::$instance->documents->restore_document(); |
| 1245 | 993 | |
| 1246 | - // BC | |
| 1247 | - // TODO: use Deprecation::do_deprecated_action() in 3.1.0 | |
| 1248 | 994 | do_action( 'elementor/frontend/get_builder_content', $document, $this->_is_excerpt, $with_css ); |
| 1249 | 995 | |
| 1250 | 996 | return $content; |
| 1251 | 997 | } |
| @@ -1257,9 +1003,9 @@ | ||
| 1257 | 1003 | * |
| 1258 | 1004 | * @since 1.0.0 |
| 1259 | 1005 | * @access public |
| 1260 | 1006 | * |
| 1261 | - * @param int $post_id The post ID. | |
| 1007 | + * @param int $post_id The post ID. | |
| 1262 | 1008 | * |
| 1263 | 1009 | * @param bool $with_css Optional. Whether to retrieve the content with CSS |
| 1264 | 1010 | * or not. Default is false. |
| 1265 | 1011 | * |
| @@ -1275,9 +1021,9 @@ | ||
| 1275 | 1021 | // Avoid recursion |
| 1276 | 1022 | if ( get_the_ID() === (int) $post_id ) { |
| 1277 | 1023 | $content = ''; |
| 1278 | 1024 | if ( $editor->is_edit_mode() ) { |
| 1279 | - $content = '<div class="elementor-alert elementor-alert-danger">' . esc_html__( 'Invalid Data: The Template ID cannot be the same as the currently edited template. Please choose a different one.', 'elementor' ) . '</div>'; | |
| 1025 | + $content = '<div class="elementor-alert elementor-alert-danger">' . __( 'Invalid Data: The Template ID cannot be the same as the currently edited template. Please choose a different one.', 'elementor' ) . '</div>'; | |
| 1280 | 1026 | } |
| 1281 | 1027 | |
| 1282 | 1028 | return $content; |
| 1283 | 1029 | } |
| @@ -1400,71 +1146,37 @@ | ||
| 1400 | 1146 | */ |
| 1401 | 1147 | protected function get_init_settings() { |
| 1402 | 1148 | $is_preview_mode = Plugin::$instance->preview->is_preview_mode( Plugin::$instance->preview->get_post_id() ); |
| 1403 | 1149 | |
| 1404 | - $active_experimental_features = Plugin::$instance->experiments->get_active_features(); | |
| 1405 | - | |
| 1406 | - $active_experimental_features = array_fill_keys( array_keys( $active_experimental_features ), true ); | |
| 1407 | - | |
| 1408 | - $assets_url = ELEMENTOR_ASSETS_URL; | |
| 1409 | - | |
| 1410 | - /** | |
| 1411 | - * Frontend assets URL | |
| 1412 | - * | |
| 1413 | - * Filters Elementor frontend assets URL. | |
| 1414 | - * | |
| 1415 | - * @since 2.3.0 | |
| 1416 | - * | |
| 1417 | - * @param string $assets_url The frontend assets URL. Default is ELEMENTOR_ASSETS_URL. | |
| 1418 | - */ | |
| 1419 | - $assets_url = apply_filters( 'elementor/frontend/assets_url', $assets_url ); | |
| 1420 | - | |
| 1421 | 1150 | $settings = [ |
| 1422 | 1151 | 'environmentMode' => [ |
| 1423 | 1152 | 'edit' => $is_preview_mode, |
| 1424 | 1153 | 'wpPreview' => is_preview(), |
| 1425 | - 'isScriptDebug' => Utils::is_script_debug(), | |
| 1426 | 1154 | ], |
| 1427 | 1155 | 'i18n' => [ |
| 1428 | - 'shareOnFacebook' => esc_html__( 'Share on Facebook', 'elementor' ), | |
| 1429 | - 'shareOnTwitter' => esc_html__( 'Share on Twitter', 'elementor' ), | |
| 1430 | - 'pinIt' => esc_html__( 'Pin it', 'elementor' ), | |
| 1431 | - 'download' => esc_html__( 'Download', 'elementor' ), | |
| 1432 | - 'downloadImage' => esc_html__( 'Download image', 'elementor' ), | |
| 1433 | - 'fullscreen' => esc_html__( 'Fullscreen', 'elementor' ), | |
| 1434 | - 'zoom' => esc_html__( 'Zoom', 'elementor' ), | |
| 1435 | - 'share' => esc_html__( 'Share', 'elementor' ), | |
| 1436 | - 'playVideo' => esc_html__( 'Play Video', 'elementor' ), | |
| 1437 | - 'previous' => esc_html__( 'Previous', 'elementor' ), | |
| 1438 | - 'next' => esc_html__( 'Next', 'elementor' ), | |
| 1439 | - 'close' => esc_html__( 'Close', 'elementor' ), | |
| 1440 | - 'a11yCarouselPrevSlideMessage' => __( 'Previous slide', 'elementor' ), | |
| 1441 | - 'a11yCarouselNextSlideMessage' => __( 'Next slide', 'elementor' ), | |
| 1442 | - 'a11yCarouselFirstSlideMessage' => __( 'This is the first slide', 'elementor' ), | |
| 1443 | - 'a11yCarouselLastSlideMessage' => __( 'This is the last slide', 'elementor' ), | |
| 1444 | - 'a11yCarouselPaginationBulletMessage' => __( 'Go to slide', 'elementor' ), | |
| 1156 | + 'shareOnFacebook' => __( 'Share on Facebook', 'elementor' ), | |
| 1157 | + 'shareOnTwitter' => __( 'Share on Twitter', 'elementor' ), | |
| 1158 | + 'pinIt' => __( 'Pin it', 'elementor' ), | |
| 1159 | + 'download' => __( 'Download', 'elementor' ), | |
| 1160 | + 'downloadImage' => __( 'Download image', 'elementor' ), | |
| 1161 | + 'fullscreen' => __( 'Fullscreen', 'elementor' ), | |
| 1162 | + 'zoom' => __( 'Zoom', 'elementor' ), | |
| 1163 | + 'share' => __( 'Share', 'elementor' ), | |
| 1164 | + 'playVideo' => __( 'Play Video', 'elementor' ), | |
| 1165 | + 'previous' => __( 'Previous', 'elementor' ), | |
| 1166 | + 'next' => __( 'Next', 'elementor' ), | |
| 1167 | + 'close' => __( 'Close', 'elementor' ), | |
| 1445 | 1168 | ], |
| 1446 | 1169 | 'is_rtl' => is_rtl(), |
| 1447 | - // 'breakpoints' object is kept for BC. | |
| 1448 | 1170 | 'breakpoints' => Responsive::get_breakpoints(), |
| 1449 | - // 'responsive' contains the custom breakpoints config introduced in Elementor v3.2.0 | |
| 1450 | - 'responsive' => [ | |
| 1451 | - 'breakpoints' => Plugin::$instance->breakpoints->get_breakpoints_config(), | |
| 1452 | - 'hasCustomBreakpoints' => Plugin::$instance->breakpoints->has_custom_breakpoints(), | |
| 1453 | - ], | |
| 1454 | 1171 | 'version' => ELEMENTOR_VERSION, |
| 1455 | 1172 | 'is_static' => $this->is_static_render_mode(), |
| 1456 | - 'experimentalFeatures' => $active_experimental_features, | |
| 1173 | + 'legacyMode' => [ | |
| 1174 | + 'elementWrappers' => Plugin::instance()->get_legacy_mode( 'elementWrappers' ), | |
| 1175 | + ], | |
| 1457 | 1176 | 'urls' => [ |
| 1458 | - 'assets' => $assets_url, | |
| 1459 | - 'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
| 1460 | - 'uploadUrl' => wp_upload_dir()['baseurl'], | |
| 1177 | + 'assets' => ELEMENTOR_ASSETS_URL, | |
| 1461 | 1178 | ], |
| 1462 | - 'nonces' => [ | |
| 1463 | - 'floatingButtonsClickTracking' => wp_create_nonce( Module::CLICK_TRACKING_NONCE ), | |
| 1464 | - 'atomicFormsSendForm' => wp_create_nonce( 'elementor_pro_atomic_forms_send_form' ), | |
| 1465 | - ], | |
| 1466 | - 'swiperClass' => 'swiper', | |
| 1467 | 1179 | ]; |
| 1468 | 1180 | |
| 1469 | 1181 | $settings['settings'] = SettingsManager::get_settings_frontend_config(); |
| 1470 | 1182 | |
| @@ -1475,23 +1187,13 @@ | ||
| 1475 | 1187 | $post = get_post(); |
| 1476 | 1188 | |
| 1477 | 1189 | $title = Utils::urlencode_html_entities( wp_get_document_title() ); |
| 1478 | 1190 | |
| 1479 | - // Try to use the 'large' WP image size because the Pinterest share API | |
| 1480 | - // has problems accepting shares with large images sometimes, and the WP 'large' thumbnail is | |
| 1481 | - // the largest default WP image size that will probably not be changed in most sites | |
| 1482 | - $featured_image_url = get_the_post_thumbnail_url( null, 'large' ); | |
| 1483 | - | |
| 1484 | - // If the large size was nullified, use the full size which cannot be nullified/deleted | |
| 1485 | - if ( ! $featured_image_url ) { | |
| 1486 | - $featured_image_url = get_the_post_thumbnail_url( null, 'full' ); | |
| 1487 | - } | |
| 1488 | - | |
| 1489 | 1191 | $settings['post'] = [ |
| 1490 | 1192 | 'id' => $post->ID, |
| 1491 | 1193 | 'title' => $title, |
| 1492 | 1194 | 'excerpt' => $post->post_excerpt, |
| 1493 | - 'featuredImage' => $featured_image_url, | |
| 1195 | + 'featuredImage' => get_the_post_thumbnail_url(), | |
| 1494 | 1196 | ]; |
| 1495 | 1197 | } else { |
| 1496 | 1198 | $settings['post'] = [ |
| 1497 | 1199 | 'id' => 0, |
| @@ -1528,11 +1230,11 @@ | ||
| 1528 | 1230 | * |
| 1529 | 1231 | * Restore removed WordPress filters that conflicted with Elementor. |
| 1530 | 1232 | * |
| 1531 | 1233 | * @since 1.5.0 |
| 1532 | - * @access public | |
| 1234 | + * @access private | |
| 1533 | 1235 | */ |
| 1534 | - public function restore_content_filters() { | |
| 1236 | + private function restore_content_filters() { | |
| 1535 | 1237 | foreach ( $this->content_removed_filters as $filter ) { |
| 1536 | 1238 | add_filter( 'the_content', $filter ); |
| 1537 | 1239 | } |
| 1538 | 1240 | |
| @@ -1546,9 +1248,9 @@ | ||
| 1546 | 1248 | * |
| 1547 | 1249 | * @access private |
| 1548 | 1250 | * @since 2.0.4 |
| 1549 | 1251 | * |
| 1550 | - * @param string $content | |
| 1252 | + * @param $content | |
| 1551 | 1253 | * |
| 1552 | 1254 | * @return string |
| 1553 | 1255 | */ |
| 1554 | 1256 | private function process_more_tag( $content ) { |
| @@ -1563,15 +1265,15 @@ | ||
| 1563 | 1265 | return $parts['main'] . '<div id="more-' . $post->ID . '"></div>' . $parts['extended']; |
| 1564 | 1266 | } |
| 1565 | 1267 | |
| 1566 | 1268 | if ( empty( $parts['more_text'] ) ) { |
| 1567 | - $parts['more_text'] = esc_html__( '(more…)', 'elementor' ); | |
| 1269 | + $parts['more_text'] = __( '(more…)', 'elementor' ); | |
| 1568 | 1270 | } |
| 1569 | 1271 | |
| 1570 | 1272 | $more_link_text = sprintf( |
| 1571 | 1273 | '<span aria-label="%1$s">%2$s</span>', |
| 1572 | 1274 | sprintf( |
| 1573 | - /* translators: %s: Current post name. */ | |
| 1275 | + /* translators: %s: Name of current post */ | |
| 1574 | 1276 | __( 'Continue reading %s', 'elementor' ), |
| 1575 | 1277 | the_title_attribute( [ |
| 1576 | 1278 | 'echo' => false, |
| 1577 | 1279 | ] ) |
| @@ -1578,24 +1280,9 @@ | ||
| 1578 | 1280 | ), |
| 1579 | 1281 | $parts['more_text'] |
| 1580 | 1282 | ); |
| 1581 | 1283 | |
| 1582 | - $more_link = sprintf( ' <a href="%s#more-%s" class="more-link elementor-more-link">%s</a>', get_permalink(), $post->ID, $more_link_text ); | |
| 1583 | - | |
| 1584 | - /** | |
| 1585 | - * The content "more" link. | |
| 1586 | - * | |
| 1587 | - * Filters the "more" link displayed after the content. | |
| 1588 | - * | |
| 1589 | - * This hook can be used either to change the link syntax or to change the | |
| 1590 | - * text inside the link. | |
| 1591 | - * | |
| 1592 | - * @since 2.0.4 | |
| 1593 | - * | |
| 1594 | - * @param string $more_link The more link. | |
| 1595 | - * @param string $more_link_text The text inside the more link. | |
| 1596 | - */ | |
| 1597 | - $more_link = apply_filters( 'the_content_more_link', $more_link, $more_link_text ); | |
| 1284 | + $more_link = apply_filters( 'the_content_more_link', sprintf( ' <a href="%s#more-%s" class="more-link elementor-more-link">%s</a>', get_permalink(), $post->ID, $more_link_text ), $more_link_text ); | |
| 1598 | 1285 | |
| 1599 | 1286 | return force_balance_tags( $parts['main'] ) . $more_link; |
| 1600 | 1287 | } |
| 1601 | 1288 | } |