| @@ -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,22 @@ | ||
| 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 ) { | |
| 41 | + $file_content = preg_replace_callback( '/ELEMENTOR_SCREEN_([A-Z]+)_([A-Z]+)/', function ( $placeholder_data ) use ( $breakpoints_keys, $breakpoints ) { | |
| 44 | 42 | // Handle BC for legacy template files and Elementor Pro builds. |
| 45 | 43 | $placeholder_data = $this->maybe_convert_placeholder_data( $placeholder_data ); |
| 46 | 44 | |
| 47 | - $breakpoint_index = array_search( strtolower( $placeholder_data[1] ), $breakpoints_keys, true ); | |
| 48 | - | |
| 49 | 45 | 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(); | |
| 46 | + $value = Plugin::$instance->breakpoints->get_desktop_min_point(); | |
| 65 | 47 | } else { |
| 66 | 48 | $breakpoint_index = array_search( strtolower( $placeholder_data[1] ), $breakpoints_keys, true ); |
| 67 | 49 | |
| 68 | 50 | $is_max_point = 'MAX' === $placeholder_data[2]; |
| 69 | 51 | |
| 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] ) { | |
| 52 | + if ( ! $is_max_point ) { | |
| 72 | 53 | $breakpoint_index--; |
| 73 | 54 | } |
| 74 | 55 | |
| 75 | 56 | $value = $breakpoints[ $breakpoints_keys[ $breakpoint_index ] ]->get_value(); |
| @@ -175,8 +156,11 @@ | ||
| 175 | 156 | * Converts responsive placeholders in Elementor CSS template files from the legacy format into the new format. |
| 176 | 157 | * Used for backwards compatibility for old Pro versions that were built with an Elementor Core version <3.2.0. |
| 177 | 158 | * |
| 178 | 159 | * @since 3.2.3 |
| 160 | + * | |
| 161 | + * @param $placeholder_data | |
| 162 | + * @return mixed | |
| 179 | 163 | */ |
| 180 | 164 | private function maybe_convert_placeholder_data( $placeholder_data ) { |
| 181 | 165 | switch ( $placeholder_data[1] ) { |
| 182 | 166 | case 'SM': |