Commit Graph

155 Commits

Author SHA1 Message Date
Yahnis Elsts a9ce2de7cf Merge remote-tracking branch 'refs/remotes/origin/master' into language-packs 2016-05-05 16:06:11 +03:00
Yahnis Elsts c6970fd883 Extract translation update filter as a method. 2016-05-03 18:32:39 +03:00
Yahnis Elsts 531c4d8247 Fix crash when running 3.x together with 2.x or lower while Debug Bar is active.
While most PUC class names use version number suffixes to avoid conflicts with older versions of the library, the classes responsible for Debug Bar integration did not (until now). This is because those classes are fairly simple and they have stayed mostly unchanged since version 1.0. Mostly, but not completely. For example, the debug bar panel depends on the getCronHookName() function, and that function was recently moved to the new PucScheduler class. 

This is a problem because when your site has two plugins using two different versions of this library (e.g. 3.0 and 1.3), you can end up in a situation where PluginUpdateChecker_3_0 unintentionally instantiates the old version of PluginUpdateCheckerPanel (1.3). Then the panel then tries to access a non-existent field or method of PluginUpdateChecker_3_0 and crashes. It produces errors like this:

[26-Apr-2016 13:34:14 UTC] PHP Fatal error:  Call to undefined method PluginUpdateChecker_3_0::getCronHookName() in [redacted]\wp-content\plugins\plugin-name-here\inc\plugin-updates\debug-bar-panel.php on line 58

Fixed by versioning debug bar panel class names.
2016-04-26 17:02:46 +03:00
Yahnis Elsts 0cfe8deaad Minor: Add a @see reference to the WP API that clears the update cache. 2016-04-19 15:42:38 +03:00
Yahnis Elsts 2c6bfc6309 Initial support for translation updates / language packs. Needs polishing and testing. 2016-04-19 13:56:54 +03:00
Yahnis Elsts 026fb99eef Initialize the $sections property with a default value (empty array).
This way we don't need to check if it's initialised.
2016-03-25 11:45:30 +02:00
Yahnis Elsts 8ec6aad7b9 Minor: whitespace 2016-03-24 22:30:11 +02:00
Yahnis Elsts b973ad6452 Simplify a couple of conditions.
In theory, $state and $state->update should always be either NULL or objects. That means isset() fully covers the possibilities and we don't need the additional empty() checks.
2016-03-24 22:27:20 +02:00
Yahnis Elsts 7a1f6d90ab Minor: Fix inconsistent indentation. 2016-03-24 21:46:07 +02:00
Yahnis Elsts de5b1d42a8 Minor: Fix incorrectly capitalized class name ("StdClass" -> "stdClass"). 2016-03-24 21:37:50 +02:00
Yahnis Elsts 43a04cca8c Extract check period calculation as a method. 2016-03-24 21:33:31 +02:00
Yahnis Elsts 71631d1306 Minor: Fix inconsistent whitespace. 2016-03-15 13:56:45 +02:00
Yahnis Elsts 377e7b5030 Merge pull request #57 from lengthofrope/master
Support both PHP 7 and PHP <5.3

Load different versions of the Parsedown library depending on the PHP version. This will only affect plugins that use the GitHub update checker because the usual checker doesn't need to parse Markdown.
2016-03-15 13:48:20 +02:00
Bas de Kort 0b4a9d16cf Add: Parsedown.php (1.6.0) 2016-03-11 06:51:43 +01:00
Bas de Kort d91e930c7b Rename Parsedown.php to ParsedownLegacy.php 2016-03-11 06:51:09 +01:00
Yahnis Elsts 6e5ebbd378 Minor: Fix some coding style issues. 2016-03-08 19:47:39 +02:00
Yahnis Elsts 67fb7c0e6b WP 4.5 compat: Add `tested` to update fields.
It appears that WordPress core developers are planning to add the `tested` and `compatibility` fields to the bulk update check API. Previously WordPress had to make a separate API request for each plugin to retrieve this information. See this Trac ticket for details:
 https://core.trac.wordpress.org/ticket/35301
 
 The `tested` field is used to generate the "Compatibility with WordPress X.Y: 100% (according to its author)" message on the "Dashboard -> Updates" page.
 
 Note: This library doesn't support the `compatibility` field, so that's not included.
2016-03-08 19:41:47 +02:00
Yahnis Elsts 04176ffa38 Merge pull request #55 from rvola/master
Add PO/MO French translation
2016-02-18 13:50:19 +02:00
Nicolas GEHIN d43bf3f54a Add PO/MO French translation 2016-02-17 14:24:10 +01:00
Yahnis Elsts 86baaae1a9 Minor: Update a couple of doc comments. 2016-02-14 18:09:46 +02:00
Yahnis Elsts 109c60e8fa Remove class name aliases that were used for backwards compatibility.
The non-versioned variants of the update checker classes were removed: PluginUpdateChecker, PluginUpdate, PluginInfo. The original purpose of these aliases was to allow plugins that used the first version of PUC to easily upgrade to a newer version of the library without changing their code. However, as the update checker has evolved over time, that is no longer safe - e.g. version 3.0 might not be fully backwards-compatible with version 1.0.

