Version Description
- December 14, 2018
- version update WP Dependency Installer
- add parameter
"optional": false
as a workaround to fix issue #4
Download this release
Release Info
Developer | senlin |
Plugin | Classic Editor Addon |
Version | 2.3.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.0 to 2.3.0
- classic-editor-addon.php +2 -2
- readme.txt +8 -2
- vendor/afragen/wp-dependency-installer/README.md +26 -6
- vendor/afragen/wp-dependency-installer/composer.json +5 -4
- vendor/afragen/wp-dependency-installer/example-plugin/test-dependency-installer.php +9 -0
- vendor/afragen/wp-dependency-installer/wp-dependencies-example.json +9 -3
- vendor/afragen/wp-dependency-installer/wp-dependency-installer.php +100 -23
- vendor/composer/autoload_classmap.php +2 -0
- vendor/composer/autoload_files.php +0 -1
- vendor/composer/autoload_static.php +6 -1
- vendor/composer/installed.json +8 -9
- wp-dependencies.json +2 -1
classic-editor-addon.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Classic Editor Addon
|
4 |
-
* Description: This free "Classic Editor Addon" plugin makes sure that the new block editor cannot be accidentally activated
|
5 |
|
6 |
* Author: <a href="https://so-wp.com">Pieter Bos</a>, <a href="https://gschoppe.com">Greg Schoppe</a>
|
7 |
-
* Version: 2.
|
8 |
|
9 |
* Requires at least: 4.9
|
10 |
* Tested up to: 5.0
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Classic Editor Addon
|
4 |
+
* Description: This free "Classic Editor Addon" plugin makes sure that the new block editor cannot be accidentally activated. See README for details.
|
5 |
|
6 |
* Author: <a href="https://so-wp.com">Pieter Bos</a>, <a href="https://gschoppe.com">Greg Schoppe</a>
|
7 |
+
* Version: 2.3.0
|
8 |
|
9 |
* Requires at least: 4.9
|
10 |
* Tested up to: 5.0
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: gutenberg, block editor, classic editor, addon, wordpress 5.0
|
|
4 |
Requires at least: 4.9
|
5 |
Requires PHP: 5.3
|
6 |
Tested up to: 5.0
|
7 |
-
Stable tag: 2.
|
8 |
License: GPL-3.0+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
10 |
|
@@ -22,7 +22,7 @@ Since version 0.0.4 of the "Classic Editor" plugin, it finally set the default s
|
|
22 |
|
23 |
Also, if we look at developers protecting the sites of their clients with the Classic Editor, they certainly don't want their clients to accidentally turn off the Classic Editor as the new block editor adds a lot of undesirable comments, tags and what not to the content.
|
24 |
|
25 |
-
Therefore we highly recommend installing this "Classic Editor Addon" plugin, which will automatically
|
26 |
|
27 |
We support this plugin exclusively through [Github](https://github.com/senlin/classic-editor-addon/issues). Therefore, if you have any questions, need help and/or want to make a feature request, please open an issue here. You can also browse through open and closed issues to find what you are looking for and perhaps even help others.
|
28 |
|
@@ -56,6 +56,12 @@ Please open an issue on [Github](https://github.com/senlin/classic-editor-addon/
|
|
56 |
|
57 |
== Changelog ==
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
= 2.2.0 =
|
60 |
|
61 |
* December 12, 2018
|
4 |
Requires at least: 4.9
|
5 |
Requires PHP: 5.3
|
6 |
Tested up to: 5.0
|
7 |
+
Stable tag: 2.3.0
|
8 |
License: GPL-3.0+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
10 |
|
22 |
|
23 |
Also, if we look at developers protecting the sites of their clients with the Classic Editor, they certainly don't want their clients to accidentally turn off the Classic Editor as the new block editor adds a lot of undesirable comments, tags and what not to the content.
|
24 |
|
25 |
+
Therefore we highly recommend installing this "Classic Editor Addon" plugin, which will automatically install the “Classic Editor” plugin and remove its settings.
|
26 |
|
27 |
We support this plugin exclusively through [Github](https://github.com/senlin/classic-editor-addon/issues). Therefore, if you have any questions, need help and/or want to make a feature request, please open an issue here. You can also browse through open and closed issues to find what you are looking for and perhaps even help others.
|
28 |
|
56 |
|
57 |
== Changelog ==
|
58 |
|
59 |
+
= 2.3.0 =
|
60 |
+
|
61 |
+
* December 14, 2018
|
62 |
+
* version update WP Dependency Installer
|
63 |
+
* add parameter `"optional": false` as a workaround to fix [issue #4](https://github.com/senlin/classic-editor-addon/issues/4)
|
64 |
+
|
65 |
= 2.2.0 =
|
66 |
|
67 |
* December 12, 2018
|
vendor/afragen/wp-dependency-installer/README.md
CHANGED
@@ -3,16 +3,16 @@
|
|
3 |
* Tags: plugin, dependency, install
|
4 |
* Requires at least: 3.8
|
5 |
* Requires PHP: 5.3
|
6 |
-
* Tested up to:
|
7 |
* Stable tag: master
|
8 |
-
* Donate link: http://thefragens.com/wp-dependency-installer-donate
|
9 |
* License: MIT
|
10 |
|
11 |
A lightweight class to add to WordPress plugins or themes to automatically install required plugin dependencies. Uses a JSON config file to declare plugin dependencies.
|
12 |
|
13 |
## Description
|
14 |
|
15 |
-
This is a drop in class for developers to optionally or automatically install plugin dependencies for their own plugins or themes. It can install a plugin from w.org, GitHub, Bitbucket, or
|
16 |
|
17 |
This contains an example plugin and an example JSON configuration file. Only required dependencies are installed automatically, optional dependencies are not. Required dependencies are always kept active.
|
18 |
|
@@ -46,7 +46,6 @@ This file must be named `wp-dependencies.json` and it must be in the root direct
|
|
46 |
"host": "wordpress",
|
47 |
"slug": "query-monitor/query-monitor.php",
|
48 |
"uri": "https://wordpress.org/plugins/query-monitor/",
|
49 |
-
"branch": "trunk",
|
50 |
"optional": false
|
51 |
},
|
52 |
{
|
@@ -60,6 +59,7 @@ This file must be named `wp-dependencies.json` and it must be in the root direct
|
|
60 |
},
|
61 |
{
|
62 |
"name": "Test Plugin Notags",
|
|
|
63 |
"slug": "test-plugin-notags/test-plugin-notags.php",
|
64 |
"uri": "https://bitbucket.org/afragen/test-plugin-notags",
|
65 |
"branch": "master",
|
@@ -74,18 +74,38 @@ This file must be named `wp-dependencies.json` and it must be in the root direct
|
|
74 |
"branch": "develop",
|
75 |
"optional": true,
|
76 |
"token": null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
]
|
79 |
```
|
80 |
|
81 |
-
An example file is included, `wp-dependencies-example.json`. You may use a shorthand uri such as `<owner>/<repo>`
|
|
|
|
|
82 |
|
83 |
-
If you want to programmatically add dependencies you can send an associative array directly to
|
84 |
```php
|
85 |
WP_Dependency_Installer::instance()->register( $config )
|
86 |
```
|
|
|
87 |
where `$config` is an associative array as in identical format as `json_decode( wp-dependencies.json content )`
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
## Development
|
90 |
|
91 |
PRs are welcome against the `develop` branch.
|
3 |
* Tags: plugin, dependency, install
|
4 |
* Requires at least: 3.8
|
5 |
* Requires PHP: 5.3
|
6 |
+
* Tested up to: 5.0
|
7 |
* Stable tag: master
|
8 |
+
* Donate link: <http://thefragens.com/wp-dependency-installer-donate>
|
9 |
* License: MIT
|
10 |
|
11 |
A lightweight class to add to WordPress plugins or themes to automatically install required plugin dependencies. Uses a JSON config file to declare plugin dependencies.
|
12 |
|
13 |
## Description
|
14 |
|
15 |
+
This is a drop in class for developers to optionally or automatically install plugin dependencies for their own plugins or themes. It can install a plugin from w.org, GitHub, Bitbucket, GitLab, Gitea, or a direct URL. You must include a JSON config file in the root directory of the plugin/theme file.
|
16 |
|
17 |
This contains an example plugin and an example JSON configuration file. Only required dependencies are installed automatically, optional dependencies are not. Required dependencies are always kept active.
|
18 |
|
46 |
"host": "wordpress",
|
47 |
"slug": "query-monitor/query-monitor.php",
|
48 |
"uri": "https://wordpress.org/plugins/query-monitor/",
|
|
|
49 |
"optional": false
|
50 |
},
|
51 |
{
|
59 |
},
|
60 |
{
|
61 |
"name": "Test Plugin Notags",
|
62 |
+
"host": "bitbucket",
|
63 |
"slug": "test-plugin-notags/test-plugin-notags.php",
|
64 |
"uri": "https://bitbucket.org/afragen/test-plugin-notags",
|
65 |
"branch": "master",
|
74 |
"branch": "develop",
|
75 |
"optional": true,
|
76 |
"token": null
|
77 |
+
},
|
78 |
+
{
|
79 |
+
"name": "Test Direct Plugin Download",
|
80 |
+
"host": "direct",
|
81 |
+
"slug": "test-direct-plugin/test-plugin.php",
|
82 |
+
"uri": "https://direct-download.com/path/to.zip",
|
83 |
+
"optional": true
|
84 |
}
|
85 |
]
|
86 |
```
|
87 |
|
88 |
+
An example file is included, `wp-dependencies-example.json`. You may use a shorthand uri such as `<owner>/<repo>` in the JSON.
|
89 |
+
|
90 |
+
If you want to programmatically add dependencies you can send an associative array directly to
|
91 |
|
|
|
92 |
```php
|
93 |
WP_Dependency_Installer::instance()->register( $config )
|
94 |
```
|
95 |
+
|
96 |
where `$config` is an associative array as in identical format as `json_decode( wp-dependencies.json content )`
|
97 |
|
98 |
+
The default timeout for dismissal of a notification is 7 days. There is a filter `wp_dependency_timeout` to adjust this on a per project basis.
|
99 |
+
|
100 |
+
```php
|
101 |
+
add_filter(
|
102 |
+
'wp_dependency_timeout', function( $timeout, $source ) {
|
103 |
+
$timeout = $source !== basename( __DIR__ ) ? $timeout : 14;
|
104 |
+
return $timeout;
|
105 |
+
}, 10, 2
|
106 |
+
);
|
107 |
+
```
|
108 |
+
|
109 |
## Development
|
110 |
|
111 |
PRs are welcome against the `develop` branch.
|
vendor/afragen/wp-dependency-installer/composer.json
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
{
|
2 |
"name": "afragen/wp-dependency-installer",
|
3 |
"description": "Library that helps WordPress plugin dependency management.",
|
|
|
4 |
"license": "MIT",
|
5 |
"authors": [
|
6 |
{
|
@@ -16,15 +17,15 @@
|
|
16 |
],
|
17 |
"prefer-stable": true,
|
18 |
"require": {
|
19 |
-
"composer/installers": "^1.0",
|
20 |
"php": ">=5.3",
|
21 |
-
"collizo4sky/persist-admin-notices-dismissal": "
|
22 |
},
|
23 |
"support": {
|
24 |
-
"issues": "https://github.com/afragen/wp-dependency-installer/issues"
|
|
|
25 |
},
|
26 |
"autoload": {
|
27 |
-
"
|
28 |
"wp-dependency-installer.php"
|
29 |
]
|
30 |
}
|
1 |
{
|
2 |
"name": "afragen/wp-dependency-installer",
|
3 |
"description": "Library that helps WordPress plugin dependency management.",
|
4 |
+
"version": "1.4.8",
|
5 |
"license": "MIT",
|
6 |
"authors": [
|
7 |
{
|
17 |
],
|
18 |
"prefer-stable": true,
|
19 |
"require": {
|
|
|
20 |
"php": ">=5.3",
|
21 |
+
"collizo4sky/persist-admin-notices-dismissal": "^1"
|
22 |
},
|
23 |
"support": {
|
24 |
+
"issues": "https://github.com/afragen/wp-dependency-installer/issues",
|
25 |
+
"source": "https://github.com/afragen/wp-dependency-installer"
|
26 |
},
|
27 |
"autoload": {
|
28 |
+
"classmap": [
|
29 |
"wp-dependency-installer.php"
|
30 |
]
|
31 |
}
|
vendor/afragen/wp-dependency-installer/example-plugin/test-dependency-installer.php
CHANGED
@@ -14,3 +14,12 @@
|
|
14 |
require_once __DIR__ . '/vendor/autoload.php';
|
15 |
|
16 |
WP_Dependency_Installer::instance()->run( __DIR__ );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
require_once __DIR__ . '/vendor/autoload.php';
|
15 |
|
16 |
WP_Dependency_Installer::instance()->run( __DIR__ );
|
17 |
+
add_filter(
|
18 |
+
'wp_dependency_timeout',
|
19 |
+
function( $timeout, $source ) {
|
20 |
+
$timeout = $source !== basename( __DIR__ ) ? $timeout : 14;
|
21 |
+
return $timeout;
|
22 |
+
},
|
23 |
+
10,
|
24 |
+
2
|
25 |
+
);
|
vendor/afragen/wp-dependency-installer/wp-dependencies-example.json
CHANGED
@@ -4,7 +4,6 @@
|
|
4 |
"host": "wordpress",
|
5 |
"slug": "query-monitor/query-monitor.php",
|
6 |
"uri": "https://wordpress.org/plugins/query-monitor/",
|
7 |
-
"branch": "trunk",
|
8 |
"optional": false
|
9 |
},
|
10 |
{
|
@@ -18,11 +17,11 @@
|
|
18 |
},
|
19 |
{
|
20 |
"name": "Test Plugin Notags",
|
|
|
21 |
"slug": "test-plugin-notags/test-plugin-notags.php",
|
22 |
"uri": "https://bitbucket.org/afragen/test-plugin-notags",
|
23 |
"branch": "master",
|
24 |
-
"optional": true
|
25 |
-
"token": null
|
26 |
},
|
27 |
{
|
28 |
"name": "Test Gitlab Plugin2",
|
@@ -32,5 +31,12 @@
|
|
32 |
"branch": "develop",
|
33 |
"optional": true,
|
34 |
"token": null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
]
|
4 |
"host": "wordpress",
|
5 |
"slug": "query-monitor/query-monitor.php",
|
6 |
"uri": "https://wordpress.org/plugins/query-monitor/",
|
|
|
7 |
"optional": false
|
8 |
},
|
9 |
{
|
17 |
},
|
18 |
{
|
19 |
"name": "Test Plugin Notags",
|
20 |
+
"host": "bitbucket",
|
21 |
"slug": "test-plugin-notags/test-plugin-notags.php",
|
22 |
"uri": "https://bitbucket.org/afragen/test-plugin-notags",
|
23 |
"branch": "master",
|
24 |
+
"optional": true
|
|
|
25 |
},
|
26 |
{
|
27 |
"name": "Test Gitlab Plugin2",
|
31 |
"branch": "develop",
|
32 |
"optional": true,
|
33 |
"token": null
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"name": "Test Direct Plugin Download",
|
37 |
+
"host": "direct",
|
38 |
+
"slug": "test-direct-plugin/test-plugin.php",
|
39 |
+
"uri": "https://direct-download.com/path/to.zip",
|
40 |
+
"optional": true
|
41 |
}
|
42 |
]
|
vendor/afragen/wp-dependency-installer/wp-dependency-installer.php
CHANGED
@@ -5,14 +5,14 @@
|
|
5 |
*
|
6 |
* A lightweight class to add to WordPress plugins or themes to automatically install
|
7 |
* required plugin dependencies. Uses a JSON config file to declare plugin dependencies.
|
8 |
-
* It can install a plugin from w.org, GitHub, Bitbucket, or
|
9 |
*
|
10 |
* @package WP_Dependency_Installer
|
11 |
* @author Andy Fragen
|
12 |
* @author Matt Gibbs
|
13 |
* @license MIT
|
14 |
* @link https://github.com/afragen/wp-dependency-installer
|
15 |
-
* @version 1.
|
16 |
*/
|
17 |
|
18 |
/**
|
@@ -50,6 +50,13 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
50 |
*/
|
51 |
protected $current_slug;
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
/**
|
54 |
* Holds names of installed dependencies for admin notices.
|
55 |
*
|
@@ -94,6 +101,7 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
94 |
) {
|
95 |
return;
|
96 |
}
|
|
|
97 |
$this->load_hooks();
|
98 |
$this->register( $config );
|
99 |
}
|
@@ -106,7 +114,8 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
106 |
*/
|
107 |
public function register( $config ) {
|
108 |
foreach ( $config as $dependency ) {
|
109 |
-
$
|
|
|
110 |
if ( ! isset( $this->config[ $slug ] ) || ! $dependency['optional'] ) {
|
111 |
$this->config[ $slug ] = $dependency;
|
112 |
}
|
@@ -119,32 +128,48 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
119 |
public function apply_config() {
|
120 |
foreach ( $this->config as $dependency ) {
|
121 |
$download_link = null;
|
|
|
122 |
$uri = $dependency['uri'];
|
123 |
$slug = $dependency['slug'];
|
124 |
-
$
|
125 |
-
$
|
|
|
|
|
126 |
$path = parse_url( $uri, PHP_URL_PATH );
|
127 |
$owner_repo = str_replace( '.git', '', trim( $path, '/' ) );
|
128 |
|
129 |
switch ( $host ) {
|
130 |
-
case
|
131 |
-
$
|
|
|
132 |
if ( ! empty( $dependency['token'] ) ) {
|
133 |
$download_link = add_query_arg( 'access_token', $dependency['token'], $download_link );
|
134 |
}
|
135 |
break;
|
136 |
-
case
|
137 |
-
$
|
|
|
|
|
138 |
break;
|
139 |
-
case
|
140 |
-
$
|
|
|
|
|
141 |
$download_link = add_query_arg( 'ref', $dependency['branch'], $download_link );
|
142 |
if ( ! empty( $dependency['token'] ) ) {
|
143 |
$download_link = add_query_arg( 'private_token', $dependency['token'], $download_link );
|
144 |
}
|
145 |
break;
|
146 |
-
case
|
147 |
-
$download_link =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
break;
|
149 |
}
|
150 |
|
@@ -152,6 +177,35 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
152 |
}
|
153 |
}
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
/**
|
156 |
* Determine if dependency is active or installed.
|
157 |
*/
|
@@ -181,7 +235,9 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
181 |
$this->notices[] = array(
|
182 |
'action' => 'activate',
|
183 |
'slug' => $slug,
|
184 |
-
|
|
|
|
|
185 |
);
|
186 |
|
187 |
} else {
|
@@ -191,7 +247,9 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
191 |
$this->notices[] = array(
|
192 |
'action' => 'install',
|
193 |
'slug' => $slug,
|
194 |
-
|
|
|
|
|
195 |
);
|
196 |
} else {
|
197 |
$this->notices[] = $this->install( $slug );
|
@@ -299,7 +357,9 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
299 |
return array(
|
300 |
'status' => 'updated',
|
301 |
'slug' => $slug,
|
302 |
-
|
|
|
|
|
303 |
);
|
304 |
|
305 |
}
|
@@ -309,7 +369,9 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
309 |
|
310 |
return array(
|
311 |
'status' => 'updated',
|
312 |
-
|
|
|
|
|
313 |
);
|
314 |
}
|
315 |
|
@@ -334,7 +396,9 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
334 |
|
335 |
return array(
|
336 |
'status' => 'updated',
|
337 |
-
|
|
|
|
|
338 |
);
|
339 |
}
|
340 |
|
@@ -377,7 +441,7 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
377 |
}
|
378 |
$message = null;
|
379 |
foreach ( $this->notices as $notice ) {
|
380 |
-
$status = empty( $notice['status'] ) ? '
|
381 |
|
382 |
if ( ! empty( $notice['action'] ) ) {
|
383 |
$action = esc_attr( $notice['action'] );
|
@@ -387,15 +451,26 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
387 |
if ( ! empty( $notice['status'] ) ) {
|
388 |
$message = esc_html( $notice['message'] );
|
389 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
$dismissible = isset( $notice['slug'] )
|
391 |
-
? 'dependency-installer-' . dirname( $notice['slug'] ) .
|
392 |
: null;
|
393 |
if ( class_exists( '\PAnd' ) && ! \PAnD::is_admin_notice_active( $dismissible ) ) {
|
394 |
continue;
|
395 |
}
|
396 |
?>
|
397 |
<div data-dismissible="<?php echo $dismissible; ?>" class="<?php echo $status; ?> notice is-dismissible dependency-installer">
|
398 |
-
<p><?php echo '<strong>[' .
|
399 |
</div>
|
400 |
<?php
|
401 |
}
|
@@ -436,9 +511,11 @@ if ( ! class_exists( 'WP_Dependency_Installer' ) ) {
|
|
436 |
unset( $actions['deactivate'] );
|
437 |
}
|
438 |
|
439 |
-
|
440 |
-
|
441 |
|
|
|
|
|
442 |
}
|
443 |
|
444 |
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
5 |
*
|
6 |
* A lightweight class to add to WordPress plugins or themes to automatically install
|
7 |
* required plugin dependencies. Uses a JSON config file to declare plugin dependencies.
|
8 |
+
* It can install a plugin from w.org, GitHub, Bitbucket, GitLab, Gitea or direct URL.
|
9 |
*
|
10 |
* @package WP_Dependency_Installer
|
11 |
* @author Andy Fragen
|
12 |
* @author Matt Gibbs
|
13 |
* @license MIT
|
14 |
* @link https://github.com/afragen/wp-dependency-installer
|
15 |
+
* @version 1.4.6
|
16 |
*/
|
17 |
|
18 |
/**
|
50 |
*/
|
51 |
protected $current_slug;
|
52 |
|
53 |
+
/**
|
54 |
+
* Holds the calling plugin/theme slug.
|
55 |
+
*
|
56 |
+
* @var string $source
|
57 |
+
*/
|
58 |
+
protected $source;
|
59 |
+
|
60 |
/**
|
61 |
* Holds names of installed dependencies for admin notices.
|
62 |
*
|
101 |
) {
|
102 |
return;
|
103 |
}
|
104 |
+
$this->source = basename( $plugin_path );
|
105 |
$this->load_hooks();
|
106 |
$this->register( $config );
|
107 |
}
|
114 |
*/
|
115 |
public function register( $config ) {
|
116 |
foreach ( $config as $dependency ) {
|
117 |
+
$dependency['source'] = $this->source;
|
118 |
+
$slug = $dependency['slug'];
|
119 |
if ( ! isset( $this->config[ $slug ] ) || ! $dependency['optional'] ) {
|
120 |
$this->config[ $slug ] = $dependency;
|
121 |
}
|
128 |
public function apply_config() {
|
129 |
foreach ( $this->config as $dependency ) {
|
130 |
$download_link = null;
|
131 |
+
$base = null;
|
132 |
$uri = $dependency['uri'];
|
133 |
$slug = $dependency['slug'];
|
134 |
+
$api = parse_url( $uri, PHP_URL_HOST );
|
135 |
+
$scheme = parse_url( $uri, PHP_URL_SCHEME );
|
136 |
+
$scheme = ! empty( $scheme ) ? $scheme . '://' : 'https://';
|
137 |
+
$host = $dependency['host'];
|
138 |
$path = parse_url( $uri, PHP_URL_PATH );
|
139 |
$owner_repo = str_replace( '.git', '', trim( $path, '/' ) );
|
140 |
|
141 |
switch ( $host ) {
|
142 |
+
case 'github':
|
143 |
+
$base = null === $api || 'github.com' === $api ? 'api.github.com' : $api;
|
144 |
+
$download_link = "{$scheme}{$base}/repos/{$owner_repo}/zipball/{$dependency['branch']}";
|
145 |
if ( ! empty( $dependency['token'] ) ) {
|
146 |
$download_link = add_query_arg( 'access_token', $dependency['token'], $download_link );
|
147 |
}
|
148 |
break;
|
149 |
+
case 'bitbucket':
|
150 |
+
$hosted = 'bitbucket.org';
|
151 |
+
$base = null === $api || $hosted === $api ? $hosted : $api;
|
152 |
+
$download_link = "{$scheme}{$base}/{$owner_repo}/get/{$dependency['branch']}.zip";
|
153 |
break;
|
154 |
+
case 'gitlab':
|
155 |
+
$hosted = 'gitlab.com';
|
156 |
+
$base = null === $api || $hosted === $api ? $hosted : $api;
|
157 |
+
$download_link = "{$scheme}{$base}/{$owner_repo}/repository/archive.zip";
|
158 |
$download_link = add_query_arg( 'ref', $dependency['branch'], $download_link );
|
159 |
if ( ! empty( $dependency['token'] ) ) {
|
160 |
$download_link = add_query_arg( 'private_token', $dependency['token'], $download_link );
|
161 |
}
|
162 |
break;
|
163 |
+
case 'gitea':
|
164 |
+
$download_link = "{$scheme}{$api}/repos/{$owner_repo}/archive/{$dependency['branch']}.zip";
|
165 |
+
if ( ! empty( $dependency['token'] ) ) {
|
166 |
+
$download_link = add_query_arg( 'access_token', $dependency['token'], $download_link );
|
167 |
+
}
|
168 |
+
case 'wordpress':
|
169 |
+
$download_link = $this->get_dot_org_latest_download( basename( $owner_repo ) );
|
170 |
+
break;
|
171 |
+
case 'direct':
|
172 |
+
$download_link = filter_var( $uri, FILTER_VALIDATE_URL );
|
173 |
break;
|
174 |
}
|
175 |
|
177 |
}
|
178 |
}
|
179 |
|
180 |
+
/**
|
181 |
+
* Get lastest download link from WordPress API.
|
182 |
+
*
|
183 |
+
* @param string $slug Plugin slug.
|
184 |
+
* @return string $download_link
|
185 |
+
*/
|
186 |
+
private function get_dot_org_latest_download( $slug ) {
|
187 |
+
$download_link = get_site_transient( 'wpdi-' . md5( $slug ) );
|
188 |
+
if ( ! $download_link ) {
|
189 |
+
$url = 'https://api.wordpress.org/plugins/info/1.1/';
|
190 |
+
$url = add_query_arg(
|
191 |
+
[
|
192 |
+
'action' => 'plugin_information',
|
193 |
+
urlencode( 'request[slug]' ) => $slug,
|
194 |
+
],
|
195 |
+
$url
|
196 |
+
);
|
197 |
+
$response = wp_remote_get( $url );
|
198 |
+
$response = json_decode( wp_remote_retrieve_body( $response ) );
|
199 |
+
$download_link = empty( $response )
|
200 |
+
? "https://downloads.wordpress.org/plugin/{$slug}.zip"
|
201 |
+
: $response->download_link;
|
202 |
+
|
203 |
+
set_site_transient( 'wpdi-' . md5( $slug ), $download_link, DAY_IN_SECONDS );
|
204 |
+
}
|
205 |
+
|
206 |
+
return $download_link;
|
207 |
+
}
|
208 |
+
|
209 |
/**
|
210 |
* Determine if dependency is active or installed.
|
211 |
*/
|
235 |
$this->notices[] = array(
|
236 |
'action' => 'activate',
|
237 |
'slug' => $slug,
|
238 |
+
/* translators: %s: Plugin name */
|
239 |
+
'text' => sprintf( esc_html__( 'Please activate the %s plugin.' ), $dependency['name'] ),
|
240 |
+
'source' => $dependency['source'],
|
241 |
);
|
242 |
|
243 |
} else {
|
247 |
$this->notices[] = array(
|
248 |
'action' => 'install',
|
249 |
'slug' => $slug,
|
250 |
+
/* translators: %s: Plugin name */
|
251 |
+
'text' => sprintf( esc_html__( 'The %s plugin is required.' ), $dependency['name'] ),
|
252 |
+
'source' => $dependency['source'],
|
253 |
);
|
254 |
} else {
|
255 |
$this->notices[] = $this->install( $slug );
|
357 |
return array(
|
358 |
'status' => 'updated',
|
359 |
'slug' => $slug,
|
360 |
+
/* translators: %s: Plugin name */
|
361 |
+
'message' => sprintf( esc_html__( '%s has been installed and activated.' ), $this->config[ $slug ]['name'] ),
|
362 |
+
'source' => $this->config[ $slug ]['source'],
|
363 |
);
|
364 |
|
365 |
}
|
369 |
|
370 |
return array(
|
371 |
'status' => 'updated',
|
372 |
+
/* translators: %s: Plugin name */
|
373 |
+
'message' => sprintf( esc_html__( '%s has been installed.' ), $this->config[ $slug ]['name'] ),
|
374 |
+
'source' => $this->config[ $slug ]['source'],
|
375 |
);
|
376 |
}
|
377 |
|
396 |
|
397 |
return array(
|
398 |
'status' => 'updated',
|
399 |
+
/* translators: %s: Plugin name */
|
400 |
+
'message' => sprintf( esc_html__( '%s has been activated.' ), $this->config[ $slug ]['name'] ),
|
401 |
+
'source' => $this->config[ $slug ]['source'],
|
402 |
);
|
403 |
}
|
404 |
|
441 |
}
|
442 |
$message = null;
|
443 |
foreach ( $this->notices as $notice ) {
|
444 |
+
$status = empty( $notice['status'] ) ? 'updated' : $notice['status'];
|
445 |
|
446 |
if ( ! empty( $notice['action'] ) ) {
|
447 |
$action = esc_attr( $notice['action'] );
|
451 |
if ( ! empty( $notice['status'] ) ) {
|
452 |
$message = esc_html( $notice['message'] );
|
453 |
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Filters the dismissal timeout.
|
457 |
+
*
|
458 |
+
* @since 1.4.1
|
459 |
+
*
|
460 |
+
* @param string|int '7' Default dismissal in days.
|
461 |
+
* @param string $notice['source'] Plugin slug of calling plugin.
|
462 |
+
* @return string|int Dismissal timeout in days.
|
463 |
+
*/
|
464 |
+
$timeout = '-' . apply_filters( 'wp_dependency_timeout', '7', $notice['source'] );
|
465 |
$dismissible = isset( $notice['slug'] )
|
466 |
+
? 'dependency-installer-' . dirname( $notice['slug'] ) . $timeout
|
467 |
: null;
|
468 |
if ( class_exists( '\PAnd' ) && ! \PAnD::is_admin_notice_active( $dismissible ) ) {
|
469 |
continue;
|
470 |
}
|
471 |
?>
|
472 |
<div data-dismissible="<?php echo $dismissible; ?>" class="<?php echo $status; ?> notice is-dismissible dependency-installer">
|
473 |
+
<p><?php echo '<strong>[' . esc_html__( 'Dependency' ) . ']</strong> ' . $message; ?></p>
|
474 |
</div>
|
475 |
<?php
|
476 |
}
|
511 |
unset( $actions['deactivate'] );
|
512 |
}
|
513 |
|
514 |
+
/* translators: %s: opening and closing span tags */
|
515 |
+
$actions = array_merge( array( 'required-plugin' => sprintf( esc_html__( '%1$sPlugin dependency%2$s' ), '<span class="network_active">', '</span>' ) ), $actions );
|
516 |
|
517 |
+
return $actions;
|
518 |
+
}
|
519 |
}
|
520 |
|
521 |
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -6,4 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
|
|
9 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
+
'WPDI_Plugin_Installer_Skin' => $vendorDir . '/afragen/wp-dependency-installer/wp-dependency-installer.php',
|
10 |
+
'WP_Dependency_Installer' => $vendorDir . '/afragen/wp-dependency-installer/wp-dependency-installer.php',
|
11 |
);
|
vendor/composer/autoload_files.php
CHANGED
@@ -7,5 +7,4 @@ $baseDir = dirname($vendorDir);
|
|
7 |
|
8 |
return array(
|
9 |
'f51bb131284ceb3bf7d980d1de33e647' => $vendorDir . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
|
10 |
-
'35bd6a751b552e7a94ae27bc4c52b33a' => $vendorDir . '/afragen/wp-dependency-installer/wp-dependency-installer.php',
|
11 |
);
|
7 |
|
8 |
return array(
|
9 |
'f51bb131284ceb3bf7d980d1de33e647' => $vendorDir . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
|
|
|
10 |
);
|
vendor/composer/autoload_static.php
CHANGED
@@ -8,7 +8,6 @@ class ComposerStaticInit7bccf5ae526588cfb1b3cd6112f8e2a4
|
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'f51bb131284ceb3bf7d980d1de33e647' => __DIR__ . '/..' . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
|
11 |
-
'35bd6a751b552e7a94ae27bc4c52b33a' => __DIR__ . '/..' . '/afragen/wp-dependency-installer/wp-dependency-installer.php',
|
12 |
);
|
13 |
|
14 |
public static $prefixLengthsPsr4 = array (
|
@@ -25,11 +24,17 @@ class ComposerStaticInit7bccf5ae526588cfb1b3cd6112f8e2a4
|
|
25 |
),
|
26 |
);
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
public static function getInitializer(ClassLoader $loader)
|
29 |
{
|
30 |
return \Closure::bind(function () use ($loader) {
|
31 |
$loader->prefixLengthsPsr4 = ComposerStaticInit7bccf5ae526588cfb1b3cd6112f8e2a4::$prefixLengthsPsr4;
|
32 |
$loader->prefixDirsPsr4 = ComposerStaticInit7bccf5ae526588cfb1b3cd6112f8e2a4::$prefixDirsPsr4;
|
|
|
33 |
|
34 |
}, null, ClassLoader::class);
|
35 |
}
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'f51bb131284ceb3bf7d980d1de33e647' => __DIR__ . '/..' . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
|
|
|
11 |
);
|
12 |
|
13 |
public static $prefixLengthsPsr4 = array (
|
24 |
),
|
25 |
);
|
26 |
|
27 |
+
public static $classMap = array (
|
28 |
+
'WPDI_Plugin_Installer_Skin' => __DIR__ . '/..' . '/afragen/wp-dependency-installer/wp-dependency-installer.php',
|
29 |
+
'WP_Dependency_Installer' => __DIR__ . '/..' . '/afragen/wp-dependency-installer/wp-dependency-installer.php',
|
30 |
+
);
|
31 |
+
|
32 |
public static function getInitializer(ClassLoader $loader)
|
33 |
{
|
34 |
return \Closure::bind(function () use ($loader) {
|
35 |
$loader->prefixLengthsPsr4 = ComposerStaticInit7bccf5ae526588cfb1b3cd6112f8e2a4::$prefixLengthsPsr4;
|
36 |
$loader->prefixDirsPsr4 = ComposerStaticInit7bccf5ae526588cfb1b3cd6112f8e2a4::$prefixDirsPsr4;
|
37 |
+
$loader->classMap = ComposerStaticInit7bccf5ae526588cfb1b3cd6112f8e2a4::$classMap;
|
38 |
|
39 |
}, null, ClassLoader::class);
|
40 |
}
|
vendor/composer/installed.json
CHANGED
@@ -155,29 +155,28 @@
|
|
155 |
},
|
156 |
{
|
157 |
"name": "afragen/wp-dependency-installer",
|
158 |
-
"version": "1.
|
159 |
-
"version_normalized": "1.
|
160 |
"source": {
|
161 |
"type": "git",
|
162 |
"url": "https://github.com/afragen/wp-dependency-installer.git",
|
163 |
-
"reference": "
|
164 |
},
|
165 |
"dist": {
|
166 |
"type": "zip",
|
167 |
-
"url": "https://api.github.com/repos/afragen/wp-dependency-installer/zipball/
|
168 |
-
"reference": "
|
169 |
"shasum": ""
|
170 |
},
|
171 |
"require": {
|
172 |
-
"collizo4sky/persist-admin-notices-dismissal": "
|
173 |
-
"composer/installers": "^1.0",
|
174 |
"php": ">=5.3"
|
175 |
},
|
176 |
-
"time": "2018-
|
177 |
"type": "library",
|
178 |
"installation-source": "dist",
|
179 |
"autoload": {
|
180 |
-
"
|
181 |
"wp-dependency-installer.php"
|
182 |
]
|
183 |
},
|
155 |
},
|
156 |
{
|
157 |
"name": "afragen/wp-dependency-installer",
|
158 |
+
"version": "1.4.8",
|
159 |
+
"version_normalized": "1.4.8.0",
|
160 |
"source": {
|
161 |
"type": "git",
|
162 |
"url": "https://github.com/afragen/wp-dependency-installer.git",
|
163 |
+
"reference": "ea09e08c20e9071f5a0e61fae6c5b34a72e3e55f"
|
164 |
},
|
165 |
"dist": {
|
166 |
"type": "zip",
|
167 |
+
"url": "https://api.github.com/repos/afragen/wp-dependency-installer/zipball/ea09e08c20e9071f5a0e61fae6c5b34a72e3e55f",
|
168 |
+
"reference": "ea09e08c20e9071f5a0e61fae6c5b34a72e3e55f",
|
169 |
"shasum": ""
|
170 |
},
|
171 |
"require": {
|
172 |
+
"collizo4sky/persist-admin-notices-dismissal": "^1",
|
|
|
173 |
"php": ">=5.3"
|
174 |
},
|
175 |
+
"time": "2018-11-26T00:08:14+00:00",
|
176 |
"type": "library",
|
177 |
"installation-source": "dist",
|
178 |
"autoload": {
|
179 |
+
"classmap": [
|
180 |
"wp-dependency-installer.php"
|
181 |
]
|
182 |
},
|
wp-dependencies.json
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
"host": "wordpress",
|
5 |
"slug": "classic-editor/classic-editor.php",
|
6 |
"uri": "https://wordpress.org/plugins/classic-editor/",
|
7 |
-
"branch": "trunk"
|
|
|
8 |
}
|
9 |
]
|
4 |
"host": "wordpress",
|
5 |
"slug": "classic-editor/classic-editor.php",
|
6 |
"uri": "https://wordpress.org/plugins/classic-editor/",
|
7 |
+
"branch": "trunk",
|
8 |
+
"optional": false
|
9 |
}
|
10 |
]
|