PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / libraries / framework / Validation / Rules / NotInRule.php
kirki / libraries / framework / Validation / Rules Last commit date
AfterRule.php 3 weeks ago ArrayRule.php 3 weeks ago BaseRule.php 3 weeks ago BooleanRule.php 3 weeks ago DateFormatRule.php 3 weeks ago DateRule.php 3 weeks ago DateTimeRule.php 3 weeks ago EmailRule.php 3 weeks ago EmailUniqueRule.php 3 weeks ago ExistsRule.php 3 weeks ago FloatRule.php 3 weeks ago GreaterThanEqualRule.php 3 weeks ago GreaterThanRule.php 3 weeks ago InRule.php 3 weeks ago IntegerRule.php 3 weeks ago IsValidImageIdRule.php 3 weeks ago LessThanEqualRule.php 3 weeks ago LessThanRule.php 3 weeks ago MaxRule.php 3 weeks ago MinRule.php 3 weeks ago NotInRule.php 3 weeks ago NullableRule.php 3 weeks ago NumberRule.php 3 weeks ago ObjectRule.php 3 weeks ago ProhibitedIfRule.php 3 weeks ago ProhibitedRule.php 3 weeks ago RegexRule.php 3 weeks ago RequiredIfExists.php 3 weeks ago RequiredIfRule.php 3 weeks ago RequiredIfSiblingRule.php 3 weeks ago RequiredRule.php 3 weeks ago SameAsRule.php 3 weeks ago Sanitizer.php 3 weeks ago StringRule.php 3 weeks ago UniqueRule.php 3 weeks ago UrlRule.php 3 weeks ago UserExists.php 3 weeks ago
NotInRule.php
44 lines
1 <?php
2
3 /**
4 * Rule to ensure a value does not exists within a predefined set.
5 *
6 * @package Framework
7 * @subpackage Validation\Rules
8 * @since 1.0.0
9 */
10 namespace Kirki\Framework\Validation\Rules;
11
12 \defined('ABSPATH') || exit;
13 use function Kirki\Framework\message;
14 class NotInRule extends BaseRule
15 {
16 /**
17 * Check if the value is in the allowed list.
18 *
19 * @return bool
20 *
21 * @since 1.0.0
22 */
23 public function validate_rule()
24 {
25 $not_in = $this->rule_value;
26 if (\is_string($not_in)) {
27 $not_in = \str_replace(' ', '', $not_in);
28 $not_in = \explode(',', $not_in);
29 }
30 return !\in_array($this->value, $not_in);
31 }
32 /**
33 * Get the error message if the value is in the not allowed list.
34 *
35 * @return string
36 *
37 * @since 1.0.0
38 */
39 public function get_error_message()
40 {
41 return message('validator.not_in', $this->last_key_segment(), $this->rule_value);
42 }
43 }
44