| @@ -1,9 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Core\Responsive; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; | |
| 5 | -use Elementor\Modules\DevTools\Deprecation; | |
| 4 | +use Elementor\Core\Responsive\Files\Frontend; | |
| 6 | 5 | use Elementor\Plugin; |
| 7 | 6 | |
| 8 | 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | 8 | exit; // Exit if accessed directly. |
| @@ -15,16 +14,13 @@ | ||
| 15 | 14 | * Elementor responsive handler class is responsible for setting up Elementor |
| 16 | 15 | * responsive breakpoints. |
| 17 | 16 | * |
| 18 | 17 | * @since 1.0.0 |
| 19 | - * @deprecated 3.2.0 | |
| 20 | 18 | */ |
| 21 | 19 | class Responsive { |
| 22 | 20 | |
| 23 | 21 | /** |
| 24 | 22 | * The Elementor breakpoint prefix. |
| 25 | - * | |
| 26 | - * @deprecated 3.2.0 | |
| 27 | 23 | */ |
| 28 | 24 | const BREAKPOINT_OPTION_PREFIX = 'viewport_'; |
| 29 | 25 | |
| 30 | 26 | /** |
| @@ -32,9 +28,8 @@ | ||
| 32 | 28 | * |
| 33 | 29 | * Holds the default responsive breakpoints. |
| 34 | 30 | * |
| 35 | 31 | * @since 1.0.0 |
| 36 | - * @deprecated 3.2.0 | |
| 37 | 32 | * @access private |
| 38 | 33 | * @static |
| 39 | 34 | * |
| 40 | 35 | * @var array Default breakpoints. |
| @@ -53,9 +48,8 @@ | ||
| 53 | 48 | * |
| 54 | 49 | * Holds the editable breakpoint keys. |
| 55 | 50 | * |
| 56 | 51 | * @since 1.0.0 |
| 57 | - * @deprecated 3.2.0 | |
| 58 | 52 | * @access private |
| 59 | 53 | * @static |
| 60 | 54 | * |
| 61 | 55 | * @var array Editable breakpoint keys. |
| @@ -70,9 +64,8 @@ | ||
| 70 | 64 | * |
| 71 | 65 | * Retrieve the default responsive breakpoints. |
| 72 | 66 | * |
| 73 | 67 | * @since 1.0.0 |
| 74 | - * @deprecated 3.2.0 Use `Elementor\Core\Breakpoints\Manager::get_default_config()` instead. | |
| 75 | 68 | * @access public |
| 76 | 69 | * @static |
| 77 | 70 | * |
| 78 | 71 | * @return array Default breakpoints. |
| @@ -77,10 +70,8 @@ | ||
| 77 | 70 | * |
| 78 | 71 | * @return array Default breakpoints. |
| 79 | 72 | */ |
| 80 | 73 | public static function get_default_breakpoints() { |
| 81 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::get_default_config()' ); | |
| 82 | - | |
| 83 | 74 | return self::$default_breakpoints; |
| 84 | 75 | } |
| 85 | 76 | |
| 86 | 77 | /** |
| @@ -88,9 +79,8 @@ | ||
| 88 | 79 | * |
| 89 | 80 | * Retrieve the editable breakpoints. |
| 90 | 81 | * |
| 91 | 82 | * @since 1.0.0 |
| 92 | - * @deprecated 3.2.0 | |
| 93 | 83 | * @access public |
| 94 | 84 | * @static |
| 95 | 85 | * |
| 96 | 86 | * @return array Editable breakpoints. |
| @@ -95,10 +85,8 @@ | ||
| 95 | 85 | * |
| 96 | 86 | * @return array Editable breakpoints. |
| 97 | 87 | */ |
| 98 | 88 | public static function get_editable_breakpoints() { |
| 99 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0' ); | |
| 100 | - | |
| 101 | 89 | return array_intersect_key( self::get_breakpoints(), array_flip( self::$editable_breakpoints_keys ) ); |
| 102 | 90 | } |
| 103 | 91 | |
| 104 | 92 | /** |
| @@ -106,9 +94,8 @@ | ||
| 106 | 94 | * |
| 107 | 95 | * Retrieve the responsive breakpoints. |
| 108 | 96 | * |
| 109 | 97 | * @since 1.0.0 |
| 110 | - * @deprecated 3.2.0 | |
| 111 | 98 | * @access public |
| 112 | 99 | * @static |
| 113 | 100 | * |
| 114 | 101 | * @return array Responsive breakpoints. |
| @@ -115,9 +102,9 @@ | ||
| 115 | 102 | */ |
| 116 | 103 | public static function get_breakpoints() { |
| 117 | 104 | return array_reduce( |
| 118 | 105 | array_keys( self::$default_breakpoints ), function( $new_array, $breakpoint_key ) { |
| 119 | - if ( ! in_array( $breakpoint_key, self::$editable_breakpoints_keys, true ) ) { | |
| 106 | + if ( ! in_array( $breakpoint_key, self::$editable_breakpoints_keys ) ) { | |
| 120 | 107 | $new_array[ $breakpoint_key ] = self::$default_breakpoints[ $breakpoint_key ]; |
| 121 | 108 | } else { |
| 122 | 109 | $saved_option = Plugin::$instance->kits_manager->get_current_settings( self::BREAKPOINT_OPTION_PREFIX . $breakpoint_key ); |
| 123 | 110 | |
| @@ -130,38 +117,52 @@ | ||
| 130 | 117 | } |
| 131 | 118 | |
| 132 | 119 | /** |
| 133 | 120 | * @since 2.1.0 |
| 134 | - * @deprecated 3.2.0 Use `Plugin::$instance->breakpoints->has_custom_breakpoints()` instead. | |
| 135 | 121 | * @access public |
| 136 | 122 | * @static |
| 137 | 123 | */ |
| 138 | 124 | public static function has_custom_breakpoints() { |
| 139 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Plugin::$instance->breakpoints->has_custom_breakpoints()' ); | |
| 140 | - | |
| 141 | - return (bool) array_diff( self::$default_breakpoints, self::get_breakpoints() ); | |
| 125 | + return ! ! array_diff( self::$default_breakpoints, self::get_breakpoints() ); | |
| 142 | 126 | } |
| 143 | 127 | |
| 144 | 128 | /** |
| 145 | 129 | * @since 2.1.0 |
| 146 | - * @deprecated 3.2.0 Use `Elementor\Core\Breakpoints\Manager::get_stylesheet_templates_path()` instead. | |
| 147 | 130 | * @access public |
| 148 | 131 | * @static |
| 149 | 132 | */ |
| 150 | 133 | public static function get_stylesheet_templates_path() { |
| 151 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::get_stylesheet_templates_path()' ); | |
| 152 | - | |
| 153 | - return Breakpoints_Manager::get_stylesheet_templates_path(); | |
| 134 | + return ELEMENTOR_ASSETS_PATH . 'css/templates/'; | |
| 154 | 135 | } |
| 155 | 136 | |
| 156 | 137 | /** |
| 157 | 138 | * @since 2.1.0 |
| 158 | - * @deprecated 3.2.0 Use `Elementor\Core\Breakpoints\Manager::compile_stylesheet_templates()` instead. | |
| 159 | 139 | * @access public |
| 160 | 140 | * @static |
| 161 | 141 | */ |
| 162 | 142 | public static function compile_stylesheet_templates() { |
| 163 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.2.0', 'Elementor\Core\Breakpoints\Manager::compile_stylesheet_templates()' ); | |
| 143 | + foreach ( self::get_stylesheet_templates() as $file_name => $template_path ) { | |
| 144 | + $file = new Frontend( $file_name, $template_path ); | |
| 164 | 145 | |
| 165 | - Breakpoints_Manager::compile_stylesheet_templates(); | |
| 146 | + $file->update(); | |
| 147 | + } | |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * @since 2.1.0 | |
| 152 | + * @access private | |
| 153 | + * @static | |
| 154 | + */ | |
| 155 | + private static function get_stylesheet_templates() { | |
| 156 | + $templates_paths = glob( self::get_stylesheet_templates_path() . '*.css' ); | |
| 157 | + | |
| 158 | + $templates = []; | |
| 159 | + | |
| 160 | + foreach ( $templates_paths as $template_path ) { | |
| 161 | + $file_name = 'custom-' . basename( $template_path ); | |
| 162 | + | |
| 163 | + $templates[ $file_name ] = $template_path; | |
| 164 | + } | |
| 165 | + | |
| 166 | + return apply_filters( 'elementor/core/responsive/get_stylesheet_templates', $templates ); | |
| 166 | 167 | } |
| 167 | 168 | } |