PluginProbe
Elementor Website Builder – more than just a page builder / 3.13.2
Elementor Website Builder – more than just a page builder v3.13.2
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 | core/files/css/base.php +10 -48 4.2.03.13.2 View file →
@@ -8,9 +8,8 @@
8 8 use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
9 9 use Elementor\Core\Files\Base as Base_File;
10 10 use Elementor\Core\DynamicTags\Manager;
11 11 use Elementor\Core\DynamicTags\Tag;
12 -use Elementor\Core\Frontend\Performance;
13 12 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
14 13 use Elementor\Plugin;
15 14 use Elementor\Stylesheet;
16 15 use Elementor\Icons_Manager;
@@ -64,10 +63,8 @@
64 63 private $icons_fonts = [];
65 64
66 65 private $dynamic_elements_ids = [];
67 66
68 - private $preserved_dynamic_style_values = [];
69 -
70 67 /**
71 68 * Stylesheet object.
72 69 *
73 70 * Holds the CSS file stylesheet instance.
@@ -214,17 +211,8 @@
214 211 if ( self::CSS_STATUS_EMPTY === $meta['status'] ) {
215 212 return;
216 213 }
217 214
218 - /**
219 - * Enqueue CSS file.
220 - *
221 - * Fires before enqueuing a CSS file.
222 - *
223 - * @param Base $this The current CSS file.
224 - */
225 - do_action( 'elementor/css-file/before_enqueue', $this );
226 -
227 215 // First time after clear cache and etc.
228 216 if ( '' === $meta['status'] || $this->is_update_required() ) {
229 217 $this->update();
230 218
@@ -234,14 +222,14 @@
234 222 if ( self::CSS_STATUS_INLINE === $meta['status'] ) {
235 223 $dep = $this->get_inline_dependency();
236 224 // If the dependency has already been printed ( like a template in footer )
237 225 if ( wp_styles()->query( $dep, 'done' ) ) {
238 - printf( '<style id="%1$s">%2$s</style>', $this->get_file_handle_id(), $meta['css'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
226 + printf( '<style id="%1$s">%2$s</style>', $this->get_file_handle_id(), $meta['css'] ); // XSS ok.
239 227 } else {
240 228 wp_add_inline_style( $dep, $meta['css'] );
241 229 }
242 230 } elseif ( self::CSS_STATUS_FILE === $meta['status'] ) { // Re-check if it's not empty after CSS update.
243 - wp_enqueue_style( $this->get_file_handle_id(), $this->get_url(), $this->get_enqueue_dependencies(), null );
231 + wp_enqueue_style( $this->get_file_handle_id(), $this->get_url(), $this->get_enqueue_dependencies(), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
244 232 }
245 233
246 234 // Handle fonts.
247 235 if ( ! empty( $meta['fonts'] ) ) {
@@ -273,17 +261,8 @@
273 261 *
274 262 * @param Base $this The current CSS file.
275 263 */
276 264 do_action( "elementor/css-file/{$name}/enqueue", $this );
277 -
278 - /**
279 - * Enqueue CSS file.
280 - *
281 - * Fires after enqueuing a CSS file.
282 - *
283 - * @param Base $this The current CSS file.
284 - */
285 - do_action( 'elementor/css-file/after_enqueue', $this );
286 265 }
287 266
288 267 /**
289 268 * Print CSS.
@@ -294,9 +273,9 @@
294 273 * @since 1.9.4
295 274 * @access public
296 275 */
297 276 public function print_css() {
298 - echo '<style>' . $this->get_content() . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
277 + echo '<style>' . $this->get_content() . '</style>'; // XSS ok.
299 278 Plugin::$instance->frontend->print_fonts_links();
300 279 }
301 280
302 281 /**
@@ -490,9 +469,9 @@
490 469 $value = $this->get_control_global_default_value( $control );
491 470 }
492 471
493 472 if ( Controls_Manager::FONT === $control['type'] ) {
494 - $this->add_font( $value );
473 + $this->fonts[] = $value;
495 474 }
496 475
497 476 /** @var Base_Data_Control $control_obj */
498 477 $control_obj = Plugin::$instance->controls_manager->get_control( $control['type'] );
@@ -548,9 +527,9 @@
548 527 * @param array $placeholders Placeholders.
549 528 * @param array $replacements Replacements.
550 529 * @param array $all_controls All controls.
551 530 */
552 - public function add_controls_stack_style_rules( Controls_Stack $controls_stack, array $controls, array $values, array $placeholders, array $replacements, ?array $all_controls = null ) {
531 + public function add_controls_stack_style_rules( Controls_Stack $controls_stack, array $controls, array $values, array $placeholders, array $replacements, array $all_controls = null ) {
553 532 if ( ! $all_controls ) {
554 533 $all_controls = $controls_stack->get_controls();
555 534 }
556 535
@@ -572,13 +551,8 @@
572 551 if ( ! empty( $parsed_dynamic_settings[ Manager::DYNAMIC_SETTING_KEY ][ $control['name'] ] ) ) {
573 552 // Dynamic CSS should not be added to the CSS files.
574 553 // Instead it's handled by \Elementor\Core\DynamicTags\Dynamic_CSS
575 554 // and printed in a style tag.
576 - $should_preserve_value = isset( $control['control_type'] ) && 'content' === $control['control_type'];
577 - if ( $should_preserve_value ) {
578 - $this->preserved_dynamic_style_values[ $control['name'] ] = $parsed_dynamic_settings[ $control['name'] ];
579 - }
580 -
581 555 unset( $parsed_dynamic_settings[ $control['name'] ] );
582 556
583 557 $this->dynamic_elements_ids[] = $controls_stack->get_id();
584 558
@@ -677,10 +651,8 @@
677 651 * @since 1.2.0
678 652 * @access protected
679 653 */
680 654 protected function parse_content() {
681 - Performance::set_use_style_controls( true );
682 -
683 655 $initial_responsive_controls_duplication_mode = Plugin::$instance->breakpoints->get_responsive_control_duplication_mode();
684 656
685 657 Plugin::$instance->breakpoints->set_responsive_control_duplication_mode( $this->get_responsive_control_duplication_mode() );
686 658
@@ -702,10 +674,8 @@
702 674 do_action( "elementor/css-file/{$name}/parse", $this );
703 675
704 676 Plugin::$instance->breakpoints->set_responsive_control_duplication_mode( $initial_responsive_controls_duplication_mode );
705 677
706 - Performance::set_use_style_controls( false );
707 -
708 678 return $this->get_stylesheet()->__toString();
709 679 }
710 680
711 681 /**
@@ -786,11 +756,9 @@
786 756 // When the control itself has no global value, but it refers to another control global value
787 757 return $this->get_selector_global_value( $control, $values['__globals__'][ $control['name'] ] );
788 758 }
789 759
790 - $value = isset( $values[ $control['name'] ] )
791 - ? $values[ $control['name'] ]
792 - : $this->preserved_dynamic_style_values[ $control['name'] ] ?? null;
760 + $value = $values[ $control['name'] ];
793 761
794 762 if ( isset( $control['selectors_dictionary'][ $value ] ) ) {
795 763 $value = $control['selectors_dictionary'][ $value ];
796 764 }
@@ -907,9 +875,9 @@
907 875 if ( $control['groupPrefix'] . 'font_family' === $control['name'] ) {
908 876 $default_generic_fonts = Plugin::$instance->kits_manager->get_current_settings( 'default_generic_fonts' );
909 877
910 878 if ( $default_generic_fonts ) {
911 - $value .= ", $default_generic_fonts";
879 + $value .= ", $default_generic_fonts";
912 880 }
913 881 }
914 882 } else {
915 883 $value = "var( --e-global-$control[type]-$id )";
@@ -917,9 +885,9 @@
917 885
918 886 return $value;
919 887 }
920 888
921 - final protected function get_active_controls( Controls_Stack $controls_stack, ?array $controls = null, ?array $settings = null ) {
889 + final protected function get_active_controls( Controls_Stack $controls_stack, array $controls = null, array $settings = null ) {
922 890 if ( ! $controls ) {
923 891 $controls = $controls_stack->get_controls();
924 892 }
925 893
@@ -934,9 +902,9 @@
934 902 $active_controls = array_reduce(
935 903 array_keys( $controls ), function( $active_controls, $control_key ) use ( $controls_stack, $controls, $settings ) {
936 904 $control = $controls[ $control_key ];
937 905
938 - if ( $controls_stack->is_control_visible( $control, $settings, $controls ) ) {
906 + if ( $controls_stack->is_control_visible( $control, $settings ) ) {
939 907 $active_controls[ $control_key ] = $control;
940 908 }
941 909
942 910 return $active_controls;
@@ -945,9 +913,9 @@
945 913
946 914 return $active_controls;
947 915 }
948 916
949 - final public function get_style_controls( Controls_Stack $controls_stack, ?array $controls = null, ?array $settings = null ) {
917 + final public function get_style_controls( Controls_Stack $controls_stack, array $controls = null, array $settings = null ) {
950 918 $controls = $this->get_active_controls( $controls_stack, $controls, $settings );
951 919
952 920 $style_controls = [];
953 921
@@ -1024,12 +992,6 @@
1024 992
1025 993 $globals = $controls_stack->get_settings( '__globals__' );
1026 994
1027 995 return ! empty( $globals[ $control_global_key ] );
1028 - }
1029 -
1030 - public function add_font( $font ) {
1031 - if ( ! in_array( $font, $this->fonts, true ) ) {
1032 - $this->fonts[] = $font;
1033 - }
1034 996 }
1035 997 }