mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Plugins: Add support for Update URI header.
This allows third-party plugins to avoid accidentally being overwritten with an update of a plugin of a similar name from the WordPress.org Plugin Directory.
Additionally, introduce the `update_plugins_{$hostname}` filter, which third-party plugins can use to offer updates for a given hostname.
If set, the `Update URI` header field should be a URI and have a unique hostname.
Some examples include:
* `https://wordpress.org/plugins/example-plugin/`
* `https://example.com/my-plugin/`
* `my-custom-plugin-name`
`Update URI: false` also works, and unless there is code handling the `false` hostname, the plugin will never get an update notification.
If the header is present, the WordPress.org API will currently only return updates for the plugin if it matches the following format:
* `https://wordpress.org/plugins/{$slug}/`
* `w.org/plugin/{$slug}`
If the header has any other value, the API will not return a result and will ignore the plugin for update purposes.
Props dd32, DavidAnderson, meloniq, markjaquith, DrewAPicture, mweichert, design_dolphin, filosofo, sean212, nhuja, JeroenReumkens, infolu, dingdang, joyously, earnjam, williampatton, grapplerulrich, markparnell, apedog, afragen, miqrogroove, rmccue, crazycoders, jdgrimes, damonganto, joostdevalk, jorbin, georgestephanis, khromov, GeekStreetWP, jb510, Rarst, juliobox, Ipstenu, mikejolley, Otto42, gMagicScott, TJNowell, GaryJ, knutsp, mordauk, nvartolomei, aspexi, chriscct7, benoitchantre, ryno267, lev0, gregorlove, dougwollison, SergeyBiryukov.
See #14179, #23318, #32101.
git-svn-id: https://develop.svn.wordpress.org/trunk@50921 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 5.3.0 Added support for `Requires at least` and `Requires PHP` headers.
|
||||
* @since 5.8.0 Added support for `Update URI` header.
|
||||
*
|
||||
* @param string $plugin_file Absolute path to the main plugin file.
|
||||
* @param bool $markup Optional. If the returned data should have HTML markup applied.
|
||||
@@ -63,6 +64,7 @@
|
||||
* @type bool $Network Whether the plugin can only be activated network-wide.
|
||||
* @type string $RequiresWP Minimum required version of WordPress.
|
||||
* @type string $RequiresPHP Minimum required version of PHP.
|
||||
* @type string $UpdateURI ID of the plugin for update purposes, should be a URI.
|
||||
* }
|
||||
*/
|
||||
function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
|
||||
@@ -79,6 +81,7 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
|
||||
'Network' => 'Network',
|
||||
'RequiresWP' => 'Requires at least',
|
||||
'RequiresPHP' => 'Requires PHP',
|
||||
'UpdateURI' => 'Update URI',
|
||||
// Site Wide Only is deprecated in favor of Network.
|
||||
'_sitewide' => 'Site Wide Only',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user