Plugin Updates

This commit is contained in:
Tony Volpe
2024-04-02 20:23:21 +00:00
parent 96800520e8
commit 94170ec2c4
1514 changed files with 133309 additions and 105985 deletions

View File

@@ -133,12 +133,12 @@ abstract class DataSourcePoller {
$this->merge_specs( $specs_from_data_source, $specs, $url );
}
$specs_group = get_transient( $this->args['transient_name'] ) ?? array();
$specs_group = get_transient( $this->args['transient_name'] );
$specs_group = is_array( $specs_group ) ? $specs_group : array();
$locale = get_user_locale();
$specs_group[ $locale ] = $specs;
// Persist the specs as a transient.
set_transient(
$this->args['transient_name'],
$this->set_specs_transient(
$specs_group,
$this->args['transient_expiry']
);
@@ -154,6 +154,20 @@ abstract class DataSourcePoller {
return delete_transient( $this->args['transient_name'] );
}
/**
* Set the specs transient.
*
* @param array $specs The specs to set in the transient.
* @param int $expiration The expiration time for the transient.
*/
public function set_specs_transient( $specs, $expiration = 0 ) {
set_transient(
$this->args['transient_name'],
$specs,
$expiration,
);
}
/**
* Read a single data source and return the read specs
*
@@ -183,7 +197,7 @@ abstract class DataSourcePoller {
// phpcs:ignore
$logger->error( print_r( $response, true ), $logger_context );
return [];
return array();
}
$body = $response['body'];
@@ -195,7 +209,7 @@ abstract class DataSourcePoller {
$logger_context
);
return [];
return array();
}
if ( ! is_array( $specs ) ) {
@@ -204,7 +218,7 @@ abstract class DataSourcePoller {
$logger_context
);
return [];
return array();
}
return $specs;