PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.0-dev1
Elementor Website Builder – more than just a page builder v3.6.0-dev1
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 / trunk / core / responsive / responsive.php

responsive.php in Elementor Website Builder – more than just a page builder 3.6.0-dev1, at trunk/core/responsive/responsive.php

159 lines 3.9 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 * @access public
71 * @static
72 *
73 * @return array Default breakpoints.
74 */
75 public static function get_default_breakpoints() {
76 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::get_default_config()' );
77
78 return self::$default_breakpoints;
79 }
80
81 /**
82 * Get editable breakpoints.
83 *
84 * Retrieve the editable breakpoints.
85 *
86 * @since 1.0.0
87 * @access public
88 * @static
89 *
90 * @return array Editable breakpoints.
91 */
92 public static function get_editable_breakpoints() {
93 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0' );
94
95 return array_intersect_key( self::get_breakpoints(), array_flip( self::$editable_breakpoints_keys ) );
96 }
97
98 /**
99 * Get breakpoints.
100 *
101 * Retrieve the responsive breakpoints.
102 *
103 * @since 1.0.0
104 * @deprecated 3.2.0
105 * @access public
106 * @static
107 *
108 * @return array Responsive breakpoints.
109 */
110 public static function get_breakpoints() {
111 return array_reduce(
112 array_keys( self::$default_breakpoints ), function( $new_array, $breakpoint_key ) {
113 if ( ! in_array( $breakpoint_key, self::$editable_breakpoints_keys ) ) {
114 $new_array[ $breakpoint_key ] = self::$default_breakpoints[ $breakpoint_key ];
115 } else {
116 $saved_option = Plugin::$instance->kits_manager->get_current_settings( self::BREAKPOINT_OPTION_PREFIX . $breakpoint_key );
117
118 $new_array[ $breakpoint_key ] = $saved_option ? (int) $saved_option : self::$default_breakpoints[ $breakpoint_key ];
119 }
120
121 return $new_array;
122 }, []
123 );
124 }
125
126 /**
127 * @since 2.1.0
128 * @access public
129 * @static
130 */
131 public static function has_custom_breakpoints() {
132 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Plugin::$instance->breakpoints->has_custom_breakpoints()' );
133
134 return ! ! array_diff( self::$default_breakpoints, self::get_breakpoints() );
135 }
136
137 /**
138 * @since 2.1.0
139 * @access public
140 * @static
141 */
142 public static function get_stylesheet_templates_path() {
143 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::get_stylesheet_templates_path()' );
144
145 return Breakpoints_Manager::get_stylesheet_templates_path();
146 }
147
148 /**
149 * @since 2.1.0
150 * @access public
151 * @static
152 */
153 public static function compile_stylesheet_templates() {
154 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::compile_stylesheet_templates()' );
155
156 Breakpoints_Manager::compile_stylesheet_templates();
157 }
158 }
159