Commit Graph

342 Commits

Author SHA1 Message Date
Yahnis Elsts 1cb79bcdce Minor: Refactor the plugin UI callback permission checks.
Let's only add our UI hooks if the user has the required permissions. This way we can avoid duplicating the permission checks in each individual callback.
2018-07-17 13:58:17 +03:00
Yahnis Elsts 4f6afa95cd Extract file parsing and lookup as a separate "Package" class. 2018-07-17 13:03:03 +03:00
Yahnis Elsts 98ac49406c Fix: Remove UI hooks when uninstalling the plugin.
It looks like I forgot to move that code when extracting the UI class.
2018-07-14 12:38:32 +03:00
Yahnis Elsts 68f4865b31 Extract plugin-specific UI as a separate class.
This includes the "View details" and "Check for updates" links that appear on the "Plugins -> Installed Plugins" page.
2018-07-14 12:15:50 +03:00
Yahnis Elsts 01863da0e8 Minor: Adjust code spacing. 2018-06-27 15:28:34 +03:00
Yahnis Elsts 4f79183092
Merge pull request #205 from dangoodman/master
Fix WordPress reporting unknown compatibility of a plugin/theme update
2018-06-27 15:11:16 +03:00
dangoodman c47c690c47 Fix code style 2018-06-27 11:24:40 +03:00
dangoodman d7dcd8851c Change fixSupportedWordpressVersion() from private to protected 2018-06-27 11:22:42 +03:00
dangoodman 05bddba61b Try to fetch an actual WP patch number 2018-06-26 13:57:44 +03:00
Yahnis Elsts e222ec10fa
Merge pull request #207 from dangoodman/pr-debugbar-typo
Fix typo in DebugBar extension availability check
2018-06-19 13:16:17 +03:00
dangoodman 15bb029ab7 Fix typo in DebugBar extension availability check 2018-06-18 21:49:05 +03:00
dangoodman 4e8f5a568e Fix WordPress reporting unknown compatibility of a plugin/theme update 2018-06-12 19:24:31 +03:00
Yahnis Elsts f26378d0c2 Minor: Added a note about using GitHub release assets 2018-05-03 17:08:22 +03:00
Yahnis Elsts a4a61b6415
Merge pull request #193 from futtta/master
Added Dutch translations.
2018-03-25 19:59:10 +03:00
futtta bf2750e548 Dutch (NL & BE, identical) translations 2018-03-25 18:33:51 +02:00
Yahnis Elsts ee8bfa1cad Minor: Emphasize the fact that the path that's passed to buildUpdateChecker must be the full path to the main plugin file (or functions.php). There have been too many issues opened lately by people who incorrectly assume that any old file path will do.
Note: Technically, for themes any file that's at the root of the theme directory will work. It doesn't have to be functions.php specifically.
2018-03-12 10:46:07 +02:00
Yahnis Elsts 889586dff7
Merge pull request #184 from Spidlace/master
Allow custom GitLab repository URLs to include a port number
2018-03-02 16:39:29 +02:00
Tony b2e15785ac minor code style issue : concatenating strings 2018-03-02 15:30:30 +01:00
Tony 3a56b83756 Add port host support for GitlabAPI 2018-03-01 13:02:22 +01:00
Yahnis Elsts 5e48f0c853 Fixed slug conflict detection.
Also fixed a related bug where calling the triggerError() method inside the update checker constructor would not trigger an error even if WP_DEBUG was enabled. The `debugMode` property didn't get initialized until the base class constructor was run. To fix that, I've added a new isDebugModeEnabled() method that performs lazy initialisation. The downside is that it duplicates one line of code from the constructor.

Closes #180
2018-02-22 18:51:25 +02:00
Yahnis Elsts b75f5555c2
Merge pull request #179 from devanonyme/master
Correction of bad mo file.
2018-02-12 19:40:52 +02:00
devanonyme 50ac73643b
Correction of bad mo file. 2018-02-12 12:21:12 -05:00
Yahnis Elsts 90a138f22d
Merge pull request #176 from devanonyme/master
Add a Canadian French translation.
2018-02-12 18:41:05 +02:00
devanonyme 9412db45ef
Add fr_CA translation files. 2018-02-12 10:48:25 -05:00
Yahnis Elsts f34eab1f5a Minor: Replace outdated class name in the readme 2018-01-18 12:15:30 +02:00
Yahnis Elsts f7f63d203d Fix PHP notice "Undefined offset: 1 in readme-parser.php on line 161".
Let's discard incorrectly formatted "upgrade notice" sections instead of triggering PHP notices.
2018-01-08 12:49:22 +02:00
Yahnis Elsts da42863436 Bump version number to 4.4. 2017-12-22 12:39:11 +02:00
Yahnis Elsts 88eee6e4a9 Add an .editorconfig
(The file was generated by exporting PhpStorm code style settings.)
2017-12-14 18:41:42 +02:00
Yahnis Elsts 60add5f915 Add support for GitHub release assets. See #93
Usage: Set up the update checker instance as usual, then call the new enableReleaseAssets() method of the GitHub API class. 

`$gitHubUpdateChecker->getVcsApi()->enableReleaseAssets();`

