Commit Graph

587 Commits

Author SHA1 Message Date
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
Yahnis Elsts 81f6d15828 Remove duplicate condition.
The triggerError method already checks for debugMode, there's no need to do it before.
2016-01-09 18:20:34 +02:00
Yahnis Elsts d78400e919 Minor: Suppress some IDE inspections (false positives). 2016-01-09 18:09:03 +02:00
Yahnis Elsts 6999915d36 Fix a "creating default object from empty value" notice on failed parsing.
Silly oversight. Given invalid input, fromJSON() can fail and return NULL.
2016-01-09 18:07:51 +02:00
Yahnis Elsts 7a29fda377 Fix a rare issue with same-host restriction causing updates to fail.
WordPress has a security feature where the HTTP API will reject all requests that are sent to another site hosted on the same server as the current site (IP match) or a local host/IP, unless the host exactly matches the current site. This feature is opt-in, but apparently some people (or security plugins?) enable it.

This can be a problem when the update metadata is on the same server as your site, but not on the exact same hostname. The aforementioned security restriction will cause updates to fail for no apparent reason.

The patch fixes the issue by using the "http_request_host_is_external" filter to explicitly allow the host that the metadata URL points to.
2016-01-09 17:55:53 +02:00
Yahnis Elsts c6f4e4841c Refactor PluginInfo a bit. 2016-01-08 12:15:22 +02:00
Yahnis Elsts b76fb8b3bd Extract the "is that a successful API response?" login as a private method. 2016-01-07 19:50:41 +02:00
Yahnis Elsts 65263271b7 Minor: Tell my IDE the type of $upgrader->skin. 2016-01-07 18:51:52 +02:00
Yahnis Elsts e65a1bbb8c Give fixDirectoryName explicit visibility.
It's declared `public` because it's a hook callback, but you should never call it from your plugin.
2016-01-07 18:49:08 +02:00
Yahnis Elsts 774af73d58 Refactor multiple calls to trigger_error as a new method.
There was a pattern of duplicate code in the library: `if ($this->debugMode) { trigger_error(...) }`. I've replaced it with a triggerError() method.
2016-01-07 17:23:44 +02:00
Yahnis Elsts fa231f35f3 Remove the $triggerErrors parameter from the fromJson() method.
Now PluginInfo will always trigger a PHP notice if it receives invalid JSON or the input doesn't pass some (basic) validation. In practice, you should never encounter this notice if you've set up your metadata correctly.
2016-01-07 16:50:02 +02:00
Yahnis Elsts 40a65f239e Merge pull request #50 from hareesh-pillai/master
Add support for `is-dismissible` class
2016-01-01 15:02:11 +02:00
Hareesh 3dc371a8cc Add support for `is-dismissible` class
Adding the `is-dismissible` class introduced in [WordPress 4.2](https://make.wordpress.org/core/2015/04/23/spinners-and-dismissible-admin-notices-in-4-2/). The admin notice displayed after the update check can now be dismissed.

Solves [Issue #49](https://github.com/YahnisElsts/plugin-update-checker/issues/49)
2015-12-15 17:08:52 +05:30
Yahnis Elsts c3954feaa7 Expose the "is this plugin being updated right now?" logic as a public function.
Make it a public method: isPluginBeingUpgraded(). This method returns true if the plugin associated with the update checker is currently in the process of being updated. 

This can be useful for plugins that hook into WordPress core to change how WordPress installs updates. For example, if you were using the "upgrader_pre_download" filter, you could call this method to verify that the update being downloaded is for your plugin and not another one.

Caution: The method is not guaranteed to be accurate.
2015-11-12 13:07:15 +02:00
icetee dd997db923 Support languages
Translation beinning
2015-10-05 14:20:43 +02:00
Yahnis Elsts a9c5868910 Fix a bug in GitHub support where update installation sometimes didn't work when using a private repository. 2015-09-24 14:59:32 +03:00
Yahnis Elsts 4a415c1f33 Minor: adjust whitespace 2015-09-07 16:55:38 +03:00
Yahnis Elsts 05e97af9e1 Merge pull request #40 from dangoodman/master
Don't fail on missing debug-bar-plugin.php
2015-09-07 16:54:19 +03:00
dangoodman 84c01cc523 Don't fail on missing debug-bar-plugin.php 2015-09-07 15:08:42 +03:00