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 / ActionScheduler_Versions.php
jetformbuilder / vendor / woocommerce / action-scheduler / classes Last commit date
WP_CLI 1 month ago abstracts 1 month ago actions 1 year ago data-stores 1 month ago migration 1 year ago schedules 1 year ago schema 1 month ago ActionScheduler_ActionClaim.php 1 year ago ActionScheduler_ActionFactory.php 1 year ago ActionScheduler_AdminView.php 1 year ago ActionScheduler_AsyncRequest_QueueRunner.php 1 year ago ActionScheduler_Compatibility.php 1 year ago ActionScheduler_DataController.php 1 month ago ActionScheduler_DateTime.php 1 year ago ActionScheduler_Exception.php 2 years ago ActionScheduler_FatalErrorMonitor.php 1 year ago ActionScheduler_InvalidActionException.php 1 year ago ActionScheduler_ListTable.php 1 year ago ActionScheduler_LogEntry.php 1 year ago ActionScheduler_NullLogEntry.php 1 year ago ActionScheduler_OptionLock.php 1 year ago ActionScheduler_QueueCleaner.php 1 year ago ActionScheduler_QueueRunner.php 1 year ago ActionScheduler_RecurringActionScheduler.php 1 month ago ActionScheduler_SystemInformation.php 1 year ago ActionScheduler_Versions.php 1 year ago ActionScheduler_WPCommentCleaner.php 1 year ago ActionScheduler_wcSystemStatus.php 1 month ago
ActionScheduler_Versions.php
152 lines
1 <?php
2
3 /**
4 * Class ActionScheduler_Versions
5 */
6 class ActionScheduler_Versions {
7 /**
8 * ActionScheduler_Versions instance.
9 *
10 * @var ActionScheduler_Versions
11 */
12 private static $instance = null;
13
14 /**
15 * Versions.
16 *
17 * @var array<string, callable>
18 */
19 private $versions = array();
20
21 /**
22 * Registered sources.
23 *
24 * @var array<string, string>
25 */
26 private $sources = array();
27
28 /**
29 * Register version's callback.
30 *
31 * @param string $version_string Action Scheduler version.
32 * @param callable $initialization_callback Callback to initialize the version.
33 */
34 public function register( $version_string, $initialization_callback ) {
35 if ( isset( $this->versions[ $version_string ] ) ) {
36 return false;
37 }
38
39 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
40 $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
41 $source = $backtrace[0]['file'];
42
43 $this->versions[ $version_string ] = $initialization_callback;
44 $this->sources[ $source ] = $version_string;
45 return true;
46 }
47
48 /**
49 * Get all versions.
50 */
51 public function get_versions() {
52 return $this->versions;
53 }
54
55 /**
56 * Get registered sources.
57 *
58 * Use with caution: this method is only available as of Action Scheduler's 3.9.1
59 * release and, owing to the way Action Scheduler is loaded, it's possible that the
60 * class definition used at runtime will belong to an earlier version.
61 *
62 * @since 3.9.1
63 *
64 * @return array<string, string>
65 */
66 public function get_sources() {
67 return $this->sources;
68 }
69
70 /**
71 * Get latest version registered.
72 */
73 public function latest_version() {
74 $keys = array_keys( $this->versions );
75 if ( empty( $keys ) ) {
76 return false;
77 }
78 uasort( $keys, 'version_compare' );
79 return end( $keys );
80 }
81
82 /**
83 * Get callback for latest registered version.
84 */
85 public function latest_version_callback() {
86 $latest = $this->latest_version();
87
88 if ( empty( $latest ) || ! isset( $this->versions[ $latest ] ) ) {
89 return '__return_null';
90 }
91
92 return $this->versions[ $latest ];
93 }
94
95 /**
96 * Get instance.
97 *
98 * @return ActionScheduler_Versions
99 * @codeCoverageIgnore
100 */
101 public static function instance() {
102 if ( empty( self::$instance ) ) {
103 self::$instance = new self();
104 }
105 return self::$instance;
106 }
107
108 /**
109 * Initialize.
110 *
111 * @codeCoverageIgnore
112 */
113 public static function initialize_latest_version() {
114 $self = self::instance();
115 call_user_func( $self->latest_version_callback() );
116 }
117
118 /**
119 * Returns information about the plugin or theme which contains the current active version
120 * of Action Scheduler.
121 *
122 * If this cannot be determined, or if Action Scheduler is being loaded via some other
123 * method, then it will return an empty array. Otherwise, if populated, the array will
124 * look like the following:
125 *
126 * [
127 * 'type' => 'plugin', # or 'theme'
128 * 'name' => 'Name',
129 * ]
130 *
131 * @deprecated 3.9.2 Use ActionScheduler_SystemInformation::active_source().
132 *
133 * @return array
134 */
135 public function active_source(): array {
136 _deprecated_function( __METHOD__, '3.9.2', 'ActionScheduler_SystemInformation::active_source()' );
137 return ActionScheduler_SystemInformation::active_source();
138 }
139
140 /**
141 * Returns the directory path for the currently active installation of Action Scheduler.
142 *
143 * @deprecated 3.9.2 Use ActionScheduler_SystemInformation::active_source_path().
144 *
145 * @return string
146 */
147 public function active_source_path(): string {
148 _deprecated_function( __METHOD__, '3.9.2', 'ActionScheduler_SystemInformation::active_source_path()' );
149 return ActionScheduler_SystemInformation::active_source_path();
150 }
151 }
152