1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
namespace TotalPoll\Limitations; ! defined( 'ABSPATH' ) && exit();
use TotalPollVendors\TotalCore\Limitations\Limitation;
/** * Quota Limitation * @package TotalPoll\Limitations */ class Quota extends Limitation { /** * Limitation check logic. * * @return bool|\WP_Error */ public function check() { $quota = isset( $this->args['value'] ) ? (int) $this->args['value'] : false; $currentValue = isset( $this->args['currentValue'] ) ? (int) $this->args['currentValue'] : false; if ( $quota && $quota > 0 && $quota <= $currentValue ): return new \WP_Error( 'quota', __( 'This poll has ended (votes quota has been exceeded).', 'totalpoll' ) ); endif;
return true; } }
|