Fixed Plugin Update code to avoid "Failed to parse" errors if key is not valid for...
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 13 Apr 2017 15:48:28 +0000 (11:48 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 13 Apr 2017 15:48:28 +0000 (11:48 -0400)
Changed message at top of wp-admin plugins page from "Plugin is up to date." which is not appropriate if it's a bad key to "No plugin update available."
Updated string in language files but did not translate.

lib/plugin-update-checker/languages/plugin-update-checker-fr_FR.po
lib/plugin-update-checker/languages/plugin-update-checker-hu_HU.po
lib/plugin-update-checker/languages/plugin-update-checker.pot
lib/plugin-update-checker/plugin-update-checker.php

index bcbcd15..b5df93a 100644 (file)
@@ -25,7 +25,7 @@ msgid "Check for updates"
 msgstr "Vérifier les mises à jour"
 
 #: plugin-update-checker.php:681
-msgid "This plugin is up to date."
+msgid "No plugin update available."
 msgstr "Ce plugin est à jour."
 
 #: plugin-update-checker.php:683
index df22657..13c71f5 100644 (file)
@@ -25,7 +25,7 @@ msgid "Check for updates"
 msgstr "Frissítés ellenőrzése"
 
 #: plugin-update-checker.php:896
-msgid "This plugin is up to date."
+msgid "No plugin update available."
 msgstr "Ez a plugin naprakész."
 
 #: plugin-update-checker.php:898
index bcbbd84..6923604 100644 (file)
@@ -26,7 +26,7 @@ msgid "Check for updates"
 msgstr ""
 
 #: plugin-update-checker.php:896
-msgid "This plugin is up to date."
+msgid "No plugin update available."
 msgstr ""
 
 #: plugin-update-checker.php:898
index 4855629..5f00cbc 100644 (file)
@@ -196,18 +196,21 @@ class PluginUpdateChecker_3_1 {
         //Try to parse the response\r
         $status = $this->validateApiResponse($result);\r
         $pluginInfo = null;\r
-        if ( !is_wp_error($status) ){\r
+        if ( !is_wp_error($status) && is_array($status)){\r
             $pluginInfo = PluginInfo_3_1::fromJson($result['body']);\r
             if ( $pluginInfo !== null ) {\r
                 $pluginInfo->filename = $this->pluginFile;\r
                 $pluginInfo->slug = $this->slug;\r
             }\r
         } else {\r
+            return false;\r
+            /* Not generating error at this time as this could simply be a bad or missing key submitted\r
             $this->triggerError(\r
                 sprintf('The URL %s does not point to a valid plugin metadata file. ', $url)\r
                     . $status->get_error_message(),\r
                 E_USER_WARNING\r
             );\r
+            */\r
         }\r
 \r
         $pluginInfo = apply_filters('puc_request_info_result-'.$this->slug, $pluginInfo, $result);\r
@@ -805,7 +808,7 @@ class PluginUpdateChecker_3_1 {
         if ( isset($_GET['puc_update_check_result'], $_GET['puc_slug']) && ($_GET['puc_slug'] == $this->slug) ) {\r
             $status = strval($_GET['puc_update_check_result']);\r
             if ( $status == 'no_update' ) {\r
-                $message = __('This plugin is up to date.', 'plugin-update-checker');\r
+                $message = __('No plugin update available.', 'plugin-update-checker');\r
             } else if ( $status == 'update_available' ) {\r
                 $message = __('A new version of this plugin is available.', 'plugin-update-checker');\r
             } else {\r