WooCommerce Admin - Version 2.0.1

Version Description

Download this release

Release Info

Developer psealock
Plugin Icon 128x128 WooCommerce Admin
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.1

Files changed (51) hide show
  1. dist/navigation/style-rtl.css +0 -126
  2. dist/navigation/style.css +0 -126
  3. images/admin_notes/img-product-light.png +0 -0
  4. languages/woocommerce-admin.pot +4 -5
  5. readme.txt +1 -1
  6. src/Composer/Package.php +1 -1
  7. src/FeaturePlugin.php +1 -1
  8. src/Features/Navigation/Menu.php +10 -7
  9. vendor/autoload.php +1 -1
  10. vendor/autoload_packages.php +1 -1
  11. vendor/automattic/jetpack-autoloader/composer.json +12 -4
  12. vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php +1 -0
  13. vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php +37 -0
  14. vendor/automattic/jetpack-autoloader/src/class-autoloader-handler.php +65 -9
  15. vendor/automattic/jetpack-autoloader/src/class-autoloader-locator.php +1 -1
  16. vendor/automattic/jetpack-autoloader/src/class-autoloader.php +33 -69
  17. vendor/automattic/jetpack-autoloader/src/class-container.php +11 -11
  18. vendor/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php +8 -15
  19. vendor/automattic/jetpack-autoloader/src/class-manifest-handler.php +0 -99
  20. vendor/automattic/jetpack-autoloader/src/class-path-processor.php +4 -0
  21. vendor/automattic/jetpack-autoloader/src/class-php-autoloader.php +82 -0
  22. vendor/automattic/jetpack-autoloader/src/class-plugin-locator.php +19 -6
  23. vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php +17 -11
  24. vendor/automattic/jetpack-autoloader/src/class-version-selector.php +3 -3
  25. vendor/automattic/jetpack-autoloader/src/functions.php +0 -66
  26. vendor/composer/ClassLoader.php +2 -34
  27. vendor/composer/InstalledVersions.php +0 -316
  28. vendor/composer/autoload_classmap.php +0 -1
  29. vendor/composer/autoload_real.php +6 -8
  30. vendor/composer/autoload_static.php +4 -5
  31. vendor/composer/installed.json +184 -192
  32. vendor/composer/installed.php +0 -56
  33. vendor/composer/jetpack_autoload_classmap.php +1 -1
  34. vendor/composer/jetpack_autoload_psr4.php +2 -2
  35. vendor/composer/platform_check.php +0 -26
  36. vendor/jetpack-autoloader/autoload_functions.php +0 -74
  37. vendor/jetpack-autoloader/class-autoloader-handler.php +66 -10
  38. vendor/jetpack-autoloader/class-autoloader-locator.php +2 -2
  39. vendor/jetpack-autoloader/class-autoloader.php +34 -70
  40. vendor/jetpack-autoloader/class-container.php +12 -12
  41. vendor/jetpack-autoloader/class-hook-manager.php +1 -1
  42. vendor/jetpack-autoloader/class-latest-autoloader-guard.php +9 -16
  43. vendor/jetpack-autoloader/class-manifest-handler.php +0 -107
  44. vendor/jetpack-autoloader/class-manifest-reader.php +1 -1
  45. vendor/jetpack-autoloader/class-path-processor.php +5 -1
  46. vendor/jetpack-autoloader/class-php-autoloader.php +90 -0
  47. vendor/jetpack-autoloader/class-plugin-locator.php +20 -7
  48. vendor/jetpack-autoloader/class-plugins-handler.php +18 -12
  49. vendor/jetpack-autoloader/class-version-loader.php +1 -1
  50. vendor/jetpack-autoloader/class-version-selector.php +4 -4
  51. woocommerce-admin.php +1 -1
