Adding /vendor directory to release
This commit is contained in:
parent
7ecf15b326
commit
9e2579be15
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload.php @generated by Composer
|
||||||
|
|
||||||
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
|
return ComposerAutoloaderInitf32f2e00289926aaf591fe7ce2891b1d::getLoader();
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by automattic/jetpack-autoloader.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack\Autoloader\jp815af2e0096699aca34ac981c50a898f;
|
||||||
|
|
||||||
|
// phpcs:ignore
|
||||||
|
|
||||||
|
require_once trailingslashit( dirname( __FILE__ ) ) . 'jetpack-autoloader/autoload_functions.php';
|
||||||
|
|
||||||
|
set_up_autoloader();
|
|
@ -0,0 +1,46 @@
|
||||||
|
A custom autoloader for Composer
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
This is a custom autoloader generator that uses a classmap to always load the latest version of a class.
|
||||||
|
|
||||||
|
The problem this autoloader is trying to solve is conflicts that arise when two or more plugins use the same package, but one of the plugins uses an older version of said package.
|
||||||
|
|
||||||
|
This is solved by keeping an in memory map of all the different classes that can be loaded, and updating the map with the path to the latest version of the package for the autoloader to find when we instantiate the class.
|
||||||
|
This only works if we instantiate the class after all the plugins have loaded. That is why the class produces an error if the plugin calls a class but has not loaded all the plugins yet.
|
||||||
|
|
||||||
|
It diverges from the default Composer autoloader setup in the following ways:
|
||||||
|
|
||||||
|
* It creates an `autoload_classmap_package.php` file in the `vendor/composer` directory.
|
||||||
|
* This file includes the version numbers from each package that is used.
|
||||||
|
* The autoloader will only load the latest version of the library no matter what plugin loads the library.
|
||||||
|
* Only call the library classes after all the plugins have loaded and the `plugins_loaded` action has fired.
|
||||||
|
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
|
||||||
|
In your project's `composer.json`, add the following lines:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"require-dev": {
|
||||||
|
"automattic/jetpack-autoloader": "^1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
After the next update/install, you will have a `vendor/autoload_packages.php` file.
|
||||||
|
Load the file in your plugin via main plugin file.
|
||||||
|
|
||||||
|
In the main plugin you will also need to include the files like this.
|
||||||
|
```php
|
||||||
|
require_once . plugin_dir_path( __FILE__ ) . '/vendor/autoload_packages.php';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Current Limitations
|
||||||
|
-----
|
||||||
|
|
||||||
|
We currently only support packages that autoload via psr-4 definition in their package.
|
||||||
|
|
||||||
|
Your project must use the default composer vendor directory, `vendor`.
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"name": "automattic/jetpack-autoloader",
|
||||||
|
"description": "Creates a custom autoloader for a plugin or theme.",
|
||||||
|
"type": "composer-plugin",
|
||||||
|
"license": "GPL-2.0-or-later",
|
||||||
|
"require": {
|
||||||
|
"composer-plugin-api": "^1.1 || ^2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Automattic\\Jetpack\\Autoloader\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"phpunit": [
|
||||||
|
"@composer install",
|
||||||
|
"./vendor/phpunit/phpunit/phpunit --colors=always"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
|
@ -0,0 +1,365 @@
|
||||||
|
<?php // phpcs:ignore WordPress.Files.FileName
|
||||||
|
/**
|
||||||
|
* Autoloader Generator.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_useFound
|
||||||
|
// phpcs:disable PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound
|
||||||
|
// phpcs:disable PHPCompatibility.FunctionDeclarations.NewClosure.Found
|
||||||
|
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_namespaceFound
|
||||||
|
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_dirFound
|
||||||
|
// phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
|
// phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
|
// phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_var_export
|
||||||
|
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents
|
||||||
|
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_read_fopen
|
||||||
|
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_read_fwrite
|
||||||
|
// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
|
// phpcs:disable WordPress.NamingConventions.ValidVariableName.InterpolatedVariableNotSnakeCase
|
||||||
|
// phpcs:disable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
|
||||||
|
// phpcs:disable WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase
|
||||||
|
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack\Autoloader;
|
||||||
|
|
||||||
|
use Composer\Autoload\AutoloadGenerator as BaseGenerator;
|
||||||
|
use Composer\Autoload\ClassMapGenerator;
|
||||||
|
use Composer\Config;
|
||||||
|
use Composer\Installer\InstallationManager;
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
|
use Composer\Package\PackageInterface;
|
||||||
|
use Composer\Repository\InstalledRepositoryInterface;
|
||||||
|
use Composer\Util\Filesystem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AutoloadGenerator.
|
||||||
|
*/
|
||||||
|
class AutoloadGenerator extends BaseGenerator {
|
||||||
|
|
||||||
|
const COMMENT = <<<AUTOLOADER_COMMENT
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by automattic/jetpack-autoloader.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
AUTOLOADER_COMMENT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate an AutoloadGenerator object.
|
||||||
|
*
|
||||||
|
* @param IOInterface $io IO object.
|
||||||
|
*/
|
||||||
|
public function __construct( IOInterface $io = null ) {
|
||||||
|
$this->io = $io;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dump the autoloader.
|
||||||
|
*
|
||||||
|
* @param Config $config Config object.
|
||||||
|
* @param InstalledRepositoryInterface $localRepo Installed Reposetories 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 $scanPsr0Packages Whether to search for packages. Currently hard coded to always be false.
|
||||||
|
* @param string $suffix The autoloader suffix.
|
||||||
|
*/
|
||||||
|
public function dump(
|
||||||
|
Config $config,
|
||||||
|
InstalledRepositoryInterface $localRepo,
|
||||||
|
PackageInterface $mainPackage,
|
||||||
|
InstallationManager $installationManager,
|
||||||
|
$targetDir,
|
||||||
|
$scanPsr0Packages = null, // Not used we always optimize.
|
||||||
|
$suffix = null
|
||||||
|
) {
|
||||||
|
|
||||||
|
$filesystem = new Filesystem();
|
||||||
|
$filesystem->ensureDirectoryExists( $config->get( 'vendor-dir' ) );
|
||||||
|
|
||||||
|
$basePath = $filesystem->normalizePath( realpath( getcwd() ) );
|
||||||
|
$vendorPath = $filesystem->normalizePath( realpath( $config->get( 'vendor-dir' ) ) );
|
||||||
|
$targetDir = $vendorPath . '/' . $targetDir;
|
||||||
|
$filesystem->ensureDirectoryExists( $targetDir );
|
||||||
|
|
||||||
|
$packageMap = $this->buildPackageMap( $installationManager, $mainPackage, $localRepo->getCanonicalPackages() );
|
||||||
|
$autoloads = $this->parseAutoloads( $packageMap, $mainPackage );
|
||||||
|
|
||||||
|
$classMap = $this->getClassMap( $autoloads, $filesystem, $vendorPath, $basePath );
|
||||||
|
$fileMap = $this->getFileMap( $autoloads, $filesystem, $vendorPath, $basePath );
|
||||||
|
|
||||||
|
// Remove a file that was generated in versions 2.0.0 to 2.1.0.
|
||||||
|
$filesystem->remove( $vendorPath . '/autoload_functions.php' );
|
||||||
|
|
||||||
|
// Generate the files.
|
||||||
|
file_put_contents( $targetDir . '/jetpack_autoload_classmap.php', $this->getAutoloadClassmapPackagesFile( $classMap ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $targetDir . '/jetpack_autoload_classmap.php</info>', true );
|
||||||
|
|
||||||
|
file_put_contents( $targetDir . '/jetpack_autoload_filemap.php', $this->getAutoloadFilesPackagesFile( $fileMap ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $targetDir . '/jetpack_autoload_filemap.php</info>', true );
|
||||||
|
|
||||||
|
file_put_contents( $vendorPath . '/autoload_packages.php', $this->getAutoloadPackageFile( 'autoload.php', $suffix ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $vendorPath . '/autoload_packages.php</info>', true );
|
||||||
|
|
||||||
|
$jetpackAutoloaderDir = $vendorPath . '/jetpack-autoloader';
|
||||||
|
$filesystem->ensureDirectoryExists( $jetpackAutoloaderDir );
|
||||||
|
file_put_contents( $jetpackAutoloaderDir . '/autoload_functions.php', $this->getAutoloadPackageFile( 'functions.php', $suffix ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $jetpackAutoloaderDir . '/jetpack-autoloader/autoload_functions.php</info>', true );
|
||||||
|
|
||||||
|
file_put_contents( $vendorPath . '/class-autoloader-handler.php', $this->getAutoloadPackageFile( 'class-autoloader-handler.php', $suffix ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-autoloader-handler.php</info>', true );
|
||||||
|
|
||||||
|
file_put_contents( $vendorPath . '/class-classes-handler.php', $this->getAutoloadPackageFile( 'class-classes-handler.php', $suffix ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-classes-handler.php</info>', true );
|
||||||
|
|
||||||
|
file_put_contents( $vendorPath . '/class-files-handler.php', $this->getAutoloadPackageFile( 'class-files-handler.php', $suffix ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-files-handler.php</info>', true );
|
||||||
|
|
||||||
|
file_put_contents( $vendorPath . '/class-plugins-handler.php', $this->getAutoloadPackageFile( 'class-plugins-handler.php', $suffix ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-plugins-handler.php</info>', true );
|
||||||
|
|
||||||
|
file_put_contents( $vendorPath . '/class-version-selector.php', $this->getAutoloadPackageFile( 'class-version-selector.php', $suffix ) );
|
||||||
|
$this->io->writeError( '<info>Generated ' . $vendorPath . '/class-version-selector.php</info>', 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.
|
||||||
|
*
|
||||||
|
* Currently supports only psr-4 and clasmap parsing.
|
||||||
|
*
|
||||||
|
* @param array $packageMap Map of all the packages.
|
||||||
|
* @param string $type Type of autoloader to use, currently not used, since we only support psr-4.
|
||||||
|
* @param PackageInterface $mainPackage Instance of the Package Object.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function parseAutoloadsType( array $packageMap, $type, PackageInterface $mainPackage ) {
|
||||||
|
$autoloads = array();
|
||||||
|
|
||||||
|
if ( 'psr-4' !== $type && 'classmap' !== $type && 'files' !== $type ) {
|
||||||
|
return parent::parseAutoloadsType( $packageMap, $type, $mainPackage );
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ( 'psr-4' === $type && isset( $autoload['psr-4'] ) && is_array( $autoload['psr-4'] ) ) {
|
||||||
|
foreach ( $autoload['psr-4'] 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 $file_id => $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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take the autoloads array and return the classMap that contains the path and the version for each namespace.
|
||||||
|
*
|
||||||
|
* @param array $autoloads Array of autoload settings defined defined by the packages.
|
||||||
|
* @param Filesystem $filesystem Filesystem class instance.
|
||||||
|
* @param string $vendorPath Path to the vendor directory.
|
||||||
|
* @param string $basePath Base Path.
|
||||||
|
*
|
||||||
|
* @return string $classMap
|
||||||
|
*/
|
||||||
|
private function getClassMap( array $autoloads, Filesystem $filesystem, $vendorPath, $basePath ) {
|
||||||
|
$blacklist = null;
|
||||||
|
|
||||||
|
if ( ! empty( $autoloads['exclude-from-classmap'] ) ) {
|
||||||
|
$blacklist = '{(' . implode( '|', $autoloads['exclude-from-classmap'] ) . ')}';
|
||||||
|
}
|
||||||
|
|
||||||
|
$classmapString = '';
|
||||||
|
|
||||||
|
// Scan the PSR-4 and classmap directories for class files, and add them to the class map.
|
||||||
|
foreach ( $autoloads['psr-4'] as $namespace => $packages_info ) {
|
||||||
|
foreach ( $packages_info as $package ) {
|
||||||
|
$dir = $filesystem->normalizePath(
|
||||||
|
$filesystem->isAbsolutePath( $package['path'] )
|
||||||
|
? $package['path']
|
||||||
|
: $basePath . '/' . $package['path']
|
||||||
|
);
|
||||||
|
$namespace = empty( $namespace ) ? null : $namespace;
|
||||||
|
$map = ClassMapGenerator::createMap( $dir, $blacklist, $this->io, $namespace );
|
||||||
|
|
||||||
|
foreach ( $map as $class => $path ) {
|
||||||
|
$classCode = var_export( $class, true );
|
||||||
|
$pathCode = $this->getPathCode( $filesystem, $basePath, $vendorPath, $path );
|
||||||
|
$versionCode = var_export( $package['version'], true );
|
||||||
|
$classmapString .= <<<CLASS_CODE
|
||||||
|
$classCode => array(
|
||||||
|
'version' => $versionCode,
|
||||||
|
'path' => $pathCode
|
||||||
|
),
|
||||||
|
CLASS_CODE;
|
||||||
|
$classmapString .= PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $autoloads['classmap'] as $package ) {
|
||||||
|
$dir = $filesystem->normalizePath(
|
||||||
|
$filesystem->isAbsolutePath( $package['path'] )
|
||||||
|
? $package['path']
|
||||||
|
: $basePath . '/' . $package['path']
|
||||||
|
);
|
||||||
|
$map = ClassMapGenerator::createMap( $dir, $blacklist, $this->io, null );
|
||||||
|
|
||||||
|
foreach ( $map as $class => $path ) {
|
||||||
|
$classCode = var_export( $class, true );
|
||||||
|
$pathCode = $this->getPathCode( $filesystem, $basePath, $vendorPath, $path );
|
||||||
|
$versionCode = var_export( $package['version'], true );
|
||||||
|
$classmapString .= <<<CLASS_CODE
|
||||||
|
$classCode => array(
|
||||||
|
'version' => $versionCode,
|
||||||
|
'path' => $pathCode
|
||||||
|
),
|
||||||
|
CLASS_CODE;
|
||||||
|
$classmapString .= PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'array( ' . PHP_EOL . $classmapString . ');' . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the PHP that will be used in the autoload_classmap_package.php files.
|
||||||
|
*
|
||||||
|
* @param string $classMap class map array string that is to be written out to the file.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getAutoloadClassmapPackagesFile( $classMap ) {
|
||||||
|
|
||||||
|
return <<<INCLUDE_CLASSMAP
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// This file `autoload_classmap_packages.php` was auto generated by automattic/jetpack-autoloader.
|
||||||
|
|
||||||
|
\$vendorDir = dirname(__DIR__);
|
||||||
|
\$baseDir = dirname(\$vendorDir);
|
||||||
|
|
||||||
|
return $classMap
|
||||||
|
|
||||||
|
INCLUDE_CLASSMAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take the autoloads array and return the fileMap that contains the path and the version for each namespace.
|
||||||
|
*
|
||||||
|
* @param array $autoloads Array of autoload settings defined defined by the packages.
|
||||||
|
* @param Filesystem $filesystem Filesystem class instance.
|
||||||
|
* @param string $vendorPath Path to the vendor directory.
|
||||||
|
* @param string $basePath Base Path.
|
||||||
|
*
|
||||||
|
* @return string $fileMap
|
||||||
|
*/
|
||||||
|
private function getFileMap( array $autoloads, Filesystem $filesystem, $vendorPath, $basePath ) {
|
||||||
|
$fileMapString = '';
|
||||||
|
foreach ( $autoloads['files'] as $file_id => $package ) {
|
||||||
|
$key = var_export( $file_id, true );
|
||||||
|
$pathCode = $this->getPathCode( $filesystem, $basePath, $vendorPath, $package['path'] );
|
||||||
|
$versionCode = var_export( $package['version'], true );
|
||||||
|
$fileMapString .= <<<FILE_CODE
|
||||||
|
$key => array(
|
||||||
|
'version' => $versionCode,
|
||||||
|
'path' => $pathCode
|
||||||
|
),
|
||||||
|
FILE_CODE;
|
||||||
|
$fileMapString .= PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'array( ' . PHP_EOL . $fileMapString . ');' . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the PHP that will be used in the autoload_files_package.php files.
|
||||||
|
*
|
||||||
|
* @param string $filesMap files array as string that is to be written out to the file.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getAutoloadFilesPackagesFile( $filesMap ) {
|
||||||
|
|
||||||
|
return <<<INCLUDE_FILEMAP
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// This file `autoload_files_packages.php` was auto generated by automattic/jetpack-autoloader.
|
||||||
|
|
||||||
|
\$vendorDir = dirname(__DIR__);
|
||||||
|
\$baseDir = dirname(\$vendorDir);
|
||||||
|
|
||||||
|
return $filesMap
|
||||||
|
|
||||||
|
INCLUDE_FILEMAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the PHP that will be used in the autoload_packages.php files.
|
||||||
|
*
|
||||||
|
* @param String $filename a file to prepare.
|
||||||
|
* @param String $suffix Unique suffix used in the namespace.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getAutoloadPackageFile( $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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
<?php //phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase
|
||||||
|
/**
|
||||||
|
* Custom Autoloader Composer Plugin, hooks into composer events to generate the custom autoloader.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_useFound
|
||||||
|
// phpcs:disable PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound
|
||||||
|
// phpcs:disable PHPCompatibility.Keywords.NewKeywords.t_namespaceFound
|
||||||
|
// phpcs:disable WordPress.Files.FileName.NotHyphenatedLowercase
|
||||||
|
// phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
|
// phpcs:disable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack\Autoloader;
|
||||||
|
|
||||||
|
use Composer\Composer;
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
|
use Composer\Script\Event;
|
||||||
|
use Composer\Script\ScriptEvents;
|
||||||
|
use Composer\Plugin\PluginInterface;
|
||||||
|
use Composer\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CustomAutoloaderPlugin.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
class CustomAutoloaderPlugin implements PluginInterface, EventSubscriberInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IO object.
|
||||||
|
*
|
||||||
|
* @var IOInterface IO object.
|
||||||
|
*/
|
||||||
|
private $io;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Composer object.
|
||||||
|
*
|
||||||
|
* @var Composer Composer object.
|
||||||
|
*/
|
||||||
|
private $composer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do nothing.
|
||||||
|
*
|
||||||
|
* @param Composer $composer Composer object.
|
||||||
|
* @param IOInterface $io IO object.
|
||||||
|
*/
|
||||||
|
public function activate( Composer $composer, IOInterface $io ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
||||||
|
$this->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 ) {
|
||||||
|
|
||||||
|
$config = $this->composer->getConfig();
|
||||||
|
|
||||||
|
if ( 'vendor' !== $config->raw()['config']['vendor-dir'] ) {
|
||||||
|
$this->io->writeError( "\n<error>An 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.</error>', true );
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$installationManager = $this->composer->getInstallationManager();
|
||||||
|
$repoManager = $this->composer->getRepositoryManager();
|
||||||
|
$localRepo = $repoManager->getLocalRepository();
|
||||||
|
$package = $this->composer->getPackage();
|
||||||
|
$optimize = true;
|
||||||
|
$suffix = $config->get( 'autoloader-suffix' )
|
||||||
|
? $config->get( 'autoloader-suffix' )
|
||||||
|
: md5( uniqid( '', true ) );
|
||||||
|
|
||||||
|
$generator = new AutoloadGenerator( $this->io );
|
||||||
|
|
||||||
|
$generator->dump( $config, $localRepo, $package, $installationManager, 'composer', $optimize, $suffix );
|
||||||
|
$this->generated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
/* HEADER */ // phpcs:ignore
|
||||||
|
|
||||||
|
require_once trailingslashit( dirname( __FILE__ ) ) . 'jetpack-autoloader/autoload_functions.php';
|
||||||
|
|
||||||
|
set_up_autoloader();
|
|
@ -0,0 +1,132 @@
|
||||||
|
<?php
|
||||||
|
/* HEADER */ // phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class selects the package version for the autoloader.
|
||||||
|
*/
|
||||||
|
class Autoloader_Handler {
|
||||||
|
|
||||||
|
// The name of the autoloader function registered by v1.* autoloaders.
|
||||||
|
const V1_AUTOLOADER_NAME = 'Automattic\Jetpack\Autoloader\autoloader';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The autoloader function for v2.* autoloaders is named __NAMESPACE__ . \autoloader.
|
||||||
|
* The namespace is defined in AutoloadGenerator as
|
||||||
|
* 'Automattic\Jetpack\Autoloader\jp' plus a unique suffix.
|
||||||
|
*/
|
||||||
|
const V2_AUTOLOADER_BASE = 'Automattic\Jetpack\Autoloader\jp';
|
||||||
|
|
||||||
|
const AUTOLOAD_GENERATOR_CLASS_NAME = 'Automattic\Jetpack\Autoloader\AutoloadGenerator';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Plugins_Handler object.
|
||||||
|
*
|
||||||
|
* @var Plugins_Handler
|
||||||
|
*/
|
||||||
|
private $plugins_handler = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Version_Selector object.
|
||||||
|
*
|
||||||
|
* @var Version_Selector
|
||||||
|
*/
|
||||||
|
private $version_selector = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
*
|
||||||
|
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
||||||
|
* @param Version_Selector $version_selector The Version_Selector object.
|
||||||
|
*/
|
||||||
|
public function __construct( $plugins_handler, $version_selector ) {
|
||||||
|
$this->plugins_handler = $plugins_handler;
|
||||||
|
$this->version_selector = $version_selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the latest installed autoloader.
|
||||||
|
*/
|
||||||
|
public function find_latest_autoloader() {
|
||||||
|
global $jetpack_autoloader_latest_version;
|
||||||
|
|
||||||
|
$current_autoloader_path = trailingslashit( dirname( __FILE__ ) ) . 'autoload_packages.php';
|
||||||
|
$current_autoloader_path = str_replace( '\\', '/', $current_autoloader_path );
|
||||||
|
|
||||||
|
$selected_autoloader_version = null;
|
||||||
|
$selected_autoloader_path = null;
|
||||||
|
|
||||||
|
$active_plugins_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
||||||
|
|
||||||
|
foreach ( $active_plugins_paths as $plugin_path ) {
|
||||||
|
$classmap_path = trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
|
||||||
|
|
||||||
|
if ( file_exists( $classmap_path ) ) {
|
||||||
|
$packages = require $classmap_path;
|
||||||
|
|
||||||
|
$compare_version = $packages[ self::AUTOLOAD_GENERATOR_CLASS_NAME ]['version'];
|
||||||
|
$compare_path = trailingslashit( $plugin_path ) . 'vendor/autoload_packages.php';
|
||||||
|
|
||||||
|
if ( $this->version_selector->is_version_update_required( $selected_autoloader_version, $compare_version ) ) {
|
||||||
|
$selected_autoloader_version = $compare_version;
|
||||||
|
$selected_autoloader_path = $compare_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$jetpack_autoloader_latest_version = $selected_autoloader_version;
|
||||||
|
|
||||||
|
// $current_autoloader_path is already loaded
|
||||||
|
if ( $current_autoloader_path !== $selected_autoloader_path ) {
|
||||||
|
require $selected_autoloader_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get this autoloader's package version.
|
||||||
|
*
|
||||||
|
* @return String The autoloader's package version.
|
||||||
|
*/
|
||||||
|
public function get_current_autoloader_version() {
|
||||||
|
$classmap_file = trailingslashit( dirname( __FILE__ ) ) . 'composer/jetpack_autoload_classmap.php';
|
||||||
|
$autoloader_packages = require $classmap_file;
|
||||||
|
|
||||||
|
return $autoloader_packages[ self::AUTOLOAD_GENERATOR_CLASS_NAME ]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the spl autoloader chain:
|
||||||
|
* - Registers this namespace's autoloader function.
|
||||||
|
* - If a v1 autoloader function is registered, moves it to the end of the chain.
|
||||||
|
* - Removes any other v2 autoloader functions that have already been registered. This
|
||||||
|
* can occur when the autoloader is being reset by an activating plugin.
|
||||||
|
*/
|
||||||
|
public function update_autoloader_chain() {
|
||||||
|
spl_autoload_register( __NAMESPACE__ . '\autoloader' );
|
||||||
|
|
||||||
|
$autoload_chain = spl_autoload_functions();
|
||||||
|
|
||||||
|
foreach ( $autoload_chain as $autoloader ) {
|
||||||
|
if ( ! is_string( $autoloader ) ) {
|
||||||
|
/*
|
||||||
|
* The Jetpack Autoloader functions are registered as strings, so
|
||||||
|
* just continue if $autoloader isn't a string.
|
||||||
|
*/
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( self::V1_AUTOLOADER_NAME === $autoloader ) {
|
||||||
|
// Move the v1.* autoloader function to the end of the spl autoloader chain.
|
||||||
|
spl_autoload_unregister( $autoloader );
|
||||||
|
spl_autoload_register( $autoloader );
|
||||||
|
|
||||||
|
} elseif (
|
||||||
|
self::V2_AUTOLOADER_BASE === substr( $autoloader, 0, strlen( self::V2_AUTOLOADER_BASE ) )
|
||||||
|
&& __NAMESPACE__ !== substr( $autoloader, 0, strlen( __NAMESPACE__ ) )
|
||||||
|
) {
|
||||||
|
// Unregister any other v2.* autoloader functions if they're in the chain.
|
||||||
|
spl_autoload_unregister( $autoloader );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
<?php
|
||||||
|
/* HEADER */ // phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class selects the package versions for the package classes.
|
||||||
|
*/
|
||||||
|
class Classes_Handler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Plugins_Handler object.
|
||||||
|
*
|
||||||
|
* @var Plugins_Handler
|
||||||
|
*/
|
||||||
|
private $plugins_handler = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Version_Selector object.
|
||||||
|
*
|
||||||
|
* @var Version_Selector
|
||||||
|
*/
|
||||||
|
private $version_selector = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
*
|
||||||
|
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
||||||
|
* @param Version_Selector $version_selector The Version_Selector object.
|
||||||
|
*/
|
||||||
|
public function __construct( $plugins_handler, $version_selector ) {
|
||||||
|
$this->plugins_handler = $plugins_handler;
|
||||||
|
$this->version_selector = $version_selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the version of a package to the $jetpack_packages_classmap global
|
||||||
|
* array so that the autoloader is able to find it.
|
||||||
|
*
|
||||||
|
* @param string $class_name Name of the class that you want to autoload.
|
||||||
|
* @param string $version Version of the class.
|
||||||
|
* @param string $path Absolute path to the class so that we can load it.
|
||||||
|
*/
|
||||||
|
public function enqueue_package_class( $class_name, $version, $path ) {
|
||||||
|
global $jetpack_packages_classmap;
|
||||||
|
|
||||||
|
if ( isset( $jetpack_packages_classmap[ $class_name ]['version'] ) ) {
|
||||||
|
$selected_version = $jetpack_packages_classmap[ $class_name ]['version'];
|
||||||
|
} else {
|
||||||
|
$selected_version = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
|
||||||
|
$jetpack_packages_classmap[ $class_name ] = array(
|
||||||
|
'version' => $version,
|
||||||
|
'path' => $path,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the path to the plugin's classmap file. The classmap filename is the filename
|
||||||
|
* generated by Jetpack Autoloader version >= 2.0.
|
||||||
|
*
|
||||||
|
* @param String $plugin_path The plugin path.
|
||||||
|
*
|
||||||
|
* @return String the classmap path.
|
||||||
|
*/
|
||||||
|
public function create_classmap_path( $plugin_path ) {
|
||||||
|
return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the classmap.
|
||||||
|
*/
|
||||||
|
public function set_class_paths() {
|
||||||
|
$active_plugins_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
||||||
|
$classmap_paths = array_map( array( $this, 'create_classmap_path' ), $active_plugins_paths );
|
||||||
|
|
||||||
|
foreach ( $classmap_paths as $path ) {
|
||||||
|
if ( is_readable( $path ) ) {
|
||||||
|
$class_map = require $path;
|
||||||
|
|
||||||
|
if ( is_array( $class_map ) ) {
|
||||||
|
foreach ( $class_map as $class_name => $class_info ) {
|
||||||
|
$this->enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
<?php
|
||||||
|
/* HEADER */ // phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class selects the package versions for the package files.
|
||||||
|
*/
|
||||||
|
class Files_Handler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Plugins_Handler object.
|
||||||
|
*
|
||||||
|
* @var Plugins_Handler
|
||||||
|
*/
|
||||||
|
private $plugins_handler = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Version_Selector object.
|
||||||
|
*
|
||||||
|
* @var Version_Selector
|
||||||
|
*/
|
||||||
|
private $version_selector = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
*
|
||||||
|
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
||||||
|
* @param Version_Selector $version_selector The Version_Selector object.
|
||||||
|
*/
|
||||||
|
public function __construct( $plugins_handler, $version_selector ) {
|
||||||
|
$this->plugins_handler = $plugins_handler;
|
||||||
|
$this->version_selector = $version_selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the version of a package file to the $jetpack_packages_filemap global
|
||||||
|
* array so that we can load the most recent version.
|
||||||
|
*
|
||||||
|
* @param string $file_identifier Unique id to file assigned by composer based on package name and filename.
|
||||||
|
* @param string $version Version of the file.
|
||||||
|
* @param string $path Absolute path to the file so that we can load it.
|
||||||
|
*/
|
||||||
|
public function enqueue_package_file( $file_identifier, $version, $path ) {
|
||||||
|
global $jetpack_packages_filemap;
|
||||||
|
|
||||||
|
if ( isset( $jetpack_packages_filemap[ $file_identifier ]['version'] ) ) {
|
||||||
|
$selected_version = $jetpack_packages_filemap[ $file_identifier ]['version'];
|
||||||
|
} else {
|
||||||
|
$selected_version = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
|
||||||
|
$jetpack_packages_filemap[ $file_identifier ] = array(
|
||||||
|
'version' => $version,
|
||||||
|
'path' => $path,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a path to the plugin's filemap. The filemap filename is the filename
|
||||||
|
* generated by Jetpack Autoloader version >= 2.0.
|
||||||
|
*
|
||||||
|
* @param String $plugin_path The plugin path.
|
||||||
|
*
|
||||||
|
* @return String The filemap path
|
||||||
|
*/
|
||||||
|
public function create_filemap_path( $plugin_path ) {
|
||||||
|
return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_filemap.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the filemap.
|
||||||
|
*/
|
||||||
|
public function set_file_paths() {
|
||||||
|
$active_plugin_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
||||||
|
$filemap_paths = array_map( array( $this, 'create_filemap_path' ), $active_plugin_paths );
|
||||||
|
|
||||||
|
foreach ( $filemap_paths as $path ) {
|
||||||
|
if ( is_readable( $path ) ) {
|
||||||
|
$file_map = require $path;
|
||||||
|
|
||||||
|
if ( is_array( $file_map ) ) {
|
||||||
|
foreach ( $file_map as $file_identifier => $file_data ) {
|
||||||
|
$this->enqueue_package_file( $file_identifier, $file_data['version'], $file_data['path'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include latest version of all enqueued files.
|
||||||
|
*/
|
||||||
|
public function file_loader() {
|
||||||
|
global $jetpack_packages_filemap;
|
||||||
|
foreach ( $jetpack_packages_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
<?php
|
||||||
|
/* HEADER */ // phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides information about the current plugin and the site's active plugins.
|
||||||
|
*/
|
||||||
|
class Plugins_Handler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the paths of all active plugins and all known activating plugins.
|
||||||
|
*
|
||||||
|
* @return array An array of plugin paths as strings or an empty array.
|
||||||
|
*/
|
||||||
|
public function get_all_active_plugins_paths() {
|
||||||
|
global $jetpack_autoloader_activating_plugins_paths;
|
||||||
|
|
||||||
|
$active_plugins_paths = $this->get_active_plugins_paths();
|
||||||
|
$multisite_plugins_paths = $this->get_multisite_plugins_paths();
|
||||||
|
$active_plugins_paths = array_merge( $multisite_plugins_paths, $active_plugins_paths );
|
||||||
|
|
||||||
|
$activating_plugins_paths = $this->get_plugins_activating_via_request();
|
||||||
|
$activating_plugins_paths = array_unique( array_merge( $activating_plugins_paths, $jetpack_autoloader_activating_plugins_paths ) );
|
||||||
|
|
||||||
|
$plugins_paths = array_unique( array_merge( $active_plugins_paths, $activating_plugins_paths ) );
|
||||||
|
|
||||||
|
return $plugins_paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the paths of the active sitewide plugins in a multisite environment.
|
||||||
|
*
|
||||||
|
* @return array The paths of the active sitewide plugins or an empty array.
|
||||||
|
*/
|
||||||
|
protected function get_multisite_plugins_paths() {
|
||||||
|
$plugin_slugs = is_multisite()
|
||||||
|
? array_keys( get_site_option( 'active_sitewide_plugins', array() ) )
|
||||||
|
: array();
|
||||||
|
|
||||||
|
$plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
|
||||||
|
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the paths of the currently active plugins.
|
||||||
|
*
|
||||||
|
* @return array The active plugins' paths or an empty array.
|
||||||
|
*/
|
||||||
|
protected function get_active_plugins_paths() {
|
||||||
|
$plugin_slugs = (array) get_option( 'active_plugins', array() );
|
||||||
|
$plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
|
||||||
|
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the plugin directory from the WP_PLUGIN_DIR constant to the plugin slug.
|
||||||
|
*
|
||||||
|
* @param string $plugin_slug The plugin slug.
|
||||||
|
*/
|
||||||
|
private function create_plugin_path( $plugin_slug ) {
|
||||||
|
$plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR );
|
||||||
|
return trailingslashit( $plugin_dir ) . substr( $plugin_slug, 0, strrpos( $plugin_slug, '/' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure the plugin has its own directory and not a single-file plugin.
|
||||||
|
*
|
||||||
|
* @param string $plugin Plugin name, may be prefixed with "/".
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function is_directory_plugin( $plugin ) {
|
||||||
|
return strlen( $plugin ) > 1 && false !== strpos( $plugin, '/', 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the autoloader should be reset. The autoloader should be reset
|
||||||
|
* when a plugin is activating via a method other than a request, for example
|
||||||
|
* using WP-CLI. When this occurs, the activating plugin was not known when
|
||||||
|
* the autoloader selected the package versions for the classmap and filemap
|
||||||
|
* globals, so the autoloader must reselect the versions.
|
||||||
|
*
|
||||||
|
* If the current plugin is not already known, this method will add it to the
|
||||||
|
* $jetpack_autoloader_activating_plugins_paths global.
|
||||||
|
*
|
||||||
|
* @return boolean True if the autoloder must be reset, else false.
|
||||||
|
*/
|
||||||
|
public function should_autoloader_reset() {
|
||||||
|
global $jetpack_autoloader_activating_plugins_paths;
|
||||||
|
|
||||||
|
$plugins_paths = $this->get_all_active_plugins_paths();
|
||||||
|
$current_plugin_path = $this->get_current_plugin_path();
|
||||||
|
$plugin_unknown = ! in_array( $current_plugin_path, $plugins_paths, true );
|
||||||
|
|
||||||
|
if ( $plugin_unknown ) {
|
||||||
|
// If the current plugin isn't known, add it to the activating plugins list.
|
||||||
|
$jetpack_autoloader_activating_plugins_paths[] = $current_plugin_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plugin_unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the names of plugins that are activating via a request.
|
||||||
|
*
|
||||||
|
* @return array An array of names of the activating plugins or an empty array.
|
||||||
|
*/
|
||||||
|
private function get_plugins_activating_via_request() {
|
||||||
|
|
||||||
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||||
|
|
||||||
|
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
|
||||||
|
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : false;
|
||||||
|
$nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note: we're not actually checking the nonce here becase 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// In case of a single plugin activation there will be a plugin slug.
|
||||||
|
if ( 'activate' === $action && ! empty( $nonce ) ) {
|
||||||
|
return array( $this->create_plugin_path( wp_unslash( $plugin ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$plugins = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array();
|
||||||
|
|
||||||
|
// In case of bulk activation there will be an array of plugins.
|
||||||
|
if ( 'activate-selected' === $action && ! empty( $nonce ) ) {
|
||||||
|
$plugin_slugs = array_map( 'wp_unslash', $plugins );
|
||||||
|
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
||||||
|
}
|
||||||
|
|
||||||
|
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the path of the current plugin.
|
||||||
|
*
|
||||||
|
* @return string The path of the current plugin.
|
||||||
|
*/
|
||||||
|
public function get_current_plugin_path() {
|
||||||
|
$vendor_path = str_replace( '\\', '/', dirname( __FILE__ ) );
|
||||||
|
// Path to the plugin's folder (the parent of the vendor folder).
|
||||||
|
return substr( $vendor_path, 0, strrpos( $vendor_path, '/' ) );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
/* HEADER */ // phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to select package versions.
|
||||||
|
*/
|
||||||
|
class Version_Selector {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the selected package version should be updated. Composer development
|
||||||
|
* package versions ('9999999-dev' or versions that start with 'dev-') are favored
|
||||||
|
* when the JETPACK_AUTOLOAD_DEV constant is set to true.
|
||||||
|
*
|
||||||
|
* @param String $selected_version The currently selected package version.
|
||||||
|
* @param String $compare_version The package version that is being evaluated to
|
||||||
|
* determine if the version needs to be updated.
|
||||||
|
*
|
||||||
|
* @return Boolean Returns true if the selected package version should be updated,
|
||||||
|
* else false.
|
||||||
|
*/
|
||||||
|
public function is_version_update_required( $selected_version, $compare_version ) {
|
||||||
|
$use_dev_versions = defined( 'JETPACK_AUTOLOAD_DEV' ) && JETPACK_AUTOLOAD_DEV;
|
||||||
|
|
||||||
|
if ( is_null( $selected_version ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $use_dev_versions && $this->is_package_version_dev( $selected_version ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->is_package_version_dev( $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 Boolean True if the version is a dev version, else false.
|
||||||
|
*/
|
||||||
|
private function is_package_version_dev( $version ) {
|
||||||
|
if ( 'dev-' === substr( $version, 0, 4 ) || '9999999-dev' === $version ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,141 @@
|
||||||
|
<?php
|
||||||
|
/* HEADER */ // phpcs:ignore
|
||||||
|
|
||||||
|
global $jetpack_packages_classmap;
|
||||||
|
global $jetpack_packages_filemap;
|
||||||
|
global $jetpack_autoloader_activating_plugins_paths;
|
||||||
|
|
||||||
|
if ( ! is_array( $jetpack_packages_classmap ) ) {
|
||||||
|
$jetpack_packages_classmap = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! is_array( $jetpack_packages_filemap ) ) {
|
||||||
|
$jetpack_packages_filemap = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! is_array( $jetpack_autoloader_activating_plugins_paths ) ) {
|
||||||
|
$jetpack_autoloader_activating_plugins_paths = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for autoloading jetpack packages.
|
||||||
|
*
|
||||||
|
* @param string $class_name Class Name to load.
|
||||||
|
*
|
||||||
|
* @return Boolean Whether the class_name was found in the classmap.
|
||||||
|
*/
|
||||||
|
function autoloader( $class_name ) {
|
||||||
|
global $jetpack_packages_classmap;
|
||||||
|
|
||||||
|
if ( isset( $jetpack_packages_classmap[ $class_name ] ) ) {
|
||||||
|
require_once $jetpack_packages_classmap[ $class_name ]['path'];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for running the code that initializes class and file maps.
|
||||||
|
*
|
||||||
|
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
||||||
|
* @param Version_Selector $version_selector The Version_Selector object.
|
||||||
|
*/
|
||||||
|
function enqueue_files( $plugins_handler, $version_selector ) {
|
||||||
|
require_once __DIR__ . '/../class-classes-handler.php';
|
||||||
|
require_once __DIR__ . '/../class-files-handler.php';
|
||||||
|
|
||||||
|
$classes_handler = new Classes_Handler( $plugins_handler, $version_selector );
|
||||||
|
$classes_handler->set_class_paths();
|
||||||
|
|
||||||
|
$files_handler = new Files_Handler( $plugins_handler, $version_selector );
|
||||||
|
$files_handler->set_file_paths();
|
||||||
|
|
||||||
|
$files_handler->file_loader();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the latest installed autoloader. If this is the latest autoloader, sets
|
||||||
|
* up the classmap and filemap.
|
||||||
|
*/
|
||||||
|
function set_up_autoloader() {
|
||||||
|
global $jetpack_autoloader_latest_version;
|
||||||
|
global $jetpack_packages_classmap;
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../class-plugins-handler.php';
|
||||||
|
require_once __DIR__ . '/../class-version-selector.php';
|
||||||
|
require_once __DIR__ . '/../class-autoloader-handler.php';
|
||||||
|
|
||||||
|
$plugins_handler = new Plugins_Handler();
|
||||||
|
$version_selector = new Version_Selector();
|
||||||
|
$autoloader_handler = new Autoloader_Handler( $plugins_handler, $version_selector );
|
||||||
|
|
||||||
|
if ( $plugins_handler->should_autoloader_reset() ) {
|
||||||
|
/*
|
||||||
|
* The autoloader must be reset when an activating plugin that was
|
||||||
|
* previously unknown is detected.
|
||||||
|
*/
|
||||||
|
$jetpack_autoloader_latest_version = null;
|
||||||
|
$jetpack_packages_classmap = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the latest autoloader.
|
||||||
|
if ( ! $jetpack_autoloader_latest_version ) {
|
||||||
|
$autoloader_handler->find_latest_autoloader();
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_autoloader_version = $autoloader_handler->get_current_autoloader_version();
|
||||||
|
|
||||||
|
// This is the latest autoloader, so generate the classmap and filemap and register the autoloader function.
|
||||||
|
if ( empty( $jetpack_packages_classmap ) && $current_autoloader_version === $jetpack_autoloader_latest_version ) {
|
||||||
|
enqueue_files( $plugins_handler, $version_selector );
|
||||||
|
$autoloader_handler->update_autoloader_chain();
|
||||||
|
add_filter( 'upgrader_post_install', __NAMESPACE__ . '\reset_maps_after_update', 0, 3 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the autoloader after a plugin update.
|
||||||
|
*
|
||||||
|
* @param bool $response Installation response.
|
||||||
|
* @param array $hook_extra Extra arguments passed to hooked filters.
|
||||||
|
* @param array $result Installation result data.
|
||||||
|
*
|
||||||
|
* @return bool The passed in $response param.
|
||||||
|
*/
|
||||||
|
function reset_maps_after_update( $response, $hook_extra, $result ) {
|
||||||
|
global $jetpack_packages_classmap;
|
||||||
|
|
||||||
|
if ( isset( $hook_extra['plugin'] ) ) {
|
||||||
|
/*
|
||||||
|
* $hook_extra['plugin'] is the path to the plugin file relative to the plugins directory:
|
||||||
|
* https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/includes/class-wp-upgrader.php#L701
|
||||||
|
*/
|
||||||
|
$plugin = $hook_extra['plugin'];
|
||||||
|
|
||||||
|
if ( false === strpos( $plugin, '/', 1 ) ) {
|
||||||
|
// Single-file plugins don't use packages, so bail.
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! is_plugin_active( $plugin ) ) {
|
||||||
|
// The updated plugin isn't active, so bail.
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $plugin is the path to the plugin file relative to the plugins directory.
|
||||||
|
*/
|
||||||
|
$plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR );
|
||||||
|
$plugin_path = trailingslashit( $plugin_dir ) . trailingslashit( explode( '/', $plugin )[0] );
|
||||||
|
|
||||||
|
if ( is_readable( $plugin_path . 'vendor/jetpack-autoloader/autoload_functions.php' ) ) {
|
||||||
|
// The plugin has a >=v2.2 autoloader, so reset the classmap.
|
||||||
|
$jetpack_packages_classmap = array();
|
||||||
|
|
||||||
|
set_up_autoloader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Jetpack Constants
|
||||||
|
|
||||||
|
A simple constant manager for Jetpack.
|
||||||
|
|
||||||
|
Testing constants is hard. Once you define a constant in PHP, it's defined. Constants Manager is an abstraction layer so that unit tests can set constants for tests.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
Retrieve the value of a constant `CONSTANT_NAME` (returns `null` if it's not defined):
|
||||||
|
|
||||||
|
```php
|
||||||
|
use Automattic\Jetpack\Constants;
|
||||||
|
|
||||||
|
$constant_value = Constants::get_constant( 'CONSTANT_NAME' );
|
||||||
|
```
|
||||||
|
|
||||||
|
Set the value of a constant `CONSTANT_NAME` to a particular value:
|
||||||
|
|
||||||
|
```php
|
||||||
|
use Automattic\Jetpack\Constants;
|
||||||
|
|
||||||
|
$value = 'some value';
|
||||||
|
Constants::set_constant( 'CONSTANT_NAME', $value );
|
||||||
|
```
|
||||||
|
|
||||||
|
Check whether a constant `CONSTANT_NAME` is defined:
|
||||||
|
|
||||||
|
```php
|
||||||
|
use Automattic\Jetpack\Constants;
|
||||||
|
|
||||||
|
$defined = Constants::is_defined( 'CONSTANT_NAME' );
|
||||||
|
```
|
||||||
|
|
||||||
|
Check whether a constant `CONSTANT_NAME` is truthy:
|
||||||
|
|
||||||
|
```php
|
||||||
|
use Automattic\Jetpack\Constants;
|
||||||
|
|
||||||
|
$is_truthy = Constants::is_true( 'CONSTANT_NAME' );
|
||||||
|
```
|
||||||
|
|
||||||
|
Delete the `CONSTANT_NAME` constant:
|
||||||
|
|
||||||
|
```php
|
||||||
|
use Automattic\Jetpack\Constants;
|
||||||
|
|
||||||
|
Constants::clear_single_constant( 'CONSTANT_NAME' );
|
||||||
|
```
|
||||||
|
|
||||||
|
Delete all known constants:
|
||||||
|
|
||||||
|
```php
|
||||||
|
use Automattic\Jetpack\Constants;
|
||||||
|
|
||||||
|
Constants::clear_constants();
|
||||||
|
```
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"name": "automattic/jetpack-constants",
|
||||||
|
"description": "A wrapper for defining constants in a more testable way.",
|
||||||
|
"type": "library",
|
||||||
|
"license": "GPL-2.0-or-later",
|
||||||
|
"require": {},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5",
|
||||||
|
"php-mock/php-mock": "^2.1"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"phpunit": [
|
||||||
|
"@composer install",
|
||||||
|
"./vendor/phpunit/phpunit/phpunit --colors=always"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* A constants manager for Jetpack.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-constants
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Automattic\Jetpack\Constants
|
||||||
|
*
|
||||||
|
* Testing constants is hard. Once you define a constant, it's defined. Constants Manager is an
|
||||||
|
* abstraction layer so that unit tests can set "constants" for tests.
|
||||||
|
*
|
||||||
|
* To test your code, you'll need to swap out `defined( 'CONSTANT' )` with `Automattic\Jetpack\Constants::is_defined( 'CONSTANT' )`
|
||||||
|
* and replace `CONSTANT` with `Automattic\Jetpack\Constants::get_constant( 'CONSTANT' )`. Then in the unit test, you can set the
|
||||||
|
* constant with `Automattic\Jetpack\Constants::set_constant( 'CONSTANT', $value )` and then clean up after each test with something like
|
||||||
|
* this:
|
||||||
|
*
|
||||||
|
* function tearDown() {
|
||||||
|
* Automattic\Jetpack\Constants::clear_constants();
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
class Constants {
|
||||||
|
/**
|
||||||
|
* A container for all defined constants.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @static
|
||||||
|
*
|
||||||
|
* @var array.
|
||||||
|
*/
|
||||||
|
public static $set_constants = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a "constant" has been set in constants Manager
|
||||||
|
* and has the value of true
|
||||||
|
*
|
||||||
|
* @param string $name The name of the constant.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function is_true( $name ) {
|
||||||
|
return self::is_defined( $name ) && self::get_constant( $name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a "constant" has been set in constants Manager, and if not,
|
||||||
|
* checks if the constant was defined with define( 'name', 'value ).
|
||||||
|
*
|
||||||
|
* @param string $name The name of the constant.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function is_defined( $name ) {
|
||||||
|
return array_key_exists( $name, self::$set_constants )
|
||||||
|
? true
|
||||||
|
: defined( $name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to retrieve the "constant" from constants Manager, and if it hasn't been set,
|
||||||
|
* then attempts to get the constant with the constant() function. If that also hasn't
|
||||||
|
* been set, attempts to get a value from filters.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the constant.
|
||||||
|
*
|
||||||
|
* @return mixed null if the constant does not exist or the value of the constant.
|
||||||
|
*/
|
||||||
|
public static function get_constant( $name ) {
|
||||||
|
if ( array_key_exists( $name, self::$set_constants ) ) {
|
||||||
|
return self::$set_constants[ $name ];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( defined( $name ) ) {
|
||||||
|
return constant( $name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the value of the constant.
|
||||||
|
*
|
||||||
|
* @since 8.5.0
|
||||||
|
*
|
||||||
|
* @param null The constant value to be filtered. The default is null.
|
||||||
|
* @param String $name The constant name.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'jetpack_constant_default_value', null, $name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the "constant" within constants Manager.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the constant.
|
||||||
|
* @param string $value The value of the constant.
|
||||||
|
*/
|
||||||
|
public static function set_constant( $name, $value ) {
|
||||||
|
self::$set_constants[ $name ] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will unset a "constant" from constants Manager if the constant exists.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the constant.
|
||||||
|
*
|
||||||
|
* @return bool Whether the constant was removed.
|
||||||
|
*/
|
||||||
|
public static function clear_single_constant( $name ) {
|
||||||
|
if ( ! array_key_exists( $name, self::$set_constants ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset( self::$set_constants[ $name ] );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets all of the constants within constants Manager.
|
||||||
|
*/
|
||||||
|
public static function clear_constants() {
|
||||||
|
self::$set_constants = array();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
../../bin/composer/wp/vendor/gettext/languages/bin/export-plural-rules
|
|
@ -0,0 +1 @@
|
||||||
|
../../bin/composer/phpcs/vendor/squizlabs/php_codesniffer/bin/phpcbf
|
|
@ -0,0 +1 @@
|
||||||
|
../../bin/composer/phpcs/vendor/squizlabs/php_codesniffer/bin/phpcs
|
|
@ -0,0 +1 @@
|
||||||
|
../../bin/composer/phpunit/vendor/phpunit/phpunit/phpunit
|
|
@ -0,0 +1 @@
|
||||||
|
../../bin/composer/wp/vendor/wp-cli/wp-cli/bin/wp
|
|
@ -0,0 +1 @@
|
||||||
|
../../bin/composer/wp/vendor/wp-cli/wp-cli/bin/wp.bat
|
|
@ -0,0 +1,140 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by automattic/jetpack-autoloader.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack\Autoloader\jp815af2e0096699aca34ac981c50a898f;
|
||||||
|
|
||||||
|
// phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class selects the package version for the autoloader.
|
||||||
|
*/
|
||||||
|
class Autoloader_Handler {
|
||||||
|
|
||||||
|
// The name of the autoloader function registered by v1.* autoloaders.
|
||||||
|
const V1_AUTOLOADER_NAME = 'Automattic\Jetpack\Autoloader\autoloader';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The autoloader function for v2.* autoloaders is named __NAMESPACE__ . \autoloader.
|
||||||
|
* The namespace is defined in AutoloadGenerator as
|
||||||
|
* 'Automattic\Jetpack\Autoloader\jp' plus a unique suffix.
|
||||||
|
*/
|
||||||
|
const V2_AUTOLOADER_BASE = 'Automattic\Jetpack\Autoloader\jp';
|
||||||
|
|
||||||
|
const AUTOLOAD_GENERATOR_CLASS_NAME = 'Automattic\Jetpack\Autoloader\AutoloadGenerator';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Plugins_Handler object.
|
||||||
|
*
|
||||||
|
* @var Plugins_Handler
|
||||||
|
*/
|
||||||
|
private $plugins_handler = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Version_Selector object.
|
||||||
|
*
|
||||||
|
* @var Version_Selector
|
||||||
|
*/
|
||||||
|
private $version_selector = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
*
|
||||||
|
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
||||||
|
* @param Version_Selector $version_selector The Version_Selector object.
|
||||||
|
*/
|
||||||
|
public function __construct( $plugins_handler, $version_selector ) {
|
||||||
|
$this->plugins_handler = $plugins_handler;
|
||||||
|
$this->version_selector = $version_selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the latest installed autoloader.
|
||||||
|
*/
|
||||||
|
public function find_latest_autoloader() {
|
||||||
|
global $jetpack_autoloader_latest_version;
|
||||||
|
|
||||||
|
$current_autoloader_path = trailingslashit( dirname( __FILE__ ) ) . 'autoload_packages.php';
|
||||||
|
$current_autoloader_path = str_replace( '\\', '/', $current_autoloader_path );
|
||||||
|
|
||||||
|
$selected_autoloader_version = null;
|
||||||
|
$selected_autoloader_path = null;
|
||||||
|
|
||||||
|
$active_plugins_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
||||||
|
|
||||||
|
foreach ( $active_plugins_paths as $plugin_path ) {
|
||||||
|
$classmap_path = trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
|
||||||
|
|
||||||
|
if ( file_exists( $classmap_path ) ) {
|
||||||
|
$packages = require $classmap_path;
|
||||||
|
|
||||||
|
$compare_version = $packages[ self::AUTOLOAD_GENERATOR_CLASS_NAME ]['version'];
|
||||||
|
$compare_path = trailingslashit( $plugin_path ) . 'vendor/autoload_packages.php';
|
||||||
|
|
||||||
|
if ( $this->version_selector->is_version_update_required( $selected_autoloader_version, $compare_version ) ) {
|
||||||
|
$selected_autoloader_version = $compare_version;
|
||||||
|
$selected_autoloader_path = $compare_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$jetpack_autoloader_latest_version = $selected_autoloader_version;
|
||||||
|
|
||||||
|
// $current_autoloader_path is already loaded
|
||||||
|
if ( $current_autoloader_path !== $selected_autoloader_path ) {
|
||||||
|
require $selected_autoloader_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get this autoloader's package version.
|
||||||
|
*
|
||||||
|
* @return String The autoloader's package version.
|
||||||
|
*/
|
||||||
|
public function get_current_autoloader_version() {
|
||||||
|
$classmap_file = trailingslashit( dirname( __FILE__ ) ) . 'composer/jetpack_autoload_classmap.php';
|
||||||
|
$autoloader_packages = require $classmap_file;
|
||||||
|
|
||||||
|
return $autoloader_packages[ self::AUTOLOAD_GENERATOR_CLASS_NAME ]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the spl autoloader chain:
|
||||||
|
* - Registers this namespace's autoloader function.
|
||||||
|
* - If a v1 autoloader function is registered, moves it to the end of the chain.
|
||||||
|
* - Removes any other v2 autoloader functions that have already been registered. This
|
||||||
|
* can occur when the autoloader is being reset by an activating plugin.
|
||||||
|
*/
|
||||||
|
public function update_autoloader_chain() {
|
||||||
|
spl_autoload_register( __NAMESPACE__ . '\autoloader' );
|
||||||
|
|
||||||
|
$autoload_chain = spl_autoload_functions();
|
||||||
|
|
||||||
|
foreach ( $autoload_chain as $autoloader ) {
|
||||||
|
if ( ! is_string( $autoloader ) ) {
|
||||||
|
/*
|
||||||
|
* The Jetpack Autoloader functions are registered as strings, so
|
||||||
|
* just continue if $autoloader isn't a string.
|
||||||
|
*/
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( self::V1_AUTOLOADER_NAME === $autoloader ) {
|
||||||
|
// Move the v1.* autoloader function to the end of the spl autoloader chain.
|
||||||
|
spl_autoload_unregister( $autoloader );
|
||||||
|
spl_autoload_register( $autoloader );
|
||||||
|
|
||||||
|
} elseif (
|
||||||
|
self::V2_AUTOLOADER_BASE === substr( $autoloader, 0, strlen( self::V2_AUTOLOADER_BASE ) )
|
||||||
|
&& __NAMESPACE__ !== substr( $autoloader, 0, strlen( __NAMESPACE__ ) )
|
||||||
|
) {
|
||||||
|
// Unregister any other v2.* autoloader functions if they're in the chain.
|
||||||
|
spl_autoload_unregister( $autoloader );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by automattic/jetpack-autoloader.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack\Autoloader\jp815af2e0096699aca34ac981c50a898f;
|
||||||
|
|
||||||
|
// phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class selects the package versions for the package classes.
|
||||||
|
*/
|
||||||
|
class Classes_Handler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Plugins_Handler object.
|
||||||
|
*
|
||||||
|
* @var Plugins_Handler
|
||||||
|
*/
|
||||||
|
private $plugins_handler = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Version_Selector object.
|
||||||
|
*
|
||||||
|
* @var Version_Selector
|
||||||
|
*/
|
||||||
|
private $version_selector = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
*
|
||||||
|
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
||||||
|
* @param Version_Selector $version_selector The Version_Selector object.
|
||||||
|
*/
|
||||||
|
public function __construct( $plugins_handler, $version_selector ) {
|
||||||
|
$this->plugins_handler = $plugins_handler;
|
||||||
|
$this->version_selector = $version_selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the version of a package to the $jetpack_packages_classmap global
|
||||||
|
* array so that the autoloader is able to find it.
|
||||||
|
*
|
||||||
|
* @param string $class_name Name of the class that you want to autoload.
|
||||||
|
* @param string $version Version of the class.
|
||||||
|
* @param string $path Absolute path to the class so that we can load it.
|
||||||
|
*/
|
||||||
|
public function enqueue_package_class( $class_name, $version, $path ) {
|
||||||
|
global $jetpack_packages_classmap;
|
||||||
|
|
||||||
|
if ( isset( $jetpack_packages_classmap[ $class_name ]['version'] ) ) {
|
||||||
|
$selected_version = $jetpack_packages_classmap[ $class_name ]['version'];
|
||||||
|
} else {
|
||||||
|
$selected_version = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
|
||||||
|
$jetpack_packages_classmap[ $class_name ] = array(
|
||||||
|
'version' => $version,
|
||||||
|
'path' => $path,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the path to the plugin's classmap file. The classmap filename is the filename
|
||||||
|
* generated by Jetpack Autoloader version >= 2.0.
|
||||||
|
*
|
||||||
|
* @param String $plugin_path The plugin path.
|
||||||
|
*
|
||||||
|
* @return String the classmap path.
|
||||||
|
*/
|
||||||
|
public function create_classmap_path( $plugin_path ) {
|
||||||
|
return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_classmap.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the classmap.
|
||||||
|
*/
|
||||||
|
public function set_class_paths() {
|
||||||
|
$active_plugins_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
||||||
|
$classmap_paths = array_map( array( $this, 'create_classmap_path' ), $active_plugins_paths );
|
||||||
|
|
||||||
|
foreach ( $classmap_paths as $path ) {
|
||||||
|
if ( is_readable( $path ) ) {
|
||||||
|
$class_map = require $path;
|
||||||
|
|
||||||
|
if ( is_array( $class_map ) ) {
|
||||||
|
foreach ( $class_map as $class_name => $class_info ) {
|
||||||
|
$this->enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by automattic/jetpack-autoloader.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack\Autoloader\jp815af2e0096699aca34ac981c50a898f;
|
||||||
|
|
||||||
|
// phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class selects the package versions for the package files.
|
||||||
|
*/
|
||||||
|
class Files_Handler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Plugins_Handler object.
|
||||||
|
*
|
||||||
|
* @var Plugins_Handler
|
||||||
|
*/
|
||||||
|
private $plugins_handler = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Version_Selector object.
|
||||||
|
*
|
||||||
|
* @var Version_Selector
|
||||||
|
*/
|
||||||
|
private $version_selector = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
*
|
||||||
|
* @param Plugins_Handler $plugins_handler The Plugins_Handler object.
|
||||||
|
* @param Version_Selector $version_selector The Version_Selector object.
|
||||||
|
*/
|
||||||
|
public function __construct( $plugins_handler, $version_selector ) {
|
||||||
|
$this->plugins_handler = $plugins_handler;
|
||||||
|
$this->version_selector = $version_selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the version of a package file to the $jetpack_packages_filemap global
|
||||||
|
* array so that we can load the most recent version.
|
||||||
|
*
|
||||||
|
* @param string $file_identifier Unique id to file assigned by composer based on package name and filename.
|
||||||
|
* @param string $version Version of the file.
|
||||||
|
* @param string $path Absolute path to the file so that we can load it.
|
||||||
|
*/
|
||||||
|
public function enqueue_package_file( $file_identifier, $version, $path ) {
|
||||||
|
global $jetpack_packages_filemap;
|
||||||
|
|
||||||
|
if ( isset( $jetpack_packages_filemap[ $file_identifier ]['version'] ) ) {
|
||||||
|
$selected_version = $jetpack_packages_filemap[ $file_identifier ]['version'];
|
||||||
|
} else {
|
||||||
|
$selected_version = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
|
||||||
|
$jetpack_packages_filemap[ $file_identifier ] = array(
|
||||||
|
'version' => $version,
|
||||||
|
'path' => $path,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a path to the plugin's filemap. The filemap filename is the filename
|
||||||
|
* generated by Jetpack Autoloader version >= 2.0.
|
||||||
|
*
|
||||||
|
* @param String $plugin_path The plugin path.
|
||||||
|
*
|
||||||
|
* @return String The filemap path
|
||||||
|
*/
|
||||||
|
public function create_filemap_path( $plugin_path ) {
|
||||||
|
return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_filemap.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the filemap.
|
||||||
|
*/
|
||||||
|
public function set_file_paths() {
|
||||||
|
$active_plugin_paths = $this->plugins_handler->get_all_active_plugins_paths();
|
||||||
|
$filemap_paths = array_map( array( $this, 'create_filemap_path' ), $active_plugin_paths );
|
||||||
|
|
||||||
|
foreach ( $filemap_paths as $path ) {
|
||||||
|
if ( is_readable( $path ) ) {
|
||||||
|
$file_map = require $path;
|
||||||
|
|
||||||
|
if ( is_array( $file_map ) ) {
|
||||||
|
foreach ( $file_map as $file_identifier => $file_data ) {
|
||||||
|
$this->enqueue_package_file( $file_identifier, $file_data['version'], $file_data['path'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include latest version of all enqueued files.
|
||||||
|
*/
|
||||||
|
public function file_loader() {
|
||||||
|
global $jetpack_packages_filemap;
|
||||||
|
foreach ( $jetpack_packages_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by automattic/jetpack-autoloader.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack\Autoloader\jp815af2e0096699aca34ac981c50a898f;
|
||||||
|
|
||||||
|
// phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides information about the current plugin and the site's active plugins.
|
||||||
|
*/
|
||||||
|
class Plugins_Handler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the paths of all active plugins and all known activating plugins.
|
||||||
|
*
|
||||||
|
* @return array An array of plugin paths as strings or an empty array.
|
||||||
|
*/
|
||||||
|
public function get_all_active_plugins_paths() {
|
||||||
|
global $jetpack_autoloader_activating_plugins_paths;
|
||||||
|
|
||||||
|
$active_plugins_paths = $this->get_active_plugins_paths();
|
||||||
|
$multisite_plugins_paths = $this->get_multisite_plugins_paths();
|
||||||
|
$active_plugins_paths = array_merge( $multisite_plugins_paths, $active_plugins_paths );
|
||||||
|
|
||||||
|
$activating_plugins_paths = $this->get_plugins_activating_via_request();
|
||||||
|
$activating_plugins_paths = array_unique( array_merge( $activating_plugins_paths, $jetpack_autoloader_activating_plugins_paths ) );
|
||||||
|
|
||||||
|
$plugins_paths = array_unique( array_merge( $active_plugins_paths, $activating_plugins_paths ) );
|
||||||
|
|
||||||
|
return $plugins_paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the paths of the active sitewide plugins in a multisite environment.
|
||||||
|
*
|
||||||
|
* @return array The paths of the active sitewide plugins or an empty array.
|
||||||
|
*/
|
||||||
|
protected function get_multisite_plugins_paths() {
|
||||||
|
$plugin_slugs = is_multisite()
|
||||||
|
? array_keys( get_site_option( 'active_sitewide_plugins', array() ) )
|
||||||
|
: array();
|
||||||
|
|
||||||
|
$plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
|
||||||
|
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the paths of the currently active plugins.
|
||||||
|
*
|
||||||
|
* @return array The active plugins' paths or an empty array.
|
||||||
|
*/
|
||||||
|
protected function get_active_plugins_paths() {
|
||||||
|
$plugin_slugs = (array) get_option( 'active_plugins', array() );
|
||||||
|
$plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
|
||||||
|
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the plugin directory from the WP_PLUGIN_DIR constant to the plugin slug.
|
||||||
|
*
|
||||||
|
* @param string $plugin_slug The plugin slug.
|
||||||
|
*/
|
||||||
|
private function create_plugin_path( $plugin_slug ) {
|
||||||
|
$plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR );
|
||||||
|
return trailingslashit( $plugin_dir ) . substr( $plugin_slug, 0, strrpos( $plugin_slug, '/' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure the plugin has its own directory and not a single-file plugin.
|
||||||
|
*
|
||||||
|
* @param string $plugin Plugin name, may be prefixed with "/".
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function is_directory_plugin( $plugin ) {
|
||||||
|
return strlen( $plugin ) > 1 && false !== strpos( $plugin, '/', 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the autoloader should be reset. The autoloader should be reset
|
||||||
|
* when a plugin is activating via a method other than a request, for example
|
||||||
|
* using WP-CLI. When this occurs, the activating plugin was not known when
|
||||||
|
* the autoloader selected the package versions for the classmap and filemap
|
||||||
|
* globals, so the autoloader must reselect the versions.
|
||||||
|
*
|
||||||
|
* If the current plugin is not already known, this method will add it to the
|
||||||
|
* $jetpack_autoloader_activating_plugins_paths global.
|
||||||
|
*
|
||||||
|
* @return boolean True if the autoloder must be reset, else false.
|
||||||
|
*/
|
||||||
|
public function should_autoloader_reset() {
|
||||||
|
global $jetpack_autoloader_activating_plugins_paths;
|
||||||
|
|
||||||
|
$plugins_paths = $this->get_all_active_plugins_paths();
|
||||||
|
$current_plugin_path = $this->get_current_plugin_path();
|
||||||
|
$plugin_unknown = ! in_array( $current_plugin_path, $plugins_paths, true );
|
||||||
|
|
||||||
|
if ( $plugin_unknown ) {
|
||||||
|
// If the current plugin isn't known, add it to the activating plugins list.
|
||||||
|
$jetpack_autoloader_activating_plugins_paths[] = $current_plugin_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plugin_unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the names of plugins that are activating via a request.
|
||||||
|
*
|
||||||
|
* @return array An array of names of the activating plugins or an empty array.
|
||||||
|
*/
|
||||||
|
private function get_plugins_activating_via_request() {
|
||||||
|
|
||||||
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||||
|
|
||||||
|
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
|
||||||
|
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : false;
|
||||||
|
$nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note: we're not actually checking the nonce here becase 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// In case of a single plugin activation there will be a plugin slug.
|
||||||
|
if ( 'activate' === $action && ! empty( $nonce ) ) {
|
||||||
|
return array( $this->create_plugin_path( wp_unslash( $plugin ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$plugins = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array();
|
||||||
|
|
||||||
|
// In case of bulk activation there will be an array of plugins.
|
||||||
|
if ( 'activate-selected' === $action && ! empty( $nonce ) ) {
|
||||||
|
$plugin_slugs = array_map( 'wp_unslash', $plugins );
|
||||||
|
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
|
||||||
|
}
|
||||||
|
|
||||||
|
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the path of the current plugin.
|
||||||
|
*
|
||||||
|
* @return string The path of the current plugin.
|
||||||
|
*/
|
||||||
|
public function get_current_plugin_path() {
|
||||||
|
$vendor_path = str_replace( '\\', '/', dirname( __FILE__ ) );
|
||||||
|
// Path to the plugin's folder (the parent of the vendor folder).
|
||||||
|
return substr( $vendor_path, 0, strrpos( $vendor_path, '/' ) );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by automattic/jetpack-autoloader.
|
||||||
|
*
|
||||||
|
* @package automattic/jetpack-autoloader
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\Jetpack\Autoloader\jp815af2e0096699aca34ac981c50a898f;
|
||||||
|
|
||||||
|
// phpcs:ignore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to select package versions.
|
||||||
|
*/
|
||||||
|
class Version_Selector {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the selected package version should be updated. Composer development
|
||||||
|
* package versions ('9999999-dev' or versions that start with 'dev-') are favored
|
||||||
|
* when the JETPACK_AUTOLOAD_DEV constant is set to true.
|
||||||
|
*
|
||||||
|
* @param String $selected_version The currently selected package version.
|
||||||
|
* @param String $compare_version The package version that is being evaluated to
|
||||||
|
* determine if the version needs to be updated.
|
||||||
|
*
|
||||||
|
* @return Boolean Returns true if the selected package version should be updated,
|
||||||
|
* else false.
|
||||||
|
*/
|
||||||
|
public function is_version_update_required( $selected_version, $compare_version ) {
|
||||||
|
$use_dev_versions = defined( 'JETPACK_AUTOLOAD_DEV' ) && JETPACK_AUTOLOAD_DEV;
|
||||||
|
|
||||||
|
if ( is_null( $selected_version ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $use_dev_versions && $this->is_package_version_dev( $selected_version ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->is_package_version_dev( $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 Boolean True if the version is a dev version, else false.
|
||||||
|
*/
|
||||||
|
private function is_package_version_dev( $version ) {
|
||||||
|
if ( 'dev-' === substr( $version, 0, 4 ) || '9999999-dev' === $version ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,445 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* 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 <fabien@symfony.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
* @see https://www.php-fig.org/psr/psr-0/
|
||||||
|
* @see https://www.php-fig.org/psr/psr-4/
|
||||||
|
*/
|
||||||
|
class ClassLoader
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,336 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class InstalledVersions
|
||||||
|
{
|
||||||
|
private static $installed = array (
|
||||||
|
'root' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'dev-release/4.8',
|
||||||
|
'version' => 'dev-release/4.8',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '5036ee60117f124a8a4f4692c95edddb177599ee',
|
||||||
|
'name' => 'woocommerce/woocommerce',
|
||||||
|
),
|
||||||
|
'versions' =>
|
||||||
|
array (
|
||||||
|
'automattic/jetpack-autoloader' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v2.2.0',
|
||||||
|
'version' => '2.2.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '66a5d150b3928be718d86696f85631a7f0b98a7b',
|
||||||
|
),
|
||||||
|
'automattic/jetpack-constants' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v1.5.0',
|
||||||
|
'version' => '1.5.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '9827a2f446b8c4faafaf1c740483031c073a381d',
|
||||||
|
),
|
||||||
|
'composer/installers' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v1.9.0',
|
||||||
|
'version' => '1.9.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
|
||||||
|
),
|
||||||
|
'league/container' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => '3.3.3',
|
||||||
|
'version' => '3.3.3.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '7dc67bdf89efc338e674863c0ea70a63efe4de05',
|
||||||
|
),
|
||||||
|
'maxmind-db/reader' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v1.6.0',
|
||||||
|
'version' => '1.6.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
|
||||||
|
),
|
||||||
|
'orno/di' =>
|
||||||
|
array (
|
||||||
|
'replaced' =>
|
||||||
|
array (
|
||||||
|
0 => '~2.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'pelago/emogrifier' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v3.1.0',
|
||||||
|
'version' => '3.1.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'f6a5c7d44612d86c3901c93f1592f5440e6b2cd8',
|
||||||
|
),
|
||||||
|
'psr/container' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => '1.0.0',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
|
||||||
|
),
|
||||||
|
'psr/container-implementation' =>
|
||||||
|
array (
|
||||||
|
'provided' =>
|
||||||
|
array (
|
||||||
|
0 => '^1.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'roundcube/plugin-installer' =>
|
||||||
|
array (
|
||||||
|
'replaced' =>
|
||||||
|
array (
|
||||||
|
0 => '*',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'shama/baton' =>
|
||||||
|
array (
|
||||||
|
'replaced' =>
|
||||||
|
array (
|
||||||
|
0 => '*',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'symfony/css-selector' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v3.3.6',
|
||||||
|
'version' => '3.3.6.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '4d882dced7b995d5274293039370148e291808f2',
|
||||||
|
),
|
||||||
|
'woocommerce/action-scheduler' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => '3.1.6',
|
||||||
|
'version' => '3.1.6.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '275d0ba54b1c263dfc62688de2fa9a25a373edf8',
|
||||||
|
),
|
||||||
|
'woocommerce/woocommerce' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'dev-release/4.8',
|
||||||
|
'version' => 'dev-release/4.8',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '5036ee60117f124a8a4f4692c95edddb177599ee',
|
||||||
|
),
|
||||||
|
'woocommerce/woocommerce-admin' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => '1.7.3',
|
||||||
|
'version' => '1.7.3.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '16de972f319e5e6fc8dbebf5024dd263234f39e0',
|
||||||
|
),
|
||||||
|
'woocommerce/woocommerce-blocks' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v3.8.1',
|
||||||
|
'version' => '3.8.1.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'e5aef9eddd13c5511ba673eb70ed8cb3e80d828c',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getInstalledPackages()
|
||||||
|
{
|
||||||
|
return array_keys(self::$installed['versions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function isInstalled($packageName)
|
||||||
|
{
|
||||||
|
return isset(self::$installed['versions'][$packageName]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (!isset(self::$installed['versions'][$packageName])) {
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
$ranges = array();
|
||||||
|
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' || ', $ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getVersion($packageName)
|
||||||
|
{
|
||||||
|
if (!isset(self::$installed['versions'][$packageName])) {
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset(self::$installed['versions'][$packageName]['version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed['versions'][$packageName]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getPrettyVersion($packageName)
|
||||||
|
{
|
||||||
|
if (!isset(self::$installed['versions'][$packageName])) {
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getReference($packageName)
|
||||||
|
{
|
||||||
|
if (!isset(self::$installed['versions'][$packageName])) {
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed['versions'][$packageName]['reference'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getRootPackage()
|
||||||
|
{
|
||||||
|
return self::$installed['root'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getRawData()
|
||||||
|
{
|
||||||
|
return self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function reload($data)
|
||||||
|
{
|
||||||
|
self::$installed = $data;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_classmap.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(dirname(__FILE__));
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Automattic\\Jetpack\\Constants' => $vendorDir . '/automattic/jetpack-constants/src/class-constants.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\Package' => $baseDir . '/includes/rest-api/Package.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\Server' => $baseDir . '/includes/rest-api/Server.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\AdminNotesHelper' => $baseDir . '/tests/legacy/unit-tests/rest-api/Helpers/AdminNotesHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\CouponHelper' => $baseDir . '/tests/legacy/unit-tests/rest-api/Helpers/CouponHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\CustomerHelper' => $baseDir . '/tests/legacy/unit-tests/rest-api/Helpers/CustomerHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\OrderHelper' => $baseDir . '/tests/legacy/unit-tests/rest-api/Helpers/OrderHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\ProductHelper' => $baseDir . '/tests/legacy/unit-tests/rest-api/Helpers/ProductHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\QueueHelper' => $baseDir . '/tests/legacy/unit-tests/rest-api/Helpers/QueueHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\SettingsHelper' => $baseDir . '/tests/legacy/unit-tests/rest-api/Helpers/SettingsHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\ShippingHelper' => $baseDir . '/tests/legacy/unit-tests/rest-api/Helpers/ShippingHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\Utilities\\ImageAttachment' => $baseDir . '/includes/rest-api/Utilities/ImageAttachment.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\Utilities\\SingletonTrait' => $baseDir . '/includes/rest-api/Utilities/SingletonTrait.php',
|
||||||
|
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||||
|
'WC_REST_CRUD_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php',
|
||||||
|
'WC_REST_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php',
|
||||||
|
'WC_REST_Coupons_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-coupons-controller.php',
|
||||||
|
'WC_REST_Coupons_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php',
|
||||||
|
'WC_REST_Coupons_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php',
|
||||||
|
'WC_REST_Customer_Downloads_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-customer-downloads-controller.php',
|
||||||
|
'WC_REST_Customer_Downloads_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php',
|
||||||
|
'WC_REST_Customer_Downloads_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php',
|
||||||
|
'WC_REST_Customers_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-customers-controller.php',
|
||||||
|
'WC_REST_Customers_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php',
|
||||||
|
'WC_REST_Customers_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-customers-v2-controller.php',
|
||||||
|
'WC_REST_Data_Continents_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php',
|
||||||
|
'WC_REST_Data_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-data-controller.php',
|
||||||
|
'WC_REST_Data_Countries_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-data-countries-controller.php',
|
||||||
|
'WC_REST_Data_Currencies_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php',
|
||||||
|
'WC_REST_Network_Orders_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-network-orders-controller.php',
|
||||||
|
'WC_REST_Network_Orders_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-network-orders-v2-controller.php',
|
||||||
|
'WC_REST_Order_Notes_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php',
|
||||||
|
'WC_REST_Order_Notes_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php',
|
||||||
|
'WC_REST_Order_Notes_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php',
|
||||||
|
'WC_REST_Order_Refunds_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php',
|
||||||
|
'WC_REST_Order_Refunds_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php',
|
||||||
|
'WC_REST_Order_Refunds_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php',
|
||||||
|
'WC_REST_Orders_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php',
|
||||||
|
'WC_REST_Orders_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php',
|
||||||
|
'WC_REST_Orders_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php',
|
||||||
|
'WC_REST_Payment_Gateways_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php',
|
||||||
|
'WC_REST_Payment_Gateways_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php',
|
||||||
|
'WC_REST_Posts_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php',
|
||||||
|
'WC_REST_Product_Attribute_Terms_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-attribute-terms-controller.php',
|
||||||
|
'WC_REST_Product_Attribute_Terms_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php',
|
||||||
|
'WC_REST_Product_Attribute_Terms_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-attribute-terms-v2-controller.php',
|
||||||
|
'WC_REST_Product_Attributes_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-attributes-controller.php',
|
||||||
|
'WC_REST_Product_Attributes_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php',
|
||||||
|
'WC_REST_Product_Attributes_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-attributes-v2-controller.php',
|
||||||
|
'WC_REST_Product_Categories_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php',
|
||||||
|
'WC_REST_Product_Categories_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php',
|
||||||
|
'WC_REST_Product_Categories_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php',
|
||||||
|
'WC_REST_Product_Reviews_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php',
|
||||||
|
'WC_REST_Product_Reviews_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php',
|
||||||
|
'WC_REST_Product_Reviews_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php',
|
||||||
|
'WC_REST_Product_Shipping_Classes_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-shipping-classes-controller.php',
|
||||||
|
'WC_REST_Product_Shipping_Classes_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php',
|
||||||
|
'WC_REST_Product_Shipping_Classes_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-shipping-classes-v2-controller.php',
|
||||||
|
'WC_REST_Product_Tags_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-tags-controller.php',
|
||||||
|
'WC_REST_Product_Tags_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php',
|
||||||
|
'WC_REST_Product_Tags_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-tags-v2-controller.php',
|
||||||
|
'WC_REST_Product_Variations_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php',
|
||||||
|
'WC_REST_Product_Variations_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php',
|
||||||
|
'WC_REST_Products_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php',
|
||||||
|
'WC_REST_Products_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php',
|
||||||
|
'WC_REST_Products_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php',
|
||||||
|
'WC_REST_Report_Coupons_Totals_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php',
|
||||||
|
'WC_REST_Report_Customers_Totals_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-customers-totals-controller.php',
|
||||||
|
'WC_REST_Report_Orders_Totals_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php',
|
||||||
|
'WC_REST_Report_Products_Totals_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-products-totals-controller.php',
|
||||||
|
'WC_REST_Report_Reviews_Totals_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-reviews-totals-controller.php',
|
||||||
|
'WC_REST_Report_Sales_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-sales-controller.php',
|
||||||
|
'WC_REST_Report_Sales_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php',
|
||||||
|
'WC_REST_Report_Sales_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-report-sales-v2-controller.php',
|
||||||
|
'WC_REST_Report_Top_Sellers_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-top-sellers-controller.php',
|
||||||
|
'WC_REST_Report_Top_Sellers_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-report-top-sellers-v1-controller.php',
|
||||||
|
'WC_REST_Report_Top_Sellers_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-report-top-sellers-v2-controller.php',
|
||||||
|
'WC_REST_Reports_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-reports-controller.php',
|
||||||
|
'WC_REST_Reports_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-reports-v1-controller.php',
|
||||||
|
'WC_REST_Reports_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-reports-v2-controller.php',
|
||||||
|
'WC_REST_Setting_Options_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-setting-options-controller.php',
|
||||||
|
'WC_REST_Setting_Options_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php',
|
||||||
|
'WC_REST_Settings_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-settings-controller.php',
|
||||||
|
'WC_REST_Settings_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-settings-v2-controller.php',
|
||||||
|
'WC_REST_Shipping_Methods_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-methods-controller.php',
|
||||||
|
'WC_REST_Shipping_Methods_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php',
|
||||||
|
'WC_REST_Shipping_Zone_Locations_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zone-locations-controller.php',
|
||||||
|
'WC_REST_Shipping_Zone_Locations_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php',
|
||||||
|
'WC_REST_Shipping_Zone_Methods_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zone-methods-controller.php',
|
||||||
|
'WC_REST_Shipping_Zone_Methods_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php',
|
||||||
|
'WC_REST_Shipping_Zones_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller.php',
|
||||||
|
'WC_REST_Shipping_Zones_Controller_Base' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php',
|
||||||
|
'WC_REST_Shipping_Zones_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php',
|
||||||
|
'WC_REST_System_Status_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-system-status-controller.php',
|
||||||
|
'WC_REST_System_Status_Tools_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-system-status-tools-controller.php',
|
||||||
|
'WC_REST_System_Status_Tools_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php',
|
||||||
|
'WC_REST_System_Status_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php',
|
||||||
|
'WC_REST_Tax_Classes_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-tax-classes-controller.php',
|
||||||
|
'WC_REST_Tax_Classes_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php',
|
||||||
|
'WC_REST_Tax_Classes_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-tax-classes-v2-controller.php',
|
||||||
|
'WC_REST_Taxes_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-taxes-controller.php',
|
||||||
|
'WC_REST_Taxes_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php',
|
||||||
|
'WC_REST_Taxes_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-taxes-v2-controller.php',
|
||||||
|
'WC_REST_Terms_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php',
|
||||||
|
'WC_REST_Webhook_Deliveries_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php',
|
||||||
|
'WC_REST_Webhook_Deliveries_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-webhook-deliveries-v2-controller.php',
|
||||||
|
'WC_REST_Webhooks_Controller' => $baseDir . '/includes/rest-api/Controllers/Version3/class-wc-rest-webhooks-controller.php',
|
||||||
|
'WC_REST_Webhooks_V1_Controller' => $baseDir . '/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php',
|
||||||
|
'WC_REST_Webhooks_V2_Controller' => $baseDir . '/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php',
|
||||||
|
);
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_namespaces.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(dirname(__FILE__));
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
);
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_psr4.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(dirname(__FILE__));
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
|
||||||
|
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
||||||
|
'Pelago\\' => array($vendorDir . '/pelago/emogrifier/src'),
|
||||||
|
'MaxMind\\Db\\' => array($vendorDir . '/maxmind-db/reader/src/MaxMind/Db'),
|
||||||
|
'League\\Container\\' => array($vendorDir . '/league/container/src'),
|
||||||
|
'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
|
||||||
|
'Automattic\\WooCommerce\\Vendor\\League\\Container\\' => array($vendorDir . '/league/container'),
|
||||||
|
'Automattic\\WooCommerce\\Tests\\' => array($baseDir . '/tests/php/src'),
|
||||||
|
'Automattic\\WooCommerce\\Testing\\Tools\\' => array($baseDir . '/tests/Tools'),
|
||||||
|
'Automattic\\WooCommerce\\Blocks\\' => array($baseDir . '/packages/woocommerce-blocks/src'),
|
||||||
|
'Automattic\\WooCommerce\\Admin\\' => array($baseDir . '/packages/woocommerce-admin/src'),
|
||||||
|
'Automattic\\WooCommerce\\' => array($baseDir . '/src'),
|
||||||
|
'Automattic\\Jetpack\\Autoloader\\' => array($vendorDir . '/automattic/jetpack-autoloader/src'),
|
||||||
|
);
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
|
class ComposerAutoloaderInitf32f2e00289926aaf591fe7ce2891b1d
|
||||||
|
{
|
||||||
|
private static $loader;
|
||||||
|
|
||||||
|
public static function loadClassLoader($class)
|
||||||
|
{
|
||||||
|
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||||
|
require __DIR__ . '/ClassLoader.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Composer\Autoload\ClassLoader
|
||||||
|
*/
|
||||||
|
public static function getLoader()
|
||||||
|
{
|
||||||
|
if (null !== self::$loader) {
|
||||||
|
return self::$loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
require __DIR__ . '/platform_check.php';
|
||||||
|
|
||||||
|
spl_autoload_register(array('ComposerAutoloaderInitf32f2e00289926aaf591fe7ce2891b1d', 'loadClassLoader'), true, true);
|
||||||
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
|
spl_autoload_unregister(array('ComposerAutoloaderInitf32f2e00289926aaf591fe7ce2891b1d', 'loadClassLoader'));
|
||||||
|
|
||||||
|
$useStaticLoader = PHP_VERSION_ID >= 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\ComposerStaticInitf32f2e00289926aaf591fe7ce2891b1d::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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,219 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_static.php @generated by Composer
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
class ComposerStaticInitf32f2e00289926aaf591fe7ce2891b1d
|
||||||
|
{
|
||||||
|
public static $prefixLengthsPsr4 = array (
|
||||||
|
'S' =>
|
||||||
|
array (
|
||||||
|
'Symfony\\Component\\CssSelector\\' => 30,
|
||||||
|
),
|
||||||
|
'P' =>
|
||||||
|
array (
|
||||||
|
'Psr\\Container\\' => 14,
|
||||||
|
'Pelago\\' => 7,
|
||||||
|
),
|
||||||
|
'M' =>
|
||||||
|
array (
|
||||||
|
'MaxMind\\Db\\' => 11,
|
||||||
|
),
|
||||||
|
'L' =>
|
||||||
|
array (
|
||||||
|
'League\\Container\\' => 17,
|
||||||
|
),
|
||||||
|
'C' =>
|
||||||
|
array (
|
||||||
|
'Composer\\Installers\\' => 20,
|
||||||
|
),
|
||||||
|
'A' =>
|
||||||
|
array (
|
||||||
|
'Automattic\\WooCommerce\\Vendor\\League\\Container\\' => 47,
|
||||||
|
'Automattic\\WooCommerce\\Tests\\' => 29,
|
||||||
|
'Automattic\\WooCommerce\\Testing\\Tools\\' => 37,
|
||||||
|
'Automattic\\WooCommerce\\Blocks\\' => 30,
|
||||||
|
'Automattic\\WooCommerce\\Admin\\' => 29,
|
||||||
|
'Automattic\\WooCommerce\\' => 23,
|
||||||
|
'Automattic\\Jetpack\\Autoloader\\' => 30,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixDirsPsr4 = array (
|
||||||
|
'Symfony\\Component\\CssSelector\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/css-selector',
|
||||||
|
),
|
||||||
|
'Psr\\Container\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/container/src',
|
||||||
|
),
|
||||||
|
'Pelago\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/pelago/emogrifier/src',
|
||||||
|
),
|
||||||
|
'MaxMind\\Db\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db',
|
||||||
|
),
|
||||||
|
'League\\Container\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/league/container/src',
|
||||||
|
),
|
||||||
|
'Composer\\Installers\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
|
||||||
|
),
|
||||||
|
'Automattic\\WooCommerce\\Vendor\\League\\Container\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/league/container',
|
||||||
|
),
|
||||||
|
'Automattic\\WooCommerce\\Tests\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/../..' . '/tests/php/src',
|
||||||
|
),
|
||||||
|
'Automattic\\WooCommerce\\Testing\\Tools\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/../..' . '/tests/Tools',
|
||||||
|
),
|
||||||
|
'Automattic\\WooCommerce\\Blocks\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/../..' . '/packages/woocommerce-blocks/src',
|
||||||
|
),
|
||||||
|
'Automattic\\WooCommerce\\Admin\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/../..' . '/packages/woocommerce-admin/src',
|
||||||
|
),
|
||||||
|
'Automattic\\WooCommerce\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/../..' . '/src',
|
||||||
|
),
|
||||||
|
'Automattic\\Jetpack\\Autoloader\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $classMap = array (
|
||||||
|
'Automattic\\Jetpack\\Constants' => __DIR__ . '/..' . '/automattic/jetpack-constants/src/class-constants.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\Package' => __DIR__ . '/../..' . '/includes/rest-api/Package.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\Server' => __DIR__ . '/../..' . '/includes/rest-api/Server.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\AdminNotesHelper' => __DIR__ . '/../..' . '/tests/legacy/unit-tests/rest-api/Helpers/AdminNotesHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\CouponHelper' => __DIR__ . '/../..' . '/tests/legacy/unit-tests/rest-api/Helpers/CouponHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\CustomerHelper' => __DIR__ . '/../..' . '/tests/legacy/unit-tests/rest-api/Helpers/CustomerHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\OrderHelper' => __DIR__ . '/../..' . '/tests/legacy/unit-tests/rest-api/Helpers/OrderHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\ProductHelper' => __DIR__ . '/../..' . '/tests/legacy/unit-tests/rest-api/Helpers/ProductHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\QueueHelper' => __DIR__ . '/../..' . '/tests/legacy/unit-tests/rest-api/Helpers/QueueHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\SettingsHelper' => __DIR__ . '/../..' . '/tests/legacy/unit-tests/rest-api/Helpers/SettingsHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\UnitTests\\Helpers\\ShippingHelper' => __DIR__ . '/../..' . '/tests/legacy/unit-tests/rest-api/Helpers/ShippingHelper.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\Utilities\\ImageAttachment' => __DIR__ . '/../..' . '/includes/rest-api/Utilities/ImageAttachment.php',
|
||||||
|
'Automattic\\WooCommerce\\RestApi\\Utilities\\SingletonTrait' => __DIR__ . '/../..' . '/includes/rest-api/Utilities/SingletonTrait.php',
|
||||||
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||||
|
'WC_REST_CRUD_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php',
|
||||||
|
'WC_REST_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php',
|
||||||
|
'WC_REST_Coupons_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-coupons-controller.php',
|
||||||
|
'WC_REST_Coupons_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php',
|
||||||
|
'WC_REST_Coupons_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php',
|
||||||
|
'WC_REST_Customer_Downloads_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-customer-downloads-controller.php',
|
||||||
|
'WC_REST_Customer_Downloads_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php',
|
||||||
|
'WC_REST_Customer_Downloads_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php',
|
||||||
|
'WC_REST_Customers_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-customers-controller.php',
|
||||||
|
'WC_REST_Customers_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php',
|
||||||
|
'WC_REST_Customers_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-customers-v2-controller.php',
|
||||||
|
'WC_REST_Data_Continents_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php',
|
||||||
|
'WC_REST_Data_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-data-controller.php',
|
||||||
|
'WC_REST_Data_Countries_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-data-countries-controller.php',
|
||||||
|
'WC_REST_Data_Currencies_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php',
|
||||||
|
'WC_REST_Network_Orders_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-network-orders-controller.php',
|
||||||
|
'WC_REST_Network_Orders_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-network-orders-v2-controller.php',
|
||||||
|
'WC_REST_Order_Notes_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php',
|
||||||
|
'WC_REST_Order_Notes_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php',
|
||||||
|
'WC_REST_Order_Notes_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php',
|
||||||
|
'WC_REST_Order_Refunds_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php',
|
||||||
|
'WC_REST_Order_Refunds_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php',
|
||||||
|
'WC_REST_Order_Refunds_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php',
|
||||||
|
'WC_REST_Orders_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php',
|
||||||
|
'WC_REST_Orders_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php',
|
||||||
|
'WC_REST_Orders_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php',
|
||||||
|
'WC_REST_Payment_Gateways_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php',
|
||||||
|
'WC_REST_Payment_Gateways_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php',
|
||||||
|
'WC_REST_Posts_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php',
|
||||||
|
'WC_REST_Product_Attribute_Terms_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-attribute-terms-controller.php',
|
||||||
|
'WC_REST_Product_Attribute_Terms_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php',
|
||||||
|
'WC_REST_Product_Attribute_Terms_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-attribute-terms-v2-controller.php',
|
||||||
|
'WC_REST_Product_Attributes_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-attributes-controller.php',
|
||||||
|
'WC_REST_Product_Attributes_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php',
|
||||||
|
'WC_REST_Product_Attributes_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-attributes-v2-controller.php',
|
||||||
|
'WC_REST_Product_Categories_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php',
|
||||||
|
'WC_REST_Product_Categories_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php',
|
||||||
|
'WC_REST_Product_Categories_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php',
|
||||||
|
'WC_REST_Product_Reviews_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php',
|
||||||
|
'WC_REST_Product_Reviews_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php',
|
||||||
|
'WC_REST_Product_Reviews_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php',
|
||||||
|
'WC_REST_Product_Shipping_Classes_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-shipping-classes-controller.php',
|
||||||
|
'WC_REST_Product_Shipping_Classes_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php',
|
||||||
|
'WC_REST_Product_Shipping_Classes_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-shipping-classes-v2-controller.php',
|
||||||
|
'WC_REST_Product_Tags_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-tags-controller.php',
|
||||||
|
'WC_REST_Product_Tags_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php',
|
||||||
|
'WC_REST_Product_Tags_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-tags-v2-controller.php',
|
||||||
|
'WC_REST_Product_Variations_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php',
|
||||||
|
'WC_REST_Product_Variations_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php',
|
||||||
|
'WC_REST_Products_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php',
|
||||||
|
'WC_REST_Products_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php',
|
||||||
|
'WC_REST_Products_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php',
|
||||||
|
'WC_REST_Report_Coupons_Totals_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php',
|
||||||
|
'WC_REST_Report_Customers_Totals_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-customers-totals-controller.php',
|
||||||
|
'WC_REST_Report_Orders_Totals_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php',
|
||||||
|
'WC_REST_Report_Products_Totals_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-products-totals-controller.php',
|
||||||
|
'WC_REST_Report_Reviews_Totals_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-reviews-totals-controller.php',
|
||||||
|
'WC_REST_Report_Sales_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-sales-controller.php',
|
||||||
|
'WC_REST_Report_Sales_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php',
|
||||||
|
'WC_REST_Report_Sales_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-report-sales-v2-controller.php',
|
||||||
|
'WC_REST_Report_Top_Sellers_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-report-top-sellers-controller.php',
|
||||||
|
'WC_REST_Report_Top_Sellers_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-report-top-sellers-v1-controller.php',
|
||||||
|
'WC_REST_Report_Top_Sellers_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-report-top-sellers-v2-controller.php',
|
||||||
|
'WC_REST_Reports_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-reports-controller.php',
|
||||||
|
'WC_REST_Reports_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-reports-v1-controller.php',
|
||||||
|
'WC_REST_Reports_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-reports-v2-controller.php',
|
||||||
|
'WC_REST_Setting_Options_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-setting-options-controller.php',
|
||||||
|
'WC_REST_Setting_Options_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php',
|
||||||
|
'WC_REST_Settings_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-settings-controller.php',
|
||||||
|
'WC_REST_Settings_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-settings-v2-controller.php',
|
||||||
|
'WC_REST_Shipping_Methods_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-methods-controller.php',
|
||||||
|
'WC_REST_Shipping_Methods_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php',
|
||||||
|
'WC_REST_Shipping_Zone_Locations_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zone-locations-controller.php',
|
||||||
|
'WC_REST_Shipping_Zone_Locations_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php',
|
||||||
|
'WC_REST_Shipping_Zone_Methods_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zone-methods-controller.php',
|
||||||
|
'WC_REST_Shipping_Zone_Methods_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php',
|
||||||
|
'WC_REST_Shipping_Zones_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller.php',
|
||||||
|
'WC_REST_Shipping_Zones_Controller_Base' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php',
|
||||||
|
'WC_REST_Shipping_Zones_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php',
|
||||||
|
'WC_REST_System_Status_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-system-status-controller.php',
|
||||||
|
'WC_REST_System_Status_Tools_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-system-status-tools-controller.php',
|
||||||
|
'WC_REST_System_Status_Tools_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php',
|
||||||
|
'WC_REST_System_Status_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php',
|
||||||
|
'WC_REST_Tax_Classes_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-tax-classes-controller.php',
|
||||||
|
'WC_REST_Tax_Classes_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php',
|
||||||
|
'WC_REST_Tax_Classes_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-tax-classes-v2-controller.php',
|
||||||
|
'WC_REST_Taxes_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-taxes-controller.php',
|
||||||
|
'WC_REST_Taxes_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php',
|
||||||
|
'WC_REST_Taxes_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-taxes-v2-controller.php',
|
||||||
|
'WC_REST_Terms_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php',
|
||||||
|
'WC_REST_Webhook_Deliveries_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php',
|
||||||
|
'WC_REST_Webhook_Deliveries_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-webhook-deliveries-v2-controller.php',
|
||||||
|
'WC_REST_Webhooks_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version3/class-wc-rest-webhooks-controller.php',
|
||||||
|
'WC_REST_Webhooks_V1_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php',
|
||||||
|
'WC_REST_Webhooks_V2_Controller' => __DIR__ . '/../..' . '/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php',
|
||||||
|
);
|
||||||
|
|
||||||
|
public static function getInitializer(ClassLoader $loader)
|
||||||
|
{
|
||||||
|
return \Closure::bind(function () use ($loader) {
|
||||||
|
$loader->prefixLengthsPsr4 = ComposerStaticInitf32f2e00289926aaf591fe7ce2891b1d::$prefixLengthsPsr4;
|
||||||
|
$loader->prefixDirsPsr4 = ComposerStaticInitf32f2e00289926aaf591fe7ce2891b1d::$prefixDirsPsr4;
|
||||||
|
$loader->classMap = ComposerStaticInitf32f2e00289926aaf591fe7ce2891b1d::$classMap;
|
||||||
|
|
||||||
|
}, null, ClassLoader::class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,719 @@
|
||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "automattic/jetpack-autoloader",
|
||||||
|
"version": "v2.2.0",
|
||||||
|
"version_normalized": "2.2.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Automattic/jetpack-autoloader.git",
|
||||||
|
"reference": "66a5d150b3928be718d86696f85631a7f0b98a7b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/66a5d150b3928be718d86696f85631a7f0b98a7b",
|
||||||
|
"reference": "66a5d150b3928be718d86696f85631a7f0b98a7b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer-plugin-api": "^1.1 || ^2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
||||||
|
},
|
||||||
|
"time": "2020-08-14T20:34:36+00:00",
|
||||||
|
"type": "composer-plugin",
|
||||||
|
"extra": {
|
||||||
|
"class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin"
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"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/master"
|
||||||
|
},
|
||||||
|
"install-path": "../automattic/jetpack-autoloader"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "automattic/jetpack-constants",
|
||||||
|
"version": "v1.5.0",
|
||||||
|
"version_normalized": "1.5.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Automattic/jetpack-constants.git",
|
||||||
|
"reference": "9827a2f446b8c4faafaf1c740483031c073a381d"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/9827a2f446b8c4faafaf1c740483031c073a381d",
|
||||||
|
"reference": "9827a2f446b8c4faafaf1c740483031c073a381d",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"php-mock/php-mock": "^2.1",
|
||||||
|
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
|
||||||
|
},
|
||||||
|
"time": "2020-08-13T14:33:09+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GPL-2.0-or-later"
|
||||||
|
],
|
||||||
|
"description": "A wrapper for defining constants in a more testable way.",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/Automattic/jetpack-constants/tree/master"
|
||||||
|
},
|
||||||
|
"install-path": "../automattic/jetpack-constants"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "composer/installers",
|
||||||
|
"version": "v1.9.0",
|
||||||
|
"version_normalized": "1.9.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/composer/installers.git",
|
||||||
|
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
|
||||||
|
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer-plugin-api": "^1.0 || ^2.0"
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"roundcube/plugin-installer": "*",
|
||||||
|
"shama/baton": "*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"composer/composer": "1.6.* || 2.0.*@dev",
|
||||||
|
"composer/semver": "1.0.* || 2.0.*@dev",
|
||||||
|
"phpunit/phpunit": "^4.8.36",
|
||||||
|
"sebastian/comparator": "^1.2.4",
|
||||||
|
"symfony/process": "^2.3"
|
||||||
|
},
|
||||||
|
"time": "2020-04-07T06:57:05+00:00",
|
||||||
|
"type": "composer-plugin",
|
||||||
|
"extra": {
|
||||||
|
"class": "Composer\\Installers\\Plugin",
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0-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",
|
||||||
|
"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",
|
||||||
|
"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.9.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://packagist.com",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "./installers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "league/container",
|
||||||
|
"version": "3.3.3",
|
||||||
|
"version_normalized": "3.3.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thephpleague/container.git",
|
||||||
|
"reference": "7dc67bdf89efc338e674863c0ea70a63efe4de05"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thephpleague/container/zipball/7dc67bdf89efc338e674863c0ea70a63efe4de05",
|
||||||
|
"reference": "7dc67bdf89efc338e674863c0ea70a63efe4de05",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.0 || ^8.0",
|
||||||
|
"psr/container": "^1.0"
|
||||||
|
},
|
||||||
|
"provide": {
|
||||||
|
"psr/container-implementation": "^1.0"
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"orno/di": "~2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^6.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.3"
|
||||||
|
},
|
||||||
|
"time": "2020-09-28T13:38:44+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-3.x": "3.x-dev",
|
||||||
|
"dev-2.x": "2.x-dev",
|
||||||
|
"dev-1.x": "1.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"League\\Container\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Phil Bennett",
|
||||||
|
"email": "philipobenito@gmail.com",
|
||||||
|
"homepage": "http://www.philipobenito.com",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A fast and intuitive dependency injection container.",
|
||||||
|
"homepage": "https://github.com/thephpleague/container",
|
||||||
|
"keywords": [
|
||||||
|
"container",
|
||||||
|
"dependency",
|
||||||
|
"di",
|
||||||
|
"injection",
|
||||||
|
"league",
|
||||||
|
"provider",
|
||||||
|
"service"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/thephpleague/container/issues",
|
||||||
|
"source": "https://github.com/thephpleague/container/tree/3.3.3"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/philipobenito",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../league/container"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "maxmind-db/reader",
|
||||||
|
"version": "v1.6.0",
|
||||||
|
"version_normalized": "1.6.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
|
||||||
|
"reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/febd4920bf17c1da84cef58e56a8227dfb37fbe4",
|
||||||
|
"reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.6"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"ext-maxminddb": "<1.6.0,>=2.0.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "2.*",
|
||||||
|
"php-coveralls/php-coveralls": "^2.1",
|
||||||
|
"phpunit/phpcov": "^3.0",
|
||||||
|
"phpunit/phpunit": "5.*",
|
||||||
|
"squizlabs/php_codesniffer": "3.*"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
|
||||||
|
"ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
|
||||||
|
"ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
|
||||||
|
},
|
||||||
|
"time": "2019-12-19T22:59:03+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"MaxMind\\Db\\": "src/MaxMind/Db"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"Apache-2.0"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Gregory J. Oschwald",
|
||||||
|
"email": "goschwald@maxmind.com",
|
||||||
|
"homepage": "https://www.maxmind.com/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "MaxMind DB Reader API",
|
||||||
|
"homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
|
||||||
|
"keywords": [
|
||||||
|
"database",
|
||||||
|
"geoip",
|
||||||
|
"geoip2",
|
||||||
|
"geolocation",
|
||||||
|
"maxmind"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues",
|
||||||
|
"source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.6.0"
|
||||||
|
},
|
||||||
|
"install-path": "../maxmind-db/reader"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pelago/emogrifier",
|
||||||
|
"version": "v3.1.0",
|
||||||
|
"version_normalized": "3.1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/MyIntervals/emogrifier.git",
|
||||||
|
"reference": "f6a5c7d44612d86c3901c93f1592f5440e6b2cd8"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/MyIntervals/emogrifier/zipball/f6a5c7d44612d86c3901c93f1592f5440e6b2cd8",
|
||||||
|
"reference": "f6a5c7d44612d86c3901c93f1592f5440e6b2cd8",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-libxml": "*",
|
||||||
|
"php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4",
|
||||||
|
"symfony/css-selector": "^2.8 || ^3.0 || ^4.0 || ^5.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.15.3",
|
||||||
|
"phpmd/phpmd": "^2.7.0",
|
||||||
|
"phpunit/phpunit": "^5.7.27",
|
||||||
|
"squizlabs/php_codesniffer": "^3.5.0"
|
||||||
|
},
|
||||||
|
"time": "2019-12-26T19:37:31+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "4.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Pelago\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Oliver Klee",
|
||||||
|
"email": "github@oliverklee.de"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Zoli Szabó",
|
||||||
|
"email": "zoli.szabo+github@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "John Reeve",
|
||||||
|
"email": "jreeve@pelagodesign.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jake Hotson",
|
||||||
|
"email": "jake@qzdesign.co.uk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Cameron Brooks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jaime Prado"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Converts CSS styles into inline style attributes in your HTML code",
|
||||||
|
"homepage": "https://www.myintervals.com/emogrifier.php",
|
||||||
|
"keywords": [
|
||||||
|
"css",
|
||||||
|
"email",
|
||||||
|
"pre-processing"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/MyIntervals/emogrifier/issues",
|
||||||
|
"source": "https://github.com/MyIntervals/emogrifier"
|
||||||
|
},
|
||||||
|
"install-path": "../pelago/emogrifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/container",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"version_normalized": "1.0.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/container.git",
|
||||||
|
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
|
||||||
|
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"time": "2017-02-14T16:28:37+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Container\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "http://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common Container Interface (PHP FIG PSR-11)",
|
||||||
|
"homepage": "https://github.com/php-fig/container",
|
||||||
|
"keywords": [
|
||||||
|
"PSR-11",
|
||||||
|
"container",
|
||||||
|
"container-interface",
|
||||||
|
"container-interop",
|
||||||
|
"psr"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-fig/container/issues",
|
||||||
|
"source": "https://github.com/php-fig/container/tree/master"
|
||||||
|
},
|
||||||
|
"install-path": "../psr/container"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/css-selector",
|
||||||
|
"version": "v3.3.6",
|
||||||
|
"version_normalized": "3.3.6.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/css-selector.git",
|
||||||
|
"reference": "4d882dced7b995d5274293039370148e291808f2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/css-selector/zipball/4d882dced7b995d5274293039370148e291808f2",
|
||||||
|
"reference": "4d882dced7b995d5274293039370148e291808f2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9"
|
||||||
|
},
|
||||||
|
"time": "2017-05-01T15:01:29+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.3-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\CssSelector\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jean-François Simon",
|
||||||
|
"email": "jeanfrancois.simon@sensiolabs.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony CssSelector Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/css-selector/tree/master"
|
||||||
|
},
|
||||||
|
"install-path": "../symfony/css-selector"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "woocommerce/action-scheduler",
|
||||||
|
"version": "3.1.6",
|
||||||
|
"version_normalized": "3.1.6.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/woocommerce/action-scheduler.git",
|
||||||
|
"reference": "275d0ba54b1c263dfc62688de2fa9a25a373edf8"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/275d0ba54b1c263dfc62688de2fa9a25a373edf8",
|
||||||
|
"reference": "275d0ba54b1c263dfc62688de2fa9a25a373edf8",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^5.6",
|
||||||
|
"woocommerce/woocommerce-sniffs": "0.0.8",
|
||||||
|
"wp-cli/wp-cli": "~1.5.1"
|
||||||
|
},
|
||||||
|
"time": "2020-05-12T16:22:33+00:00",
|
||||||
|
"type": "wordpress-plugin",
|
||||||
|
"extra": {
|
||||||
|
"scripts-description": {
|
||||||
|
"test": "Run unit tests",
|
||||||
|
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
|
||||||
|
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GPL-3.0-or-later"
|
||||||
|
],
|
||||||
|
"description": "Action Scheduler for WordPress and WooCommerce",
|
||||||
|
"homepage": "https://actionscheduler.org/",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/woocommerce/action-scheduler/issues",
|
||||||
|
"source": "https://github.com/woocommerce/action-scheduler/tree/master"
|
||||||
|
},
|
||||||
|
"install-path": "../../packages/action-scheduler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "woocommerce/woocommerce-admin",
|
||||||
|
"version": "1.7.3",
|
||||||
|
"version_normalized": "1.7.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/woocommerce/woocommerce-admin.git",
|
||||||
|
"reference": "16de972f319e5e6fc8dbebf5024dd263234f39e0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/16de972f319e5e6fc8dbebf5024dd263234f39e0",
|
||||||
|
"reference": "16de972f319e5e6fc8dbebf5024dd263234f39e0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"automattic/jetpack-autoloader": "^2.2.0",
|
||||||
|
"composer/installers": "^1.9.0",
|
||||||
|
"php": ">=5.6|>=7.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "7.5.20",
|
||||||
|
"suin/phpcs-psr4-sniff": "^2.2",
|
||||||
|
"woocommerce/woocommerce-sniffs": "0.1.0"
|
||||||
|
},
|
||||||
|
"time": "2020-12-03T21:12:01+00:00",
|
||||||
|
"type": "wordpress-plugin",
|
||||||
|
"extra": {
|
||||||
|
"scripts-description": {
|
||||||
|
"test": "Run unit tests",
|
||||||
|
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
|
||||||
|
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Automattic\\WooCommerce\\Admin\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GPL-3.0-or-later"
|
||||||
|
],
|
||||||
|
"description": "A modern, javascript-driven WooCommerce Admin experience.",
|
||||||
|
"homepage": "https://github.com/woocommerce/woocommerce-admin",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/woocommerce/woocommerce-admin/issues",
|
||||||
|
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v1.7.3"
|
||||||
|
},
|
||||||
|
"install-path": "../../packages/woocommerce-admin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "woocommerce/woocommerce-blocks",
|
||||||
|
"version": "v3.8.1",
|
||||||
|
"version_normalized": "3.8.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
|
||||||
|
"reference": "e5aef9eddd13c5511ba673eb70ed8cb3e80d828c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/e5aef9eddd13c5511ba673eb70ed8cb3e80d828c",
|
||||||
|
"reference": "e5aef9eddd13c5511ba673eb70ed8cb3e80d828c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"automattic/jetpack-autoloader": "^2.0.0",
|
||||||
|
"composer/installers": "^1.7.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "6.5.14",
|
||||||
|
"woocommerce/woocommerce-sniffs": "0.1.0"
|
||||||
|
},
|
||||||
|
"time": "2020-11-23T20:48:39+00:00",
|
||||||
|
"type": "wordpress-plugin",
|
||||||
|
"extra": {
|
||||||
|
"scripts-description": {
|
||||||
|
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
|
||||||
|
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Automattic\\WooCommerce\\Blocks\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GPL-3.0-or-later"
|
||||||
|
],
|
||||||
|
"description": "WooCommerce blocks for the Gutenberg editor.",
|
||||||
|
"homepage": "https://woocommerce.com/",
|
||||||
|
"keywords": [
|
||||||
|
"blocks",
|
||||||
|
"gutenberg",
|
||||||
|
"woocommerce"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues",
|
||||||
|
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v3.8.1"
|
||||||
|
},
|
||||||
|
"install-path": "../../packages/woocommerce-blocks"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dev": false,
|
||||||
|
"dev-package-names": []
|
||||||
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
<?php return array (
|
||||||
|
'root' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'dev-release/4.8',
|
||||||
|
'version' => 'dev-release/4.8',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '5036ee60117f124a8a4f4692c95edddb177599ee',
|
||||||
|
'name' => 'woocommerce/woocommerce',
|
||||||
|
),
|
||||||
|
'versions' =>
|
||||||
|
array (
|
||||||
|
'automattic/jetpack-autoloader' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v2.2.0',
|
||||||
|
'version' => '2.2.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '66a5d150b3928be718d86696f85631a7f0b98a7b',
|
||||||
|
),
|
||||||
|
'automattic/jetpack-constants' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v1.5.0',
|
||||||
|
'version' => '1.5.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '9827a2f446b8c4faafaf1c740483031c073a381d',
|
||||||
|
),
|
||||||
|
'composer/installers' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v1.9.0',
|
||||||
|
'version' => '1.9.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
|
||||||
|
),
|
||||||
|
'league/container' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => '3.3.3',
|
||||||
|
'version' => '3.3.3.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '7dc67bdf89efc338e674863c0ea70a63efe4de05',
|
||||||
|
),
|
||||||
|
'maxmind-db/reader' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v1.6.0',
|
||||||
|
'version' => '1.6.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
|
||||||
|
),
|
||||||
|
'orno/di' =>
|
||||||
|
array (
|
||||||
|
'replaced' =>
|
||||||
|
array (
|
||||||
|
0 => '~2.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'pelago/emogrifier' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v3.1.0',
|
||||||
|
'version' => '3.1.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'f6a5c7d44612d86c3901c93f1592f5440e6b2cd8',
|
||||||
|
),
|
||||||
|
'psr/container' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => '1.0.0',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
|
||||||
|
),
|
||||||
|
'psr/container-implementation' =>
|
||||||
|
array (
|
||||||
|
'provided' =>
|
||||||
|
array (
|
||||||
|
0 => '^1.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'roundcube/plugin-installer' =>
|
||||||
|
array (
|
||||||
|
'replaced' =>
|
||||||
|
array (
|
||||||
|
0 => '*',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'shama/baton' =>
|
||||||
|
array (
|
||||||
|
'replaced' =>
|
||||||
|
array (
|
||||||
|
0 => '*',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'symfony/css-selector' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v3.3.6',
|
||||||
|
'version' => '3.3.6.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '4d882dced7b995d5274293039370148e291808f2',
|
||||||
|
),
|
||||||
|
'woocommerce/action-scheduler' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => '3.1.6',
|
||||||
|
'version' => '3.1.6.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '275d0ba54b1c263dfc62688de2fa9a25a373edf8',
|
||||||
|
),
|
||||||
|
'woocommerce/woocommerce' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'dev-release/4.8',
|
||||||
|
'version' => 'dev-release/4.8',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '5036ee60117f124a8a4f4692c95edddb177599ee',
|
||||||
|
),
|
||||||
|
'woocommerce/woocommerce-admin' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => '1.7.3',
|
||||||
|
'version' => '1.7.3.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '16de972f319e5e6fc8dbebf5024dd263234f39e0',
|
||||||
|
),
|
||||||
|
'woocommerce/woocommerce-blocks' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v3.8.1',
|
||||||
|
'version' => '3.8.1.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'e5aef9eddd13c5511ba673eb70ed8cb3e80d828c',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
|
@ -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.
|
|
@ -0,0 +1,112 @@
|
||||||
|
{
|
||||||
|
"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",
|
||||||
|
"RadPHP",
|
||||||
|
"ReIndex",
|
||||||
|
"Roundcube",
|
||||||
|
"shopware",
|
||||||
|
"SilverStripe",
|
||||||
|
"SMF",
|
||||||
|
"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" }
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"class": "Composer\\Installers\\Plugin",
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"shama/baton": "*",
|
||||||
|
"roundcube/plugin-installer": "*"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer-plugin-api": "^1.0 || ^2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"composer/composer": "1.6.* || 2.0.*@dev",
|
||||||
|
"composer/semver": "1.0.* || 2.0.*@dev",
|
||||||
|
"phpunit/phpunit": "^4.8.36",
|
||||||
|
"sebastian/comparator": "^1.2.4",
|
||||||
|
"symfony/process": "^2.3"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "phpunit"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class AglInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class AimeosInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'extension' => 'ext/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class AnnotateCmsInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'addons/modules/{$name}/',
|
||||||
|
'component' => 'addons/components/{$name}/',
|
||||||
|
'service' => 'addons/services/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class AsgardInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class AttogramInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'modules/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
|
use Composer\Composer;
|
||||||
|
use Composer\Package\PackageInterface;
|
||||||
|
|
||||||
|
abstract class BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array();
|
||||||
|
protected $composer;
|
||||||
|
protected $package;
|
||||||
|
protected $io;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes base installer.
|
||||||
|
*
|
||||||
|
* @param PackageInterface $package
|
||||||
|
* @param Composer $composer
|
||||||
|
* @param IOInterface $io
|
||||||
|
*/
|
||||||
|
public function __construct(PackageInterface $package = null, Composer $composer = null, IOInterface $io = null)
|
||||||
|
{
|
||||||
|
$this->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
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function inflectPackageVars($vars)
|
||||||
|
{
|
||||||
|
return $vars;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the installer's locations
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
use Composer\Util\Filesystem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installer for Bitrix Framework. Supported types of extensions:
|
||||||
|
* - `bitrix-d7-module` — copy the module to directory `bitrix/modules/<vendor>.<name>`.
|
||||||
|
* - `bitrix-d7-component` — copy the component to directory `bitrix/components/<vendor>/<name>`.
|
||||||
|
* - `bitrix-d7-template` — copy the template to directory `bitrix/templates/<vendor>_<name>`.
|
||||||
|
*
|
||||||
|
* You can set custom path to directory with Bitrix kernel in `composer.json`:
|
||||||
|
*
|
||||||
|
* ```json
|
||||||
|
* {
|
||||||
|
* "extra": {
|
||||||
|
* "bitrix-dir": "s1/bitrix"
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @author Nik Samokhvalov <nik@samokhvalov.info>
|
||||||
|
* @author Denis Kulichkin <onexhovia@gmail.com>
|
||||||
|
*/
|
||||||
|
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(' <error>Duplication of packages:</error>');
|
||||||
|
$this->io->writeError(' <info>Package ' . $oldPath . ' will be called instead package ' . $path . '</info>');
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
switch ($this->io->ask(' <info>Delete ' . $oldPath . ' [y,n,?]?</info> ', '?')) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class BonefishInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'package' => 'Packages/{$vendor}/{$name}/'
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
use Composer\DependencyResolver\Pool;
|
||||||
|
|
||||||
|
class CakePHPInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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)
|
||||||
|
{
|
||||||
|
if (class_exists('Composer\Semver\Constraint\MultiConstraint')) {
|
||||||
|
$multiClass = 'Composer\Semver\Constraint\MultiConstraint';
|
||||||
|
$constraintClass = 'Composer\Semver\Constraint\Constraint';
|
||||||
|
} else {
|
||||||
|
$multiClass = 'Composer\Package\LinkConstraint\MultiConstraint';
|
||||||
|
$constraintClass = 'Composer\Package\LinkConstraint\VersionConstraint';
|
||||||
|
}
|
||||||
|
|
||||||
|
$repositoryManager = $this->composer->getRepositoryManager();
|
||||||
|
if (! $repositoryManager) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$repos = $repositoryManager->getLocalRepository();
|
||||||
|
if (!$repos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $repos->findPackage('cakephp/cakephp', new $constraintClass($matcher, $version)) !== null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class ChefInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'cookbook' => 'Chef/{$vendor}/{$name}/',
|
||||||
|
'role' => 'Chef/roles/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class CiviCrmInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'ext' => 'ext/{$name}/'
|
||||||
|
);
|
||||||
|
}
|
10
vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php
vendored
Normal file
10
vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class ClanCatsFrameworkInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'ship' => 'CCF/orbit/{$name}/',
|
||||||
|
'theme' => 'CCF/app/themes/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class CockpitInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'cockpit/modules/addons/{$name}/',
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format module name.
|
||||||
|
*
|
||||||
|
* Strip `module-` prefix from package name.
|
||||||
|
*
|
||||||
|
* @param array @vars
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class CodeIgniterInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'library' => 'application/libraries/{$name}/',
|
||||||
|
'third-party' => 'application/third_party/{$name}/',
|
||||||
|
'module' => 'application/modules/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class Concrete5Installer extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'core' => 'concrete/',
|
||||||
|
'block' => 'application/blocks/{$name}/',
|
||||||
|
'package' => 'packages/{$name}/',
|
||||||
|
'theme' => 'application/themes/{$name}/',
|
||||||
|
'update' => 'updates/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installer for Craft Plugins
|
||||||
|
*/
|
||||||
|
class CraftInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
const NAME_PREFIX = 'craft';
|
||||||
|
const NAME_SUFFIX = 'plugin';
|
||||||
|
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class CroogoInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class DecibelInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
/** @var array */
|
||||||
|
protected $locations = array(
|
||||||
|
'app' => 'app/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class DframeInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'modules/{$vendor}/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class DokuWikiInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DolibarrInstaller
|
||||||
|
*
|
||||||
|
* @package Composer\Installers
|
||||||
|
* @author Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
*/
|
||||||
|
class DolibarrInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
//TODO: Add support for scripts and themes
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'htdocs/custom/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class DrupalInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'core' => '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/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class ElggInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => 'mod/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class EliasisInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'component' => 'components/{$name}/',
|
||||||
|
'module' => 'modules/{$name}/',
|
||||||
|
'plugin' => 'plugins/{$name}/',
|
||||||
|
'template' => 'templates/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
29
vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php
vendored
Normal file
29
vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
use Composer\Package\PackageInterface;
|
||||||
|
|
||||||
|
class ExpressionEngineInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $locations = array();
|
||||||
|
|
||||||
|
private $ee2Locations = array(
|
||||||
|
'addon' => '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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class EzPlatformInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'meta-assets' => 'web/assets/ezplatform/',
|
||||||
|
'assets' => 'web/assets/ezplatform/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class FuelInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'fuel/app/modules/{$name}/',
|
||||||
|
'package' => 'fuel/packages/{$name}/',
|
||||||
|
'theme' => 'fuel/app/themes/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class FuelphpInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'component' => 'components/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class GravInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class HuradInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class ImageCMSInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'template' => 'templates/{$name}/',
|
||||||
|
'module' => 'application/modules/{$name}/',
|
||||||
|
'library' => 'application/libraries/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,280 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
use Composer\Composer;
|
||||||
|
use Composer\Installer\BinaryInstaller;
|
||||||
|
use Composer\Installer\LibraryInstaller;
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
|
use Composer\Package\PackageInterface;
|
||||||
|
use Composer\Repository\InstalledRepositoryInterface;
|
||||||
|
use Composer\Util\Filesystem;
|
||||||
|
|
||||||
|
class Installer extends LibraryInstaller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Package types to installer class map
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $supportedTypes = array(
|
||||||
|
'aimeos' => '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',
|
||||||
|
'redaxo' => 'RedaxoInstaller',
|
||||||
|
'redaxo5' => 'Redaxo5Installer',
|
||||||
|
'reindex' => 'ReIndexInstaller',
|
||||||
|
'roundcube' => 'RoundcubeInstaller',
|
||||||
|
'shopware' => 'ShopwareInstaller',
|
||||||
|
'sitedirect' => 'SiteDirectInstaller',
|
||||||
|
'silverstripe' => 'SilverStripeInstaller',
|
||||||
|
'smf' => 'SMFInstaller',
|
||||||
|
'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)
|
||||||
|
{
|
||||||
|
parent::uninstall($repo, $package);
|
||||||
|
$installPath = $this->getPackageBasePath($package);
|
||||||
|
$this->io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@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
|
||||||
|
*/
|
||||||
|
protected function findFrameworkType($type)
|
||||||
|
{
|
||||||
|
$frameworkType = false;
|
||||||
|
|
||||||
|
krsort($this->supportedTypes);
|
||||||
|
|
||||||
|
foreach ($this->supportedTypes as $key => $val) {
|
||||||
|
if ($key === substr($type, 0, strlen($key))) {
|
||||||
|
$frameworkType = substr($type, 0, strlen($key));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $frameworkType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class ItopInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'extension' => 'extensions/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class JoomlaInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'component' => 'components/{$name}/',
|
||||||
|
'module' => 'modules/{$name}/',
|
||||||
|
'template' => 'templates/{$name}/',
|
||||||
|
'plugin' => 'plugins/{$name}/',
|
||||||
|
'library' => 'libraries/{$name}/',
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: Add inflector for mod_ and com_ names
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Installer for kanboard plugins
|
||||||
|
*
|
||||||
|
* kanboard.net
|
||||||
|
*
|
||||||
|
* Class KanboardInstaller
|
||||||
|
* @package Composer\Installers
|
||||||
|
*/
|
||||||
|
class KanboardInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => 'plugins/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class KirbyInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => 'site/plugins/{$name}/',
|
||||||
|
'field' => 'site/fields/{$name}/',
|
||||||
|
'tag' => 'site/tags/{$name}/'
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class KnownInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => 'IdnoPlugins/{$name}/',
|
||||||
|
'theme' => 'Themes/{$name}/',
|
||||||
|
'console' => 'ConsolePlugins/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class KodiCMSInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => 'cms/plugins/{$name}/',
|
||||||
|
'media' => 'cms/media/vendor/{$name}/'
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class KohanaInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'modules/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
27
vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php
vendored
Normal file
27
vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class LanManagementSystemInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class LaravelInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'library' => 'libraries/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class LavaLiteInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'package' => 'packages/{$vendor}/{$name}/',
|
||||||
|
'theme' => 'public/themes/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class LithiumInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'library' => 'libraries/{$name}/',
|
||||||
|
'source' => 'libraries/_source/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class MODULEWorkInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'modules/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An installer to handle MODX Evolution specifics when installing packages.
|
||||||
|
*/
|
||||||
|
class MODXEvoInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'snippet' => 'assets/snippets/{$name}/',
|
||||||
|
'plugin' => 'assets/plugins/{$name}/',
|
||||||
|
'module' => 'assets/modules/{$name}/',
|
||||||
|
'template' => 'assets/templates/{$name}/',
|
||||||
|
'lib' => 'assets/lib/{$name}/'
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class MagentoInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'theme' => 'app/design/frontend/{$name}/',
|
||||||
|
'skin' => 'skin/frontend/default/{$name}/',
|
||||||
|
'library' => 'lib/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin/theme installer for majima
|
||||||
|
* @author David Neustadt
|
||||||
|
*/
|
||||||
|
class MajimaInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class MakoInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'package' => 'app/packages/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
use Composer\DependencyResolver\Pool;
|
||||||
|
|
||||||
|
class MantisBTInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class MauticInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => '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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class MayaInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class MediaWikiInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'core' => '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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class MicroweberInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An installer to handle MODX specifics when installing packages.
|
||||||
|
*/
|
||||||
|
class ModxInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'extra' => 'core/packages/{$name}/'
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class MoodleInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'mod' => '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}/',
|
||||||
|
'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}/'
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class OctoberInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class OntoWikiInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'extension' => '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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
|
||||||
|
class OsclassInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $locations = array(
|
||||||
|
'plugin' => 'oc-content/plugins/{$name}/',
|
||||||
|
'theme' => 'oc-content/themes/{$name}/',
|
||||||
|
'language' => 'oc-content/languages/{$name}/',
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
use Composer\Package\PackageInterface;
|
||||||
|
|
||||||
|
class OxidInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
|
||||||
|
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'modules/{$name}/',
|
||||||
|
'theme' => 'application/views/{$name}/',
|
||||||
|
'out' => 'out/{$name}/',
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getInstallPath
|
||||||
|
*
|
||||||
|
* @param PackageInterface $package
|
||||||
|
* @param string $frameworkType
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class PPIInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'module' => 'modules/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
namespace Composer\Installers;
|
||||||
|
|
||||||
|
class PhiftyInstaller extends BaseInstaller
|
||||||
|
{
|
||||||
|
protected $locations = array(
|
||||||
|
'bundle' => 'bundles/{$name}/',
|
||||||
|
'library' => 'libraries/{$name}/',
|
||||||
|
'framework' => 'frameworks/{$name}/',
|
||||||
|
);
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue