plugin updates

This commit is contained in:
Tony Volpe
2024-11-15 13:53:04 -05:00
parent 1293d604ca
commit 0238f0c4ca
2009 changed files with 163492 additions and 89543 deletions

View File

@@ -9,8 +9,15 @@ class ActionScheduler_Versions {
*/
private static $instance = NULL;
/** @var array<string, callable> */
private $versions = array();
/**
* Register version's callback.
*
* @param string $version_string Action Scheduler version.
* @param callable $initialization_callback Callback to initialize the version.
*/
public function register( $version_string, $initialization_callback ) {
if ( isset($this->versions[$version_string]) ) {
return FALSE;
@@ -19,10 +26,16 @@ class ActionScheduler_Versions {
return TRUE;
}
/**
* Get all versions.
*/
public function get_versions() {
return $this->versions;
}
/**
* Get latest version registered.
*/
public function latest_version() {
$keys = array_keys($this->versions);
if ( empty($keys) ) {
@@ -32,6 +45,9 @@ class ActionScheduler_Versions {
return end($keys);
}
/**
* Get callback for latest registered version.
*/
public function latest_version_callback() {
$latest = $this->latest_version();
if ( empty($latest) || !isset($this->versions[$latest]) ) {
@@ -59,4 +75,3 @@ class ActionScheduler_Versions {
call_user_func($self->latest_version_callback());
}
}