PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.1.1
Kirki – Freeform Page Builder, Website Builder & Customizer v6.1.1
6.2.4 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 / GreaterThanEqualRule.php
kirki / libraries / framework / Validation / Rules Last commit date
AfterRule.php 1 month ago ArrayRule.php 1 month ago BaseRule.php 1 month ago BooleanRule.php 1 month ago DateFormatRule.php 1 month ago DateRule.php 1 month ago DateTimeRule.php 1 month ago EmailRule.php 1 month ago EmailUniqueRule.php 1 month ago ExistsRule.php 1 month ago FloatRule.php 1 month ago GreaterThanEqualRule.php 1 month ago GreaterThanRule.php 1 month ago InRule.php 1 month ago IntegerRule.php 1 month ago IsValidImageIdRule.php 1 month ago LessThanEqualRule.php 1 month ago LessThanRule.php 1 month ago MaxRule.php 1 month ago MinRule.php 1 month ago NotInRule.php 1 month ago NullableRule.php 1 month ago NumberRule.php 1 month ago ObjectRule.php 1 month ago ProhibitedIfRule.php 1 month ago ProhibitedRule.php 1 month ago RegexRule.php 1 month ago RequiredIfExists.php 1 month ago RequiredIfRule.php 1 month ago RequiredIfSiblingRule.php 1 month ago RequiredRule.php 1 month ago SameAsRule.php 1 month ago Sanitizer.php 1 month ago StringRule.php 1 month ago UniqueRule.php 1 month ago UrlRule.php 1 month ago UserExists.php 1 month ago
GreaterThanEqualRule.php
53 lines
1 <?php
2
3 /**
4 * Rule to ensure the value is after the given date.
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 Kirki\Framework\Supports\Date;
14 use Kirki\Framework\Supports\Str;
15 use function Kirki\Framework\message;
16 class GreaterThanEqualRule extends BaseRule
17 {
18 /**
19 * Check if the rule is valid.
20 *
21 * @return bool
22 *
23 * @since 1.0.0
24 */
25 public function validate_rule()
26 {
27 $current_value = $this->value;
28 $target_value = $this->rule_value;
29 if (!\is_numeric($target_value) && \array_key_exists($target_value, $this->data)) {
30 $target_value = $this->data[$target_value];
31 }
32 $target_value = Str::to_number($target_value);
33 if (\is_int($target_value)) {
34 $current_value = (int) $current_value;
35 }
36 if (\is_float($target_value)) {
37 $current_value = (float) $current_value;
38 }
39 return $current_value >= $target_value;
40 }
41 /**
42 * Get the error message if the rule is not valid.
43 *
44 * @return string
45 *
46 * @since 1.0.0
47 */
48 public function get_error_message()
49 {
50 return message('validator.gte', $this->last_key_segment(), $this->rule_value);
51 }
52 }
53