Skip to content

Commit

Permalink
refactor: Transient key formation for dokan_get_jed_locale_data globa…
Browse files Browse the repository at this point in the history
…l function
  • Loading branch information
devAsadNur committed Aug 8, 2024
1 parent 789d0b1 commit a104d51
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2950,10 +2950,12 @@ function dokan_get_translations_for_plugin_domain( $domain, $language_dir = null
* @return array
*/
function dokan_get_jed_locale_data( $domain, $language_dir = null ) {
$plugin_language_dir = WP_LANG_DIR . '/plugins/';
$plugin_language_dir = WP_LANG_DIR . '/plugins/';
$language_dir_time = ! empty( $language_dir ) ? filectime( $language_dir ) : 0;
$plugin_language_dir_time = ! empty( $plugin_language_dir ) ? filectime( $plugin_language_dir ) : 0;

// get transient key
$transient_key = sprintf( 'dokan_i18n-%s-%d-%d-%s', $domain, filectime( $language_dir ), filectime( $plugin_language_dir ), get_user_locale() );
$transient_key = sprintf( 'dokan_i18n-%s-%d-%d-%s', $domain, $language_dir_time, $plugin_language_dir_time, get_user_locale() );

// check if data exists on cache or not
$locale = Cache::get_transient( $transient_key );
Expand Down

0 comments on commit a104d51

Please sign in to comment.