VaultPress - Version 2.1.4

Version Description

  • Release date: August 7, 2020

** Opcache Conflict **

  • General: Revert autoloader version to prior 1.7.0 version, to resolve an intermittent issue during the upgrade process for some users.
Download this release

Release Info

Developer georgestephanis
Plugin Icon 128x128 VaultPress
Version 2.1.4
Comparing to
See all releases

Code changes from version 2.1.3 to 2.1.4

composer.json CHANGED
@@ -9,7 +9,7 @@
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"
9
  },
10
  "require": {
11
  "automattic/jetpack-logo": "1.3.0",
12
+ "automattic/jetpack-autoloader": "1.7.0"
13
  },
14
  "require-dev": {
15
  "automattic/jetpack-standards": "master-dev"
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, apokalyptik, briancolinger, josephscott, shaunandrews,
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.3
7
  Requires PHP: 5.6
8
  License: GPLv2
9
 
@@ -49,6 +49,14 @@ Yes, VaultPress supports Multisite installs. Each site will require its own subs
49
 
50
  == Changelog ==
51
 
 
 
 
 
 
 
 
 
52
  = 2.1.3 =
53
 
54
  * Release date: August 6, 2020
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.4
7
  Requires PHP: 5.6
8
  License: GPLv2
9
 
49
 
50
  == Changelog ==
51
 
52
+ = 2.1.4 =
53
+
54
+ * Release date: August 7, 2020
55
+
56
+ ** Opcache Conflict **
57
+
58
+ * General: Revert autoloader version to prior 1.7.0 version, to resolve an intermittent issue during the upgrade process for some users.
59
+
60
  = 2.1.3 =
61
 
62
  * Release date: August 6, 2020
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&amp;utm_medium=plugin-description&amp;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&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">Need some help?</a>
6
- * Version: 2.1.3
7
  * Author: Automattic
8
  * Author URI: http://vaultpress.com/?utm_source=author-uri&amp;utm_medium=plugin-description&amp;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.3' );
21
  define( 'VAULTPRESS__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
22
 
23
  /**
3
  * Plugin Name: VaultPress
4
  * Plugin URI: http://vaultpress.com/?utm_source=plugin-uri&amp;utm_medium=plugin-description&amp;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&amp;utm_medium=plugin-description&amp;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&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">Need some help?</a>
6
+ * Version: 2.1.4
7
  * Author: Automattic
8
  * Author URI: http://vaultpress.com/?utm_source=author-uri&amp;utm_medium=plugin-description&amp;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.4' );
21
  define( 'VAULTPRESS__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
22
 
23
  /**
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit373b2f296178305839844a9c51510640::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitabbe6786ee8beb5eddaaf6583db0467b::getLoader();
vendor/autoload_functions.php DELETED
@@ -1,152 +0,0 @@
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\jp81114e817f576996f858e1e4e18c97c5;
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,14 +1,206 @@
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\jp81114e817f576996f858e1e4e18c97c5;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
- // phpcs:ignore
 
 
11
 
12
- require_once trailingslashit( dirname( __FILE__ ) ) . '/autoload_functions.php';
 
 
13
 
14
- set_up_autoloader();
 
 
 
 
 
 
 
 
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
+ // phpcs:disable PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound
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
+ return;
41
+ }
42
+ // If we have a @dev version set always use that one!
43
+ if ( 'dev-' === substr( $jetpack_packages_classes[ $class_name ]['version'], 0, 4 ) ) {
44
+ return;
45
+ }
46
+
47
+ // Always favour the @dev version. Since that version is the same as bleeding edge.
48
+ // We need to make sure that we don't do this in production!
49
+ if ( 'dev-' === substr( $version, 0, 4 ) ) {
50
+ $jetpack_packages_classes[ $class_name ] = array(
51
+ 'version' => $version,
52
+ 'path' => $path,
53
+ );
54
+
55
+ return;
56
+ }
57
+ // Set the latest version!
58
+ if ( version_compare( $jetpack_packages_classes[ $class_name ]['version'], $version, '<' ) ) {
59
+ $jetpack_packages_classes[ $class_name ] = array(
60
+ 'version' => $version,
61
+ 'path' => $path,
62
+ );
63
+ }
64
+ }
65
+ }
66
+
67
+ if ( ! function_exists( __NAMESPACE__ . '\enqueue_package_file' ) ) {
68
+ global $jetpack_packages_files;
69
+
70
+ if ( ! is_array( $jetpack_packages_files ) ) {
71
+ $jetpack_packages_files = array();
72
+ }
73
+ /**
74
+ * Adds the version of a package file to the $jetpack_packages_files global array so that
75
+ * we can load the most recent version after 'plugins_loaded'.
76
+ *
77
+ * @param string $file_identifier Unique id to file assigned by composer based on package name and filename.
78
+ * @param string $version Version of the file.
79
+ * @param string $path Absolute path to the file so that we can load it.
80
+ */
81
+ function enqueue_package_file( $file_identifier, $version, $path ) {
82
+ global $jetpack_packages_files;
83
+
84
+ if ( ! isset( $jetpack_packages_files[ $file_identifier ] ) ) {
85
+ $jetpack_packages_files[ $file_identifier ] = array(
86
+ 'version' => $version,
87
+ 'path' => $path,
88
+ );
89
+
90
+ return;
91
+ }
92
+ // If we have a @dev version set always use that one!
93
+ if ( 'dev-' === substr( $jetpack_packages_files[ $file_identifier ]['version'], 0, 4 ) ) {
94
+ return;
95
+ }
96
+
97
+ // Always favour the @dev version. Since that version is the same as bleeding edge.
98
+ // We need to make sure that we don't do this in production!
99
+ if ( 'dev-' === substr( $version, 0, 4 ) ) {
100
+ $jetpack_packages_files[ $file_identifier ] = array(
101
+ 'version' => $version,
102
+ 'path' => $path,
103
+ );
104
+
105
+ return;
106
+ }
107
+ // Set the latest version!
108
+ if ( version_compare( $jetpack_packages_files[ $file_identifier ]['version'], $version, '<' ) ) {
109
+ $jetpack_packages_files[ $file_identifier ] = array(
110
+ 'version' => $version,
111
+ 'path' => $path,
112
+ );
113
+ }
114
+ }
115
+ }
116
+
117
+ if ( ! function_exists( __NAMESPACE__ . '\file_loader' ) ) {
118
+ /**
119
+ * Include latest version of all enqueued files. Should be called after all plugins are loaded.
120
+ */
121
+ function file_loader() {
122
+ global $jetpack_packages_files;
123
+ foreach ( $jetpack_packages_files as $file_identifier => $file_data ) {
124
+ if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
125
+ require $file_data['path'];
126
+
127
+ $GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
128
+ }
129
+ }
130
+ }
131
+ }
132
+
133
+ if ( ! function_exists( __NAMESPACE__ . '\autoloader' ) ) {
134
+ /**
135
+ * Used for autoloading jetpack packages.
136
+ *
137
+ * @param string $class_name Class Name to load.
138
+ */
139
+ function autoloader( $class_name ) {
140
+ global $jetpack_packages_classes;
141
+
142
+ if ( isset( $jetpack_packages_classes[ $class_name ] ) ) {
143
+ if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
144
+ // TODO ideally we shouldn't skip any of these, see: https://github.com/Automattic/jetpack/pull/12646.
145
+ $ignore = in_array(
146
+ $class_name,
147
+ array(
148
+ 'Automattic\Jetpack\Connection\Manager',
149
+ 'Jetpack_Options',
150
+ ),
151
+ true
152
+ );
153
+
154
+ if ( ! $ignore && function_exists( 'did_action' ) && ! did_action( 'plugins_loaded' ) ) {
155
+ _doing_it_wrong(
156
+ esc_html( $class_name ),
157
+ sprintf(
158
+ /* translators: %s Name of a PHP Class */
159
+ esc_html__( 'Not all plugins have loaded yet but we requested the class %s', 'jetpack' ),
160
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
161
+ $class_name
162
+ ),
163
+ esc_html( $jetpack_packages_classes[ $class_name ]['version'] )
164
+ );
165
+ }
166
+ }
167
+
168
+ require_once $jetpack_packages_classes[ $class_name ]['path'];
169
+
170
+ return true;
171
+ }
172
+
173
+ return false;
174
+ }
175
+
176
+ // Add the jetpack autoloader.
177
+ spl_autoload_register( __NAMESPACE__ . '\autoloader' );
178
+ }
179
+ /**
180
+ * Prepare all the classes for autoloading.
181
+ */
182
+ function enqueue_packages_dad950db79c73a765361c7b7c609843f() {
183
+ $class_map = require_once dirname( __FILE__ ) . '/composer/autoload_classmap_package.php';
184
+ foreach ( $class_map as $class_name => $class_info ) {
185
+ enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
186
+ }
187
+
188
+ $autoload_file = __DIR__ . '/composer/autoload_files_package.php';
189
 
190
+ $includeFiles = file_exists( $autoload_file )
191
+ ? require $autoload_file
192
+ : array();
193
 
194
+ foreach ( $includeFiles as $fileIdentifier => $file_data ) {
195
+ enqueue_package_file( $fileIdentifier, $file_data[ 'version' ], $file_data[ 'path' ] );
196
+ }
197
 
198
+ if ( function_exists( 'has_action') && function_exists( 'did_action' ) && ! did_action( 'plugins_loaded' ) && false === has_action( 'plugins_loaded', __NAMESPACE__ . '\file_loader' ) ) {
199
+ // Add action if it has not been added and has not happened yet.
200
+ // Priority -10 to load files as early as possible in case plugins try to use them during `plugins_loaded`.
201
+ add_action( 'plugins_loaded', __NAMESPACE__ . '\file_loader', 0, -10 );
202
+ } elseif( ! function_exists( 'did_action' ) || did_action( 'plugins_loaded' ) ) {
203
+ file_loader(); // Either WordPress is not loaded or plugin is doing it wrong. Either way we'll load the files so nothing breaks.
204
+ }
205
+ }
206
+ enqueue_packages_dad950db79c73a765361c7b7c609843f();
vendor/automattic/jetpack-autoloader/README.md CHANGED
@@ -42,5 +42,3 @@ Current Limitations
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`.
42
  -----
43
 
44
  We currently only support packages that autoload via psr-4 definition in their package.
 
 
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 || ^2.0"
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"
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 // phpcs:ignore WordPress.Files.FileName
2
  /**
3
  * Autoloader Generator.
4
  *
@@ -11,6 +11,7 @@
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,15 +39,6 @@ use Composer\Util\Filesystem;
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,7 +57,7 @@ AUTOLOADER_COMMENT;
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,
@@ -92,32 +84,15 @@ AUTOLOADER_COMMENT;
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
  /**
@@ -181,7 +156,7 @@ AUTOLOADER_COMMENT;
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
  );
@@ -338,23 +313,45 @@ INCLUDE_FILEMAP;
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
  }
1
+ <?php
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.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
  */
40
  class AutoloadGenerator extends BaseGenerator {
41
 
 
 
 
 
 
 
 
 
 
42
  /**
43
  * Instantiate an AutoloadGenerator object.
44
  *
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, ignored since we want our autoloader to only be included once.
61
  */
62
  public function dump(
63
  Config $config,
84
  $fileMap = $this->getFileMap( $autoloads, $filesystem, $vendorPath, $basePath );
85
 
86
  // Generate the files.
87
+ file_put_contents( $targetDir . '/autoload_classmap_package.php', $this->getAutoloadClassmapPackagesFile( $classMap ) );
88
+ $this->io->writeError( '<info>Generated ' . $targetDir . '/autoload_classmap_package.php</info>', true );
89
 
90
+ file_put_contents( $targetDir . '/autoload_files_package.php', $this->getAutoloadFilesPackagesFile( $fileMap ) );
91
+ $this->io->writeError( '<info>Generated ' . $targetDir . '/autoload_files_package.php</info>', true );
92
 
93
+ file_put_contents( $vendorPath . '/autoload_packages.php', $this->getAutoloadPackageFile( $suffix ) );
94
  $this->io->writeError( '<info>Generated ' . $vendorPath . '/autoload_packages.php</info>', true );
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
 
98
  /**
156
  $paths = is_array( $paths ) ? $paths : array( $paths );
157
  foreach ( $paths as $path ) {
158
  $relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
159
+ $autoloads[ $this->getFileIdentifier( $package, $path ) ] = array(
160
  'path' => $relativePath,
161
  'version' => $package->getVersion(), // Version of the file comes from the package - should we try to parse it?
162
  );
313
  /**
314
  * Generate the PHP that will be used in the autoload_packages.php files.
315
  *
316
+ * @param string $suffix Unique suffix added to the jetpack_enqueue_packages function.
 
317
  *
318
  * @return string
319
  */
320
+ private function getAutoloadPackageFile( $suffix ) {
321
+ $sourceLoader = fopen( __DIR__ . '/autoload.php', 'r' );
322
+ $file_contents = stream_get_contents( $sourceLoader );
323
+ $file_contents .= <<<INCLUDE_FILES
324
+ /**
325
+ * Prepare all the classes for autoloading.
326
+ */
327
+ function enqueue_packages_$suffix() {
328
+ \$class_map = require_once dirname( __FILE__ ) . '/composer/autoload_classmap_package.php';
329
+ foreach ( \$class_map as \$class_name => \$class_info ) {
330
+ enqueue_package_class( \$class_name, \$class_info['version'], \$class_info['path'] );
331
+ }
332
+
333
+ \$autoload_file = __DIR__ . '/composer/autoload_files_package.php';
334
+
335
+ \$includeFiles = file_exists( \$autoload_file )
336
+ ? require \$autoload_file
337
+ : array();
338
+
339
+ foreach ( \$includeFiles as \$fileIdentifier => \$file_data ) {
340
+ enqueue_package_file( \$fileIdentifier, \$file_data[ 'version' ], \$file_data[ 'path' ] );
341
+ }
342
+
343
+ if ( function_exists( 'has_action') && function_exists( 'did_action' ) && ! did_action( 'plugins_loaded' ) && false === has_action( 'plugins_loaded', __NAMESPACE__ . '\\file_loader' ) ) {
344
+ // Add action if it has not been added and has not happened yet.
345
+ // Priority -10 to load files as early as possible in case plugins try to use them during `plugins_loaded`.
346
+ add_action( 'plugins_loaded', __NAMESPACE__ . '\\file_loader', 0, -10 );
347
+ } elseif( ! function_exists( 'did_action' ) || did_action( 'plugins_loaded' ) ) {
348
+ file_loader(); // Either WordPress is not loaded or plugin is doing it wrong. Either way we'll load the files so nothing breaks.
349
+ }
350
+ }
351
+ enqueue_packages_$suffix();
352
+
353
+ INCLUDE_FILES;
354
+
355
+ return $file_contents;
356
  }
357
  }
vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php CHANGED
@@ -1,4 +1,4 @@
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,39 +53,10 @@ class CustomAutoloaderPlugin implements PluginInterface, EventSubscriberInterfac
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,19 +71,11 @@ class CustomAutoloaderPlugin implements PluginInterface, EventSubscriberInterfac
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' )
1
+ <?php
2
  /**
3
  * Custom Autoloader Composer Plugin, hooks into composer events to generate the custom autoloader.
4
  *
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 succribed events.
60
  */
61
  public static function getSubscribedEvents() {
62
  return array(
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' )
vendor/automattic/jetpack-autoloader/src/autoload.php CHANGED
@@ -1,6 +1,178 @@
1
  <?php
2
- /* HEADER */ // phpcs:ignore
 
 
 
 
 
 
 
3
 
4
- require_once trailingslashit( dirname( __FILE__ ) ) . '/autoload_functions.php';
 
 
5
 
6
- set_up_autoloader();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ // phpcs:disable PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound
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
+ return;
41
+ }
42
+ // If we have a @dev version set always use that one!
43
+ if ( 'dev-' === substr( $jetpack_packages_classes[ $class_name ]['version'], 0, 4 ) ) {
44
+ return;
45
+ }
46
+
47
+ // Always favour the @dev version. Since that version is the same as bleeding edge.
48
+ // We need to make sure that we don't do this in production!
49
+ if ( 'dev-' === substr( $version, 0, 4 ) ) {
50
+ $jetpack_packages_classes[ $class_name ] = array(
51
+ 'version' => $version,
52
+ 'path' => $path,
53
+ );
54
+
55
+ return;
56
+ }
57
+ // Set the latest version!
58
+ if ( version_compare( $jetpack_packages_classes[ $class_name ]['version'], $version, '<' ) ) {
59
+ $jetpack_packages_classes[ $class_name ] = array(
60
+ 'version' => $version,
61
+ 'path' => $path,
62
+ );
63
+ }
64
+ }
65
+ }
66
+
67
+ if ( ! function_exists( __NAMESPACE__ . '\enqueue_package_file' ) ) {
68
+ global $jetpack_packages_files;
69
+
70
+ if ( ! is_array( $jetpack_packages_files ) ) {
71
+ $jetpack_packages_files = array();
72
+ }
73
+ /**
74
+ * Adds the version of a package file to the $jetpack_packages_files global array so that
75
+ * we can load the most recent version after 'plugins_loaded'.
76
+ *
77
+ * @param string $file_identifier Unique id to file assigned by composer based on package name and filename.
78
+ * @param string $version Version of the file.
79
+ * @param string $path Absolute path to the file so that we can load it.
80
+ */
81
+ function enqueue_package_file( $file_identifier, $version, $path ) {
82
+ global $jetpack_packages_files;
83
+
84
+ if ( ! isset( $jetpack_packages_files[ $file_identifier ] ) ) {
85
+ $jetpack_packages_files[ $file_identifier ] = array(
86
+ 'version' => $version,
87
+ 'path' => $path,
88
+ );
89
+
90
+ return;
91
+ }
92
+ // If we have a @dev version set always use that one!
93
+ if ( 'dev-' === substr( $jetpack_packages_files[ $file_identifier ]['version'], 0, 4 ) ) {
94
+ return;
95
+ }
96
+
97
+ // Always favour the @dev version. Since that version is the same as bleeding edge.
98
+ // We need to make sure that we don't do this in production!
99
+ if ( 'dev-' === substr( $version, 0, 4 ) ) {
100
+ $jetpack_packages_files[ $file_identifier ] = array(
101
+ 'version' => $version,
102
+ 'path' => $path,
103
+ );
104
+
105
+ return;
106
+ }
107
+ // Set the latest version!
108
+ if ( version_compare( $jetpack_packages_files[ $file_identifier ]['version'], $version, '<' ) ) {
109
+ $jetpack_packages_files[ $file_identifier ] = array(
110
+ 'version' => $version,
111
+ 'path' => $path,
112
+ );
113
+ }
114
+ }
115
+ }
116
+
117
+ if ( ! function_exists( __NAMESPACE__ . '\file_loader' ) ) {
118
+ /**
119
+ * Include latest version of all enqueued files. Should be called after all plugins are loaded.
120
+ */
121
+ function file_loader() {
122
+ global $jetpack_packages_files;
123
+ foreach ( $jetpack_packages_files as $file_identifier => $file_data ) {
124
+ if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
125
+ require $file_data['path'];
126
+
127
+ $GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
128
+ }
129
+ }
130
+ }
131
+ }
132
+
133
+ if ( ! function_exists( __NAMESPACE__ . '\autoloader' ) ) {
134
+ /**
135
+ * Used for autoloading jetpack packages.
136
+ *
137
+ * @param string $class_name Class Name to load.
138
+ */
139
+ function autoloader( $class_name ) {
140
+ global $jetpack_packages_classes;
141
+
142
+ if ( isset( $jetpack_packages_classes[ $class_name ] ) ) {
143
+ if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
144
+ // TODO ideally we shouldn't skip any of these, see: https://github.com/Automattic/jetpack/pull/12646.
145
+ $ignore = in_array(
146
+ $class_name,
147
+ array(
148
+ 'Automattic\Jetpack\Connection\Manager',
149
+ 'Jetpack_Options',
150
+ ),
151
+ true
152
+ );
153
+
154
+ if ( ! $ignore && function_exists( 'did_action' ) && ! did_action( 'plugins_loaded' ) ) {
155
+ _doing_it_wrong(
156
+ esc_html( $class_name ),
157
+ sprintf(
158
+ /* translators: %s Name of a PHP Class */
159
+ esc_html__( 'Not all plugins have loaded yet but we requested the class %s', 'jetpack' ),
160
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
161
+ $class_name
162
+ ),
163
+ esc_html( $jetpack_packages_classes[ $class_name ]['version'] )
164
+ );
165
+ }
166
+ }
167
+
168
+ require_once $jetpack_packages_classes[ $class_name ]['path'];
169
+
170
+ return true;
171
+ }
172
+
173
+ return false;
174
+ }
175
+
176
+ // Add the jetpack autoloader.
177
+ spl_autoload_register( __NAMESPACE__ . '\autoloader' );
178
+ }
vendor/automattic/jetpack-autoloader/src/class-autoloader-handler.php DELETED
@@ -1,132 +0,0 @@
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 DELETED
@@ -1,90 +0,0 @@
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 DELETED
@@ -1,104 +0,0 @@
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 DELETED
@@ -1,150 +0,0 @@
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 DELETED
@@ -1,61 +0,0 @@
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 DELETED
@@ -1,144 +0,0 @@
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/class-autoloader-handler.php DELETED
@@ -1,140 +0,0 @@
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\jp81114e817f576996f858e1e4e18c97c5;
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 DELETED
@@ -1,98 +0,0 @@
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\jp81114e817f576996f858e1e4e18c97c5;
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 DELETED
@@ -1,112 +0,0 @@
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\jp81114e817f576996f858e1e4e18c97c5;
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 DELETED
@@ -1,158 +0,0 @@
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\jp81114e817f576996f858e1e4e18c97c5;
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 DELETED
@@ -1,69 +0,0 @@
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\jp81114e817f576996f858e1e4e18c97c5;
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/{jetpack_autoload_classmap.php → autoload_classmap_package.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' => '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
  );
43
  'path' => $vendorDir . '/automattic/jetpack-standards/PostInstall.php'
44
  ),
45
  'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => array(
46
+ 'version' => '1.7.0.0',
47
  'path' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php'
48
  ),
49
  'Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin' => array(
50
+ 'version' => '1.7.0.0',
51
  'path' => $vendorDir . '/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php'
52
  ),
53
  'Automattic\\Jetpack\\Assets\\Logo' => array(
54
+ 'version' => '1.2.0.0',
55
  'path' => $vendorDir . '/automattic/jetpack-logo/src/class-logo.php'
56
  ),
57
  );
vendor/composer/{jetpack_autoload_filemap.php → autoload_files_package.php} RENAMED
File without changes
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitf733b826e082db99519415f102671fe9
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitf733b826e082db99519415f102671fe9
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) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitabbe6786ee8beb5eddaaf6583db0467b
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitabbe6786ee8beb5eddaaf6583db0467b', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitabbe6786ee8beb5eddaaf6583db0467b', '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\ComposerStaticInitabbe6786ee8beb5eddaaf6583db0467b::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 ComposerStaticInitf733b826e082db99519415f102671fe9
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'V' =>
@@ -48,9 +48,9 @@ class ComposerStaticInitf733b826e082db99519415f102671fe9
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
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitabbe6786ee8beb5eddaaf6583db0467b
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 = ComposerStaticInitabbe6786ee8beb5eddaaf6583db0467b::$prefixLengthsPsr4;
52
+ $loader->prefixDirsPsr4 = ComposerStaticInitabbe6786ee8beb5eddaaf6583db0467b::$prefixDirsPsr4;
53
+ $loader->classMap = ComposerStaticInitabbe6786ee8beb5eddaaf6583db0467b::$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": "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,24 +39,24 @@
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,17 +179,17 @@
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,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-12-27T09:44:58+00:00",
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.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,7 +416,7 @@
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"
1
  [
2
  {
3
  "name": "automattic/jetpack-autoloader",
4
+ "version": "v1.7.0",
5
+ "version_normalized": "1.7.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/Automattic/jetpack-autoloader.git",
9
+ "reference": "7c6736eeee0f9fc49fa691fe3e958725efb27ca0"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/7c6736eeee0f9fc49fa691fe3e958725efb27ca0",
14
+ "reference": "7c6736eeee0f9fc49fa691fe3e958725efb27ca0",
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": "2020-04-23T02:28:37+00:00",
24
  "type": "composer-plugin",
25
  "extra": {
26
  "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin"
39
  },
40
  {
41
  "name": "automattic/jetpack-logo",
42
+ "version": "v1.2.0",
43
+ "version_normalized": "1.2.0.0",
44
  "source": {
45
  "type": "git",
46
  "url": "https://github.com/Automattic/jetpack-logo.git",
47
+ "reference": "d7840f25d7836ab69de979bcb67e8190220e53a3"
48
  },
49
  "dist": {
50
  "type": "zip",
51
+ "url": "https://api.github.com/repos/Automattic/jetpack-logo/zipball/d7840f25d7836ab69de979bcb67e8190220e53a3",
52
+ "reference": "d7840f25d7836ab69de979bcb67e8190220e53a3",
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-03-27T21:57:58+00:00",
60
  "type": "library",
61
  "installation-source": "dist",
62
  "autoload": {
179
  },
180
  {
181
  "name": "phpcompatibility/php-compatibility",
182
+ "version": "9.3.4",
183
+ "version_normalized": "9.3.4.0",
184
  "source": {
185
  "type": "git",
186
  "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
187
+ "reference": "1f37659196e4f3113ea506a7efba201c52303bf1"
188
  },
189
  "dist": {
190
  "type": "zip",
191
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/1f37659196e4f3113ea506a7efba201c52303bf1",
192
+ "reference": "1f37659196e4f3113ea506a7efba201c52303bf1",
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-11-15T04:12:02+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.3",
398
+ "version_normalized": "3.5.3.0",
399
  "source": {
400
  "type": "git",
401
  "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
402
+ "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb"
403
  },
404
  "dist": {
405
  "type": "zip",
406
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/557a1fc7ac702c66b0bbfe16ab3d55839ef724cb",
407
+ "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb",
408
  "shasum": ""
409
  },
410
  "require": {
416
  "require-dev": {
417
  "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
418
  },
419
+ "time": "2019-12-04T04:46:47+00:00",
420
  "bin": [
421
  "bin/phpcs",
422
  "bin/phpcbf"