Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #73 from Mte90/master
Browse files Browse the repository at this point in the history
feat(transient): migrate to option
  • Loading branch information
enricobattocchi authored Nov 18, 2022
2 parents 7bc3d41 + 0ca258d commit 47e73e9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/i18n-v3.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ private function init( $args ) {
* @return bool
*/
private function hide_promo() {
$hide_promo = get_transient( 'yoast_i18n_' . $this->project_slug . '_promo_hide' );
$hide_promo = get_option( 'yoast_i18n_' . $this->project_slug . '_promo_hide' );
if ( ! $hide_promo ) {
if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) {
// No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc.
set_transient( 'yoast_i18n_' . $this->project_slug . '_promo_hide', true );
update_option( 'yoast_i18n_' . $this->project_slug . '_promo_hide', true );
$hide_promo = true;
}
}
Expand Down Expand Up @@ -289,16 +289,16 @@ public function promo() {
}

/**
* Try to find the transient for the translation set or retrieve them.
* Try to find the option for the translation set or retrieve them.
*
* @return object|null
*/
private function find_or_initialize_translation_details() {
$set = get_transient( 'yoast_i18n_' . $this->project_slug . '_' . $this->locale );
$set = get_option( 'yoast_i18n_' . $this->project_slug . '_' . $this->locale );

if ( ! $set ) {
$set = $this->retrieve_translation_details();
set_transient( 'yoast_i18n_' . $this->project_slug . '_' . $this->locale, $set, DAY_IN_SECONDS );
update_option( 'yoast_i18n_' . $this->project_slug . '_' . $this->locale, $set );
}

return $set;
Expand Down

0 comments on commit 47e73e9

Please sign in to comment.