dist/navigation/style-rtl.css DELETED
@@ -1,126 +0,0 @@
1
- /**
2
- * Colors
3
- */
4
- /**
5
- * Colors
6
- */
7
- /**
8
- * Colors
9
- */
10
- /**
11
- * Fonts & basic variables.
12
- */
13
- /**
14
- * Grid System.
15
- * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
16
- */
17
- /**
18
- * Dimensions.
19
- */
20
- /**
21
- * Shadows.
22
- */
23
- /**
24
- * Editor widths.
25
- */
26
- /**
27
- * Block UI.
28
- */
29
- /**
30
- * Border radii.
31
- */
32
- /**
33
- * Block paddings.
34
- */
35
- /**
36
- * Breakpoint mixins
37
- */
38
- /**
39
- * Long content fade mixin
40
- *
41
- * Creates a fading overlay to signify that the content is longer
42
- * than the space allows.
43
- */
44
- /**
45
- * Focus styles.
46
- */
47
- /**
48
- * Applies editor left position to the selector passed as argument
49
- */
50
- /**
51
- * Styles that are reused verbatim in a few places
52
- */
53
- /**
54
- * Allows users to opt-out of animations via OS-level preferences.
55
- */
56
- /**
57
- * Reset default styles for JavaScript UI based pages.
58
- * This is a WP-admin agnostic reset
59
- */
60
- /**
61
- * Reset the WP Admin page styles for Gutenberg-like pages.
62
- */
63
- /**
64
- * Breakpoints & Media Queries
65
- */
66
- :root {
67
- --wp-admin-theme-color: #007cba;
68
- --wp-admin-theme-color-darker-10: #006ba1;
69
- --wp-admin-theme-color-darker-20: #005a87; }
70
-
71
- body.admin-color-light {
72
- --wp-admin-theme-color: #0085ba;
73
- --wp-admin-theme-color-darker-10: #0073a1;
74
- --wp-admin-theme-color-darker-20: #006187; }
75
-
76
- body.admin-color-modern {
77
- --wp-admin-theme-color: #3858e9;
78
- --wp-admin-theme-color-darker-10: #2145e6;
79
- --wp-admin-theme-color-darker-20: #183ad6; }
80
-
81
- body.admin-color-blue {
82
- --wp-admin-theme-color: #096484;
83
- --wp-admin-theme-color-darker-10: #07526c;
84
- --wp-admin-theme-color-darker-20: #064054; }
85
-
86
- body.admin-color-coffee {
87
- --wp-admin-theme-color: #46403c;
88
- --wp-admin-theme-color-darker-10: #383330;
89
- --wp-admin-theme-color-darker-20: #2b2724; }
90
-
91
- body.admin-color-ectoplasm {
92
- --wp-admin-theme-color: #523f6d;
93
- --wp-admin-theme-color-darker-10: #46365d;
94
- --wp-admin-theme-color-darker-20: #3a2c4d; }
95
-
96
- body.admin-color-midnight {
97
- --wp-admin-theme-color: #e14d43;
98
- --wp-admin-theme-color-darker-10: #dd382d;
99
- --wp-admin-theme-color-darker-20: #d02c21; }
100
-
101
- body.admin-color-ocean {
102
- --wp-admin-theme-color: #627c83;
103
- --wp-admin-theme-color-darker-10: #576e74;
104
- --wp-admin-theme-color-darker-20: #4c6066; }
105
-
106
- body.admin-color-sunrise {
107
- --wp-admin-theme-color: #dd823b;
108
- --wp-admin-theme-color-darker-10: #d97426;
109
- --wp-admin-theme-color-darker-20: #c36922; }
110
-
111
- /* stylelint-disable block-closing-brace-newline-after */
112
- /* stylelint-enable */
113
- /**
114
- * Breakpoint mixins
115
- */
116
- /* stylelint-disable block-closing-brace-newline-after */
117
- /* stylelint-enable */
118
- body.js:not(.has-woocommerce-navigation) #adminmenu
119
- li.toplevel_page_woocommerce.wp-has-submenu.wp-not-current-submenu.opensub:hover::after {
120
- display: none; }
121
-
122
- body.js:not(.has-woocommerce-navigation) .toplevel_page_woocommerce ul.wp-submenu {
123
- display: none; }
124
- @media (max-width: 782px) {
125
- body.js:not(.has-woocommerce-navigation) .toplevel_page_woocommerce ul.wp-submenu .wp-first-item.hide-if-js {
126
- display: list-item; } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dist/navigation/style.css DELETED
@@ -1,126 +0,0 @@
1
- /**
2
- * Colors
3
- */
4
- /**
5
- * Colors
6
- */
7
- /**
8
- * Colors
9
- */
10
- /**
11
- * Fonts & basic variables.
12
- */
13
- /**
14
- * Grid System.
15
- * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
16
- */
17
- /**
18
- * Dimensions.
19
- */
20
- /**
21
- * Shadows.
22
- */
23
- /**
24
- * Editor widths.
25
- */
26
- /**
27
- * Block UI.
28
- */
29
- /**
30
- * Border radii.
31
- */
32
- /**
33
- * Block paddings.
34
- */
35
- /**
36
- * Breakpoint mixins
37
- */
38
- /**
39
- * Long content fade mixin
40
- *
41
- * Creates a fading overlay to signify that the content is longer
42
- * than the space allows.
43
- */
44
- /**
45
- * Focus styles.
46
- */
47
- /**
48
- * Applies editor left position to the selector passed as argument
49
- */
50
- /**
51
- * Styles that are reused verbatim in a few places
52
- */
53
- /**
54
- * Allows users to opt-out of animations via OS-level preferences.
55
- */
56
- /**
57
- * Reset default styles for JavaScript UI based pages.
58
- * This is a WP-admin agnostic reset
59
- */
60
- /**
61
- * Reset the WP Admin page styles for Gutenberg-like pages.
62
- */
63
- /**
64
- * Breakpoints & Media Queries
65
- */
66
- :root {
67
- --wp-admin-theme-color: #007cba;
68
- --wp-admin-theme-color-darker-10: #006ba1;
69
- --wp-admin-theme-color-darker-20: #005a87; }
70
-
71
- body.admin-color-light {
72
- --wp-admin-theme-color: #0085ba;
73
- --wp-admin-theme-color-darker-10: #0073a1;
74
- --wp-admin-theme-color-darker-20: #006187; }
75
-
76
- body.admin-color-modern {
77
- --wp-admin-theme-color: #3858e9;
78
- --wp-admin-theme-color-darker-10: #2145e6;
79
- --wp-admin-theme-color-darker-20: #183ad6; }
80
-
81
- body.admin-color-blue {
82
- --wp-admin-theme-color: #096484;
83
- --wp-admin-theme-color-darker-10: #07526c;
84
- --wp-admin-theme-color-darker-20: #064054; }
85
-
86
- body.admin-color-coffee {
87
- --wp-admin-theme-color: #46403c;
88
- --wp-admin-theme-color-darker-10: #383330;
89
- --wp-admin-theme-color-darker-20: #2b2724; }
90
-
91
- body.admin-color-ectoplasm {
92
- --wp-admin-theme-color: #523f6d;
93
- --wp-admin-theme-color-darker-10: #46365d;
94
- --wp-admin-theme-color-darker-20: #3a2c4d; }
95
-
96
- body.admin-color-midnight {
97
- --wp-admin-theme-color: #e14d43;
98
- --wp-admin-theme-color-darker-10: #dd382d;
99
- --wp-admin-theme-color-darker-20: #d02c21; }
100
-
101
- body.admin-color-ocean {
102
- --wp-admin-theme-color: #627c83;
103
- --wp-admin-theme-color-darker-10: #576e74;
104
- --wp-admin-theme-color-darker-20: #4c6066; }
105
-
106
- body.admin-color-sunrise {
107
- --wp-admin-theme-color: #dd823b;
108
- --wp-admin-theme-color-darker-10: #d97426;
109
- --wp-admin-theme-color-darker-20: #c36922; }
110
-
111
- /* stylelint-disable block-closing-brace-newline-after */
112
- /* stylelint-enable */
113
- /**
114
- * Breakpoint mixins
115
- */
116
- /* stylelint-disable block-closing-brace-newline-after */
117
- /* stylelint-enable */
118
- body.js:not(.has-woocommerce-navigation) #adminmenu
119
- li.toplevel_page_woocommerce.wp-has-submenu.wp-not-current-submenu.opensub:hover::after {
120
- display: none; }
121
-
122
- body.js:not(.has-woocommerce-navigation) .toplevel_page_woocommerce ul.wp-submenu {
123
- display: none; }
124
- @media (max-width: 782px) {
125
- body.js:not(.has-woocommerce-navigation) .toplevel_page_woocommerce ul.wp-submenu .wp-first-item.hide-if-js {
126
- display: list-item; } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/admin_notes/img-product-light.png DELETED
Binary file
languages/woocommerce-admin.pot CHANGED
@@ -2,10 +2,9 @@
2
  # This file is distributed under the same license as the WooCommerce Admin package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Admin 2.0.0\n"
6
- "Report-Msgid-Bugs-To: "
7
- "https://wordpress.org/support/plugin/woocommerce-admin\n"
8
- "POT-Creation-Date: 2021-02-11 07:08:16+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -2719,7 +2718,7 @@ msgid ""
2719
  "arguments `menuId` and `parent` are not allowed for add_setting_item()"
2720
  msgstr ""
2721
 
2722
- #: src/Features/Navigation/Menu.php:740
2723
  msgid "WordPress Dashboard"
2724
  msgstr ""
2725
 
2
  # This file is distributed under the same license as the WooCommerce Admin package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Admin 2.0.1\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/temp-wc-admin\n"
7
+ "POT-Creation-Date: 2021-02-12 01:04:48+00:00\n"
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
2718
  "arguments `menuId` and `parent` are not allowed for add_setting_item()"
2719
  msgstr ""
2720
 
2721
+ #: src/Features/Navigation/Menu.php:743
2722
  msgid "WordPress Dashboard"
2723
  msgstr ""
2724
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ecommerce, e-commerce, store, sales, reports, analytics, dashboard, activi
4
  Requires at least: 5.4.0
5
  Tested up to: 5.6.0
6
  Requires PHP: 7.0
7
- Stable tag: 2.0.0
8
  License: GPLv3
9
  License URI: https://github.com/woocommerce/woocommerce-admin/blob/main/license.txt
10
 
4
  Requires at least: 5.4.0
5
  Tested up to: 5.6.0
6
  Requires PHP: 7.0
7
+ Stable tag: 2.0.1
8
  License: GPLv3
9
  License URI: https://github.com/woocommerce/woocommerce-admin/blob/main/license.txt
10
 
src/Composer/Package.php CHANGED
@@ -24,7 +24,7 @@ class Package {
24
  *
25
  * @var string
26
  */
27
- const VERSION = '2.0.0';
28
 
29
  /**
30
  * Package active.
24
  *
25
  * @var string
26
  */
27
+ const VERSION = '2.0.1';
28
 
29
  /**
30
  * Package active.
src/FeaturePlugin.php CHANGED
@@ -154,7 +154,7 @@ class FeaturePlugin {
154
  $this->define( 'WC_ADMIN_PLUGIN_FILE', WC_ADMIN_ABSPATH . 'woocommerce-admin.php' );
155
  // WARNING: Do not directly edit this version number constant.
156
  // It is updated as part of the prebuild process from the package.json value.
157
- $this->define( 'WC_ADMIN_VERSION_NUMBER', '2.0.0' );
158
  }
159
 
160
  /**
154
  $this->define( 'WC_ADMIN_PLUGIN_FILE', WC_ADMIN_ABSPATH . 'woocommerce-admin.php' );
155
  // WARNING: Do not directly edit this version number constant.
156
  // It is updated as part of the prebuild process from the package.json value.
157
+ $this->define( 'WC_ADMIN_VERSION_NUMBER', '2.0.1' );
158
  }
159
 
160
  /**
src/Features/Navigation/Menu.php CHANGED
@@ -89,8 +89,8 @@ class Menu {
89
  add_action( 'admin_menu', array( $this, 'add_core_items' ) );
90
  add_filter( 'admin_enqueue_scripts', array( $this, 'enqueue_data' ), 20 );
91
 
92
- add_filter( 'admin_menu', array( $this, 'migrate_core_child_items' ) );
93
- add_filter( 'admin_menu', array( $this, 'migrate_menu_items' ), PHP_INT_MAX - 1 );
94
  }
95
 
96
  /**
@@ -618,12 +618,15 @@ class Menu {
618
 
619
  // Remove excluded submenu items
620
  if ( isset( $submenu['woocommerce'] ) ) {
621
- $submenu['woocommerce'] = array_filter(
622
- $submenu['woocommerce'],
623
- function ( $submenu_item ) {
624
- return ! in_array( $submenu_item[2], CoreMenu::get_excluded_items(), true );
 
 
 
625
  }
626
- );
627
  }
628
 
629
  foreach ( $submenu as $parent_key => $parent ) {
89
  add_action( 'admin_menu', array( $this, 'add_core_items' ) );
90
  add_filter( 'admin_enqueue_scripts', array( $this, 'enqueue_data' ), 20 );
91
 
92
+ add_filter( 'admin_menu', array( $this, 'migrate_core_child_items' ), PHP_INT_MAX - 1 );
93
+ add_filter( 'admin_menu', array( $this, 'migrate_menu_items' ), PHP_INT_MAX - 2 );
94
  }
95
 
96
  /**
618
 
619
  // Remove excluded submenu items
620
  if ( isset( $submenu['woocommerce'] ) ) {
621
+ foreach ( $submenu['woocommerce'] as $key => $submenu_item ) {
622
+ if ( in_array( $submenu_item[ self::CALLBACK ], CoreMenu::get_excluded_items(), true ) ) {
623
+ if ( isset( $submenu['woocommerce'][ $key ][ self::CSS_CLASSES ] ) ) {
624
+ $submenu['woocommerce'][ $key ][ self::CSS_CLASSES ] .= ' hide-if-js';
625
+ } else {
626
+ $submenu['woocommerce'][ $key ][] = 'hide-if-js';
627
+ }
628
  }
629
+ }
630
  }
631
 
632
  foreach ( $submenu as $parent_key => $parent ) {
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInita537f22e61b714db0c75a63174123add::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit38b3d38eb0faab3eda1eac718e9ae633::getLoader();
vendor/autoload_packages.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
vendor/automattic/jetpack-autoloader/composer.json CHANGED
@@ -17,15 +17,23 @@
17
  "Automattic\\Jetpack\\Autoloader\\": "src"
18
  }
19
  },
20
- "extra": {
21
- "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin"
22
- },
23
  "scripts": {
24
  "phpunit": [
25
  "@composer install",
26
  "./vendor/phpunit/phpunit/phpunit --colors=always"
 
 
 
 
 
 
 
27
  ]
28
  },
29
  "minimum-stability": "dev",
30
- "prefer-stable": true
 
 
 
 
31
  }
17
  "Automattic\\Jetpack\\Autoloader\\": "src"
18
  }
19
  },
 
 
 
20
  "scripts": {
21
  "phpunit": [
22
  "@composer install",
23
  "./vendor/phpunit/phpunit/phpunit --colors=always"
24
+ ],
25
+ "test-coverage": [
26
+ "@composer install",
27
+ "phpdbg -d memory_limit=2048M -d max_execution_time=900 -qrr ./vendor/bin/phpunit --coverage-clover \"$COVERAGE_DIR/clover.xml\""
28
+ ],
29
+ "test-php": [
30
+ "@composer phpunit"
31
  ]
32
  },
33
  "minimum-stability": "dev",
34
+ "prefer-stable": true,
35
+ "extra": {
36
+ "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin",
37
+ "mirror-repo": "Automattic/jetpack-autoloader"
38
+ }
39
  }
vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php CHANGED
@@ -137,6 +137,7 @@ class AutoloadGenerator {
137
  * Packages of equal weight retain the original order
138
  *
139
  * @param array $packageMap The package map.
 
140
  * @return array
141
  */
142
  protected function sortPackageMap( array $packageMap ) {
137
  * Packages of equal weight retain the original order
138
  *
139
  * @param array $packageMap The package map.
140
+ *
141
  * @return array
142
  */
143
  protected function sortPackageMap( array $packageMap ) {
vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php CHANGED
@@ -98,6 +98,13 @@ class CustomAutoloaderPlugin implements PluginInterface, EventSubscriberInterfac
98
  * @param Event $event Script event object.
99
  */
100
  public function postAutoloadDump( Event $event ) {
 
 
 
 
 
 
 
101
  $config = $this->composer->getConfig();
102
 
103
  if ( 'vendor' !== $config->raw()['config']['vendor-dir'] ) {
@@ -158,4 +165,34 @@ class CustomAutoloaderPlugin implements PluginInterface, EventSubscriberInterfac
158
  return md5( uniqid( '', true ) );
159
  }
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
98
  * @param Event $event Script event object.
99
  */
100
  public function postAutoloadDump( Event $event ) {
101
+ // When the autoloader is not required by the root package we don't want to execute it.
102
+ // This prevents unwanted transitive execution that generates unused autoloaders or
103
+ // at worst throws fatal executions.
104
+ if ( ! $this->isRequiredByRoot() ) {
105
+ return;
106
+ }
107
+
108
  $config = $this->composer->getConfig();
109
 
110
  if ( 'vendor' !== $config->raw()['config']['vendor-dir'] ) {
165
  return md5( uniqid( '', true ) );
166
  }
167
 
168
+ /**
169
+ * Checks to see whether or not the root package is the one that required the autoloader.
170
+ *
171
+ * @return bool
172
+ */
173
+ private function isRequiredByRoot() {
174
+ $package = $this->composer->getPackage();
175
+ $requires = $package->getRequires();
176
+ if ( ! is_array( $requires ) ) {
177
+ $requires = array();
178
+ }
179
+ $devRequires = $package->getDevRequires();
180
+ if ( ! is_array( $devRequires ) ) {
181
+ $devRequires = array();
182
+ }
183
+ $requires = array_merge( $requires, $devRequires );
184
+
185
+ if ( empty( $requires ) ) {
186
+ $this->io->writeError( "\n<error>The package is not required and this should never happen?</error>", true );
187
+ exit();
188
+ }
189
+
190
+ foreach ( $requires as $require ) {
191
+ if ( 'automattic/jetpack-autoloader' === $require->getTarget() ) {
192
+ return true;
193
+ }
194
+ }
195
+
196
+ return false;
197
+ }
198
  }
vendor/automattic/jetpack-autoloader/src/class-autoloader-handler.php CHANGED
@@ -1,11 +1,20 @@
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
  /**
10
  * The Hook_Manager instance.
11
  *
@@ -30,22 +39,58 @@ class Autoloader_Handler {
30
  /**
31
  * The constructor.
32
  *
 
33
  * @param Hook_Manager $hook_manager The Hook_Manager instance.
34
  * @param Manifest_Reader $manifest_reader The Manifest_Reader instance.
35
  * @param Version_Selector $version_selector The Version_Selector instance.
36
  */
37
- public function __construct( $hook_manager, $manifest_reader, $version_selector ) {
 
38
  $this->hook_manager = $hook_manager;
39
  $this->manifest_reader = $manifest_reader;
40
  $this->version_selector = $version_selector;
41
  }
42
 
43
  /**
44
- * Creates an autoloader using the given plugins and activates it.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  *
46
  * @param string[] $plugins The plugins to initialize the autoloader for.
47
  */
48
- public function create_autoloader( $plugins ) {
49
  global $jetpack_packages_psr4;
50
  $jetpack_packages_psr4 = array();
51
  $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
@@ -65,19 +110,30 @@ class Autoloader_Handler {
65
  $jetpack_packages_filemap
66
  );
67
 
68
- // Activate the autoloader.
69
- Autoloader::activate( $loader );
 
 
70
  }
71
 
72
  /**
73
  * Resets the active autoloader and all related global state.
74
  */
75
  public function reset_autoloader() {
76
- global $jetpack_autoloader_loader;
77
- global $jetpack_autoloader_latest_version;
78
-
79
  $this->hook_manager->reset();
80
- $jetpack_autoloader_loader = null;
 
 
81
  $jetpack_autoloader_latest_version = null;
 
 
 
 
 
 
 
 
 
82
  }
83
  }
1
  <?php
2
  /* HEADER */ // phpcs:ignore
3
 
4
+ use Automattic\Jetpack\Autoloader\AutoloadGenerator;
5
+
6
  /**
7
  * This class selects the package version for the autoloader.
8
  */
9
  class Autoloader_Handler {
10
 
11
+ /**
12
+ * The PHP_Autoloader instance.
13
+ *
14
+ * @var PHP_Autoloader
15
+ */
16
+ private $php_autoloader;
17
+
18
  /**
19
  * The Hook_Manager instance.
20
  *
39
  /**
40
  * The constructor.
41
  *
42
+ * @param PHP_Autoloader $php_autoloader The PHP_Autoloader instance.
43
  * @param Hook_Manager $hook_manager The Hook_Manager instance.
44
  * @param Manifest_Reader $manifest_reader The Manifest_Reader instance.
45
  * @param Version_Selector $version_selector The Version_Selector instance.
46
  */
47
+ public function __construct( $php_autoloader, $hook_manager, $manifest_reader, $version_selector ) {
48
+ $this->php_autoloader = $php_autoloader;
49
  $this->hook_manager = $hook_manager;
50
  $this->manifest_reader = $manifest_reader;
51
  $this->version_selector = $version_selector;
52
  }
53
 
54
  /**
55
+ * Checks to see whether or not an autoloader is currently in the process of initializing.
56
+ *
57
+ * @return bool
58
+ */
59
+ public function is_initializing() {
60
+ // If no version has been set it means that no autoloader has started initializing yet.
61
+ global $jetpack_autoloader_latest_version;
62
+ if ( ! isset( $jetpack_autoloader_latest_version ) ) {
63
+ return false;
64
+ }
65
+
66
+ // When the version is set but the classmap is not it ALWAYS means that this is the
67
+ // latest autoloader and is being included by an older one.
68
+ global $jetpack_packages_classmap;
69
+ if ( empty( $jetpack_packages_classmap ) ) {
70
+ return true;
71
+ }
72
+
73
+ // Version 2.4.0 added a new global and altered the reset semantics. We need to check
74
+ // the other global as well since it may also point at initialization.
75
+ // Note: We don't need to check for the class first because every autoloader that
76
+ // will set the latest version global requires this class in the classmap.
77
+ $replacing_version = $jetpack_packages_classmap[ AutoloadGenerator::class ]['version'];
78
+ if ( $this->version_selector->is_dev_version( $replacing_version ) || version_compare( $replacing_version, '2.4.0.0', '>=' ) ) {
79
+ global $jetpack_autoloader_loader;
80
+ if ( ! isset( $jetpack_autoloader_loader ) ) {
81
+ return true;
82
+ }
83
+ }
84
+
85
+ return false;
86
+ }
87
+
88
+ /**
89
+ * Activates an autoloader using the given plugins and activates it.
90
  *
91
  * @param string[] $plugins The plugins to initialize the autoloader for.
92
  */
93
+ public function activate_autoloader( $plugins ) {
94
  global $jetpack_packages_psr4;
95
  $jetpack_packages_psr4 = array();
96
  $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
110
  $jetpack_packages_filemap
111
  );
112
 
113
+ $this->php_autoloader->register_autoloader( $loader );
114
+
115
+ // Now that the autoloader is active we can load the filemap.
116
+ $loader->load_filemap();
117
  }
118
 
119
  /**
120
  * Resets the active autoloader and all related global state.
121
  */
122
  public function reset_autoloader() {
123
+ $this->php_autoloader->unregister_autoloader();
 
 
124
  $this->hook_manager->reset();
125
+
126
+ // Clear all of the autoloader globals so that older autoloaders don't do anything strange.
127
+ global $jetpack_autoloader_latest_version;
128
  $jetpack_autoloader_latest_version = null;
129
+
130
+ global $jetpack_packages_classmap;
131
+ $jetpack_packages_classmap = array(); // Must be array to avoid exceptions in old autoloaders!
132
+
133
+ global $jetpack_packages_psr4;
134
+ $jetpack_packages_psr4 = array(); // Must be array to avoid exceptions in old autoloaders!
135
+
136
+ global $jetpack_packages_filemap;
137
+ $jetpack_packages_filemap = array(); // Must be array to avoid exceptions in old autoloaders!
138
  }
139
  }
vendor/automattic/jetpack-autoloader/src/class-autoloader-locator.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /* HEADER */ // phpcs:ignore
3
 
4
- use \Automattic\Jetpack\Autoloader\AutoloadGenerator;
5
 
6
  /**
7
  * This class locates autoloaders.
1
  <?php
2
  /* HEADER */ // phpcs:ignore
3
 
4
+ use Automattic\Jetpack\Autoloader\AutoloadGenerator;
5
 
6
  /**
7
  * This class locates autoloaders.
vendor/automattic/jetpack-autoloader/src/class-autoloader.php CHANGED
@@ -22,6 +22,12 @@ class Autoloader {
22
 
23
  // phpcs:disable Generic.Commenting.DocComment.MissingShort
24
 
 
 
 
 
 
 
25
  /** @var Plugin_Locator $plugin_locator */
26
  $plugin_locator = $container->get( Plugin_Locator::class );
27
 
@@ -31,29 +37,39 @@ class Autoloader {
31
  // The current plugin is the one that we are attempting to initialize here.
32
  $current_plugin = $plugin_locator->find_current_plugin();
33
 
 
 
 
 
 
 
 
34
  // The cached plugins are all of those that were active or discovered by the autoloader during a previous request.
35
  // Note that it's possible this list will include plugins that have since been deactivated, but after a request
36
  // the cache should be updated and the deactivated plugins will be removed.
37
  $cached_plugins = $plugins_handler->get_cached_plugins();
38
 
39
- // The active plugins are those that we were able to discover in on the site. This list will not include
40
- // mu-plugins, those activated by code, or those who are hidden by filtering.
41
- // By combining these lists we can preemptively load classes for plugins that are activated via another method.
42
- // While this may result in us considering packages in deactivated plugins the request after they're removed,
43
- // there shouldn't be any problems as a result and the eventual consistency is reliable enough.
44
- $all_plugins = array_values( array_unique( array_merge( $plugins_handler->get_active_plugins(), $cached_plugins ) ) );
 
 
 
 
 
 
45
 
46
  /** @var Latest_Autoloader_Guard $guard */
47
  $guard = $container->get( Latest_Autoloader_Guard::class );
48
- if ( $guard->should_stop_init( $current_plugin, $all_plugins ) ) {
49
  return;
50
  }
51
 
52
- /** @var Autoloader_Handler $autoloader_handler */
53
- $autoloader_handler = $container->get( Autoloader_Handler::class );
54
-
55
  // Initialize the autoloader using the handler now that we're ready.
56
- $autoloader_handler->create_autoloader( $all_plugins );
57
 
58
  /** @var Hook_Manager $hook_manager */
59
  $hook_manager = $container->get( Hook_Manager::class );
@@ -63,7 +79,7 @@ class Autoloader {
63
  // deactivated from being considered in other requests.
64
  $hook_manager->add_action(
65
  'shutdown',
66
- function () use ( $plugins_handler, $cached_plugins ) {
67
  // Don't save a broken cache if an error happens during some plugin's initialization.
68
  if ( ! did_action( 'plugins_loaded' ) ) {
69
  // Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
@@ -74,10 +90,12 @@ class Autoloader {
74
  return;
75
  }
76
 
77
- // Load the active plugins fresh since the list we have above might not contain
78
  // plugins that were activated but did not reset the autoloader. This happens
79
- // because they were already included in the cache.
80
- $active_plugins = $plugins_handler->get_active_plugins();
 
 
81
 
82
  // The paths should be sorted for easy comparisons with those loaded from the cache.
83
  // Note we don't need to sort the cached entries because they're already sorted.
@@ -94,58 +112,4 @@ class Autoloader {
94
 
95
  // phpcs:enable Generic.Commenting.DocComment.MissingShort
96
  }
97
-
98
- /**
99
- * Loads a class file if one could be found.
100
- *
101
- * @param string $class_name The name of the class to autoload.
102
- *
103
- * @return bool Indicates whether or not a class file was loaded.
104
- */
105
- public static function load_class( $class_name ) {
106
- global $jetpack_autoloader_loader;
107
- if ( ! isset( $jetpack_autoloader_loader ) ) {
108
- return;
109
- }
110
-
111
- $file = $jetpack_autoloader_loader->find_class_file( $class_name );
112
- if ( ! isset( $file ) ) {
113
- return false;
114
- }
115
-
116
- require $file;
117
- return true;
118
- }
119
-
120
- /**
121
- * Activates this autoloader and deactivates any other v2 autoloaders that may be present.
122
- *
123
- * @param Version_Loader $version_loader The version loader for our autoloader.
124
- */
125
- public static function activate( $version_loader ) {
126
- // Set the global autoloader to indicate that we've activated this autoloader.
127
- global $jetpack_autoloader_loader;
128
- $jetpack_autoloader_loader = $version_loader;
129
-
130
- // Remove any v2 autoloader that we've already registered.
131
- $autoload_chain = spl_autoload_functions();
132
- foreach ( $autoload_chain as $autoloader ) {
133
- // Jetpack autoloaders are always strings.
134
- if ( ! is_string( $autoloader ) ) {
135
- continue;
136
- }
137
-
138
- // We can identify a v2 autoloader using the namespace prefix without the unique suffix.
139
- if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $autoloader, 0, 32 ) ) {
140
- spl_autoload_unregister( $autoloader );
141
- continue;
142
- }
143
- }
144
-
145
- // Ensure that the autoloader is first to avoid contention with others.
146
- spl_autoload_register( self::class . '::load_class', true, true );
147
-
148
- // Now that we've activated the autoloader we should load the filemap.
149
- $jetpack_autoloader_loader->load_filemap();
150
- }
151
  }
22
 
23
  // phpcs:disable Generic.Commenting.DocComment.MissingShort
24
 
25
+ /** @var Autoloader_Handler $autoloader_handler */
26
+ $autoloader_handler = $container->get( Autoloader_Handler::class );
27
+
28
+ // If the autoloader is already initializing it means that it has included us as the latest.
29
+ $was_included_by_autoloader = $autoloader_handler->is_initializing();
30
+
31
  /** @var Plugin_Locator $plugin_locator */
32
  $plugin_locator = $container->get( Plugin_Locator::class );
33
 
37
  // The current plugin is the one that we are attempting to initialize here.
38
  $current_plugin = $plugin_locator->find_current_plugin();
39
 
40
+ // The active plugins are those that we were able to discover on the site. This list will not
41
+ // include mu-plugins, those activated by code, or those who are hidden by filtering. We also
42
+ // want to take care to not consider the current plugin unknown if it was included by an
43
+ // autoloader. This avoids the case where a plugin will be marked "active" while deactivated
44
+ // due to it having the latest autoloader.
45
+ $active_plugins = $plugins_handler->get_active_plugins( true, ! $was_included_by_autoloader );
46
+
47
  // The cached plugins are all of those that were active or discovered by the autoloader during a previous request.
48
  // Note that it's possible this list will include plugins that have since been deactivated, but after a request
49
  // the cache should be updated and the deactivated plugins will be removed.
50
  $cached_plugins = $plugins_handler->get_cached_plugins();
51
 
52
+ // We combine the active list and cached list to preemptively load classes for plugins that are
53
+ // presently unknown but will be loaded during the request. While this may result in us considering packages in
54
+ // deactivated plugins there shouldn't be any problems as a result and the eventual consistency is sufficient.
55
+ $all_plugins = array_merge( $active_plugins, $cached_plugins );
56
+
57
+ // In particular we also include the current plugin to address the case where it is the latest autoloader
58
+ // but also unknown (and not cached). We don't want it in the active list because we don't know that it
59
+ // is active but we need it in the all plugins list so that it is considered by the autoloader.
60
+ $all_plugins[] = $current_plugin;
61
+
62
+ // We require uniqueness in the array to avoid processing the same plugin more than once.
63
+ $all_plugins = array_values( array_unique( $all_plugins ) );
64
 
65
  /** @var Latest_Autoloader_Guard $guard */
66
  $guard = $container->get( Latest_Autoloader_Guard::class );
67
+ if ( $guard->should_stop_init( $current_plugin, $all_plugins, $was_included_by_autoloader ) ) {
68
  return;
69
  }
70
 
 
 
 
71
  // Initialize the autoloader using the handler now that we're ready.
72
+ $autoloader_handler->activate_autoloader( $all_plugins );
73
 
74
  /** @var Hook_Manager $hook_manager */
75
  $hook_manager = $container->get( Hook_Manager::class );
79
  // deactivated from being considered in other requests.
80
  $hook_manager->add_action(
81
  'shutdown',
82
+ function () use ( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) {
83
  // Don't save a broken cache if an error happens during some plugin's initialization.
84
  if ( ! did_action( 'plugins_loaded' ) ) {
85
  // Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
90
  return;
91
  }
92
 
93
+ // Load the active plugins fresh since the list we pulled earlier might not contain
94
  // plugins that were activated but did not reset the autoloader. This happens
95
+ // when a plugin is in the cache but not "active" when the autoloader loads.
96
+ // We also want to make sure that plugins which are deactivating are not
97
+ // considered "active" so that they will be removed from the cache now.
98
+ $active_plugins = $plugins_handler->get_active_plugins( false, ! $was_included_by_autoloader );
99
 
100
  // The paths should be sorted for easy comparisons with those loaded from the cache.
101
  // Note we don't need to sort the cached entries because they're already sorted.
112
 
113
  // phpcs:enable Generic.Commenting.DocComment.MissingShort
114
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
vendor/automattic/jetpack-autoloader/src/class-container.php CHANGED
@@ -87,6 +87,9 @@ class Container {
87
  $this->get( Version_Selector::class )
88
  );
89
 
 
 
 
90
  require_once __DIR__ . '/class-manifest-reader.php';
91
  $this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
92
  $this->get( Version_Selector::class )
@@ -100,6 +103,7 @@ class Container {
100
 
101
  require_once __DIR__ . '/class-autoloader-handler.php';
102
  $this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
 
103
  $this->get( Hook_Manager::class ),
104
  $this->get( Manifest_Reader::class ),
105
  $this->get( Version_Selector::class )
@@ -120,22 +124,18 @@ class Container {
120
  * Initializes any of the globals needed by the autoloader.
121
  */
122
  private function initialize_globals() {
 
 
 
 
 
 
 
123
  // Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
124
  // but was not discoverable, we will record them in this array to track them as "active".
125
  global $jetpack_autoloader_activating_plugins_paths;
126
  if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
127
  $jetpack_autoloader_activating_plugins_paths = array();
128
  }
129
-
130
- // Since older autoloaders include newer ones, we need to be able to tell the difference between an
131
- // inclusion via autoloader and an inclusion via plugin file. This allows the autoloader to
132
- // perform special tasks for each kind of inclusion.
133
- global $jetpack_autoloader_including_latest;
134
- if ( ! isset( $jetpack_autoloader_including_latest ) ) {
135
- // If the latest version global has been set but the including latest hasn't, it means that an
136
- // older autoloader without support for the global is including us.
137
- global $jetpack_autoloader_latest_version;
138
- $jetpack_autoloader_including_latest = isset( $jetpack_autoloader_latest_version );
139
- }
140
  }
141
  }
87
  $this->get( Version_Selector::class )
88
  );
89
 
90
+ require_once __DIR__ . '/class-php-autoloader.php';
91
+ $this->dependencies[ PHP_Autoloader::class ] = new PHP_Autoloader();
92
+
93
  require_once __DIR__ . '/class-manifest-reader.php';
94
  $this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
95
  $this->get( Version_Selector::class )
103
 
104
  require_once __DIR__ . '/class-autoloader-handler.php';
105
  $this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
106
+ $this->get( PHP_Autoloader::class ),
107
  $this->get( Hook_Manager::class ),
108
  $this->get( Manifest_Reader::class ),
109
  $this->get( Version_Selector::class )
124
  * Initializes any of the globals needed by the autoloader.
125
  */
126
  private function initialize_globals() {
127
+ /*
128
+ * This global was retired in version 2.9. The value is set to 'false' to maintain
129
+ * compatibility with older versions of the autoloader.
130
+ */
131
+ global $jetpack_autoloader_including_latest;
132
+ $jetpack_autoloader_including_latest = false;
133
+
134
  // Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
135
  // but was not discoverable, we will record them in this array to track them as "active".
136
  global $jetpack_autoloader_activating_plugins_paths;
137
  if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
138
  $jetpack_autoloader_activating_plugins_paths = array();
139
  }
 
 
 
 
 
 
 
 
 
 
 
140
  }
141
  }
vendor/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php CHANGED
@@ -45,38 +45,31 @@ class Latest_Autoloader_Guard {
45
  * has the side-effect of actually loading the latest autoloader in the event that this
46
  * is not it.
47
  *
48
- * @param string $current_plugin The current plugin we're checking.
49
- * @param string[] $plugins The active plugins to check for autoloaders in.
 
50
  *
51
  * @return bool True if we should stop initialization, otherwise false.
52
  */
53
- public function should_stop_init( $current_plugin, $plugins ) {
54
- global $jetpack_autoloader_including_latest;
55
  global $jetpack_autoloader_latest_version;
56
 
57
- // When we're being included from an older autoloader we need to
58
- // reset the latest version so that the new autoloader can look
59
- // for the latest autoloader again.
60
- if ( $jetpack_autoloader_including_latest ) {
61
- $jetpack_autoloader_latest_version = null;
62
- }
63
-
64
  // We need to reset the autoloader when the plugins change because
65
  // that means the autoloader was generated with a different list.
66
  if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
67
  $this->autoloader_handler->reset_autoloader();
68
  }
69
 
70
- // Don't bother initializing the autoloader if it already has been.
71
- if ( isset( $jetpack_autoloader_latest_version ) ) {
 
 
72
  return true;
73
  }
74
 
75
  $latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
76
  if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
77
- $jetpack_autoloader_including_latest = true;
78
  require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
79
- $jetpack_autoloader_including_latest = false;
80
  return true;
81
  }
82
 
45
  * has the side-effect of actually loading the latest autoloader in the event that this
46
  * is not it.
47
  *
48
+ * @param string $current_plugin The current plugin we're checking.
49
+ * @param string[] $plugins The active plugins to check for autoloaders in.
50
+ * @param bool $was_included_by_autoloader Indicates whether or not this autoloader was included by another.
51
  *
52
  * @return bool True if we should stop initialization, otherwise false.
53
  */
54
+ public function should_stop_init( $current_plugin, $plugins, $was_included_by_autoloader ) {
 
55
  global $jetpack_autoloader_latest_version;
56
 
 
 
 
 
 
 
 
57
  // We need to reset the autoloader when the plugins change because
58
  // that means the autoloader was generated with a different list.
59
  if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
60
  $this->autoloader_handler->reset_autoloader();
61
  }
62
 
63
+ // When the latest autoloader has already been found we don't need to search for it again.
64
+ // We should take care however because this will also trigger if the autoloader has been
65
+ // included by an older one.
66
+ if ( isset( $jetpack_autoloader_latest_version ) && ! $was_included_by_autoloader ) {
67
  return true;
68
  }
69
 
70
  $latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
71
  if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
 
72
  require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
 
73
  return true;
74
  }
75
 
vendor/automattic/jetpack-autoloader/src/class-manifest-handler.php DELETED
@@ -1,99 +0,0 @@
1
- <?php
2
- /* HEADER */ // phpcs:ignore
3
-
4
- /**
5
- * This class selects the most recent version of a registered path.
6
- */
7
- class Manifest_Handler {
8
-
9
- /**
10
- * An array of the active plugin paths we want to search.
11
- *
12
- * @var array
13
- */
14
- private $active_plugin_paths;
15
-
16
- /**
17
- * The Version_Selector object.
18
- *
19
- * @var Version_Selector
20
- */
21
- private $version_selector;
22
-
23
- /**
24
- * The constructor.
25
- *
26
- * @param array $active_plugin_paths An array of the active plugin paths we want to search.
27
- * @param Version_Selector $version_selector The Version_Selector object.
28
- */
29
- public function __construct( $active_plugin_paths, $version_selector ) {
30
- $this->active_plugin_paths = $active_plugin_paths;
31
- $this->version_selector = $version_selector;
32
- }
33
-
34
- /**
35
- * Registers all of the paths in a given manifest.
36
- *
37
- * @param string $manifest_path The path that we're loading the manifest from in each plugin.
38
- * @param array $path_map The path map to add the contents of the manifests to.
39
- *
40
- * @return array $path_map The path map we've built using the manifests in each plugin.
41
- */
42
- public function register_plugin_manifests( $manifest_path, &$path_map ) {
43
- $file_paths = array_map(
44
- function ( $path ) use ( $manifest_path ) {
45
- return trailingslashit( $path ) . $manifest_path;
46
- },
47
- $this->active_plugin_paths
48
- );
49
-
50
- foreach ( $file_paths as $path ) {
51
- $this->register_manifest( $path, $path_map );
52
- }
53
-
54
- return $path_map;
55
- }
56
-
57
- /**
58
- * Registers a plugin's manifest file with the path map.
59
- *
60
- * @param string $manifest_path The absolute path to the manifest that we're loading.
61
- * @param array $path_map The path map to add the contents of the manifest to.
62
- */
63
- protected function register_manifest( $manifest_path, &$path_map ) {
64
- if ( ! is_readable( $manifest_path ) ) {
65
- return;
66
- }
67
-
68
- $manifest = require $manifest_path;
69
- if ( ! is_array( $manifest ) ) {
70
- return;
71
- }
72
-
73
- foreach ( $manifest as $key => $data ) {
74
- $this->register_record( $key, $data, $path_map );
75
- }
76
- }
77
-
78
- /**
79
- * Registers an entry from the manifest in the path map.
80
- *
81
- * @param string $key The identifier for the entry we're registering.
82
- * @param array $data The data for the entry we're registering.
83
- * @param array $path_map The path map to add the contents of the manifest to.
84
- */
85
- protected function register_record( $key, $data, &$path_map ) {
86
- if ( isset( $path_map[ $key ]['version'] ) ) {
87
- $selected_version = $path_map[ $key ]['version'];
88
- } else {
89
- $selected_version = null;
90
- }
91
-
92
- if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) {
93
- $path_map[ $key ] = array(
94
- 'version' => $data['version'],
95
- 'path' => $data['path'],
96
- );
97
- }
98
- }
99
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/automattic/jetpack-autoloader/src/class-path-processor.php CHANGED
@@ -9,6 +9,7 @@ class Path_Processor {
9
  * Given a path this will replace any of the path constants with a token to represent it.
10
  *
11
  * @param string $path The path we want to process.
 
12
  * @return string The tokenized path.
13
  */
14
  public function tokenize_path_constants( $path ) {
@@ -31,6 +32,7 @@ class Path_Processor {
31
  * Given a path this will replace any of the path constant tokens with the expanded path.
32
  *
33
  * @param string $tokenized_path The path we want to process.
 
34
  * @return string The expanded path.
35
  */
36
  public function untokenize_path_constants( $tokenized_path ) {
@@ -56,6 +58,7 @@ class Path_Processor {
56
  *
57
  * @param string $file The plugin or theme file to resolve.
58
  * @param array $directories_to_check The directories we should check for the file if it isn't an absolute path.
 
59
  * @return string|false Returns the absolute path to the directory, otherwise false.
60
  */
61
  public function find_directory_with_autoloader( $file, $directories_to_check ) {
@@ -114,6 +117,7 @@ class Path_Processor {
114
  * Indicates whether or not a path is absolute.
115
  *
116
  * @param string $path The path to check.
 
117
  * @return bool True if the path is absolute, otherwise false.
118
  */
119
  private function is_absolute_path( $path ) {
9
  * Given a path this will replace any of the path constants with a token to represent it.
10
  *
11
  * @param string $path The path we want to process.
12
+ *
13
  * @return string The tokenized path.
14
  */
15
  public function tokenize_path_constants( $path ) {
32
  * Given a path this will replace any of the path constant tokens with the expanded path.
33
  *
34
  * @param string $tokenized_path The path we want to process.
35
+ *
36
  * @return string The expanded path.
37
  */
38
  public function untokenize_path_constants( $tokenized_path ) {
58
  *
59
  * @param string $file The plugin or theme file to resolve.
60
  * @param array $directories_to_check The directories we should check for the file if it isn't an absolute path.
61
+ *
62
  * @return string|false Returns the absolute path to the directory, otherwise false.
63
  */
64
  public function find_directory_with_autoloader( $file, $directories_to_check ) {
117
  * Indicates whether or not a path is absolute.
118
  *
119
  * @param string $path The path to check.
120
+ *
121
  * @return bool True if the path is absolute, otherwise false.
122
  */
123
  private function is_absolute_path( $path ) {
vendor/automattic/jetpack-autoloader/src/class-php-autoloader.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* HEADER */ // phpcs:ignore
3
+
4
+ /**
5
+ * This class handles management of the actual PHP autoloader.
6
+ */
7
+ class PHP_Autoloader {
8
+
9
+ /**
10
+ * Registers the autoloader with PHP so that it can begin autoloading classes.
11
+ *
12
+ * @param Version_Loader $version_loader The class loader to use in the autoloader.
13
+ */
14
+ public function register_autoloader( $version_loader ) {
15
+ // Make sure no other autoloaders are registered.
16
+ $this->unregister_autoloader();
17
+
18
+ // Set the global so that it can be used to load classes.
19
+ global $jetpack_autoloader_loader;
20
+ $jetpack_autoloader_loader = $version_loader;
21
+
22
+ // Ensure that the autoloader is first to avoid contention with others.
23
+ spl_autoload_register( array( self::class, 'load_class' ), true, true );
24
+ }
25
+
26
+ /**
27
+ * Unregisters the active autoloader so that it will no longer autoload classes.
28
+ */
29
+ public function unregister_autoloader() {
30
+ // Remove any v2 autoloader that we've already registered.
31
+ $autoload_chain = spl_autoload_functions();
32
+ foreach ( $autoload_chain as $autoloader ) {
33
+ // We can identify a v2 autoloader using the namespace.
34
+ $namespace_check = null;
35
+
36
+ // Functions are recorded as strings.
37
+ if ( is_string( $autoloader ) ) {
38
+ $namespace_check = $autoloader;
39
+ } elseif ( is_array( $autoloader ) && is_string( $autoloader[0] ) ) {
40
+ // Static method calls have the class as the first array element.
41
+ $namespace_check = $autoloader[0];
42
+ } else {
43
+ // Since the autoloader has only ever been a function or a static method we don't currently need to check anything else.
44
+ continue;
45
+ }
46
+
47
+ // Check for the namespace without the generated suffix.
48
+ if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $namespace_check, 0, 32 ) ) {
49
+ spl_autoload_unregister( $autoloader );
50
+ }
51
+ }
52
+
53
+ // Clear the global now that the autoloader has been unregistered.
54
+ global $jetpack_autoloader_loader;
55
+ $jetpack_autoloader_loader = null;
56
+ }
57
+
58
+ /**
59
+ * Loads a class file if one could be found.
60
+ *
61
+ * Note: This function is static so that the autoloader can be easily unregistered. If
62
+ * it was a class method we would have to unwrap the object to check the namespace.
63
+ *
64
+ * @param string $class_name The name of the class to autoload.
65
+ *
66
+ * @return bool Indicates whether or not a class file was loaded.
67
+ */
68
+ public static function load_class( $class_name ) {
69
+ global $jetpack_autoloader_loader;
70
+ if ( ! isset( $jetpack_autoloader_loader ) ) {
71
+ return;
72
+ }
73
+
74
+ $file = $jetpack_autoloader_loader->find_class_file( $class_name );
75
+ if ( ! isset( $file ) ) {
76
+ return false;
77
+ }
78
+
79
+ require $file;
80
+ return true;
81
+ }
82
+ }
vendor/automattic/jetpack-autoloader/src/class-plugin-locator.php CHANGED
@@ -26,6 +26,7 @@ class Plugin_Locator {
26
  * Finds the path to the current plugin.
27
  *
28
  * @return string $path The path to the current plugin.
 
29
  * @throws \RuntimeException If the current plugin does not have an autoloader.
30
  */
31
  public function find_current_plugin() {
@@ -50,8 +51,8 @@ class Plugin_Locator {
50
  * @return array $plugin_paths The list of absolute paths we've found.
51
  */
52
  public function find_using_option( $option_name, $site_option = false ) {
53
- $raw = $site_option ? get_site_option( $option_name, array() ) : get_option( $option_name, array() );
54
- if ( empty( $raw ) ) {
55
  return array();
56
  }
57
 
@@ -59,11 +60,13 @@ class Plugin_Locator {
59
  }
60
 
61
  /**
62
- * Checks for plugins that are being activated in this request and returns all that it finds.
 
 
63
  *
64
  * @return array $plugin_paths The list of absolute paths we've found.
65
  */
66
- public function find_activating_this_request() {
67
  // phpcs:disable WordPress.Security.NonceVerification.Recommended
68
 
69
  /**
@@ -77,11 +80,15 @@ class Plugin_Locator {
77
  return array();
78
  }
79
 
80
- $plugin_slugs = array();
81
-
82
  $action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
 
 
 
 
 
83
  switch ( $action ) {
84
  case 'activate':
 
85
  if ( empty( $_REQUEST['plugin'] ) ) {
86
  break;
87
  }
@@ -90,6 +97,7 @@ class Plugin_Locator {
90
  break;
91
 
92
  case 'activate-selected':
 
93
  if ( empty( $_REQUEST['checked'] ) ) {
94
  break;
95
  }
@@ -98,6 +106,7 @@ class Plugin_Locator {
98
  break;
99
  }
100
 
 
101
  return $this->convert_plugins_to_paths( $plugin_slugs );
102
  }
103
 
@@ -111,6 +120,10 @@ class Plugin_Locator {
111
  * @return string[]
112
  */
113
  private function convert_plugins_to_paths( $plugins ) {
 
 
 
 
114
  // We're going to look for plugins in the standard directories.
115
  $path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
116
 
26
  * Finds the path to the current plugin.
27
  *
28
  * @return string $path The path to the current plugin.
29
+ *
30
  * @throws \RuntimeException If the current plugin does not have an autoloader.
31
  */
32
  public function find_current_plugin() {
51
  * @return array $plugin_paths The list of absolute paths we've found.
52
  */
53
  public function find_using_option( $option_name, $site_option = false ) {
54
+ $raw = $site_option ? get_site_option( $option_name ) : get_option( $option_name );
55
+ if ( false === $raw ) {
56
  return array();
57
  }
58
 
60
  }
61
 
62
  /**
63
+ * Checks for plugins in the `action` request parameter.
64
+ *
65
+ * @param string[] $allowed_actions The actions that we're allowed to return plugins for.
66
  *
67
  * @return array $plugin_paths The list of absolute paths we've found.
68
  */
69
+ public function find_using_request_action( $allowed_actions ) {
70
  // phpcs:disable WordPress.Security.NonceVerification.Recommended
71
 
72
  /**
80
  return array();
81
  }
82
 
 
 
83
  $action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
84
+ if ( ! in_array( $action, $allowed_actions, true ) ) {
85
+ return array();
86
+ }
87
+
88
+ $plugin_slugs = array();
89
  switch ( $action ) {
90
  case 'activate':
91
+ case 'deactivate':
92
  if ( empty( $_REQUEST['plugin'] ) ) {
93
  break;
94
  }
97
  break;
98
 
99
  case 'activate-selected':
100
+ case 'deactivate-selected':
101
  if ( empty( $_REQUEST['checked'] ) ) {
102
  break;
103
  }
106
  break;
107
  }
108
 
109
+ // phpcs:enable WordPress.Security.NonceVerification.Recommended
110
  return $this->convert_plugins_to_paths( $plugin_slugs );
111
  }
112
 
120
  * @return string[]
121
  */
122
  private function convert_plugins_to_paths( $plugins ) {
123
+ if ( ! is_array( $plugins ) || empty( $plugins ) ) {
124
+ return array();
125
+ }
126
+
127
  // We're going to look for plugins in the standard directories.
128
  $path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
129
 
vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php CHANGED
@@ -38,11 +38,13 @@ class Plugins_Handler {
38
  /**
39
  * Gets all of the active plugins we can find.
40
  *
 
 
 
41
  * @return string[]
42
  */
43
- public function get_active_plugins() {
44
  global $jetpack_autoloader_activating_plugins_paths;
45
- global $jetpack_autoloader_including_latest;
46
 
47
  // We're going to build a unique list of plugins from a few different sources
48
  // to find all of our "active" plugins. While we need to return an integer
@@ -73,7 +75,8 @@ class Plugins_Handler {
73
  }
74
  }
75
 
76
- $plugins = $this->plugin_locator->find_activating_this_request();
 
77
  foreach ( $plugins as $path ) {
78
  $active_plugins[ $path ] = $path;
79
  }
@@ -86,11 +89,20 @@ class Plugins_Handler {
86
  // of causing a reset because the active plugins list has
87
  // been changed since it was saved in the global.
88
  $current_plugin = $this->plugin_locator->find_current_plugin();
89
- if ( ! in_array( $current_plugin, $active_plugins, true ) && ! $jetpack_autoloader_including_latest ) {
90
  $active_plugins[ $current_plugin ] = $current_plugin;
91
  $jetpack_autoloader_activating_plugins_paths[] = $current_plugin;
92
  }
93
 
 
 
 
 
 
 
 
 
 
94
  // Transform the array so that we don't have to worry about the keys interacting with other array types later.
95
  return array_values( $active_plugins );
96
  }
@@ -102,7 +114,7 @@ class Plugins_Handler {
102
  */
103
  public function get_cached_plugins() {
104
  $cached = get_transient( self::TRANSIENT_KEY );
105
- if ( false === $cached ) {
106
  return array();
107
  }
108
 
@@ -134,12 +146,6 @@ class Plugins_Handler {
134
  public function have_plugins_changed( $plugins ) {
135
  global $jetpack_autoloader_cached_plugin_paths;
136
 
137
- // When no autoloader has executed there is nothing to have changed.
138
- if ( ! isset( $jetpack_autoloader_cached_plugin_paths ) ) {
139
- $jetpack_autoloader_cached_plugin_paths = $plugins;
140
- return false;
141
- }
142
-
143
  if ( $jetpack_autoloader_cached_plugin_paths !== $plugins ) {
144
  $jetpack_autoloader_cached_plugin_paths = $plugins;
145
  return true;
38
  /**
39
  * Gets all of the active plugins we can find.
40
  *
41
+ * @param bool $include_deactivating When true, plugins deactivating this request will be considered active.
42
+ * @param bool $record_unknown When true, the current plugin will be marked as active and recorded when unknown.
43
+ *
44
  * @return string[]
45
  */
46
+ public function get_active_plugins( $include_deactivating, $record_unknown ) {
47
  global $jetpack_autoloader_activating_plugins_paths;
 
48
 
49
  // We're going to build a unique list of plugins from a few different sources
50
  // to find all of our "active" plugins. While we need to return an integer
75
  }
76
  }
77
 
78
+ // These actions contain plugins that are being activated/deactivated during this request.
79
+ $plugins = $this->plugin_locator->find_using_request_action( array( 'activate', 'activate-selected', 'deactivate', 'deactivate-selected' ) );
80
  foreach ( $plugins as $path ) {
81
  $active_plugins[ $path ] = $path;
82
  }
89
  // of causing a reset because the active plugins list has
90
  // been changed since it was saved in the global.
91
  $current_plugin = $this->plugin_locator->find_current_plugin();
92
+ if ( $record_unknown && ! in_array( $current_plugin, $active_plugins, true ) ) {
93
  $active_plugins[ $current_plugin ] = $current_plugin;
94
  $jetpack_autoloader_activating_plugins_paths[] = $current_plugin;
95
  }
96
 
97
+ // When deactivating plugins aren't desired we should entirely remove them from the active list.
98
+ if ( ! $include_deactivating ) {
99
+ // These actions contain plugins that are being deactivated during this request.
100
+ $plugins = $this->plugin_locator->find_using_request_action( array( 'deactivate', 'deactivate-selected' ) );
101
+ foreach ( $plugins as $path ) {
102
+ unset( $active_plugins[ $path ] );
103
+ }
104
+ }
105
+
106
  // Transform the array so that we don't have to worry about the keys interacting with other array types later.
107
  return array_values( $active_plugins );
108
  }
114
  */
115
  public function get_cached_plugins() {
116
  $cached = get_transient( self::TRANSIENT_KEY );
117
+ if ( ! is_array( $cached ) || empty( $cached ) ) {
118
  return array();
119
  }
120
 
146
  public function have_plugins_changed( $plugins ) {
147
  global $jetpack_autoloader_cached_plugin_paths;
148
 
 
 
 
 
 
 
149
  if ( $jetpack_autoloader_cached_plugin_paths !== $plugins ) {
150
  $jetpack_autoloader_cached_plugin_paths = $plugins;
151
  return true;
vendor/automattic/jetpack-autoloader/src/class-version-selector.php CHANGED
@@ -25,11 +25,11 @@ class Version_Selector {
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 {
@@ -51,7 +51,7 @@ class Version_Selector {
51
  *
52
  * @return bool 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
  }
25
  return true;
26
  }
27
 
28
+ if ( $use_dev_versions && $this->is_dev_version( $selected_version ) ) {
29
  return false;
30
  }
31
 
32
+ if ( $this->is_dev_version( $compare_version ) ) {
33
  if ( $use_dev_versions ) {
34
  return true;
35
  } else {
51
  *
52
  * @return bool True if the version is a dev version, else false.
53
  */
54
+ public function is_dev_version( $version ) {
55
  if ( 'dev-' === substr( $version, 0, 4 ) || '9999999-dev' === $version ) {
56
  return true;
57
  }
vendor/automattic/jetpack-autoloader/src/functions.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
- /* HEADER */ // phpcs:ignore
3
-
4
- /**
5
- * Used for autoloading jetpack packages.
6
- *
7
- * @param string $class_name Class Name to load.
8
- *
9
- * @return Boolean Whether the class_name was found in the classmap.
10
- */
11
- function autoloader( $class_name ) {
12
- global $jetpack_autoloader_loader;
13
- if ( ! isset( $jetpack_autoloader_loader ) ) {
14
- return false;
15
- }
16
-
17
- $file = $jetpack_autoloader_loader->find_class_file( $class_name );
18
- if ( ! isset( $file ) ) {
19
- return false;
20
- }
21
-
22
- require_once $file;
23
- return true;
24
- }
25
-
26
- /**
27
- * Finds the latest installed autoloader. If this is the latest autoloader, sets
28
- * up the classmap and filemap.
29
- */
30
- function set_up_autoloader() {
31
- global $jetpack_autoloader_latest_version;
32
- global $jetpack_autoloader_loader;
33
-
34
- require_once __DIR__ . '/class-plugins-handler.php';
35
- require_once __DIR__ . '/class-version-selector.php';
36
- require_once __DIR__ . '/class-autoloader-locator.php';
37
- require_once __DIR__ . '/class-autoloader-handler.php';
38
-
39
- $plugins_handler = new Plugins_Handler();
40
- $version_selector = new Version_Selector();
41
- $autoloader_handler = new Autoloader_Handler(
42
- $plugins_handler->get_current_plugin_path(),
43
- $plugins_handler->get_all_active_plugins_paths(),
44
- new Autoloader_Locator( $version_selector ),
45
- $version_selector
46
- );
47
-
48
- // The autoloader must be reset when a plugin that was previously unknown is detected.
49
- if ( $autoloader_handler->should_autoloader_reset() ) {
50
- $jetpack_autoloader_latest_version = null;
51
- $jetpack_autoloader_loader = null;
52
- }
53
-
54
- if ( ! $autoloader_handler->is_latest_autoloader() || isset( $jetpack_autoloader_loader ) ) {
55
- return;
56
- }
57
-
58
- require_once __DIR__ . '/class-manifest-handler.php';
59
- require_once __DIR__ . '/class-version-loader.php';
60
-
61
- $jetpack_autoloader_loader = $autoloader_handler->build_autoloader();
62
- $autoloader_handler->update_autoloader_chain();
63
-
64
- // Now that the autoloader is ready we can load the files in the filemap safely.
65
- $jetpack_autoloader_loader->load_filemap();
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/ClassLoader.php CHANGED
@@ -37,13 +37,11 @@ namespace Composer\Autoload;
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see https://www.php-fig.org/psr/psr-0/
41
- * @see https://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
45
- private $vendorDir;
46
-
47
  // PSR-4
48
  private $prefixLengthsPsr4 = array();
49
  private $prefixDirsPsr4 = array();
@@ -59,13 +57,6 @@ class ClassLoader
59
  private $missingClasses = array();
60
  private $apcuPrefix;
61
 
62
- private static $registeredLoaders = array();
63
-
64
- public function __construct($vendorDir = null)
65
- {
66
- $this->vendorDir = $vendorDir;
67
- }
68
-
69
  public function getPrefixes()
70
  {
71
  if (!empty($this->prefixesPsr0)) {
@@ -309,15 +300,6 @@ class ClassLoader
309
  public function register($prepend = false)
310
  {
311
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
312
-
313
- if (null === $this->vendorDir) {
314
- //no-op
315
- } elseif ($prepend) {
316
- self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
317
- } else {
318
- unset(self::$registeredLoaders[$this->vendorDir]);
319
- self::$registeredLoaders[$this->vendorDir] = $this;
320
- }
321
  }
322
 
323
  /**
@@ -326,10 +308,6 @@ class ClassLoader
326
  public function unregister()
327
  {
328
  spl_autoload_unregister(array($this, 'loadClass'));
329
-
330
- if (null !== $this->vendorDir) {
331
- unset(self::$registeredLoaders[$this->vendorDir]);
332
- }
333
  }
334
 
335
  /**
@@ -389,16 +367,6 @@ class ClassLoader
389
  return $file;
390
  }
391
 
392
- /**
393
- * Returns the currently registered loaders indexed by their corresponding vendor directories.
394
- *
395
- * @return self[]
396
- */
397
- public static function getRegisteredLoaders()
398
- {
399
- return self::$registeredLoaders;
400
- }
401
-
402
  private function findFileWithExtension($class, $ext)
403
  {
404
  // PSR-4 lookup
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
 
 
45
  // PSR-4
46
  private $prefixLengthsPsr4 = array();
47
  private $prefixDirsPsr4 = array();
57
  private $missingClasses = array();
58
  private $apcuPrefix;
59
 
 
 
 
 
 
 
 
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
300
  public function register($prepend = false)
301
  {
302
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
 
 
 
 
 
 
 
 
 
303
  }
304
 
305
  /**
308
  public function unregister()
309
  {
310
  spl_autoload_unregister(array($this, 'loadClass'));
 
 
 
 
311
  }
312
 
313
  /**
367
  return $file;
368
  }
369
 
 
 
 
 
 
 
 
 
 
 
370
  private function findFileWithExtension($class, $ext)
371
  {
372
  // PSR-4 lookup
vendor/composer/InstalledVersions.php DELETED
@@ -1,316 +0,0 @@
1
- <?php
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
- namespace Composer;
14
-
15
- use Composer\Autoload\ClassLoader;
16
- use Composer\Semver\VersionParser;
17
-
18
-
19
-
20
-
21
-
22
-
23
- class InstalledVersions
24
- {
25
- private static $installed = array (
26
- 'root' =>
27
- array (
28
- 'pretty_version' => '2.0.0',
29
- 'version' => '2.0.0.0',
30
- 'aliases' =>
31
- array (
32
- ),
33
- 'reference' => NULL,
34
- 'name' => 'woocommerce/woocommerce-admin',
35
- ),
36
- 'versions' =>
37
- array (
38
- 'automattic/jetpack-autoloader' =>
39
- array (
40
- 'pretty_version' => 'v2.7.1',
41
- 'version' => '2.7.1.0',
42
- 'aliases' =>
43
- array (
44
- ),
45
- 'reference' => '5437697a56aefbdf707849b9833e1b36093d7a73',
46
- ),
47
- 'composer/installers' =>
48
- array (
49
- 'pretty_version' => 'v1.9.0',
50
- 'version' => '1.9.0.0',
51
- 'aliases' =>
52
- array (
53
- ),
54
- 'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
55
- ),
56
- 'roundcube/plugin-installer' =>
57
- array (
58
- 'replaced' =>
59
- array (
60
- 0 => '*',
61
- ),
62
- ),
63
- 'shama/baton' =>
64
- array (
65
- 'replaced' =>
66
- array (
67
- 0 => '*',
68
- ),
69
- ),
70
- 'woocommerce/woocommerce-admin' =>
71
- array (
72
- 'pretty_version' => '2.0.0',
73
- 'version' => '2.0.0.0',
74
- 'aliases' =>
75
- array (
76
- ),
77
- 'reference' => NULL,
78
- ),
79
- ),
80
- );
81
- private static $canGetVendors;
82
- private static $installedByVendor = array();
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
- public static function getInstalledPackages()
91
- {
92
- $packages = array();
93
- foreach (self::getInstalled() as $installed) {
94
- $packages[] = array_keys($installed['versions']);
95
- }
96
-
97
-
98
- if (1 === \count($packages)) {
99
- return $packages[0];
100
- }
101
-
102
- return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
103
- }
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
- public static function isInstalled($packageName)
114
- {
115
- foreach (self::getInstalled() as $installed) {
116
- if (isset($installed['versions'][$packageName])) {
117
- return true;
118
- }
119
- }
120
-
121
- return false;
122
- }
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
- public static function satisfies(VersionParser $parser, $packageName, $constraint)
138
- {
139
- $constraint = $parser->parseConstraints($constraint);
140
- $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
141
-
142
- return $provided->matches($constraint);
143
- }
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
- public static function getVersionRanges($packageName)
155
- {
156
- foreach (self::getInstalled() as $installed) {
157
- if (!isset($installed['versions'][$packageName])) {
158
- continue;
159
- }
160
-
161
- $ranges = array();
162
- if (isset($installed['versions'][$packageName]['pretty_version'])) {
163
- $ranges[] = $installed['versions'][$packageName]['pretty_version'];
164
- }
165
- if (array_key_exists('aliases', $installed['versions'][$packageName])) {
166
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
167
- }
168
- if (array_key_exists('replaced', $installed['versions'][$packageName])) {
169
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
170
- }
171
- if (array_key_exists('provided', $installed['versions'][$packageName])) {
172
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
173
- }
174
-
175
- return implode(' || ', $ranges);
176
- }
177
-
178
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
179
- }
180
-
181
-
182
-
183
-
184
-
185
- public static function getVersion($packageName)
186
- {
187
- foreach (self::getInstalled() as $installed) {
188
- if (!isset($installed['versions'][$packageName])) {
189
- continue;
190
- }
191
-
192
- if (!isset($installed['versions'][$packageName]['version'])) {
193
- return null;
194
- }
195
-
196
- return $installed['versions'][$packageName]['version'];
197
- }
198
-
199
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
200
- }
201
-
202
-
203
-
204
-
205
-
206
- public static function getPrettyVersion($packageName)
207
- {
208
- foreach (self::getInstalled() as $installed) {
209
- if (!isset($installed['versions'][$packageName])) {
210
- continue;
211
- }
212
-
213
- if (!isset($installed['versions'][$packageName]['pretty_version'])) {
214
- return null;
215
- }
216
-
217
- return $installed['versions'][$packageName]['pretty_version'];
218
- }
219
-
220
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
221
- }
222
-
223
-
224
-
225
-
226
-
227
- public static function getReference($packageName)
228
- {
229
- foreach (self::getInstalled() as $installed) {
230
- if (!isset($installed['versions'][$packageName])) {
231
- continue;
232
- }
233
-
234
- if (!isset($installed['versions'][$packageName]['reference'])) {
235
- return null;
236
- }
237
-
238
- return $installed['versions'][$packageName]['reference'];
239
- }
240
-
241
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
242
- }
243
-
244
-
245
-
246
-
247
-
248
- public static function getRootPackage()
249
- {
250
- $installed = self::getInstalled();
251
-
252
- return $installed[0]['root'];
253
- }
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
- public static function getRawData()
262
- {
263
- return self::$installed;
264
- }
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
- public static function reload($data)
285
- {
286
- self::$installed = $data;
287
- self::$installedByVendor = array();
288
- }
289
-
290
-
291
-
292
-
293
- private static function getInstalled()
294
- {
295
- if (null === self::$canGetVendors) {
296
- self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
297
- }
298
-
299
- $installed = array();
300
-
301
- if (self::$canGetVendors) {
302
-
303
- foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
304
- if (isset(self::$installedByVendor[$vendorDir])) {
305
- $installed[] = self::$installedByVendor[$vendorDir];
306
- } elseif (is_file($vendorDir.'/composer/installed.php')) {
307
- $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
308
- }
309
- }
310
- }
311
-
312
- $installed[] = self::$installed;
313
-
314
- return $installed;
315
- }
316
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_classmap.php CHANGED
@@ -7,5 +7,4 @@ $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
  'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php',
10
- 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
11
  );
7
 
8
  return array(
9
  'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php',
 
10
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInita537f22e61b714db0c75a63174123add
6
  {
7
  private static $loader;
8
 
@@ -22,17 +22,15 @@ class ComposerAutoloaderInita537f22e61b714db0c75a63174123add
22
  return self::$loader;
23
  }
24
 
25
- require __DIR__ . '/platform_check.php';
26
-
27
- spl_autoload_register(array('ComposerAutoloaderInita537f22e61b714db0c75a63174123add', 'loadClassLoader'), true, true);
28
- self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
- spl_autoload_unregister(array('ComposerAutoloaderInita537f22e61b714db0c75a63174123add', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
- require __DIR__ . '/autoload_static.php';
34
 
35
- call_user_func(\Composer\Autoload\ComposerStaticInita537f22e61b714db0c75a63174123add::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit38b3d38eb0faab3eda1eac718e9ae633
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit38b3d38eb0faab3eda1eac718e9ae633', 'loadClassLoader'), true, true);
26
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit38b3d38eb0faab3eda1eac718e9ae633', '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\ComposerStaticInit38b3d38eb0faab3eda1eac718e9ae633::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 ComposerStaticInita537f22e61b714db0c75a63174123add
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
@@ -35,15 +35,14 @@ class ComposerStaticInita537f22e61b714db0c75a63174123add
35
 
36
  public static $classMap = array (
37
  'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php',
38
- 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
39
  );
40
 
41
  public static function getInitializer(ClassLoader $loader)
42
  {
43
  return \Closure::bind(function () use ($loader) {
44
- $loader->prefixLengthsPsr4 = ComposerStaticInita537f22e61b714db0c75a63174123add::$prefixLengthsPsr4;
45
- $loader->prefixDirsPsr4 = ComposerStaticInita537f22e61b714db0c75a63174123add::$prefixDirsPsr4;
46
- $loader->classMap = ComposerStaticInita537f22e61b714db0c75a63174123add::$classMap;
47
 
48
  }, null, ClassLoader::class);
49
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit38b3d38eb0faab3eda1eac718e9ae633
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
35
 
36
  public static $classMap = array (
37
  'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php',
 
38
  );
39
 
40
  public static function getInitializer(ClassLoader $loader)
41
  {
42
  return \Closure::bind(function () use ($loader) {
43
+ $loader->prefixLengthsPsr4 = ComposerStaticInit38b3d38eb0faab3eda1eac718e9ae633::$prefixLengthsPsr4;
44
+ $loader->prefixDirsPsr4 = ComposerStaticInit38b3d38eb0faab3eda1eac718e9ae633::$prefixDirsPsr4;
45
+ $loader->classMap = ComposerStaticInit38b3d38eb0faab3eda1eac718e9ae633::$classMap;
46
 
47
  }, null, ClassLoader::class);
48
  }
vendor/composer/installed.json CHANGED
@@ -1,195 +1,187 @@
1
- {
2
- "packages": [
3
- {
4
- "name": "automattic/jetpack-autoloader",
5
- "version": "v2.7.1",
6
- "version_normalized": "2.7.1.0",
7
- "source": {
8
- "type": "git",
9
- "url": "https://github.com/Automattic/jetpack-autoloader.git",
10
- "reference": "5437697a56aefbdf707849b9833e1b36093d7a73"
11
- },
12
- "dist": {
13
- "type": "zip",
14
- "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/5437697a56aefbdf707849b9833e1b36093d7a73",
15
- "reference": "5437697a56aefbdf707849b9833e1b36093d7a73",
16
- "shasum": ""
17
- },
18
- "require": {
19
- "composer-plugin-api": "^1.1 || ^2.0"
20
- },
21
- "require-dev": {
22
- "yoast/phpunit-polyfills": "0.2.0"
23
- },
24
- "time": "2020-12-18T22:33:59+00:00",
25
- "type": "composer-plugin",
26
- "extra": {
27
- "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin"
28
- },
29
- "installation-source": "dist",
30
- "autoload": {
31
- "classmap": [
32
- "src/AutoloadGenerator.php"
33
- ],
34
- "psr-4": {
35
- "Automattic\\Jetpack\\Autoloader\\": "src"
36
- }
37
- },
38
- "notification-url": "https://packagist.org/downloads/",
39
- "license": [
40
- "GPL-2.0-or-later"
41
- ],
42
- "description": "Creates a custom autoloader for a plugin or theme.",
43
- "support": {
44
- "source": "https://github.com/Automattic/jetpack-autoloader/tree/v2.7.1"
45
- },
46
- "install-path": "../automattic/jetpack-autoloader"
47
  },
48
- {
49
- "name": "composer/installers",
50
- "version": "v1.9.0",
51
- "version_normalized": "1.9.0.0",
52
- "source": {
53
- "type": "git",
54
- "url": "https://github.com/composer/installers.git",
55
- "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca"
56
- },
57
- "dist": {
58
- "type": "zip",
59
- "url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
60
- "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
61
- "shasum": ""
62
- },
63
- "require": {
64
- "composer-plugin-api": "^1.0 || ^2.0"
65
- },
66
- "replace": {
67
- "roundcube/plugin-installer": "*",
68
- "shama/baton": "*"
69
- },
70
- "require-dev": {
71
- "composer/composer": "1.6.* || 2.0.*@dev",
72
- "composer/semver": "1.0.* || 2.0.*@dev",
73
- "phpunit/phpunit": "^4.8.36",
74
- "sebastian/comparator": "^1.2.4",
75
- "symfony/process": "^2.3"
76
- },
77
- "time": "2020-04-07T06:57:05+00:00",
78
- "type": "composer-plugin",
79
- "extra": {
80
- "class": "Composer\\Installers\\Plugin",
81
- "branch-alias": {
82
- "dev-master": "1.0-dev"
83
- }
84
- },
85
- "installation-source": "dist",
86
- "autoload": {
87
- "psr-4": {
88
- "Composer\\Installers\\": "src/Composer/Installers"
89
- }
90
- },
91
- "notification-url": "https://packagist.org/downloads/",
92
- "license": [
93
- "MIT"
94
- ],
95
- "authors": [
96
- {
97
- "name": "Kyle Robinson Young",
98
- "email": "kyle@dontkry.com",
99
- "homepage": "https://github.com/shama"
100
- }
101
- ],
102
- "description": "A multi-framework Composer library installer",
103
- "homepage": "https://composer.github.io/installers/",
104
- "keywords": [
105
- "Craft",
106
- "Dolibarr",
107
- "Eliasis",
108
- "Hurad",
109
- "ImageCMS",
110
- "Kanboard",
111
- "Lan Management System",
112
- "MODX Evo",
113
- "MantisBT",
114
- "Mautic",
115
- "Maya",
116
- "OXID",
117
- "Plentymarkets",
118
- "Porto",
119
- "RadPHP",
120
- "SMF",
121
- "Thelia",
122
- "Whmcs",
123
- "WolfCMS",
124
- "agl",
125
- "aimeos",
126
- "annotatecms",
127
- "attogram",
128
- "bitrix",
129
- "cakephp",
130
- "chef",
131
- "cockpit",
132
- "codeigniter",
133
- "concrete5",
134
- "croogo",
135
- "dokuwiki",
136
- "drupal",
137
- "eZ Platform",
138
- "elgg",
139
- "expressionengine",
140
- "fuelphp",
141
- "grav",
142
- "installer",
143
- "itop",
144
- "joomla",
145
- "known",
146
- "kohana",
147
- "laravel",
148
- "lavalite",
149
- "lithium",
150
- "magento",
151
- "majima",
152
- "mako",
153
- "mediawiki",
154
- "modulework",
155
- "modx",
156
- "moodle",
157
- "osclass",
158
- "phpbb",
159
- "piwik",
160
- "ppi",
161
- "puppet",
162
- "pxcms",
163
- "reindex",
164
- "roundcube",
165
- "shopware",
166
- "silverstripe",
167
- "sydes",
168
- "sylius",
169
- "symfony",
170
- "typo3",
171
- "wordpress",
172
- "yawik",
173
- "zend",
174
- "zikula"
175
  ],
176
- "support": {
177
- "issues": "https://github.com/composer/installers/issues",
178
- "source": "https://github.com/composer/installers/tree/v1.9.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  },
180
- "funding": [
181
- {
182
- "url": "https://packagist.com",
183
- "type": "custom"
184
- },
185
- {
186
- "url": "https://tidelift.com/funding/github/packagist/composer/composer",
187
- "type": "tidelift"
188
- }
189
- ],
190
- "install-path": "./installers"
191
- }
192
- ],
193
- "dev": false,
194
- "dev-package-names": []
195
- }
1
+ [
2
+ {
3
+ "name": "automattic/jetpack-autoloader",
4
+ "version": "v2.9.1",
5
+ "version_normalized": "2.9.1.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/Automattic/jetpack-autoloader.git",
9
+ "reference": "d6ca2cc26ad6963e1be19b3338a9e98f40d9bd88"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/d6ca2cc26ad6963e1be19b3338a9e98f40d9bd88",
14
+ "reference": "d6ca2cc26ad6963e1be19b3338a9e98f40d9bd88",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "composer-plugin-api": "^1.1 || ^2.0"
19
+ },
20
+ "require-dev": {
21
+ "yoast/phpunit-polyfills": "0.2.0"
22
+ },
23
+ "time": "2021-02-05T19:07:06+00:00",
24
+ "type": "composer-plugin",
25
+ "extra": {
26
+ "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin",
27
+ "mirror-repo": "Automattic/jetpack-autoloader"
28
+ },
29
+ "installation-source": "dist",
30
+ "autoload": {
31
+ "classmap": [
32
+ "src/AutoloadGenerator.php"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  ],
34
+ "psr-4": {
35
+ "Automattic\\Jetpack\\Autoloader\\": "src"
36
+ }
37
+ },
38
+ "notification-url": "https://packagist.org/downloads/",
39
+ "license": [
40
+ "GPL-2.0-or-later"
41
+ ],
42
+ "description": "Creates a custom autoloader for a plugin or theme."
43
+ },
44
+ {
45
+ "name": "composer/installers",
46
+ "version": "v1.9.0",
47
+ "version_normalized": "1.9.0.0",
48
+ "source": {
49
+ "type": "git",
50
+ "url": "https://github.com/composer/installers.git",
51
+ "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca"
52
+ },
53
+ "dist": {
54
+ "type": "zip",
55
+ "url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
56
+ "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
57
+ "shasum": ""
58
+ },
59
+ "require": {
60
+ "composer-plugin-api": "^1.0 || ^2.0"
61
+ },
62
+ "replace": {
63
+ "roundcube/plugin-installer": "*",
64
+ "shama/baton": "*"
65
+ },
66
+ "require-dev": {
67
+ "composer/composer": "1.6.* || 2.0.*@dev",
68
+ "composer/semver": "1.0.* || 2.0.*@dev",
69
+ "phpunit/phpunit": "^4.8.36",
70
+ "sebastian/comparator": "^1.2.4",
71
+ "symfony/process": "^2.3"
72
+ },
73
+ "time": "2020-04-07T06:57:05+00:00",
74
+ "type": "composer-plugin",
75
+ "extra": {
76
+ "class": "Composer\\Installers\\Plugin",
77
+ "branch-alias": {
78
+ "dev-master": "1.0-dev"
79
+ }
80
+ },
81
+ "installation-source": "dist",
82
+ "autoload": {
83
+ "psr-4": {
84
+ "Composer\\Installers\\": "src/Composer/Installers"
85
+ }
86
+ },
87
+ "notification-url": "https://packagist.org/downloads/",
88
+ "license": [
89
+ "MIT"
90
+ ],
91
+ "authors": [
92
+ {
93
+ "name": "Kyle Robinson Young",
94
+ "email": "kyle@dontkry.com",
95
+ "homepage": "https://github.com/shama"
96
+ }
97
+ ],
98
+ "description": "A multi-framework Composer library installer",
99
+ "homepage": "https://composer.github.io/installers/",
100
+ "keywords": [
101
+ "Craft",
102
+ "Dolibarr",
103
+ "Eliasis",
104
+ "Hurad",
105
+ "ImageCMS",
106
+ "Kanboard",
107
+ "Lan Management System",
108
+ "MODX Evo",
109
+ "MantisBT",
110
+ "Mautic",
111
+ "Maya",
112
+ "OXID",
113
+ "Plentymarkets",
114
+ "Porto",
115
+ "RadPHP",
116
+ "SMF",
117
+ "Thelia",
118
+ "Whmcs",
119
+ "WolfCMS",
120
+ "agl",
121
+ "aimeos",
122
+ "annotatecms",
123
+ "attogram",
124
+ "bitrix",
125
+ "cakephp",
126
+ "chef",
127
+ "cockpit",
128
+ "codeigniter",
129
+ "concrete5",
130
+ "croogo",
131
+ "dokuwiki",
132
+ "drupal",
133
+ "eZ Platform",
134
+ "elgg",
135
+ "expressionengine",
136
+ "fuelphp",
137
+ "grav",
138
+ "installer",
139
+ "itop",
140
+ "joomla",
141
+ "known",
142
+ "kohana",
143
+ "laravel",
144
+ "lavalite",
145
+ "lithium",
146
+ "magento",
147
+ "majima",
148
+ "mako",
149
+ "mediawiki",
150
+ "modulework",
151
+ "modx",
152
+ "moodle",
153
+ "osclass",
154
+ "phpbb",
155
+ "piwik",
156
+ "ppi",
157
+ "puppet",
158
+ "pxcms",
159
+ "reindex",
160
+ "roundcube",
161
+ "shopware",
162
+ "silverstripe",
163
+ "sydes",
164
+ "sylius",
165
+ "symfony",
166
+ "typo3",
167
+ "wordpress",
168
+ "yawik",
169
+ "zend",
170
+ "zikula"
171
+ ],
172
+ "support": {
173
+ "issues": "https://github.com/composer/installers/issues",
174
+ "source": "https://github.com/composer/installers/tree/v1.9.0"
175
+ },
176
+ "funding": [
177
+ {
178
+ "url": "https://packagist.com",
179
+ "type": "custom"
180
  },
181
+ {
182
+ "url": "https://tidelift.com/funding/github/packagist/composer/composer",
183
+ "type": "tidelift"
184
+ }
185
+ ]
186
+ }
187
+ ]
 
 
 
 
 
 
 
 
 
vendor/composer/installed.php DELETED
@@ -1,56 +0,0 @@
1
- <?php return array (
2
- 'root' =>
3
- array (
4
- 'pretty_version' => '2.0.0',
5
- 'version' => '2.0.0.0',
6
- 'aliases' =>
7
- array (
8
- ),
9
- 'reference' => NULL,
10
- 'name' => 'woocommerce/woocommerce-admin',
11
- ),
12
- 'versions' =>
13
- array (
14
- 'automattic/jetpack-autoloader' =>
15
- array (
16
- 'pretty_version' => 'v2.7.1',
17
- 'version' => '2.7.1.0',
18
- 'aliases' =>
19
- array (
20
- ),
21
- 'reference' => '5437697a56aefbdf707849b9833e1b36093d7a73',
22
- ),
23
- 'composer/installers' =>
24
- array (
25
- 'pretty_version' => 'v1.9.0',
26
- 'version' => '1.9.0.0',
27
- 'aliases' =>
28
- array (
29
- ),
30
- 'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
31
- ),
32
- 'roundcube/plugin-installer' =>
33
- array (
34
- 'replaced' =>
35
- array (
36
- 0 => '*',
37
- ),
38
- ),
39
- 'shama/baton' =>
40
- array (
41
- 'replaced' =>
42
- array (
43
- 0 => '*',
44
- ),
45
- ),
46
- 'woocommerce/woocommerce-admin' =>
47
- array (
48
- 'pretty_version' => '2.0.0',
49
- 'version' => '2.0.0.0',
50
- 'aliases' =>
51
- array (
52
- ),
53
- 'reference' => NULL,
54
- ),
55
- ),
56
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/jetpack_autoload_classmap.php CHANGED
@@ -7,7 +7,7 @@ $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
  'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => array(
10
- 'version' => '2.7.1.0',
11
  'path' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php'
12
  ),
13
  );
7
 
8
  return array(
9
  'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => array(
10
+ 'version' => '2.9.1.0',
11
  'path' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php'
12
  ),
13
  );
vendor/composer/jetpack_autoload_psr4.php CHANGED
@@ -11,11 +11,11 @@ return array(
11
  'path' => array( $vendorDir . '/composer/installers/src/Composer/Installers' )
12
  ),
13
  'Automattic\\WooCommerce\\Admin\\' => array(
14
- 'version' => '2.0.0.0',
15
  'path' => array( $baseDir . '/src' )
16
  ),
17
  'Automattic\\Jetpack\\Autoloader\\' => array(
18
- 'version' => '2.7.1.0',
19
  'path' => array( $vendorDir . '/automattic/jetpack-autoloader/src' )
20
  ),
21
  );
11
  'path' => array( $vendorDir . '/composer/installers/src/Composer/Installers' )
12
  ),
13
  'Automattic\\WooCommerce\\Admin\\' => array(
14
+ 'version' => '2.0.1.0',
15
  'path' => array( $baseDir . '/src' )
16
  ),
17
  'Automattic\\Jetpack\\Autoloader\\' => array(
18
+ 'version' => '2.9.1.0',
19
  'path' => array( $vendorDir . '/automattic/jetpack-autoloader/src' )
20
  ),
21
  );
vendor/composer/platform_check.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- // platform_check.php @generated by Composer
4
-
5
- $issues = array();
6
-
7
- if (!(PHP_VERSION_ID >= 70000)) {
8
- $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.';
9
- }
10
-
11
- if ($issues) {
12
- if (!headers_sent()) {
13
- header('HTTP/1.1 500 Internal Server Error');
14
- }
15
- if (!ini_get('display_errors')) {
16
- if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17
- fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18
- } elseif (!headers_sent()) {
19
- echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
20
- }
21
- }
22
- trigger_error(
23
- 'Composer detected issues in your platform: ' . implode(' ', $issues),
24
- E_USER_ERROR
25
- );
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/jetpack-autoloader/autoload_functions.php DELETED
@@ -1,74 +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\jpb0eb90e766c41d008f579055bbf9b3bc;
9
-
10
- // phpcs:ignore
11
-
12
- /**
13
- * Used for autoloading jetpack packages.
14
- *
15
- * @param string $class_name Class Name to load.
16
- *
17
- * @return Boolean Whether the class_name was found in the classmap.
18
- */
19
- function autoloader( $class_name ) {
20
- global $jetpack_autoloader_loader;
21
- if ( ! isset( $jetpack_autoloader_loader ) ) {
22
- return false;
23
- }
24
-
25
- $file = $jetpack_autoloader_loader->find_class_file( $class_name );
26
- if ( ! isset( $file ) ) {
27
- return false;
28
- }
29
-
30
- require_once $file;
31
- return true;
32
- }
33
-
34
- /**
35
- * Finds the latest installed autoloader. If this is the latest autoloader, sets
36
- * up the classmap and filemap.
37
- */
38
- function set_up_autoloader() {
39
- global $jetpack_autoloader_latest_version;
40
- global $jetpack_autoloader_loader;
41
-
42
- require_once __DIR__ . '/class-plugins-handler.php';
43
- require_once __DIR__ . '/class-version-selector.php';
44
- require_once __DIR__ . '/class-autoloader-locator.php';
45
- require_once __DIR__ . '/class-autoloader-handler.php';
46
-
47
- $plugins_handler = new Plugins_Handler();
48
- $version_selector = new Version_Selector();
49
- $autoloader_handler = new Autoloader_Handler(
50
- $plugins_handler->get_current_plugin_path(),
51
- $plugins_handler->get_all_active_plugins_paths(),
52
- new Autoloader_Locator( $version_selector ),
53
- $version_selector
54
- );
55
-
56
- // The autoloader must be reset when a plugin that was previously unknown is detected.
57
- if ( $autoloader_handler->should_autoloader_reset() ) {
58
- $jetpack_autoloader_latest_version = null;
59
- $jetpack_autoloader_loader = null;
60
- }
61
-
62
- if ( ! $autoloader_handler->is_latest_autoloader() || isset( $jetpack_autoloader_loader ) ) {
63
- return;
64
- }
65
-
66
- require_once __DIR__ . '/class-manifest-handler.php';
67
- require_once __DIR__ . '/class-version-loader.php';
68
-
69
- $jetpack_autoloader_loader = $autoloader_handler->build_autoloader();
70
- $autoloader_handler->update_autoloader_chain();
71
-
72
- // Now that the autoloader is ready we can load the files in the filemap safely.
73
- $jetpack_autoloader_loader->load_filemap();
74
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/jetpack-autoloader/class-autoloader-handler.php CHANGED
@@ -5,15 +5,24 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
 
 
12
  /**
13
  * This class selects the package version for the autoloader.
14
  */
15
  class Autoloader_Handler {
16
 
 
 
 
 
 
 
 
17
  /**
18
  * The Hook_Manager instance.
19
  *
@@ -38,22 +47,58 @@ class Autoloader_Handler {
38
  /**
39
  * The constructor.
40
  *
 
41
  * @param Hook_Manager $hook_manager The Hook_Manager instance.
42
  * @param Manifest_Reader $manifest_reader The Manifest_Reader instance.
43
  * @param Version_Selector $version_selector The Version_Selector instance.
44
  */
45
- public function __construct( $hook_manager, $manifest_reader, $version_selector ) {
 
46
  $this->hook_manager = $hook_manager;
47
  $this->manifest_reader = $manifest_reader;
48
  $this->version_selector = $version_selector;
49
  }
50
 
51
  /**
52
- * Creates an autoloader using the given plugins and activates it.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  *
54
  * @param string[] $plugins The plugins to initialize the autoloader for.
55
  */
56
- public function create_autoloader( $plugins ) {
57
  global $jetpack_packages_psr4;
58
  $jetpack_packages_psr4 = array();
59
  $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
@@ -73,19 +118,30 @@ class Autoloader_Handler {
73
  $jetpack_packages_filemap
74
  );
75
 
76
- // Activate the autoloader.
77
- Autoloader::activate( $loader );
 
 
78
  }
79
 
80
  /**
81
  * Resets the active autoloader and all related global state.
82
  */
83
  public function reset_autoloader() {
84
- global $jetpack_autoloader_loader;
85
- global $jetpack_autoloader_latest_version;
86
-
87
  $this->hook_manager->reset();
88
- $jetpack_autoloader_loader = null;
 
 
89
  $jetpack_autoloader_latest_version = null;
 
 
 
 
 
 
 
 
 
90
  }
91
  }
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
12
+ use Automattic\Jetpack\Autoloader\AutoloadGenerator;
13
+
14
  /**
15
  * This class selects the package version for the autoloader.
16
  */
17
  class Autoloader_Handler {
18
 
19
+ /**
20
+ * The PHP_Autoloader instance.
21
+ *
22
+ * @var PHP_Autoloader
23
+ */
24
+ private $php_autoloader;
25
+
26
  /**
27
  * The Hook_Manager instance.
28
  *
47
  /**
48
  * The constructor.
49
  *
50
+ * @param PHP_Autoloader $php_autoloader The PHP_Autoloader instance.
51
  * @param Hook_Manager $hook_manager The Hook_Manager instance.
52
  * @param Manifest_Reader $manifest_reader The Manifest_Reader instance.
53
  * @param Version_Selector $version_selector The Version_Selector instance.
54
  */
55
+ public function __construct( $php_autoloader, $hook_manager, $manifest_reader, $version_selector ) {
56
+ $this->php_autoloader = $php_autoloader;
57
  $this->hook_manager = $hook_manager;
58
  $this->manifest_reader = $manifest_reader;
59
  $this->version_selector = $version_selector;
60
  }
61
 
62
  /**
63
+ * Checks to see whether or not an autoloader is currently in the process of initializing.
64
+ *
65
+ * @return bool
66
+ */
67
+ public function is_initializing() {
68
+ // If no version has been set it means that no autoloader has started initializing yet.
69
+ global $jetpack_autoloader_latest_version;
70
+ if ( ! isset( $jetpack_autoloader_latest_version ) ) {
71
+ return false;
72
+ }
73
+
74
+ // When the version is set but the classmap is not it ALWAYS means that this is the
75
+ // latest autoloader and is being included by an older one.
76
+ global $jetpack_packages_classmap;
77
+ if ( empty( $jetpack_packages_classmap ) ) {
78
+ return true;
79
+ }
80
+
81
+ // Version 2.4.0 added a new global and altered the reset semantics. We need to check
82
+ // the other global as well since it may also point at initialization.
83
+ // Note: We don't need to check for the class first because every autoloader that
84
+ // will set the latest version global requires this class in the classmap.
85
+ $replacing_version = $jetpack_packages_classmap[ AutoloadGenerator::class ]['version'];
86
+ if ( $this->version_selector->is_dev_version( $replacing_version ) || version_compare( $replacing_version, '2.4.0.0', '>=' ) ) {
87
+ global $jetpack_autoloader_loader;
88
+ if ( ! isset( $jetpack_autoloader_loader ) ) {
89
+ return true;
90
+ }
91
+ }
92
+
93
+ return false;
94
+ }
95
+
96
+ /**
97
+ * Activates an autoloader using the given plugins and activates it.
98
  *
99
  * @param string[] $plugins The plugins to initialize the autoloader for.
100
  */
101
+ public function activate_autoloader( $plugins ) {
102
  global $jetpack_packages_psr4;
103
  $jetpack_packages_psr4 = array();
104
  $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
118
  $jetpack_packages_filemap
119
  );
120
 
121
+ $this->php_autoloader->register_autoloader( $loader );
122
+
123
+ // Now that the autoloader is active we can load the filemap.
124
+ $loader->load_filemap();
125
  }
126
 
127
  /**
128
  * Resets the active autoloader and all related global state.
129
  */
130
  public function reset_autoloader() {
131
+ $this->php_autoloader->unregister_autoloader();
 
 
132
  $this->hook_manager->reset();
133
+
134
+ // Clear all of the autoloader globals so that older autoloaders don't do anything strange.
135
+ global $jetpack_autoloader_latest_version;
136
  $jetpack_autoloader_latest_version = null;
137
+
138
+ global $jetpack_packages_classmap;
139
+ $jetpack_packages_classmap = array(); // Must be array to avoid exceptions in old autoloaders!
140
+
141
+ global $jetpack_packages_psr4;
142
+ $jetpack_packages_psr4 = array(); // Must be array to avoid exceptions in old autoloaders!
143
+
144
+ global $jetpack_packages_filemap;
145
+ $jetpack_packages_filemap = array(); // Must be array to avoid exceptions in old autoloaders!
146
  }
147
  }
vendor/jetpack-autoloader/class-autoloader-locator.php CHANGED
@@ -5,11 +5,11 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
12
- use \Automattic\Jetpack\Autoloader\AutoloadGenerator;
13
 
14
  /**
15
  * This class locates autoloaders.
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
12
+ use Automattic\Jetpack\Autoloader\AutoloadGenerator;
13
 
14
  /**
15
  * This class locates autoloaders.
vendor/jetpack-autoloader/class-autoloader.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
@@ -30,6 +30,12 @@ class Autoloader {
30
 
31
  // phpcs:disable Generic.Commenting.DocComment.MissingShort
32
 
 
 
 
 
 
 
33
  /** @var Plugin_Locator $plugin_locator */
34
  $plugin_locator = $container->get( Plugin_Locator::class );
35
 
@@ -39,29 +45,39 @@ class Autoloader {
39
  // The current plugin is the one that we are attempting to initialize here.
40
  $current_plugin = $plugin_locator->find_current_plugin();
41
 
 
 
 
 
 
 
 
42
  // The cached plugins are all of those that were active or discovered by the autoloader during a previous request.
43
  // Note that it's possible this list will include plugins that have since been deactivated, but after a request
44
  // the cache should be updated and the deactivated plugins will be removed.
45
  $cached_plugins = $plugins_handler->get_cached_plugins();
46
 
47
- // The active plugins are those that we were able to discover in on the site. This list will not include
48
- // mu-plugins, those activated by code, or those who are hidden by filtering.
49
- // By combining these lists we can preemptively load classes for plugins that are activated via another method.
50
- // While this may result in us considering packages in deactivated plugins the request after they're removed,
51
- // there shouldn't be any problems as a result and the eventual consistency is reliable enough.
52
- $all_plugins = array_values( array_unique( array_merge( $plugins_handler->get_active_plugins(), $cached_plugins ) ) );
 
 
 
 
 
 
53
 
54
  /** @var Latest_Autoloader_Guard $guard */
55
  $guard = $container->get( Latest_Autoloader_Guard::class );
56
- if ( $guard->should_stop_init( $current_plugin, $all_plugins ) ) {
57
  return;
58
  }
59
 
60
- /** @var Autoloader_Handler $autoloader_handler */
61
- $autoloader_handler = $container->get( Autoloader_Handler::class );
62
-
63
  // Initialize the autoloader using the handler now that we're ready.
64
- $autoloader_handler->create_autoloader( $all_plugins );
65
 
66
  /** @var Hook_Manager $hook_manager */
67
  $hook_manager = $container->get( Hook_Manager::class );
@@ -71,7 +87,7 @@ class Autoloader {
71
  // deactivated from being considered in other requests.
72
  $hook_manager->add_action(
73
  'shutdown',
74
- function () use ( $plugins_handler, $cached_plugins ) {
75
  // Don't save a broken cache if an error happens during some plugin's initialization.
76
  if ( ! did_action( 'plugins_loaded' ) ) {
77
  // Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
@@ -82,10 +98,12 @@ class Autoloader {
82
  return;
83
  }
84
 
85
- // Load the active plugins fresh since the list we have above might not contain
86
  // plugins that were activated but did not reset the autoloader. This happens
87
- // because they were already included in the cache.
88
- $active_plugins = $plugins_handler->get_active_plugins();
 
 
89
 
90
  // The paths should be sorted for easy comparisons with those loaded from the cache.
91
  // Note we don't need to sort the cached entries because they're already sorted.
@@ -102,58 +120,4 @@ class Autoloader {
102
 
103
  // phpcs:enable Generic.Commenting.DocComment.MissingShort
104
  }
105
-
106
- /**
107
- * Loads a class file if one could be found.
108
- *
109
- * @param string $class_name The name of the class to autoload.
110
- *
111
- * @return bool Indicates whether or not a class file was loaded.
112
- */
113
- public static function load_class( $class_name ) {
114
- global $jetpack_autoloader_loader;
115
- if ( ! isset( $jetpack_autoloader_loader ) ) {
116
- return;
117
- }
118
-
119
- $file = $jetpack_autoloader_loader->find_class_file( $class_name );
120
- if ( ! isset( $file ) ) {
121
- return false;
122
- }
123
-
124
- require $file;
125
- return true;
126
- }
127
-
128
- /**
129
- * Activates this autoloader and deactivates any other v2 autoloaders that may be present.
130
- *
131
- * @param Version_Loader $version_loader The version loader for our autoloader.
132
- */
133
- public static function activate( $version_loader ) {
134
- // Set the global autoloader to indicate that we've activated this autoloader.
135
- global $jetpack_autoloader_loader;
136
- $jetpack_autoloader_loader = $version_loader;
137
-
138
- // Remove any v2 autoloader that we've already registered.
139
- $autoload_chain = spl_autoload_functions();
140
- foreach ( $autoload_chain as $autoloader ) {
141
- // Jetpack autoloaders are always strings.
142
- if ( ! is_string( $autoloader ) ) {
143
- continue;
144
- }
145
-
146
- // We can identify a v2 autoloader using the namespace prefix without the unique suffix.
147
- if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $autoloader, 0, 32 ) ) {
148
- spl_autoload_unregister( $autoloader );
149
- continue;
150
- }
151
- }
152
-
153
- // Ensure that the autoloader is first to avoid contention with others.
154
- spl_autoload_register( self::class . '::load_class', true, true );
155
-
156
- // Now that we've activated the autoloader we should load the filemap.
157
- $jetpack_autoloader_loader->load_filemap();
158
- }
159
  }
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
30
 
31
  // phpcs:disable Generic.Commenting.DocComment.MissingShort
32
 
33
+ /** @var Autoloader_Handler $autoloader_handler */
34
+ $autoloader_handler = $container->get( Autoloader_Handler::class );
35
+
36
+ // If the autoloader is already initializing it means that it has included us as the latest.
37
+ $was_included_by_autoloader = $autoloader_handler->is_initializing();
38
+
39
  /** @var Plugin_Locator $plugin_locator */
40
  $plugin_locator = $container->get( Plugin_Locator::class );
41
 
45
  // The current plugin is the one that we are attempting to initialize here.
46
  $current_plugin = $plugin_locator->find_current_plugin();
47
 
48
+ // The active plugins are those that we were able to discover on the site. This list will not
49
+ // include mu-plugins, those activated by code, or those who are hidden by filtering. We also
50
+ // want to take care to not consider the current plugin unknown if it was included by an
51
+ // autoloader. This avoids the case where a plugin will be marked "active" while deactivated
52
+ // due to it having the latest autoloader.
53
+ $active_plugins = $plugins_handler->get_active_plugins( true, ! $was_included_by_autoloader );
54
+
55
  // The cached plugins are all of those that were active or discovered by the autoloader during a previous request.
56
  // Note that it's possible this list will include plugins that have since been deactivated, but after a request
57
  // the cache should be updated and the deactivated plugins will be removed.
58
  $cached_plugins = $plugins_handler->get_cached_plugins();
59
 
60
+ // We combine the active list and cached list to preemptively load classes for plugins that are
61
+ // presently unknown but will be loaded during the request. While this may result in us considering packages in
62
+ // deactivated plugins there shouldn't be any problems as a result and the eventual consistency is sufficient.
63
+ $all_plugins = array_merge( $active_plugins, $cached_plugins );
64
+
65
+ // In particular we also include the current plugin to address the case where it is the latest autoloader
66
+ // but also unknown (and not cached). We don't want it in the active list because we don't know that it
67
+ // is active but we need it in the all plugins list so that it is considered by the autoloader.
68
+ $all_plugins[] = $current_plugin;
69
+
70
+ // We require uniqueness in the array to avoid processing the same plugin more than once.
71
+ $all_plugins = array_values( array_unique( $all_plugins ) );
72
 
73
  /** @var Latest_Autoloader_Guard $guard */
74
  $guard = $container->get( Latest_Autoloader_Guard::class );
75
+ if ( $guard->should_stop_init( $current_plugin, $all_plugins, $was_included_by_autoloader ) ) {
76
  return;
77
  }
78
 
 
 
 
79
  // Initialize the autoloader using the handler now that we're ready.
80
+ $autoloader_handler->activate_autoloader( $all_plugins );
81
 
82
  /** @var Hook_Manager $hook_manager */
83
  $hook_manager = $container->get( Hook_Manager::class );
87
  // deactivated from being considered in other requests.
88
  $hook_manager->add_action(
89
  'shutdown',
90
+ function () use ( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) {
91
  // Don't save a broken cache if an error happens during some plugin's initialization.
92
  if ( ! did_action( 'plugins_loaded' ) ) {
93
  // Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
98
  return;
99
  }
100
 
101
+ // Load the active plugins fresh since the list we pulled earlier might not contain
102
  // plugins that were activated but did not reset the autoloader. This happens
103
+ // when a plugin is in the cache but not "active" when the autoloader loads.
104
+ // We also want to make sure that plugins which are deactivating are not
105
+ // considered "active" so that they will be removed from the cache now.
106
+ $active_plugins = $plugins_handler->get_active_plugins( false, ! $was_included_by_autoloader );
107
 
108
  // The paths should be sorted for easy comparisons with those loaded from the cache.
109
  // Note we don't need to sort the cached entries because they're already sorted.
120
 
121
  // phpcs:enable Generic.Commenting.DocComment.MissingShort
122
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  }
vendor/jetpack-autoloader/class-container.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
@@ -95,6 +95,9 @@ class Container {
95
  $this->get( Version_Selector::class )
96
  );
97
 
 
 
 
98
  require_once __DIR__ . '/class-manifest-reader.php';
99
  $this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
100
  $this->get( Version_Selector::class )
@@ -108,6 +111,7 @@ class Container {
108
 
109
  require_once __DIR__ . '/class-autoloader-handler.php';
110
  $this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
 
111
  $this->get( Hook_Manager::class ),
112
  $this->get( Manifest_Reader::class ),
113
  $this->get( Version_Selector::class )
@@ -128,22 +132,18 @@ class Container {
128
  * Initializes any of the globals needed by the autoloader.
129
  */
130
  private function initialize_globals() {
 
 
 
 
 
 
 
131
  // Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
132
  // but was not discoverable, we will record them in this array to track them as "active".
133
  global $jetpack_autoloader_activating_plugins_paths;
134
  if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
135
  $jetpack_autoloader_activating_plugins_paths = array();
136
  }
137
-
138
- // Since older autoloaders include newer ones, we need to be able to tell the difference between an
139
- // inclusion via autoloader and an inclusion via plugin file. This allows the autoloader to
140
- // perform special tasks for each kind of inclusion.
141
- global $jetpack_autoloader_including_latest;
142
- if ( ! isset( $jetpack_autoloader_including_latest ) ) {
143
- // If the latest version global has been set but the including latest hasn't, it means that an
144
- // older autoloader without support for the global is including us.
145
- global $jetpack_autoloader_latest_version;
146
- $jetpack_autoloader_including_latest = isset( $jetpack_autoloader_latest_version );
147
- }
148
  }
149
  }
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
95
  $this->get( Version_Selector::class )
96
  );
97
 
98
+ require_once __DIR__ . '/class-php-autoloader.php';
99
+ $this->dependencies[ PHP_Autoloader::class ] = new PHP_Autoloader();
100
+
101
  require_once __DIR__ . '/class-manifest-reader.php';
102
  $this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
103
  $this->get( Version_Selector::class )
111
 
112
  require_once __DIR__ . '/class-autoloader-handler.php';
113
  $this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
114
+ $this->get( PHP_Autoloader::class ),
115
  $this->get( Hook_Manager::class ),
116
  $this->get( Manifest_Reader::class ),
117
  $this->get( Version_Selector::class )
132
  * Initializes any of the globals needed by the autoloader.
133
  */
134
  private function initialize_globals() {
135
+ /*
136
+ * This global was retired in version 2.9. The value is set to 'false' to maintain
137
+ * compatibility with older versions of the autoloader.
138
+ */
139
+ global $jetpack_autoloader_including_latest;
140
+ $jetpack_autoloader_including_latest = false;
141
+
142
  // Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
143
  // but was not discoverable, we will record them in this array to track them as "active".
144
  global $jetpack_autoloader_activating_plugins_paths;
145
  if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
146
  $jetpack_autoloader_activating_plugins_paths = array();
147
  }
 
 
 
 
 
 
 
 
 
 
 
148
  }
149
  }
vendor/jetpack-autoloader/class-hook-manager.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
vendor/jetpack-autoloader/class-latest-autoloader-guard.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
@@ -53,38 +53,31 @@ class Latest_Autoloader_Guard {
53
  * has the side-effect of actually loading the latest autoloader in the event that this
54
  * is not it.
55
  *
56
- * @param string $current_plugin The current plugin we're checking.
57
- * @param string[] $plugins The active plugins to check for autoloaders in.
 
58
  *
59
  * @return bool True if we should stop initialization, otherwise false.
60
  */
61
- public function should_stop_init( $current_plugin, $plugins ) {
62
- global $jetpack_autoloader_including_latest;
63
  global $jetpack_autoloader_latest_version;
64
 
65
- // When we're being included from an older autoloader we need to
66
- // reset the latest version so that the new autoloader can look
67
- // for the latest autoloader again.
68
- if ( $jetpack_autoloader_including_latest ) {
69
- $jetpack_autoloader_latest_version = null;
70
- }
71
-
72
  // We need to reset the autoloader when the plugins change because
73
  // that means the autoloader was generated with a different list.
74
  if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
75
  $this->autoloader_handler->reset_autoloader();
76
  }
77
 
78
- // Don't bother initializing the autoloader if it already has been.
79
- if ( isset( $jetpack_autoloader_latest_version ) ) {
 
 
80
  return true;
81
  }
82
 
83
  $latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
84
  if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
85
- $jetpack_autoloader_including_latest = true;
86
  require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
87
- $jetpack_autoloader_including_latest = false;
88
  return true;
89
  }
90
 
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
53
  * has the side-effect of actually loading the latest autoloader in the event that this
54
  * is not it.
55
  *
56
+ * @param string $current_plugin The current plugin we're checking.
57
+ * @param string[] $plugins The active plugins to check for autoloaders in.
58
+ * @param bool $was_included_by_autoloader Indicates whether or not this autoloader was included by another.
59
  *
60
  * @return bool True if we should stop initialization, otherwise false.
61
  */
62
+ public function should_stop_init( $current_plugin, $plugins, $was_included_by_autoloader ) {
 
63
  global $jetpack_autoloader_latest_version;
64
 
 
 
 
 
 
 
 
65
  // We need to reset the autoloader when the plugins change because
66
  // that means the autoloader was generated with a different list.
67
  if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
68
  $this->autoloader_handler->reset_autoloader();
69
  }
70
 
71
+ // When the latest autoloader has already been found we don't need to search for it again.
72
+ // We should take care however because this will also trigger if the autoloader has been
73
+ // included by an older one.
74
+ if ( isset( $jetpack_autoloader_latest_version ) && ! $was_included_by_autoloader ) {
75
  return true;
76
  }
77
 
78
  $latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
79
  if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
 
80
  require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
 
81
  return true;
82
  }
83
 
vendor/jetpack-autoloader/class-manifest-handler.php DELETED
@@ -1,107 +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\jpb0eb90e766c41d008f579055bbf9b3bc;
9
-
10
- // phpcs:ignore
11
-
12
- /**
13
- * This class selects the most recent version of a registered path.
14
- */
15
- class Manifest_Handler {
16
-
17
- /**
18
- * An array of the active plugin paths we want to search.
19
- *
20
- * @var array
21
- */
22
- private $active_plugin_paths;
23
-
24
- /**
25
- * The Version_Selector object.
26
- *
27
- * @var Version_Selector
28
- */
29
- private $version_selector;
30
-
31
- /**
32
- * The constructor.
33
- *
34
- * @param array $active_plugin_paths An array of the active plugin paths we want to search.
35
- * @param Version_Selector $version_selector The Version_Selector object.
36
- */
37
- public function __construct( $active_plugin_paths, $version_selector ) {
38
- $this->active_plugin_paths = $active_plugin_paths;
39
- $this->version_selector = $version_selector;
40
- }
41
-
42
- /**
43
- * Registers all of the paths in a given manifest.
44
- *
45
- * @param string $manifest_path The path that we're loading the manifest from in each plugin.
46
- * @param array $path_map The path map to add the contents of the manifests to.
47
- *
48
- * @return array $path_map The path map we've built using the manifests in each plugin.
49
- */
50
- public function register_plugin_manifests( $manifest_path, &$path_map ) {
51
- $file_paths = array_map(
52
- function ( $path ) use ( $manifest_path ) {
53
- return trailingslashit( $path ) . $manifest_path;
54
- },
55
- $this->active_plugin_paths
56
- );
57
-
58
- foreach ( $file_paths as $path ) {
59
- $this->register_manifest( $path, $path_map );
60
- }
61
-
62
- return $path_map;
63
- }
64
-
65
- /**
66
- * Registers a plugin's manifest file with the path map.
67
- *
68
- * @param string $manifest_path The absolute path to the manifest that we're loading.
69
- * @param array $path_map The path map to add the contents of the manifest to.
70
- */
71
- protected function register_manifest( $manifest_path, &$path_map ) {
72
- if ( ! is_readable( $manifest_path ) ) {
73
- return;
74
- }
75
-
76
- $manifest = require $manifest_path;
77
- if ( ! is_array( $manifest ) ) {
78
- return;
79
- }
80
-
81
- foreach ( $manifest as $key => $data ) {
82
- $this->register_record( $key, $data, $path_map );
83
- }
84
- }
85
-
86
- /**
87
- * Registers an entry from the manifest in the path map.
88
- *
89
- * @param string $key The identifier for the entry we're registering.
90
- * @param array $data The data for the entry we're registering.
91
- * @param array $path_map The path map to add the contents of the manifest to.
92
- */
93
- protected function register_record( $key, $data, &$path_map ) {
94
- if ( isset( $path_map[ $key ]['version'] ) ) {
95
- $selected_version = $path_map[ $key ]['version'];
96
- } else {
97
- $selected_version = null;
98
- }
99
-
100
- if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) {
101
- $path_map[ $key ] = array(
102
- 'version' => $data['version'],
103
- 'path' => $data['path'],
104
- );
105
- }
106
- }
107
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/jetpack-autoloader/class-manifest-reader.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
vendor/jetpack-autoloader/class-path-processor.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
@@ -17,6 +17,7 @@ class Path_Processor {
17
  * Given a path this will replace any of the path constants with a token to represent it.
18
  *
19
  * @param string $path The path we want to process.
 
20
  * @return string The tokenized path.
21
  */
22
  public function tokenize_path_constants( $path ) {
@@ -39,6 +40,7 @@ class Path_Processor {
39
  * Given a path this will replace any of the path constant tokens with the expanded path.
40
  *
41
  * @param string $tokenized_path The path we want to process.
 
42
  * @return string The expanded path.
43
  */
44
  public function untokenize_path_constants( $tokenized_path ) {
@@ -64,6 +66,7 @@ class Path_Processor {
64
  *
65
  * @param string $file The plugin or theme file to resolve.
66
  * @param array $directories_to_check The directories we should check for the file if it isn't an absolute path.
 
67
  * @return string|false Returns the absolute path to the directory, otherwise false.
68
  */
69
  public function find_directory_with_autoloader( $file, $directories_to_check ) {
@@ -122,6 +125,7 @@ class Path_Processor {
122
  * Indicates whether or not a path is absolute.
123
  *
124
  * @param string $path The path to check.
 
125
  * @return bool True if the path is absolute, otherwise false.
126
  */
127
  private function is_absolute_path( $path ) {
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
17
  * Given a path this will replace any of the path constants with a token to represent it.
18
  *
19
  * @param string $path The path we want to process.
20
+ *
21
  * @return string The tokenized path.
22
  */
23
  public function tokenize_path_constants( $path ) {
40
  * Given a path this will replace any of the path constant tokens with the expanded path.
41
  *
42
  * @param string $tokenized_path The path we want to process.
43
+ *
44
  * @return string The expanded path.
45
  */
46
  public function untokenize_path_constants( $tokenized_path ) {
66
  *
67
  * @param string $file The plugin or theme file to resolve.
68
  * @param array $directories_to_check The directories we should check for the file if it isn't an absolute path.
69
+ *
70
  * @return string|false Returns the absolute path to the directory, otherwise false.
71
  */
72
  public function find_directory_with_autoloader( $file, $directories_to_check ) {
125
  * Indicates whether or not a path is absolute.
126
  *
127
  * @param string $path The path to check.
128
+ *
129
  * @return bool True if the path is absolute, otherwise false.
130
  */
131
  private function is_absolute_path( $path ) {
vendor/jetpack-autoloader/class-php-autoloader.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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\jp38b3d38eb0faab3eda1eac718e9ae633;
9
+
10
+ // phpcs:ignore
11
+
12
+ /**
13
+ * This class handles management of the actual PHP autoloader.
14
+ */
15
+ class PHP_Autoloader {
16
+
17
+ /**
18
+ * Registers the autoloader with PHP so that it can begin autoloading classes.
19
+ *
20
+ * @param Version_Loader $version_loader The class loader to use in the autoloader.
21
+ */
22
+ public function register_autoloader( $version_loader ) {
23
+ // Make sure no other autoloaders are registered.
24
+ $this->unregister_autoloader();
25
+
26
+ // Set the global so that it can be used to load classes.
27
+ global $jetpack_autoloader_loader;
28
+ $jetpack_autoloader_loader = $version_loader;
29
+
30
+ // Ensure that the autoloader is first to avoid contention with others.
31
+ spl_autoload_register( array( self::class, 'load_class' ), true, true );
32
+ }
33
+
34
+ /**
35
+ * Unregisters the active autoloader so that it will no longer autoload classes.
36
+ */
37
+ public function unregister_autoloader() {
38
+ // Remove any v2 autoloader that we've already registered.
39
+ $autoload_chain = spl_autoload_functions();
40
+ foreach ( $autoload_chain as $autoloader ) {
41
+ // We can identify a v2 autoloader using the namespace.
42
+ $namespace_check = null;
43
+
44
+ // Functions are recorded as strings.
45
+ if ( is_string( $autoloader ) ) {
46
+ $namespace_check = $autoloader;
47
+ } elseif ( is_array( $autoloader ) && is_string( $autoloader[0] ) ) {
48
+ // Static method calls have the class as the first array element.
49
+ $namespace_check = $autoloader[0];
50
+ } else {
51
+ // Since the autoloader has only ever been a function or a static method we don't currently need to check anything else.
52
+ continue;
53
+ }
54
+
55
+ // Check for the namespace without the generated suffix.
56
+ if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $namespace_check, 0, 32 ) ) {
57
+ spl_autoload_unregister( $autoloader );
58
+ }
59
+ }
60
+
61
+ // Clear the global now that the autoloader has been unregistered.
62
+ global $jetpack_autoloader_loader;
63
+ $jetpack_autoloader_loader = null;
64
+ }
65
+
66
+ /**
67
+ * Loads a class file if one could be found.
68
+ *
69
+ * Note: This function is static so that the autoloader can be easily unregistered. If
70
+ * it was a class method we would have to unwrap the object to check the namespace.
71
+ *
72
+ * @param string $class_name The name of the class to autoload.
73
+ *
74
+ * @return bool Indicates whether or not a class file was loaded.
75
+ */
76
+ public static function load_class( $class_name ) {
77
+ global $jetpack_autoloader_loader;
78
+ if ( ! isset( $jetpack_autoloader_loader ) ) {
79
+ return;
80
+ }
81
+
82
+ $file = $jetpack_autoloader_loader->find_class_file( $class_name );
83
+ if ( ! isset( $file ) ) {
84
+ return false;
85
+ }
86
+
87
+ require $file;
88
+ return true;
89
+ }
90
+ }
vendor/jetpack-autoloader/class-plugin-locator.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
@@ -34,6 +34,7 @@ class Plugin_Locator {
34
  * Finds the path to the current plugin.
35
  *
36
  * @return string $path The path to the current plugin.
 
37
  * @throws \RuntimeException If the current plugin does not have an autoloader.
38
  */
39
  public function find_current_plugin() {
@@ -58,8 +59,8 @@ class Plugin_Locator {
58
  * @return array $plugin_paths The list of absolute paths we've found.
59
  */
60
  public function find_using_option( $option_name, $site_option = false ) {
61
- $raw = $site_option ? get_site_option( $option_name, array() ) : get_option( $option_name, array() );
62
- if ( empty( $raw ) ) {
63
  return array();
64
  }
65
 
@@ -67,11 +68,13 @@ class Plugin_Locator {
67
  }
68
 
69
  /**
70
- * Checks for plugins that are being activated in this request and returns all that it finds.
 
 
71
  *
72
  * @return array $plugin_paths The list of absolute paths we've found.
73
  */
74
- public function find_activating_this_request() {
75
  // phpcs:disable WordPress.Security.NonceVerification.Recommended
76
 
77
  /**
@@ -85,11 +88,15 @@ class Plugin_Locator {
85
  return array();
86
  }
87
 
88
- $plugin_slugs = array();
89
-
90
  $action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
 
 
 
 
 
91
  switch ( $action ) {
92
  case 'activate':
 
93
  if ( empty( $_REQUEST['plugin'] ) ) {
94
  break;
95
  }
@@ -98,6 +105,7 @@ class Plugin_Locator {
98
  break;
99
 
100
  case 'activate-selected':
 
101
  if ( empty( $_REQUEST['checked'] ) ) {
102
  break;
103
  }
@@ -106,6 +114,7 @@ class Plugin_Locator {
106
  break;
107
  }
108
 
 
109
  return $this->convert_plugins_to_paths( $plugin_slugs );
110
  }
111
 
@@ -119,6 +128,10 @@ class Plugin_Locator {
119
  * @return string[]
120
  */
121
  private function convert_plugins_to_paths( $plugins ) {
 
 
 
 
122
  // We're going to look for plugins in the standard directories.
123
  $path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
124
 
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
34
  * Finds the path to the current plugin.
35
  *
36
  * @return string $path The path to the current plugin.
37
+ *
38
  * @throws \RuntimeException If the current plugin does not have an autoloader.
39
  */
40
  public function find_current_plugin() {
59
  * @return array $plugin_paths The list of absolute paths we've found.
60
  */
61
  public function find_using_option( $option_name, $site_option = false ) {
62
+ $raw = $site_option ? get_site_option( $option_name ) : get_option( $option_name );
63
+ if ( false === $raw ) {
64
  return array();
65
  }
66
 
68
  }
69
 
70
  /**
71
+ * Checks for plugins in the `action` request parameter.
72
+ *
73
+ * @param string[] $allowed_actions The actions that we're allowed to return plugins for.
74
  *
75
  * @return array $plugin_paths The list of absolute paths we've found.
76
  */
77
+ public function find_using_request_action( $allowed_actions ) {
78
  // phpcs:disable WordPress.Security.NonceVerification.Recommended
79
 
80
  /**
88
  return array();
89
  }
90
 
 
 
91
  $action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
92
+ if ( ! in_array( $action, $allowed_actions, true ) ) {
93
+ return array();
94
+ }
95
+
96
+ $plugin_slugs = array();
97
  switch ( $action ) {
98
  case 'activate':
99
+ case 'deactivate':
100
  if ( empty( $_REQUEST['plugin'] ) ) {
101
  break;
102
  }
105
  break;
106
 
107
  case 'activate-selected':
108
+ case 'deactivate-selected':
109
  if ( empty( $_REQUEST['checked'] ) ) {
110
  break;
111
  }
114
  break;
115
  }
116
 
117
+ // phpcs:enable WordPress.Security.NonceVerification.Recommended
118
  return $this->convert_plugins_to_paths( $plugin_slugs );
119
  }
120
 
128
  * @return string[]
129
  */
130
  private function convert_plugins_to_paths( $plugins ) {
131
+ if ( ! is_array( $plugins ) || empty( $plugins ) ) {
132
+ return array();
133
+ }
134
+
135
  // We're going to look for plugins in the standard directories.
136
  $path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
137
 
vendor/jetpack-autoloader/class-plugins-handler.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
@@ -46,11 +46,13 @@ class Plugins_Handler {
46
  /**
47
  * Gets all of the active plugins we can find.
48
  *
 
 
 
49
  * @return string[]
50
  */
51
- public function get_active_plugins() {
52
  global $jetpack_autoloader_activating_plugins_paths;
53
- global $jetpack_autoloader_including_latest;
54
 
55
  // We're going to build a unique list of plugins from a few different sources
56
  // to find all of our "active" plugins. While we need to return an integer
@@ -81,7 +83,8 @@ class Plugins_Handler {
81
  }
82
  }
83
 
84
- $plugins = $this->plugin_locator->find_activating_this_request();
 
85
  foreach ( $plugins as $path ) {
86
  $active_plugins[ $path ] = $path;
87
  }
@@ -94,11 +97,20 @@ class Plugins_Handler {
94
  // of causing a reset because the active plugins list has
95
  // been changed since it was saved in the global.
96
  $current_plugin = $this->plugin_locator->find_current_plugin();
97
- if ( ! in_array( $current_plugin, $active_plugins, true ) && ! $jetpack_autoloader_including_latest ) {
98
  $active_plugins[ $current_plugin ] = $current_plugin;
99
  $jetpack_autoloader_activating_plugins_paths[] = $current_plugin;
100
  }
101
 
 
 
 
 
 
 
 
 
 
102
  // Transform the array so that we don't have to worry about the keys interacting with other array types later.
103
  return array_values( $active_plugins );
104
  }
@@ -110,7 +122,7 @@ class Plugins_Handler {
110
  */
111
  public function get_cached_plugins() {
112
  $cached = get_transient( self::TRANSIENT_KEY );
113
- if ( false === $cached ) {
114
  return array();
115
  }
116
 
@@ -142,12 +154,6 @@ class Plugins_Handler {
142
  public function have_plugins_changed( $plugins ) {
143
  global $jetpack_autoloader_cached_plugin_paths;
144
 
145
- // When no autoloader has executed there is nothing to have changed.
146
- if ( ! isset( $jetpack_autoloader_cached_plugin_paths ) ) {
147
- $jetpack_autoloader_cached_plugin_paths = $plugins;
148
- return false;
149
- }
150
-
151
  if ( $jetpack_autoloader_cached_plugin_paths !== $plugins ) {
152
  $jetpack_autoloader_cached_plugin_paths = $plugins;
153
  return true;
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
46
  /**
47
  * Gets all of the active plugins we can find.
48
  *
49
+ * @param bool $include_deactivating When true, plugins deactivating this request will be considered active.
50
+ * @param bool $record_unknown When true, the current plugin will be marked as active and recorded when unknown.
51
+ *
52
  * @return string[]
53
  */
54
+ public function get_active_plugins( $include_deactivating, $record_unknown ) {
55
  global $jetpack_autoloader_activating_plugins_paths;
 
56
 
57
  // We're going to build a unique list of plugins from a few different sources
58
  // to find all of our "active" plugins. While we need to return an integer
83
  }
84
  }
85
 
86
+ // These actions contain plugins that are being activated/deactivated during this request.
87
+ $plugins = $this->plugin_locator->find_using_request_action( array( 'activate', 'activate-selected', 'deactivate', 'deactivate-selected' ) );
88
  foreach ( $plugins as $path ) {
89
  $active_plugins[ $path ] = $path;
90
  }
97
  // of causing a reset because the active plugins list has
98
  // been changed since it was saved in the global.
99
  $current_plugin = $this->plugin_locator->find_current_plugin();
100
+ if ( $record_unknown && ! in_array( $current_plugin, $active_plugins, true ) ) {
101
  $active_plugins[ $current_plugin ] = $current_plugin;
102
  $jetpack_autoloader_activating_plugins_paths[] = $current_plugin;
103
  }
104
 
105
+ // When deactivating plugins aren't desired we should entirely remove them from the active list.
106
+ if ( ! $include_deactivating ) {
107
+ // These actions contain plugins that are being deactivated during this request.
108
+ $plugins = $this->plugin_locator->find_using_request_action( array( 'deactivate', 'deactivate-selected' ) );
109
+ foreach ( $plugins as $path ) {
110
+ unset( $active_plugins[ $path ] );
111
+ }
112
+ }
113
+
114
  // Transform the array so that we don't have to worry about the keys interacting with other array types later.
115
  return array_values( $active_plugins );
116
  }
122
  */
123
  public function get_cached_plugins() {
124
  $cached = get_transient( self::TRANSIENT_KEY );
125
+ if ( ! is_array( $cached ) || empty( $cached ) ) {
126
  return array();
127
  }
128
 
154
  public function have_plugins_changed( $plugins ) {
155
  global $jetpack_autoloader_cached_plugin_paths;
156
 
 
 
 
 
 
 
157
  if ( $jetpack_autoloader_cached_plugin_paths !== $plugins ) {
158
  $jetpack_autoloader_cached_plugin_paths = $plugins;
159
  return true;
vendor/jetpack-autoloader/class-version-loader.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
vendor/jetpack-autoloader/class-version-selector.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
- namespace Automattic\Jetpack\Autoloader\jpa537f22e61b714db0c75a63174123add;
9
 
10
  // phpcs:ignore
11
 
@@ -33,11 +33,11 @@ class Version_Selector {
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 {
@@ -59,7 +59,7 @@ class Version_Selector {
59
  *
60
  * @return bool 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
  }
5
  * @package automattic/jetpack-autoloader
6
  */
7
 
8
+ namespace Automattic\Jetpack\Autoloader\jp38b3d38eb0faab3eda1eac718e9ae633;
9
 
10
  // phpcs:ignore
11
 
33
  return true;
34
  }
35
 
36
+ if ( $use_dev_versions && $this->is_dev_version( $selected_version ) ) {
37
  return false;
38
  }
39
 
40
+ if ( $this->is_dev_version( $compare_version ) ) {
41
  if ( $use_dev_versions ) {
42
  return true;
43
  } else {
59
  *
60
  * @return bool True if the version is a dev version, else false.
61
  */
62
+ public function is_dev_version( $version ) {
63
  if ( 'dev-' === substr( $version, 0, 4 ) || '9999999-dev' === $version ) {
64
  return true;
65
  }
woocommerce-admin.php CHANGED
@@ -7,7 +7,7 @@
7
  * Author URI: https://woocommerce.com/
8
  * Text Domain: woocommerce-admin
9
  * Domain Path: /languages
10
- * Version: 2.0.0
11
  * Requires at least: 5.3
12
  * Requires PHP: 5.6.20
13
  *
7
  * Author URI: https://woocommerce.com/
8
  * Text Domain: woocommerce-admin
9
  * Domain Path: /languages
10
+ * Version: 2.0.1
11
  * Requires at least: 5.3
12
  * Requires PHP: 5.6.20
13
  *