Notes:
- You can make PUC look for a specific asset by passing a regular expression to enableReleaseAssets(). For example, `$api->enableReleaseAssets('/custom-asset/')` will make PUC use the first asset where the file name contains the string "custom-asset".
- PUC always chooses the first matching asset.
- If the latest release has no assets or none of them match the regex, PUC will fall back to the old behaviour of using the automatically generated ZIP file.
- Private repositories only work with WP 3.7 or later. Older WordPress versions will throw an error when trying to download the update.
2017-11-27 17:32:49 +02:00
Yahnis Elsts af5207d349 Minor: Include the v4 factory. 2017-11-26 21:55:24 +02:00
Yahnis Elsts bf21da2ff2 Re-add Puc_v4_Factory for better backwards compatibility.
This way developers that used an older 4.x version shouldn't need to change their code when they update to this version.
2017-11-26 21:40:17 +02:00
Yahnis Elsts ec5ee45379 Show API errors when manually checking for updates.
Introduces a new hook: "puc_api_error". This is an action with up to 4 callback arguments:

1) $error - A WP_Error instance that provides a brief description of the error.
2) $response - The value returned by wp_remote_get(). Can be omitted if the original response is not available at this point.
3) $url - The URL that the update checker requested. Can be omitted.
4) $slug - The plugin or theme slug. Can be omitted. 


See #151
2017-11-24 17:36:15 +02:00
Yahnis Elsts 585f60d91c Add the ability to show a plugin icon on the "Dashboard -> Updates" page.
Usage: Add the following entry to your JSON file:

"icons" : {
	"1x" : "http://example.com/assets/icon-128x128.png",
	"2x" : "http://example.com/assets/icon-256x256.png",
	"svg": "http://example.com/assets/icon.svg"
} 

All of the keys are optional. They should point to different versions of the same icon:
- "1x": a 128x128 px image.
- "2x": a 256x256 px image for HiDPI screens.
- "svg": a vector version of the icon.

See WordPress.org for more information on supported icon sizes and image formats:  
https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/#plugin-icons

Suggested in #153
2017-11-21 22:11:18 +02:00
Yahnis Elsts 150d3d8165 Rename Puc_v4_Factory to Puc_v4p3_Factory
This should fix the fatal error that happens when running PUC 4.3 together with an older 4.x release while Debug Bar is active.

See #152
2017-11-16 17:00:22 +02:00
Yahnis Elsts 22fd23a32b Fix: Remove left-over debugging code. 2017-11-03 19:20:11 +02:00
Yahnis Elsts 548b9fbec7 Minor: Fix incorrect link text in the readme 2017-11-03 13:45:11 +02:00
Yahnis Elsts 8be2d1d966 Minor: Fix another spelling error and reformat comments for consistency 2017-11-03 13:44:29 +02:00
Yahnis Elsts 1a7d95a017 Minor: Fix a spelling error in method name 2017-11-03 13:23:53 +02:00
Yahnis Elsts 92763829c6 Bump version number to 4.3 2017-11-03 13:22:55 +02:00
Yahnis Elsts 3a1f929a7f VCS integration: Support alternative readme.txt capitalisations
Apparently, some developers call the file "README.txt" instead of "readme.txt". Most version control systems are case-sensitive, so we need to known the exact capitalisation to successfully retrieve the readme from the repository. Let's search the plugin directory to find the local readme file and then use that name. 

Closes #147
2017-11-02 13:49:17 +02:00
Yahnis Elsts 9d9bab0462 Minor: Reformat and refactor addViewDetailsLink()
- WordPress escapes the site URL when building the "Visit plugin site" link, so we need to look for the escaped URL instead of the raw string.
- Using regexps is probably overkill. A simple string search will do.
- Add a default case to the switch in case a plugin returns an invalid link position.
- Move the "view_details_link_position" filter inside the foreach loop to eliminate an if().
- Move the slug check closer to the top. There's no point in running the "view_details_link" filter if the link isn't going to be shown anyway.
2017-11-02 10:13:21 +02:00
Yahnis Elsts fa412cad65
Merge pull request #146 from Mikk3lRo/always-show-details-link
Always show the "View details" link
2017-11-02 09:47:59 +02:00
Mikk3lRo eaa06eae6c My IDE still refuses to use tabs for indentation - sorry :p 2017-11-01 16:53:50 +01:00
Mikk3lRo 5703f6e338 Make "Visit Plugin Site"-link detection more robust and correct comment to reflect new default position. 2017-11-01 16:51:33 +01:00
Mikk3lRo 727b99573c Rename first -> before and last -> after and set default to before for placement of View details link. 2017-11-01 16:39:00 +01:00
Mikk3lRo 844c1fdb53 Update docblock 2017-10-31 03:07:23 +01:00
Mikk3lRo 1ebe29e1a4 Add spaces inside some paranthesis. 2017-10-31 03:04:04 +01:00
Mikk3lRo 5a4e5a44a2 Remove filter to add View Details Link. Extend / modify order of links. 2017-10-31 02:35:00 +01:00
Mikk3lRo eb12e77706 Added third argument to addViewDetailsLink. 2017-10-30 19:18:52 +01:00
Mikk3lRo 5e987d8982 Use the same method of checking for empty linkText as used in the pre-
existing addCheckForUpdatesLink
2017-10-23 23:59:09 +02:00