Version Description
- Release date: August 4, 2020
** Compatibility **
- General: Implement the spread operator for our IXR class methods to match WordPress Core behavior in 5.5.
- General: Update some miscellaneous dependencies.
Download this release
Release Info
Developer | georgestephanis |
Plugin | VaultPress |
Version | 2.1.2 |
Comparing to | |
See all releases |
Code changes from version 2.1.1 to 2.1.2
- class.vaultpress-ixr-ssl-client.php +8 -2
- composer.json +2 -2
- readme.txt +21 -3
- vaultpress.php +8 -8
- vendor/autoload.php +1 -1
- vendor/autoload_functions.php +152 -0
- vendor/autoload_packages.php +5 -135
- vendor/automattic/jetpack-autoloader/README.md +2 -0
- vendor/automattic/jetpack-autoloader/composer.json +1 -1
- vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php +115 -41
- vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php +40 -3
- vendor/automattic/jetpack-autoloader/src/autoload.php +3 -118
- vendor/automattic/jetpack-autoloader/src/class-autoloader-handler.php +132 -0
- vendor/automattic/jetpack-autoloader/src/class-classes-handler.php +90 -0
- vendor/automattic/jetpack-autoloader/src/class-files-handler.php +104 -0
- vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php +150 -0
- vendor/automattic/jetpack-autoloader/src/class-version-selector.php +61 -0
- vendor/automattic/jetpack-autoloader/src/functions.php +144 -0
- vendor/automattic/jetpack-logo/src/class-logo.php +30 -11
- vendor/class-autoloader-handler.php +140 -0
- vendor/class-classes-handler.php +98 -0
- vendor/class-files-handler.php +112 -0
- vendor/class-plugins-handler.php +158 -0
- vendor/class-version-selector.php +69 -0
- vendor/composer/autoload_real.php +7 -4
- vendor/composer/autoload_static.php +4 -4
- vendor/composer/installed.json +25 -25
- vendor/composer/{autoload_classmap_package.php → jetpack_autoload_classmap.php} +3 -3
- vendor/composer/jetpack_autoload_filemap.php +10 -0
class.vaultpress-ixr-ssl-client.php
CHANGED
@@ -22,8 +22,14 @@ class VaultPress_IXR_SSL_Client extends IXR_Client {
|
|
22 |
if ( $port )
|
23 |
$this->port = $port;
|
24 |
}
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
$method = array_shift($args);
|
28 |
$request = new IXR_Request($method, $args);
|
29 |
$length = $request->getLength();
|
22 |
if ( $port )
|
23 |
$this->port = $port;
|
24 |
}
|
25 |
+
/**
|
26 |
+
* Perform the IXR request.
|
27 |
+
*
|
28 |
+
* @param string[] ...$args IXR args.
|
29 |
+
*
|
30 |
+
* @return bool True if request succeeded, false otherwise.
|
31 |
+
*/
|
32 |
+
function query( ...$args ) {
|
33 |
$method = array_shift($args);
|
34 |
$request = new IXR_Request($method, $args);
|
35 |
$length = $request->getLength();
|
composer.json
CHANGED
@@ -8,8 +8,8 @@
|
|
8 |
"issues": "https://github.com/Automattic/vaultpress/issues"
|
9 |
},
|
10 |
"require": {
|
11 |
-
"automattic/jetpack-logo": "1.
|
12 |
-
"automattic/jetpack-autoloader": "1.
|
13 |
},
|
14 |
"require-dev": {
|
15 |
"automattic/jetpack-standards": "master-dev"
|
8 |
"issues": "https://github.com/Automattic/vaultpress/issues"
|
9 |
},
|
10 |
"require": {
|
11 |
+
"automattic/jetpack-logo": "1.3.0",
|
12 |
+
"automattic/jetpack-autoloader": "2.1.0"
|
13 |
},
|
14 |
"require-dev": {
|
15 |
"automattic/jetpack-standards": "master-dev"
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== VaultPress ===
|
2 |
Contributors: automattic, apokalyptik, briancolinger, josephscott, shaunandrews, xknown, thingalon, annezazu, rachelsquirrel
|
3 |
Tags: security, malware, virus, archive, back up, back ups, backup, backups, scanning, restore, wordpress backup, site backup, website backup
|
4 |
-
Requires at least: 5.
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 2.1.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2
|
9 |
|
@@ -49,6 +49,24 @@ Yes, VaultPress supports Multisite installs. Each site will require its own subs
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
= 2.1 =
|
53 |
|
54 |
* Release date: December 9, 2019
|
1 |
=== VaultPress ===
|
2 |
Contributors: automattic, apokalyptik, briancolinger, josephscott, shaunandrews, xknown, thingalon, annezazu, rachelsquirrel
|
3 |
Tags: security, malware, virus, archive, back up, back ups, backup, backups, scanning, restore, wordpress backup, site backup, website backup
|
4 |
+
Requires at least: 5.2
|
5 |
+
Tested up to: 5.5
|
6 |
+
Stable tag: 2.1.2
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2
|
9 |
|
49 |
|
50 |
== Changelog ==
|
51 |
|
52 |
+
= 2.1.2 =
|
53 |
+
|
54 |
+
* Release date: August 4, 2020
|
55 |
+
|
56 |
+
** Compatibility **
|
57 |
+
|
58 |
+
* General: Implement the spread operator for our IXR class methods to match WordPress Core behavior in 5.5.
|
59 |
+
* General: Update some miscellaneous dependencies.
|
60 |
+
|
61 |
+
= 2.1.1 =
|
62 |
+
|
63 |
+
* Release date: December 10, 2019
|
64 |
+
|
65 |
+
**Compatibility**
|
66 |
+
|
67 |
+
* General: the VaultPress plugin now requires PHP 5.6, just like WordPress.
|
68 |
+
* General: avoid using PHP short array syntax to load plugin files.
|
69 |
+
|
70 |
= 2.1 =
|
71 |
|
72 |
* Release date: December 9, 2019
|
vaultpress.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: VaultPress
|
4 |
* Plugin URI: http://vaultpress.com/?utm_source=plugin-uri&utm_medium=plugin-description&utm_campaign=1.0
|
5 |
* Description: Protect your content, themes, plugins, and settings with <strong>realtime backup</strong> and <strong>automated security scanning</strong> from <a href="http://vaultpress.com/?utm_source=wp-admin&utm_medium=plugin-description&utm_campaign=1.0" rel="nofollow">VaultPress</a>. Activate, enter your registration key, and never worry again. <a href="http://vaultpress.com/help/?utm_source=wp-admin&utm_medium=plugin-description&utm_campaign=1.0" rel="nofollow">Need some help?</a>
|
6 |
-
* Version: 2.1.
|
7 |
* Author: Automattic
|
8 |
* Author URI: http://vaultpress.com/?utm_source=author-uri&utm_medium=plugin-description&utm_campaign=1.0
|
9 |
* License: GPL2+
|
@@ -17,7 +17,7 @@
|
|
17 |
defined( 'ABSPATH' ) || die();
|
18 |
|
19 |
define( 'VAULTPRESS__MINIMUM_PHP_VERSION', '5.6' );
|
20 |
-
define( 'VAULTPRESS__VERSION', '2.1' );
|
21 |
define( 'VAULTPRESS__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
22 |
|
23 |
/**
|
@@ -2911,7 +2911,7 @@ JS;
|
|
2911 |
add_action( 'edit_attachment', array( $this, 'post_action_handler' ) );
|
2912 |
add_action( 'add_attachment', array( $this, 'post_action_handler' ) );
|
2913 |
add_action( 'delete_attachment', array( $this, 'post_action_handler' ) );
|
2914 |
-
add_action( '
|
2915 |
add_action( 'wp_restore_post_revision', array( $this, 'post_action_handler' ) );
|
2916 |
|
2917 |
// Postmeta
|
@@ -2993,12 +2993,12 @@ JS;
|
|
2993 |
if ( ! class_exists( 'Jetpack' ) ) {
|
2994 |
return false;
|
2995 |
}
|
2996 |
-
|
2997 |
// For version of Jetpack prior to 7.7.
|
2998 |
-
if ( ! class_exists( 'Jetpack_IXR_Client' ) ) {
|
2999 |
Jetpack::load_xml_rpc_client();
|
3000 |
}
|
3001 |
-
|
3002 |
$xml = new Jetpack_IXR_Client( array( 'user_id' => get_current_user_id() ) );
|
3003 |
$xml->query( 'wpcom.getUserEmail' );
|
3004 |
if ( ! $xml->isError() ) {
|
@@ -3012,9 +3012,9 @@ JS;
|
|
3012 |
if ( ! class_exists( 'Jetpack' ) ) {
|
3013 |
return false;
|
3014 |
}
|
3015 |
-
|
3016 |
// For version of Jetpack prior to 7.7.
|
3017 |
-
if ( ! class_exists( 'Jetpack_IXR_Client' ) ) {
|
3018 |
Jetpack::load_xml_rpc_client();
|
3019 |
}
|
3020 |
|
3 |
* Plugin Name: VaultPress
|
4 |
* Plugin URI: http://vaultpress.com/?utm_source=plugin-uri&utm_medium=plugin-description&utm_campaign=1.0
|
5 |
* Description: Protect your content, themes, plugins, and settings with <strong>realtime backup</strong> and <strong>automated security scanning</strong> from <a href="http://vaultpress.com/?utm_source=wp-admin&utm_medium=plugin-description&utm_campaign=1.0" rel="nofollow">VaultPress</a>. Activate, enter your registration key, and never worry again. <a href="http://vaultpress.com/help/?utm_source=wp-admin&utm_medium=plugin-description&utm_campaign=1.0" rel="nofollow">Need some help?</a>
|
6 |
+
* Version: 2.1.2
|
7 |
* Author: Automattic
|
8 |
* Author URI: http://vaultpress.com/?utm_source=author-uri&utm_medium=plugin-description&utm_campaign=1.0
|
9 |
* License: GPL2+
|
17 |
defined( 'ABSPATH' ) || die();
|
18 |
|
19 |
define( 'VAULTPRESS__MINIMUM_PHP_VERSION', '5.6' );
|
20 |
+
define( 'VAULTPRESS__VERSION', '2.1.2' );
|
21 |
define( 'VAULTPRESS__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
22 |
|
23 |
/**
|
2911 |
add_action( 'edit_attachment', array( $this, 'post_action_handler' ) );
|
2912 |
add_action( 'add_attachment', array( $this, 'post_action_handler' ) );
|
2913 |
add_action( 'delete_attachment', array( $this, 'post_action_handler' ) );
|
2914 |
+
add_action( 'private_to_publish', array( $this, 'post_action_handler' ) );
|
2915 |
add_action( 'wp_restore_post_revision', array( $this, 'post_action_handler' ) );
|
2916 |
|
2917 |
// Postmeta
|
2993 |
if ( ! class_exists( 'Jetpack' ) ) {
|
2994 |
return false;
|
2995 |
}
|
2996 |
+
|
2997 |
// For version of Jetpack prior to 7.7.
|
2998 |
+
if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' ) && ! class_exists( 'Jetpack_IXR_Client' ) ) {
|
2999 |
Jetpack::load_xml_rpc_client();
|
3000 |
}
|
3001 |
+
|
3002 |
$xml = new Jetpack_IXR_Client( array( 'user_id' => get_current_user_id() ) );
|
3003 |
$xml->query( 'wpcom.getUserEmail' );
|
3004 |
if ( ! $xml->isError() ) {
|
3012 |
if ( ! class_exists( 'Jetpack' ) ) {
|
3013 |
return false;
|
3014 |
}
|
3015 |
+
|
3016 |
// For version of Jetpack prior to 7.7.
|
3017 |
+
if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' ) && ! class_exists( 'Jetpack_IXR_Client' ) ) {
|
3018 |
Jetpack::load_xml_rpc_client();
|
3019 |
}
|
3020 |
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitf733b826e082db99519415f102671fe9::getLoader();
|
vendor/autoload_functions.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file was automatically generated by automattic/jetpack-autoloader.
|
4 |
+
*
|
5 |
+
* @package automattic/jetpack-autoloader
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Automattic\Jetpack\Autoloader\jp8e4bd021160ba30631028144cededd1f;
|
9 |
+
|
10 |
+
// phpcs:ignore
|
11 |
+
|
12 |
+
global $jetpack_packages_classmap;
|
13 |
+
global $jetpack_packages_filemap;
|
14 |
+
global $jetpack_autoloader_activating_plugins_paths;
|
15 |
+
|
16 |
+
if ( ! is_array( $jetpack_packages_classmap ) ) {
|
17 |
+
$jetpack_packages_classmap = array();
|
18 |
+
}
|
19 |
+
|
20 |
+
if ( ! is_array( $jetpack_packages_filemap ) ) {
|
21 |
+
$jetpack_packages_filemap = array();
|
22 |
+
}
|
23 |
+
|
24 |
+
if ( ! is_array( $jetpack_autoloader_activating_plugins_paths ) ) {
|
25 |
+
$jetpack_autoloader_activating_plugins_paths = array();
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Used for autoloading jetpack packages.
|
30 |
+
*
|
31 |
+
* @param string $class_name Class Name to load.
|
32 |
+
*
|
33 |
+
* @return Boolean Whether the class_name was found in the classmap.
|
34 |
+
*/
|
35 |
+
function autoloader( $class_name ) {
|
36 |
+
global $jetpack_packages_classmap;
|
37 |
+
|
38 |
+
if ( isset( $jetpack_packages_classmap[ $class_name ] ) ) {
|
39 |
+
require_once $jetpack_packages_classmap[ $class_name ]['path'];
|
40 |
+
return true;
|
41 |
+
}
|
42 |
+
|
43 |
+
return false;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Used for running the code that initializes class and file maps.
|
48 |
+
*
|
49 |
+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
50 |
+
* @param Version_Selector $version_selector The Version_Selector object.
|
51 |
+
*/
|
52 |
+
function enqueue_files( $plugins_handler, $version_selector ) {
|
53 |
+
require_once __DIR__ . '/class-classes-handler.php';
|
54 |
+
require_once __DIR__ . '/class-files-handler.php';
|
55 |
+
|
56 |
+
$classes_handler = new Classes_Handler( $plugins_handler, $version_selector );
|
57 |
+
$classes_handler->set_class_paths();
|
58 |
+
|
59 |
+
$files_handler = new Files_Handler( $plugins_handler, $version_selector );
|
60 |
+
$files_handler->set_file_paths();
|
61 |
+
|
62 |
+
$files_handler->file_loader();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Finds the latest installed autoloader. If this is the latest autoloader, sets
|
67 |
+
* up the classmap and filemap.
|
68 |
+
*/
|
69 |
+
function set_up_autoloader() {
|
70 |
+
global $jetpack_autoloader_latest_version;
|
71 |
+
global $jetpack_packages_classmap;
|
72 |
+
|
73 |
+
require_once __DIR__ . '/class-plugins-handler.php';
|
74 |
+
require_once __DIR__ . '/class-version-selector.php';
|
75 |
+
require_once __DIR__ . '/class-autoloader-handler.php';
|
76 |
+
|
77 |
+
$plugins_handler = new Plugins_Handler();
|
78 |
+
$version_selector = new Version_Selector();
|
79 |
+
$autoloader_handler = new Autoloader_Handler( $plugins_handler, $version_selector );
|
80 |
+
|
81 |
+
if ( $plugins_handler->should_autoloader_reset() ) {
|
82 |
+
/*
|
83 |
+
* The autoloader must be reset when an activating plugin that was
|
84 |
+
* previously unknown is detected.
|
85 |
+
*/
|
86 |
+
$jetpack_autoloader_latest_version = null;
|
87 |
+
$jetpack_packages_classmap = array();
|
88 |
+
}
|
89 |
+
|
90 |
+
// Find the latest autoloader.
|
91 |
+
if ( ! $jetpack_autoloader_latest_version ) {
|
92 |
+
$autoloader_handler->find_latest_autoloader();
|
93 |
+
}
|
94 |
+
|
95 |
+
$current_autoloader_version = $autoloader_handler->get_current_autoloader_version();
|
96 |
+
|
97 |
+
// This is the latest autoloader, so generate the classmap and filemap and register the autoloader function.
|
98 |
+
if ( empty( $jetpack_packages_classmap ) && $current_autoloader_version === $jetpack_autoloader_latest_version ) {
|
99 |
+
enqueue_files( $plugins_handler, $version_selector );
|
100 |
+
$autoloader_handler->update_autoloader_chain();
|
101 |
+
add_filter( 'upgrader_post_install', __NAMESPACE__ . '\reset_maps_after_update', 0, 3 );
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Resets the autoloader after a plugin update.
|
107 |
+
*
|
108 |
+
* @param bool $response Installation response.
|
109 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
110 |
+
* @param array $result Installation result data.
|
111 |
+
*
|
112 |
+
* @return bool The passed in $response param.
|
113 |
+
*/
|
114 |
+
function reset_maps_after_update( $response, $hook_extra, $result ) {
|
115 |
+
global $jetpack_autoloader_latest_version;
|
116 |
+
global $jetpack_packages_classmap;
|
117 |
+
|
118 |
+
if ( isset( $hook_extra['plugin'] ) ) {
|
119 |
+
/*
|
120 |
+
* $hook_extra['plugin'] is the path to the plugin file relative to the plugins directory:
|
121 |
+
* https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/includes/class-wp-upgrader.php#L701
|
122 |
+
*/
|
123 |
+
$plugin = $hook_extra['plugin'];
|
124 |
+
|
125 |
+
if ( false === strpos( $plugin, '/', 1 ) ) {
|
126 |
+
// Single-file plugins don't use packages, so bail.
|
127 |
+
return $response;
|
128 |
+
}
|
129 |
+
|
130 |
+
if ( ! is_plugin_active( $plugin ) ) {
|
131 |
+
// The updated plugin isn't active, so bail.
|
132 |
+
return $response;
|
133 |
+
}
|
134 |
+
|
135 |
+
/*
|
136 |
+
* $plugin is the path to the plugin file relative to the plugins directory.
|
137 |
+
*/
|
138 |
+
$plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR );
|
139 |
+
$plugin_path = trailingslashit( $plugin_dir ) . trailingslashit( explode( '/', $plugin )[0] );
|
140 |
+
|
141 |
+
if ( is_readable( $plugin_path . 'vendor/autoload_functions.php' ) ) {
|
142 |
+
// The plugin has a v2.x autoloader, so reset it.
|
143 |
+
$jetpack_autoloader_latest_version = null;
|
144 |
+
$jetpack_packages_classmap = array();
|
145 |
+
|
146 |
+
set_up_autoloader();
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
return $response;
|
151 |
+
}
|
152 |
+
|
vendor/autoload_packages.php
CHANGED
@@ -1,144 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* This file
|
4 |
-
*
|
5 |
-
* From your plugin include this file with:
|
6 |
-
* require_once . plugin_dir_path( __FILE__ ) . '/vendor/autoload_packages.php';
|
7 |
*
|
8 |
* @package automattic/jetpack-autoloader
|
9 |
*/
|
10 |
|
11 |
-
|
12 |
-
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_namespaceFound
|
13 |
-
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_ns_cFound
|
14 |
-
|
15 |
-
namespace Automattic\Jetpack\Autoloader;
|
16 |
-
|
17 |
-
if ( ! function_exists( __NAMESPACE__ . '\enqueue_package_class' ) ) {
|
18 |
-
global $jetpack_packages_classes;
|
19 |
-
|
20 |
-
if ( ! is_array( $jetpack_packages_classes ) ) {
|
21 |
-
$jetpack_packages_classes = array();
|
22 |
-
}
|
23 |
-
/**
|
24 |
-
* Adds the version of a package to the $jetpack_packages global array so that
|
25 |
-
* the autoloader is able to find it.
|
26 |
-
*
|
27 |
-
* @param string $class_name Name of the class that you want to autoload.
|
28 |
-
* @param string $version Version of the class.
|
29 |
-
* @param string $path Absolute path to the class so that we can load it.
|
30 |
-
*/
|
31 |
-
function enqueue_package_class( $class_name, $version, $path ) {
|
32 |
-
global $jetpack_packages_classes;
|
33 |
-
|
34 |
-
if ( ! isset( $jetpack_packages_classes[ $class_name ] ) ) {
|
35 |
-
$jetpack_packages_classes[ $class_name ] = array(
|
36 |
-
'version' => $version,
|
37 |
-
'path' => $path,
|
38 |
-
);
|
39 |
-
}
|
40 |
-
// If we have a @dev version set always use that one!
|
41 |
-
if ( 'dev-' === substr( $jetpack_packages_classes[ $class_name ]['version'], 0, 4 ) ) {
|
42 |
-
return;
|
43 |
-
}
|
44 |
-
|
45 |
-
// Always favour the @dev version. Since that version is the same as bleeding edge.
|
46 |
-
// We need to make sure that we don't do this in production!
|
47 |
-
if ( 'dev-' === substr( $version, 0, 4 ) ) {
|
48 |
-
$jetpack_packages_classes[ $class_name ] = array(
|
49 |
-
'version' => $version,
|
50 |
-
'path' => $path,
|
51 |
-
);
|
52 |
-
|
53 |
-
return;
|
54 |
-
}
|
55 |
-
// Set the latest version!
|
56 |
-
if ( version_compare( $jetpack_packages_classes[ $class_name ]['version'], $version, '<' ) ) {
|
57 |
-
$jetpack_packages_classes[ $class_name ] = array(
|
58 |
-
'version' => $version,
|
59 |
-
'path' => $path,
|
60 |
-
);
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( ! function_exists( __NAMESPACE__ . '\autoloader' ) ) {
|
66 |
-
/**
|
67 |
-
* Used for autoloading jetpack packages.
|
68 |
-
*
|
69 |
-
* @param string $class_name Class Name to load.
|
70 |
-
*/
|
71 |
-
function autoloader( $class_name ) {
|
72 |
-
global $jetpack_packages_classes;
|
73 |
-
|
74 |
-
if ( isset( $jetpack_packages_classes[ $class_name ] ) ) {
|
75 |
-
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
76 |
-
// TODO ideally we shouldn't skip any of these, see: https://github.com/Automattic/jetpack/pull/12646.
|
77 |
-
$ignore = in_array(
|
78 |
-
$class_name,
|
79 |
-
array(
|
80 |
-
'Automattic\Jetpack\JITM',
|
81 |
-
'Automattic\Jetpack\Connection\Manager',
|
82 |
-
'Automattic\Jetpack\Connection\Manager_Interface',
|
83 |
-
'Automattic\Jetpack\Connection\XMLRPC_Connector',
|
84 |
-
'Jetpack_IXR_Client',
|
85 |
-
'Jetpack_Options',
|
86 |
-
'Jetpack_Signature',
|
87 |
-
'Jetpack_XMLRPC_Server',
|
88 |
-
'Automattic\Jetpack\Sync\Main',
|
89 |
-
'Automattic\Jetpack\Constants',
|
90 |
-
'Automattic\Jetpack\Tracking',
|
91 |
-
'Automattic\Jetpack\Plugin\Tracking',
|
92 |
-
),
|
93 |
-
true
|
94 |
-
);
|
95 |
-
if ( ! $ignore && function_exists( 'did_action' ) && ! did_action( 'plugins_loaded' ) ) {
|
96 |
-
_doing_it_wrong(
|
97 |
-
esc_html( $class_name ),
|
98 |
-
sprintf(
|
99 |
-
/* translators: %s Name of a PHP Class */
|
100 |
-
esc_html__( 'Not all plugins have loaded yet but we requested the class %s', 'jetpack' ),
|
101 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
102 |
-
$class_name
|
103 |
-
),
|
104 |
-
esc_html( $jetpack_packages_classes[ $class_name ]['version'] )
|
105 |
-
);
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
if ( file_exists( $jetpack_packages_classes[ $class_name ]['path'] ) ) {
|
110 |
-
require_once $jetpack_packages_classes[ $class_name ]['path'];
|
111 |
-
|
112 |
-
return true;
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
return false;
|
117 |
-
}
|
118 |
-
|
119 |
-
// Add the jetpack autoloader.
|
120 |
-
spl_autoload_register( __NAMESPACE__ . '\autoloader' );
|
121 |
-
}
|
122 |
-
/**
|
123 |
-
* Prepare all the classes for autoloading.
|
124 |
-
*/
|
125 |
-
function enqueue_packages_583fd9fc320cf240dae152d6e27f7b85() {
|
126 |
-
$class_map = require_once dirname( __FILE__ ) . '/composer/autoload_classmap_package.php';
|
127 |
-
foreach ( $class_map as $class_name => $class_info ) {
|
128 |
-
enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
|
129 |
-
}
|
130 |
|
131 |
-
|
132 |
-
$includeFiles = file_exists( $autoload_file )
|
133 |
-
? require $autoload_file
|
134 |
-
: array();
|
135 |
|
136 |
-
|
137 |
-
if ( empty( $GLOBALS['__composer_autoload_files'][ $fileIdentifier ] ) ) {
|
138 |
-
require $file;
|
139 |
|
140 |
-
|
141 |
-
}
|
142 |
-
}
|
143 |
-
}
|
144 |
-
enqueue_packages_583fd9fc320cf240dae152d6e27f7b85();
|
1 |
<?php
|
2 |
/**
|
3 |
+
* This file was automatically generated by automattic/jetpack-autoloader.
|
|
|
|
|
|
|
4 |
*
|
5 |
* @package automattic/jetpack-autoloader
|
6 |
*/
|
7 |
|
8 |
+
namespace Automattic\Jetpack\Autoloader\jp8e4bd021160ba30631028144cededd1f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
+
// phpcs:ignore
|
|
|
|
|
|
|
11 |
|
12 |
+
require_once trailingslashit( dirname( __FILE__ ) ) . '/autoload_functions.php';
|
|
|
|
|
13 |
|
14 |
+
set_up_autoloader();
|
|
|
|
|
|
|
|
vendor/automattic/jetpack-autoloader/README.md
CHANGED
@@ -42,3 +42,5 @@ Current Limitations
|
|
42 |
-----
|
43 |
|
44 |
We currently only support packages that autoload via psr-4 definition in their package.
|
|
|
|
42 |
-----
|
43 |
|
44 |
We currently only support packages that autoload via psr-4 definition in their package.
|
45 |
+
|
46 |
+
Your project must use the default composer vendor directory, `vendor`.
|
vendor/automattic/jetpack-autoloader/composer.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
"type": "composer-plugin",
|
5 |
"license": "GPL-2.0-or-later",
|
6 |
"require": {
|
7 |
-
"composer-plugin-api": "^1.1"
|
8 |
},
|
9 |
"require-dev": {
|
10 |
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
4 |
"type": "composer-plugin",
|
5 |
"license": "GPL-2.0-or-later",
|
6 |
"require": {
|
7 |
+
"composer-plugin-api": "^1.1 || ^2.0"
|
8 |
},
|
9 |
"require-dev": {
|
10 |
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
/**
|
3 |
* Autoloader Generator.
|
4 |
*
|
@@ -11,7 +11,6 @@
|
|
11 |
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_namespaceFound
|
12 |
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_dirFound
|
13 |
// phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
14 |
-
// phpcs:disable WordPress.Files.FileName.NotHyphenatedLowercase
|
15 |
// phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
16 |
// phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_var_export
|
17 |
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents
|
@@ -39,6 +38,15 @@ use Composer\Util\Filesystem;
|
|
39 |
*/
|
40 |
class AutoloadGenerator extends BaseGenerator {
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* Instantiate an AutoloadGenerator object.
|
44 |
*
|
@@ -57,7 +65,7 @@ class AutoloadGenerator extends BaseGenerator {
|
|
57 |
* @param InstallationManager $installationManager Manager for installing packages.
|
58 |
* @param string $targetDir Path to the current target directory.
|
59 |
* @param bool $scanPsr0Packages Whether to search for packages. Currently hard coded to always be false.
|
60 |
-
* @param string $suffix The autoloader suffix
|
61 |
*/
|
62 |
public function dump(
|
63 |
Config $config,
|
@@ -81,14 +89,35 @@ class AutoloadGenerator extends BaseGenerator {
|
|
81 |
$autoloads = $this->parseAutoloads( $packageMap, $mainPackage );
|
82 |
|
83 |
$classMap = $this->getClassMap( $autoloads, $filesystem, $vendorPath, $basePath );
|
|
|
84 |
|
85 |
// Generate the files.
|
86 |
-
file_put_contents( $targetDir . '/
|
87 |
-
$this->io->writeError( '<info>Generated ' . $targetDir . '/
|
|
|
|
|
|
|
88 |
|
89 |
-
file_put_contents( $vendorPath . '/autoload_packages.php', $this->getAutoloadPackageFile( $suffix ) );
|
90 |
$this->io->writeError( '<info>Generated ' . $vendorPath . '/autoload_packages.php</info>', true );
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
|
94 |
/**
|
@@ -106,7 +135,7 @@ class AutoloadGenerator extends BaseGenerator {
|
|
106 |
protected function parseAutoloadsType( array $packageMap, $type, PackageInterface $mainPackage ) {
|
107 |
$autoloads = array();
|
108 |
|
109 |
-
if ( 'psr-4' !== $type && 'classmap' !== $type ) {
|
110 |
return parent::parseAutoloadsType( $packageMap, $type, $mainPackage );
|
111 |
}
|
112 |
|
@@ -147,6 +176,18 @@ class AutoloadGenerator extends BaseGenerator {
|
|
147 |
}
|
148 |
}
|
149 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
|
152 |
return $autoloads;
|
@@ -160,7 +201,7 @@ class AutoloadGenerator extends BaseGenerator {
|
|
160 |
* @param string $vendorPath Path to the vendor directory.
|
161 |
* @param string $basePath Base Path.
|
162 |
*
|
163 |
-
* @return
|
164 |
*/
|
165 |
private function getClassMap( array $autoloads, Filesystem $filesystem, $vendorPath, $basePath ) {
|
166 |
$blacklist = null;
|
@@ -176,8 +217,8 @@ class AutoloadGenerator extends BaseGenerator {
|
|
176 |
foreach ( $packages_info as $package ) {
|
177 |
$dir = $filesystem->normalizePath(
|
178 |
$filesystem->isAbsolutePath( $package['path'] )
|
179 |
-
|
180 |
-
|
181 |
);
|
182 |
$namespace = empty( $namespace ) ? null : $namespace;
|
183 |
$map = ClassMapGenerator::createMap( $dir, $blacklist, $this->io, $namespace );
|
@@ -200,8 +241,8 @@ CLASS_CODE;
|
|
200 |
foreach ( $autoloads['classmap'] as $package ) {
|
201 |
$dir = $filesystem->normalizePath(
|
202 |
$filesystem->isAbsolutePath( $package['path'] )
|
203 |
-
|
204 |
-
|
205 |
);
|
206 |
$map = ClassMapGenerator::createMap( $dir, $blacklist, $this->io, null );
|
207 |
|
@@ -225,7 +266,7 @@ CLASS_CODE;
|
|
225 |
/**
|
226 |
* Generate the PHP that will be used in the autoload_classmap_package.php files.
|
227 |
*
|
228 |
-
* @param
|
229 |
*
|
230 |
* @return string
|
231 |
*/
|
@@ -245,42 +286,75 @@ INCLUDE_CLASSMAP;
|
|
245 |
}
|
246 |
|
247 |
/**
|
248 |
-
*
|
|
|
|
|
|
|
|
|
|
|
249 |
*
|
250 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
*
|
252 |
* @return string
|
253 |
*/
|
254 |
-
private function
|
255 |
-
$sourceLoader = fopen( __DIR__ . '/autoload.php', 'r' );
|
256 |
-
$file_contents = stream_get_contents( $sourceLoader );
|
257 |
-
$file_contents .= <<<INCLUDE_FILES
|
258 |
-
/**
|
259 |
-
* Prepare all the classes for autoloading.
|
260 |
-
*/
|
261 |
-
function enqueue_packages_$suffix() {
|
262 |
-
\$class_map = require_once dirname( __FILE__ ) . '/composer/autoload_classmap_package.php';
|
263 |
-
foreach ( \$class_map as \$class_name => \$class_info ) {
|
264 |
-
enqueue_package_class( \$class_name, \$class_info['version'], \$class_info['path'] );
|
265 |
-
}
|
266 |
|
267 |
-
|
268 |
-
|
269 |
-
? require \$autoload_file
|
270 |
-
: array();
|
271 |
|
272 |
-
|
273 |
-
if ( empty( \$GLOBALS['__composer_autoload_files'][ \$fileIdentifier ] ) ) {
|
274 |
-
require \$file;
|
275 |
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
enqueue_packages_$suffix();
|
281 |
|
282 |
-
|
|
|
283 |
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
}
|
286 |
}
|
1 |
+
<?php // phpcs:ignore WordPress.Files.FileName
|
2 |
/**
|
3 |
* Autoloader Generator.
|
4 |
*
|
11 |
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_namespaceFound
|
12 |
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_dirFound
|
13 |
// phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
|
|
14 |
// phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
15 |
// phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_var_export
|
16 |
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents
|
38 |
*/
|
39 |
class AutoloadGenerator extends BaseGenerator {
|
40 |
|
41 |
+
const COMMENT = <<<AUTOLOADER_COMMENT
|
42 |
+
/**
|
43 |
+
* This file was automatically generated by automattic/jetpack-autoloader.
|
44 |
+
*
|
45 |
+
* @package automattic/jetpack-autoloader
|
46 |
+
*/
|
47 |
+
|
48 |
+
AUTOLOADER_COMMENT;
|
49 |
+
|
50 |
/**
|
51 |
* Instantiate an AutoloadGenerator object.
|
52 |
*
|
65 |
* @param InstallationManager $installationManager Manager for installing packages.
|
66 |
* @param string $targetDir Path to the current target directory.
|
67 |
* @param bool $scanPsr0Packages Whether to search for packages. Currently hard coded to always be false.
|
68 |
+
* @param string $suffix The autoloader suffix.
|
69 |
*/
|
70 |
public function dump(
|
71 |
Config $config,
|
89 |
$autoloads = $this->parseAutoloads( $packageMap, $mainPackage );
|
90 |
|
91 |
$classMap = $this->getClassMap( $autoloads, $filesystem, $vendorPath, $basePath );
|
92 |
+
$fileMap = $this->getFileMap( $autoloads, $filesystem, $vendorPath, $basePath );
|
93 |
|
94 |
// Generate the files.
|
95 |
+
file_put_contents( $targetDir . '/jetpack_autoload_classmap.php', $this->getAutoloadClassmapPackagesFile( $classMap ) );
|
96 |
+
$this->io->writeError( '<info>Generated ' . $targetDir . '/jetpack_autoload_classmap.php</info>', true );
|
97 |
+
|
98 |
+
file_put_contents( $targetDir . '/jetpack_autoload_filemap.php', $this->getAutoloadFilesPackagesFile( $fileMap ) );
|
99 |
+
$this->io->writeError( '<info>Generated ' . $targetDir . '/jetpack_autoload_filemap.php</info>', true );
|
100 |
|
101 |
+
file_put_contents( $vendorPath . '/autoload_packages.php', $this->getAutoloadPackageFile( 'autoload.php', $suffix ) );
|
102 |
$this->io->writeError( '<info>Generated ' . $vendorPath . '/autoload_packages.php</info>', true );
|
103 |
|
104 |
+
file_put_contents( $vendorPath . '/autoload_functions.php', $this->getAutoloadPackageFile( 'functions.php', $suffix ) );
|
105 |
+
$this->io->writeError( '<info>Generated ' . $vendorPath . '/autoload_functions.php</info>', true );
|
106 |
+
|
107 |
+
file_put_contents( $vendorPath . '/class-autoloader-handler.php', $this->getAutoloadPackageFile( 'class-autoloader-handler.php', $suffix ) );
|
108 |
+
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-autoloader-handler.php</info>', true );
|
109 |
+
|
110 |
+
file_put_contents( $vendorPath . '/class-classes-handler.php', $this->getAutoloadPackageFile( 'class-classes-handler.php', $suffix ) );
|
111 |
+
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-classes-handler.php</info>', true );
|
112 |
+
|
113 |
+
file_put_contents( $vendorPath . '/class-files-handler.php', $this->getAutoloadPackageFile( 'class-files-handler.php', $suffix ) );
|
114 |
+
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-files-handler.php</info>', true );
|
115 |
+
|
116 |
+
file_put_contents( $vendorPath . '/class-plugins-handler.php', $this->getAutoloadPackageFile( 'class-plugins-handler.php', $suffix ) );
|
117 |
+
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-plugins-handler.php</info>', true );
|
118 |
+
|
119 |
+
file_put_contents( $vendorPath . '/class-version-selector.php', $this->getAutoloadPackageFile( 'class-version-selector.php', $suffix ) );
|
120 |
+
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-version-selector.php</info>', true );
|
121 |
}
|
122 |
|
123 |
/**
|
135 |
protected function parseAutoloadsType( array $packageMap, $type, PackageInterface $mainPackage ) {
|
136 |
$autoloads = array();
|
137 |
|
138 |
+
if ( 'psr-4' !== $type && 'classmap' !== $type && 'files' !== $type ) {
|
139 |
return parent::parseAutoloadsType( $packageMap, $type, $mainPackage );
|
140 |
}
|
141 |
|
176 |
}
|
177 |
}
|
178 |
}
|
179 |
+
if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
|
180 |
+
foreach ( $autoload['files'] as $file_id => $paths ) {
|
181 |
+
$paths = is_array( $paths ) ? $paths : array( $paths );
|
182 |
+
foreach ( $paths as $path ) {
|
183 |
+
$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
|
184 |
+
$autoloads[ $this->getFileIdentifier( $package, $path ) ] = array(
|
185 |
+
'path' => $relativePath,
|
186 |
+
'version' => $package->getVersion(), // Version of the file comes from the package - should we try to parse it?
|
187 |
+
);
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
}
|
192 |
|
193 |
return $autoloads;
|
201 |
* @param string $vendorPath Path to the vendor directory.
|
202 |
* @param string $basePath Base Path.
|
203 |
*
|
204 |
+
* @return string $classMap
|
205 |
*/
|
206 |
private function getClassMap( array $autoloads, Filesystem $filesystem, $vendorPath, $basePath ) {
|
207 |
$blacklist = null;
|
217 |
foreach ( $packages_info as $package ) {
|
218 |
$dir = $filesystem->normalizePath(
|
219 |
$filesystem->isAbsolutePath( $package['path'] )
|
220 |
+
? $package['path']
|
221 |
+
: $basePath . '/' . $package['path']
|
222 |
);
|
223 |
$namespace = empty( $namespace ) ? null : $namespace;
|
224 |
$map = ClassMapGenerator::createMap( $dir, $blacklist, $this->io, $namespace );
|
241 |
foreach ( $autoloads['classmap'] as $package ) {
|
242 |
$dir = $filesystem->normalizePath(
|
243 |
$filesystem->isAbsolutePath( $package['path'] )
|
244 |
+
? $package['path']
|
245 |
+
: $basePath . '/' . $package['path']
|
246 |
);
|
247 |
$map = ClassMapGenerator::createMap( $dir, $blacklist, $this->io, null );
|
248 |
|
266 |
/**
|
267 |
* Generate the PHP that will be used in the autoload_classmap_package.php files.
|
268 |
*
|
269 |
+
* @param string $classMap class map array string that is to be written out to the file.
|
270 |
*
|
271 |
* @return string
|
272 |
*/
|
286 |
}
|
287 |
|
288 |
/**
|
289 |
+
* Take the autoloads array and return the fileMap that contains the path and the version for each namespace.
|
290 |
+
*
|
291 |
+
* @param array $autoloads Array of autoload settings defined defined by the packages.
|
292 |
+
* @param Filesystem $filesystem Filesystem class instance.
|
293 |
+
* @param string $vendorPath Path to the vendor directory.
|
294 |
+
* @param string $basePath Base Path.
|
295 |
*
|
296 |
+
* @return string $fileMap
|
297 |
+
*/
|
298 |
+
private function getFileMap( array $autoloads, Filesystem $filesystem, $vendorPath, $basePath ) {
|
299 |
+
$fileMapString = '';
|
300 |
+
foreach ( $autoloads['files'] as $file_id => $package ) {
|
301 |
+
$key = var_export( $file_id, true );
|
302 |
+
$pathCode = $this->getPathCode( $filesystem, $basePath, $vendorPath, $package['path'] );
|
303 |
+
$versionCode = var_export( $package['version'], true );
|
304 |
+
$fileMapString .= <<<FILE_CODE
|
305 |
+
$key => array(
|
306 |
+
'version' => $versionCode,
|
307 |
+
'path' => $pathCode
|
308 |
+
),
|
309 |
+
FILE_CODE;
|
310 |
+
$fileMapString .= PHP_EOL;
|
311 |
+
}
|
312 |
+
|
313 |
+
return 'array( ' . PHP_EOL . $fileMapString . ');' . PHP_EOL;
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Generate the PHP that will be used in the autoload_files_package.php files.
|
318 |
+
*
|
319 |
+
* @param string $filesMap files array as string that is to be written out to the file.
|
320 |
*
|
321 |
* @return string
|
322 |
*/
|
323 |
+
private function getAutoloadFilesPackagesFile( $filesMap ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
+
return <<<INCLUDE_FILEMAP
|
326 |
+
<?php
|
|
|
|
|
327 |
|
328 |
+
// This file `autoload_files_packages.php` was auto generated by automattic/jetpack-autoloader.
|
|
|
|
|
329 |
|
330 |
+
\$vendorDir = dirname(__DIR__);
|
331 |
+
\$baseDir = dirname(\$vendorDir);
|
332 |
+
|
333 |
+
return $filesMap
|
|
|
334 |
|
335 |
+
INCLUDE_FILEMAP;
|
336 |
+
}
|
337 |
|
338 |
+
/**
|
339 |
+
* Generate the PHP that will be used in the autoload_packages.php files.
|
340 |
+
*
|
341 |
+
* @param String $filename a file to prepare.
|
342 |
+
* @param String $suffix Unique suffix used in the namespace.
|
343 |
+
*
|
344 |
+
* @return string
|
345 |
+
*/
|
346 |
+
private function getAutoloadPackageFile( $filename, $suffix ) {
|
347 |
+
$header = self::COMMENT;
|
348 |
+
$header .= PHP_EOL;
|
349 |
+
$header .= 'namespace Automattic\Jetpack\Autoloader\jp' . $suffix . ';';
|
350 |
+
$header .= PHP_EOL . PHP_EOL;
|
351 |
+
|
352 |
+
$sourceLoader = fopen( __DIR__ . '/' . $filename, 'r' );
|
353 |
+
$file_contents = stream_get_contents( $sourceLoader );
|
354 |
+
return str_replace(
|
355 |
+
'/* HEADER */',
|
356 |
+
$header,
|
357 |
+
$file_contents
|
358 |
+
);
|
359 |
}
|
360 |
}
|
vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
/**
|
3 |
* Custom Autoloader Composer Plugin, hooks into composer events to generate the custom autoloader.
|
4 |
*
|
@@ -53,10 +53,39 @@ class CustomAutoloaderPlugin implements PluginInterface, EventSubscriberInterfac
|
|
53 |
$this->io = $io;
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
/**
|
57 |
* Tell composer to listen for events and do something with them.
|
58 |
*
|
59 |
-
* @return array List of
|
60 |
*/
|
61 |
public static function getSubscribedEvents() {
|
62 |
return array(
|
@@ -71,11 +100,19 @@ class CustomAutoloaderPlugin implements PluginInterface, EventSubscriberInterfac
|
|
71 |
*/
|
72 |
public function postAutoloadDump( Event $event ) {
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
$installationManager = $this->composer->getInstallationManager();
|
75 |
$repoManager = $this->composer->getRepositoryManager();
|
76 |
$localRepo = $repoManager->getLocalRepository();
|
77 |
$package = $this->composer->getPackage();
|
78 |
-
$config = $this->composer->getConfig();
|
79 |
$optimize = true;
|
80 |
$suffix = $config->get( 'autoloader-suffix' )
|
81 |
? $config->get( 'autoloader-suffix' )
|
1 |
+
<?php //phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase
|
2 |
/**
|
3 |
* Custom Autoloader Composer Plugin, hooks into composer events to generate the custom autoloader.
|
4 |
*
|
53 |
$this->io = $io;
|
54 |
}
|
55 |
|
56 |
+
/**
|
57 |
+
* Do nothing.
|
58 |
+
* phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
59 |
+
*
|
60 |
+
* @param Composer $composer Composer object.
|
61 |
+
* @param IOInterface $io IO object.
|
62 |
+
*/
|
63 |
+
public function deactivate( Composer $composer, IOInterface $io ) {
|
64 |
+
/*
|
65 |
+
* Intentionally left empty. This is a PluginInterface method.
|
66 |
+
* phpcs:enable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
67 |
+
*/
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Do nothing.
|
72 |
+
* phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
73 |
+
*
|
74 |
+
* @param Composer $composer Composer object.
|
75 |
+
* @param IOInterface $io IO object.
|
76 |
+
*/
|
77 |
+
public function uninstall( Composer $composer, IOInterface $io ) {
|
78 |
+
/*
|
79 |
+
* Intentionally left empty. This is a PluginInterface method.
|
80 |
+
* phpcs:enable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
81 |
+
*/
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
/**
|
86 |
* Tell composer to listen for events and do something with them.
|
87 |
*
|
88 |
+
* @return array List of subscribed events.
|
89 |
*/
|
90 |
public static function getSubscribedEvents() {
|
91 |
return array(
|
100 |
*/
|
101 |
public function postAutoloadDump( Event $event ) {
|
102 |
|
103 |
+
$config = $this->composer->getConfig();
|
104 |
+
|
105 |
+
if ( 'vendor' !== $config->raw()['config']['vendor-dir'] ) {
|
106 |
+
$this->io->writeError( "\n<error>An error occurred while generating the autoloader files:", true );
|
107 |
+
$this->io->writeError( 'The project\'s composer.json or composer environment set a non-default vendor directory.', true );
|
108 |
+
$this->io->writeError( 'The default composer vendor directory must be used.</error>', true );
|
109 |
+
exit();
|
110 |
+
}
|
111 |
+
|
112 |
$installationManager = $this->composer->getInstallationManager();
|
113 |
$repoManager = $this->composer->getRepositoryManager();
|
114 |
$localRepo = $repoManager->getLocalRepository();
|
115 |
$package = $this->composer->getPackage();
|
|
|
116 |
$optimize = true;
|
117 |
$suffix = $config->get( 'autoloader-suffix' )
|
118 |
? $config->get( 'autoloader-suffix' )
|
vendor/automattic/jetpack-autoloader/src/autoload.php
CHANGED
@@ -1,121 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* This file `autoload_packages.php`was generated by automattic/jetpack-autoloader.
|
4 |
-
*
|
5 |
-
* From your plugin include this file with:
|
6 |
-
* require_once . plugin_dir_path( __FILE__ ) . '/vendor/autoload_packages.php';
|
7 |
-
*
|
8 |
-
* @package automattic/jetpack-autoloader
|
9 |
-
*/
|
10 |
|
11 |
-
|
12 |
-
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_namespaceFound
|
13 |
-
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_ns_cFound
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
if ( ! function_exists( __NAMESPACE__ . '\enqueue_package_class' ) ) {
|
18 |
-
global $jetpack_packages_classes;
|
19 |
-
|
20 |
-
if ( ! is_array( $jetpack_packages_classes ) ) {
|
21 |
-
$jetpack_packages_classes = array();
|
22 |
-
}
|
23 |
-
/**
|
24 |
-
* Adds the version of a package to the $jetpack_packages global array so that
|
25 |
-
* the autoloader is able to find it.
|
26 |
-
*
|
27 |
-
* @param string $class_name Name of the class that you want to autoload.
|
28 |
-
* @param string $version Version of the class.
|
29 |
-
* @param string $path Absolute path to the class so that we can load it.
|
30 |
-
*/
|
31 |
-
function enqueue_package_class( $class_name, $version, $path ) {
|
32 |
-
global $jetpack_packages_classes;
|
33 |
-
|
34 |
-
if ( ! isset( $jetpack_packages_classes[ $class_name ] ) ) {
|
35 |
-
$jetpack_packages_classes[ $class_name ] = array(
|
36 |
-
'version' => $version,
|
37 |
-
'path' => $path,
|
38 |
-
);
|
39 |
-
}
|
40 |
-
// If we have a @dev version set always use that one!
|
41 |
-
if ( 'dev-' === substr( $jetpack_packages_classes[ $class_name ]['version'], 0, 4 ) ) {
|
42 |
-
return;
|
43 |
-
}
|
44 |
-
|
45 |
-
// Always favour the @dev version. Since that version is the same as bleeding edge.
|
46 |
-
// We need to make sure that we don't do this in production!
|
47 |
-
if ( 'dev-' === substr( $version, 0, 4 ) ) {
|
48 |
-
$jetpack_packages_classes[ $class_name ] = array(
|
49 |
-
'version' => $version,
|
50 |
-
'path' => $path,
|
51 |
-
);
|
52 |
-
|
53 |
-
return;
|
54 |
-
}
|
55 |
-
// Set the latest version!
|
56 |
-
if ( version_compare( $jetpack_packages_classes[ $class_name ]['version'], $version, '<' ) ) {
|
57 |
-
$jetpack_packages_classes[ $class_name ] = array(
|
58 |
-
'version' => $version,
|
59 |
-
'path' => $path,
|
60 |
-
);
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( ! function_exists( __NAMESPACE__ . '\autoloader' ) ) {
|
66 |
-
/**
|
67 |
-
* Used for autoloading jetpack packages.
|
68 |
-
*
|
69 |
-
* @param string $class_name Class Name to load.
|
70 |
-
*/
|
71 |
-
function autoloader( $class_name ) {
|
72 |
-
global $jetpack_packages_classes;
|
73 |
-
|
74 |
-
if ( isset( $jetpack_packages_classes[ $class_name ] ) ) {
|
75 |
-
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
76 |
-
// TODO ideally we shouldn't skip any of these, see: https://github.com/Automattic/jetpack/pull/12646.
|
77 |
-
$ignore = in_array(
|
78 |
-
$class_name,
|
79 |
-
array(
|
80 |
-
'Automattic\Jetpack\JITM',
|
81 |
-
'Automattic\Jetpack\Connection\Manager',
|
82 |
-
'Automattic\Jetpack\Connection\Manager_Interface',
|
83 |
-
'Automattic\Jetpack\Connection\XMLRPC_Connector',
|
84 |
-
'Jetpack_IXR_Client',
|
85 |
-
'Jetpack_Options',
|
86 |
-
'Jetpack_Signature',
|
87 |
-
'Jetpack_XMLRPC_Server',
|
88 |
-
'Automattic\Jetpack\Sync\Main',
|
89 |
-
'Automattic\Jetpack\Constants',
|
90 |
-
'Automattic\Jetpack\Tracking',
|
91 |
-
'Automattic\Jetpack\Plugin\Tracking',
|
92 |
-
),
|
93 |
-
true
|
94 |
-
);
|
95 |
-
if ( ! $ignore && function_exists( 'did_action' ) && ! did_action( 'plugins_loaded' ) ) {
|
96 |
-
_doing_it_wrong(
|
97 |
-
esc_html( $class_name ),
|
98 |
-
sprintf(
|
99 |
-
/* translators: %s Name of a PHP Class */
|
100 |
-
esc_html__( 'Not all plugins have loaded yet but we requested the class %s', 'jetpack' ),
|
101 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
102 |
-
$class_name
|
103 |
-
),
|
104 |
-
esc_html( $jetpack_packages_classes[ $class_name ]['version'] )
|
105 |
-
);
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
if ( file_exists( $jetpack_packages_classes[ $class_name ]['path'] ) ) {
|
110 |
-
require_once $jetpack_packages_classes[ $class_name ]['path'];
|
111 |
-
|
112 |
-
return true;
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
return false;
|
117 |
-
}
|
118 |
-
|
119 |
-
// Add the jetpack autoloader.
|
120 |
-
spl_autoload_register( __NAMESPACE__ . '\autoloader' );
|
121 |
-
}
|
1 |
<?php
|
2 |
+
/* HEADER */ // phpcs:ignore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
require_once trailingslashit( dirname( __FILE__ ) ) . '/autoload_functions.php';
|
|
|
|
|
5 |
|
6 |
+
set_up_autoloader();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/automattic/jetpack-autoloader/src/class-autoloader-handler.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* HEADER */ // phpcs:ignore
|
3 |
+
|
4 |
+
/**
|
5 |
+
* This class selects the package version for the autoloader.
|
6 |
+
*/
|
7 |
+
class Autoloader_Handler {
|
8 |
+
|
9 |
+
// The name of the autoloader function registered by v1.* autoloaders.
|
10 |
+
const V1_AUTOLOADER_NAME = 'Automattic\Jetpack\Autoloader\autoloader';
|
11 |
+
|
12 |
+
/*
|
13 |
+
* The autoloader function for v2.* autoloaders is named __NAMESPACE__ . \autoloader.
|
14 |
+
* The namespace is defined in AutoloadGenerator as
|
15 |
+
* 'Automattic\Jetpack\Autoloader\jp' plus a unique suffix.
|
16 |
+
*/
|
17 |
+
const V2_AUTOLOADER_BASE = 'Automattic\Jetpack\Autoloader\jp';
|
18 |
+
|
19 |
+
const AUTOLOAD_GENERATOR_CLASS_NAME = 'Automattic\Jetpack\Autoloader\AutoloadGenerator';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* The Plugins_Handler object.
|
23 |
+
*
|
24 |
+
* @var Plugins_Handler
|
25 |
+
*/
|
26 |
+
private $plugins_handler = null;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* The Version_Selector object.
|
30 |
+
*
|
31 |
+
* @var Version_Selector
|
32 |
+
*/
|
33 |
+
private $version_selector = null;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The constructor.
|
37 |
+
*
|
38 |
+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
39 |
+
* @param Version_Selector $version_selector The Version_Selector object.
|
40 |
+
*/
|
41 |
+
public function __construct( $plugins_handler, $version_selector ) {
|
42 |
+
$this->plugins_handler = $plugins_handler;
|
43 |
+
$this->version_selector = $version_selector;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Finds the latest installed autoloader.
|
48 |
+
*/
|
49 |
+
public function find_latest_autoloader() {
|
50 |
+
global $jetpack_autoloader_latest_version;
|
51 |
+
|
52 |
+
$current_autoloader_path = trailingslashit( dirname( __FILE__ ) ) . 'autoload_packages.php';
|
53 |
+
$current_autoloader_path = str_replace( '\\', '/', $current_autoloader_path );
|
54 |
+
|
55 |
+
$selected_autoloader_version = null;
|
56 |
+
$selected_autoloader_path = null;
|
57 |
+
|
58 |
+
$active_plugins_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
59 |
+
|
60 |
+
foreach ( $active_plugins_paths as $plugin_path ) {
|
61 |
+
$classmap_path = trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
|
62 |
+
|
63 |
+
if ( file_exists( $classmap_path ) ) {
|
64 |
+
$packages = require $classmap_path;
|
65 |
+
|
66 |
+
$compare_version = $packages[ self::AUTOLOAD_GENERATOR_CLASS_NAME ]['version'];
|
67 |
+
$compare_path = trailingslashit( $plugin_path ) . 'vendor/autoload_packages.php';
|
68 |
+
|
69 |
+
if ( $this->version_selector->is_version_update_required( $selected_autoloader_version, $compare_version ) ) {
|
70 |
+
$selected_autoloader_version = $compare_version;
|
71 |
+
$selected_autoloader_path = $compare_path;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
$jetpack_autoloader_latest_version = $selected_autoloader_version;
|
77 |
+
|
78 |
+
// $current_autoloader_path is already loaded
|
79 |
+
if ( $current_autoloader_path !== $selected_autoloader_path ) {
|
80 |
+
require $selected_autoloader_path;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Get this autoloader's package version.
|
86 |
+
*
|
87 |
+
* @return String The autoloader's package version.
|
88 |
+
*/
|
89 |
+
public function get_current_autoloader_version() {
|
90 |
+
$classmap_file = trailingslashit( dirname( __FILE__ ) ) . 'composer/jetpack_autoload_classmap.php';
|
91 |
+
$autoloader_packages = require $classmap_file;
|
92 |
+
|
93 |
+
return $autoloader_packages[ self::AUTOLOAD_GENERATOR_CLASS_NAME ]['version'];
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Updates the spl autoloader chain:
|
99 |
+
* - Registers this namespace's autoloader function.
|
100 |
+
* - If a v1 autoloader function is registered, moves it to the end of the chain.
|
101 |
+
* - Removes any other v2 autoloader functions that have already been registered. This
|
102 |
+
* can occur when the autoloader is being reset by an activating plugin.
|
103 |
+
*/
|
104 |
+
public function update_autoloader_chain() {
|
105 |
+
spl_autoload_register( __NAMESPACE__ . '\autoloader' );
|
106 |
+
|
107 |
+
$autoload_chain = spl_autoload_functions();
|
108 |
+
|
109 |
+
foreach ( $autoload_chain as $autoloader ) {
|
110 |
+
if ( ! is_string( $autoloader ) ) {
|
111 |
+
/*
|
112 |
+
* The Jetpack Autoloader functions are registered as strings, so
|
113 |
+
* just continue if $autoloader isn't a string.
|
114 |
+
*/
|
115 |
+
continue;
|
116 |
+
}
|
117 |
+
|
118 |
+
if ( self::V1_AUTOLOADER_NAME === $autoloader ) {
|
119 |
+
// Move the v1.* autoloader function to the end of the spl autoloader chain.
|
120 |
+
spl_autoload_unregister( $autoloader );
|
121 |
+
spl_autoload_register( $autoloader );
|
122 |
+
|
123 |
+
} elseif (
|
124 |
+
self::V2_AUTOLOADER_BASE === substr( $autoloader, 0, strlen( self::V2_AUTOLOADER_BASE ) )
|
125 |
+
&& __NAMESPACE__ !== substr( $autoloader, 0, strlen( __NAMESPACE__ ) )
|
126 |
+
) {
|
127 |
+
// Unregister any other v2.* autoloader functions if they're in the chain.
|
128 |
+
spl_autoload_unregister( $autoloader );
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
vendor/automattic/jetpack-autoloader/src/class-classes-handler.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* HEADER */ // phpcs:ignore
|
3 |
+
|
4 |
+
/**
|
5 |
+
* This class selects the package versions for the package classes.
|
6 |
+
*/
|
7 |
+
class Classes_Handler {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* The Plugins_Handler object.
|
11 |
+
*
|
12 |
+
* @var Plugins_Handler
|
13 |
+
*/
|
14 |
+
private $plugins_handler = null;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The Version_Selector object.
|
18 |
+
*
|
19 |
+
* @var Version_Selector
|
20 |
+
*/
|
21 |
+
private $version_selector = null;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The constructor.
|
25 |
+
*
|
26 |
+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
27 |
+
* @param Version_Selector $version_selector The Version_Selector object.
|
28 |
+
*/
|
29 |
+
public function __construct( $plugins_handler, $version_selector ) {
|
30 |
+
$this->plugins_handler = $plugins_handler;
|
31 |
+
$this->version_selector = $version_selector;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Adds the version of a package to the $jetpack_packages_classmap global
|
36 |
+
* array so that the autoloader is able to find it.
|
37 |
+
*
|
38 |
+
* @param string $class_name Name of the class that you want to autoload.
|
39 |
+
* @param string $version Version of the class.
|
40 |
+
* @param string $path Absolute path to the class so that we can load it.
|
41 |
+
*/
|
42 |
+
public function enqueue_package_class( $class_name, $version, $path ) {
|
43 |
+
global $jetpack_packages_classmap;
|
44 |
+
|
45 |
+
if ( isset( $jetpack_packages_classmap[ $class_name ]['version'] ) ) {
|
46 |
+
$selected_version = $jetpack_packages_classmap[ $class_name ]['version'];
|
47 |
+
} else {
|
48 |
+
$selected_version = null;
|
49 |
+
}
|
50 |
+
|
51 |
+
if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
|
52 |
+
$jetpack_packages_classmap[ $class_name ] = array(
|
53 |
+
'version' => $version,
|
54 |
+
'path' => $path,
|
55 |
+
);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Creates the path to the plugin's classmap file. The classmap filename is the filename
|
61 |
+
* generated by Jetpack Autoloader version >= 2.0.
|
62 |
+
*
|
63 |
+
* @param String $plugin_path The plugin path.
|
64 |
+
*
|
65 |
+
* @return String the classmap path.
|
66 |
+
*/
|
67 |
+
public function create_classmap_path( $plugin_path ) {
|
68 |
+
return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Initializes the classmap.
|
73 |
+
*/
|
74 |
+
public function set_class_paths() {
|
75 |
+
$active_plugins_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
76 |
+
$classmap_paths = array_map( array( $this, 'create_classmap_path' ), $active_plugins_paths );
|
77 |
+
|
78 |
+
foreach ( $classmap_paths as $path ) {
|
79 |
+
if ( is_readable( $path ) ) {
|
80 |
+
$class_map = require $path;
|
81 |
+
|
82 |
+
if ( is_array( $class_map ) ) {
|
83 |
+
foreach ( $class_map as $class_name => $class_info ) {
|
84 |
+
$this->enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
vendor/automattic/jetpack-autoloader/src/class-files-handler.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* HEADER */ // phpcs:ignore
|
3 |
+
|
4 |
+
/**
|
5 |
+
* This class selects the package versions for the package files.
|
6 |
+
*/
|
7 |
+
class Files_Handler {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* The Plugins_Handler object.
|
11 |
+
*
|
12 |
+
* @var Plugins_Handler
|
13 |
+
*/
|
14 |
+
private $plugins_handler = null;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The Version_Selector object.
|
18 |
+
*
|
19 |
+
* @var Version_Selector
|
20 |
+
*/
|
21 |
+
private $version_selector = null;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The constructor.
|
25 |
+
*
|
26 |
+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
27 |
+
* @param Version_Selector $version_selector The Version_Selector object.
|
28 |
+
*/
|
29 |
+
public function __construct( $plugins_handler, $version_selector ) {
|
30 |
+
$this->plugins_handler = $plugins_handler;
|
31 |
+
$this->version_selector = $version_selector;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Adds the version of a package file to the $jetpack_packages_filemap global
|
36 |
+
* array so that we can load the most recent version.
|
37 |
+
*
|
38 |
+
* @param string $file_identifier Unique id to file assigned by composer based on package name and filename.
|
39 |
+
* @param string $version Version of the file.
|
40 |
+
* @param string $path Absolute path to the file so that we can load it.
|
41 |
+
*/
|
42 |
+
public function enqueue_package_file( $file_identifier, $version, $path ) {
|
43 |
+
global $jetpack_packages_filemap;
|
44 |
+
|
45 |
+
if ( isset( $jetpack_packages_filemap[ $file_identifier ]['version'] ) ) {
|
46 |
+
$selected_version = $jetpack_packages_filemap[ $file_identifier ]['version'];
|
47 |
+
} else {
|
48 |
+
$selected_version = null;
|
49 |
+
}
|
50 |
+
|
51 |
+
if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
|
52 |
+
$jetpack_packages_filemap[ $file_identifier ] = array(
|
53 |
+
'version' => $version,
|
54 |
+
'path' => $path,
|
55 |
+
);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Creates a path to the plugin's filemap. The filemap filename is the filename
|
61 |
+
* generated by Jetpack Autoloader version >= 2.0.
|
62 |
+
*
|
63 |
+
* @param String $plugin_path The plugin path.
|
64 |
+
*
|
65 |
+
* @return String The filemap path
|
66 |
+
*/
|
67 |
+
public function create_filemap_path( $plugin_path ) {
|
68 |
+
return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_filemap.php';
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Initializes the filemap.
|
73 |
+
*/
|
74 |
+
public function set_file_paths() {
|
75 |
+
$active_plugin_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
76 |
+
$filemap_paths = array_map( array( $this, 'create_filemap_path' ), $active_plugin_paths );
|
77 |
+
|
78 |
+
foreach ( $filemap_paths as $path ) {
|
79 |
+
if ( is_readable( $path ) ) {
|
80 |
+
$file_map = require $path;
|
81 |
+
|
82 |
+
if ( is_array( $file_map ) ) {
|
83 |
+
foreach ( $file_map as $file_identifier => $file_data ) {
|
84 |
+
$this->enqueue_package_file( $file_identifier, $file_data['version'], $file_data['path'] );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Include latest version of all enqueued files.
|
93 |
+
*/
|
94 |
+
public function file_loader() {
|
95 |
+
global $jetpack_packages_filemap;
|
96 |
+
foreach ( $jetpack_packages_filemap as $file_identifier => $file_data ) {
|
97 |
+
if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
|
98 |
+
require_once $file_data['path'];
|
99 |
+
|
100 |
+
$GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* HEADER */ // phpcs:ignore
|
3 |
+
|
4 |
+
/**
|
5 |
+
* This class provides information about the current plugin and the site's active plugins.
|
6 |
+
*/
|
7 |
+
class Plugins_Handler {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Returns an array containing the paths of all active plugins and all known activating plugins.
|
11 |
+
*
|
12 |
+
* @return array An array of plugin paths as strings or an empty array.
|
13 |
+
*/
|
14 |
+
public function get_all_active_plugins_paths() {
|
15 |
+
global $jetpack_autoloader_activating_plugins_paths;
|
16 |
+
|
17 |
+
$active_plugins_paths = $this->get_active_plugins_paths();
|
18 |
+
$multisite_plugins_paths = $this->get_multisite_plugins_paths();
|
19 |
+
$active_plugins_paths = array_merge( $multisite_plugins_paths, $active_plugins_paths );
|
20 |
+
|
21 |
+
$activating_plugins_paths = $this->get_plugins_activating_via_request();
|
22 |
+
$activating_plugins_paths = array_unique( array_merge( $activating_plugins_paths, $jetpack_autoloader_activating_plugins_paths ) );
|
23 |
+
|
24 |
+
$plugins_paths = array_unique( array_merge( $active_plugins_paths, $activating_plugins_paths ) );
|
25 |
+
|
26 |
+
return $plugins_paths;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Returns an array containing the paths of the active sitewide plugins in a multisite environment.
|
31 |
+
*
|
32 |
+
* @return array The paths of the active sitewide plugins or an empty array.
|
33 |
+
*/
|
34 |
+
protected function get_multisite_plugins_paths() {
|
35 |
+
$plugin_slugs = is_multisite()
|
36 |
+
? array_keys( get_site_option( 'active_sitewide_plugins', array() ) )
|
37 |
+
: array();
|
38 |
+
|
39 |
+
$plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
|
40 |
+
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns an array containing the paths of the currently active plugins.
|
45 |
+
*
|
46 |
+
* @return array The active plugins' paths or an empty array.
|
47 |
+
*/
|
48 |
+
protected function get_active_plugins_paths() {
|
49 |
+
$plugin_slugs = (array) get_option( 'active_plugins', array() );
|
50 |
+
$plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
|
51 |
+
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Adds the plugin directory from the WP_PLUGIN_DIR constant to the plugin slug.
|
56 |
+
*
|
57 |
+
* @param string $plugin_slug The plugin slug.
|
58 |
+
*/
|
59 |
+
private function create_plugin_path( $plugin_slug ) {
|
60 |
+
$plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR );
|
61 |
+
return trailingslashit( $plugin_dir ) . substr( $plugin_slug, 0, strrpos( $plugin_slug, '/' ) );
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Ensure the plugin has its own directory and not a single-file plugin.
|
66 |
+
*
|
67 |
+
* @param string $plugin Plugin name, may be prefixed with "/".
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function is_directory_plugin( $plugin ) {
|
72 |
+
return strlen( $plugin ) > 1 && false !== strpos( $plugin, '/', 1 );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Checks whether the autoloader should be reset. The autoloader should be reset
|
77 |
+
* when a plugin is activating via a method other than a request, for example
|
78 |
+
* using WP-CLI. When this occurs, the activating plugin was not known when
|
79 |
+
* the autoloader selected the package versions for the classmap and filemap
|
80 |
+
* globals, so the autoloader must reselect the versions.
|
81 |
+
*
|
82 |
+
* If the current plugin is not already known, this method will add it to the
|
83 |
+
* $jetpack_autoloader_activating_plugins_paths global.
|
84 |
+
*
|
85 |
+
* @return boolean True if the autoloder must be reset, else false.
|
86 |
+
*/
|
87 |
+
public function should_autoloader_reset() {
|
88 |
+
global $jetpack_autoloader_activating_plugins_paths;
|
89 |
+
|
90 |
+
$plugins_paths = $this->get_all_active_plugins_paths();
|
91 |
+
$current_plugin_path = $this->get_current_plugin_path();
|
92 |
+
$plugin_unknown = ! in_array( $current_plugin_path, $plugins_paths, true );
|
93 |
+
|
94 |
+
if ( $plugin_unknown ) {
|
95 |
+
// If the current plugin isn't known, add it to the activating plugins list.
|
96 |
+
$jetpack_autoloader_activating_plugins_paths[] = $current_plugin_path;
|
97 |
+
}
|
98 |
+
|
99 |
+
return $plugin_unknown;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Returns an array containing the names of plugins that are activating via a request.
|
104 |
+
*
|
105 |
+
* @return array An array of names of the activating plugins or an empty array.
|
106 |
+
*/
|
107 |
+
private function get_plugins_activating_via_request() {
|
108 |
+
|
109 |
+
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
110 |
+
|
111 |
+
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
|
112 |
+
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : false;
|
113 |
+
$nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : false;
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Note: we're not actually checking the nonce here becase it's too early
|
117 |
+
* in the execution. The pluggable functions are not yet loaded to give
|
118 |
+
* plugins a chance to plug their versions. Therefore we're doing the bare
|
119 |
+
* minimum: checking whether the nonce exists and it's in the right place.
|
120 |
+
* The request will fail later if the nonce doesn't pass the check.
|
121 |
+
*/
|
122 |
+
|
123 |
+
// In case of a single plugin activation there will be a plugin slug.
|
124 |
+
if ( 'activate' === $action && ! empty( $nonce ) ) {
|
125 |
+
return array( $this->create_plugin_path( wp_unslash( $plugin ) ) );
|
126 |
+
}
|
127 |
+
|
128 |
+
$plugins = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array();
|
129 |
+
|
130 |
+
// In case of bulk activation there will be an array of plugins.
|
131 |
+
if ( 'activate-selected' === $action && ! empty( $nonce ) ) {
|
132 |
+
$plugin_slugs = array_map( 'wp_unslash', $plugins );
|
133 |
+
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
134 |
+
}
|
135 |
+
|
136 |
+
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
137 |
+
return array();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Returns the path of the current plugin.
|
142 |
+
*
|
143 |
+
* @return string The path of the current plugin.
|
144 |
+
*/
|
145 |
+
public function get_current_plugin_path() {
|
146 |
+
$vendor_path = str_replace( '\\', '/', dirname( __FILE__ ) );
|
147 |
+
// Path to the plugin's folder (the parent of the vendor folder).
|
148 |
+
return substr( $vendor_path, 0, strrpos( $vendor_path, '/' ) );
|
149 |
+
}
|
150 |
+
}
|
vendor/automattic/jetpack-autoloader/src/class-version-selector.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* HEADER */ // phpcs:ignore
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Used to select package versions.
|
6 |
+
*/
|
7 |
+
class Version_Selector {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Checks whether the selected package version should be updated. Composer development
|
11 |
+
* package versions ('9999999-dev' or versions that start with 'dev-') are favored
|
12 |
+
* when the JETPACK_AUTOLOAD_DEV constant is set to true.
|
13 |
+
*
|
14 |
+
* @param String $selected_version The currently selected package version.
|
15 |
+
* @param String $compare_version The package version that is being evaluated to
|
16 |
+
* determine if the version needs to be updated.
|
17 |
+
*
|
18 |
+
* @return Boolean Returns true if the selected package version should be updated,
|
19 |
+
* else false.
|
20 |
+
*/
|
21 |
+
public function is_version_update_required( $selected_version, $compare_version ) {
|
22 |
+
$use_dev_versions = defined( 'JETPACK_AUTOLOAD_DEV' ) && JETPACK_AUTOLOAD_DEV;
|
23 |
+
|
24 |
+
if ( is_null( $selected_version ) ) {
|
25 |
+
return true;
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( $use_dev_versions && $this->is_package_version_dev( $selected_version ) ) {
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( $this->is_package_version_dev( $compare_version ) ) {
|
33 |
+
if ( $use_dev_versions ) {
|
34 |
+
return true;
|
35 |
+
} else {
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
if ( version_compare( $selected_version, $compare_version, '<' ) ) {
|
41 |
+
return true;
|
42 |
+
}
|
43 |
+
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Checks whether the given package version is a development version.
|
49 |
+
*
|
50 |
+
* @param String $version The package version.
|
51 |
+
*
|
52 |
+
* @return Boolean True if the version is a dev version, else false.
|
53 |
+
*/
|
54 |
+
private function is_package_version_dev( $version ) {
|
55 |
+
if ( 'dev-' === substr( $version, 0, 4 ) || '9999999-dev' === $version ) {
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
}
|
vendor/automattic/jetpack-autoloader/src/functions.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* HEADER */ // phpcs:ignore
|
3 |
+
|
4 |
+
global $jetpack_packages_classmap;
|
5 |
+
global $jetpack_packages_filemap;
|
6 |
+
global $jetpack_autoloader_activating_plugins_paths;
|
7 |
+
|
8 |
+
if ( ! is_array( $jetpack_packages_classmap ) ) {
|
9 |
+
$jetpack_packages_classmap = array();
|
10 |
+
}
|
11 |
+
|
12 |
+
if ( ! is_array( $jetpack_packages_filemap ) ) {
|
13 |
+
$jetpack_packages_filemap = array();
|
14 |
+
}
|
15 |
+
|
16 |
+
if ( ! is_array( $jetpack_autoloader_activating_plugins_paths ) ) {
|
17 |
+
$jetpack_autoloader_activating_plugins_paths = array();
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Used for autoloading jetpack packages.
|
22 |
+
*
|
23 |
+
* @param string $class_name Class Name to load.
|
24 |
+
*
|
25 |
+
* @return Boolean Whether the class_name was found in the classmap.
|
26 |
+
*/
|
27 |
+
function autoloader( $class_name ) {
|
28 |
+
global $jetpack_packages_classmap;
|
29 |
+
|
30 |
+
if ( isset( $jetpack_packages_classmap[ $class_name ] ) ) {
|
31 |
+
require_once $jetpack_packages_classmap[ $class_name ]['path'];
|
32 |
+
return true;
|
33 |
+
}
|
34 |
+
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Used for running the code that initializes class and file maps.
|
40 |
+
*
|
41 |
+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
42 |
+
* @param Version_Selector $version_selector The Version_Selector object.
|
43 |
+
*/
|
44 |
+
function enqueue_files( $plugins_handler, $version_selector ) {
|
45 |
+
require_once __DIR__ . '/class-classes-handler.php';
|
46 |
+
require_once __DIR__ . '/class-files-handler.php';
|
47 |
+
|
48 |
+
$classes_handler = new Classes_Handler( $plugins_handler, $version_selector );
|
49 |
+
$classes_handler->set_class_paths();
|
50 |
+
|
51 |
+
$files_handler = new Files_Handler( $plugins_handler, $version_selector );
|
52 |
+
$files_handler->set_file_paths();
|
53 |
+
|
54 |
+
$files_handler->file_loader();
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Finds the latest installed autoloader. If this is the latest autoloader, sets
|
59 |
+
* up the classmap and filemap.
|
60 |
+
*/
|
61 |
+
function set_up_autoloader() {
|
62 |
+
global $jetpack_autoloader_latest_version;
|
63 |
+
global $jetpack_packages_classmap;
|
64 |
+
|
65 |
+
require_once __DIR__ . '/class-plugins-handler.php';
|
66 |
+
require_once __DIR__ . '/class-version-selector.php';
|
67 |
+
require_once __DIR__ . '/class-autoloader-handler.php';
|
68 |
+
|
69 |
+
$plugins_handler = new Plugins_Handler();
|
70 |
+
$version_selector = new Version_Selector();
|
71 |
+
$autoloader_handler = new Autoloader_Handler( $plugins_handler, $version_selector );
|
72 |
+
|
73 |
+
if ( $plugins_handler->should_autoloader_reset() ) {
|
74 |
+
/*
|
75 |
+
* The autoloader must be reset when an activating plugin that was
|
76 |
+
* previously unknown is detected.
|
77 |
+
*/
|
78 |
+
$jetpack_autoloader_latest_version = null;
|
79 |
+
$jetpack_packages_classmap = array();
|
80 |
+
}
|
81 |
+
|
82 |
+
// Find the latest autoloader.
|
83 |
+
if ( ! $jetpack_autoloader_latest_version ) {
|
84 |
+
$autoloader_handler->find_latest_autoloader();
|
85 |
+
}
|
86 |
+
|
87 |
+
$current_autoloader_version = $autoloader_handler->get_current_autoloader_version();
|
88 |
+
|
89 |
+
// This is the latest autoloader, so generate the classmap and filemap and register the autoloader function.
|
90 |
+
if ( empty( $jetpack_packages_classmap ) && $current_autoloader_version === $jetpack_autoloader_latest_version ) {
|
91 |
+
enqueue_files( $plugins_handler, $version_selector );
|
92 |
+
$autoloader_handler->update_autoloader_chain();
|
93 |
+
add_filter( 'upgrader_post_install', __NAMESPACE__ . '\reset_maps_after_update', 0, 3 );
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Resets the autoloader after a plugin update.
|
99 |
+
*
|
100 |
+
* @param bool $response Installation response.
|
101 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
102 |
+
* @param array $result Installation result data.
|
103 |
+
*
|
104 |
+
* @return bool The passed in $response param.
|
105 |
+
*/
|
106 |
+
function reset_maps_after_update( $response, $hook_extra, $result ) {
|
107 |
+
global $jetpack_autoloader_latest_version;
|
108 |
+
global $jetpack_packages_classmap;
|
109 |
+
|
110 |
+
if ( isset( $hook_extra['plugin'] ) ) {
|
111 |
+
/*
|
112 |
+
* $hook_extra['plugin'] is the path to the plugin file relative to the plugins directory:
|
113 |
+
* https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/includes/class-wp-upgrader.php#L701
|
114 |
+
*/
|
115 |
+
$plugin = $hook_extra['plugin'];
|
116 |
+
|
117 |
+
if ( false === strpos( $plugin, '/', 1 ) ) {
|
118 |
+
// Single-file plugins don't use packages, so bail.
|
119 |
+
return $response;
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( ! is_plugin_active( $plugin ) ) {
|
123 |
+
// The updated plugin isn't active, so bail.
|
124 |
+
return $response;
|
125 |
+
}
|
126 |
+
|
127 |
+
/*
|
128 |
+
* $plugin is the path to the plugin file relative to the plugins directory.
|
129 |
+
*/
|
130 |
+
$plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR );
|
131 |
+
$plugin_path = trailingslashit( $plugin_dir ) . trailingslashit( explode( '/', $plugin )[0] );
|
132 |
+
|
133 |
+
if ( is_readable( $plugin_path . 'vendor/autoload_functions.php' ) ) {
|
134 |
+
// The plugin has a v2.x autoloader, so reset it.
|
135 |
+
$jetpack_autoloader_latest_version = null;
|
136 |
+
$jetpack_packages_classmap = array();
|
137 |
+
|
138 |
+
set_up_autoloader();
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
return $response;
|
143 |
+
}
|
144 |
+
|
vendor/automattic/jetpack-logo/src/class-logo.php
CHANGED
@@ -52,20 +52,39 @@ class Logo {
|
|
52 |
* @return string
|
53 |
*/
|
54 |
public function get_jp_emblem( $logotype = false ) {
|
55 |
-
$
|
56 |
-
$text = '
|
57 |
-
<path d="M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z" />
|
58 |
-
<path d="M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z" />
|
59 |
-
<path d="M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z" />
|
60 |
-
<path d="M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z" />
|
61 |
-
<path d="M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z" />
|
62 |
-
<path d="M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z" />
|
63 |
-
<path d="M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z" />
|
64 |
-
';
|
65 |
return sprintf(
|
66 |
'<svg id="jetpack-logo__icon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 %1$s 32">%2$s</svg>',
|
67 |
( true === $logotype ? '118' : '32' ),
|
68 |
-
( true === $logotype ? $logo . $text : $logo )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
);
|
70 |
}
|
71 |
}
|
52 |
* @return string
|
53 |
*/
|
54 |
public function get_jp_emblem( $logotype = false ) {
|
55 |
+
$logo_text = $this->get_jp_logo_parts();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
return sprintf(
|
57 |
'<svg id="jetpack-logo__icon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 %1$s 32">%2$s</svg>',
|
58 |
( true === $logotype ? '118' : '32' ),
|
59 |
+
( true === $logotype ? $logo_text['logo'] . $logo_text['text'] : $logo_text['logo'] )
|
60 |
+
);
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Return string containing the Jetpack logo in a slightly larger format than get_jp_emblem().
|
65 |
+
*
|
66 |
+
* @return string
|
67 |
+
*/
|
68 |
+
public function get_jp_emblem_larger() {
|
69 |
+
$logo_text = $this->get_jp_logo_parts();
|
70 |
+
return '<svg class="jitm-jp-logo" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" height="32" viewBox="0 0 118 32">' . $logo_text['logo'] . $logo_text['text'] . '</svg>';
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Return array containing the Jetpack logo and text
|
75 |
+
*
|
76 |
+
* @return array
|
77 |
+
*/
|
78 |
+
private function get_jp_logo_parts() {
|
79 |
+
return array(
|
80 |
+
'logo' => '<path fill="#00BE28" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16c8.8,0,16-7.2,16-16S24.8,0,16,0z M15.2,18.7h-8l8-15.5V18.7z M16.8,28.8 V13.3h8L16.8,28.8z"/>',
|
81 |
+
'text' => '<path d="M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z" />
|
82 |
+
<path d="M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z" />
|
83 |
+
<path d="M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z" />
|
84 |
+
<path d="M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z" />
|
85 |
+
<path d="M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z" />
|
86 |
+
<path d="M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z" />
|
87 |
+
<path d="M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z" />',
|
88 |
);
|
89 |
}
|
90 |
}
|
vendor/class-autoloader-handler.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file was automatically generated by automattic/jetpack-autoloader.
|
4 |
+
*
|
5 |
+
* @package automattic/jetpack-autoloader
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Automattic\Jetpack\Autoloader\jp8e4bd021160ba30631028144cededd1f;
|
9 |
+
|
10 |
+
// phpcs:ignore
|
11 |
+
|
12 |
+
/**
|
13 |
+
* This class selects the package version for the autoloader.
|
14 |
+
*/
|
15 |
+
class Autoloader_Handler {
|
16 |
+
|
17 |
+
// The name of the autoloader function registered by v1.* autoloaders.
|
18 |
+
const V1_AUTOLOADER_NAME = 'Automattic\Jetpack\Autoloader\autoloader';
|
19 |
+
|
20 |
+
/*
|
21 |
+
* The autoloader function for v2.* autoloaders is named __NAMESPACE__ . \autoloader.
|
22 |
+
* The namespace is defined in AutoloadGenerator as
|
23 |
+
* 'Automattic\Jetpack\Autoloader\jp' plus a unique suffix.
|
24 |
+
*/
|
25 |
+
const V2_AUTOLOADER_BASE = 'Automattic\Jetpack\Autoloader\jp';
|
26 |
+
|
27 |
+
const AUTOLOAD_GENERATOR_CLASS_NAME = 'Automattic\Jetpack\Autoloader\AutoloadGenerator';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* The Plugins_Handler object.
|
31 |
+
*
|
32 |
+
* @var Plugins_Handler
|
33 |
+
*/
|
34 |
+
private $plugins_handler = null;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* The Version_Selector object.
|
38 |
+
*
|
39 |
+
* @var Version_Selector
|
40 |
+
*/
|
41 |
+
private $version_selector = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* The constructor.
|
45 |
+
*
|
46 |
+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
47 |
+
* @param Version_Selector $version_selector The Version_Selector object.
|
48 |
+
*/
|
49 |
+
public function __construct( $plugins_handler, $version_selector ) {
|
50 |
+
$this->plugins_handler = $plugins_handler;
|
51 |
+
$this->version_selector = $version_selector;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Finds the latest installed autoloader.
|
56 |
+
*/
|
57 |
+
public function find_latest_autoloader() {
|
58 |
+
global $jetpack_autoloader_latest_version;
|
59 |
+
|
60 |
+
$current_autoloader_path = trailingslashit( dirname( __FILE__ ) ) . 'autoload_packages.php';
|
61 |
+
$current_autoloader_path = str_replace( '\\', '/', $current_autoloader_path );
|
62 |
+
|
63 |
+
$selected_autoloader_version = null;
|
64 |
+
$selected_autoloader_path = null;
|
65 |
+
|
66 |
+
$active_plugins_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
67 |
+
|
68 |
+
foreach ( $active_plugins_paths as $plugin_path ) {
|
69 |
+
$classmap_path = trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
|
70 |
+
|
71 |
+
if ( file_exists( $classmap_path ) ) {
|
72 |
+
$packages = require $classmap_path;
|
73 |
+
|
74 |
+
$compare_version = $packages[ self::AUTOLOAD_GENERATOR_CLASS_NAME ]['version'];
|
75 |
+
$compare_path = trailingslashit( $plugin_path ) . 'vendor/autoload_packages.php';
|
76 |
+
|
77 |
+
if ( $this->version_selector->is_version_update_required( $selected_autoloader_version, $compare_version ) ) {
|
78 |
+
$selected_autoloader_version = $compare_version;
|
79 |
+
$selected_autoloader_path = $compare_path;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
$jetpack_autoloader_latest_version = $selected_autoloader_version;
|
85 |
+
|
86 |
+
// $current_autoloader_path is already loaded
|
87 |
+
if ( $current_autoloader_path !== $selected_autoloader_path ) {
|
88 |
+
require $selected_autoloader_path;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Get this autoloader's package version.
|
94 |
+
*
|
95 |
+
* @return String The autoloader's package version.
|
96 |
+
*/
|
97 |
+
public function get_current_autoloader_version() {
|
98 |
+
$classmap_file = trailingslashit( dirname( __FILE__ ) ) . 'composer/jetpack_autoload_classmap.php';
|
99 |
+
$autoloader_packages = require $classmap_file;
|
100 |
+
|
101 |
+
return $autoloader_packages[ self::AUTOLOAD_GENERATOR_CLASS_NAME ]['version'];
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Updates the spl autoloader chain:
|
107 |
+
* - Registers this namespace's autoloader function.
|
108 |
+
* - If a v1 autoloader function is registered, moves it to the end of the chain.
|
109 |
+
* - Removes any other v2 autoloader functions that have already been registered. This
|
110 |
+
* can occur when the autoloader is being reset by an activating plugin.
|
111 |
+
*/
|
112 |
+
public function update_autoloader_chain() {
|
113 |
+
spl_autoload_register( __NAMESPACE__ . '\autoloader' );
|
114 |
+
|
115 |
+
$autoload_chain = spl_autoload_functions();
|
116 |
+
|
117 |
+
foreach ( $autoload_chain as $autoloader ) {
|
118 |
+
if ( ! is_string( $autoloader ) ) {
|
119 |
+
/*
|
120 |
+
* The Jetpack Autoloader functions are registered as strings, so
|
121 |
+
* just continue if $autoloader isn't a string.
|
122 |
+
*/
|
123 |
+
continue;
|
124 |
+
}
|
125 |
+
|
126 |
+
if ( self::V1_AUTOLOADER_NAME === $autoloader ) {
|
127 |
+
// Move the v1.* autoloader function to the end of the spl autoloader chain.
|
128 |
+
spl_autoload_unregister( $autoloader );
|
129 |
+
spl_autoload_register( $autoloader );
|
130 |
+
|
131 |
+
} elseif (
|
132 |
+
self::V2_AUTOLOADER_BASE === substr( $autoloader, 0, strlen( self::V2_AUTOLOADER_BASE ) )
|
133 |
+
&& __NAMESPACE__ !== substr( $autoloader, 0, strlen( __NAMESPACE__ ) )
|
134 |
+
) {
|
135 |
+
// Unregister any other v2.* autoloader functions if they're in the chain.
|
136 |
+
spl_autoload_unregister( $autoloader );
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
vendor/class-classes-handler.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file was automatically generated by automattic/jetpack-autoloader.
|
4 |
+
*
|
5 |
+
* @package automattic/jetpack-autoloader
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Automattic\Jetpack\Autoloader\jp8e4bd021160ba30631028144cededd1f;
|
9 |
+
|
10 |
+
// phpcs:ignore
|
11 |
+
|
12 |
+
/**
|
13 |
+
* This class selects the package versions for the package classes.
|
14 |
+
*/
|
15 |
+
class Classes_Handler {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The Plugins_Handler object.
|
19 |
+
*
|
20 |
+
* @var Plugins_Handler
|
21 |
+
*/
|
22 |
+
private $plugins_handler = null;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The Version_Selector object.
|
26 |
+
*
|
27 |
+
* @var Version_Selector
|
28 |
+
*/
|
29 |
+
private $version_selector = null;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The constructor.
|
33 |
+
*
|
34 |
+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
35 |
+
* @param Version_Selector $version_selector The Version_Selector object.
|
36 |
+
*/
|
37 |
+
public function __construct( $plugins_handler, $version_selector ) {
|
38 |
+
$this->plugins_handler = $plugins_handler;
|
39 |
+
$this->version_selector = $version_selector;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Adds the version of a package to the $jetpack_packages_classmap global
|
44 |
+
* array so that the autoloader is able to find it.
|
45 |
+
*
|
46 |
+
* @param string $class_name Name of the class that you want to autoload.
|
47 |
+
* @param string $version Version of the class.
|
48 |
+
* @param string $path Absolute path to the class so that we can load it.
|
49 |
+
*/
|
50 |
+
public function enqueue_package_class( $class_name, $version, $path ) {
|
51 |
+
global $jetpack_packages_classmap;
|
52 |
+
|
53 |
+
if ( isset( $jetpack_packages_classmap[ $class_name ]['version'] ) ) {
|
54 |
+
$selected_version = $jetpack_packages_classmap[ $class_name ]['version'];
|
55 |
+
} else {
|
56 |
+
$selected_version = null;
|
57 |
+
}
|
58 |
+
|
59 |
+
if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
|
60 |
+
$jetpack_packages_classmap[ $class_name ] = array(
|
61 |
+
'version' => $version,
|
62 |
+
'path' => $path,
|
63 |
+
);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Creates the path to the plugin's classmap file. The classmap filename is the filename
|
69 |
+
* generated by Jetpack Autoloader version >= 2.0.
|
70 |
+
*
|
71 |
+
* @param String $plugin_path The plugin path.
|
72 |
+
*
|
73 |
+
* @return String the classmap path.
|
74 |
+
*/
|
75 |
+
public function create_classmap_path( $plugin_path ) {
|
76 |
+
return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Initializes the classmap.
|
81 |
+
*/
|
82 |
+
public function set_class_paths() {
|
83 |
+
$active_plugins_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
84 |
+
$classmap_paths = array_map( array( $this, 'create_classmap_path' ), $active_plugins_paths );
|
85 |
+
|
86 |
+
foreach ( $classmap_paths as $path ) {
|
87 |
+
if ( is_readable( $path ) ) {
|
88 |
+
$class_map = require $path;
|
89 |
+
|
90 |
+
if ( is_array( $class_map ) ) {
|
91 |
+
foreach ( $class_map as $class_name => $class_info ) {
|
92 |
+
$this->enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
vendor/class-files-handler.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file was automatically generated by automattic/jetpack-autoloader.
|
4 |
+
*
|
5 |
+
* @package automattic/jetpack-autoloader
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Automattic\Jetpack\Autoloader\jp8e4bd021160ba30631028144cededd1f;
|
9 |
+
|
10 |
+
// phpcs:ignore
|
11 |
+
|
12 |
+
/**
|
13 |
+
* This class selects the package versions for the package files.
|
14 |
+
*/
|
15 |
+
class Files_Handler {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The Plugins_Handler object.
|
19 |
+
*
|
20 |
+
* @var Plugins_Handler
|
21 |
+
*/
|
22 |
+
private $plugins_handler = null;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The Version_Selector object.
|
26 |
+
*
|
27 |
+
* @var Version_Selector
|
28 |
+
*/
|
29 |
+
private $version_selector = null;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The constructor.
|
33 |
+
*
|
34 |
+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
35 |
+
* @param Version_Selector $version_selector The Version_Selector object.
|
36 |
+
*/
|
37 |
+
public function __construct( $plugins_handler, $version_selector ) {
|
38 |
+
$this->plugins_handler = $plugins_handler;
|
39 |
+
$this->version_selector = $version_selector;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Adds the version of a package file to the $jetpack_packages_filemap global
|
44 |
+
* array so that we can load the most recent version.
|
45 |
+
*
|
46 |
+
* @param string $file_identifier Unique id to file assigned by composer based on package name and filename.
|
47 |
+
* @param string $version Version of the file.
|
48 |
+
* @param string $path Absolute path to the file so that we can load it.
|
49 |
+
*/
|
50 |
+
public function enqueue_package_file( $file_identifier, $version, $path ) {
|
51 |
+
global $jetpack_packages_filemap;
|
52 |
+
|
53 |
+
if ( isset( $jetpack_packages_filemap[ $file_identifier ]['version'] ) ) {
|
54 |
+
$selected_version = $jetpack_packages_filemap[ $file_identifier ]['version'];
|
55 |
+
} else {
|
56 |
+
$selected_version = null;
|
57 |
+
}
|
58 |
+
|
59 |
+
if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
|
60 |
+
$jetpack_packages_filemap[ $file_identifier ] = array(
|
61 |
+
'version' => $version,
|
62 |
+
'path' => $path,
|
63 |
+
);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Creates a path to the plugin's filemap. The filemap filename is the filename
|
69 |
+
* generated by Jetpack Autoloader version >= 2.0.
|
70 |
+
*
|
71 |
+
* @param String $plugin_path The plugin path.
|
72 |
+
*
|
73 |
+
* @return String The filemap path
|
74 |
+
*/
|
75 |
+
public function create_filemap_path( $plugin_path ) {
|
76 |
+
return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_filemap.php';
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Initializes the filemap.
|
81 |
+
*/
|
82 |
+
public function set_file_paths() {
|
83 |
+
$active_plugin_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
84 |
+
$filemap_paths = array_map( array( $this, 'create_filemap_path' ), $active_plugin_paths );
|
85 |
+
|
86 |
+
foreach ( $filemap_paths as $path ) {
|
87 |
+
if ( is_readable( $path ) ) {
|
88 |
+
$file_map = require $path;
|
89 |
+
|
90 |
+
if ( is_array( $file_map ) ) {
|
91 |
+
foreach ( $file_map as $file_identifier => $file_data ) {
|
92 |
+
$this->enqueue_package_file( $file_identifier, $file_data['version'], $file_data['path'] );
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Include latest version of all enqueued files.
|
101 |
+
*/
|
102 |
+
public function file_loader() {
|
103 |
+
global $jetpack_packages_filemap;
|
104 |
+
foreach ( $jetpack_packages_filemap as $file_identifier => $file_data ) {
|
105 |
+
if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
|
106 |
+
require_once $file_data['path'];
|
107 |
+
|
108 |
+
$GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
vendor/class-plugins-handler.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file was automatically generated by automattic/jetpack-autoloader.
|
4 |
+
*
|
5 |
+
* @package automattic/jetpack-autoloader
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Automattic\Jetpack\Autoloader\jp8e4bd021160ba30631028144cededd1f;
|
9 |
+
|
10 |
+
// phpcs:ignore
|
11 |
+
|
12 |
+
/**
|
13 |
+
* This class provides information about the current plugin and the site's active plugins.
|
14 |
+
*/
|
15 |
+
class Plugins_Handler {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Returns an array containing the paths of all active plugins and all known activating plugins.
|
19 |
+
*
|
20 |
+
* @return array An array of plugin paths as strings or an empty array.
|
21 |
+
*/
|
22 |
+
public function get_all_active_plugins_paths() {
|
23 |
+
global $jetpack_autoloader_activating_plugins_paths;
|
24 |
+
|
25 |
+
$active_plugins_paths = $this->get_active_plugins_paths();
|
26 |
+
$multisite_plugins_paths = $this->get_multisite_plugins_paths();
|
27 |
+
$active_plugins_paths = array_merge( $multisite_plugins_paths, $active_plugins_paths );
|
28 |
+
|
29 |
+
$activating_plugins_paths = $this->get_plugins_activating_via_request();
|
30 |
+
$activating_plugins_paths = array_unique( array_merge( $activating_plugins_paths, $jetpack_autoloader_activating_plugins_paths ) );
|
31 |
+
|
32 |
+
$plugins_paths = array_unique( array_merge( $active_plugins_paths, $activating_plugins_paths ) );
|
33 |
+
|
34 |
+
return $plugins_paths;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Returns an array containing the paths of the active sitewide plugins in a multisite environment.
|
39 |
+
*
|
40 |
+
* @return array The paths of the active sitewide plugins or an empty array.
|
41 |
+
*/
|
42 |
+
protected function get_multisite_plugins_paths() {
|
43 |
+
$plugin_slugs = is_multisite()
|
44 |
+
? array_keys( get_site_option( 'active_sitewide_plugins', array() ) )
|
45 |
+
: array();
|
46 |
+
|
47 |
+
$plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
|
48 |
+
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns an array containing the paths of the currently active plugins.
|
53 |
+
*
|
54 |
+
* @return array The active plugins' paths or an empty array.
|
55 |
+
*/
|
56 |
+
protected function get_active_plugins_paths() {
|
57 |
+
$plugin_slugs = (array) get_option( 'active_plugins', array() );
|
58 |
+
$plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
|
59 |
+
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Adds the plugin directory from the WP_PLUGIN_DIR constant to the plugin slug.
|
64 |
+
*
|
65 |
+
* @param string $plugin_slug The plugin slug.
|
66 |
+
*/
|
67 |
+
private function create_plugin_path( $plugin_slug ) {
|
68 |
+
$plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR );
|
69 |
+
return trailingslashit( $plugin_dir ) . substr( $plugin_slug, 0, strrpos( $plugin_slug, '/' ) );
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Ensure the plugin has its own directory and not a single-file plugin.
|
74 |
+
*
|
75 |
+
* @param string $plugin Plugin name, may be prefixed with "/".
|
76 |
+
*
|
77 |
+
* @return bool
|
78 |
+
*/
|
79 |
+
public function is_directory_plugin( $plugin ) {
|
80 |
+
return strlen( $plugin ) > 1 && false !== strpos( $plugin, '/', 1 );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Checks whether the autoloader should be reset. The autoloader should be reset
|
85 |
+
* when a plugin is activating via a method other than a request, for example
|
86 |
+
* using WP-CLI. When this occurs, the activating plugin was not known when
|
87 |
+
* the autoloader selected the package versions for the classmap and filemap
|
88 |
+
* globals, so the autoloader must reselect the versions.
|
89 |
+
*
|
90 |
+
* If the current plugin is not already known, this method will add it to the
|
91 |
+
* $jetpack_autoloader_activating_plugins_paths global.
|
92 |
+
*
|
93 |
+
* @return boolean True if the autoloder must be reset, else false.
|
94 |
+
*/
|
95 |
+
public function should_autoloader_reset() {
|
96 |
+
global $jetpack_autoloader_activating_plugins_paths;
|
97 |
+
|
98 |
+
$plugins_paths = $this->get_all_active_plugins_paths();
|
99 |
+
$current_plugin_path = $this->get_current_plugin_path();
|
100 |
+
$plugin_unknown = ! in_array( $current_plugin_path, $plugins_paths, true );
|
101 |
+
|
102 |
+
if ( $plugin_unknown ) {
|
103 |
+
// If the current plugin isn't known, add it to the activating plugins list.
|
104 |
+
$jetpack_autoloader_activating_plugins_paths[] = $current_plugin_path;
|
105 |
+
}
|
106 |
+
|
107 |
+
return $plugin_unknown;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Returns an array containing the names of plugins that are activating via a request.
|
112 |
+
*
|
113 |
+
* @return array An array of names of the activating plugins or an empty array.
|
114 |
+
*/
|
115 |
+
private function get_plugins_activating_via_request() {
|
116 |
+
|
117 |
+
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
118 |
+
|
119 |
+
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
|
120 |
+
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : false;
|
121 |
+
$nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : false;
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Note: we're not actually checking the nonce here becase it's too early
|
125 |
+
* in the execution. The pluggable functions are not yet loaded to give
|
126 |
+
* plugins a chance to plug their versions. Therefore we're doing the bare
|
127 |
+
* minimum: checking whether the nonce exists and it's in the right place.
|
128 |
+
* The request will fail later if the nonce doesn't pass the check.
|
129 |
+
*/
|
130 |
+
|
131 |
+
// In case of a single plugin activation there will be a plugin slug.
|
132 |
+
if ( 'activate' === $action && ! empty( $nonce ) ) {
|
133 |
+
return array( $this->create_plugin_path( wp_unslash( $plugin ) ) );
|
134 |
+
}
|
135 |
+
|
136 |
+
$plugins = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array();
|
137 |
+
|
138 |
+
// In case of bulk activation there will be an array of plugins.
|
139 |
+
if ( 'activate-selected' === $action && ! empty( $nonce ) ) {
|
140 |
+
$plugin_slugs = array_map( 'wp_unslash', $plugins );
|
141 |
+
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
142 |
+
}
|
143 |
+
|
144 |
+
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
145 |
+
return array();
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Returns the path of the current plugin.
|
150 |
+
*
|
151 |
+
* @return string The path of the current plugin.
|
152 |
+
*/
|
153 |
+
public function get_current_plugin_path() {
|
154 |
+
$vendor_path = str_replace( '\\', '/', dirname( __FILE__ ) );
|
155 |
+
// Path to the plugin's folder (the parent of the vendor folder).
|
156 |
+
return substr( $vendor_path, 0, strrpos( $vendor_path, '/' ) );
|
157 |
+
}
|
158 |
+
}
|
vendor/class-version-selector.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file was automatically generated by automattic/jetpack-autoloader.
|
4 |
+
*
|
5 |
+
* @package automattic/jetpack-autoloader
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Automattic\Jetpack\Autoloader\jp8e4bd021160ba30631028144cededd1f;
|
9 |
+
|
10 |
+
// phpcs:ignore
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Used to select package versions.
|
14 |
+
*/
|
15 |
+
class Version_Selector {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Checks whether the selected package version should be updated. Composer development
|
19 |
+
* package versions ('9999999-dev' or versions that start with 'dev-') are favored
|
20 |
+
* when the JETPACK_AUTOLOAD_DEV constant is set to true.
|
21 |
+
*
|
22 |
+
* @param String $selected_version The currently selected package version.
|
23 |
+
* @param String $compare_version The package version that is being evaluated to
|
24 |
+
* determine if the version needs to be updated.
|
25 |
+
*
|
26 |
+
* @return Boolean Returns true if the selected package version should be updated,
|
27 |
+
* else false.
|
28 |
+
*/
|
29 |
+
public function is_version_update_required( $selected_version, $compare_version ) {
|
30 |
+
$use_dev_versions = defined( 'JETPACK_AUTOLOAD_DEV' ) && JETPACK_AUTOLOAD_DEV;
|
31 |
+
|
32 |
+
if ( is_null( $selected_version ) ) {
|
33 |
+
return true;
|
34 |
+
}
|
35 |
+
|
36 |
+
if ( $use_dev_versions && $this->is_package_version_dev( $selected_version ) ) {
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
|
40 |
+
if ( $this->is_package_version_dev( $compare_version ) ) {
|
41 |
+
if ( $use_dev_versions ) {
|
42 |
+
return true;
|
43 |
+
} else {
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( version_compare( $selected_version, $compare_version, '<' ) ) {
|
49 |
+
return true;
|
50 |
+
}
|
51 |
+
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Checks whether the given package version is a development version.
|
57 |
+
*
|
58 |
+
* @param String $version The package version.
|
59 |
+
*
|
60 |
+
* @return Boolean True if the version is a dev version, else false.
|
61 |
+
*/
|
62 |
+
private function is_package_version_dev( $version ) {
|
63 |
+
if ( 'dev-' === substr( $version, 0, 4 ) || '9999999-dev' === $version ) {
|
64 |
+
return true;
|
65 |
+
}
|
66 |
+
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
}
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -13,21 +13,24 @@ class ComposerAutoloaderInit09a12e678f9680fd9bd0641a6da40a9d
|
|
13 |
}
|
14 |
}
|
15 |
|
|
|
|
|
|
|
16 |
public static function getLoader()
|
17 |
{
|
18 |
if (null !== self::$loader) {
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitf733b826e082db99519415f102671fe9
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
13 |
}
|
14 |
}
|
15 |
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
public static function getLoader()
|
20 |
{
|
21 |
if (null !== self::$loader) {
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInitf733b826e082db99519415f102671fe9', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitf733b826e082db99519415f102671fe9', 'loadClassLoader'));
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitf733b826e082db99519415f102671fe9::getInitializer($loader));
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'V' =>
|
@@ -48,9 +48,9 @@ class ComposerStaticInit09a12e678f9680fd9bd0641a6da40a9d
|
|
48 |
public static function getInitializer(ClassLoader $loader)
|
49 |
{
|
50 |
return \Closure::bind(function () use ($loader) {
|
51 |
-
$loader->prefixLengthsPsr4 =
|
52 |
-
$loader->prefixDirsPsr4 =
|
53 |
-
$loader->classMap =
|
54 |
|
55 |
}, null, ClassLoader::class);
|
56 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitf733b826e082db99519415f102671fe9
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'V' =>
|
48 |
public static function getInitializer(ClassLoader $loader)
|
49 |
{
|
50 |
return \Closure::bind(function () use ($loader) {
|
51 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitf733b826e082db99519415f102671fe9::$prefixLengthsPsr4;
|
52 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitf733b826e082db99519415f102671fe9::$prefixDirsPsr4;
|
53 |
+
$loader->classMap = ComposerStaticInitf733b826e082db99519415f102671fe9::$classMap;
|
54 |
|
55 |
}, null, ClassLoader::class);
|
56 |
}
|
vendor/composer/installed.json
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
[
|
2 |
{
|
3 |
"name": "automattic/jetpack-autoloader",
|
4 |
-
"version": "
|
5 |
-
"version_normalized": "1.
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/Automattic/jetpack-autoloader.git",
|
9 |
-
"reference": "
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/
|
14 |
-
"reference": "
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
18 |
-
"composer-plugin-api": "^1.1"
|
19 |
},
|
20 |
"require-dev": {
|
21 |
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
22 |
},
|
23 |
-
"time": "
|
24 |
"type": "composer-plugin",
|
25 |
"extra": {
|
26 |
"class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin"
|
@@ -39,24 +39,24 @@
|
|
39 |
},
|
40 |
{
|
41 |
"name": "automattic/jetpack-logo",
|
42 |
-
"version": "v1.
|
43 |
-
"version_normalized": "1.
|
44 |
"source": {
|
45 |
"type": "git",
|
46 |
"url": "https://github.com/Automattic/jetpack-logo.git",
|
47 |
-
"reference": "
|
48 |
},
|
49 |
"dist": {
|
50 |
"type": "zip",
|
51 |
-
"url": "https://api.github.com/repos/Automattic/jetpack-logo/zipball/
|
52 |
-
"reference": "
|
53 |
"shasum": ""
|
54 |
},
|
55 |
"require-dev": {
|
56 |
"php-mock/php-mock": "^2.1",
|
57 |
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
58 |
},
|
59 |
-
"time": "
|
60 |
"type": "library",
|
61 |
"installation-source": "dist",
|
62 |
"autoload": {
|
@@ -179,17 +179,17 @@
|
|
179 |
},
|
180 |
{
|
181 |
"name": "phpcompatibility/php-compatibility",
|
182 |
-
"version": "9.3.
|
183 |
-
"version_normalized": "9.3.
|
184 |
"source": {
|
185 |
"type": "git",
|
186 |
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
187 |
-
"reference": "
|
188 |
},
|
189 |
"dist": {
|
190 |
"type": "zip",
|
191 |
-
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/
|
192 |
-
"reference": "
|
193 |
"shasum": ""
|
194 |
},
|
195 |
"require": {
|
@@ -206,7 +206,7 @@
|
|
206 |
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
207 |
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
208 |
},
|
209 |
-
"time": "2019-
|
210 |
"type": "phpcodesniffer-standard",
|
211 |
"installation-source": "dist",
|
212 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -394,17 +394,17 @@
|
|
394 |
},
|
395 |
{
|
396 |
"name": "squizlabs/php_codesniffer",
|
397 |
-
"version": "3.5.
|
398 |
-
"version_normalized": "3.5.
|
399 |
"source": {
|
400 |
"type": "git",
|
401 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
402 |
-
"reference": "
|
403 |
},
|
404 |
"dist": {
|
405 |
"type": "zip",
|
406 |
-
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/
|
407 |
-
"reference": "
|
408 |
"shasum": ""
|
409 |
},
|
410 |
"require": {
|
@@ -416,7 +416,7 @@
|
|
416 |
"require-dev": {
|
417 |
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
418 |
},
|
419 |
-
"time": "
|
420 |
"bin": [
|
421 |
"bin/phpcs",
|
422 |
"bin/phpcbf"
|
1 |
[
|
2 |
{
|
3 |
"name": "automattic/jetpack-autoloader",
|
4 |
+
"version": "v2.1.0",
|
5 |
+
"version_normalized": "2.1.0.0",
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/Automattic/jetpack-autoloader.git",
|
9 |
+
"reference": "802517b3ff3010de89141d9f7c4d56aec1d21527"
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/802517b3ff3010de89141d9f7c4d56aec1d21527",
|
14 |
+
"reference": "802517b3ff3010de89141d9f7c4d56aec1d21527",
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
18 |
+
"composer-plugin-api": "^1.1 || ^2.0"
|
19 |
},
|
20 |
"require-dev": {
|
21 |
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
22 |
},
|
23 |
+
"time": "2020-07-27T20:37:00+00:00",
|
24 |
"type": "composer-plugin",
|
25 |
"extra": {
|
26 |
"class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin"
|
39 |
},
|
40 |
{
|
41 |
"name": "automattic/jetpack-logo",
|
42 |
+
"version": "v1.3.0",
|
43 |
+
"version_normalized": "1.3.0.0",
|
44 |
"source": {
|
45 |
"type": "git",
|
46 |
"url": "https://github.com/Automattic/jetpack-logo.git",
|
47 |
+
"reference": "cd0481713ace5acb3162153fab9182497d04f268"
|
48 |
},
|
49 |
"dist": {
|
50 |
"type": "zip",
|
51 |
+
"url": "https://api.github.com/repos/Automattic/jetpack-logo/zipball/cd0481713ace5acb3162153fab9182497d04f268",
|
52 |
+
"reference": "cd0481713ace5acb3162153fab9182497d04f268",
|
53 |
"shasum": ""
|
54 |
},
|
55 |
"require-dev": {
|
56 |
"php-mock/php-mock": "^2.1",
|
57 |
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
58 |
},
|
59 |
+
"time": "2020-06-22T11:37:52+00:00",
|
60 |
"type": "library",
|
61 |
"installation-source": "dist",
|
62 |
"autoload": {
|
179 |
},
|
180 |
{
|
181 |
"name": "phpcompatibility/php-compatibility",
|
182 |
+
"version": "9.3.5",
|
183 |
+
"version_normalized": "9.3.5.0",
|
184 |
"source": {
|
185 |
"type": "git",
|
186 |
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
187 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
|
188 |
},
|
189 |
"dist": {
|
190 |
"type": "zip",
|
191 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
|
192 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
|
193 |
"shasum": ""
|
194 |
},
|
195 |
"require": {
|
206 |
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
207 |
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
208 |
},
|
209 |
+
"time": "2019-12-27T09:44:58+00:00",
|
210 |
"type": "phpcodesniffer-standard",
|
211 |
"installation-source": "dist",
|
212 |
"notification-url": "https://packagist.org/downloads/",
|
394 |
},
|
395 |
{
|
396 |
"name": "squizlabs/php_codesniffer",
|
397 |
+
"version": "3.5.5",
|
398 |
+
"version_normalized": "3.5.5.0",
|
399 |
"source": {
|
400 |
"type": "git",
|
401 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
402 |
+
"reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6"
|
403 |
},
|
404 |
"dist": {
|
405 |
"type": "zip",
|
406 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6",
|
407 |
+
"reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6",
|
408 |
"shasum": ""
|
409 |
},
|
410 |
"require": {
|
416 |
"require-dev": {
|
417 |
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
418 |
},
|
419 |
+
"time": "2020-04-17T01:09:41+00:00",
|
420 |
"bin": [
|
421 |
"bin/phpcs",
|
422 |
"bin/phpcbf"
|
vendor/composer/{autoload_classmap_package.php → jetpack_autoload_classmap.php}
RENAMED
@@ -43,15 +43,15 @@ return array(
|
|
43 |
'path' => $vendorDir . '/automattic/jetpack-standards/PostInstall.php'
|
44 |
),
|
45 |
'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => array(
|
46 |
-
'version' => '1.
|
47 |
'path' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php'
|
48 |
),
|
49 |
'Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin' => array(
|
50 |
-
'version' => '1.
|
51 |
'path' => $vendorDir . '/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php'
|
52 |
),
|
53 |
'Automattic\\Jetpack\\Assets\\Logo' => array(
|
54 |
-
'version' => '1.
|
55 |
'path' => $vendorDir . '/automattic/jetpack-logo/src/class-logo.php'
|
56 |
),
|
57 |
);
|
43 |
'path' => $vendorDir . '/automattic/jetpack-standards/PostInstall.php'
|
44 |
),
|
45 |
'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => array(
|
46 |
+
'version' => '2.1.0.0',
|
47 |
'path' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php'
|
48 |
),
|
49 |
'Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin' => array(
|
50 |
+
'version' => '2.1.0.0',
|
51 |
'path' => $vendorDir . '/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php'
|
52 |
),
|
53 |
'Automattic\\Jetpack\\Assets\\Logo' => array(
|
54 |
+
'version' => '1.3.0.0',
|
55 |
'path' => $vendorDir . '/automattic/jetpack-logo/src/class-logo.php'
|
56 |
),
|
57 |
);
|
vendor/composer/jetpack_autoload_filemap.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// This file `autoload_files_packages.php` was auto generated by automattic/jetpack-autoloader.
|
4 |
+
|
5 |
+
$vendorDir = dirname(__DIR__);
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
10 |
+
|