PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.2
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / deprecated / inc / class-wpseo-validator.php

class-wpseo-validator.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.2, at src/deprecated/inc/class-wpseo-validator.php

100 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Internals
6 */
7
8 /**
9 * Class WPSEO_Validator.
10 *
11 * @deprecated 15.6
12 */
13 class WPSEO_Validator {
14
15 /**
16 * Validates whether the passed variable is a boolean.
17 *
18 * @deprecated 15.6
19 * @codeCoverageIgnore
20 *
21 * @param mixed $variable The variable to validate.
22 *
23 * @return bool Whether or not the passed variable is a valid boolean.
24 */
25 public static function is_boolean( $variable ) {
26 _deprecated_function( __METHOD__, 'WPSEO 15.6' );
27
28 if ( is_bool( $variable ) ) {
29 return true;
30 }
31
32 return filter_var( $variable, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ) !== null;
33 }
34
35 /**
36 * Validates whether the passed variable is a string.
37 *
38 * @deprecated 15.6
39 * @codeCoverageIgnore
40 *
41 * @param mixed $variable The variable to validate.
42 *
43 * @return bool Whether or not the passed variable is a string.
44 */
45 public static function is_string( $variable ) {
46 _deprecated_function( __METHOD__, 'WPSEO 15.6' );
47
48 return is_string( $variable );
49 }
50
51 /**
52 * Validates whether the passed variable is a non-empty string.
53 *
54 * @deprecated 15.6
55 * @codeCoverageIgnore
56 *
57 * @param mixed $variable The variable to validate.
58 *
59 * @return bool Whether or not the passed value is a non-empty string.
60 */
61 public static function is_non_empty_string( $variable ) {
62 _deprecated_function( __METHOD__, 'WPSEO 15.6' );
63
64 return self::is_string( $variable ) && $variable !== '';
65 }
66
67 /**
68 * Validates whether the passed variable is an integer.
69 *
70 * @deprecated 15.6
71 * @codeCoverageIgnore
72 *
73 * @param mixed $variable The variable to validate.
74 *
75 * @return bool Whether or not the passed variable is an integer.
76 */
77 public static function is_integer( $variable ) {
78 _deprecated_function( __METHOD__, 'WPSEO 15.6' );
79
80 return filter_var( $variable, FILTER_VALIDATE_INT ) || filter_var( $variable, FILTER_VALIDATE_INT ) === 0;
81 }
82
83 /**
84 * Determines whether a particular key exists within the passed dataset.
85 *
86 * @deprecated 15.6
87 * @codeCoverageIgnore
88 *
89 * @param array $data The dataset to search through.
90 * @param string $key The key to search for.
91 *
92 * @return bool Whether or not the key exists.
93 */
94 public static function key_exists( array $data, $key ) {
95 _deprecated_function( __METHOD__, 'WPSEO 15.6' );
96
97 return array_key_exists( $key, $data );
98 }
99 }
100