From f0a10eaca98a58b58bdbb89c50158d591473fa2a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 13 Oct 2017 12:26:16 +0000 Subject: [PATCH] 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). --- Puc/v4p2/UpdateChecker.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Puc/v4p2/UpdateChecker.php b/Puc/v4p2/UpdateChecker.php index 75bcc3e..ce94583 100644 --- a/Puc/v4p2/UpdateChecker.php +++ b/Puc/v4p2/UpdateChecker.php @@ -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];