PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.1
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / vendor / woocommerce / action-scheduler / classes / abstracts / ActionScheduler_Lock.php
jetformbuilder / vendor / woocommerce / action-scheduler / classes / abstracts Last commit date
ActionScheduler.php 1 month ago ActionScheduler_Abstract_ListTable.php 1 year ago ActionScheduler_Abstract_QueueRunner.php 1 month ago ActionScheduler_Abstract_RecurringSchedule.php 1 year ago ActionScheduler_Abstract_Schedule.php 1 year ago ActionScheduler_Abstract_Schema.php 1 year ago ActionScheduler_Lock.php 1 year ago ActionScheduler_Logger.php 1 year ago ActionScheduler_Store.php 1 year ago ActionScheduler_TimezoneHelper.php 1 year ago ActionScheduler_WPCLI_Command.php 1 year ago
ActionScheduler_Lock.php
75 lines
1 <?php
2
3 /**
4 * Abstract class for setting a basic lock to throttle some action.
5 *
6 * Class ActionScheduler_Lock
7 */
8 abstract class ActionScheduler_Lock {
9
10 /**
11 * Instance.
12 *
13 * @var ActionScheduler_Lock
14 */
15 private static $locker = null;
16
17 /**
18 * Duration of lock.
19 *
20 * @var int
21 */
22 protected static $lock_duration = MINUTE_IN_SECONDS;
23
24 /**
25 * Check if a lock is set for a given lock type.
26 *
27 * @param string $lock_type A string to identify different lock types.
28 * @return bool
29 */
30 public function is_locked( $lock_type ) {
31 return ( $this->get_expiration( $lock_type ) >= time() );
32 }
33
34 /**
35 * Set a lock.
36 *
37 * To prevent race conditions, implementations should avoid setting the lock if the lock is already held.
38 *
39 * @param string $lock_type A string to identify different lock types.
40 * @return bool
41 */
42 abstract public function set( $lock_type );
43
44 /**
45 * If a lock is set, return the timestamp it was set to expiry.
46 *
47 * @param string $lock_type A string to identify different lock types.
48 * @return bool|int False if no lock is set, otherwise the timestamp for when the lock is set to expire.
49 */
50 abstract public function get_expiration( $lock_type );
51
52 /**
53 * Get the amount of time to set for a given lock. 60 seconds by default.
54 *
55 * @param string $lock_type A string to identify different lock types.
56 * @return int
57 */
58 protected function get_duration( $lock_type ) {
59 return apply_filters( 'action_scheduler_lock_duration', self::$lock_duration, $lock_type );
60 }
61
62 /**
63 * Get instance.
64 *
65 * @return ActionScheduler_Lock
66 */
67 public static function instance() {
68 if ( empty( self::$locker ) ) {
69 $class = apply_filters( 'action_scheduler_lock_class', 'ActionScheduler_OptionLock' );
70 self::$locker = new $class();
71 }
72 return self::$locker;
73 }
74 }
75