Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 22a1969

Browse files
committed
Adding /vendor directory to release
1 parent 5a6b125 commit 22a1969

File tree

122 files changed

+9690
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+9690
-0
lines changed

vendor/autoload.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
// autoload.php @generated by Composer
4+
5+
require_once __DIR__ . '/composer/autoload_real.php';
6+
7+
return ComposerAutoloaderInit65bb8b63f3455c292e3c1aab694e645c::getLoader();

vendor/autoload_functions.php

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<?php
2+
/**
3+
* This file was automatically generated by automattic/jetpack-autoloader.
4+
*
5+
* @package automattic/jetpack-autoloader
6+
*/
7+
8+
namespace Automattic\Jetpack\Autoloader\jp9af6bcdc76f2d9375175f2949c411364;
9+
10+
// phpcs:ignore
11+
12+
global $jetpack_packages_classmap;
13+
global $jetpack_packages_filemap;
14+
global $jetpack_autoloader_activating_plugins_paths;
15+
16+
if ( ! is_array( $jetpack_packages_classmap ) ) {
17+
$jetpack_packages_classmap = array();
18+
}
19+
20+
if ( ! is_array( $jetpack_packages_filemap ) ) {
21+
$jetpack_packages_filemap = array();
22+
}
23+
24+
if ( ! is_array( $jetpack_autoloader_activating_plugins_paths ) ) {
25+
$jetpack_autoloader_activating_plugins_paths = array();
26+
}
27+
28+
/**
29+
* Used for autoloading jetpack packages.
30+
*
31+
* @param string $class_name Class Name to load.
32+
*
33+
* @return Boolean Whether the class_name was found in the classmap.
34+
*/
35+
function autoloader( $class_name ) {
36+
global $jetpack_packages_classmap;
37+
38+
if ( isset( $jetpack_packages_classmap[ $class_name ] ) ) {
39+
require_once $jetpack_packages_classmap[ $class_name ]['path'];
40+
return true;
41+
}
42+
43+
return false;
44+
}
45+
46+
/**
47+
* Used for running the code that initializes class and file maps.
48+
*
49+
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
50+
* @param Version_Selector $version_selector The Version_Selector object.
51+
*/
52+
function enqueue_files( $plugins_handler, $version_selector ) {
53+
require_once __DIR__ . '/class-classes-handler.php';
54+
require_once __DIR__ . '/class-files-handler.php';
55+
56+
$classes_handler = new Classes_Handler( $plugins_handler, $version_selector );
57+
$classes_handler->set_class_paths();
58+
59+
$files_handler = new Files_Handler( $plugins_handler, $version_selector );
60+
$files_handler->set_file_paths();
61+
62+
$files_handler->file_loader();
63+
}
64+
65+
/**
66+
* Finds the latest installed autoloader. If this is the latest autoloader, sets
67+
* up the classmap and filemap.
68+
*/
69+
function set_up_autoloader() {
70+
global $jetpack_autoloader_latest_version;
71+
global $jetpack_packages_classmap;
72+
73+
require_once __DIR__ . '/class-plugins-handler.php';
74+
require_once __DIR__ . '/class-version-selector.php';
75+
require_once __DIR__ . '/class-autoloader-handler.php';
76+
77+
$plugins_handler = new Plugins_Handler();
78+
$version_selector = new Version_Selector();
79+
$autoloader_handler = new Autoloader_Handler( $plugins_handler, $version_selector );
80+
81+
if ( $plugins_handler->should_autoloader_reset() ) {
82+
/*
83+
* The autoloader must be reset when an activating plugin that was
84+
* previously unknown is detected.
85+
*/
86+
$jetpack_autoloader_latest_version = null;
87+
$jetpack_packages_classmap = array();
88+
}
89+
90+
// Find the latest autoloader.
91+
if ( ! $jetpack_autoloader_latest_version ) {
92+
$autoloader_handler->find_latest_autoloader();
93+
}
94+
95+
$current_autoloader_version = $autoloader_handler->get_current_autoloader_version();
96+
97+
// This is the latest autoloader, so generate the classmap and filemap and register the autoloader function.
98+
if ( empty( $jetpack_packages_classmap ) && $current_autoloader_version === $jetpack_autoloader_latest_version ) {
99+
enqueue_files( $plugins_handler, $version_selector );
100+
$autoloader_handler->update_autoloader_chain();
101+
add_filter( 'upgrader_post_install', __NAMESPACE__ . '\reset_maps_after_update', 0, 3 );
102+
}
103+
}
104+
105+
/**
106+
* Resets the autoloader after a plugin update.
107+
*
108+
* @param bool $response Installation response.
109+
* @param array $hook_extra Extra arguments passed to hooked filters.
110+
* @param array $result Installation result data.
111+
*
112+
* @return bool The passed in $response param.
113+
*/
114+
function reset_maps_after_update( $response, $hook_extra, $result ) {
115+
global $jetpack_autoloader_latest_version;
116+
global $jetpack_packages_classmap;
117+
118+
if ( isset( $hook_extra['plugin'] ) ) {
119+
/*
120+
* $hook_extra['plugin'] is the path to the plugin file relative to the plugins directory:
121+
* https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/includes/class-wp-upgrader.php#L701
122+
*/
123+
$plugin = $hook_extra['plugin'];
124+
125+
if ( false === strpos( $plugin, '/', 1 ) ) {
126+
// Single-file plugins don't use packages, so bail.
127+
return $response;
128+
}
129+
130+
if ( ! is_plugin_active( $plugin ) ) {
131+
// The updated plugin isn't active, so bail.
132+
return $response;
133+
}
134+
135+
/*
136+
* $plugin is the path to the plugin file relative to the plugins directory.
137+
* What if this plugin is not in the plugins directory, for example an mu plugin?
138+
*/
139+
$plugin_path = trailingslashit( WP_PLUGIN_DIR ) . trailingslashit( explode( '/', $plugin )[0] );
140+
141+
if ( is_readable( $plugin_path . 'vendor/autoload_functions.php' ) ) {
142+
// The plugin has a v2.x autoloader, so reset it.
143+
$jetpack_autoloader_latest_version = null;
144+
$jetpack_packages_classmap = array();
145+
146+
set_up_autoloader();
147+
}
148+
}
149+
150+
return $response;
151+
}
152+

