Refactor WPFunctions to be injectable with DI

This commit is contained in:
Amine Ben hammou
2018-12-12 14:41:44 +01:00
parent e059ee7364
commit a46d98ec44
23 changed files with 146 additions and 97 deletions

View File

@@ -16,11 +16,12 @@ class Date {
'mtext' => 'F',
'y' => 'Y'
);
$wp = new WPFunctions();
if(!empty($action_mapping[$shortcode_details['action']])) {
return date_i18n($action_mapping[$shortcode_details['action']], WPFunctions::currentTime('timestamp'));
return date_i18n($action_mapping[$shortcode_details['action']], $wp->currentTime('timestamp'));
}
return ($shortcode_details['action'] === 'custom' && $shortcode_details['action_argument'] === 'format') ?
date_i18n($shortcode_details['action_argument_value'], WPFunctions::currentTime('timestamp')) :
date_i18n($shortcode_details['action_argument_value'], $wp->currentTime('timestamp')) :
false;
}
}