PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.2.2
Kirki – Freeform Page Builder, Website Builder & Customizer v6.2.2
6.2.3 6.2.2 6.2.1 6.2.0 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 / SameAsRule.php
kirki / libraries / framework / Validation / Rules Last commit date
ArrayRule.php 2 weeks ago BooleanRule.php 2 weeks ago ConditionalRule.php 2 weeks ago DateRule.php 2 weeks ago ExistsRule.php 2 weeks ago FileRule.php 2 weeks ago InRule.php 2 weeks ago NotInRule.php 2 weeks ago NullableRule.php 2 weeks ago NumericRule.php 2 weeks ago ObjectRule.php 2 weeks ago ProhibitedIfRule.php 2 weeks ago ProhibitedRule.php 2 weeks ago ProhibitedUnlessRule.php 2 weeks ago RequiredIfRule.php 2 weeks ago RequiredRule.php 2 weeks ago RequiredUnlessRule.php 2 weeks ago SameAsRule.php 2 weeks ago SometimesRule.php 2 weeks ago StringRule.php 2 weeks ago UniqueRule.php 2 weeks ago
SameAsRule.php
55 lines
1 <?php
2
3 /**
4 * Same as rule class.
5 *
6 * @package Framework
7 * @subpackage Validation
8 * @since 1.0.0
9 */
10 namespace Kirki\Framework\Validation\Rules;
11
12 use Kirki\Framework\Validation\ValidationRule;
13 use function Kirki\Framework\deep_get;
14 \defined('ABSPATH') || exit;
15 /**
16 * Validates that the given value strictly matches the value of another field.
17 */
18 class SameAsRule extends ValidationRule
19 {
20 /**
21 * The rule name.
22 *
23 * @var string
24 *
25 * @since 1.0.0
26 */
27 protected string $rule = 'same_as';
28 /**
29 * Validate the rule.
30 *
31 * @return bool
32 *
33 * @since 1.0.0
34 */
35 public function validate() : bool
36 {
37 $other_value = deep_get($this->data, (string) $this->args);
38 if ($this->value !== $other_value) {
39 return $this->fails($this->default_messages['default']);
40 }
41 return \true;
42 }
43 /**
44 * Get the error messages.
45 *
46 * @return array
47 *
48 * @since 1.0.0
49 */
50 public function messages()
51 {
52 return $this->process_messages($this->messages);
53 }
54 }
55