vendor/autoload_packages.php

+205
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
<?php
2+
/**
3+
* This file `autoload_packages.php`was generated by automattic/jetpack-autoloader.
4+
*
5+
* From your plugin include this file with:
6+
* require_once . plugin_dir_path( __FILE__ ) . '/vendor/autoload_packages.php';
7+
*
8+
* @package automattic/jetpack-autoloader
9+
*/
10+
11+
// phpcs:disable PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound
12+
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_namespaceFound
13+
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_ns_cFound
14+
15+
namespace Automattic\Jetpack\Autoloader;
16+
17+
if ( ! function_exists( __NAMESPACE__ . '\enqueue_package_class' ) ) {
18+
global $jetpack_packages_classes;
19+
20+
if ( ! is_array( $jetpack_packages_classes ) ) {
21+
$jetpack_packages_classes = array();
22+
}
23+
/**
24+
* Adds the version of a package to the $jetpack_packages global array so that
25+
* the autoloader is able to find it.
26+
*
27+
* @param string $class_name Name of the class that you want to autoload.
28+
* @param string $version Version of the class.
29+
* @param string $path Absolute path to the class so that we can load it.
30+
*/
31+
function enqueue_package_class( $class_name, $version, $path ) {
32+
global $jetpack_packages_classes;
33+
34+
if ( ! isset( $jetpack_packages_classes[ $class_name ] ) ) {
35+
$jetpack_packages_classes[ $class_name ] = array(
36+
'version' => $version,
37+
'path' => $path,
38+
);
39+
40+
return;
41+
}
42+
// If we have a @dev version set always use that one!
43+
if ( 'dev-' === substr( $jetpack_packages_classes[ $class_name ]['version'], 0, 4 ) ) {
44+
return;
45+
}
46+
47+
// Always favour the @dev version. Since that version is the same as bleeding edge.
48+
// We need to make sure that we don't do this in production!
49+
if ( 'dev-' === substr( $version, 0, 4 ) ) {
50+
$jetpack_packages_classes[ $class_name ] = array(
51+
'version' => $version,
52+
'path' => $path,
53+
);
54+
55+
return;
56+
}
57+
// Set the latest version!
58+
if ( version_compare( $jetpack_packages_classes[ $class_name ]['version'], $version, '<' ) ) {
59+
$jetpack_packages_classes[ $class_name ] = array(
60+
'version' => $version,
61+
'path' => $path,
62+
);
63+
}
64+
}
65+
}
66+
67+
if ( ! function_exists( __NAMESPACE__ . '\enqueue_package_file' ) ) {
68+
global $jetpack_packages_files;
69+
70+
if ( ! is_array( $jetpack_packages_files ) ) {
71+
$jetpack_packages_files = array();
72+
}
73+
/**
74+
* Adds the version of a package file to the $jetpack_packages_files global array so that
75+
* we can load the most recent version after 'plugins_loaded'.
76+
*
77+
* @param string $file_identifier Unique id to file assigned by composer based on package name and filename.
78+
* @param string $version Version of the file.
79+
* @param string $path Absolute path to the file so that we can load it.
80+
*/
81+
function enqueue_package_file( $file_identifier, $version, $path ) {
82+
global $jetpack_packages_files;
83+
84+
if ( ! isset( $jetpack_packages_files[ $file_identifier ] ) ) {
85+
$jetpack_packages_files[ $file_identifier ] = array(
86+
'version' => $version,
87+
'path' => $path,
88+
);
89+
90+
return;
91+
}
92+
// If we have a @dev version set always use that one!
93+
if ( 'dev-' === substr( $jetpack_packages_files[ $file_identifier ]['version'], 0, 4 ) ) {
94+
return;
95+
}
96+
97+
// Always favour the @dev version. Since that version is the same as bleeding edge.
98+
// We need to make sure that we don't do this in production!
99+
if ( 'dev-' === substr( $version, 0, 4 ) ) {
100+
$jetpack_packages_files[ $file_identifier ] = array(
101+
'version' => $version,
102+
'path' => $path,
103+
);
104+
105+
return;
106+
}
107+
// Set the latest version!
108+
if ( version_compare( $jetpack_packages_files[ $file_identifier ]['version'], $version, '<' ) ) {
109+
$jetpack_packages_files[ $file_identifier ] = array(
110+
'version' => $version,
111+
'path' => $path,
112+
);
113+
}
114+
}
115+
}
116+
117+
if ( ! function_exists( __NAMESPACE__ . '\file_loader' ) ) {
118+
/**
119+
* Include latest version of all enqueued files. Should be called after all plugins are loaded.
120+
*/
121+
function file_loader() {
122+
global $jetpack_packages_files;
123+
foreach ( $jetpack_packages_files as $file_identifier => $file_data ) {
124+
if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
125+
require $file_data['path'];
126+
127+
$GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
128+
}
129+
}
130+
}
131+
}
132+
133+
if ( ! function_exists( __NAMESPACE__ . '\autoloader' ) ) {
134+
/**
135+
* Used for autoloading jetpack packages.
136+
*
137+
* @param string $class_name Class Name to load.
138+
*/
139+
function autoloader( $class_name ) {
140+
global $jetpack_packages_classes;
141+
142+
if ( isset( $jetpack_packages_classes[ $class_name ] ) ) {
143+
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
144+
// TODO ideally we shouldn't skip any of these, see: https://github.com/Automattic/jetpack/pull/12646.
145+
$ignore = in_array(
146+
$class_name,
147+
array(
148+
'Automattic\Jetpack\Connection\Manager',
149+
),
150+
true
151+
);
152+
153+
if ( ! $ignore && function_exists( 'did_action' ) && ! did_action( 'plugins_loaded' ) ) {
154+
_doing_it_wrong(
155+
esc_html( $class_name ),
156+
sprintf(
157+
/* translators: %s Name of a PHP Class */
158+
esc_html__( 'Not all plugins have loaded yet but we requested the class %s', 'jetpack' ),
159+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
160+
$class_name
161+
),
162+
esc_html( $jetpack_packages_classes[ $class_name ]['version'] )
163+
);
164+
}
165+
}
166+
167+
require_once $jetpack_packages_classes[ $class_name ]['path'];
168+
169+
return true;
170+
}
171+
172+
return false;
173+
}
174+
175+
// Add the jetpack autoloader.
176+
spl_autoload_register( __NAMESPACE__ . '\autoloader' );
177+
}
178+
/**
179+
* Prepare all the classes for autoloading.
180+
*/
181+
function enqueue_packages_79ae06eafd0c9fc3b6dd2f3b40b49b43() {
182+
$class_map = require_once dirname( __FILE__ ) . '/composer/autoload_classmap_package.php';
183+
foreach ( $class_map as $class_name => $class_info ) {
184+
enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
185+
}
186+
187+
$autoload_file = __DIR__ . '/composer/autoload_files_package.php';
188+
189+
$includeFiles = file_exists( $autoload_file )
190+
? require $autoload_file
191+
: array();
192+
193+
foreach ( $includeFiles as $fileIdentifier => $file_data ) {
194+
enqueue_package_file( $fileIdentifier, $file_data[ 'version' ], $file_data[ 'path' ] );
195+
}
196+
197+
if ( function_exists( 'has_action') && function_exists( 'did_action' ) && ! did_action( 'plugins_loaded' ) && false === has_action( 'plugins_loaded', __NAMESPACE__ . '\file_loader' ) ) {
198+
// Add action if it has not been added and has not happened yet.
199+
// Priority -10 to load files as early as possible in case plugins try to use them during `plugins_loaded`.
200+
add_action( 'plugins_loaded', __NAMESPACE__ . '\file_loader', 0, -10 );
201+
} elseif( ! function_exists( 'did_action' ) || did_action( 'plugins_loaded' ) ) {
202+
file_loader(); // Either WordPress is not loaded or plugin is doing it wrong. Either way we'll load the files so nothing breaks.
203+
}
204+
}
205+
enqueue_packages_79ae06eafd0c9fc3b6dd2f3b40b49b43();

0 commit comments

Comments
 (0)