If you were using the plain PluginUpdateChecker class, use this instead:

- `new PluginUpdateChecker_x_y(...)` - replace x_y with the library version number. This will create an instance of the specific version that's bundled with your plugin, which is best for compatibility with other plugins.
- `PucFactory::buildUpdateChecker()`. This will instantiate the newest loaded version, even if it was loaded by some other plugin and not yours. Simpler to use is some ways, but be prepared to support the latest version of the update checker.
2016-02-14 18:00:50 +02:00
Yahnis Elsts 7a5732bd21 Add an `if class_exists()` guard clause to the PucUpgraderStatus class. 2016-01-22 11:53:13 +02:00
Yahnis Elsts cc42d4847a Merge remote-tracking branch 'refs/remotes/origin/extract-scheduler' 2016-01-16 00:50:03 +02:00
Yahnis Elsts 512617903f Remove left-over hooks that were causing errors. 2016-01-15 18:28:51 +02:00
Yahnis Elsts f9373e7149 Merge remote-tracking branch 'refs/remotes/origin/extract-scheduler' 2016-01-14 20:17:11 +02:00
Yahnis Elsts 58a8a13efb Extract the "which plugin is being upgraded?" heuristics to a new class. 2016-01-14 19:32:58 +02:00
Yahnis Elsts 3006c8b736 Bump version to 3.0 because there are backwards-incompatible changes. 2016-01-14 17:26:44 +02:00
Yahnis Elsts 653161f3ae Merge remote-tracking branch 'refs/remotes/origin/master' into extract-scheduler 2016-01-14 17:07:44 +02:00
Yahnis Elsts 632ffd1e6b Minor: Fix spacing and rephrase a comment. 2016-01-14 16:58:25 +02:00
Yahnis Elsts cc6e2295ef Merge pull request #45 from icetee/master
Add i18n support
2016-01-14 16:36:49 +02:00
Yahnis Elsts 5b7498ba61 Replace another admin_url/network_admin_url pair with self_admin_url. 2016-01-13 19:42:22 +02:00
Yahnis Elsts 487df1d1d6 Minor: Bump copyright year to 2016 2016-01-13 18:45:56 +02:00
Yahnis Elsts 9931919237 Extract scheduling logic to a separate class. WIP. 2016-01-13 18:03:06 +02:00
Yahnis Elsts 55ad04d9b0 Extract the "identify a plugin given its file header" algorithm to a method. 2016-01-12 17:23:00 +02:00
Tamás András Horváth 87b0327f8c Merge remote-tracking branch 'refs/remotes/YahnisElsts/master' 2016-01-11 22:03:09 +01:00
Tamás András Horváth 30a6e01e44 Support i18n 2016-01-11 22:02:52 +01:00
Yahnis Elsts f2078a8d40 Extract readme parsing as a new method. 2016-01-11 19:55:06 +02:00
Yahnis Elsts 8595d5a921 Extract directory structure validation as a method. 2016-01-11 17:25:04 +02:00
Yahnis Elsts 2c9af31765 Add a "Resources" section.
Need a place for miscellaneous tools and tutorials.
2016-01-11 16:18:08 +02:00
Tamás András Horváth 8dcacbd823 Merge remote-tracking branch 'refs/remotes/YahnisElsts/master' 2016-01-10 19:36:03 +01:00
Tamás András Horváth 2b9dfe6fe5 Merge remote-tracking branch 'refs/remotes/YahnisElsts/master' 2016-01-10 19:30:20 +01:00
Yahnis Elsts dcc0f1ce38 Refactor the render() method into multiple methods - one for each section of debug output. 2016-01-10 18:58:44 +02:00
Yahnis Elsts 5f08d1135b Extract metadata validation as a method. 2016-01-10 16:53:09 +02:00
Yahnis Elsts 51be10504f Minor: Refactor injectUpdate(). 2016-01-09 22:17:24 +02:00
Yahnis Elsts 8ecc66c848 Refactor mu-plugin logic a bit by extracting a method. 2016-01-09 20:10:10 +02:00
Tamás András Horváth b37db731e6 Merge remote-tracking branch 'refs/remotes/YahnisElsts/master' 2016-01-09 18:05:02 +01:00
Tamás András Horváth 602fa7152f Revert "Support languages"
This reverts commit dd997db923.
2016-01-09 18:04:49 +01:00
Yahnis Elsts a26064220b Don't bother checking if WP_DEBUG is defined.
It's always defined. Checked as far back as WP 3.2. WordPress defines it in `/wp-includes/default-constants.php`.
2016-01-09 19:02:20 +02:00
Yahnis Elsts 080dc83ac5 Use self_admin_url() to simplify admin URL generation.
No need to check if is_network_admin() and switch between network_admin_url() and admin_url(). Turns out, WordPress already has a utility function that does that.
2016-01-09 18:41:56 +02:00
Yahnis Elsts d600e14f5d Minor: More IDE hints. 2016-01-09 18:27:59 +02:00