| @@ -1,10 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Core\Responsive\Files; |
| 4 | 4 | |
| 5 | +use Elementor\Core\Breakpoints\Breakpoint; | |
| 5 | 6 | use Elementor\Core\Files\Base; |
| 6 | 7 | use Elementor\Core\Responsive\Responsive; |
| 8 | +use Elementor\Plugin; | |
| 7 | 9 | |
| 8 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | 11 | exit; // Exit if accessed directly |
| 10 | 12 | } |
| @@ -29,9 +31,9 @@ | ||
| 29 | 31 | * @since 2.1.0 |
| 30 | 32 | * @access public |
| 31 | 33 | */ |
| 32 | 34 | public function parse_content() { |
| 33 | - $breakpoints = Responsive::get_breakpoints(); | |
| 35 | + $breakpoints = Plugin::$instance->breakpoints->get_active_breakpoints(); | |
| 34 | 36 | |
| 35 | 37 | $breakpoints_keys = array_keys( $breakpoints ); |
| 36 | 38 | |
| 37 | 39 | $file_content = file_get_contents( $this->template_file ); |
| @@ -36,20 +38,24 @@ | ||
| 36 | 38 | |
| 37 | 39 | $file_content = file_get_contents( $this->template_file ); |
| 38 | 40 | |
| 39 | 41 | $file_content = preg_replace_callback( '/ELEMENTOR_SCREEN_([A-Z]+)_([A-Z]+)/', function ( $placeholder_data ) use ( $breakpoints_keys, $breakpoints ) { |
| 40 | - $breakpoint_index = array_search( strtolower( $placeholder_data[1] ), $breakpoints_keys ); | |
| 42 | + if ( 'DESKTOP' === $placeholder_data[1] ) { | |
| 43 | + $value = Plugin::$instance->breakpoints->get_desktop_min_point(); | |
| 44 | + } else { | |
| 45 | + $breakpoint_index = array_search( strtolower( $placeholder_data[1] ), $breakpoints_keys, true ); | |
| 41 | 46 | |
| 42 | - $is_max_point = 'MAX' === $placeholder_data[2]; | |
| 47 | + $is_max_point = 'MAX' === $placeholder_data[2]; | |
| 43 | 48 | |
| 44 | - if ( $is_max_point ) { | |
| 45 | - $breakpoint_index++; | |
| 46 | - } | |
| 49 | + if ( ! $is_max_point ) { | |
| 50 | + $breakpoint_index--; | |
| 51 | + } | |
| 47 | 52 | |
| 48 | - $value = $breakpoints[ $breakpoints_keys[ $breakpoint_index ] ]; | |
| 53 | + $value = $breakpoints[ $breakpoints_keys[ $breakpoint_index ] ]->get_value(); | |
| 49 | 54 | |
| 50 | - if ( $is_max_point ) { | |
| 51 | - $value--; | |
| 55 | + if ( ! $is_max_point ) { | |
| 56 | + $value++; | |
| 57 | + } | |
| 52 | 58 | } |
| 53 | 59 | |
| 54 | 60 | return $value . 'px'; |
| 55 | 61 | }, $file_content ); |