ArrayRule.php
2 years ago
AuthenticationRule.php
2 years ago
BillingAddressCityRule.php
2 years ago
BillingAddressStateRule.php
2 years ago
BillingAddressZipRule.php
2 years ago
DonationTypeRule.php
2 years ago
GatewayRule.php
2 years ago
Max.php
2 years ago
Min.php
2 years ago
Size.php
2 years ago
SubscriptionFrequencyRule.php
2 years ago
SubscriptionInstallmentsRule.php
2 years ago
SubscriptionPeriodRule.php
2 years ago
AuthenticationRule.php
36 lines
| 1 | <?php |
| 2 | namespace Give\DonationForms\Rules; |
| 3 | |
| 4 | use Closure; |
| 5 | use Give\Vendors\StellarWP\Validation\Contracts\ValidationRule; |
| 6 | |
| 7 | class AuthenticationRule implements ValidationRule |
| 8 | { |
| 9 | |
| 10 | /** |
| 11 | * @since 3.0.0 |
| 12 | */ |
| 13 | public static function id(): string |
| 14 | { |
| 15 | return 'authentication'; |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * @since 3.0.0 |
| 20 | */ |
| 21 | public static function fromString(string $options = null): ValidationRule |
| 22 | { |
| 23 | return new self(); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * @since 3.0.0 |
| 28 | */ |
| 29 | public function __invoke($value, Closure $fail, string $key, array $values) |
| 30 | { |
| 31 | if (!is_user_logged_in()) { |
| 32 | $fail(__('Login required.', 'give')); |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 |