PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.0
Elementor Website Builder – more than just a page builder v3.2.0
4.3.0-beta3 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 All 452 releases
← All changes | core/responsive/files/frontend.php +5 -50 4.2.0-dev23.2.0 View file →
@@ -5,12 +5,11 @@
5 5 use Elementor\Core\Breakpoints\Breakpoint;
6 6 use Elementor\Core\Files\Base;
7 7 use Elementor\Core\Responsive\Responsive;
8 8 use Elementor\Plugin;
9 -use Elementor\Utils;
10 9
11 10 if ( ! defined( 'ABSPATH' ) ) {
12 - exit; // Exit if accessed directly.
11 + exit; // Exit if accessed directly
13 12 }
14 13
15 14 class Frontend extends Base {
16 15
@@ -36,40 +35,19 @@
36 35 $breakpoints = Plugin::$instance->breakpoints->get_active_breakpoints();
37 36
38 37 $breakpoints_keys = array_keys( $breakpoints );
39 38
40 - $file_content = Utils::file_get_contents( $this->template_file );
39 + $file_content = file_get_contents( $this->template_file );
41 40
42 - // The regex pattern parses placeholders located in the frontend _templates.scss file.
43 - $file_content = preg_replace_callback( '/ELEMENTOR_SCREEN_([A-Z_]+)(?:_(MIN|MAX|NEXT))/', function ( $placeholder_data ) use ( $breakpoints_keys, $breakpoints ) {
44 - // Handle BC for legacy template files and Elementor Pro builds.
45 - $placeholder_data = $this->maybe_convert_placeholder_data( $placeholder_data );
46 -
47 - $breakpoint_index = array_search( strtolower( $placeholder_data[1] ), $breakpoints_keys, true );
48 -
41 + $file_content = preg_replace_callback( '/ELEMENTOR_SCREEN_([A-Z]+)_([A-Z]+)/', function ( $placeholder_data ) use ( $breakpoints_keys, $breakpoints ) {
49 42 if ( 'DESKTOP' === $placeholder_data[1] ) {
50 - if ( 'MIN' === $placeholder_data[2] ) {
51 - $value = Plugin::$instance->breakpoints->get_desktop_min_point();
52 - } elseif ( isset( $breakpoints['widescreen'] ) ) {
53 - // If the 'widescreen' breakpoint is active, the Desktop's max value is the Widescreen breakpoint - 1px.
54 - $value = $breakpoints['widescreen']->get_value() - 1;
55 - } else {
56 - // If the 'widescreen' breakpoint is not active, the Desktop device should not have a max value.
57 - $value = 99999;
58 - }
59 - } elseif ( false === $breakpoint_index ) {
60 - // If the breakpoint in the placeholder is not active - use a -1 value for the media query, to make
61 - // sure the setting is printed (to avoid a PHP error) but doesn't apply.
62 - return -1;
63 - } elseif ( 'WIDESCREEN' === $placeholder_data[1] ) {
64 - $value = $breakpoints['widescreen']->get_value();
43 + $value = Plugin::$instance->breakpoints->get_desktop_min_point();
65 44 } else {
66 45 $breakpoint_index = array_search( strtolower( $placeholder_data[1] ), $breakpoints_keys, true );
67 46
68 47 $is_max_point = 'MAX' === $placeholder_data[2];
69 48
70 - // If the placeholder capture is `MOBILE_NEXT` or `TABLET_NEXT`, the original breakpoint value is used.
71 - if ( ! $is_max_point && 'NEXT' !== $placeholder_data[2] ) {
49 + if ( ! $is_max_point ) {
72 50 $breakpoint_index--;
73 51 }
74 52
75 53 $value = $breakpoints[ $breakpoints_keys[ $breakpoint_index ] ]->get_value();
@@ -166,29 +144,6 @@
166 144 $option = [];
167 145 }
168 146
169 147 return $option;
170 - }
171 -
172 - /**
173 - * Maybe Convert Placeholder Data
174 - *
175 - * Converts responsive placeholders in Elementor CSS template files from the legacy format into the new format.
176 - * Used for backwards compatibility for old Pro versions that were built with an Elementor Core version <3.2.0.
177 - *
178 - * @since 3.2.3
179 - */
180 - private function maybe_convert_placeholder_data( $placeholder_data ) {
181 - switch ( $placeholder_data[1] ) {
182 - case 'SM':
183 - $placeholder_data[1] = 'MOBILE';
184 - break;
185 - case 'MD':
186 - $placeholder_data[1] = 'TABLET';
187 - break;
188 - case 'LG':
189 - $placeholder_data[1] = 'DESKTOP';
190 - }
191 -
192 - return $placeholder_data;
193 148 }
194 149 }