diff --git a/vendor/autoload.php b/vendor/autoload.php
new file mode 100644
index 00000000000..c2ac89fcea6
--- /dev/null
+++ b/vendor/autoload.php
@@ -0,0 +1,7 @@
+ '../autoload_packages.php',
+ );
+ $ignoreList = array(
+ 'AutoloadGenerator.php',
+ 'AutoloadProcessor.php',
+ 'CustomAutoloaderPlugin.php',
+ 'ManifestGenerator.php',
+ 'AutoloadFileWriter.php',
+ );
+
+ // Copy all of the autoloader files.
+ $files = scandir( __DIR__ );
+ foreach ( $files as $file ) {
+ // Only PHP files will be copied.
+ if ( substr( $file, -4 ) !== '.php' ) {
+ continue;
+ }
+
+ if ( in_array( $file, $ignoreList, true ) ) {
+ continue;
+ }
+
+ $newFile = isset( $renameList[ $file ] ) ? $renameList[ $file ] : $file;
+ $content = self::prepareAutoloaderFile( $file, $suffix );
+
+ $written = file_put_contents( $outDir . '/' . $newFile, $content );
+ if ( $io ) {
+ if ( $written ) {
+ $io->writeError( " Generated: $newFile" );
+ } else {
+ $io->writeError( " Error: $newFile" );
+ }
+ }
+ }
+ }
+
+ /**
+ * Prepares an autoloader file to be written to the destination.
+ *
+ * @param String $filename a file to prepare.
+ * @param String $suffix Unique suffix used in the namespace.
+ *
+ * @return string
+ */
+ private static function prepareAutoloaderFile( $filename, $suffix ) {
+ $header = self::COMMENT;
+ $header .= PHP_EOL;
+ $header .= 'namespace Automattic\Jetpack\Autoloader\jp' . $suffix . ';';
+ $header .= PHP_EOL . PHP_EOL;
+
+ $sourceLoader = fopen( __DIR__ . '/' . $filename, 'r' );
+ $file_contents = stream_get_contents( $sourceLoader );
+ return str_replace(
+ '/* HEADER */',
+ $header,
+ $file_contents
+ );
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php b/vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php
new file mode 100644
index 00000000000..7ebdc4e2d54
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php
@@ -0,0 +1,393 @@
+io = $io;
+ $this->filesystem = new Filesystem();
+ }
+
+ /**
+ * Dump the Jetpack autoloader files.
+ *
+ * @param Composer $composer The Composer object.
+ * @param Config $config Config object.
+ * @param InstalledRepositoryInterface $localRepo Installed Repository object.
+ * @param PackageInterface $mainPackage Main Package object.
+ * @param InstallationManager $installationManager Manager for installing packages.
+ * @param string $targetDir Path to the current target directory.
+ * @param bool $scanPsrPackages Whether or not PSR packages should be converted to a classmap.
+ * @param string $suffix The autoloader suffix.
+ */
+ public function dump(
+ Composer $composer,
+ Config $config,
+ InstalledRepositoryInterface $localRepo,
+ PackageInterface $mainPackage,
+ InstallationManager $installationManager,
+ $targetDir,
+ $scanPsrPackages = false,
+ $suffix = null
+ ) {
+ $this->filesystem->ensureDirectoryExists( $config->get( 'vendor-dir' ) );
+
+ $packageMap = $composer->getAutoloadGenerator()->buildPackageMap( $installationManager, $mainPackage, $localRepo->getCanonicalPackages() );
+ $autoloads = $this->parseAutoloads( $packageMap, $mainPackage );
+
+ // Convert the autoloads into a format that the manifest generator can consume more easily.
+ $basePath = $this->filesystem->normalizePath( realpath( getcwd() ) );
+ $vendorPath = $this->filesystem->normalizePath( realpath( $config->get( 'vendor-dir' ) ) );
+ $processedAutoloads = $this->processAutoloads( $autoloads, $scanPsrPackages, $vendorPath, $basePath );
+ unset( $packageMap, $autoloads );
+
+ // Make sure none of the legacy files remain that can lead to problems with the autoloader.
+ $this->removeLegacyFiles( $vendorPath );
+
+ // Write all of the files now that we're done.
+ $this->writeAutoloaderFiles( $vendorPath . '/jetpack-autoloader/', $suffix );
+ $this->writeManifests( $vendorPath . '/' . $targetDir, $processedAutoloads );
+
+ if ( ! $scanPsrPackages ) {
+ $this->io->writeError( 'You are generating an unoptimized autoloader. If this is a production build, consider using the -o option.' );
+ }
+ }
+
+ /**
+ * Compiles an ordered list of namespace => path mappings
+ *
+ * @param array $packageMap Array of array(package, installDir-relative-to-composer.json).
+ * @param PackageInterface $mainPackage Main package instance.
+ *
+ * @return array The list of path mappings.
+ */
+ public function parseAutoloads( array $packageMap, PackageInterface $mainPackage ) {
+ $rootPackageMap = array_shift( $packageMap );
+
+ $sortedPackageMap = $this->sortPackageMap( $packageMap );
+ $sortedPackageMap[] = $rootPackageMap;
+ array_unshift( $packageMap, $rootPackageMap );
+
+ $psr0 = $this->parseAutoloadsType( $packageMap, 'psr-0', $mainPackage );
+ $psr4 = $this->parseAutoloadsType( $packageMap, 'psr-4', $mainPackage );
+ $classmap = $this->parseAutoloadsType( array_reverse( $sortedPackageMap ), 'classmap', $mainPackage );
+ $files = $this->parseAutoloadsType( $sortedPackageMap, 'files', $mainPackage );
+
+ krsort( $psr0 );
+ krsort( $psr4 );
+
+ return array(
+ 'psr-0' => $psr0,
+ 'psr-4' => $psr4,
+ 'classmap' => $classmap,
+ 'files' => $files,
+ );
+ }
+
+ /**
+ * Sorts packages by dependency weight
+ *
+ * Packages of equal weight retain the original order
+ *
+ * @param array $packageMap The package map.
+ *
+ * @return array
+ */
+ protected function sortPackageMap( array $packageMap ) {
+ $packages = array();
+ $paths = array();
+
+ foreach ( $packageMap as $item ) {
+ list( $package, $path ) = $item;
+ $name = $package->getName();
+ $packages[ $name ] = $package;
+ $paths[ $name ] = $path;
+ }
+
+ $sortedPackages = PackageSorter::sortPackages( $packages );
+
+ $sortedPackageMap = array();
+
+ foreach ( $sortedPackages as $package ) {
+ $name = $package->getName();
+ $sortedPackageMap[] = array( $packages[ $name ], $paths[ $name ] );
+ }
+
+ return $sortedPackageMap;
+ }
+
+ /**
+ * Returns the file identifier.
+ *
+ * @param PackageInterface $package The package instance.
+ * @param string $path The path.
+ */
+ protected function getFileIdentifier( PackageInterface $package, $path ) {
+ return md5( $package->getName() . ':' . $path );
+ }
+
+ /**
+ * Returns the path code for the given path.
+ *
+ * @param Filesystem $filesystem The filesystem instance.
+ * @param string $basePath The base path.
+ * @param string $vendorPath The vendor path.
+ * @param string $path The path.
+ *
+ * @return string The path code.
+ */
+ protected function getPathCode( Filesystem $filesystem, $basePath, $vendorPath, $path ) {
+ if ( ! $filesystem->isAbsolutePath( $path ) ) {
+ $path = $basePath . '/' . $path;
+ }
+ $path = $filesystem->normalizePath( $path );
+
+ $baseDir = '';
+ if ( 0 === strpos( $path . '/', $vendorPath . '/' ) ) {
+ $path = substr( $path, strlen( $vendorPath ) );
+ $baseDir = '$vendorDir';
+
+ if ( false !== $path ) {
+ $baseDir .= ' . ';
+ }
+ } else {
+ $path = $filesystem->normalizePath( $filesystem->findShortestPath( $basePath, $path, true ) );
+ if ( ! $filesystem->isAbsolutePath( $path ) ) {
+ $baseDir = '$baseDir . ';
+ $path = '/' . $path;
+ }
+ }
+
+ if ( strpos( $path, '.phar' ) !== false ) {
+ $baseDir = "'phar://' . " . $baseDir;
+ }
+
+ return $baseDir . ( ( false !== $path ) ? var_export( $path, true ) : '' );
+ }
+
+ /**
+ * This function differs from the composer parseAutoloadsType in that beside returning the path.
+ * It also return the path and the version of a package.
+ *
+ * Supports PSR-4, PSR-0, and classmap parsing.
+ *
+ * @param array $packageMap Map of all the packages.
+ * @param string $type Type of autoloader to use.
+ * @param PackageInterface $mainPackage Instance of the Package Object.
+ *
+ * @return array
+ */
+ protected function parseAutoloadsType( array $packageMap, $type, PackageInterface $mainPackage ) {
+ $autoloads = array();
+
+ foreach ( $packageMap as $item ) {
+ list($package, $installPath) = $item;
+ $autoload = $package->getAutoload();
+
+ if ( $package === $mainPackage ) {
+ $autoload = array_merge_recursive( $autoload, $package->getDevAutoload() );
+ }
+
+ if ( null !== $package->getTargetDir() && $package !== $mainPackage ) {
+ $installPath = substr( $installPath, 0, -strlen( '/' . $package->getTargetDir() ) );
+ }
+
+ if ( in_array( $type, array( 'psr-4', 'psr-0' ), true ) && isset( $autoload[ $type ] ) && is_array( $autoload[ $type ] ) ) {
+ foreach ( $autoload[ $type ] as $namespace => $paths ) {
+ $paths = is_array( $paths ) ? $paths : array( $paths );
+ foreach ( $paths as $path ) {
+ $relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
+ $autoloads[ $namespace ][] = array(
+ 'path' => $relativePath,
+ 'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
+ );
+ }
+ }
+ }
+
+ if ( 'classmap' === $type && isset( $autoload['classmap'] ) && is_array( $autoload['classmap'] ) ) {
+ foreach ( $autoload['classmap'] as $paths ) {
+ $paths = is_array( $paths ) ? $paths : array( $paths );
+ foreach ( $paths as $path ) {
+ $relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
+ $autoloads[] = array(
+ 'path' => $relativePath,
+ 'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
+ );
+ }
+ }
+ }
+ if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
+ foreach ( $autoload['files'] as $paths ) {
+ $paths = is_array( $paths ) ? $paths : array( $paths );
+ foreach ( $paths as $path ) {
+ $relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
+ $autoloads[ $this->getFileIdentifier( $package, $path ) ] = array(
+ 'path' => $relativePath,
+ 'version' => $package->getVersion(), // Version of the file comes from the package - should we try to parse it?
+ );
+ }
+ }
+ }
+ }
+
+ return $autoloads;
+ }
+
+ /**
+ * Given Composer's autoloads this will convert them to a version that we can use to generate the manifests.
+ *
+ * When the $scanPsrPackages argument is true, PSR-4 namespaces are converted to classmaps. When $scanPsrPackages
+ * is false, PSR-4 namespaces are not converted to classmaps.
+ *
+ * PSR-0 namespaces are always converted to classmaps.
+ *
+ * @param array $autoloads The autoloads we want to process.
+ * @param bool $scanPsrPackages Whether or not PSR-4 packages should be converted to a classmap.
+ * @param string $vendorPath The path to the vendor directory.
+ * @param string $basePath The path to the current directory.
+ *
+ * @return array $processedAutoloads
+ */
+ private function processAutoloads( $autoloads, $scanPsrPackages, $vendorPath, $basePath ) {
+ $processor = new AutoloadProcessor(
+ function ( $path, $excludedClasses, $namespace ) use ( $basePath ) {
+ $dir = $this->filesystem->normalizePath(
+ $this->filesystem->isAbsolutePath( $path ) ? $path : $basePath . '/' . $path
+ );
+ return ClassMapGenerator::createMap(
+ $dir,
+ $excludedClasses,
+ null, // Don't pass the IOInterface since the normal autoload generation will have reported already.
+ empty( $namespace ) ? null : $namespace
+ );
+ },
+ function ( $path ) use ( $basePath, $vendorPath ) {
+ return $this->getPathCode( $this->filesystem, $basePath, $vendorPath, $path );
+ }
+ );
+
+ return array(
+ 'psr-4' => $processor->processPsr4Packages( $autoloads, $scanPsrPackages ),
+ 'classmap' => $processor->processClassmap( $autoloads, $scanPsrPackages ),
+ 'files' => $processor->processFiles( $autoloads ),
+ );
+ }
+
+ /**
+ * Removes all of the legacy autoloader files so they don't cause any problems.
+ *
+ * @param string $outDir The directory legacy files are written to.
+ */
+ private function removeLegacyFiles( $outDir ) {
+ $files = array(
+ 'autoload_functions.php',
+ 'class-autoloader-handler.php',
+ 'class-classes-handler.php',
+ 'class-files-handler.php',
+ 'class-plugins-handler.php',
+ 'class-version-selector.php',
+ );
+ foreach ( $files as $file ) {
+ $this->filesystem->remove( $outDir . '/' . $file );
+ }
+ }
+
+ /**
+ * Writes all of the autoloader files to disk.
+ *
+ * @param string $outDir The directory to write to.
+ * @param string $suffix The unique autoloader suffix.
+ */
+ private function writeAutoloaderFiles( $outDir, $suffix ) {
+ $this->io->writeError( "Generating jetpack autoloader ($outDir)" );
+
+ // We will remove all autoloader files to generate this again.
+ $this->filesystem->emptyDirectory( $outDir );
+
+ // Write the autoloader files.
+ AutoloadFileWriter::copyAutoloaderFiles( $this->io, $outDir, $suffix );
+ }
+
+ /**
+ * Writes all of the manifest files to disk.
+ *
+ * @param string $outDir The directory to write to.
+ * @param array $processedAutoloads The processed autoloads.
+ */
+ private function writeManifests( $outDir, $processedAutoloads ) {
+ $this->io->writeError( "Generating jetpack autoloader manifests ($outDir)" );
+
+ $manifestFiles = array(
+ 'classmap' => 'jetpack_autoload_classmap.php',
+ 'psr-4' => 'jetpack_autoload_psr4.php',
+ 'files' => 'jetpack_autoload_filemap.php',
+ );
+
+ foreach ( $manifestFiles as $key => $file ) {
+ // Make sure the file doesn't exist so it isn't there if we don't write it.
+ $this->filesystem->remove( $outDir . '/' . $file );
+ if ( empty( $processedAutoloads[ $key ] ) ) {
+ continue;
+ }
+
+ $content = ManifestGenerator::buildManifest( $key, $file, $processedAutoloads[ $key ] );
+ if ( empty( $content ) ) {
+ continue;
+ }
+
+ if ( file_put_contents( $outDir . '/' . $file, $content ) ) {
+ $this->io->writeError( " Generated: $file" );
+ } else {
+ $this->io->writeError( " Error: $file" );
+ }
+ }
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/AutoloadProcessor.php b/vendor/automattic/jetpack-autoloader/src/AutoloadProcessor.php
new file mode 100644
index 00000000000..70501f22152
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/AutoloadProcessor.php
@@ -0,0 +1,180 @@
+classmapScanner = $classmapScanner;
+ $this->pathCodeTransformer = $pathCodeTransformer;
+ }
+
+ /**
+ * Processes the classmap autoloads into a relative path format including the version for each file.
+ *
+ * @param array $autoloads The autoloads we are processing.
+ * @param bool $scanPsrPackages Whether or not PSR packages should be converted to a classmap.
+ *
+ * @return array $processed
+ */
+ public function processClassmap( $autoloads, $scanPsrPackages ) {
+ // We can't scan PSR packages if we don't actually have any.
+ if ( empty( $autoloads['psr-4'] ) ) {
+ $scanPsrPackages = false;
+ }
+
+ if ( empty( $autoloads['classmap'] ) && ! $scanPsrPackages ) {
+ return null;
+ }
+
+ $excludedClasses = null;
+ if ( ! empty( $autoloads['exclude-from-classmap'] ) ) {
+ $excludedClasses = '{(' . implode( '|', $autoloads['exclude-from-classmap'] ) . ')}';
+ }
+
+ $processed = array();
+
+ if ( $scanPsrPackages ) {
+ foreach ( $autoloads['psr-4'] as $namespace => $sources ) {
+ $namespace = empty( $namespace ) ? null : $namespace;
+
+ foreach ( $sources as $source ) {
+ $classmap = call_user_func( $this->classmapScanner, $source['path'], $excludedClasses, $namespace );
+
+ foreach ( $classmap as $class => $path ) {
+ $processed[ $class ] = array(
+ 'version' => $source['version'],
+ 'path' => call_user_func( $this->pathCodeTransformer, $path ),
+ );
+ }
+ }
+ }
+ }
+
+ /*
+ * PSR-0 namespaces are converted to classmaps for both optimized and unoptimized autoloaders because any new
+ * development should use classmap or PSR-4 autoloading.
+ */
+ if ( ! empty( $autoloads['psr-0'] ) ) {
+ foreach ( $autoloads['psr-0'] as $namespace => $sources ) {
+ $namespace = empty( $namespace ) ? null : $namespace;
+
+ foreach ( $sources as $source ) {
+ $classmap = call_user_func( $this->classmapScanner, $source['path'], $excludedClasses, $namespace );
+ foreach ( $classmap as $class => $path ) {
+ $processed[ $class ] = array(
+ 'version' => $source['version'],
+ 'path' => call_user_func( $this->pathCodeTransformer, $path ),
+ );
+ }
+ }
+ }
+ }
+
+ if ( ! empty( $autoloads['classmap'] ) ) {
+ foreach ( $autoloads['classmap'] as $package ) {
+ $classmap = call_user_func( $this->classmapScanner, $package['path'], $excludedClasses, null );
+
+ foreach ( $classmap as $class => $path ) {
+ $processed[ $class ] = array(
+ 'version' => $package['version'],
+ 'path' => call_user_func( $this->pathCodeTransformer, $path ),
+ );
+ }
+ }
+ }
+
+ return $processed;
+ }
+
+ /**
+ * Processes the PSR-4 autoloads into a relative path format including the version for each file.
+ *
+ * @param array $autoloads The autoloads we are processing.
+ * @param bool $scanPsrPackages Whether or not PSR packages should be converted to a classmap.
+ *
+ * @return array $processed
+ */
+ public function processPsr4Packages( $autoloads, $scanPsrPackages ) {
+ if ( $scanPsrPackages || empty( $autoloads['psr-4'] ) ) {
+ return null;
+ }
+
+ $processed = array();
+
+ foreach ( $autoloads['psr-4'] as $namespace => $packages ) {
+ $namespace = empty( $namespace ) ? null : $namespace;
+ $paths = array();
+
+ foreach ( $packages as $package ) {
+ $paths[] = call_user_func( $this->pathCodeTransformer, $package['path'] );
+ }
+
+ $processed[ $namespace ] = array(
+ 'version' => $package['version'],
+ 'path' => $paths,
+ );
+ }
+
+ return $processed;
+ }
+
+ /**
+ * Processes the file autoloads into a relative format including the version for each file.
+ *
+ * @param array $autoloads The autoloads we are processing.
+ *
+ * @return array|null $processed
+ */
+ public function processFiles( $autoloads ) {
+ if ( empty( $autoloads['files'] ) ) {
+ return null;
+ }
+
+ $processed = array();
+
+ foreach ( $autoloads['files'] as $file_id => $package ) {
+ $processed[ $file_id ] = array(
+ 'version' => $package['version'],
+ 'path' => call_user_func( $this->pathCodeTransformer, $package['path'] ),
+ );
+ }
+
+ return $processed;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php b/vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php
new file mode 100644
index 00000000000..78c908c33d2
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php
@@ -0,0 +1,198 @@
+composer = $composer;
+ $this->io = $io;
+ }
+
+ /**
+ * Do nothing.
+ * phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
+ *
+ * @param Composer $composer Composer object.
+ * @param IOInterface $io IO object.
+ */
+ public function deactivate( Composer $composer, IOInterface $io ) {
+ /*
+ * Intentionally left empty. This is a PluginInterface method.
+ * phpcs:enable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
+ */
+ }
+
+ /**
+ * Do nothing.
+ * phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
+ *
+ * @param Composer $composer Composer object.
+ * @param IOInterface $io IO object.
+ */
+ public function uninstall( Composer $composer, IOInterface $io ) {
+ /*
+ * Intentionally left empty. This is a PluginInterface method.
+ * phpcs:enable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
+ */
+ }
+
+ /**
+ * Tell composer to listen for events and do something with them.
+ *
+ * @return array List of subscribed events.
+ */
+ public static function getSubscribedEvents() {
+ return array(
+ ScriptEvents::POST_AUTOLOAD_DUMP => 'postAutoloadDump',
+ );
+ }
+
+ /**
+ * Generate the custom autolaoder.
+ *
+ * @param Event $event Script event object.
+ */
+ public function postAutoloadDump( Event $event ) {
+ // When the autoloader is not required by the root package we don't want to execute it.
+ // This prevents unwanted transitive execution that generates unused autoloaders or
+ // at worst throws fatal executions.
+ if ( ! $this->isRequiredByRoot() ) {
+ return;
+ }
+
+ $config = $this->composer->getConfig();
+
+ if ( 'vendor' !== $config->raw()['config']['vendor-dir'] ) {
+ $this->io->writeError( "\nAn error occurred while generating the autoloader files:", true );
+ $this->io->writeError( 'The project\'s composer.json or composer environment set a non-default vendor directory.', true );
+ $this->io->writeError( 'The default composer vendor directory must be used.', true );
+ exit();
+ }
+
+ $installationManager = $this->composer->getInstallationManager();
+ $repoManager = $this->composer->getRepositoryManager();
+ $localRepo = $repoManager->getLocalRepository();
+ $package = $this->composer->getPackage();
+ $optimize = $event->getFlags()['optimize'];
+ $suffix = $this->determineSuffix();
+
+ $generator = new AutoloadGenerator( $this->io );
+ $generator->dump( $this->composer, $config, $localRepo, $package, $installationManager, 'composer', $optimize, $suffix );
+ $this->generated = true;
+ }
+
+ /**
+ * Determine the suffix for the autoloader class.
+ *
+ * Reuses an existing suffix from vendor/autoload_packages.php or vendor/autoload.php if possible.
+ *
+ * @return string Suffix.
+ */
+ private function determineSuffix() {
+ $config = $this->composer->getConfig();
+ $vendorPath = $config->get( 'vendor-dir' );
+
+ // Command line.
+ $suffix = $config->get( 'autoloader-suffix' );
+ if ( $suffix ) {
+ return $suffix;
+ }
+
+ // Reuse our own suffix, if any.
+ if ( is_readable( $vendorPath . '/autoload_packages.php' ) ) {
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
+ $content = file_get_contents( $vendorPath . '/autoload_packages.php' );
+ if ( preg_match( '/^namespace Automattic\\\\Jetpack\\\\Autoloader\\\\jp([^;\s]+);/m', $content, $match ) ) {
+ return $match[1];
+ }
+ }
+
+ // Reuse Composer's suffix, if any.
+ if ( is_readable( $vendorPath . '/autoload.php' ) ) {
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
+ $content = file_get_contents( $vendorPath . '/autoload.php' );
+ if ( preg_match( '{ComposerAutoloaderInit([^:\s]+)::}', $content, $match ) ) {
+ return $match[1];
+ }
+ }
+
+ // Generate a random suffix.
+ return md5( uniqid( '', true ) );
+ }
+
+ /**
+ * Checks to see whether or not the root package is the one that required the autoloader.
+ *
+ * @return bool
+ */
+ private function isRequiredByRoot() {
+ $package = $this->composer->getPackage();
+ $requires = $package->getRequires();
+ if ( ! is_array( $requires ) ) {
+ $requires = array();
+ }
+ $devRequires = $package->getDevRequires();
+ if ( ! is_array( $devRequires ) ) {
+ $devRequires = array();
+ }
+ $requires = array_merge( $requires, $devRequires );
+
+ if ( empty( $requires ) ) {
+ $this->io->writeError( "\nThe package is not required and this should never happen?", true );
+ exit();
+ }
+
+ foreach ( $requires as $require ) {
+ if ( 'automattic/jetpack-autoloader' === $require->getTarget() ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/ManifestGenerator.php b/vendor/automattic/jetpack-autoloader/src/ManifestGenerator.php
new file mode 100644
index 00000000000..595a97fc6e2
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/ManifestGenerator.php
@@ -0,0 +1,121 @@
+ $data ) {
+ $key = var_export( $key, true );
+ $versionCode = var_export( $data['version'], true );
+ $fileContent .= << array(
+ 'version' => $versionCode,
+ 'path' => {$data['path']}
+ ),
+MANIFEST_CODE;
+ $fileContent .= PHP_EOL;
+ }
+
+ return self::buildFile( $fileName, $fileContent );
+ }
+
+ /**
+ * Builds the contents for the PSR-4 manifest file.
+ *
+ * @param string $fileName The filename we are building.
+ * @param array $namespaces The formatted PSR-4 data for the manifest.
+ *
+ * @return string|null $manifestFile
+ */
+ private static function buildPsr4Manifest( $fileName, $namespaces ) {
+ $fileContent = PHP_EOL;
+ foreach ( $namespaces as $namespace => $data ) {
+ $namespaceCode = var_export( $namespace, true );
+ $versionCode = var_export( $data['version'], true );
+ $pathCode = 'array( ' . implode( ', ', $data['path'] ) . ' )';
+ $fileContent .= << array(
+ 'version' => $versionCode,
+ 'path' => $pathCode
+ ),
+MANIFEST_CODE;
+ $fileContent .= PHP_EOL;
+ }
+
+ return self::buildFile( $fileName, $fileContent );
+ }
+
+ /**
+ * Generate the PHP that will be used in the file.
+ *
+ * @param string $fileName The filename we are building.
+ * @param string $content The content to be written into the file.
+ *
+ * @return string $fileContent
+ */
+ private static function buildFile( $fileName, $content ) {
+ return <<php_autoloader = $php_autoloader;
+ $this->hook_manager = $hook_manager;
+ $this->manifest_reader = $manifest_reader;
+ $this->version_selector = $version_selector;
+ }
+
+ /**
+ * Checks to see whether or not an autoloader is currently in the process of initializing.
+ *
+ * @return bool
+ */
+ public function is_initializing() {
+ // If no version has been set it means that no autoloader has started initializing yet.
+ global $jetpack_autoloader_latest_version;
+ if ( ! isset( $jetpack_autoloader_latest_version ) ) {
+ return false;
+ }
+
+ // When the version is set but the classmap is not it ALWAYS means that this is the
+ // latest autoloader and is being included by an older one.
+ global $jetpack_packages_classmap;
+ if ( empty( $jetpack_packages_classmap ) ) {
+ return true;
+ }
+
+ // Version 2.4.0 added a new global and altered the reset semantics. We need to check
+ // the other global as well since it may also point at initialization.
+ // Note: We don't need to check for the class first because every autoloader that
+ // will set the latest version global requires this class in the classmap.
+ $replacing_version = $jetpack_packages_classmap[ AutoloadGenerator::class ]['version'];
+ if ( $this->version_selector->is_dev_version( $replacing_version ) || version_compare( $replacing_version, '2.4.0.0', '>=' ) ) {
+ global $jetpack_autoloader_loader;
+ if ( ! isset( $jetpack_autoloader_loader ) ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Activates an autoloader using the given plugins and activates it.
+ *
+ * @param string[] $plugins The plugins to initialize the autoloader for.
+ */
+ public function activate_autoloader( $plugins ) {
+ global $jetpack_packages_psr4;
+ $jetpack_packages_psr4 = array();
+ $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
+
+ global $jetpack_packages_classmap;
+ $jetpack_packages_classmap = array();
+ $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_classmap.php', $jetpack_packages_classmap );
+
+ global $jetpack_packages_filemap;
+ $jetpack_packages_filemap = array();
+ $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_filemap.php', $jetpack_packages_filemap );
+
+ $loader = new Version_Loader(
+ $this->version_selector,
+ $jetpack_packages_classmap,
+ $jetpack_packages_psr4,
+ $jetpack_packages_filemap
+ );
+
+ $this->php_autoloader->register_autoloader( $loader );
+
+ // Now that the autoloader is active we can load the filemap.
+ $loader->load_filemap();
+ }
+
+ /**
+ * Resets the active autoloader and all related global state.
+ */
+ public function reset_autoloader() {
+ $this->php_autoloader->unregister_autoloader();
+ $this->hook_manager->reset();
+
+ // Clear all of the autoloader globals so that older autoloaders don't do anything strange.
+ global $jetpack_autoloader_latest_version;
+ $jetpack_autoloader_latest_version = null;
+
+ global $jetpack_packages_classmap;
+ $jetpack_packages_classmap = array(); // Must be array to avoid exceptions in old autoloaders!
+
+ global $jetpack_packages_psr4;
+ $jetpack_packages_psr4 = array(); // Must be array to avoid exceptions in old autoloaders!
+
+ global $jetpack_packages_filemap;
+ $jetpack_packages_filemap = array(); // Must be array to avoid exceptions in old autoloaders!
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-autoloader-locator.php b/vendor/automattic/jetpack-autoloader/src/class-autoloader-locator.php
new file mode 100644
index 00000000000..828fe25b9e6
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-autoloader-locator.php
@@ -0,0 +1,82 @@
+version_selector = $version_selector;
+ }
+
+ /**
+ * Finds the path to the plugin with the latest autoloader.
+ *
+ * @param array $plugin_paths An array of plugin paths.
+ * @param string $latest_version The latest version reference.
+ *
+ * @return string|null
+ */
+ public function find_latest_autoloader( $plugin_paths, &$latest_version ) {
+ $latest_plugin = null;
+
+ foreach ( $plugin_paths as $plugin_path ) {
+ $version = $this->get_autoloader_version( $plugin_path );
+ if ( ! $this->version_selector->is_version_update_required( $latest_version, $version ) ) {
+ continue;
+ }
+
+ $latest_version = $version;
+ $latest_plugin = $plugin_path;
+ }
+
+ return $latest_plugin;
+ }
+
+ /**
+ * Gets the path to the autoloader.
+ *
+ * @param string $plugin_path The path to the plugin.
+ *
+ * @return string
+ */
+ public function get_autoloader_path( $plugin_path ) {
+ return trailingslashit( $plugin_path ) . 'vendor/autoload_packages.php';
+ }
+
+ /**
+ * Gets the version for the autoloader.
+ *
+ * @param string $plugin_path The path to the plugin.
+ *
+ * @return string|null
+ */
+ public function get_autoloader_version( $plugin_path ) {
+ $classmap = trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
+ if ( ! file_exists( $classmap ) ) {
+ return null;
+ }
+
+ $classmap = require $classmap;
+ if ( isset( $classmap[ AutoloadGenerator::class ] ) ) {
+ return $classmap[ AutoloadGenerator::class ]['version'];
+ }
+
+ return null;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-autoloader.php b/vendor/automattic/jetpack-autoloader/src/class-autoloader.php
new file mode 100644
index 00000000000..fb5672b0465
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-autoloader.php
@@ -0,0 +1,115 @@
+get( Autoloader_Handler::class );
+
+ // If the autoloader is already initializing it means that it has included us as the latest.
+ $was_included_by_autoloader = $autoloader_handler->is_initializing();
+
+ /** @var Plugin_Locator $plugin_locator */
+ $plugin_locator = $container->get( Plugin_Locator::class );
+
+ /** @var Plugins_Handler $plugins_handler */
+ $plugins_handler = $container->get( Plugins_Handler::class );
+
+ // The current plugin is the one that we are attempting to initialize here.
+ $current_plugin = $plugin_locator->find_current_plugin();
+
+ // The active plugins are those that we were able to discover on the site. This list will not
+ // include mu-plugins, those activated by code, or those who are hidden by filtering. We also
+ // want to take care to not consider the current plugin unknown if it was included by an
+ // autoloader. This avoids the case where a plugin will be marked "active" while deactivated
+ // due to it having the latest autoloader.
+ $active_plugins = $plugins_handler->get_active_plugins( true, ! $was_included_by_autoloader );
+
+ // The cached plugins are all of those that were active or discovered by the autoloader during a previous request.
+ // Note that it's possible this list will include plugins that have since been deactivated, but after a request
+ // the cache should be updated and the deactivated plugins will be removed.
+ $cached_plugins = $plugins_handler->get_cached_plugins();
+
+ // We combine the active list and cached list to preemptively load classes for plugins that are
+ // presently unknown but will be loaded during the request. While this may result in us considering packages in
+ // deactivated plugins there shouldn't be any problems as a result and the eventual consistency is sufficient.
+ $all_plugins = array_merge( $active_plugins, $cached_plugins );
+
+ // In particular we also include the current plugin to address the case where it is the latest autoloader
+ // but also unknown (and not cached). We don't want it in the active list because we don't know that it
+ // is active but we need it in the all plugins list so that it is considered by the autoloader.
+ $all_plugins[] = $current_plugin;
+
+ // We require uniqueness in the array to avoid processing the same plugin more than once.
+ $all_plugins = array_values( array_unique( $all_plugins ) );
+
+ /** @var Latest_Autoloader_Guard $guard */
+ $guard = $container->get( Latest_Autoloader_Guard::class );
+ if ( $guard->should_stop_init( $current_plugin, $all_plugins, $was_included_by_autoloader ) ) {
+ return;
+ }
+
+ // Initialize the autoloader using the handler now that we're ready.
+ $autoloader_handler->activate_autoloader( $all_plugins );
+
+ /** @var Hook_Manager $hook_manager */
+ $hook_manager = $container->get( Hook_Manager::class );
+
+ // When the active and cached plugin lists do not match we should
+ // update the cache. This will prevent plugins that have been
+ // deactivated from being considered in other requests.
+ $hook_manager->add_action(
+ 'shutdown',
+ function () use ( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) {
+ // Don't save a broken cache if an error happens during some plugin's initialization.
+ if ( ! did_action( 'plugins_loaded' ) ) {
+ // Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
+ if ( ! empty( $cached_plugins ) ) {
+ $plugins_handler->cache_plugins( array() );
+ }
+
+ return;
+ }
+
+ // Load the active plugins fresh since the list we pulled earlier might not contain
+ // plugins that were activated but did not reset the autoloader. This happens
+ // when a plugin is in the cache but not "active" when the autoloader loads.
+ // We also want to make sure that plugins which are deactivating are not
+ // considered "active" so that they will be removed from the cache now.
+ $active_plugins = $plugins_handler->get_active_plugins( false, ! $was_included_by_autoloader );
+
+ // The paths should be sorted for easy comparisons with those loaded from the cache.
+ // Note we don't need to sort the cached entries because they're already sorted.
+ sort( $active_plugins );
+
+ // We don't want to waste time saving a cache that hasn't changed.
+ if ( $cached_plugins === $active_plugins ) {
+ return;
+ }
+
+ $plugins_handler->cache_plugins( $active_plugins );
+ }
+ );
+
+ // phpcs:enable Generic.Commenting.DocComment.MissingShort
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-container.php b/vendor/automattic/jetpack-autoloader/src/class-container.php
new file mode 100644
index 00000000000..788d9de55df
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-container.php
@@ -0,0 +1,141 @@
+ 'Hook_Manager',
+ );
+
+ /**
+ * A map of all the dependencies we've registered with the container and created.
+ *
+ * @var array
+ */
+ protected $dependencies;
+
+ /**
+ * The constructor.
+ */
+ public function __construct() {
+ $this->dependencies = array();
+
+ $this->register_shared_dependencies();
+ $this->register_dependencies();
+ $this->initialize_globals();
+ }
+
+ /**
+ * Gets a dependency out of the container.
+ *
+ * @param string $class The class to fetch.
+ *
+ * @return mixed
+ * @throws \InvalidArgumentException When a class that isn't registered with the container is fetched.
+ */
+ public function get( $class ) {
+ if ( ! isset( $this->dependencies[ $class ] ) ) {
+ throw new \InvalidArgumentException( "Class '$class' is not registered with the container." );
+ }
+
+ return $this->dependencies[ $class ];
+ }
+
+ /**
+ * Registers all of the dependencies that are shared between all instances of the autoloader.
+ */
+ private function register_shared_dependencies() {
+ global $jetpack_autoloader_container_shared;
+ if ( ! isset( $jetpack_autoloader_container_shared ) ) {
+ $jetpack_autoloader_container_shared = array();
+ }
+
+ $key = self::SHARED_DEPENDENCY_KEYS[ Hook_Manager::class ];
+ if ( ! isset( $jetpack_autoloader_container_shared[ $key ] ) ) {
+ require_once __DIR__ . '/class-hook-manager.php';
+ $jetpack_autoloader_container_shared[ $key ] = new Hook_Manager();
+ }
+ $this->dependencies[ Hook_Manager::class ] = &$jetpack_autoloader_container_shared[ $key ];
+ }
+
+ /**
+ * Registers all of the dependencies with the container.
+ */
+ private function register_dependencies() {
+ require_once __DIR__ . '/class-path-processor.php';
+ $this->dependencies[ Path_Processor::class ] = new Path_Processor();
+
+ require_once __DIR__ . '/class-plugin-locator.php';
+ $this->dependencies[ Plugin_Locator::class ] = new Plugin_Locator(
+ $this->get( Path_Processor::class )
+ );
+
+ require_once __DIR__ . '/class-version-selector.php';
+ $this->dependencies[ Version_Selector::class ] = new Version_Selector();
+
+ require_once __DIR__ . '/class-autoloader-locator.php';
+ $this->dependencies[ Autoloader_Locator::class ] = new Autoloader_Locator(
+ $this->get( Version_Selector::class )
+ );
+
+ require_once __DIR__ . '/class-php-autoloader.php';
+ $this->dependencies[ PHP_Autoloader::class ] = new PHP_Autoloader();
+
+ require_once __DIR__ . '/class-manifest-reader.php';
+ $this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
+ $this->get( Version_Selector::class )
+ );
+
+ require_once __DIR__ . '/class-plugins-handler.php';
+ $this->dependencies[ Plugins_Handler::class ] = new Plugins_Handler(
+ $this->get( Plugin_Locator::class ),
+ $this->get( Path_Processor::class )
+ );
+
+ require_once __DIR__ . '/class-autoloader-handler.php';
+ $this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
+ $this->get( PHP_Autoloader::class ),
+ $this->get( Hook_Manager::class ),
+ $this->get( Manifest_Reader::class ),
+ $this->get( Version_Selector::class )
+ );
+
+ require_once __DIR__ . '/class-latest-autoloader-guard.php';
+ $this->dependencies[ Latest_Autoloader_Guard::class ] = new Latest_Autoloader_Guard(
+ $this->get( Plugins_Handler::class ),
+ $this->get( Autoloader_Handler::class ),
+ $this->get( Autoloader_Locator::class )
+ );
+
+ // Register any classes that we will use elsewhere.
+ require_once __DIR__ . '/class-version-loader.php';
+ }
+
+ /**
+ * Initializes any of the globals needed by the autoloader.
+ */
+ private function initialize_globals() {
+ /*
+ * This global was retired in version 2.9. The value is set to 'false' to maintain
+ * compatibility with older versions of the autoloader.
+ */
+ global $jetpack_autoloader_including_latest;
+ $jetpack_autoloader_including_latest = false;
+
+ // Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
+ // but was not discoverable, we will record them in this array to track them as "active".
+ global $jetpack_autoloader_activating_plugins_paths;
+ if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
+ $jetpack_autoloader_activating_plugins_paths = array();
+ }
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-hook-manager.php b/vendor/automattic/jetpack-autoloader/src/class-hook-manager.php
new file mode 100644
index 00000000000..1d64c756bfb
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-hook-manager.php
@@ -0,0 +1,68 @@
+registered_hooks = array();
+ }
+
+ /**
+ * Adds an action to WordPress and registers it internally.
+ *
+ * @param string $tag The name of the action which is hooked.
+ * @param callable $callable The function to call.
+ * @param int $priority Used to specify the priority of the action.
+ * @param int $accepted_args Used to specify the number of arguments the callable accepts.
+ */
+ public function add_action( $tag, $callable, $priority = 10, $accepted_args = 1 ) {
+ $this->registered_hooks[ $tag ][] = array(
+ 'priority' => $priority,
+ 'callable' => $callable,
+ );
+
+ add_action( $tag, $callable, $priority, $accepted_args );
+ }
+
+ /**
+ * Adds a filter to WordPress and registers it internally.
+ *
+ * @param string $tag The name of the filter which is hooked.
+ * @param callable $callable The function to call.
+ * @param int $priority Used to specify the priority of the filter.
+ * @param int $accepted_args Used to specify the number of arguments the callable accepts.
+ */
+ public function add_filter( $tag, $callable, $priority = 10, $accepted_args = 1 ) {
+ $this->registered_hooks[ $tag ][] = array(
+ 'priority' => $priority,
+ 'callable' => $callable,
+ );
+
+ add_filter( $tag, $callable, $priority, $accepted_args );
+ }
+
+ /**
+ * Removes all of the registered hooks.
+ */
+ public function reset() {
+ foreach ( $this->registered_hooks as $tag => $hooks ) {
+ foreach ( $hooks as $hook ) {
+ remove_filter( $tag, $hook['callable'], $hook['priority'] );
+ }
+ }
+ $this->registered_hooks = array();
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php b/vendor/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php
new file mode 100644
index 00000000000..54edfc87c23
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php
@@ -0,0 +1,78 @@
+plugins_handler = $plugins_handler;
+ $this->autoloader_handler = $autoloader_handler;
+ $this->autoloader_locator = $autoloader_locator;
+ }
+
+ /**
+ * Indicates whether or not the autoloader should be initialized. Note that this function
+ * has the side-effect of actually loading the latest autoloader in the event that this
+ * is not it.
+ *
+ * @param string $current_plugin The current plugin we're checking.
+ * @param string[] $plugins The active plugins to check for autoloaders in.
+ * @param bool $was_included_by_autoloader Indicates whether or not this autoloader was included by another.
+ *
+ * @return bool True if we should stop initialization, otherwise false.
+ */
+ public function should_stop_init( $current_plugin, $plugins, $was_included_by_autoloader ) {
+ global $jetpack_autoloader_latest_version;
+
+ // We need to reset the autoloader when the plugins change because
+ // that means the autoloader was generated with a different list.
+ if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
+ $this->autoloader_handler->reset_autoloader();
+ }
+
+ // When the latest autoloader has already been found we don't need to search for it again.
+ // We should take care however because this will also trigger if the autoloader has been
+ // included by an older one.
+ if ( isset( $jetpack_autoloader_latest_version ) && ! $was_included_by_autoloader ) {
+ return true;
+ }
+
+ $latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
+ if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
+ require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-manifest-reader.php b/vendor/automattic/jetpack-autoloader/src/class-manifest-reader.php
new file mode 100644
index 00000000000..8eb4825fb2d
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-manifest-reader.php
@@ -0,0 +1,91 @@
+version_selector = $version_selector;
+ }
+
+ /**
+ * Reads all of the manifests in the given plugin paths.
+ *
+ * @param array $plugin_paths The paths to the plugins we're loading the manifest in.
+ * @param string $manifest_path The path that we're loading the manifest from in each plugin.
+ * @param array $path_map The path map to add the contents of the manifests to.
+ *
+ * @return array $path_map The path map we've built using the manifests in each plugin.
+ */
+ public function read_manifests( $plugin_paths, $manifest_path, &$path_map ) {
+ $file_paths = array_map(
+ function ( $path ) use ( $manifest_path ) {
+ return trailingslashit( $path ) . $manifest_path;
+ },
+ $plugin_paths
+ );
+
+ foreach ( $file_paths as $path ) {
+ $this->register_manifest( $path, $path_map );
+ }
+
+ return $path_map;
+ }
+
+ /**
+ * Registers a plugin's manifest file with the path map.
+ *
+ * @param string $manifest_path The absolute path to the manifest that we're loading.
+ * @param array $path_map The path map to add the contents of the manifest to.
+ */
+ protected function register_manifest( $manifest_path, &$path_map ) {
+ if ( ! is_readable( $manifest_path ) ) {
+ return;
+ }
+
+ $manifest = require $manifest_path;
+ if ( ! is_array( $manifest ) ) {
+ return;
+ }
+
+ foreach ( $manifest as $key => $data ) {
+ $this->register_record( $key, $data, $path_map );
+ }
+ }
+
+ /**
+ * Registers an entry from the manifest in the path map.
+ *
+ * @param string $key The identifier for the entry we're registering.
+ * @param array $data The data for the entry we're registering.
+ * @param array $path_map The path map to add the contents of the manifest to.
+ */
+ protected function register_record( $key, $data, &$path_map ) {
+ if ( isset( $path_map[ $key ]['version'] ) ) {
+ $selected_version = $path_map[ $key ]['version'];
+ } else {
+ $selected_version = null;
+ }
+
+ if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) {
+ $path_map[ $key ] = array(
+ 'version' => $data['version'],
+ 'path' => $data['path'],
+ );
+ }
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-path-processor.php b/vendor/automattic/jetpack-autoloader/src/class-path-processor.php
new file mode 100644
index 00000000000..bc480c60b05
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-path-processor.php
@@ -0,0 +1,186 @@
+get_normalized_constants();
+ foreach ( $constants as $constant => $constant_path ) {
+ $len = strlen( $constant_path );
+ if ( substr( $path, 0, $len ) !== $constant_path ) {
+ continue;
+ }
+
+ return substr_replace( $path, '{{' . $constant . '}}', 0, $len );
+ }
+
+ return $path;
+ }
+
+ /**
+ * Given a path this will replace any of the path constant tokens with the expanded path.
+ *
+ * @param string $tokenized_path The path we want to process.
+ *
+ * @return string The expanded path.
+ */
+ public function untokenize_path_constants( $tokenized_path ) {
+ $tokenized_path = wp_normalize_path( $tokenized_path );
+
+ $constants = $this->get_normalized_constants();
+ foreach ( $constants as $constant => $constant_path ) {
+ $constant = '{{' . $constant . '}}';
+
+ $len = strlen( $constant );
+ if ( substr( $tokenized_path, 0, $len ) !== $constant ) {
+ continue;
+ }
+
+ return $this->get_real_path( substr_replace( $tokenized_path, $constant_path, 0, $len ) );
+ }
+
+ return $tokenized_path;
+ }
+
+ /**
+ * Given a file and an array of places it might be, this will find the absolute path and return it.
+ *
+ * @param string $file The plugin or theme file to resolve.
+ * @param array $directories_to_check The directories we should check for the file if it isn't an absolute path.
+ *
+ * @return string|false Returns the absolute path to the directory, otherwise false.
+ */
+ public function find_directory_with_autoloader( $file, $directories_to_check ) {
+ $file = wp_normalize_path( $file );
+
+ if ( ! $this->is_absolute_path( $file ) ) {
+ $file = $this->find_absolute_plugin_path( $file, $directories_to_check );
+ if ( ! isset( $file ) ) {
+ return false;
+ }
+ }
+
+ // We need the real path for consistency with __DIR__ paths.
+ $file = $this->get_real_path( $file );
+
+ // phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
+ $directory = @is_file( $file ) ? dirname( $file ) : $file;
+ if ( ! @is_file( $directory . '/vendor/composer/jetpack_autoload_classmap.php' ) ) {
+ return false;
+ }
+ // phpcs:enable WordPress.PHP.NoSilencedErrors.Discouraged
+
+ return $directory;
+ }
+
+ /**
+ * Fetches an array of normalized paths keyed by the constant they came from.
+ *
+ * @return string[] The normalized paths keyed by the constant.
+ */
+ private function get_normalized_constants() {
+ $raw_constants = array(
+ // Order the constants from most-specific to least-specific.
+ 'WP_PLUGIN_DIR',
+ 'WPMU_PLUGIN_DIR',
+ 'WP_CONTENT_DIR',
+ 'ABSPATH',
+ );
+
+ $constants = array();
+ foreach ( $raw_constants as $raw ) {
+ if ( ! defined( $raw ) ) {
+ continue;
+ }
+
+ $path = wp_normalize_path( constant( $raw ) );
+ if ( isset( $path ) ) {
+ $constants[ $raw ] = $path;
+ }
+ }
+
+ return $constants;
+ }
+
+ /**
+ * Indicates whether or not a path is absolute.
+ *
+ * @param string $path The path to check.
+ *
+ * @return bool True if the path is absolute, otherwise false.
+ */
+ private function is_absolute_path( $path ) {
+ if ( 0 === strlen( $path ) || '.' === $path[0] ) {
+ return false;
+ }
+
+ // Absolute paths on Windows may begin with a drive letter.
+ if ( preg_match( '/^[a-zA-Z]:[\/\\\\]/', $path ) ) {
+ return true;
+ }
+
+ // A path starting with / or \ is absolute; anything else is relative.
+ return ( '/' === $path[0] || '\\' === $path[0] );
+ }
+
+ /**
+ * Given a file and a list of directories to check, this method will try to figure out
+ * the absolute path to the file in question.
+ *
+ * @param string $normalized_path The normalized path to the plugin or theme file to resolve.
+ * @param array $directories_to_check The directories we should check for the file if it isn't an absolute path.
+ *
+ * @return string|null The absolute path to the plugin file, otherwise null.
+ */
+ private function find_absolute_plugin_path( $normalized_path, $directories_to_check ) {
+ // We're only able to find the absolute path for plugin/theme PHP files.
+ if ( ! is_string( $normalized_path ) || '.php' !== substr( $normalized_path, -4 ) ) {
+ return null;
+ }
+
+ foreach ( $directories_to_check as $directory ) {
+ $normalized_check = wp_normalize_path( trailingslashit( $directory ) ) . $normalized_path;
+ // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
+ if ( @is_file( $normalized_check ) ) {
+ return $normalized_check;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Given a path this will figure out the real path that we should be using.
+ *
+ * @param string $path The path to resolve.
+ *
+ * @return string The resolved path.
+ */
+ private function get_real_path( $path ) {
+ // We want to resolve symbolic links for consistency with __DIR__ paths.
+ // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
+ $real_path = @realpath( $path );
+ if ( false === $real_path ) {
+ // Let the autoloader deal with paths that don't exist.
+ $real_path = $path;
+ }
+
+ // Using realpath will make it platform-specific so we must normalize it after.
+ if ( $path !== $real_path ) {
+ $real_path = wp_normalize_path( $real_path );
+ }
+
+ return $real_path;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-php-autoloader.php b/vendor/automattic/jetpack-autoloader/src/class-php-autoloader.php
new file mode 100644
index 00000000000..98d072420c8
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-php-autoloader.php
@@ -0,0 +1,82 @@
+unregister_autoloader();
+
+ // Set the global so that it can be used to load classes.
+ global $jetpack_autoloader_loader;
+ $jetpack_autoloader_loader = $version_loader;
+
+ // Ensure that the autoloader is first to avoid contention with others.
+ spl_autoload_register( array( self::class, 'load_class' ), true, true );
+ }
+
+ /**
+ * Unregisters the active autoloader so that it will no longer autoload classes.
+ */
+ public function unregister_autoloader() {
+ // Remove any v2 autoloader that we've already registered.
+ $autoload_chain = spl_autoload_functions();
+ foreach ( $autoload_chain as $autoloader ) {
+ // We can identify a v2 autoloader using the namespace.
+ $namespace_check = null;
+
+ // Functions are recorded as strings.
+ if ( is_string( $autoloader ) ) {
+ $namespace_check = $autoloader;
+ } elseif ( is_array( $autoloader ) && is_string( $autoloader[0] ) ) {
+ // Static method calls have the class as the first array element.
+ $namespace_check = $autoloader[0];
+ } else {
+ // Since the autoloader has only ever been a function or a static method we don't currently need to check anything else.
+ continue;
+ }
+
+ // Check for the namespace without the generated suffix.
+ if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $namespace_check, 0, 32 ) ) {
+ spl_autoload_unregister( $autoloader );
+ }
+ }
+
+ // Clear the global now that the autoloader has been unregistered.
+ global $jetpack_autoloader_loader;
+ $jetpack_autoloader_loader = null;
+ }
+
+ /**
+ * Loads a class file if one could be found.
+ *
+ * Note: This function is static so that the autoloader can be easily unregistered. If
+ * it was a class method we would have to unwrap the object to check the namespace.
+ *
+ * @param string $class_name The name of the class to autoload.
+ *
+ * @return bool Indicates whether or not a class file was loaded.
+ */
+ public static function load_class( $class_name ) {
+ global $jetpack_autoloader_loader;
+ if ( ! isset( $jetpack_autoloader_loader ) ) {
+ return;
+ }
+
+ $file = $jetpack_autoloader_loader->find_class_file( $class_name );
+ if ( ! isset( $file ) ) {
+ return false;
+ }
+
+ require $file;
+ return true;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-plugin-locator.php b/vendor/automattic/jetpack-autoloader/src/class-plugin-locator.php
new file mode 100644
index 00000000000..dea37cef5bb
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-plugin-locator.php
@@ -0,0 +1,145 @@
+path_processor = $path_processor;
+ }
+
+ /**
+ * Finds the path to the current plugin.
+ *
+ * @return string $path The path to the current plugin.
+ *
+ * @throws \RuntimeException If the current plugin does not have an autoloader.
+ */
+ public function find_current_plugin() {
+ // Escape from `vendor/__DIR__` to root plugin directory.
+ $plugin_directory = dirname( dirname( __DIR__ ) );
+
+ // Use the path processor to ensure that this is an autoloader we're referencing.
+ $path = $this->path_processor->find_directory_with_autoloader( $plugin_directory, array() );
+ if ( false === $path ) {
+ throw new \RuntimeException( 'Failed to locate plugin ' . $plugin_directory );
+ }
+
+ return $path;
+ }
+
+ /**
+ * Checks a given option for plugin paths.
+ *
+ * @param string $option_name The option that we want to check for plugin information.
+ * @param bool $site_option Indicates whether or not we want to check the site option.
+ *
+ * @return array $plugin_paths The list of absolute paths we've found.
+ */
+ public function find_using_option( $option_name, $site_option = false ) {
+ $raw = $site_option ? get_site_option( $option_name ) : get_option( $option_name );
+ if ( false === $raw ) {
+ return array();
+ }
+
+ return $this->convert_plugins_to_paths( $raw );
+ }
+
+ /**
+ * Checks for plugins in the `action` request parameter.
+ *
+ * @param string[] $allowed_actions The actions that we're allowed to return plugins for.
+ *
+ * @return array $plugin_paths The list of absolute paths we've found.
+ */
+ public function find_using_request_action( $allowed_actions ) {
+ // phpcs:disable WordPress.Security.NonceVerification.Recommended
+
+ /**
+ * Note: we're not actually checking the nonce here because it's too early
+ * in the execution. The pluggable functions are not yet loaded to give
+ * plugins a chance to plug their versions. Therefore we're doing the bare
+ * minimum: checking whether the nonce exists and it's in the right place.
+ * The request will fail later if the nonce doesn't pass the check.
+ */
+ if ( empty( $_REQUEST['_wpnonce'] ) ) {
+ return array();
+ }
+
+ $action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
+ if ( ! in_array( $action, $allowed_actions, true ) ) {
+ return array();
+ }
+
+ $plugin_slugs = array();
+ switch ( $action ) {
+ case 'activate':
+ case 'deactivate':
+ if ( empty( $_REQUEST['plugin'] ) ) {
+ break;
+ }
+
+ $plugin_slugs[] = wp_unslash( $_REQUEST['plugin'] );
+ break;
+
+ case 'activate-selected':
+ case 'deactivate-selected':
+ if ( empty( $_REQUEST['checked'] ) ) {
+ break;
+ }
+
+ $plugin_slugs = wp_unslash( $_REQUEST['checked'] );
+ break;
+ }
+
+ // phpcs:enable WordPress.Security.NonceVerification.Recommended
+ return $this->convert_plugins_to_paths( $plugin_slugs );
+ }
+
+ /**
+ * Given an array of plugin slugs or paths, this will convert them to absolute paths and filter
+ * out the plugins that are not directory plugins. Note that array keys will also be included
+ * if they are plugin paths!
+ *
+ * @param string[] $plugins Plugin paths or slugs to filter.
+ *
+ * @return string[]
+ */
+ private function convert_plugins_to_paths( $plugins ) {
+ if ( ! is_array( $plugins ) || empty( $plugins ) ) {
+ return array();
+ }
+
+ // We're going to look for plugins in the standard directories.
+ $path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
+
+ $plugin_paths = array();
+ foreach ( $plugins as $key => $value ) {
+ $path = $this->path_processor->find_directory_with_autoloader( $key, $path_constants );
+ if ( $path ) {
+ $plugin_paths[] = $path;
+ }
+
+ $path = $this->path_processor->find_directory_with_autoloader( $value, $path_constants );
+ if ( $path ) {
+ $plugin_paths[] = $path;
+ }
+ }
+
+ return $plugin_paths;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php b/vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php
new file mode 100644
index 00000000000..dd00ac12192
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php
@@ -0,0 +1,156 @@
+plugin_locator = $plugin_locator;
+ $this->path_processor = $path_processor;
+ }
+
+ /**
+ * Gets all of the active plugins we can find.
+ *
+ * @param bool $include_deactivating When true, plugins deactivating this request will be considered active.
+ * @param bool $record_unknown When true, the current plugin will be marked as active and recorded when unknown.
+ *
+ * @return string[]
+ */
+ public function get_active_plugins( $include_deactivating, $record_unknown ) {
+ global $jetpack_autoloader_activating_plugins_paths;
+
+ // We're going to build a unique list of plugins from a few different sources
+ // to find all of our "active" plugins. While we need to return an integer
+ // array, we're going to use an associative array internally to reduce
+ // the amount of time that we're going to spend checking uniqueness
+ // and merging different arrays together to form the output.
+ $active_plugins = array();
+
+ // Make sure that plugins which have activated this request are considered as "active" even though
+ // they probably won't be present in any option.
+ if ( is_array( $jetpack_autoloader_activating_plugins_paths ) ) {
+ foreach ( $jetpack_autoloader_activating_plugins_paths as $path ) {
+ $active_plugins[ $path ] = $path;
+ }
+ }
+
+ // This option contains all of the plugins that have been activated.
+ $plugins = $this->plugin_locator->find_using_option( 'active_plugins' );
+ foreach ( $plugins as $path ) {
+ $active_plugins[ $path ] = $path;
+ }
+
+ // This option contains all of the multisite plugins that have been activated.
+ if ( is_multisite() ) {
+ $plugins = $this->plugin_locator->find_using_option( 'active_sitewide_plugins', true );
+ foreach ( $plugins as $path ) {
+ $active_plugins[ $path ] = $path;
+ }
+ }
+
+ // These actions contain plugins that are being activated/deactivated during this request.
+ $plugins = $this->plugin_locator->find_using_request_action( array( 'activate', 'activate-selected', 'deactivate', 'deactivate-selected' ) );
+ foreach ( $plugins as $path ) {
+ $active_plugins[ $path ] = $path;
+ }
+
+ // When the current plugin isn't considered "active" there's a problem.
+ // Since we're here, the plugin is active and currently being loaded.
+ // We can support this case (mu-plugins and non-standard activation)
+ // by adding the current plugin to the active list and marking it
+ // as an unknown (activating) plugin. This also has the benefit
+ // of causing a reset because the active plugins list has
+ // been changed since it was saved in the global.
+ $current_plugin = $this->plugin_locator->find_current_plugin();
+ if ( $record_unknown && ! in_array( $current_plugin, $active_plugins, true ) ) {
+ $active_plugins[ $current_plugin ] = $current_plugin;
+ $jetpack_autoloader_activating_plugins_paths[] = $current_plugin;
+ }
+
+ // When deactivating plugins aren't desired we should entirely remove them from the active list.
+ if ( ! $include_deactivating ) {
+ // These actions contain plugins that are being deactivated during this request.
+ $plugins = $this->plugin_locator->find_using_request_action( array( 'deactivate', 'deactivate-selected' ) );
+ foreach ( $plugins as $path ) {
+ unset( $active_plugins[ $path ] );
+ }
+ }
+
+ // Transform the array so that we don't have to worry about the keys interacting with other array types later.
+ return array_values( $active_plugins );
+ }
+
+ /**
+ * Gets all of the cached plugins if there are any.
+ *
+ * @return string[]
+ */
+ public function get_cached_plugins() {
+ $cached = get_transient( self::TRANSIENT_KEY );
+ if ( ! is_array( $cached ) || empty( $cached ) ) {
+ return array();
+ }
+
+ // We need to expand the tokens to an absolute path for this webserver.
+ return array_map( array( $this->path_processor, 'untokenize_path_constants' ), $cached );
+ }
+
+ /**
+ * Saves the plugin list to the cache.
+ *
+ * @param array $plugins The plugin list to save to the cache.
+ */
+ public function cache_plugins( $plugins ) {
+ // We store the paths in a tokenized form so that that webservers with different absolute paths don't break.
+ $plugins = array_map( array( $this->path_processor, 'tokenize_path_constants' ), $plugins );
+
+ set_transient( self::TRANSIENT_KEY, $plugins );
+ }
+
+ /**
+ * Checks to see whether or not the plugin list given has changed when compared to the
+ * shared `$jetpack_autoloader_cached_plugin_paths` global. This allows us to deal
+ * with cases where the active list may change due to filtering..
+ *
+ * @param string[] $plugins The plugins list to check against the global cache.
+ *
+ * @return bool True if the plugins have changed, otherwise false.
+ */
+ public function have_plugins_changed( $plugins ) {
+ global $jetpack_autoloader_cached_plugin_paths;
+
+ if ( $jetpack_autoloader_cached_plugin_paths !== $plugins ) {
+ $jetpack_autoloader_cached_plugin_paths = $plugins;
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-version-loader.php b/vendor/automattic/jetpack-autoloader/src/class-version-loader.php
new file mode 100644
index 00000000000..a1169ced924
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-version-loader.php
@@ -0,0 +1,156 @@
+version_selector = $version_selector;
+ $this->classmap = $classmap;
+ $this->psr4_map = $psr4_map;
+ $this->filemap = $filemap;
+ }
+
+ /**
+ * Finds the file path for the given class.
+ *
+ * @param string $class_name The class to find.
+ *
+ * @return string|null $file_path The path to the file if found, null if no class was found.
+ */
+ public function find_class_file( $class_name ) {
+ $data = $this->select_newest_file(
+ isset( $this->classmap[ $class_name ] ) ? $this->classmap[ $class_name ] : null,
+ $this->find_psr4_file( $class_name )
+ );
+ if ( ! isset( $data ) ) {
+ return null;
+ }
+
+ return $data['path'];
+ }
+
+ /**
+ * Load all of the files in the filemap.
+ */
+ public function load_filemap() {
+ if ( empty( $this->filemap ) ) {
+ return;
+ }
+
+ foreach ( $this->filemap as $file_identifier => $file_data ) {
+ if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
+ require_once $file_data['path'];
+
+ $GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
+ }
+ }
+ }
+
+ /**
+ * Compares different class sources and returns the newest.
+ *
+ * @param array|null $classmap_data The classmap class data.
+ * @param array|null $psr4_data The PSR-4 class data.
+ *
+ * @return array|null $data
+ */
+ private function select_newest_file( $classmap_data, $psr4_data ) {
+ if ( ! isset( $classmap_data ) ) {
+ return $psr4_data;
+ } elseif ( ! isset( $psr4_data ) ) {
+ return $classmap_data;
+ }
+
+ if ( $this->version_selector->is_version_update_required( $classmap_data['version'], $psr4_data['version'] ) ) {
+ return $psr4_data;
+ }
+
+ return $classmap_data;
+ }
+
+ /**
+ * Finds the file for a given class in a PSR-4 namespace.
+ *
+ * @param string $class_name The class to find.
+ *
+ * @return array|null $data The version and path path to the file if found, null otherwise.
+ */
+ private function find_psr4_file( $class_name ) {
+ if ( ! isset( $this->psr4_map ) ) {
+ return null;
+ }
+
+ // Don't bother with classes that have no namespace.
+ $class_index = strrpos( $class_name, '\\' );
+ if ( ! $class_index ) {
+ return null;
+ }
+ $class_for_path = str_replace( '\\', '/', $class_name );
+
+ // Search for the namespace by iteratively cutting off the last segment until
+ // we find a match. This allows us to check the most-specific namespaces
+ // first as well as minimize the amount of time spent looking.
+ for (
+ $class_namespace = substr( $class_name, 0, $class_index );
+ ! empty( $class_namespace );
+ $class_namespace = substr( $class_namespace, 0, strrpos( $class_namespace, '\\' ) )
+ ) {
+ $namespace = $class_namespace . '\\';
+ if ( ! isset( $this->psr4_map[ $namespace ] ) ) {
+ continue;
+ }
+ $data = $this->psr4_map[ $namespace ];
+
+ foreach ( $data['path'] as $path ) {
+ $path .= '/' . substr( $class_for_path, strlen( $namespace ) ) . '.php';
+ if ( file_exists( $path ) ) {
+ return array(
+ 'version' => $data['version'],
+ 'path' => $path,
+ );
+ }
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/vendor/automattic/jetpack-autoloader/src/class-version-selector.php b/vendor/automattic/jetpack-autoloader/src/class-version-selector.php
new file mode 100644
index 00000000000..dc8466756a7
--- /dev/null
+++ b/vendor/automattic/jetpack-autoloader/src/class-version-selector.php
@@ -0,0 +1,61 @@
+is_dev_version( $selected_version ) ) {
+ return false;
+ }
+
+ if ( $this->is_dev_version( $compare_version ) ) {
+ if ( $use_dev_versions ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ if ( version_compare( $selected_version, $compare_version, '<' ) ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks whether the given package version is a development version.
+ *
+ * @param String $version The package version.
+ *
+ * @return bool True if the version is a dev version, else false.
+ */
+ public function is_dev_version( $version ) {
+ if ( 'dev-' === substr( $version, 0, 4 ) || '9999999-dev' === $version ) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
new file mode 100644
index 00000000000..247294d66ee
--- /dev/null
+++ b/vendor/composer/ClassLoader.php
@@ -0,0 +1,479 @@
+
+ * Jordi Boggiano
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Composer\Autoload;
+
+/**
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
+ *
+ * $loader = new \Composer\Autoload\ClassLoader();
+ *
+ * // register classes with namespaces
+ * $loader->add('Symfony\Component', __DIR__.'/component');
+ * $loader->add('Symfony', __DIR__.'/framework');
+ *
+ * // activate the autoloader
+ * $loader->register();
+ *
+ * // to enable searching the include path (eg. for PEAR packages)
+ * $loader->setUseIncludePath(true);
+ *
+ * In this example, if you try to use a class in the Symfony\Component
+ * namespace or one of its children (Symfony\Component\Console for instance),
+ * the autoloader will first look for the class under the component/
+ * directory, and it will then fallback to the framework/ directory if not
+ * found before giving up.
+ *
+ * This class is loosely based on the Symfony UniversalClassLoader.
+ *
+ * @author Fabien Potencier
+ * @author Jordi Boggiano
+ * @see https://www.php-fig.org/psr/psr-0/
+ * @see https://www.php-fig.org/psr/psr-4/
+ */
+class ClassLoader
+{
+ private $vendorDir;
+
+ // PSR-4
+ private $prefixLengthsPsr4 = array();
+ private $prefixDirsPsr4 = array();
+ private $fallbackDirsPsr4 = array();
+
+ // PSR-0
+ private $prefixesPsr0 = array();
+ private $fallbackDirsPsr0 = array();
+
+ private $useIncludePath = false;
+ private $classMap = array();
+ private $classMapAuthoritative = false;
+ private $missingClasses = array();
+ private $apcuPrefix;
+
+ private static $registeredLoaders = array();
+
+ public function __construct($vendorDir = null)
+ {
+ $this->vendorDir = $vendorDir;
+ }
+
+ public function getPrefixes()
+ {
+ if (!empty($this->prefixesPsr0)) {
+ return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
+ }
+
+ return array();
+ }
+
+ public function getPrefixesPsr4()
+ {
+ return $this->prefixDirsPsr4;
+ }
+
+ public function getFallbackDirs()
+ {
+ return $this->fallbackDirsPsr0;
+ }
+
+ public function getFallbackDirsPsr4()
+ {
+ return $this->fallbackDirsPsr4;
+ }
+
+ public function getClassMap()
+ {
+ return $this->classMap;
+ }
+
+ /**
+ * @param array $classMap Class to filename map
+ */
+ public function addClassMap(array $classMap)
+ {
+ if ($this->classMap) {
+ $this->classMap = array_merge($this->classMap, $classMap);
+ } else {
+ $this->classMap = $classMap;
+ }
+ }
+
+ /**
+ * Registers a set of PSR-0 directories for a given prefix, either
+ * appending or prepending to the ones previously set for this prefix.
+ *
+ * @param string $prefix The prefix
+ * @param array|string $paths The PSR-0 root directories
+ * @param bool $prepend Whether to prepend the directories
+ */
+ public function add($prefix, $paths, $prepend = false)
+ {
+ if (!$prefix) {
+ if ($prepend) {
+ $this->fallbackDirsPsr0 = array_merge(
+ (array) $paths,
+ $this->fallbackDirsPsr0
+ );
+ } else {
+ $this->fallbackDirsPsr0 = array_merge(
+ $this->fallbackDirsPsr0,
+ (array) $paths
+ );
+ }
+
+ return;
+ }
+
+ $first = $prefix[0];
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
+
+ return;
+ }
+ if ($prepend) {
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
+ (array) $paths,
+ $this->prefixesPsr0[$first][$prefix]
+ );
+ } else {
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
+ $this->prefixesPsr0[$first][$prefix],
+ (array) $paths
+ );
+ }
+ }
+
+ /**
+ * Registers a set of PSR-4 directories for a given namespace, either
+ * appending or prepending to the ones previously set for this namespace.
+ *
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param array|string $paths The PSR-4 base directories
+ * @param bool $prepend Whether to prepend the directories
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function addPsr4($prefix, $paths, $prepend = false)
+ {
+ if (!$prefix) {
+ // Register directories for the root namespace.
+ if ($prepend) {
+ $this->fallbackDirsPsr4 = array_merge(
+ (array) $paths,
+ $this->fallbackDirsPsr4
+ );
+ } else {
+ $this->fallbackDirsPsr4 = array_merge(
+ $this->fallbackDirsPsr4,
+ (array) $paths
+ );
+ }
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
+ // Register directories for a new namespace.
+ $length = strlen($prefix);
+ if ('\\' !== $prefix[$length - 1]) {
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+ }
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
+ } elseif ($prepend) {
+ // Prepend directories for an already registered namespace.
+ $this->prefixDirsPsr4[$prefix] = array_merge(
+ (array) $paths,
+ $this->prefixDirsPsr4[$prefix]
+ );
+ } else {
+ // Append directories for an already registered namespace.
+ $this->prefixDirsPsr4[$prefix] = array_merge(
+ $this->prefixDirsPsr4[$prefix],
+ (array) $paths
+ );
+ }
+ }
+
+ /**
+ * Registers a set of PSR-0 directories for a given prefix,
+ * replacing any others previously set for this prefix.
+ *
+ * @param string $prefix The prefix
+ * @param array|string $paths The PSR-0 base directories
+ */
+ public function set($prefix, $paths)
+ {
+ if (!$prefix) {
+ $this->fallbackDirsPsr0 = (array) $paths;
+ } else {
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
+ }
+ }
+
+ /**
+ * Registers a set of PSR-4 directories for a given namespace,
+ * replacing any others previously set for this namespace.
+ *
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param array|string $paths The PSR-4 base directories
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function setPsr4($prefix, $paths)
+ {
+ if (!$prefix) {
+ $this->fallbackDirsPsr4 = (array) $paths;
+ } else {
+ $length = strlen($prefix);
+ if ('\\' !== $prefix[$length - 1]) {
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+ }
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
+ }
+ }
+
+ /**
+ * Turns on searching the include path for class files.
+ *
+ * @param bool $useIncludePath
+ */
+ public function setUseIncludePath($useIncludePath)
+ {
+ $this->useIncludePath = $useIncludePath;
+ }
+
+ /**
+ * Can be used to check if the autoloader uses the include path to check
+ * for classes.
+ *
+ * @return bool
+ */
+ public function getUseIncludePath()
+ {
+ return $this->useIncludePath;
+ }
+
+ /**
+ * Turns off searching the prefix and fallback directories for classes
+ * that have not been registered with the class map.
+ *
+ * @param bool $classMapAuthoritative
+ */
+ public function setClassMapAuthoritative($classMapAuthoritative)
+ {
+ $this->classMapAuthoritative = $classMapAuthoritative;
+ }
+
+ /**
+ * Should class lookup fail if not found in the current class map?
+ *
+ * @return bool
+ */
+ public function isClassMapAuthoritative()
+ {
+ return $this->classMapAuthoritative;
+ }
+
+ /**
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
+ *
+ * @param string|null $apcuPrefix
+ */
+ public function setApcuPrefix($apcuPrefix)
+ {
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
+ }
+
+ /**
+ * The APCu prefix in use, or null if APCu caching is not enabled.
+ *
+ * @return string|null
+ */
+ public function getApcuPrefix()
+ {
+ return $this->apcuPrefix;
+ }
+
+ /**
+ * Registers this instance as an autoloader.
+ *
+ * @param bool $prepend Whether to prepend the autoloader or not
+ */
+ public function register($prepend = false)
+ {
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+
+ if (null === $this->vendorDir) {
+ return;
+ }
+
+ if ($prepend) {
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
+ } else {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ self::$registeredLoaders[$this->vendorDir] = $this;
+ }
+ }
+
+ /**
+ * Unregisters this instance as an autoloader.
+ */
+ public function unregister()
+ {
+ spl_autoload_unregister(array($this, 'loadClass'));
+
+ if (null !== $this->vendorDir) {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ }
+ }
+
+ /**
+ * Loads the given class or interface.
+ *
+ * @param string $class The name of the class
+ * @return bool|null True if loaded, null otherwise
+ */
+ public function loadClass($class)
+ {
+ if ($file = $this->findFile($class)) {
+ includeFile($file);
+
+ return true;
+ }
+ }
+
+ /**
+ * Finds the path to the file where the class is defined.
+ *
+ * @param string $class The name of the class
+ *
+ * @return string|false The path if found, false otherwise
+ */
+ public function findFile($class)
+ {
+ // class map lookup
+ if (isset($this->classMap[$class])) {
+ return $this->classMap[$class];
+ }
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
+ return false;
+ }
+ if (null !== $this->apcuPrefix) {
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
+ if ($hit) {
+ return $file;
+ }
+ }
+
+ $file = $this->findFileWithExtension($class, '.php');
+
+ // Search for Hack files if we are running on HHVM
+ if (false === $file && defined('HHVM_VERSION')) {
+ $file = $this->findFileWithExtension($class, '.hh');
+ }
+
+ if (null !== $this->apcuPrefix) {
+ apcu_add($this->apcuPrefix.$class, $file);
+ }
+
+ if (false === $file) {
+ // Remember that this class does not exist.
+ $this->missingClasses[$class] = true;
+ }
+
+ return $file;
+ }
+
+ /**
+ * Returns the currently registered loaders indexed by their corresponding vendor directories.
+ *
+ * @return self[]
+ */
+ public static function getRegisteredLoaders()
+ {
+ return self::$registeredLoaders;
+ }
+
+ private function findFileWithExtension($class, $ext)
+ {
+ // PSR-4 lookup
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
+
+ $first = $class[0];
+ if (isset($this->prefixLengthsPsr4[$first])) {
+ $subPath = $class;
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
+ $subPath = substr($subPath, 0, $lastPos);
+ $search = $subPath . '\\';
+ if (isset($this->prefixDirsPsr4[$search])) {
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
+ foreach ($this->prefixDirsPsr4[$search] as $dir) {
+ if (file_exists($file = $dir . $pathEnd)) {
+ return $file;
+ }
+ }
+ }
+ }
+ }
+
+ // PSR-4 fallback dirs
+ foreach ($this->fallbackDirsPsr4 as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
+ return $file;
+ }
+ }
+
+ // PSR-0 lookup
+ if (false !== $pos = strrpos($class, '\\')) {
+ // namespaced class name
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
+ } else {
+ // PEAR-like class name
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
+ }
+
+ if (isset($this->prefixesPsr0[$first])) {
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
+ if (0 === strpos($class, $prefix)) {
+ foreach ($dirs as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+ return $file;
+ }
+ }
+ }
+ }
+ }
+
+ // PSR-0 fallback dirs
+ foreach ($this->fallbackDirsPsr0 as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+ return $file;
+ }
+ }
+
+ // PSR-0 include paths.
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
+ return $file;
+ }
+
+ return false;
+ }
+}
+
+/**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ */
+function includeFile($file)
+{
+ include $file;
+}
diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php
new file mode 100644
index 00000000000..e1ddfebc157
--- /dev/null
+++ b/vendor/composer/InstalledVersions.php
@@ -0,0 +1,315 @@
+
+ array (
+ 'pretty_version' => 'dev-trunk',
+ 'version' => 'dev-trunk',
+ 'aliases' =>
+ array (
+ ),
+ 'reference' => 'a074162193ff8cf2dde019272e070963db4acd83',
+ 'name' => 'woocommerce/woocommerce-blocks',
+ ),
+ 'versions' =>
+ array (
+ 'automattic/jetpack-autoloader' =>
+ array (
+ 'pretty_version' => 'v2.9.1',
+ 'version' => '2.9.1.0',
+ 'aliases' =>
+ array (
+ ),
+ 'reference' => 'd6ca2cc26ad6963e1be19b3338a9e98f40d9bd88',
+ ),
+ 'composer/installers' =>
+ array (
+ 'pretty_version' => 'v1.10.0',
+ 'version' => '1.10.0.0',
+ 'aliases' =>
+ array (
+ ),
+ 'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d',
+ ),
+ 'roundcube/plugin-installer' =>
+ array (
+ 'replaced' =>
+ array (
+ 0 => '*',
+ ),
+ ),
+ 'shama/baton' =>
+ array (
+ 'replaced' =>
+ array (
+ 0 => '*',
+ ),
+ ),
+ 'woocommerce/woocommerce-blocks' =>
+ array (
+ 'pretty_version' => 'dev-trunk',
+ 'version' => 'dev-trunk',
+ 'aliases' =>
+ array (
+ ),
+ 'reference' => 'a074162193ff8cf2dde019272e070963db4acd83',
+ ),
+ ),
+);
+private static $canGetVendors;
+private static $installedByVendor = array();
+
+
+
+
+
+
+
+public static function getInstalledPackages()
+{
+$packages = array();
+foreach (self::getInstalled() as $installed) {
+$packages[] = array_keys($installed['versions']);
+}
+
+
+if (1 === \count($packages)) {
+return $packages[0];
+}
+
+return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
+}
+
+
+
+
+
+
+
+
+
+public static function isInstalled($packageName)
+{
+foreach (self::getInstalled() as $installed) {
+if (isset($installed['versions'][$packageName])) {
+return true;
+}
+}
+
+return false;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+public static function satisfies(VersionParser $parser, $packageName, $constraint)
+{
+$constraint = $parser->parseConstraints($constraint);
+$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
+
+return $provided->matches($constraint);
+}
+
+
+
+
+
+
+
+
+
+
+public static function getVersionRanges($packageName)
+{
+foreach (self::getInstalled() as $installed) {
+if (!isset($installed['versions'][$packageName])) {
+continue;
+}
+
+$ranges = array();
+if (isset($installed['versions'][$packageName]['pretty_version'])) {
+$ranges[] = $installed['versions'][$packageName]['pretty_version'];
+}
+if (array_key_exists('aliases', $installed['versions'][$packageName])) {
+$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
+}
+if (array_key_exists('replaced', $installed['versions'][$packageName])) {
+$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
+}
+if (array_key_exists('provided', $installed['versions'][$packageName])) {
+$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
+}
+
+return implode(' || ', $ranges);
+}
+
+throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+}
+
+
+
+
+
+public static function getVersion($packageName)
+{
+foreach (self::getInstalled() as $installed) {
+if (!isset($installed['versions'][$packageName])) {
+continue;
+}
+
+if (!isset($installed['versions'][$packageName]['version'])) {
+return null;
+}
+
+return $installed['versions'][$packageName]['version'];
+}
+
+throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+}
+
+
+
+
+
+public static function getPrettyVersion($packageName)
+{
+foreach (self::getInstalled() as $installed) {
+if (!isset($installed['versions'][$packageName])) {
+continue;
+}
+
+if (!isset($installed['versions'][$packageName]['pretty_version'])) {
+return null;
+}
+
+return $installed['versions'][$packageName]['pretty_version'];
+}
+
+throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+}
+
+
+
+
+
+public static function getReference($packageName)
+{
+foreach (self::getInstalled() as $installed) {
+if (!isset($installed['versions'][$packageName])) {
+continue;
+}
+
+if (!isset($installed['versions'][$packageName]['reference'])) {
+return null;
+}
+
+return $installed['versions'][$packageName]['reference'];
+}
+
+throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+}
+
+
+
+
+
+public static function getRootPackage()
+{
+$installed = self::getInstalled();
+
+return $installed[0]['root'];
+}
+
+
+
+
+
+
+
+public static function getRawData()
+{
+return self::$installed;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+public static function reload($data)
+{
+self::$installed = $data;
+self::$installedByVendor = array();
+}
+
+
+
+
+private static function getInstalled()
+{
+if (null === self::$canGetVendors) {
+self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
+}
+
+$installed = array();
+
+if (self::$canGetVendors) {
+foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
+if (isset(self::$installedByVendor[$vendorDir])) {
+$installed[] = self::$installedByVendor[$vendorDir];
+} elseif (is_file($vendorDir.'/composer/installed.php')) {
+$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
+}
+}
+}
+
+$installed[] = self::$installed;
+
+return $installed;
+}
+}
diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE
new file mode 100644
index 00000000000..f27399a042d
--- /dev/null
+++ b/vendor/composer/LICENSE
@@ -0,0 +1,21 @@
+
+Copyright (c) Nils Adermann, Jordi Boggiano
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
new file mode 100644
index 00000000000..e63ebab3fc3
--- /dev/null
+++ b/vendor/composer/autoload_classmap.php
@@ -0,0 +1,11 @@
+ $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php',
+ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
+);
diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php
new file mode 100644
index 00000000000..b7fc0125dbc
--- /dev/null
+++ b/vendor/composer/autoload_namespaces.php
@@ -0,0 +1,9 @@
+ array($vendorDir . '/composer/installers/src/Composer/Installers'),
+ 'Automattic\\WooCommerce\\Blocks\\' => array($baseDir . '/src'),
+ 'Automattic\\Jetpack\\Autoloader\\' => array($vendorDir . '/automattic/jetpack-autoloader/src'),
+);
diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php
new file mode 100644
index 00000000000..e15745d2186
--- /dev/null
+++ b/vendor/composer/autoload_real.php
@@ -0,0 +1,55 @@
+= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
+ if ($useStaticLoader) {
+ require __DIR__ . '/autoload_static.php';
+
+ call_user_func(\Composer\Autoload\ComposerStaticInitdc626e89ccc8fca6cd6fabe222c1ad17::getInitializer($loader));
+ } else {
+ $map = require __DIR__ . '/autoload_namespaces.php';
+ foreach ($map as $namespace => $path) {
+ $loader->set($namespace, $path);
+ }
+
+ $map = require __DIR__ . '/autoload_psr4.php';
+ foreach ($map as $namespace => $path) {
+ $loader->setPsr4($namespace, $path);
+ }
+
+ $classMap = require __DIR__ . '/autoload_classmap.php';
+ if ($classMap) {
+ $loader->addClassMap($classMap);
+ }
+ }
+
+ $loader->register(true);
+
+ return $loader;
+ }
+}
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
new file mode 100644
index 00000000000..7a73909b8cb
--- /dev/null
+++ b/vendor/composer/autoload_static.php
@@ -0,0 +1,50 @@
+
+ array (
+ 'Composer\\Installers\\' => 20,
+ ),
+ 'A' =>
+ array (
+ 'Automattic\\WooCommerce\\Blocks\\' => 30,
+ 'Automattic\\Jetpack\\Autoloader\\' => 30,
+ ),
+ );
+
+ public static $prefixDirsPsr4 = array (
+ 'Composer\\Installers\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
+ ),
+ 'Automattic\\WooCommerce\\Blocks\\' =>
+ array (
+ 0 => __DIR__ . '/../..' . '/src',
+ ),
+ 'Automattic\\Jetpack\\Autoloader\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src',
+ ),
+ );
+
+ public static $classMap = array (
+ 'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php',
+ 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
+ );
+
+ public static function getInitializer(ClassLoader $loader)
+ {
+ return \Closure::bind(function () use ($loader) {
+ $loader->prefixLengthsPsr4 = ComposerStaticInitdc626e89ccc8fca6cd6fabe222c1ad17::$prefixLengthsPsr4;
+ $loader->prefixDirsPsr4 = ComposerStaticInitdc626e89ccc8fca6cd6fabe222c1ad17::$prefixDirsPsr4;
+ $loader->classMap = ComposerStaticInitdc626e89ccc8fca6cd6fabe222c1ad17::$classMap;
+
+ }, null, ClassLoader::class);
+ }
+}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
new file mode 100644
index 00000000000..abc945a3e2f
--- /dev/null
+++ b/vendor/composer/installed.json
@@ -0,0 +1,203 @@
+{
+ "packages": [
+ {
+ "name": "automattic/jetpack-autoloader",
+ "version": "v2.9.1",
+ "version_normalized": "2.9.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Automattic/jetpack-autoloader.git",
+ "reference": "d6ca2cc26ad6963e1be19b3338a9e98f40d9bd88"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/d6ca2cc26ad6963e1be19b3338a9e98f40d9bd88",
+ "reference": "d6ca2cc26ad6963e1be19b3338a9e98f40d9bd88",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^1.1 || ^2.0"
+ },
+ "require-dev": {
+ "yoast/phpunit-polyfills": "0.2.0"
+ },
+ "time": "2021-02-05T19:07:06+00:00",
+ "type": "composer-plugin",
+ "extra": {
+ "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin",
+ "mirror-repo": "Automattic/jetpack-autoloader"
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "classmap": [
+ "src/AutoloadGenerator.php"
+ ],
+ "psr-4": {
+ "Automattic\\Jetpack\\Autoloader\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0-or-later"
+ ],
+ "description": "Creates a custom autoloader for a plugin or theme.",
+ "support": {
+ "source": "https://github.com/Automattic/jetpack-autoloader/tree/v2.9.1"
+ },
+ "install-path": "../automattic/jetpack-autoloader"
+ },
+ {
+ "name": "composer/installers",
+ "version": "v1.10.0",
+ "version_normalized": "1.10.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/installers.git",
+ "reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/installers/zipball/1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d",
+ "reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^1.0 || ^2.0"
+ },
+ "replace": {
+ "roundcube/plugin-installer": "*",
+ "shama/baton": "*"
+ },
+ "require-dev": {
+ "composer/composer": "1.6.* || ^2.0",
+ "composer/semver": "^1 || ^3",
+ "phpstan/phpstan": "^0.12.55",
+ "phpstan/phpstan-phpunit": "^0.12.16",
+ "symfony/phpunit-bridge": "^4.2 || ^5",
+ "symfony/process": "^2.3"
+ },
+ "time": "2021-01-14T11:07:16+00:00",
+ "type": "composer-plugin",
+ "extra": {
+ "class": "Composer\\Installers\\Plugin",
+ "branch-alias": {
+ "dev-main": "1.x-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Composer\\Installers\\": "src/Composer/Installers"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Kyle Robinson Young",
+ "email": "kyle@dontkry.com",
+ "homepage": "https://github.com/shama"
+ }
+ ],
+ "description": "A multi-framework Composer library installer",
+ "homepage": "https://composer.github.io/installers/",
+ "keywords": [
+ "Craft",
+ "Dolibarr",
+ "Eliasis",
+ "Hurad",
+ "ImageCMS",
+ "Kanboard",
+ "Lan Management System",
+ "MODX Evo",
+ "MantisBT",
+ "Mautic",
+ "Maya",
+ "OXID",
+ "Plentymarkets",
+ "Porto",
+ "RadPHP",
+ "SMF",
+ "Starbug",
+ "Thelia",
+ "Whmcs",
+ "WolfCMS",
+ "agl",
+ "aimeos",
+ "annotatecms",
+ "attogram",
+ "bitrix",
+ "cakephp",
+ "chef",
+ "cockpit",
+ "codeigniter",
+ "concrete5",
+ "croogo",
+ "dokuwiki",
+ "drupal",
+ "eZ Platform",
+ "elgg",
+ "expressionengine",
+ "fuelphp",
+ "grav",
+ "installer",
+ "itop",
+ "joomla",
+ "known",
+ "kohana",
+ "laravel",
+ "lavalite",
+ "lithium",
+ "magento",
+ "majima",
+ "mako",
+ "mediawiki",
+ "modulework",
+ "modx",
+ "moodle",
+ "osclass",
+ "phpbb",
+ "piwik",
+ "ppi",
+ "processwire",
+ "puppet",
+ "pxcms",
+ "reindex",
+ "roundcube",
+ "shopware",
+ "silverstripe",
+ "sydes",
+ "sylius",
+ "symfony",
+ "typo3",
+ "wordpress",
+ "yawik",
+ "zend",
+ "zikula"
+ ],
+ "support": {
+ "issues": "https://github.com/composer/installers/issues",
+ "source": "https://github.com/composer/installers/tree/v1.10.0"
+ },
+ "funding": [
+ {
+ "url": "https://packagist.com",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/composer",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/composer/composer",
+ "type": "tidelift"
+ }
+ ],
+ "install-path": "./installers"
+ }
+ ],
+ "dev": false,
+ "dev-package-names": []
+}
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
new file mode 100644
index 00000000000..347d51c8678
--- /dev/null
+++ b/vendor/composer/installed.php
@@ -0,0 +1,56 @@
+
+ array (
+ 'pretty_version' => 'dev-trunk',
+ 'version' => 'dev-trunk',
+ 'aliases' =>
+ array (
+ ),
+ 'reference' => 'a074162193ff8cf2dde019272e070963db4acd83',
+ 'name' => 'woocommerce/woocommerce-blocks',
+ ),
+ 'versions' =>
+ array (
+ 'automattic/jetpack-autoloader' =>
+ array (
+ 'pretty_version' => 'v2.9.1',
+ 'version' => '2.9.1.0',
+ 'aliases' =>
+ array (
+ ),
+ 'reference' => 'd6ca2cc26ad6963e1be19b3338a9e98f40d9bd88',
+ ),
+ 'composer/installers' =>
+ array (
+ 'pretty_version' => 'v1.10.0',
+ 'version' => '1.10.0.0',
+ 'aliases' =>
+ array (
+ ),
+ 'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d',
+ ),
+ 'roundcube/plugin-installer' =>
+ array (
+ 'replaced' =>
+ array (
+ 0 => '*',
+ ),
+ ),
+ 'shama/baton' =>
+ array (
+ 'replaced' =>
+ array (
+ 0 => '*',
+ ),
+ ),
+ 'woocommerce/woocommerce-blocks' =>
+ array (
+ 'pretty_version' => 'dev-trunk',
+ 'version' => 'dev-trunk',
+ 'aliases' =>
+ array (
+ ),
+ 'reference' => 'a074162193ff8cf2dde019272e070963db4acd83',
+ ),
+ ),
+);
diff --git a/vendor/composer/installers/.github/workflows/continuous-integration.yml b/vendor/composer/installers/.github/workflows/continuous-integration.yml
new file mode 100644
index 00000000000..840e44826ed
--- /dev/null
+++ b/vendor/composer/installers/.github/workflows/continuous-integration.yml
@@ -0,0 +1,70 @@
+name: "Continuous Integration"
+
+on:
+ - push
+ - pull_request
+
+env:
+ COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
+ SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
+
+jobs:
+ tests:
+ name: "CI"
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ php-version:
+ - "5.3"
+ - "5.4"
+ - "5.5"
+ - "5.6"
+ - "7.0"
+ - "7.1"
+ - "7.2"
+ - "7.3"
+ - "7.4"
+ - "8.0"
+ - "8.1"
+ dependencies: [locked]
+ include:
+ - php-version: "5.3"
+ dependencies: lowest
+ - php-version: "8.1"
+ dependencies: lowest
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Install PHP"
+ uses: "shivammathur/setup-php@v2"
+ with:
+ coverage: "none"
+ php-version: "${{ matrix.php-version }}"
+
+ - name: Get composer cache directory
+ id: composercache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composercache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: "Handle lowest dependencies update"
+ if: "contains(matrix.dependencies, 'lowest')"
+ run: "echo \"COMPOSER_FLAGS=$COMPOSER_FLAGS --prefer-lowest\" >> $GITHUB_ENV"
+
+ - name: "Install latest dependencies"
+ run: |
+ # Remove PHPStan as it requires a newer PHP
+ composer remove phpstan/phpstan phpstan/phpstan-phpunit --dev --no-update
+ composer update ${{ env.COMPOSER_FLAGS }}
+
+ - name: "Run tests"
+ run: "vendor/bin/simple-phpunit --verbose"
diff --git a/vendor/composer/installers/.github/workflows/lint.yml b/vendor/composer/installers/.github/workflows/lint.yml
new file mode 100644
index 00000000000..81a1ac4d4bc
--- /dev/null
+++ b/vendor/composer/installers/.github/workflows/lint.yml
@@ -0,0 +1,30 @@
+name: "PHP Lint"
+
+on:
+ - push
+ - pull_request
+
+jobs:
+ tests:
+ name: "Lint"
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ php-version:
+ - "5.3"
+ - "8.0"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Install PHP"
+ uses: "shivammathur/setup-php@v2"
+ with:
+ coverage: "none"
+ php-version: "${{ matrix.php-version }}"
+
+ - name: "Lint PHP files"
+ run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"
diff --git a/vendor/composer/installers/.github/workflows/phpstan.yml b/vendor/composer/installers/.github/workflows/phpstan.yml
new file mode 100644
index 00000000000..ac4c4a92c4c
--- /dev/null
+++ b/vendor/composer/installers/.github/workflows/phpstan.yml
@@ -0,0 +1,51 @@
+name: "PHPStan"
+
+on:
+ - push
+ - pull_request
+
+env:
+ COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
+ SYMFONY_PHPUNIT_VERSION: ""
+
+jobs:
+ tests:
+ name: "PHPStan"
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ php-version:
+ # pinned to 7.4 because we need PHPUnit 7.5 which does not support PHP 8
+ - "7.4"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Install PHP"
+ uses: "shivammathur/setup-php@v2"
+ with:
+ coverage: "none"
+ php-version: "${{ matrix.php-version }}"
+
+ - name: Get composer cache directory
+ id: composercache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composercache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: "Install latest dependencies"
+ run: "composer update ${{ env.COMPOSER_FLAGS }}"
+
+ - name: Run PHPStan
+ # Locked to phpunit 7.5 here as newer ones have void return types which break inheritance
+ run: |
+ composer require --dev phpunit/phpunit:^7.5.20 --with-all-dependencies ${{ env.COMPOSER_FLAGS }}
+ vendor/bin/phpstan analyse
diff --git a/vendor/composer/installers/LICENSE b/vendor/composer/installers/LICENSE
new file mode 100644
index 00000000000..85f97fc7951
--- /dev/null
+++ b/vendor/composer/installers/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Kyle Robinson Young
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/vendor/composer/installers/composer.json b/vendor/composer/installers/composer.json
new file mode 100644
index 00000000000..61c0b7f45f2
--- /dev/null
+++ b/vendor/composer/installers/composer.json
@@ -0,0 +1,119 @@
+{
+ "name": "composer/installers",
+ "type": "composer-plugin",
+ "license": "MIT",
+ "description": "A multi-framework Composer library installer",
+ "keywords": [
+ "installer",
+ "Aimeos",
+ "AGL",
+ "AnnotateCms",
+ "Attogram",
+ "Bitrix",
+ "CakePHP",
+ "Chef",
+ "Cockpit",
+ "CodeIgniter",
+ "concrete5",
+ "Craft",
+ "Croogo",
+ "DokuWiki",
+ "Dolibarr",
+ "Drupal",
+ "Elgg",
+ "Eliasis",
+ "ExpressionEngine",
+ "eZ Platform",
+ "FuelPHP",
+ "Grav",
+ "Hurad",
+ "ImageCMS",
+ "iTop",
+ "Joomla",
+ "Kanboard",
+ "Known",
+ "Kohana",
+ "Lan Management System",
+ "Laravel",
+ "Lavalite",
+ "Lithium",
+ "Magento",
+ "majima",
+ "Mako",
+ "MantisBT",
+ "Mautic",
+ "Maya",
+ "MODX",
+ "MODX Evo",
+ "MediaWiki",
+ "OXID",
+ "osclass",
+ "MODULEWork",
+ "Moodle",
+ "Piwik",
+ "pxcms",
+ "phpBB",
+ "Plentymarkets",
+ "PPI",
+ "Puppet",
+ "Porto",
+ "ProcessWire",
+ "RadPHP",
+ "ReIndex",
+ "Roundcube",
+ "shopware",
+ "SilverStripe",
+ "SMF",
+ "Starbug",
+ "SyDES",
+ "Sylius",
+ "symfony",
+ "Thelia",
+ "TYPO3",
+ "WHMCS",
+ "WolfCMS",
+ "WordPress",
+ "YAWIK",
+ "Zend",
+ "Zikula"
+ ],
+ "homepage": "https://composer.github.io/installers/",
+ "authors": [
+ {
+ "name": "Kyle Robinson Young",
+ "email": "kyle@dontkry.com",
+ "homepage": "https://github.com/shama"
+ }
+ ],
+ "autoload": {
+ "psr-4": { "Composer\\Installers\\": "src/Composer/Installers" }
+ },
+ "autoload-dev": {
+ "psr-4": { "Composer\\Installers\\Test\\": "tests/Composer/Installers/Test" }
+ },
+ "extra": {
+ "class": "Composer\\Installers\\Plugin",
+ "branch-alias": {
+ "dev-main": "1.x-dev"
+ }
+ },
+ "replace": {
+ "shama/baton": "*",
+ "roundcube/plugin-installer": "*"
+ },
+ "require": {
+ "composer-plugin-api": "^1.0 || ^2.0"
+ },
+ "require-dev": {
+ "composer/composer": "1.6.* || ^2.0",
+ "composer/semver": "^1 || ^3",
+ "symfony/phpunit-bridge": "^4.2 || ^5",
+ "phpstan/phpstan": "^0.12.55",
+ "symfony/process": "^2.3",
+ "phpstan/phpstan-phpunit": "^0.12.16"
+ },
+ "scripts": {
+ "test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit",
+ "phpstan": "vendor/bin/phpstan analyse"
+ }
+}
diff --git a/vendor/composer/installers/phpstan.neon.dist b/vendor/composer/installers/phpstan.neon.dist
new file mode 100644
index 00000000000..8e3d81e9a19
--- /dev/null
+++ b/vendor/composer/installers/phpstan.neon.dist
@@ -0,0 +1,10 @@
+parameters:
+ level: 5
+ paths:
+ - src
+ - tests
+ excludes_analyse:
+ - tests/Composer/Installers/Test/PolyfillTestCase.php
+
+includes:
+ - vendor/phpstan/phpstan-phpunit/extension.neon
diff --git a/vendor/composer/installers/src/Composer/Installers/AglInstaller.php b/vendor/composer/installers/src/Composer/Installers/AglInstaller.php
new file mode 100644
index 00000000000..01b8a416592
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/AglInstaller.php
@@ -0,0 +1,21 @@
+ 'More/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) {
+ return strtoupper($matches[1]);
+ }, $vars['name']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php b/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php
new file mode 100644
index 00000000000..79a0e958fd4
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php
@@ -0,0 +1,9 @@
+ 'ext/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php b/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php
new file mode 100644
index 00000000000..89d7ad9057d
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php
@@ -0,0 +1,11 @@
+ 'addons/modules/{$name}/',
+ 'component' => 'addons/components/{$name}/',
+ 'service' => 'addons/services/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php b/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php
new file mode 100644
index 00000000000..22dad1b9a01
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php
@@ -0,0 +1,49 @@
+ 'Modules/{$name}/',
+ 'theme' => 'Themes/{$name}/'
+ );
+
+ /**
+ * Format package name.
+ *
+ * For package type asgard-module, cut off a trailing '-plugin' if present.
+ *
+ * For package type asgard-theme, cut off a trailing '-theme' if present.
+ *
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] === 'asgard-module') {
+ return $this->inflectPluginVars($vars);
+ }
+
+ if ($vars['type'] === 'asgard-theme') {
+ return $this->inflectThemeVars($vars);
+ }
+
+ return $vars;
+ }
+
+ protected function inflectPluginVars($vars)
+ {
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+
+ protected function inflectThemeVars($vars)
+ {
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php b/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php
new file mode 100644
index 00000000000..d62fd8fd1e1
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php
@@ -0,0 +1,9 @@
+ 'modules/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php b/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php
new file mode 100644
index 00000000000..70dde907ed3
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php
@@ -0,0 +1,137 @@
+composer = $composer;
+ $this->package = $package;
+ $this->io = $io;
+ }
+
+ /**
+ * Return the install path based on package type.
+ *
+ * @param PackageInterface $package
+ * @param string $frameworkType
+ * @return string
+ */
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
+ {
+ $type = $this->package->getType();
+
+ $prettyName = $this->package->getPrettyName();
+ if (strpos($prettyName, '/') !== false) {
+ list($vendor, $name) = explode('/', $prettyName);
+ } else {
+ $vendor = '';
+ $name = $prettyName;
+ }
+
+ $availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
+
+ $extra = $package->getExtra();
+ if (!empty($extra['installer-name'])) {
+ $availableVars['name'] = $extra['installer-name'];
+ }
+
+ if ($this->composer->getPackage()) {
+ $extra = $this->composer->getPackage()->getExtra();
+ if (!empty($extra['installer-paths'])) {
+ $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
+ if ($customPath !== false) {
+ return $this->templatePath($customPath, $availableVars);
+ }
+ }
+ }
+
+ $packageType = substr($type, strlen($frameworkType) + 1);
+ $locations = $this->getLocations();
+ if (!isset($locations[$packageType])) {
+ throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
+ }
+
+ return $this->templatePath($locations[$packageType], $availableVars);
+ }
+
+ /**
+ * For an installer to override to modify the vars per installer.
+ *
+ * @param array $vars This will normally receive array{name: string, vendor: string, type: string}
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ return $vars;
+ }
+
+ /**
+ * Gets the installer's locations
+ *
+ * @return array map of package types => install path
+ */
+ public function getLocations()
+ {
+ return $this->locations;
+ }
+
+ /**
+ * Replace vars in a path
+ *
+ * @param string $path
+ * @param array $vars
+ * @return string
+ */
+ protected function templatePath($path, array $vars = array())
+ {
+ if (strpos($path, '{') !== false) {
+ extract($vars);
+ preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
+ if (!empty($matches[1])) {
+ foreach ($matches[1] as $var) {
+ $path = str_replace('{$' . $var . '}', $$var, $path);
+ }
+ }
+ }
+
+ return $path;
+ }
+
+ /**
+ * Search through a passed paths array for a custom install path.
+ *
+ * @param array $paths
+ * @param string $name
+ * @param string $type
+ * @param string $vendor = NULL
+ * @return string|false
+ */
+ protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
+ {
+ foreach ($paths as $path => $names) {
+ $names = (array) $names;
+ if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) {
+ return $path;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php b/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php
new file mode 100644
index 00000000000..e80cd1e109f
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php
@@ -0,0 +1,126 @@
+.`.
+ * - `bitrix-d7-component` — copy the component to directory `bitrix/components//`.
+ * - `bitrix-d7-template` — copy the template to directory `bitrix/templates/_`.
+ *
+ * You can set custom path to directory with Bitrix kernel in `composer.json`:
+ *
+ * ```json
+ * {
+ * "extra": {
+ * "bitrix-dir": "s1/bitrix"
+ * }
+ * }
+ * ```
+ *
+ * @author Nik Samokhvalov
+ * @author Denis Kulichkin
+ */
+class BitrixInstaller extends BaseInstaller
+{
+ protected $locations = array(
+ 'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
+ 'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
+ 'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
+ 'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/',
+ 'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/',
+ 'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
+ );
+
+ /**
+ * @var array Storage for informations about duplicates at all the time of installation packages.
+ */
+ private static $checkedDuplicates = array();
+
+ /**
+ * {@inheritdoc}
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($this->composer->getPackage()) {
+ $extra = $this->composer->getPackage()->getExtra();
+
+ if (isset($extra['bitrix-dir'])) {
+ $vars['bitrix_dir'] = $extra['bitrix-dir'];
+ }
+ }
+
+ if (!isset($vars['bitrix_dir'])) {
+ $vars['bitrix_dir'] = 'bitrix';
+ }
+
+ return parent::inflectPackageVars($vars);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function templatePath($path, array $vars = array())
+ {
+ $templatePath = parent::templatePath($path, $vars);
+ $this->checkDuplicates($templatePath, $vars);
+
+ return $templatePath;
+ }
+
+ /**
+ * Duplicates search packages.
+ *
+ * @param string $path
+ * @param array $vars
+ */
+ protected function checkDuplicates($path, array $vars = array())
+ {
+ $packageType = substr($vars['type'], strlen('bitrix') + 1);
+ $localDir = explode('/', $vars['bitrix_dir']);
+ array_pop($localDir);
+ $localDir[] = 'local';
+ $localDir = implode('/', $localDir);
+
+ $oldPath = str_replace(
+ array('{$bitrix_dir}', '{$name}'),
+ array($localDir, $vars['name']),
+ $this->locations[$packageType]
+ );
+
+ if (in_array($oldPath, static::$checkedDuplicates)) {
+ return;
+ }
+
+ if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) {
+
+ $this->io->writeError(' Duplication of packages:');
+ $this->io->writeError(' Package ' . $oldPath . ' will be called instead package ' . $path . '');
+
+ while (true) {
+ switch ($this->io->ask(' Delete ' . $oldPath . ' [y,n,?]? ', '?')) {
+ case 'y':
+ $fs = new Filesystem();
+ $fs->removeDirectory($oldPath);
+ break 2;
+
+ case 'n':
+ break 2;
+
+ case '?':
+ default:
+ $this->io->writeError(array(
+ ' y - delete package ' . $oldPath . ' and to continue with the installation',
+ ' n - don\'t delete and to continue with the installation',
+ ));
+ $this->io->writeError(' ? - print help');
+ break;
+ }
+ }
+ }
+
+ static::$checkedDuplicates[] = $oldPath;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php b/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php
new file mode 100644
index 00000000000..da3aad2a3bf
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php
@@ -0,0 +1,9 @@
+ 'Packages/{$vendor}/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php b/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php
new file mode 100644
index 00000000000..dda90a4e9d0
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php
@@ -0,0 +1,65 @@
+ 'Plugin/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
+ return $vars;
+ }
+
+ $nameParts = explode('/', $vars['name']);
+ foreach ($nameParts as &$value) {
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
+ $value = str_replace(array('-', '_'), ' ', $value);
+ $value = str_replace(' ', '', ucwords($value));
+ }
+ $vars['name'] = implode('/', $nameParts);
+
+ return $vars;
+ }
+
+ /**
+ * Change the default plugin location when cakephp >= 3.0
+ */
+ public function getLocations()
+ {
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
+ $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
+ }
+ return $this->locations;
+ }
+
+ /**
+ * Check if CakePHP version matches against a version
+ *
+ * @param string $matcher
+ * @param string $version
+ * @return bool
+ */
+ protected function matchesCakeVersion($matcher, $version)
+ {
+ $repositoryManager = $this->composer->getRepositoryManager();
+ if (! $repositoryManager) {
+ return false;
+ }
+
+ $repos = $repositoryManager->getLocalRepository();
+ if (!$repos) {
+ return false;
+ }
+
+ return $repos->findPackage('cakephp/cakephp', new Constraint($matcher, $version)) !== null;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php b/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php
new file mode 100644
index 00000000000..ab2f9aad807
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php
@@ -0,0 +1,11 @@
+ 'Chef/{$vendor}/{$name}/',
+ 'role' => 'Chef/roles/{$name}/',
+ );
+}
+
diff --git a/vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php b/vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php
new file mode 100644
index 00000000000..6673aea94ba
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php
@@ -0,0 +1,9 @@
+ 'ext/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php b/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php
new file mode 100644
index 00000000000..c887815c95a
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php
@@ -0,0 +1,10 @@
+ 'CCF/orbit/{$name}/',
+ 'theme' => 'CCF/app/themes/{$name}/',
+ );
+}
\ No newline at end of file
diff --git a/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php b/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php
new file mode 100644
index 00000000000..053f3ffd764
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php
@@ -0,0 +1,32 @@
+ 'cockpit/modules/addons/{$name}/',
+ );
+
+ /**
+ * Format module name.
+ *
+ * Strip `module-` prefix from package name.
+ *
+ * {@inheritDoc}
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] == 'cockpit-module') {
+ return $this->inflectModuleVars($vars);
+ }
+
+ return $vars;
+ }
+
+ public function inflectModuleVars($vars)
+ {
+ $vars['name'] = ucfirst(preg_replace('/cockpit-/i', '', $vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php b/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php
new file mode 100644
index 00000000000..3b4a4ece11a
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php
@@ -0,0 +1,11 @@
+ 'application/libraries/{$name}/',
+ 'third-party' => 'application/third_party/{$name}/',
+ 'module' => 'application/modules/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php b/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php
new file mode 100644
index 00000000000..5c01bafd777
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php
@@ -0,0 +1,13 @@
+ 'concrete/',
+ 'block' => 'application/blocks/{$name}/',
+ 'package' => 'packages/{$name}/',
+ 'theme' => 'application/themes/{$name}/',
+ 'update' => 'updates/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php b/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php
new file mode 100644
index 00000000000..d37a77ae2b7
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php
@@ -0,0 +1,35 @@
+ 'craft/plugins/{$name}/',
+ );
+
+ /**
+ * Strip `craft-` prefix and/or `-plugin` suffix from package names
+ *
+ * @param array $vars
+ *
+ * @return array
+ */
+ final public function inflectPackageVars($vars)
+ {
+ return $this->inflectPluginVars($vars);
+ }
+
+ private function inflectPluginVars($vars)
+ {
+ $vars['name'] = preg_replace('/-' . self::NAME_SUFFIX . '$/i', '', $vars['name']);
+ $vars['name'] = preg_replace('/^' . self::NAME_PREFIX . '-/i', '', $vars['name']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php b/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php
new file mode 100644
index 00000000000..d94219d3a45
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php
@@ -0,0 +1,21 @@
+ 'Plugin/{$name}/',
+ 'theme' => 'View/Themed/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php b/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php
new file mode 100644
index 00000000000..f4837a6c18d
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php
@@ -0,0 +1,10 @@
+ 'app/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/DframeInstaller.php b/vendor/composer/installers/src/Composer/Installers/DframeInstaller.php
new file mode 100644
index 00000000000..70788163a11
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/DframeInstaller.php
@@ -0,0 +1,10 @@
+ 'modules/{$vendor}/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php b/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php
new file mode 100644
index 00000000000..cfd638d5f5f
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php
@@ -0,0 +1,50 @@
+ 'lib/plugins/{$name}/',
+ 'template' => 'lib/tpl/{$name}/',
+ );
+
+ /**
+ * Format package name.
+ *
+ * For package type dokuwiki-plugin, cut off a trailing '-plugin',
+ * or leading dokuwiki_ if present.
+ *
+ * For package type dokuwiki-template, cut off a trailing '-template' if present.
+ *
+ */
+ public function inflectPackageVars($vars)
+ {
+
+ if ($vars['type'] === 'dokuwiki-plugin') {
+ return $this->inflectPluginVars($vars);
+ }
+
+ if ($vars['type'] === 'dokuwiki-template') {
+ return $this->inflectTemplateVars($vars);
+ }
+
+ return $vars;
+ }
+
+ protected function inflectPluginVars($vars)
+ {
+ $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
+ $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
+
+ return $vars;
+ }
+
+ protected function inflectTemplateVars($vars)
+ {
+ $vars['name'] = preg_replace('/-template$/', '', $vars['name']);
+ $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
+
+ return $vars;
+ }
+
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php b/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php
new file mode 100644
index 00000000000..21f7e8e8016
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php
@@ -0,0 +1,16 @@
+
+ */
+class DolibarrInstaller extends BaseInstaller
+{
+ //TODO: Add support for scripts and themes
+ protected $locations = array(
+ 'module' => 'htdocs/custom/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php b/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php
new file mode 100644
index 00000000000..73282392286
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php
@@ -0,0 +1,22 @@
+ 'core/',
+ 'module' => 'modules/{$name}/',
+ 'theme' => 'themes/{$name}/',
+ 'library' => 'libraries/{$name}/',
+ 'profile' => 'profiles/{$name}/',
+ 'database-driver' => 'drivers/lib/Drupal/Driver/Database/{$name}/',
+ 'drush' => 'drush/{$name}/',
+ 'custom-theme' => 'themes/custom/{$name}/',
+ 'custom-module' => 'modules/custom/{$name}/',
+ 'custom-profile' => 'profiles/custom/{$name}/',
+ 'drupal-multisite' => 'sites/{$name}/',
+ 'console' => 'console/{$name}/',
+ 'console-language' => 'console/language/{$name}/',
+ 'config' => 'config/sync/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php b/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php
new file mode 100644
index 00000000000..c0bb609f4fe
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php
@@ -0,0 +1,9 @@
+ 'mod/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php b/vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php
new file mode 100644
index 00000000000..6f3dc97b11a
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php
@@ -0,0 +1,12 @@
+ 'components/{$name}/',
+ 'module' => 'modules/{$name}/',
+ 'plugin' => 'plugins/{$name}/',
+ 'template' => 'templates/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php b/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php
new file mode 100644
index 00000000000..d5321a8ca10
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php
@@ -0,0 +1,29 @@
+ 'system/expressionengine/third_party/{$name}/',
+ 'theme' => 'themes/third_party/{$name}/',
+ );
+
+ private $ee3Locations = array(
+ 'addon' => 'system/user/addons/{$name}/',
+ 'theme' => 'themes/user/{$name}/',
+ );
+
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
+ {
+
+ $version = "{$frameworkType}Locations";
+ $this->locations = $this->$version;
+
+ return parent::getInstallPath($package, $frameworkType);
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php b/vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php
new file mode 100644
index 00000000000..f30ebcc775c
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php
@@ -0,0 +1,10 @@
+ 'web/assets/ezplatform/',
+ 'assets' => 'web/assets/ezplatform/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php b/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php
new file mode 100644
index 00000000000..6eba2e34f2f
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php
@@ -0,0 +1,11 @@
+ 'fuel/app/modules/{$name}/',
+ 'package' => 'fuel/packages/{$name}/',
+ 'theme' => 'fuel/app/themes/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php b/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php
new file mode 100644
index 00000000000..29d980b30da
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php
@@ -0,0 +1,9 @@
+ 'components/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/GravInstaller.php b/vendor/composer/installers/src/Composer/Installers/GravInstaller.php
new file mode 100644
index 00000000000..dbe63e07ec2
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/GravInstaller.php
@@ -0,0 +1,30 @@
+ 'user/plugins/{$name}/',
+ 'theme' => 'user/themes/{$name}/',
+ );
+
+ /**
+ * Format package name
+ *
+ * @param array $vars
+ *
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ $restrictedWords = implode('|', array_keys($this->locations));
+
+ $vars['name'] = strtolower($vars['name']);
+ $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
+ '$1',
+ $vars['name']
+ );
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php b/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php
new file mode 100644
index 00000000000..8fe017f0f74
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php
@@ -0,0 +1,25 @@
+ 'plugins/{$name}/',
+ 'theme' => 'plugins/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $nameParts = explode('/', $vars['name']);
+ foreach ($nameParts as &$value) {
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
+ $value = str_replace(array('-', '_'), ' ', $value);
+ $value = str_replace(' ', '', ucwords($value));
+ }
+ $vars['name'] = implode('/', $nameParts);
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php b/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php
new file mode 100644
index 00000000000..5e2142ea577
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php
@@ -0,0 +1,11 @@
+ 'templates/{$name}/',
+ 'module' => 'application/modules/{$name}/',
+ 'library' => 'application/libraries/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/Installer.php b/vendor/composer/installers/src/Composer/Installers/Installer.php
new file mode 100644
index 00000000000..5869c177690
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/Installer.php
@@ -0,0 +1,294 @@
+ 'AimeosInstaller',
+ 'asgard' => 'AsgardInstaller',
+ 'attogram' => 'AttogramInstaller',
+ 'agl' => 'AglInstaller',
+ 'annotatecms' => 'AnnotateCmsInstaller',
+ 'bitrix' => 'BitrixInstaller',
+ 'bonefish' => 'BonefishInstaller',
+ 'cakephp' => 'CakePHPInstaller',
+ 'chef' => 'ChefInstaller',
+ 'civicrm' => 'CiviCrmInstaller',
+ 'ccframework' => 'ClanCatsFrameworkInstaller',
+ 'cockpit' => 'CockpitInstaller',
+ 'codeigniter' => 'CodeIgniterInstaller',
+ 'concrete5' => 'Concrete5Installer',
+ 'craft' => 'CraftInstaller',
+ 'croogo' => 'CroogoInstaller',
+ 'dframe' => 'DframeInstaller',
+ 'dokuwiki' => 'DokuWikiInstaller',
+ 'dolibarr' => 'DolibarrInstaller',
+ 'decibel' => 'DecibelInstaller',
+ 'drupal' => 'DrupalInstaller',
+ 'elgg' => 'ElggInstaller',
+ 'eliasis' => 'EliasisInstaller',
+ 'ee3' => 'ExpressionEngineInstaller',
+ 'ee2' => 'ExpressionEngineInstaller',
+ 'ezplatform' => 'EzPlatformInstaller',
+ 'fuel' => 'FuelInstaller',
+ 'fuelphp' => 'FuelphpInstaller',
+ 'grav' => 'GravInstaller',
+ 'hurad' => 'HuradInstaller',
+ 'imagecms' => 'ImageCMSInstaller',
+ 'itop' => 'ItopInstaller',
+ 'joomla' => 'JoomlaInstaller',
+ 'kanboard' => 'KanboardInstaller',
+ 'kirby' => 'KirbyInstaller',
+ 'known' => 'KnownInstaller',
+ 'kodicms' => 'KodiCMSInstaller',
+ 'kohana' => 'KohanaInstaller',
+ 'lms' => 'LanManagementSystemInstaller',
+ 'laravel' => 'LaravelInstaller',
+ 'lavalite' => 'LavaLiteInstaller',
+ 'lithium' => 'LithiumInstaller',
+ 'magento' => 'MagentoInstaller',
+ 'majima' => 'MajimaInstaller',
+ 'mantisbt' => 'MantisBTInstaller',
+ 'mako' => 'MakoInstaller',
+ 'maya' => 'MayaInstaller',
+ 'mautic' => 'MauticInstaller',
+ 'mediawiki' => 'MediaWikiInstaller',
+ 'microweber' => 'MicroweberInstaller',
+ 'modulework' => 'MODULEWorkInstaller',
+ 'modx' => 'ModxInstaller',
+ 'modxevo' => 'MODXEvoInstaller',
+ 'moodle' => 'MoodleInstaller',
+ 'october' => 'OctoberInstaller',
+ 'ontowiki' => 'OntoWikiInstaller',
+ 'oxid' => 'OxidInstaller',
+ 'osclass' => 'OsclassInstaller',
+ 'pxcms' => 'PxcmsInstaller',
+ 'phpbb' => 'PhpBBInstaller',
+ 'pimcore' => 'PimcoreInstaller',
+ 'piwik' => 'PiwikInstaller',
+ 'plentymarkets'=> 'PlentymarketsInstaller',
+ 'ppi' => 'PPIInstaller',
+ 'puppet' => 'PuppetInstaller',
+ 'radphp' => 'RadPHPInstaller',
+ 'phifty' => 'PhiftyInstaller',
+ 'porto' => 'PortoInstaller',
+ 'processwire' => 'ProcessWireInstaller',
+ 'redaxo' => 'RedaxoInstaller',
+ 'redaxo5' => 'Redaxo5Installer',
+ 'reindex' => 'ReIndexInstaller',
+ 'roundcube' => 'RoundcubeInstaller',
+ 'shopware' => 'ShopwareInstaller',
+ 'sitedirect' => 'SiteDirectInstaller',
+ 'silverstripe' => 'SilverStripeInstaller',
+ 'smf' => 'SMFInstaller',
+ 'starbug' => 'StarbugInstaller',
+ 'sydes' => 'SyDESInstaller',
+ 'sylius' => 'SyliusInstaller',
+ 'symfony1' => 'Symfony1Installer',
+ 'tao' => 'TaoInstaller',
+ 'thelia' => 'TheliaInstaller',
+ 'tusk' => 'TuskInstaller',
+ 'typo3-cms' => 'TYPO3CmsInstaller',
+ 'typo3-flow' => 'TYPO3FlowInstaller',
+ 'userfrosting' => 'UserFrostingInstaller',
+ 'vanilla' => 'VanillaInstaller',
+ 'whmcs' => 'WHMCSInstaller',
+ 'wolfcms' => 'WolfCMSInstaller',
+ 'wordpress' => 'WordPressInstaller',
+ 'yawik' => 'YawikInstaller',
+ 'zend' => 'ZendInstaller',
+ 'zikula' => 'ZikulaInstaller',
+ 'prestashop' => 'PrestashopInstaller'
+ );
+
+ /**
+ * Installer constructor.
+ *
+ * Disables installers specified in main composer extra installer-disable
+ * list
+ *
+ * @param IOInterface $io
+ * @param Composer $composer
+ * @param string $type
+ * @param Filesystem|null $filesystem
+ * @param BinaryInstaller|null $binaryInstaller
+ */
+ public function __construct(
+ IOInterface $io,
+ Composer $composer,
+ $type = 'library',
+ Filesystem $filesystem = null,
+ BinaryInstaller $binaryInstaller = null
+ ) {
+ parent::__construct($io, $composer, $type, $filesystem,
+ $binaryInstaller);
+ $this->removeDisabledInstallers();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getInstallPath(PackageInterface $package)
+ {
+ $type = $package->getType();
+ $frameworkType = $this->findFrameworkType($type);
+
+ if ($frameworkType === false) {
+ throw new \InvalidArgumentException(
+ 'Sorry the package type of this package is not yet supported.'
+ );
+ }
+
+ $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
+ $installer = new $class($package, $this->composer, $this->getIO());
+
+ return $installer->getInstallPath($package, $frameworkType);
+ }
+
+ public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
+ {
+ $installPath = $this->getPackageBasePath($package);
+ $io = $this->io;
+ $outputStatus = function () use ($io, $installPath) {
+ $io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? 'deleted' : 'not deleted'));
+ };
+
+ $promise = parent::uninstall($repo, $package);
+
+ // Composer v2 might return a promise here
+ if ($promise instanceof PromiseInterface) {
+ return $promise->then($outputStatus);
+ }
+
+ // If not, execute the code right away as parent::uninstall executed synchronously (composer v1, or v2 without async)
+ $outputStatus();
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supports($packageType)
+ {
+ $frameworkType = $this->findFrameworkType($packageType);
+
+ if ($frameworkType === false) {
+ return false;
+ }
+
+ $locationPattern = $this->getLocationPattern($frameworkType);
+
+ return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
+ }
+
+ /**
+ * Finds a supported framework type if it exists and returns it
+ *
+ * @param string $type
+ * @return string|false
+ */
+ protected function findFrameworkType($type)
+ {
+ krsort($this->supportedTypes);
+
+ foreach ($this->supportedTypes as $key => $val) {
+ if ($key === substr($type, 0, strlen($key))) {
+ return substr($type, 0, strlen($key));
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Get the second part of the regular expression to check for support of a
+ * package type
+ *
+ * @param string $frameworkType
+ * @return string
+ */
+ protected function getLocationPattern($frameworkType)
+ {
+ $pattern = false;
+ if (!empty($this->supportedTypes[$frameworkType])) {
+ $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
+ /** @var BaseInstaller $framework */
+ $framework = new $frameworkClass(null, $this->composer, $this->getIO());
+ $locations = array_keys($framework->getLocations());
+ $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
+ }
+
+ return $pattern ? : '(\w+)';
+ }
+
+ /**
+ * Get I/O object
+ *
+ * @return IOInterface
+ */
+ private function getIO()
+ {
+ return $this->io;
+ }
+
+ /**
+ * Look for installers set to be disabled in composer's extra config and
+ * remove them from the list of supported installers.
+ *
+ * Globals:
+ * - true, "all", and "*" - disable all installers.
+ * - false - enable all installers (useful with
+ * wikimedia/composer-merge-plugin or similar)
+ *
+ * @return void
+ */
+ protected function removeDisabledInstallers()
+ {
+ $extra = $this->composer->getPackage()->getExtra();
+
+ if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
+ // No installers are disabled
+ return;
+ }
+
+ // Get installers to disable
+ $disable = $extra['installer-disable'];
+
+ // Ensure $disabled is an array
+ if (!is_array($disable)) {
+ $disable = array($disable);
+ }
+
+ // Check which installers should be disabled
+ $all = array(true, "all", "*");
+ $intersect = array_intersect($all, $disable);
+ if (!empty($intersect)) {
+ // Disable all installers
+ $this->supportedTypes = array();
+ } else {
+ // Disable specified installers
+ foreach ($disable as $key => $installer) {
+ if (is_string($installer) && key_exists($installer, $this->supportedTypes)) {
+ unset($this->supportedTypes[$installer]);
+ }
+ }
+ }
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ItopInstaller.php b/vendor/composer/installers/src/Composer/Installers/ItopInstaller.php
new file mode 100644
index 00000000000..c6c1b337460
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ItopInstaller.php
@@ -0,0 +1,9 @@
+ 'extensions/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php b/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php
new file mode 100644
index 00000000000..9ee7759651a
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php
@@ -0,0 +1,15 @@
+ 'components/{$name}/',
+ 'module' => 'modules/{$name}/',
+ 'template' => 'templates/{$name}/',
+ 'plugin' => 'plugins/{$name}/',
+ 'library' => 'libraries/{$name}/',
+ );
+
+ // TODO: Add inflector for mod_ and com_ names
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php b/vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php
new file mode 100644
index 00000000000..9cb7b8cdbff
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php
@@ -0,0 +1,18 @@
+ 'plugins/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php b/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php
new file mode 100644
index 00000000000..36b2f84a761
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php
@@ -0,0 +1,11 @@
+ 'site/plugins/{$name}/',
+ 'field' => 'site/fields/{$name}/',
+ 'tag' => 'site/tags/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/KnownInstaller.php b/vendor/composer/installers/src/Composer/Installers/KnownInstaller.php
new file mode 100644
index 00000000000..c5d08c5f9a1
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/KnownInstaller.php
@@ -0,0 +1,11 @@
+ 'IdnoPlugins/{$name}/',
+ 'theme' => 'Themes/{$name}/',
+ 'console' => 'ConsolePlugins/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php b/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php
new file mode 100644
index 00000000000..7143e232bc3
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php
@@ -0,0 +1,10 @@
+ 'cms/plugins/{$name}/',
+ 'media' => 'cms/media/vendor/{$name}/'
+ );
+}
\ No newline at end of file
diff --git a/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php b/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php
new file mode 100644
index 00000000000..dcd6d26322a
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php
@@ -0,0 +1,9 @@
+ 'modules/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php b/vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php
new file mode 100644
index 00000000000..903143a558e
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php
@@ -0,0 +1,27 @@
+ 'plugins/{$name}/',
+ 'template' => 'templates/{$name}/',
+ 'document-template' => 'documents/templates/{$name}/',
+ 'userpanel-module' => 'userpanel/modules/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php b/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php
new file mode 100644
index 00000000000..be4d53a7bd3
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php
@@ -0,0 +1,9 @@
+ 'libraries/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php b/vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php
new file mode 100644
index 00000000000..412c0b5c0b6
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php
@@ -0,0 +1,10 @@
+ 'packages/{$vendor}/{$name}/',
+ 'theme' => 'public/themes/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php b/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php
new file mode 100644
index 00000000000..47bbd4cabeb
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php
@@ -0,0 +1,10 @@
+ 'libraries/{$name}/',
+ 'source' => 'libraries/_source/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php b/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php
new file mode 100644
index 00000000000..9c2e9fb40c3
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php
@@ -0,0 +1,9 @@
+ 'modules/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php b/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php
new file mode 100644
index 00000000000..5a664608df9
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php
@@ -0,0 +1,16 @@
+ 'assets/snippets/{$name}/',
+ 'plugin' => 'assets/plugins/{$name}/',
+ 'module' => 'assets/modules/{$name}/',
+ 'template' => 'assets/templates/{$name}/',
+ 'lib' => 'assets/lib/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php b/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php
new file mode 100644
index 00000000000..cf18e9478ce
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php
@@ -0,0 +1,11 @@
+ 'app/design/frontend/{$name}/',
+ 'skin' => 'skin/frontend/default/{$name}/',
+ 'library' => 'lib/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php b/vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php
new file mode 100644
index 00000000000..e463756faa9
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php
@@ -0,0 +1,37 @@
+ 'plugins/{$name}/',
+ );
+
+ /**
+ * Transforms the names
+ * @param array $vars
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ return $this->correctPluginName($vars);
+ }
+
+ /**
+ * Change hyphenated names to camelcase
+ * @param array $vars
+ * @return array
+ */
+ private function correctPluginName($vars)
+ {
+ $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
+ return strtoupper($matches[0][1]);
+ }, $vars['name']);
+ $vars['name'] = ucfirst($camelCasedName);
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php b/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php
new file mode 100644
index 00000000000..ca3cfacb49a
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php
@@ -0,0 +1,9 @@
+ 'app/packages/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MantisBTInstaller.php b/vendor/composer/installers/src/Composer/Installers/MantisBTInstaller.php
new file mode 100644
index 00000000000..dadb1dbbcf6
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MantisBTInstaller.php
@@ -0,0 +1,23 @@
+ 'plugins/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php b/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php
new file mode 100644
index 00000000000..3e1ce2b2d7d
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php
@@ -0,0 +1,25 @@
+ 'plugins/{$name}/',
+ 'theme' => 'themes/{$name}/',
+ );
+
+ /**
+ * Format package name of mautic-plugins to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] == 'mautic-plugin') {
+ $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
+ return strtoupper($matches[0][1]);
+ }, ucfirst($vars['name']));
+ }
+
+ return $vars;
+ }
+
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MayaInstaller.php b/vendor/composer/installers/src/Composer/Installers/MayaInstaller.php
new file mode 100644
index 00000000000..30a91676d73
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MayaInstaller.php
@@ -0,0 +1,33 @@
+ 'modules/{$name}/',
+ );
+
+ /**
+ * Format package name.
+ *
+ * For package type maya-module, cut off a trailing '-module' if present.
+ *
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] === 'maya-module') {
+ return $this->inflectModuleVars($vars);
+ }
+
+ return $vars;
+ }
+
+ protected function inflectModuleVars($vars)
+ {
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php b/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php
new file mode 100644
index 00000000000..f5a8957ef0d
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php
@@ -0,0 +1,51 @@
+ 'core/',
+ 'extension' => 'extensions/{$name}/',
+ 'skin' => 'skins/{$name}/',
+ );
+
+ /**
+ * Format package name.
+ *
+ * For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
+ * to CamelCase keeping existing uppercase chars.
+ *
+ * For package type mediawiki-skin, cut off a trailing '-skin' if present.
+ *
+ */
+ public function inflectPackageVars($vars)
+ {
+
+ if ($vars['type'] === 'mediawiki-extension') {
+ return $this->inflectExtensionVars($vars);
+ }
+
+ if ($vars['type'] === 'mediawiki-skin') {
+ return $this->inflectSkinVars($vars);
+ }
+
+ return $vars;
+ }
+
+ protected function inflectExtensionVars($vars)
+ {
+ $vars['name'] = preg_replace('/-extension$/', '', $vars['name']);
+ $vars['name'] = str_replace('-', ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+
+ protected function inflectSkinVars($vars)
+ {
+ $vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
+
+ return $vars;
+ }
+
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php b/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php
new file mode 100644
index 00000000000..b7d970392ab
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php
@@ -0,0 +1,119 @@
+ 'userfiles/modules/{$install_item_dir}/',
+ 'module-skin' => 'userfiles/modules/{$install_item_dir}/templates/',
+ 'template' => 'userfiles/templates/{$install_item_dir}/',
+ 'element' => 'userfiles/elements/{$install_item_dir}/',
+ 'vendor' => 'vendor/{$install_item_dir}/',
+ 'components' => 'components/{$install_item_dir}/'
+ );
+
+ /**
+ * Format package name.
+ *
+ * For package type microweber-module, cut off a trailing '-module' if present
+ *
+ * For package type microweber-template, cut off a trailing '-template' if present.
+ *
+ */
+ public function inflectPackageVars($vars)
+ {
+
+
+ if ($this->package->getTargetDir()) {
+ $vars['install_item_dir'] = $this->package->getTargetDir();
+ } else {
+ $vars['install_item_dir'] = $vars['name'];
+ if ($vars['type'] === 'microweber-template') {
+ return $this->inflectTemplateVars($vars);
+ }
+ if ($vars['type'] === 'microweber-templates') {
+ return $this->inflectTemplatesVars($vars);
+ }
+ if ($vars['type'] === 'microweber-core') {
+ return $this->inflectCoreVars($vars);
+ }
+ if ($vars['type'] === 'microweber-adapter') {
+ return $this->inflectCoreVars($vars);
+ }
+ if ($vars['type'] === 'microweber-module') {
+ return $this->inflectModuleVars($vars);
+ }
+ if ($vars['type'] === 'microweber-modules') {
+ return $this->inflectModulesVars($vars);
+ }
+ if ($vars['type'] === 'microweber-skin') {
+ return $this->inflectSkinVars($vars);
+ }
+ if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') {
+ return $this->inflectElementVars($vars);
+ }
+ }
+
+
+ return $vars;
+ }
+
+ protected function inflectTemplateVars($vars)
+ {
+ $vars['install_item_dir'] = preg_replace('/-template$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/template-$/', '', $vars['install_item_dir']);
+
+ return $vars;
+ }
+
+ protected function inflectTemplatesVars($vars)
+ {
+ $vars['install_item_dir'] = preg_replace('/-templates$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/templates-$/', '', $vars['install_item_dir']);
+
+ return $vars;
+ }
+
+ protected function inflectCoreVars($vars)
+ {
+ $vars['install_item_dir'] = preg_replace('/-providers$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/-provider$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/-adapter$/', '', $vars['install_item_dir']);
+
+ return $vars;
+ }
+
+ protected function inflectModuleVars($vars)
+ {
+ $vars['install_item_dir'] = preg_replace('/-module$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/module-$/', '', $vars['install_item_dir']);
+
+ return $vars;
+ }
+
+ protected function inflectModulesVars($vars)
+ {
+ $vars['install_item_dir'] = preg_replace('/-modules$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/modules-$/', '', $vars['install_item_dir']);
+
+ return $vars;
+ }
+
+ protected function inflectSkinVars($vars)
+ {
+ $vars['install_item_dir'] = preg_replace('/-skin$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/skin-$/', '', $vars['install_item_dir']);
+
+ return $vars;
+ }
+
+ protected function inflectElementVars($vars)
+ {
+ $vars['install_item_dir'] = preg_replace('/-elements$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/elements-$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/-element$/', '', $vars['install_item_dir']);
+ $vars['install_item_dir'] = preg_replace('/element-$/', '', $vars['install_item_dir']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ModxInstaller.php b/vendor/composer/installers/src/Composer/Installers/ModxInstaller.php
new file mode 100644
index 00000000000..0ee140abfe5
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ModxInstaller.php
@@ -0,0 +1,12 @@
+ 'core/packages/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php b/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php
new file mode 100644
index 00000000000..05317995f42
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php
@@ -0,0 +1,59 @@
+ 'mod/{$name}/',
+ 'admin_report' => 'admin/report/{$name}/',
+ 'atto' => 'lib/editor/atto/plugins/{$name}/',
+ 'tool' => 'admin/tool/{$name}/',
+ 'assignment' => 'mod/assignment/type/{$name}/',
+ 'assignsubmission' => 'mod/assign/submission/{$name}/',
+ 'assignfeedback' => 'mod/assign/feedback/{$name}/',
+ 'auth' => 'auth/{$name}/',
+ 'availability' => 'availability/condition/{$name}/',
+ 'block' => 'blocks/{$name}/',
+ 'booktool' => 'mod/book/tool/{$name}/',
+ 'cachestore' => 'cache/stores/{$name}/',
+ 'cachelock' => 'cache/locks/{$name}/',
+ 'calendartype' => 'calendar/type/{$name}/',
+ 'fileconverter' => 'files/converter/{$name}/',
+ 'format' => 'course/format/{$name}/',
+ 'coursereport' => 'course/report/{$name}/',
+ 'customcertelement' => 'mod/customcert/element/{$name}/',
+ 'datafield' => 'mod/data/field/{$name}/',
+ 'datapreset' => 'mod/data/preset/{$name}/',
+ 'editor' => 'lib/editor/{$name}/',
+ 'enrol' => 'enrol/{$name}/',
+ 'filter' => 'filter/{$name}/',
+ 'gradeexport' => 'grade/export/{$name}/',
+ 'gradeimport' => 'grade/import/{$name}/',
+ 'gradereport' => 'grade/report/{$name}/',
+ 'gradingform' => 'grade/grading/form/{$name}/',
+ 'local' => 'local/{$name}/',
+ 'logstore' => 'admin/tool/log/store/{$name}/',
+ 'ltisource' => 'mod/lti/source/{$name}/',
+ 'ltiservice' => 'mod/lti/service/{$name}/',
+ 'message' => 'message/output/{$name}/',
+ 'mnetservice' => 'mnet/service/{$name}/',
+ 'plagiarism' => 'plagiarism/{$name}/',
+ 'portfolio' => 'portfolio/{$name}/',
+ 'qbehaviour' => 'question/behaviour/{$name}/',
+ 'qformat' => 'question/format/{$name}/',
+ 'qtype' => 'question/type/{$name}/',
+ 'quizaccess' => 'mod/quiz/accessrule/{$name}/',
+ 'quiz' => 'mod/quiz/report/{$name}/',
+ 'report' => 'report/{$name}/',
+ 'repository' => 'repository/{$name}/',
+ 'scormreport' => 'mod/scorm/report/{$name}/',
+ 'search' => 'search/engine/{$name}/',
+ 'theme' => 'theme/{$name}/',
+ 'tinymce' => 'lib/editor/tinymce/plugins/{$name}/',
+ 'profilefield' => 'user/profile/field/{$name}/',
+ 'webservice' => 'webservice/{$name}/',
+ 'workshopallocation' => 'mod/workshop/allocation/{$name}/',
+ 'workshopeval' => 'mod/workshop/eval/{$name}/',
+ 'workshopform' => 'mod/workshop/form/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php b/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php
new file mode 100644
index 00000000000..08d5dc4e75e
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php
@@ -0,0 +1,47 @@
+ 'modules/{$name}/',
+ 'plugin' => 'plugins/{$vendor}/{$name}/',
+ 'theme' => 'themes/{$name}/'
+ );
+
+ /**
+ * Format package name.
+ *
+ * For package type october-plugin, cut off a trailing '-plugin' if present.
+ *
+ * For package type october-theme, cut off a trailing '-theme' if present.
+ *
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] === 'october-plugin') {
+ return $this->inflectPluginVars($vars);
+ }
+
+ if ($vars['type'] === 'october-theme') {
+ return $this->inflectThemeVars($vars);
+ }
+
+ return $vars;
+ }
+
+ protected function inflectPluginVars($vars)
+ {
+ $vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
+ $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
+
+ return $vars;
+ }
+
+ protected function inflectThemeVars($vars)
+ {
+ $vars['name'] = preg_replace('/^oc-|-theme$/', '', $vars['name']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php b/vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php
new file mode 100644
index 00000000000..5dd3438d90b
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php
@@ -0,0 +1,24 @@
+ 'extensions/{$name}/',
+ 'theme' => 'extensions/themes/{$name}/',
+ 'translation' => 'extensions/translations/{$name}/',
+ );
+
+ /**
+ * Format package name to lower case and remove ".ontowiki" suffix
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower($vars['name']);
+ $vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
+ $vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php b/vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php
new file mode 100644
index 00000000000..3ca7954c9ea
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php
@@ -0,0 +1,14 @@
+ 'oc-content/plugins/{$name}/',
+ 'theme' => 'oc-content/themes/{$name}/',
+ 'language' => 'oc-content/languages/{$name}/',
+ );
+
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php b/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php
new file mode 100644
index 00000000000..1797a22cf1b
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php
@@ -0,0 +1,59 @@
+.+)\/.+/';
+
+ protected $locations = array(
+ 'module' => 'modules/{$name}/',
+ 'theme' => 'application/views/{$name}/',
+ 'out' => 'out/{$name}/',
+ );
+
+ /**
+ * getInstallPath
+ *
+ * @param PackageInterface $package
+ * @param string $frameworkType
+ * @return string
+ */
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
+ {
+ $installPath = parent::getInstallPath($package, $frameworkType);
+ $type = $this->package->getType();
+ if ($type === 'oxid-module') {
+ $this->prepareVendorDirectory($installPath);
+ }
+ return $installPath;
+ }
+
+ /**
+ * prepareVendorDirectory
+ *
+ * Makes sure there is a vendormetadata.php file inside
+ * the vendor folder if there is a vendor folder.
+ *
+ * @param string $installPath
+ * @return void
+ */
+ protected function prepareVendorDirectory($installPath)
+ {
+ $matches = '';
+ $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
+ if (!$hasVendorDirectory) {
+ return;
+ }
+
+ $vendorDirectory = $matches['vendor'];
+ $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
+ if (!file_exists($vendorPath)) {
+ mkdir($vendorPath, 0755, true);
+ }
+
+ $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
+ touch($vendorMetaDataPath);
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php b/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php
new file mode 100644
index 00000000000..170136f9840
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php
@@ -0,0 +1,9 @@
+ 'modules/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php b/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php
new file mode 100644
index 00000000000..4e59a8a74f7
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php
@@ -0,0 +1,11 @@
+ 'bundles/{$name}/',
+ 'library' => 'libraries/{$name}/',
+ 'framework' => 'frameworks/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php b/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php
new file mode 100644
index 00000000000..deb2b77a67e
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php
@@ -0,0 +1,11 @@
+ 'ext/{$vendor}/{$name}/',
+ 'language' => 'language/{$name}/',
+ 'style' => 'styles/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php b/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php
new file mode 100644
index 00000000000..4781fa6d107
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php
@@ -0,0 +1,21 @@
+ 'plugins/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php b/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php
new file mode 100644
index 00000000000..c17f4572b32
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php
@@ -0,0 +1,32 @@
+ 'plugins/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ * @param array $vars
+ *
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php b/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php
new file mode 100644
index 00000000000..903e55f62c1
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php
@@ -0,0 +1,29 @@
+ '{$name}/'
+ );
+
+ /**
+ * Remove hyphen, "plugin" and format to camelcase
+ * @param array $vars
+ *
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = explode("-", $vars['name']);
+ foreach ($vars['name'] as $key => $name) {
+ $vars['name'][$key] = ucfirst($vars['name'][$key]);
+ if (strcasecmp($name, "Plugin") == 0) {
+ unset($vars['name'][$key]);
+ }
+ }
+ $vars['name'] = implode("",$vars['name']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/Plugin.php b/vendor/composer/installers/src/Composer/Installers/Plugin.php
new file mode 100644
index 00000000000..e60da0e7f19
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/Plugin.php
@@ -0,0 +1,27 @@
+installer = new Installer($io, $composer);
+ $composer->getInstallationManager()->addInstaller($this->installer);
+ }
+
+ public function deactivate(Composer $composer, IOInterface $io)
+ {
+ $composer->getInstallationManager()->removeInstaller($this->installer);
+ }
+
+ public function uninstall(Composer $composer, IOInterface $io)
+ {
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PortoInstaller.php b/vendor/composer/installers/src/Composer/Installers/PortoInstaller.php
new file mode 100644
index 00000000000..dbf85e635e8
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PortoInstaller.php
@@ -0,0 +1,9 @@
+ 'app/Containers/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php b/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php
new file mode 100644
index 00000000000..4c8421e3640
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php
@@ -0,0 +1,10 @@
+ 'modules/{$name}/',
+ 'theme' => 'themes/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ProcessWireInstaller.php b/vendor/composer/installers/src/Composer/Installers/ProcessWireInstaller.php
new file mode 100644
index 00000000000..e6834a0ca55
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ProcessWireInstaller.php
@@ -0,0 +1,22 @@
+ 'site/modules/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php b/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php
new file mode 100644
index 00000000000..77cc3dd8777
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php
@@ -0,0 +1,11 @@
+ 'modules/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php b/vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php
new file mode 100644
index 00000000000..65510580e13
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php
@@ -0,0 +1,63 @@
+ 'app/Modules/{$name}/',
+ 'theme' => 'themes/{$name}/',
+ );
+
+ /**
+ * Format package name.
+ *
+ * @param array $vars
+ *
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] === 'pxcms-module') {
+ return $this->inflectModuleVars($vars);
+ }
+
+ if ($vars['type'] === 'pxcms-theme') {
+ return $this->inflectThemeVars($vars);
+ }
+
+ return $vars;
+ }
+
+ /**
+ * For package type pxcms-module, cut off a trailing '-plugin' if present.
+ *
+ * return string
+ */
+ protected function inflectModuleVars($vars)
+ {
+ $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
+ $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
+ $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
+ $vars['name'] = ucwords($vars['name']); // make module name camelcased
+
+ return $vars;
+ }
+
+
+ /**
+ * For package type pxcms-module, cut off a trailing '-plugin' if present.
+ *
+ * return string
+ */
+ protected function inflectThemeVars($vars)
+ {
+ $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
+ $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
+ $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
+ $vars['name'] = ucwords($vars['name']); // make module name camelcased
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php b/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php
new file mode 100644
index 00000000000..0f78b5ca649
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php
@@ -0,0 +1,24 @@
+ 'src/{$name}/'
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $nameParts = explode('/', $vars['name']);
+ foreach ($nameParts as &$value) {
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
+ $value = str_replace(array('-', '_'), ' ', $value);
+ $value = str_replace(' ', '', ucwords($value));
+ }
+ $vars['name'] = implode('/', $nameParts);
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php b/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php
new file mode 100644
index 00000000000..252c7339f92
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php
@@ -0,0 +1,10 @@
+ 'themes/{$name}/',
+ 'plugin' => 'plugins/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/Redaxo5Installer.php b/vendor/composer/installers/src/Composer/Installers/Redaxo5Installer.php
new file mode 100644
index 00000000000..23a20347eff
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/Redaxo5Installer.php
@@ -0,0 +1,10 @@
+ 'redaxo/src/addons/{$name}/',
+ 'bestyle-plugin' => 'redaxo/src/addons/be_style/plugins/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php b/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php
new file mode 100644
index 00000000000..09544576b20
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php
@@ -0,0 +1,10 @@
+ 'redaxo/include/addons/{$name}/',
+ 'bestyle-plugin' => 'redaxo/include/addons/be_style/plugins/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php b/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php
new file mode 100644
index 00000000000..d8d795be097
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php
@@ -0,0 +1,22 @@
+ 'plugins/{$name}/',
+ );
+
+ /**
+ * Lowercase name and changes the name to a underscores
+ *
+ * @param array $vars
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower(str_replace('-', '_', $vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php b/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php
new file mode 100644
index 00000000000..1acd3b14c38
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php
@@ -0,0 +1,10 @@
+ 'Sources/{$name}/',
+ 'theme' => 'Themes/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php b/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php
new file mode 100644
index 00000000000..7d20d27a228
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php
@@ -0,0 +1,60 @@
+ 'engine/Shopware/Plugins/Local/Backend/{$name}/',
+ 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/',
+ 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/',
+ 'theme' => 'templates/{$name}/',
+ 'plugin' => 'custom/plugins/{$name}/',
+ 'frontend-theme' => 'themes/Frontend/{$name}/',
+ );
+
+ /**
+ * Transforms the names
+ * @param array $vars
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] === 'shopware-theme') {
+ return $this->correctThemeName($vars);
+ }
+
+ return $this->correctPluginName($vars);
+ }
+
+ /**
+ * Changes the name to a camelcased combination of vendor and name
+ * @param array $vars
+ * @return array
+ */
+ private function correctPluginName($vars)
+ {
+ $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
+ return strtoupper($matches[0][1]);
+ }, $vars['name']);
+
+ $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName);
+
+ return $vars;
+ }
+
+ /**
+ * Changes the name to a underscore separated name
+ * @param array $vars
+ * @return array
+ */
+ private function correctThemeName($vars)
+ {
+ $vars['name'] = str_replace('-', '_', $vars['name']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php b/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php
new file mode 100644
index 00000000000..81910e9f162
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php
@@ -0,0 +1,35 @@
+ '{$name}/',
+ 'theme' => 'themes/{$name}/',
+ );
+
+ /**
+ * Return the install path based on package type.
+ *
+ * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework
+ * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0
+ *
+ * @param PackageInterface $package
+ * @param string $frameworkType
+ * @return string
+ */
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
+ {
+ if (
+ $package->getName() == 'silverstripe/framework'
+ && preg_match('/^\d+\.\d+\.\d+/', $package->getVersion())
+ && version_compare($package->getVersion(), '2.999.999') < 0
+ ) {
+ return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
+ }
+
+ return parent::getInstallPath($package, $frameworkType);
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php b/vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php
new file mode 100644
index 00000000000..762d94c687d
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php
@@ -0,0 +1,25 @@
+ 'modules/{$vendor}/{$name}/',
+ 'plugin' => 'plugins/{$vendor}/{$name}/'
+ );
+
+ public function inflectPackageVars($vars)
+ {
+ return $this->parseVars($vars);
+ }
+
+ protected function parseVars($vars)
+ {
+ $vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor'];
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/StarbugInstaller.php b/vendor/composer/installers/src/Composer/Installers/StarbugInstaller.php
new file mode 100644
index 00000000000..a31c9fda0f4
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/StarbugInstaller.php
@@ -0,0 +1,12 @@
+ 'modules/{$name}/',
+ 'theme' => 'themes/{$name}/',
+ 'custom-module' => 'app/modules/{$name}/',
+ 'custom-theme' => 'app/themes/{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php b/vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php
new file mode 100644
index 00000000000..8626a9bc2c9
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php
@@ -0,0 +1,47 @@
+ 'app/modules/{$name}/',
+ 'theme' => 'themes/{$name}/',
+ );
+
+ /**
+ * Format module name.
+ *
+ * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
+ *
+ * {@inerhitDoc}
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] == 'sydes-module') {
+ return $this->inflectModuleVars($vars);
+ }
+
+ if ($vars['type'] === 'sydes-theme') {
+ return $this->inflectThemeVars($vars);
+ }
+
+ return $vars;
+ }
+
+ public function inflectModuleVars($vars)
+ {
+ $vars['name'] = preg_replace('/(^sydes-|-module$)/i', '', $vars['name']);
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+
+ protected function inflectThemeVars($vars)
+ {
+ $vars['name'] = preg_replace('/(^sydes-|-theme$)/', '', $vars['name']);
+ $vars['name'] = strtolower($vars['name']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/SyliusInstaller.php b/vendor/composer/installers/src/Composer/Installers/SyliusInstaller.php
new file mode 100644
index 00000000000..4357a35bb55
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/SyliusInstaller.php
@@ -0,0 +1,9 @@
+ 'themes/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php b/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php
new file mode 100644
index 00000000000..1675c4f213b
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php
@@ -0,0 +1,26 @@
+
+ */
+class Symfony1Installer extends BaseInstaller
+{
+ protected $locations = array(
+ 'plugin' => 'plugins/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
+ return strtoupper($matches[0][1]);
+ }, $vars['name']);
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php b/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php
new file mode 100644
index 00000000000..b1663e84369
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php
@@ -0,0 +1,16 @@
+
+ */
+class TYPO3CmsInstaller extends BaseInstaller
+{
+ protected $locations = array(
+ 'extension' => 'typo3conf/ext/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php b/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php
new file mode 100644
index 00000000000..42572f44f56
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php
@@ -0,0 +1,38 @@
+ 'Packages/Application/{$name}/',
+ 'framework' => 'Packages/Framework/{$name}/',
+ 'plugin' => 'Packages/Plugins/{$name}/',
+ 'site' => 'Packages/Sites/{$name}/',
+ 'boilerplate' => 'Packages/Boilerplates/{$name}/',
+ 'build' => 'Build/{$name}/',
+ );
+
+ /**
+ * Modify the package name to be a TYPO3 Flow style key.
+ *
+ * @param array $vars
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ $autoload = $this->package->getAutoload();
+ if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) {
+ $namespace = key($autoload['psr-0']);
+ $vars['name'] = str_replace('\\', '.', $namespace);
+ }
+ if (isset($autoload['psr-4']) && is_array($autoload['psr-4'])) {
+ $namespace = key($autoload['psr-4']);
+ $vars['name'] = rtrim(str_replace('\\', '.', $namespace), '.');
+ }
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/TaoInstaller.php b/vendor/composer/installers/src/Composer/Installers/TaoInstaller.php
new file mode 100644
index 00000000000..4f79a45f9cb
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/TaoInstaller.php
@@ -0,0 +1,30 @@
+ '{$name}'
+ );
+
+ public function inflectPackageVars($vars)
+ {
+ $extra = $this->package->getExtra();
+
+ if (array_key_exists(self::EXTRA_TAO_EXTENSION_NAME, $extra)) {
+ $vars['name'] = $extra[self::EXTRA_TAO_EXTENSION_NAME];
+ return $vars;
+ }
+
+ $vars['name'] = str_replace('extension-', '', $vars['name']);
+ $vars['name'] = str_replace('-', ' ', $vars['name']);
+ $vars['name'] = lcfirst(str_replace(' ', '', ucwords($vars['name'])));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php b/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php
new file mode 100644
index 00000000000..158af52610b
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php
@@ -0,0 +1,12 @@
+ 'local/modules/{$name}/',
+ 'frontoffice-template' => 'templates/frontOffice/{$name}/',
+ 'backoffice-template' => 'templates/backOffice/{$name}/',
+ 'email-template' => 'templates/email/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php b/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php
new file mode 100644
index 00000000000..7c0113b85a6
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php
@@ -0,0 +1,14 @@
+
+ */
+ class TuskInstaller extends BaseInstaller
+ {
+ protected $locations = array(
+ 'task' => '.tusk/tasks/{$name}/',
+ 'command' => '.tusk/commands/{$name}/',
+ 'asset' => 'assets/tusk/{$name}/',
+ );
+ }
diff --git a/vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php b/vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php
new file mode 100644
index 00000000000..fcb414ab715
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php
@@ -0,0 +1,9 @@
+ 'app/sprinkles/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php b/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php
new file mode 100644
index 00000000000..24ca645129b
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php
@@ -0,0 +1,10 @@
+ 'plugins/{$name}/',
+ 'theme' => 'themes/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php b/vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php
new file mode 100644
index 00000000000..7d90c5e6e3f
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php
@@ -0,0 +1,49 @@
+ 'src/{$vendor}/{$name}/',
+ 'theme' => 'themes/{$name}/'
+ );
+
+ /**
+ * Format package name.
+ *
+ * For package type vgmcp-bundle, cut off a trailing '-bundle' if present.
+ *
+ * For package type vgmcp-theme, cut off a trailing '-theme' if present.
+ *
+ */
+ public function inflectPackageVars($vars)
+ {
+ if ($vars['type'] === 'vgmcp-bundle') {
+ return $this->inflectPluginVars($vars);
+ }
+
+ if ($vars['type'] === 'vgmcp-theme') {
+ return $this->inflectThemeVars($vars);
+ }
+
+ return $vars;
+ }
+
+ protected function inflectPluginVars($vars)
+ {
+ $vars['name'] = preg_replace('/-bundle$/', '', $vars['name']);
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+
+ protected function inflectThemeVars($vars)
+ {
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php b/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php
new file mode 100644
index 00000000000..b65dbbafd36
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php
@@ -0,0 +1,21 @@
+ 'modules/addons/{$vendor}_{$name}/',
+ 'fraud' => 'modules/fraud/{$vendor}_{$name}/',
+ 'gateways' => 'modules/gateways/{$vendor}_{$name}/',
+ 'notifications' => 'modules/notifications/{$vendor}_{$name}/',
+ 'registrars' => 'modules/registrars/{$vendor}_{$name}/',
+ 'reports' => 'modules/reports/{$vendor}_{$name}/',
+ 'security' => 'modules/security/{$vendor}_{$name}/',
+ 'servers' => 'modules/servers/{$vendor}_{$name}/',
+ 'social' => 'modules/social/{$vendor}_{$name}/',
+ 'support' => 'modules/support/{$vendor}_{$name}/',
+ 'templates' => 'templates/{$vendor}_{$name}/',
+ 'includes' => 'includes/{$vendor}_{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php b/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php
new file mode 100644
index 00000000000..cb387881dc9
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php
@@ -0,0 +1,9 @@
+ 'wolf/plugins/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php b/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php
new file mode 100644
index 00000000000..91c46ad9961
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php
@@ -0,0 +1,12 @@
+ 'wp-content/plugins/{$name}/',
+ 'theme' => 'wp-content/themes/{$name}/',
+ 'muplugin' => 'wp-content/mu-plugins/{$name}/',
+ 'dropin' => 'wp-content/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php b/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php
new file mode 100644
index 00000000000..27f429ff218
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php
@@ -0,0 +1,32 @@
+ 'module/{$name}/',
+ );
+
+ /**
+ * Format package name to CamelCase
+ * @param array $vars
+ *
+ * @return array
+ */
+ public function inflectPackageVars($vars)
+ {
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
+
+ return $vars;
+ }
+}
\ No newline at end of file
diff --git a/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php b/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php
new file mode 100644
index 00000000000..bde9bc8c848
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php
@@ -0,0 +1,11 @@
+ 'library/{$name}/',
+ 'extra' => 'extras/library/{$name}/',
+ 'module' => 'module/{$name}/',
+ );
+}
diff --git a/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php b/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php
new file mode 100644
index 00000000000..56cdf5da75d
--- /dev/null
+++ b/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php
@@ -0,0 +1,10 @@
+ 'modules/{$vendor}-{$name}/',
+ 'theme' => 'themes/{$vendor}-{$name}/'
+ );
+}
diff --git a/vendor/composer/installers/src/bootstrap.php b/vendor/composer/installers/src/bootstrap.php
new file mode 100644
index 00000000000..0de276ee26c
--- /dev/null
+++ b/vendor/composer/installers/src/bootstrap.php
@@ -0,0 +1,13 @@
+ array(
+ 'version' => '2.9.1.0',
+ 'path' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php'
+ ),
+);
diff --git a/vendor/composer/jetpack_autoload_psr4.php b/vendor/composer/jetpack_autoload_psr4.php
new file mode 100644
index 00000000000..84d6e5f031e
--- /dev/null
+++ b/vendor/composer/jetpack_autoload_psr4.php
@@ -0,0 +1,21 @@
+ array(
+ 'version' => '1.10.0.0',
+ 'path' => array( $vendorDir . '/composer/installers/src/Composer/Installers' )
+ ),
+ 'Automattic\\WooCommerce\\Blocks\\' => array(
+ 'version' => '4.9.1.0',
+ 'path' => array( $baseDir . '/src' )
+ ),
+ 'Automattic\\Jetpack\\Autoloader\\' => array(
+ 'version' => '2.9.1.0',
+ 'path' => array( $vendorDir . '/automattic/jetpack-autoloader/src' )
+ ),
+);
diff --git a/vendor/jetpack-autoloader/class-autoloader-handler.php b/vendor/jetpack-autoloader/class-autoloader-handler.php
new file mode 100644
index 00000000000..f9084f0f8ae
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-autoloader-handler.php
@@ -0,0 +1,147 @@
+php_autoloader = $php_autoloader;
+ $this->hook_manager = $hook_manager;
+ $this->manifest_reader = $manifest_reader;
+ $this->version_selector = $version_selector;
+ }
+
+ /**
+ * Checks to see whether or not an autoloader is currently in the process of initializing.
+ *
+ * @return bool
+ */
+ public function is_initializing() {
+ // If no version has been set it means that no autoloader has started initializing yet.
+ global $jetpack_autoloader_latest_version;
+ if ( ! isset( $jetpack_autoloader_latest_version ) ) {
+ return false;
+ }
+
+ // When the version is set but the classmap is not it ALWAYS means that this is the
+ // latest autoloader and is being included by an older one.
+ global $jetpack_packages_classmap;
+ if ( empty( $jetpack_packages_classmap ) ) {
+ return true;
+ }
+
+ // Version 2.4.0 added a new global and altered the reset semantics. We need to check
+ // the other global as well since it may also point at initialization.
+ // Note: We don't need to check for the class first because every autoloader that
+ // will set the latest version global requires this class in the classmap.
+ $replacing_version = $jetpack_packages_classmap[ AutoloadGenerator::class ]['version'];
+ if ( $this->version_selector->is_dev_version( $replacing_version ) || version_compare( $replacing_version, '2.4.0.0', '>=' ) ) {
+ global $jetpack_autoloader_loader;
+ if ( ! isset( $jetpack_autoloader_loader ) ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Activates an autoloader using the given plugins and activates it.
+ *
+ * @param string[] $plugins The plugins to initialize the autoloader for.
+ */
+ public function activate_autoloader( $plugins ) {
+ global $jetpack_packages_psr4;
+ $jetpack_packages_psr4 = array();
+ $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
+
+ global $jetpack_packages_classmap;
+ $jetpack_packages_classmap = array();
+ $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_classmap.php', $jetpack_packages_classmap );
+
+ global $jetpack_packages_filemap;
+ $jetpack_packages_filemap = array();
+ $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_filemap.php', $jetpack_packages_filemap );
+
+ $loader = new Version_Loader(
+ $this->version_selector,
+ $jetpack_packages_classmap,
+ $jetpack_packages_psr4,
+ $jetpack_packages_filemap
+ );
+
+ $this->php_autoloader->register_autoloader( $loader );
+
+ // Now that the autoloader is active we can load the filemap.
+ $loader->load_filemap();
+ }
+
+ /**
+ * Resets the active autoloader and all related global state.
+ */
+ public function reset_autoloader() {
+ $this->php_autoloader->unregister_autoloader();
+ $this->hook_manager->reset();
+
+ // Clear all of the autoloader globals so that older autoloaders don't do anything strange.
+ global $jetpack_autoloader_latest_version;
+ $jetpack_autoloader_latest_version = null;
+
+ global $jetpack_packages_classmap;
+ $jetpack_packages_classmap = array(); // Must be array to avoid exceptions in old autoloaders!
+
+ global $jetpack_packages_psr4;
+ $jetpack_packages_psr4 = array(); // Must be array to avoid exceptions in old autoloaders!
+
+ global $jetpack_packages_filemap;
+ $jetpack_packages_filemap = array(); // Must be array to avoid exceptions in old autoloaders!
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-autoloader-locator.php b/vendor/jetpack-autoloader/class-autoloader-locator.php
new file mode 100644
index 00000000000..3d2b0b79cf1
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-autoloader-locator.php
@@ -0,0 +1,90 @@
+version_selector = $version_selector;
+ }
+
+ /**
+ * Finds the path to the plugin with the latest autoloader.
+ *
+ * @param array $plugin_paths An array of plugin paths.
+ * @param string $latest_version The latest version reference.
+ *
+ * @return string|null
+ */
+ public function find_latest_autoloader( $plugin_paths, &$latest_version ) {
+ $latest_plugin = null;
+
+ foreach ( $plugin_paths as $plugin_path ) {
+ $version = $this->get_autoloader_version( $plugin_path );
+ if ( ! $this->version_selector->is_version_update_required( $latest_version, $version ) ) {
+ continue;
+ }
+
+ $latest_version = $version;
+ $latest_plugin = $plugin_path;
+ }
+
+ return $latest_plugin;
+ }
+
+ /**
+ * Gets the path to the autoloader.
+ *
+ * @param string $plugin_path The path to the plugin.
+ *
+ * @return string
+ */
+ public function get_autoloader_path( $plugin_path ) {
+ return trailingslashit( $plugin_path ) . 'vendor/autoload_packages.php';
+ }
+
+ /**
+ * Gets the version for the autoloader.
+ *
+ * @param string $plugin_path The path to the plugin.
+ *
+ * @return string|null
+ */
+ public function get_autoloader_version( $plugin_path ) {
+ $classmap = trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
+ if ( ! file_exists( $classmap ) ) {
+ return null;
+ }
+
+ $classmap = require $classmap;
+ if ( isset( $classmap[ AutoloadGenerator::class ] ) ) {
+ return $classmap[ AutoloadGenerator::class ]['version'];
+ }
+
+ return null;
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-autoloader.php b/vendor/jetpack-autoloader/class-autoloader.php
new file mode 100644
index 00000000000..886e7cbc3f1
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-autoloader.php
@@ -0,0 +1,123 @@
+get( Autoloader_Handler::class );
+
+ // If the autoloader is already initializing it means that it has included us as the latest.
+ $was_included_by_autoloader = $autoloader_handler->is_initializing();
+
+ /** @var Plugin_Locator $plugin_locator */
+ $plugin_locator = $container->get( Plugin_Locator::class );
+
+ /** @var Plugins_Handler $plugins_handler */
+ $plugins_handler = $container->get( Plugins_Handler::class );
+
+ // The current plugin is the one that we are attempting to initialize here.
+ $current_plugin = $plugin_locator->find_current_plugin();
+
+ // The active plugins are those that we were able to discover on the site. This list will not
+ // include mu-plugins, those activated by code, or those who are hidden by filtering. We also
+ // want to take care to not consider the current plugin unknown if it was included by an
+ // autoloader. This avoids the case where a plugin will be marked "active" while deactivated
+ // due to it having the latest autoloader.
+ $active_plugins = $plugins_handler->get_active_plugins( true, ! $was_included_by_autoloader );
+
+ // The cached plugins are all of those that were active or discovered by the autoloader during a previous request.
+ // Note that it's possible this list will include plugins that have since been deactivated, but after a request
+ // the cache should be updated and the deactivated plugins will be removed.
+ $cached_plugins = $plugins_handler->get_cached_plugins();
+
+ // We combine the active list and cached list to preemptively load classes for plugins that are
+ // presently unknown but will be loaded during the request. While this may result in us considering packages in
+ // deactivated plugins there shouldn't be any problems as a result and the eventual consistency is sufficient.
+ $all_plugins = array_merge( $active_plugins, $cached_plugins );
+
+ // In particular we also include the current plugin to address the case where it is the latest autoloader
+ // but also unknown (and not cached). We don't want it in the active list because we don't know that it
+ // is active but we need it in the all plugins list so that it is considered by the autoloader.
+ $all_plugins[] = $current_plugin;
+
+ // We require uniqueness in the array to avoid processing the same plugin more than once.
+ $all_plugins = array_values( array_unique( $all_plugins ) );
+
+ /** @var Latest_Autoloader_Guard $guard */
+ $guard = $container->get( Latest_Autoloader_Guard::class );
+ if ( $guard->should_stop_init( $current_plugin, $all_plugins, $was_included_by_autoloader ) ) {
+ return;
+ }
+
+ // Initialize the autoloader using the handler now that we're ready.
+ $autoloader_handler->activate_autoloader( $all_plugins );
+
+ /** @var Hook_Manager $hook_manager */
+ $hook_manager = $container->get( Hook_Manager::class );
+
+ // When the active and cached plugin lists do not match we should
+ // update the cache. This will prevent plugins that have been
+ // deactivated from being considered in other requests.
+ $hook_manager->add_action(
+ 'shutdown',
+ function () use ( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) {
+ // Don't save a broken cache if an error happens during some plugin's initialization.
+ if ( ! did_action( 'plugins_loaded' ) ) {
+ // Ensure that the cache is emptied to prevent consecutive failures if the cache is to blame.
+ if ( ! empty( $cached_plugins ) ) {
+ $plugins_handler->cache_plugins( array() );
+ }
+
+ return;
+ }
+
+ // Load the active plugins fresh since the list we pulled earlier might not contain
+ // plugins that were activated but did not reset the autoloader. This happens
+ // when a plugin is in the cache but not "active" when the autoloader loads.
+ // We also want to make sure that plugins which are deactivating are not
+ // considered "active" so that they will be removed from the cache now.
+ $active_plugins = $plugins_handler->get_active_plugins( false, ! $was_included_by_autoloader );
+
+ // The paths should be sorted for easy comparisons with those loaded from the cache.
+ // Note we don't need to sort the cached entries because they're already sorted.
+ sort( $active_plugins );
+
+ // We don't want to waste time saving a cache that hasn't changed.
+ if ( $cached_plugins === $active_plugins ) {
+ return;
+ }
+
+ $plugins_handler->cache_plugins( $active_plugins );
+ }
+ );
+
+ // phpcs:enable Generic.Commenting.DocComment.MissingShort
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-container.php b/vendor/jetpack-autoloader/class-container.php
new file mode 100644
index 00000000000..61891971799
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-container.php
@@ -0,0 +1,149 @@
+ 'Hook_Manager',
+ );
+
+ /**
+ * A map of all the dependencies we've registered with the container and created.
+ *
+ * @var array
+ */
+ protected $dependencies;
+
+ /**
+ * The constructor.
+ */
+ public function __construct() {
+ $this->dependencies = array();
+
+ $this->register_shared_dependencies();
+ $this->register_dependencies();
+ $this->initialize_globals();
+ }
+
+ /**
+ * Gets a dependency out of the container.
+ *
+ * @param string $class The class to fetch.
+ *
+ * @return mixed
+ * @throws \InvalidArgumentException When a class that isn't registered with the container is fetched.
+ */
+ public function get( $class ) {
+ if ( ! isset( $this->dependencies[ $class ] ) ) {
+ throw new \InvalidArgumentException( "Class '$class' is not registered with the container." );
+ }
+
+ return $this->dependencies[ $class ];
+ }
+
+ /**
+ * Registers all of the dependencies that are shared between all instances of the autoloader.
+ */
+ private function register_shared_dependencies() {
+ global $jetpack_autoloader_container_shared;
+ if ( ! isset( $jetpack_autoloader_container_shared ) ) {
+ $jetpack_autoloader_container_shared = array();
+ }
+
+ $key = self::SHARED_DEPENDENCY_KEYS[ Hook_Manager::class ];
+ if ( ! isset( $jetpack_autoloader_container_shared[ $key ] ) ) {
+ require_once __DIR__ . '/class-hook-manager.php';
+ $jetpack_autoloader_container_shared[ $key ] = new Hook_Manager();
+ }
+ $this->dependencies[ Hook_Manager::class ] = &$jetpack_autoloader_container_shared[ $key ];
+ }
+
+ /**
+ * Registers all of the dependencies with the container.
+ */
+ private function register_dependencies() {
+ require_once __DIR__ . '/class-path-processor.php';
+ $this->dependencies[ Path_Processor::class ] = new Path_Processor();
+
+ require_once __DIR__ . '/class-plugin-locator.php';
+ $this->dependencies[ Plugin_Locator::class ] = new Plugin_Locator(
+ $this->get( Path_Processor::class )
+ );
+
+ require_once __DIR__ . '/class-version-selector.php';
+ $this->dependencies[ Version_Selector::class ] = new Version_Selector();
+
+ require_once __DIR__ . '/class-autoloader-locator.php';
+ $this->dependencies[ Autoloader_Locator::class ] = new Autoloader_Locator(
+ $this->get( Version_Selector::class )
+ );
+
+ require_once __DIR__ . '/class-php-autoloader.php';
+ $this->dependencies[ PHP_Autoloader::class ] = new PHP_Autoloader();
+
+ require_once __DIR__ . '/class-manifest-reader.php';
+ $this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
+ $this->get( Version_Selector::class )
+ );
+
+ require_once __DIR__ . '/class-plugins-handler.php';
+ $this->dependencies[ Plugins_Handler::class ] = new Plugins_Handler(
+ $this->get( Plugin_Locator::class ),
+ $this->get( Path_Processor::class )
+ );
+
+ require_once __DIR__ . '/class-autoloader-handler.php';
+ $this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
+ $this->get( PHP_Autoloader::class ),
+ $this->get( Hook_Manager::class ),
+ $this->get( Manifest_Reader::class ),
+ $this->get( Version_Selector::class )
+ );
+
+ require_once __DIR__ . '/class-latest-autoloader-guard.php';
+ $this->dependencies[ Latest_Autoloader_Guard::class ] = new Latest_Autoloader_Guard(
+ $this->get( Plugins_Handler::class ),
+ $this->get( Autoloader_Handler::class ),
+ $this->get( Autoloader_Locator::class )
+ );
+
+ // Register any classes that we will use elsewhere.
+ require_once __DIR__ . '/class-version-loader.php';
+ }
+
+ /**
+ * Initializes any of the globals needed by the autoloader.
+ */
+ private function initialize_globals() {
+ /*
+ * This global was retired in version 2.9. The value is set to 'false' to maintain
+ * compatibility with older versions of the autoloader.
+ */
+ global $jetpack_autoloader_including_latest;
+ $jetpack_autoloader_including_latest = false;
+
+ // Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
+ // but was not discoverable, we will record them in this array to track them as "active".
+ global $jetpack_autoloader_activating_plugins_paths;
+ if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
+ $jetpack_autoloader_activating_plugins_paths = array();
+ }
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-hook-manager.php b/vendor/jetpack-autoloader/class-hook-manager.php
new file mode 100644
index 00000000000..38e9e022caf
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-hook-manager.php
@@ -0,0 +1,76 @@
+registered_hooks = array();
+ }
+
+ /**
+ * Adds an action to WordPress and registers it internally.
+ *
+ * @param string $tag The name of the action which is hooked.
+ * @param callable $callable The function to call.
+ * @param int $priority Used to specify the priority of the action.
+ * @param int $accepted_args Used to specify the number of arguments the callable accepts.
+ */
+ public function add_action( $tag, $callable, $priority = 10, $accepted_args = 1 ) {
+ $this->registered_hooks[ $tag ][] = array(
+ 'priority' => $priority,
+ 'callable' => $callable,
+ );
+
+ add_action( $tag, $callable, $priority, $accepted_args );
+ }
+
+ /**
+ * Adds a filter to WordPress and registers it internally.
+ *
+ * @param string $tag The name of the filter which is hooked.
+ * @param callable $callable The function to call.
+ * @param int $priority Used to specify the priority of the filter.
+ * @param int $accepted_args Used to specify the number of arguments the callable accepts.
+ */
+ public function add_filter( $tag, $callable, $priority = 10, $accepted_args = 1 ) {
+ $this->registered_hooks[ $tag ][] = array(
+ 'priority' => $priority,
+ 'callable' => $callable,
+ );
+
+ add_filter( $tag, $callable, $priority, $accepted_args );
+ }
+
+ /**
+ * Removes all of the registered hooks.
+ */
+ public function reset() {
+ foreach ( $this->registered_hooks as $tag => $hooks ) {
+ foreach ( $hooks as $hook ) {
+ remove_filter( $tag, $hook['callable'], $hook['priority'] );
+ }
+ }
+ $this->registered_hooks = array();
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-latest-autoloader-guard.php b/vendor/jetpack-autoloader/class-latest-autoloader-guard.php
new file mode 100644
index 00000000000..9cd87c800f6
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-latest-autoloader-guard.php
@@ -0,0 +1,86 @@
+plugins_handler = $plugins_handler;
+ $this->autoloader_handler = $autoloader_handler;
+ $this->autoloader_locator = $autoloader_locator;
+ }
+
+ /**
+ * Indicates whether or not the autoloader should be initialized. Note that this function
+ * has the side-effect of actually loading the latest autoloader in the event that this
+ * is not it.
+ *
+ * @param string $current_plugin The current plugin we're checking.
+ * @param string[] $plugins The active plugins to check for autoloaders in.
+ * @param bool $was_included_by_autoloader Indicates whether or not this autoloader was included by another.
+ *
+ * @return bool True if we should stop initialization, otherwise false.
+ */
+ public function should_stop_init( $current_plugin, $plugins, $was_included_by_autoloader ) {
+ global $jetpack_autoloader_latest_version;
+
+ // We need to reset the autoloader when the plugins change because
+ // that means the autoloader was generated with a different list.
+ if ( $this->plugins_handler->have_plugins_changed( $plugins ) ) {
+ $this->autoloader_handler->reset_autoloader();
+ }
+
+ // When the latest autoloader has already been found we don't need to search for it again.
+ // We should take care however because this will also trigger if the autoloader has been
+ // included by an older one.
+ if ( isset( $jetpack_autoloader_latest_version ) && ! $was_included_by_autoloader ) {
+ return true;
+ }
+
+ $latest_plugin = $this->autoloader_locator->find_latest_autoloader( $plugins, $jetpack_autoloader_latest_version );
+ if ( isset( $latest_plugin ) && $latest_plugin !== $current_plugin ) {
+ require $this->autoloader_locator->get_autoloader_path( $latest_plugin );
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-manifest-reader.php b/vendor/jetpack-autoloader/class-manifest-reader.php
new file mode 100644
index 00000000000..6a48e8da97e
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-manifest-reader.php
@@ -0,0 +1,99 @@
+version_selector = $version_selector;
+ }
+
+ /**
+ * Reads all of the manifests in the given plugin paths.
+ *
+ * @param array $plugin_paths The paths to the plugins we're loading the manifest in.
+ * @param string $manifest_path The path that we're loading the manifest from in each plugin.
+ * @param array $path_map The path map to add the contents of the manifests to.
+ *
+ * @return array $path_map The path map we've built using the manifests in each plugin.
+ */
+ public function read_manifests( $plugin_paths, $manifest_path, &$path_map ) {
+ $file_paths = array_map(
+ function ( $path ) use ( $manifest_path ) {
+ return trailingslashit( $path ) . $manifest_path;
+ },
+ $plugin_paths
+ );
+
+ foreach ( $file_paths as $path ) {
+ $this->register_manifest( $path, $path_map );
+ }
+
+ return $path_map;
+ }
+
+ /**
+ * Registers a plugin's manifest file with the path map.
+ *
+ * @param string $manifest_path The absolute path to the manifest that we're loading.
+ * @param array $path_map The path map to add the contents of the manifest to.
+ */
+ protected function register_manifest( $manifest_path, &$path_map ) {
+ if ( ! is_readable( $manifest_path ) ) {
+ return;
+ }
+
+ $manifest = require $manifest_path;
+ if ( ! is_array( $manifest ) ) {
+ return;
+ }
+
+ foreach ( $manifest as $key => $data ) {
+ $this->register_record( $key, $data, $path_map );
+ }
+ }
+
+ /**
+ * Registers an entry from the manifest in the path map.
+ *
+ * @param string $key The identifier for the entry we're registering.
+ * @param array $data The data for the entry we're registering.
+ * @param array $path_map The path map to add the contents of the manifest to.
+ */
+ protected function register_record( $key, $data, &$path_map ) {
+ if ( isset( $path_map[ $key ]['version'] ) ) {
+ $selected_version = $path_map[ $key ]['version'];
+ } else {
+ $selected_version = null;
+ }
+
+ if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) {
+ $path_map[ $key ] = array(
+ 'version' => $data['version'],
+ 'path' => $data['path'],
+ );
+ }
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-path-processor.php b/vendor/jetpack-autoloader/class-path-processor.php
new file mode 100644
index 00000000000..0ddf9593713
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-path-processor.php
@@ -0,0 +1,194 @@
+get_normalized_constants();
+ foreach ( $constants as $constant => $constant_path ) {
+ $len = strlen( $constant_path );
+ if ( substr( $path, 0, $len ) !== $constant_path ) {
+ continue;
+ }
+
+ return substr_replace( $path, '{{' . $constant . '}}', 0, $len );
+ }
+
+ return $path;
+ }
+
+ /**
+ * Given a path this will replace any of the path constant tokens with the expanded path.
+ *
+ * @param string $tokenized_path The path we want to process.
+ *
+ * @return string The expanded path.
+ */
+ public function untokenize_path_constants( $tokenized_path ) {
+ $tokenized_path = wp_normalize_path( $tokenized_path );
+
+ $constants = $this->get_normalized_constants();
+ foreach ( $constants as $constant => $constant_path ) {
+ $constant = '{{' . $constant . '}}';
+
+ $len = strlen( $constant );
+ if ( substr( $tokenized_path, 0, $len ) !== $constant ) {
+ continue;
+ }
+
+ return $this->get_real_path( substr_replace( $tokenized_path, $constant_path, 0, $len ) );
+ }
+
+ return $tokenized_path;
+ }
+
+ /**
+ * Given a file and an array of places it might be, this will find the absolute path and return it.
+ *
+ * @param string $file The plugin or theme file to resolve.
+ * @param array $directories_to_check The directories we should check for the file if it isn't an absolute path.
+ *
+ * @return string|false Returns the absolute path to the directory, otherwise false.
+ */
+ public function find_directory_with_autoloader( $file, $directories_to_check ) {
+ $file = wp_normalize_path( $file );
+
+ if ( ! $this->is_absolute_path( $file ) ) {
+ $file = $this->find_absolute_plugin_path( $file, $directories_to_check );
+ if ( ! isset( $file ) ) {
+ return false;
+ }
+ }
+
+ // We need the real path for consistency with __DIR__ paths.
+ $file = $this->get_real_path( $file );
+
+ // phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
+ $directory = @is_file( $file ) ? dirname( $file ) : $file;
+ if ( ! @is_file( $directory . '/vendor/composer/jetpack_autoload_classmap.php' ) ) {
+ return false;
+ }
+ // phpcs:enable WordPress.PHP.NoSilencedErrors.Discouraged
+
+ return $directory;
+ }
+
+ /**
+ * Fetches an array of normalized paths keyed by the constant they came from.
+ *
+ * @return string[] The normalized paths keyed by the constant.
+ */
+ private function get_normalized_constants() {
+ $raw_constants = array(
+ // Order the constants from most-specific to least-specific.
+ 'WP_PLUGIN_DIR',
+ 'WPMU_PLUGIN_DIR',
+ 'WP_CONTENT_DIR',
+ 'ABSPATH',
+ );
+
+ $constants = array();
+ foreach ( $raw_constants as $raw ) {
+ if ( ! defined( $raw ) ) {
+ continue;
+ }
+
+ $path = wp_normalize_path( constant( $raw ) );
+ if ( isset( $path ) ) {
+ $constants[ $raw ] = $path;
+ }
+ }
+
+ return $constants;
+ }
+
+ /**
+ * Indicates whether or not a path is absolute.
+ *
+ * @param string $path The path to check.
+ *
+ * @return bool True if the path is absolute, otherwise false.
+ */
+ private function is_absolute_path( $path ) {
+ if ( 0 === strlen( $path ) || '.' === $path[0] ) {
+ return false;
+ }
+
+ // Absolute paths on Windows may begin with a drive letter.
+ if ( preg_match( '/^[a-zA-Z]:[\/\\\\]/', $path ) ) {
+ return true;
+ }
+
+ // A path starting with / or \ is absolute; anything else is relative.
+ return ( '/' === $path[0] || '\\' === $path[0] );
+ }
+
+ /**
+ * Given a file and a list of directories to check, this method will try to figure out
+ * the absolute path to the file in question.
+ *
+ * @param string $normalized_path The normalized path to the plugin or theme file to resolve.
+ * @param array $directories_to_check The directories we should check for the file if it isn't an absolute path.
+ *
+ * @return string|null The absolute path to the plugin file, otherwise null.
+ */
+ private function find_absolute_plugin_path( $normalized_path, $directories_to_check ) {
+ // We're only able to find the absolute path for plugin/theme PHP files.
+ if ( ! is_string( $normalized_path ) || '.php' !== substr( $normalized_path, -4 ) ) {
+ return null;
+ }
+
+ foreach ( $directories_to_check as $directory ) {
+ $normalized_check = wp_normalize_path( trailingslashit( $directory ) ) . $normalized_path;
+ // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
+ if ( @is_file( $normalized_check ) ) {
+ return $normalized_check;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Given a path this will figure out the real path that we should be using.
+ *
+ * @param string $path The path to resolve.
+ *
+ * @return string The resolved path.
+ */
+ private function get_real_path( $path ) {
+ // We want to resolve symbolic links for consistency with __DIR__ paths.
+ // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
+ $real_path = @realpath( $path );
+ if ( false === $real_path ) {
+ // Let the autoloader deal with paths that don't exist.
+ $real_path = $path;
+ }
+
+ // Using realpath will make it platform-specific so we must normalize it after.
+ if ( $path !== $real_path ) {
+ $real_path = wp_normalize_path( $real_path );
+ }
+
+ return $real_path;
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-php-autoloader.php b/vendor/jetpack-autoloader/class-php-autoloader.php
new file mode 100644
index 00000000000..528e2b12a1e
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-php-autoloader.php
@@ -0,0 +1,90 @@
+unregister_autoloader();
+
+ // Set the global so that it can be used to load classes.
+ global $jetpack_autoloader_loader;
+ $jetpack_autoloader_loader = $version_loader;
+
+ // Ensure that the autoloader is first to avoid contention with others.
+ spl_autoload_register( array( self::class, 'load_class' ), true, true );
+ }
+
+ /**
+ * Unregisters the active autoloader so that it will no longer autoload classes.
+ */
+ public function unregister_autoloader() {
+ // Remove any v2 autoloader that we've already registered.
+ $autoload_chain = spl_autoload_functions();
+ foreach ( $autoload_chain as $autoloader ) {
+ // We can identify a v2 autoloader using the namespace.
+ $namespace_check = null;
+
+ // Functions are recorded as strings.
+ if ( is_string( $autoloader ) ) {
+ $namespace_check = $autoloader;
+ } elseif ( is_array( $autoloader ) && is_string( $autoloader[0] ) ) {
+ // Static method calls have the class as the first array element.
+ $namespace_check = $autoloader[0];
+ } else {
+ // Since the autoloader has only ever been a function or a static method we don't currently need to check anything else.
+ continue;
+ }
+
+ // Check for the namespace without the generated suffix.
+ if ( 'Automattic\\Jetpack\\Autoloader\\jp' === substr( $namespace_check, 0, 32 ) ) {
+ spl_autoload_unregister( $autoloader );
+ }
+ }
+
+ // Clear the global now that the autoloader has been unregistered.
+ global $jetpack_autoloader_loader;
+ $jetpack_autoloader_loader = null;
+ }
+
+ /**
+ * Loads a class file if one could be found.
+ *
+ * Note: This function is static so that the autoloader can be easily unregistered. If
+ * it was a class method we would have to unwrap the object to check the namespace.
+ *
+ * @param string $class_name The name of the class to autoload.
+ *
+ * @return bool Indicates whether or not a class file was loaded.
+ */
+ public static function load_class( $class_name ) {
+ global $jetpack_autoloader_loader;
+ if ( ! isset( $jetpack_autoloader_loader ) ) {
+ return;
+ }
+
+ $file = $jetpack_autoloader_loader->find_class_file( $class_name );
+ if ( ! isset( $file ) ) {
+ return false;
+ }
+
+ require $file;
+ return true;
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-plugin-locator.php b/vendor/jetpack-autoloader/class-plugin-locator.php
new file mode 100644
index 00000000000..6c9a2f54937
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-plugin-locator.php
@@ -0,0 +1,153 @@
+path_processor = $path_processor;
+ }
+
+ /**
+ * Finds the path to the current plugin.
+ *
+ * @return string $path The path to the current plugin.
+ *
+ * @throws \RuntimeException If the current plugin does not have an autoloader.
+ */
+ public function find_current_plugin() {
+ // Escape from `vendor/__DIR__` to root plugin directory.
+ $plugin_directory = dirname( dirname( __DIR__ ) );
+
+ // Use the path processor to ensure that this is an autoloader we're referencing.
+ $path = $this->path_processor->find_directory_with_autoloader( $plugin_directory, array() );
+ if ( false === $path ) {
+ throw new \RuntimeException( 'Failed to locate plugin ' . $plugin_directory );
+ }
+
+ return $path;
+ }
+
+ /**
+ * Checks a given option for plugin paths.
+ *
+ * @param string $option_name The option that we want to check for plugin information.
+ * @param bool $site_option Indicates whether or not we want to check the site option.
+ *
+ * @return array $plugin_paths The list of absolute paths we've found.
+ */
+ public function find_using_option( $option_name, $site_option = false ) {
+ $raw = $site_option ? get_site_option( $option_name ) : get_option( $option_name );
+ if ( false === $raw ) {
+ return array();
+ }
+
+ return $this->convert_plugins_to_paths( $raw );
+ }
+
+ /**
+ * Checks for plugins in the `action` request parameter.
+ *
+ * @param string[] $allowed_actions The actions that we're allowed to return plugins for.
+ *
+ * @return array $plugin_paths The list of absolute paths we've found.
+ */
+ public function find_using_request_action( $allowed_actions ) {
+ // phpcs:disable WordPress.Security.NonceVerification.Recommended
+
+ /**
+ * Note: we're not actually checking the nonce here because it's too early
+ * in the execution. The pluggable functions are not yet loaded to give
+ * plugins a chance to plug their versions. Therefore we're doing the bare
+ * minimum: checking whether the nonce exists and it's in the right place.
+ * The request will fail later if the nonce doesn't pass the check.
+ */
+ if ( empty( $_REQUEST['_wpnonce'] ) ) {
+ return array();
+ }
+
+ $action = isset( $_REQUEST['action'] ) ? wp_unslash( $_REQUEST['action'] ) : false;
+ if ( ! in_array( $action, $allowed_actions, true ) ) {
+ return array();
+ }
+
+ $plugin_slugs = array();
+ switch ( $action ) {
+ case 'activate':
+ case 'deactivate':
+ if ( empty( $_REQUEST['plugin'] ) ) {
+ break;
+ }
+
+ $plugin_slugs[] = wp_unslash( $_REQUEST['plugin'] );
+ break;
+
+ case 'activate-selected':
+ case 'deactivate-selected':
+ if ( empty( $_REQUEST['checked'] ) ) {
+ break;
+ }
+
+ $plugin_slugs = wp_unslash( $_REQUEST['checked'] );
+ break;
+ }
+
+ // phpcs:enable WordPress.Security.NonceVerification.Recommended
+ return $this->convert_plugins_to_paths( $plugin_slugs );
+ }
+
+ /**
+ * Given an array of plugin slugs or paths, this will convert them to absolute paths and filter
+ * out the plugins that are not directory plugins. Note that array keys will also be included
+ * if they are plugin paths!
+ *
+ * @param string[] $plugins Plugin paths or slugs to filter.
+ *
+ * @return string[]
+ */
+ private function convert_plugins_to_paths( $plugins ) {
+ if ( ! is_array( $plugins ) || empty( $plugins ) ) {
+ return array();
+ }
+
+ // We're going to look for plugins in the standard directories.
+ $path_constants = array( WP_PLUGIN_DIR, WPMU_PLUGIN_DIR );
+
+ $plugin_paths = array();
+ foreach ( $plugins as $key => $value ) {
+ $path = $this->path_processor->find_directory_with_autoloader( $key, $path_constants );
+ if ( $path ) {
+ $plugin_paths[] = $path;
+ }
+
+ $path = $this->path_processor->find_directory_with_autoloader( $value, $path_constants );
+ if ( $path ) {
+ $plugin_paths[] = $path;
+ }
+ }
+
+ return $plugin_paths;
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-plugins-handler.php b/vendor/jetpack-autoloader/class-plugins-handler.php
new file mode 100644
index 00000000000..31a1349ad88
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-plugins-handler.php
@@ -0,0 +1,164 @@
+plugin_locator = $plugin_locator;
+ $this->path_processor = $path_processor;
+ }
+
+ /**
+ * Gets all of the active plugins we can find.
+ *
+ * @param bool $include_deactivating When true, plugins deactivating this request will be considered active.
+ * @param bool $record_unknown When true, the current plugin will be marked as active and recorded when unknown.
+ *
+ * @return string[]
+ */
+ public function get_active_plugins( $include_deactivating, $record_unknown ) {
+ global $jetpack_autoloader_activating_plugins_paths;
+
+ // We're going to build a unique list of plugins from a few different sources
+ // to find all of our "active" plugins. While we need to return an integer
+ // array, we're going to use an associative array internally to reduce
+ // the amount of time that we're going to spend checking uniqueness
+ // and merging different arrays together to form the output.
+ $active_plugins = array();
+
+ // Make sure that plugins which have activated this request are considered as "active" even though
+ // they probably won't be present in any option.
+ if ( is_array( $jetpack_autoloader_activating_plugins_paths ) ) {
+ foreach ( $jetpack_autoloader_activating_plugins_paths as $path ) {
+ $active_plugins[ $path ] = $path;
+ }
+ }
+
+ // This option contains all of the plugins that have been activated.
+ $plugins = $this->plugin_locator->find_using_option( 'active_plugins' );
+ foreach ( $plugins as $path ) {
+ $active_plugins[ $path ] = $path;
+ }
+
+ // This option contains all of the multisite plugins that have been activated.
+ if ( is_multisite() ) {
+ $plugins = $this->plugin_locator->find_using_option( 'active_sitewide_plugins', true );
+ foreach ( $plugins as $path ) {
+ $active_plugins[ $path ] = $path;
+ }
+ }
+
+ // These actions contain plugins that are being activated/deactivated during this request.
+ $plugins = $this->plugin_locator->find_using_request_action( array( 'activate', 'activate-selected', 'deactivate', 'deactivate-selected' ) );
+ foreach ( $plugins as $path ) {
+ $active_plugins[ $path ] = $path;
+ }
+
+ // When the current plugin isn't considered "active" there's a problem.
+ // Since we're here, the plugin is active and currently being loaded.
+ // We can support this case (mu-plugins and non-standard activation)
+ // by adding the current plugin to the active list and marking it
+ // as an unknown (activating) plugin. This also has the benefit
+ // of causing a reset because the active plugins list has
+ // been changed since it was saved in the global.
+ $current_plugin = $this->plugin_locator->find_current_plugin();
+ if ( $record_unknown && ! in_array( $current_plugin, $active_plugins, true ) ) {
+ $active_plugins[ $current_plugin ] = $current_plugin;
+ $jetpack_autoloader_activating_plugins_paths[] = $current_plugin;
+ }
+
+ // When deactivating plugins aren't desired we should entirely remove them from the active list.
+ if ( ! $include_deactivating ) {
+ // These actions contain plugins that are being deactivated during this request.
+ $plugins = $this->plugin_locator->find_using_request_action( array( 'deactivate', 'deactivate-selected' ) );
+ foreach ( $plugins as $path ) {
+ unset( $active_plugins[ $path ] );
+ }
+ }
+
+ // Transform the array so that we don't have to worry about the keys interacting with other array types later.
+ return array_values( $active_plugins );
+ }
+
+ /**
+ * Gets all of the cached plugins if there are any.
+ *
+ * @return string[]
+ */
+ public function get_cached_plugins() {
+ $cached = get_transient( self::TRANSIENT_KEY );
+ if ( ! is_array( $cached ) || empty( $cached ) ) {
+ return array();
+ }
+
+ // We need to expand the tokens to an absolute path for this webserver.
+ return array_map( array( $this->path_processor, 'untokenize_path_constants' ), $cached );
+ }
+
+ /**
+ * Saves the plugin list to the cache.
+ *
+ * @param array $plugins The plugin list to save to the cache.
+ */
+ public function cache_plugins( $plugins ) {
+ // We store the paths in a tokenized form so that that webservers with different absolute paths don't break.
+ $plugins = array_map( array( $this->path_processor, 'tokenize_path_constants' ), $plugins );
+
+ set_transient( self::TRANSIENT_KEY, $plugins );
+ }
+
+ /**
+ * Checks to see whether or not the plugin list given has changed when compared to the
+ * shared `$jetpack_autoloader_cached_plugin_paths` global. This allows us to deal
+ * with cases where the active list may change due to filtering..
+ *
+ * @param string[] $plugins The plugins list to check against the global cache.
+ *
+ * @return bool True if the plugins have changed, otherwise false.
+ */
+ public function have_plugins_changed( $plugins ) {
+ global $jetpack_autoloader_cached_plugin_paths;
+
+ if ( $jetpack_autoloader_cached_plugin_paths !== $plugins ) {
+ $jetpack_autoloader_cached_plugin_paths = $plugins;
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-version-loader.php b/vendor/jetpack-autoloader/class-version-loader.php
new file mode 100644
index 00000000000..2827c0c1786
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-version-loader.php
@@ -0,0 +1,164 @@
+version_selector = $version_selector;
+ $this->classmap = $classmap;
+ $this->psr4_map = $psr4_map;
+ $this->filemap = $filemap;
+ }
+
+ /**
+ * Finds the file path for the given class.
+ *
+ * @param string $class_name The class to find.
+ *
+ * @return string|null $file_path The path to the file if found, null if no class was found.
+ */
+ public function find_class_file( $class_name ) {
+ $data = $this->select_newest_file(
+ isset( $this->classmap[ $class_name ] ) ? $this->classmap[ $class_name ] : null,
+ $this->find_psr4_file( $class_name )
+ );
+ if ( ! isset( $data ) ) {
+ return null;
+ }
+
+ return $data['path'];
+ }
+
+ /**
+ * Load all of the files in the filemap.
+ */
+ public function load_filemap() {
+ if ( empty( $this->filemap ) ) {
+ return;
+ }
+
+ foreach ( $this->filemap as $file_identifier => $file_data ) {
+ if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
+ require_once $file_data['path'];
+
+ $GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
+ }
+ }
+ }
+
+ /**
+ * Compares different class sources and returns the newest.
+ *
+ * @param array|null $classmap_data The classmap class data.
+ * @param array|null $psr4_data The PSR-4 class data.
+ *
+ * @return array|null $data
+ */
+ private function select_newest_file( $classmap_data, $psr4_data ) {
+ if ( ! isset( $classmap_data ) ) {
+ return $psr4_data;
+ } elseif ( ! isset( $psr4_data ) ) {
+ return $classmap_data;
+ }
+
+ if ( $this->version_selector->is_version_update_required( $classmap_data['version'], $psr4_data['version'] ) ) {
+ return $psr4_data;
+ }
+
+ return $classmap_data;
+ }
+
+ /**
+ * Finds the file for a given class in a PSR-4 namespace.
+ *
+ * @param string $class_name The class to find.
+ *
+ * @return array|null $data The version and path path to the file if found, null otherwise.
+ */
+ private function find_psr4_file( $class_name ) {
+ if ( ! isset( $this->psr4_map ) ) {
+ return null;
+ }
+
+ // Don't bother with classes that have no namespace.
+ $class_index = strrpos( $class_name, '\\' );
+ if ( ! $class_index ) {
+ return null;
+ }
+ $class_for_path = str_replace( '\\', '/', $class_name );
+
+ // Search for the namespace by iteratively cutting off the last segment until
+ // we find a match. This allows us to check the most-specific namespaces
+ // first as well as minimize the amount of time spent looking.
+ for (
+ $class_namespace = substr( $class_name, 0, $class_index );
+ ! empty( $class_namespace );
+ $class_namespace = substr( $class_namespace, 0, strrpos( $class_namespace, '\\' ) )
+ ) {
+ $namespace = $class_namespace . '\\';
+ if ( ! isset( $this->psr4_map[ $namespace ] ) ) {
+ continue;
+ }
+ $data = $this->psr4_map[ $namespace ];
+
+ foreach ( $data['path'] as $path ) {
+ $path .= '/' . substr( $class_for_path, strlen( $namespace ) ) . '.php';
+ if ( file_exists( $path ) ) {
+ return array(
+ 'version' => $data['version'],
+ 'path' => $path,
+ );
+ }
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/vendor/jetpack-autoloader/class-version-selector.php b/vendor/jetpack-autoloader/class-version-selector.php
new file mode 100644
index 00000000000..4927e769e2a
--- /dev/null
+++ b/vendor/jetpack-autoloader/class-version-selector.php
@@ -0,0 +1,69 @@
+is_dev_version( $selected_version ) ) {
+ return false;
+ }
+
+ if ( $this->is_dev_version( $compare_version ) ) {
+ if ( $use_dev_versions ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ if ( version_compare( $selected_version, $compare_version, '<' ) ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks whether the given package version is a development version.
+ *
+ * @param String $version The package version.
+ *
+ * @return bool True if the version is a dev version, else false.
+ */
+ public function is_dev_version( $version ) {
+ if ( 'dev-' === substr( $version, 0, 4 ) || '9999999-dev' === $version ) {
+ return true;
+ }
+
+ return false;
+ }
+}