PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.1
Elementor Website Builder – more than just a page builder v3.8.1
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
← All changes | modules/dev-tools/deprecation.php +33 -29 4.2.23.8.1 View file →
@@ -1,9 +1,7 @@
1 1 <?php
2 2 namespace Elementor\Modules\DevTools;
3 3
4 -use Elementor\Utils;
5 -
6 4 if ( ! defined( 'ABSPATH' ) ) {
7 5 exit; // Exit if accessed directly.
8 6 }
9 7
@@ -65,9 +63,9 @@
65 63 *
66 64 * @since 3.1.0
67 65 *
68 66 * @param string $version
69 - * @param int $count
67 + * @param int $count
70 68 *
71 69 * @return string|false
72 70 */
73 71 public function get_next_version( $version, $count = 1 ) {
@@ -186,10 +184,10 @@
186 184 * @param string $version
187 185 * @param string $replacement Optional
188 186 * @param string $base_version Optional. Default is `null`
189 187 *
190 - * @return bool
191 - * @throws \Exception Invalid deprecation.
188 + * @return bool|void
189 + * @throws \Exception
192 190 */
193 191 private function check_deprecation( $entity, $version, $replacement, $base_version = null ) {
194 192 if ( null === $base_version ) {
195 193 $base_version = $this->current_version;
@@ -197,9 +195,9 @@
197 195
198 196 $diff = $this->compare_version( $base_version, $version );
199 197
200 198 if ( false === $diff ) {
201 - throw new \Exception( 'Invalid deprecation diff.' );
199 + throw new \Exception( 'Invalid deprecation diff' );
202 200 }
203 201
204 202 $print_deprecated = false;
205 203
@@ -211,11 +209,14 @@
211 209 $replacement,
212 210 ];
213 211 }
214 212
215 - if ( Utils::is_elementor_debug() ) {
213 + if ( defined( 'ELEMENTOR_DEBUG' ) && ELEMENTOR_DEBUG ) {
216 214 $print_deprecated = true;
217 215 }
216 + } else {
217 + // Hard deprecated.
218 + $print_deprecated = true;
218 219 }
219 220
220 221 return $print_deprecated;
221 222 }
@@ -226,20 +227,20 @@
226 227 * Handles the deprecation process for functions.
227 228 *
228 229 * @since 3.1.0
229 230 *
230 - * @param string $function_name
231 + * @param string $function
231 232 * @param string $version
232 - * @param string $replacement Optional. Default is ''
233 - * @param string $base_version Optional. Default is `null`
234 - * @throws \Exception Deprecation error.
233 + * @param string $replacement Optional. Default is ''
234 + * @param string $base_version Optional. Default is `null`
235 + * @throws \Exception
235 236 */
236 - public function deprecated_function( $function_name, $version, $replacement = '', $base_version = null ) {
237 - $print_deprecated = $this->check_deprecation( $function_name, $version, $replacement, $base_version );
237 + public function deprecated_function( $function, $version, $replacement = '', $base_version = null ) {
238 + $print_deprecated = $this->check_deprecation( $function, $version, $replacement, $base_version );
238 239
239 240 if ( $print_deprecated ) {
240 241 // PHPCS - We need to echo special characters because they can exist in function calls.
241 - _deprecated_function( $function_name, esc_html( $version ), $replacement ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
242 + _deprecated_function( $function, esc_html( $version ), $replacement ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
242 243 }
243 244 }
244 245
245 246 /**
@@ -246,14 +247,15 @@
246 247 * Deprecated Hook
247 248 *
248 249 * Handles the deprecation process for hooks.
249 250 *
251 + * @since 3.1.0
252 + *
250 253 * @param string $hook
251 254 * @param string $version
252 255 * @param string $replacement Optional. Default is ''
253 256 * @param string $base_version Optional. Default is `null`
254 - * @throws \Exception Deprecation error.
255 - * @since 3.1.0
257 + * @throws \Exception
256 258 */
257 259 public function deprecated_hook( $hook, $version, $replacement = '', $base_version = null ) {
258 260 $print_deprecated = $this->check_deprecation( $hook, $version, $replacement, $base_version );
259 261
@@ -272,9 +274,9 @@
272 274 * @param string $argument
273 275 * @param string $version
274 276 * @param string $replacement
275 277 * @param string $message
276 - * @throws \Exception Deprecation error.
278 + * @throws \Exception
277 279 */
278 280 public function deprecated_argument( $argument, $version, $replacement = '', $message = '' ) {
279 281 $print_deprecated = $this->check_deprecation( $argument, $version, $replacement );
280 282
@@ -308,16 +310,17 @@
308 310 * Do Deprecated Action
309 311 *
310 312 * A method used to run deprecated actions through Elementor's deprecation process.
311 313 *
312 - * @param string $hook
313 - * @param array $args
314 - * @param string $version
315 - * @param string $replacement
314 + * @since 3.1.0
315 + *
316 + * @param string $hook
317 + * @param array $args
318 + * @param string $version
319 + * @param string $replacement
316 320 * @param null|string $base_version
317 321 *
318 - * @throws \Exception Deprecation error.
319 - * @since 3.1.0
322 + * @throws \Exception
320 323 */
321 324 public function do_deprecated_action( $hook, $args, $version, $replacement = '', $base_version = null ) {
322 325 if ( ! has_action( $hook ) ) {
323 326 return;
@@ -332,17 +335,18 @@
332 335 * Apply Deprecated Filter
333 336 *
334 337 * A method used to run deprecated filters through Elementor's deprecation process.
335 338 *
336 - * @param string $hook
337 - * @param array $args
338 - * @param string $version
339 - * @param string $replacement
339 + * @since 3.2.0
340 + *
341 + * @param string $hook
342 + * @param array $args
343 + * @param string $version
344 + * @param string $replacement
340 345 * @param null|string $base_version
341 346 *
342 347 * @return mixed
343 - * @throws \Exception Deprecation error.
344 - * @since 3.2.0
348 + * @throws \Exception
345 349 */
346 350 public function apply_deprecated_filter( $hook, $args, $version, $replacement = '', $base_version = null ) {
347 351 if ( ! has_action( $hook ) ) {
348 352 // `$args` should be an array, but in order to keep BC, we need to support non-array values.