Use a WP 3.7+ function conditionally

`wp_get_installed_translations()` was introduced in WP 3.7. This change returns an empty result for the translations list if the function does not exist. (Encountered in the wild, fatal error).
This commit is contained in:
David Anderson 2017-10-13 12:26:16 +00:00 committed by GitHub
parent 818ceaffc0
commit f0a10eaca9
1 changed files with 3 additions and 0 deletions

View File

@ -569,6 +569,9 @@ if ( !class_exists('Puc_v4p2_UpdateChecker', false) ):
* @return array
*/
protected function getInstalledTranslations() {
if ( !function_exists('wp_get_installed_translations') ) {
return array();
}
$installedTranslations = wp_get_installed_translations($this->translationType . 's');
if ( isset($installedTranslations[$this->directoryName]) ) {
$installedTranslations = $installedTranslations[$this->directoryName];