PluginProbe
Elementor Website Builder – more than just a page builder / 3.14.0-beta4
Elementor Website Builder – more than just a page builder v3.14.0-beta4
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
elementor / core / responsive / responsive.php

responsive.php in Elementor Website Builder – more than just a page builder 3.14.0-beta4, at core/responsive/responsive.php

164 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Responsive;
3
4 use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
5 use Elementor\Modules\DevTools\Deprecation;
6 use Elementor\Plugin;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 /**
13 * Elementor responsive.
14 *
15 * Elementor responsive handler class is responsible for setting up Elementor
16 * responsive breakpoints.
17 *
18 * @since 1.0.0
19 * @deprecated 3.2.0
20 */
21 class Responsive {
22
23 /**
24 * The Elementor breakpoint prefix.
25 */
26 const BREAKPOINT_OPTION_PREFIX = 'viewport_';
27
28 /**
29 * Default breakpoints.
30 *
31 * Holds the default responsive breakpoints.
32 *
33 * @since 1.0.0
34 * @access private
35 * @static
36 *
37 * @var array Default breakpoints.
38 */
39 private static $default_breakpoints = [
40 'xs' => 0,
41 'sm' => 480,
42 'md' => 768,
43 'lg' => 1025,
44 'xl' => 1440,
45 'xxl' => 1600,
46 ];
47
48 /**
49 * Editable breakpoint keys.
50 *
51 * Holds the editable breakpoint keys.
52 *
53 * @since 1.0.0
54 * @access private
55 * @static
56 *
57 * @var array Editable breakpoint keys.
58 */
59 private static $editable_breakpoints_keys = [
60 'md',
61 'lg',
62 ];
63
64 /**
65 * Get default breakpoints.
66 *
67 * Retrieve the default responsive breakpoints.
68 *
69 * @since 1.0.0
70 * @deprecated 3.2.0
71 * @access public
72 * @static
73 *
74 * @return array Default breakpoints.
75 */
76 public static function get_default_breakpoints() {
77 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::get_default_config()' );
78
79 return self::$default_breakpoints;
80 }
81
82 /**
83 * Get editable breakpoints.
84 *
85 * Retrieve the editable breakpoints.
86 *
87 * @since 1.0.0
88 * @deprecated 3.2.0
89 * @access public
90 * @static
91 *
92 * @return array Editable breakpoints.
93 */
94 public static function get_editable_breakpoints() {
95 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0' );
96
97 return array_intersect_key( self::get_breakpoints(), array_flip( self::$editable_breakpoints_keys ) );
98 }
99
100 /**
101 * Get breakpoints.
102 *
103 * Retrieve the responsive breakpoints.
104 *
105 * @since 1.0.0
106 * @deprecated 3.2.0
107 * @access public
108 * @static
109 *
110 * @return array Responsive breakpoints.
111 */
112 public static function get_breakpoints() {
113 return array_reduce(
114 array_keys( self::$default_breakpoints ), function( $new_array, $breakpoint_key ) {
115 if ( ! in_array( $breakpoint_key, self::$editable_breakpoints_keys ) ) {
116 $new_array[ $breakpoint_key ] = self::$default_breakpoints[ $breakpoint_key ];
117 } else {
118 $saved_option = Plugin::$instance->kits_manager->get_current_settings( self::BREAKPOINT_OPTION_PREFIX . $breakpoint_key );
119
120 $new_array[ $breakpoint_key ] = $saved_option ? (int) $saved_option : self::$default_breakpoints[ $breakpoint_key ];
121 }
122
123 return $new_array;
124 }, []
125 );
126 }
127
128 /**
129 * @since 2.1.0
130 * @deprecated 3.2.0
131 * @access public
132 * @static
133 */
134 public static function has_custom_breakpoints() {
135 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Plugin::$instance->breakpoints->has_custom_breakpoints()' );
136
137 return ! ! array_diff( self::$default_breakpoints, self::get_breakpoints() );
138 }
139
140 /**
141 * @since 2.1.0
142 * @deprecated 3.2.0
143 * @access public
144 * @static
145 */
146 public static function get_stylesheet_templates_path() {
147 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::get_stylesheet_templates_path()' );
148
149 return Breakpoints_Manager::get_stylesheet_templates_path();
150 }
151
152 /**
153 * @since 2.1.0
154 * @deprecated 3.2.0
155 * @access public
156 * @static
157 */
158 public static function compile_stylesheet_templates() {
159 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::compile_stylesheet_templates()' );
160
161 Breakpoints_Manager::compile_stylesheet_templates();
162 }
163 }
164