PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.4
Elementor Website Builder – more than just a page builder v3.28.4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/frontend.php +47 -68 4.1.03.28.4 View file →
@@ -146,8 +146,10 @@
146 146 private $body_classes = [
147 147 'elementor-default',
148 148 ];
149 149
150 + private $google_fonts_index = 0;
151 +
150 152 /**
151 153 * Front End constructor.
152 154 *
153 155 * Initializing Elementor front end. Make sure we are not in admin, not and
@@ -171,12 +173,8 @@
171 173
172 174 // Hack to avoid enqueue post CSS while it's a `the_excerpt` call.
173 175 add_filter( 'get_the_excerpt', [ $this, 'start_excerpt_flag' ], 1 );
174 176 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 177 }
180 178
181 179 /**
182 180 * Get module name.
@@ -238,22 +236,35 @@
238 236 }
239 237
240 238 // Priority 7 to allow google fonts in header template to load in <head> tag
241 239 add_action( 'wp_head', [ $this, 'print_fonts_links' ], 7 );
240 + add_action( 'wp_head', [ $this, 'print_google_fonts_preconnect_tag' ], 8 );
242 241 add_action( 'wp_head', [ $this, 'add_theme_color_meta_tag' ] );
243 242 add_action( 'wp_footer', [ $this, 'wp_footer' ] );
244 243 }
245 244
245 + public function print_google_fonts_preconnect_tag() {
246 + if ( 0 >= $this->google_fonts_index ) {
247 + return;
248 + }
249 +
250 + if ( Plugin::$instance->experiments->is_feature_active( 'e_local_google_fonts' ) ) {
251 + return;
252 + }
253 +
254 + echo '<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>';
255 + }
256 +
246 257 /**
247 258 * @since 2.0.12
248 259 * @access public
249 - * @param string|array $class_name
260 + * @param string|array $class
250 261 */
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 );
262 + public function add_body_class( $class ) {
263 + if ( is_array( $class ) ) {
264 + $this->body_classes = array_merge( $this->body_classes, $class );
254 265 } else {
255 - $this->body_classes[] = $class_name;
266 + $this->body_classes[] = $class;
256 267 }
257 268 }
258 269
259 270 /**
@@ -419,9 +430,9 @@
419 430 $this->get_js_assets_url( 'dialog', 'assets/lib/dialog/' ),
420 431 [
421 432 'jquery-ui-position',
422 433 ],
423 - '4.9.4',
434 + '4.9.3',
424 435 true
425 436 );
426 437
427 438 wp_register_script(
@@ -454,10 +465,8 @@
454 465 ELEMENTOR_VERSION,
455 466 true
456 467 );
457 468
458 - $this->register_frontend_handlers();
459 -
460 469 /**
461 470 * After frontend register scripts.
462 471 *
463 472 * Fires after Elementor frontend scripts are registered.
@@ -555,9 +564,9 @@
555 564 );
556 565
557 566 wp_register_style(
558 567 'elementor-frontend',
559 - $this->get_frontend_file_url( "frontend{$min_suffix}.css", $has_custom_breakpoints ),
568 + $this->get_frontend_file_url( "frontend{$direction_suffix}{$min_suffix}.css", $has_custom_breakpoints ),
560 569 [],
561 570 $has_custom_breakpoints ? null : ELEMENTOR_VERSION
562 571 );
563 572
@@ -591,23 +600,8 @@
591 600 do_action( 'elementor/frontend/after_register_styles' );
592 601 }
593 602
594 603 /**
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 604 * Enqueue scripts.
611 605 *
612 606 * Enqueue all the frontend scripts.
613 607 *
@@ -623,8 +617,10 @@
623 617 * @since 1.0.0
624 618 */
625 619 do_action( 'elementor/frontend/before_enqueue_scripts' );
626 620
621 + wp_enqueue_script( 'elementor-frontend' );
622 +
627 623 $this->print_config();
628 624
629 625 $this->enqueue_conditional_assets();
630 626
@@ -686,22 +682,14 @@
686 682 if ( ! Plugin::$instance->preview->is_preview_mode() ) {
687 683 $post_id = get_the_ID();
688 684 // Check $post_id for virtual pages. check is singular because the $post_id is set to the first post on archive pages.
689 685 if ( $post_id && is_singular() ) {
690 - do_action( 'elementor/post/render', $post_id );
691 686 $this->handle_page_assets( $post_id );
692 687
693 688 $css_file = Post_CSS::create( get_the_ID() );
694 689 $css_file->enqueue();
695 690 }
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 691 }
702 -
703 - do_action( 'elementor/frontend/after_enqueue_post_styles' );
704 692 }
705 693 }
706 694
707 695 private function handle_page_assets( $post_id ): void {
@@ -900,20 +888,8 @@
900 888 * @since 1.9.4
901 889 * @access public
902 890 */
903 891 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 892 $google_fonts = $this->get_list_of_google_fonts_by_type();
917 893
918 894 $this->enqueue_google_fonts( $google_fonts );
919 895 $this->enqueue_icon_fonts();
@@ -1044,19 +1020,36 @@
1044 1020 if ( ! $print_google_fonts ) {
1045 1021 return;
1046 1022 }
1047 1023
1048 - $force_enqueue_from_cdn = Plugin::$instance->preview->is_preview_mode();
1024 + // Print used fonts
1025 + if ( ! empty( $google_fonts['google'] ) ) {
1026 + ++$this->google_fonts_index;
1049 1027
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 );
1028 + if ( Plugin::$instance->experiments->is_feature_active( 'e_local_google_fonts' ) ) {
1029 + foreach ( $google_fonts['google'] as $current_font ) {
1030 + Google_Font::enqueue( $current_font );
1031 + }
1032 + } else {
1033 + $fonts_url = $this->get_stable_google_fonts_url( $google_fonts['google'] );
1034 +
1035 + wp_enqueue_style( 'google-fonts-' . $this->google_fonts_index, $fonts_url ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
1053 1036 }
1054 1037 }
1055 1038
1056 1039 if ( ! empty( $google_fonts['early'] ) ) {
1057 - foreach ( $google_fonts['early'] as $current_font ) {
1058 - Google_Font::enqueue( $current_font, Google_Font::TYPE_EARLYACCESS, $force_enqueue_from_cdn );
1040 + if ( Plugin::$instance->experiments->is_feature_active( 'e_local_google_fonts' ) ) {
1041 + foreach ( $google_fonts['early'] as $current_font ) {
1042 + Google_Font::enqueue( $current_font, Google_Font::TYPE_EARLYACCESS );
1043 + }
1044 + } else {
1045 + $early_access_font_urls = $this->get_early_access_google_font_urls( $google_fonts['early'] );
1046 +
1047 + foreach ( $early_access_font_urls as $ea_font_url ) {
1048 + ++$this->google_fonts_index;
1049 +
1050 + wp_enqueue_style( 'google-earlyaccess-' . $this->google_fonts_index, $ea_font_url ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
1051 + }
1059 1052 }
1060 1053 }
1061 1054 }
1062 1055
@@ -1147,21 +1140,8 @@
1147 1140
1148 1141 $data = $document->get_elements_data();
1149 1142
1150 1143 /**
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 1144 * Frontend builder content data.
1165 1145 *
1166 1146 * Filters the builder content in the frontend.
1167 1147 *
@@ -1460,9 +1440,8 @@
1460 1440 'uploadUrl' => wp_upload_dir()['baseurl'],
1461 1441 ],
1462 1442 'nonces' => [
1463 1443 'floatingButtonsClickTracking' => wp_create_nonce( Module::CLICK_TRACKING_NONCE ),
1464 - 'atomicFormsSendForm' => wp_create_nonce( 'elementor_pro_atomic_forms_send_form' ),
1465 1444 ],
1466 1445 'swiperClass' => 'swiper',
1467 1446 ];
1468 1447