Changeset 2887683
- Timestamp:
- 03/27/2023 02:59:48 PM (3 years ago)
- Location:
- digest
- Files:
-
- 2 added
- 2 deleted
- 28 edited
- 1 copied
-
tags/3.0.0 (copied) (copied from digest/trunk)
-
tags/3.0.0/CHANGELOG.md (added)
-
tags/3.0.0/digest.php (modified) (2 diffs)
-
tags/3.0.0/inc/Cron.php (modified) (3 diffs)
-
tags/3.0.0/inc/Setting/FrequencySetting.php (modified) (3 diffs)
-
tags/3.0.0/inc/namespace.php (modified) (1 diff)
-
tags/3.0.0/js/digest.js (modified) (1 diff)
-
tags/3.0.0/vendor/autoload.php (modified) (1 diff)
-
tags/3.0.0/vendor/composer/ClassLoader.php (modified) (18 diffs)
-
tags/3.0.0/vendor/composer/InstalledVersions.php (modified) (2 diffs)
-
tags/3.0.0/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/3.0.0/vendor/composer/autoload_namespaces.php (modified) (1 diff)
-
tags/3.0.0/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
tags/3.0.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/3.0.0/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/3.0.0/vendor/composer/installed.php (modified) (1 diff)
-
tags/3.0.0/vendor/composer/platform_check.php (deleted)
-
trunk/CHANGELOG.md (added)
-
trunk/digest.php (modified) (2 diffs)
-
trunk/inc/Cron.php (modified) (3 diffs)
-
trunk/inc/Setting/FrequencySetting.php (modified) (3 diffs)
-
trunk/inc/namespace.php (modified) (1 diff)
-
trunk/js/digest.js (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/ClassLoader.php (modified) (18 diffs)
-
trunk/vendor/composer/InstalledVersions.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_namespaces.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (1 diff)
-
trunk/vendor/composer/platform_check.php (deleted)
Legend:
- Unmodified
- Added
- Removed
-
digest/tags/3.0.0/digest.php
r2541316 r2887683 1 1 <?php 2 2 /** 3 * Plugin Name: Digest Notifications 4 * Plugin URI: https://required.com/services/wordpress-plugins/digest-notifications/ 5 * Description: Get a daily or weekly digest of what's happening on your site 6 * instead of receiving a single email each time. 7 * Version: 2.0.0 8 * Author: required 9 * Author URI: https://required.com 10 * License: GPLv2+ 11 * Text Domain: digest 12 * Requires at least: 4.7 13 * Requires PHP: 5.6 3 * Plugin Name: Digest Notifications 4 * Plugin URI: https://required.com/services/wordpress-plugins/digest-notifications/ 5 * Description: Get a daily, weekly, or monthly digest of what's happening on your site instead of receiving a single email each time. 6 * Version: 3.0.0 7 * Requires at least: 6.0 8 * Requires PHP: 7.4 9 * Author: required 10 * Author URI: https://required.com 11 * License: GPLv2+ 12 * Text Domain: digest 14 13 */ 15 14 16 15 /** 17 * Copyright (c) 2015-2 107required (email : support@required.ch)16 * Copyright (c) 2015-2023 required (email : support@required.ch) 18 17 * 19 18 * This program is free software; you can redistribute it and/or modify … … 55 54 array( 56 55 'title' => __( 'Digest Notifications', 'digest' ), 57 'php' => ' 5.6',58 'wp' => ' 4.7',56 'php' => '7.4', 57 'wp' => '6.0', 59 58 'file' => __FILE__, 60 59 ) -
digest/tags/3.0.0/inc/Cron.php
r2541316 r2887683 50 50 protected static function ready() { 51 51 // Return early if the hour is wrong. 52 if ( absint( self::$options['hour'] ) !== absint( date_i18n( 'G' ) ) ) {52 if ( absint( self::$options['hour'] ) !== absint( wp_date( 'G' ) ) ) { 53 53 return false; 54 54 } … … 57 57 if ( 58 58 'weekly' === self::$options['period'] && 59 absint( self::$options['day'] ) !== absint( date_i18n( 'w' ) ) 59 absint( self::$options['day'] ) !== absint( wp_date( 'w' ) ) 60 ) { 61 return false; 62 } 63 64 // Return early if it's not the first day of the month. 65 if ( 66 'monthly' === self::$options['period'] && 67 wp_date( 'Y-m-d' ) !== wp_date( 'Y-m-01' ) 60 68 ) { 61 69 return false; … … 85 93 // translators: %s: Site name. 86 94 $subject = __( 'Today on %s', 'digest' ); 95 } elseif ( 'monthly' === self::$options['period'] ) { 96 // translators: %s: Site name. 97 $subject = __( 'Past Month on %s', 'digest' ); 87 98 } 88 99 -
digest/tags/3.0.0/inc/Setting/FrequencySetting.php
r2541316 r2887683 51 51 __( 'Email Notifications', 'digest' ), 52 52 function () { 53 esc_html_e( "You get a daily or weekly digest of what's happening on your site. Here you can configure its frequency.", 'digest' );53 esc_html_e( "You get a daily, weekly, or monthly digest of what's happening on your site. Here you can configure its frequency.", 'digest' ); 54 54 }, 55 55 'general' … … 89 89 <option value="weekly" <?php selected( 'weekly', $options['period'] ); ?>> 90 90 <?php echo esc_attr_x( 'every week', 'frequency', 'digest' ); ?> 91 </option> 92 <option value="monthly" <?php selected( 'monthly', $options['period'] ); ?>> 93 <?php echo esc_attr_x( 'every month', 'frequency', 'digest' ); ?> 91 94 </option> 92 95 </select> … … 136 139 $new_value['day'] = isset( $value['day'] ) ? $value['day'] : get_option( 'start_of_week', 0 ); 137 140 138 if ( 'daily' !== $new_value['period']) {141 if ( ! \in_array( $new_value['period'], [ 'daily', 'weekly', 'monthly' ], true ) ) { 139 142 $new_value['period'] = 'weekly'; 140 143 } -
digest/tags/3.0.0/inc/namespace.php
r2541316 r2887683 16 16 define( __NAMESPACE__ . '\PLUGIN_FILE', dirname( __DIR__ ) . '/digest.php' ); 17 17 define( __NAMESPACE__ . '\PLUGIN_DIR', dirname( __DIR__ ) ); 18 define( __NAMESPACE__ . '\VERSION', ' 2.0.0-alpha' );18 define( __NAMESPACE__ . '\VERSION', '3.0.0' ); 19 19 20 20 /** -
digest/tags/3.0.0/js/digest.js
r2541316 r2887683 1 !function(){ vare=document.getElementById("digest_frequency_period"),n=document.getElementById("digest-frequency-day-wrapper");function t(){"weekly"===(this.value||e.value)?n.className="":n.className="digest-hidden"}e.onchange=t,t()}();1 !function(){const e=document.getElementById("digest_frequency_period"),n=document.getElementById("digest-frequency-day-wrapper");function t(){"weekly"===(this.value||e.value)?n.className="":n.className="digest-hidden"}e.onchange=t,t()}(); -
digest/tags/3.0.0/vendor/autoload.php
r2541316 r2887683 3 3 // autoload.php @generated by Composer 4 4 5 if (PHP_VERSION_ID < 50600) { 6 if (!headers_sent()) { 7 header('HTTP/1.1 500 Internal Server Error'); 8 } 9 $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; 10 if (!ini_get('display_errors')) { 11 if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { 12 fwrite(STDERR, $err); 13 } elseif (!headers_sent()) { 14 echo $err; 15 } 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 21 } 22 5 23 require_once __DIR__ . '/composer/autoload_real.php'; 6 24 7 return ComposerAutoloaderInit f67ba7642a570c4ff5f84f5e36d69f3a::getLoader();25 return ComposerAutoloaderInitead4f9c2a59a5fd6f80b16e3e46a6781::getLoader(); -
digest/tags/3.0.0/vendor/composer/ClassLoader.php
r2541316 r2887683 43 43 class ClassLoader 44 44 { 45 /** @var \Closure(string):void */ 46 private static $includeFile; 47 48 /** @var ?string */ 45 49 private $vendorDir; 46 50 47 51 // PSR-4 52 /** 53 * @var array[] 54 * @psalm-var array<string, array<string, int>> 55 */ 48 56 private $prefixLengthsPsr4 = array(); 57 /** 58 * @var array[] 59 * @psalm-var array<string, array<int, string>> 60 */ 49 61 private $prefixDirsPsr4 = array(); 62 /** 63 * @var array[] 64 * @psalm-var array<string, string> 65 */ 50 66 private $fallbackDirsPsr4 = array(); 51 67 52 68 // PSR-0 69 /** 70 * @var array[] 71 * @psalm-var array<string, array<string, string[]>> 72 */ 53 73 private $prefixesPsr0 = array(); 74 /** 75 * @var array[] 76 * @psalm-var array<string, string> 77 */ 54 78 private $fallbackDirsPsr0 = array(); 55 79 80 /** @var bool */ 56 81 private $useIncludePath = false; 82 83 /** 84 * @var string[] 85 * @psalm-var array<string, string> 86 */ 57 87 private $classMap = array(); 88 89 /** @var bool */ 58 90 private $classMapAuthoritative = false; 91 92 /** 93 * @var bool[] 94 * @psalm-var array<string, bool> 95 */ 59 96 private $missingClasses = array(); 97 98 /** @var ?string */ 60 99 private $apcuPrefix; 61 100 101 /** 102 * @var self[] 103 */ 62 104 private static $registeredLoaders = array(); 63 105 106 /** 107 * @param ?string $vendorDir 108 */ 64 109 public function __construct($vendorDir = null) 65 110 { 66 111 $this->vendorDir = $vendorDir; 67 } 68 112 self::initializeIncludeClosure(); 113 } 114 115 /** 116 * @return string[] 117 */ 69 118 public function getPrefixes() 70 119 { … … 76 125 } 77 126 127 /** 128 * @return array[] 129 * @psalm-return array<string, array<int, string>> 130 */ 78 131 public function getPrefixesPsr4() 79 132 { … … 81 134 } 82 135 136 /** 137 * @return array[] 138 * @psalm-return array<string, string> 139 */ 83 140 public function getFallbackDirs() 84 141 { … … 86 143 } 87 144 145 /** 146 * @return array[] 147 * @psalm-return array<string, string> 148 */ 88 149 public function getFallbackDirsPsr4() 89 150 { … … 91 152 } 92 153 154 /** 155 * @return string[] Array of classname => path 156 * @psalm-return array<string, string> 157 */ 93 158 public function getClassMap() 94 159 { … … 97 162 98 163 /** 99 * @param array $classMap Class to filename map 164 * @param string[] $classMap Class to filename map 165 * @psalm-param array<string, string> $classMap 166 * 167 * @return void 100 168 */ 101 169 public function addClassMap(array $classMap) … … 112 180 * appending or prepending to the ones previously set for this prefix. 113 181 * 114 * @param string $prefix The prefix 115 * @param array|string $paths The PSR-0 root directories 116 * @param bool $prepend Whether to prepend the directories 182 * @param string $prefix The prefix 183 * @param string[]|string $paths The PSR-0 root directories 184 * @param bool $prepend Whether to prepend the directories 185 * 186 * @return void 117 187 */ 118 188 public function add($prefix, $paths, $prepend = false) … … 157 227 * appending or prepending to the ones previously set for this namespace. 158 228 * 159 * @param string $prefix The prefix/namespace, with trailing '\\'160 * @param array|string $paths The PSR-4 base directories161 * @param bool $prepend Whether to prepend the directories229 * @param string $prefix The prefix/namespace, with trailing '\\' 230 * @param string[]|string $paths The PSR-4 base directories 231 * @param bool $prepend Whether to prepend the directories 162 232 * 163 233 * @throws \InvalidArgumentException 234 * 235 * @return void 164 236 */ 165 237 public function addPsr4($prefix, $paths, $prepend = false) … … 205 277 * replacing any others previously set for this prefix. 206 278 * 207 * @param string $prefix The prefix 208 * @param array|string $paths The PSR-0 base directories 279 * @param string $prefix The prefix 280 * @param string[]|string $paths The PSR-0 base directories 281 * 282 * @return void 209 283 */ 210 284 public function set($prefix, $paths) … … 221 295 * replacing any others previously set for this namespace. 222 296 * 223 * @param string $prefix The prefix/namespace, with trailing '\\'224 * @param array|string $paths The PSR-4 base directories297 * @param string $prefix The prefix/namespace, with trailing '\\' 298 * @param string[]|string $paths The PSR-4 base directories 225 299 * 226 300 * @throws \InvalidArgumentException 301 * 302 * @return void 227 303 */ 228 304 public function setPsr4($prefix, $paths) … … 244 320 * 245 321 * @param bool $useIncludePath 322 * 323 * @return void 246 324 */ 247 325 public function setUseIncludePath($useIncludePath) … … 266 344 * 267 345 * @param bool $classMapAuthoritative 346 * 347 * @return void 268 348 */ 269 349 public function setClassMapAuthoritative($classMapAuthoritative) … … 286 366 * 287 367 * @param string|null $apcuPrefix 368 * 369 * @return void 288 370 */ 289 371 public function setApcuPrefix($apcuPrefix) … … 306 388 * 307 389 * @param bool $prepend Whether to prepend the autoloader or not 390 * 391 * @return void 308 392 */ 309 393 public function register($prepend = false) … … 325 409 /** 326 410 * Unregisters this instance as an autoloader. 411 * 412 * @return void 327 413 */ 328 414 public function unregister() … … 339 425 * 340 426 * @param string $class The name of the class 341 * @return bool|null True if loaded, null otherwise427 * @return true|null True if loaded, null otherwise 342 428 */ 343 429 public function loadClass($class) 344 430 { 345 431 if ($file = $this->findFile($class)) { 346 includeFile($file); 432 $includeFile = self::$includeFile; 433 $includeFile($file); 347 434 348 435 return true; 349 436 } 437 438 return null; 350 439 } 351 440 … … 402 491 } 403 492 493 /** 494 * @param string $class 495 * @param string $ext 496 * @return string|false 497 */ 404 498 private function findFileWithExtension($class, $ext) 405 499 { … … 467 561 return false; 468 562 } 563 564 /** 565 * @return void 566 */ 567 private static function initializeIncludeClosure() 568 { 569 if (self::$includeFile !== null) { 570 return; 571 } 572 573 /** 574 * Scope isolated include. 575 * 576 * Prevents access to $this/self from included files. 577 * 578 * @param string $file 579 * @return void 580 */ 581 self::$includeFile = \Closure::bind(static function($file) { 582 include $file; 583 }, null, null); 584 } 469 585 } 470 471 /**472 * Scope isolated include.473 *474 * Prevents access to $this/self from included files.475 */476 function includeFile($file)477 {478 include $file;479 } -
digest/tags/3.0.0/vendor/composer/InstalledVersions.php
r2541316 r2887683 1 1 <?php 2 2 3 4 5 6 7 8 9 10 11 3 /* 4 * This file is part of Composer. 5 * 6 * (c) Nils Adermann <naderman@naderman.de> 7 * Jordi Boggiano <j.boggiano@seld.be> 8 * 9 * For the full copyright and license information, please view the LICENSE 10 * file that was distributed with this source code. 11 */ 12 12 13 13 namespace Composer; … … 16 16 use Composer\Semver\VersionParser; 17 17 18 19 20 21 22 23 24 18 /** 19 * This class is copied in every Composer installed project and available to all 20 * 21 * See also https://getcomposer.org/doc/07-runtime.md#installed-versions 22 * 23 * To require its presence, you can require `composer-runtime-api ^2.0` 24 * 25 * @final 26 */ 25 27 class InstalledVersions 26 28 { 27 private static $installed = array ( 28 'root' => 29 array ( 30 'pretty_version' => '2.0.0', 31 'version' => '2.0.0.0', 32 'aliases' => 33 array ( 34 ), 35 'reference' => '5fe66ddc9b561109c4d3b1509824319319185c73', 36 'name' => 'wearerequired/digest', 37 ), 38 'versions' => 39 array ( 40 'wearerequired/digest' => 41 array ( 42 'pretty_version' => '2.0.0', 43 'version' => '2.0.0.0', 44 'aliases' => 45 array ( 46 ), 47 'reference' => '5fe66ddc9b561109c4d3b1509824319319185c73', 48 ), 49 'wearerequired/wp-requirements-check' => 50 array ( 51 'pretty_version' => '1.1.0', 52 'version' => '1.1.0.0', 53 'aliases' => 54 array ( 55 ), 56 'reference' => '82b8a6c4b953f59e7e534df2d4287e34af950812', 57 ), 58 ), 59 ); 60 private static $canGetVendors; 61 private static $installedByVendor = array(); 62 63 64 65 66 67 68 69 public static function getInstalledPackages() 70 { 71 $packages = array(); 72 foreach (self::getInstalled() as $installed) { 73 $packages[] = array_keys($installed['versions']); 29 /** 30 * @var mixed[]|null 31 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 32 */ 33 private static $installed; 34 35 /** 36 * @var bool|null 37 */ 38 private static $canGetVendors; 39 40 /** 41 * @var array[] 42 * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 43 */ 44 private static $installedByVendor = array(); 45 46 /** 47 * Returns a list of all package names which are present, either by being installed, replaced or provided 48 * 49 * @return string[] 50 * @psalm-return list<string> 51 */ 52 public static function getInstalledPackages() 53 { 54 $packages = array(); 55 foreach (self::getInstalled() as $installed) { 56 $packages[] = array_keys($installed['versions']); 57 } 58 59 if (1 === \count($packages)) { 60 return $packages[0]; 61 } 62 63 return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); 64 } 65 66 /** 67 * Returns a list of all package names with a specific type e.g. 'library' 68 * 69 * @param string $type 70 * @return string[] 71 * @psalm-return list<string> 72 */ 73 public static function getInstalledPackagesByType($type) 74 { 75 $packagesByType = array(); 76 77 foreach (self::getInstalled() as $installed) { 78 foreach ($installed['versions'] as $name => $package) { 79 if (isset($package['type']) && $package['type'] === $type) { 80 $packagesByType[] = $name; 81 } 82 } 83 } 84 85 return $packagesByType; 86 } 87 88 /** 89 * Checks whether the given package is installed 90 * 91 * This also returns true if the package name is provided or replaced by another package 92 * 93 * @param string $packageName 94 * @param bool $includeDevRequirements 95 * @return bool 96 */ 97 public static function isInstalled($packageName, $includeDevRequirements = true) 98 { 99 foreach (self::getInstalled() as $installed) { 100 if (isset($installed['versions'][$packageName])) { 101 return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; 102 } 103 } 104 105 return false; 106 } 107 108 /** 109 * Checks whether the given package satisfies a version constraint 110 * 111 * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: 112 * 113 * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') 114 * 115 * @param VersionParser $parser Install composer/semver to have access to this class and functionality 116 * @param string $packageName 117 * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package 118 * @return bool 119 */ 120 public static function satisfies(VersionParser $parser, $packageName, $constraint) 121 { 122 $constraint = $parser->parseConstraints((string) $constraint); 123 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 124 125 return $provided->matches($constraint); 126 } 127 128 /** 129 * Returns a version constraint representing all the range(s) which are installed for a given package 130 * 131 * It is easier to use this via isInstalled() with the $constraint argument if you need to check 132 * whether a given version of a package is installed, and not just whether it exists 133 * 134 * @param string $packageName 135 * @return string Version constraint usable with composer/semver 136 */ 137 public static function getVersionRanges($packageName) 138 { 139 foreach (self::getInstalled() as $installed) { 140 if (!isset($installed['versions'][$packageName])) { 141 continue; 142 } 143 144 $ranges = array(); 145 if (isset($installed['versions'][$packageName]['pretty_version'])) { 146 $ranges[] = $installed['versions'][$packageName]['pretty_version']; 147 } 148 if (array_key_exists('aliases', $installed['versions'][$packageName])) { 149 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); 150 } 151 if (array_key_exists('replaced', $installed['versions'][$packageName])) { 152 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); 153 } 154 if (array_key_exists('provided', $installed['versions'][$packageName])) { 155 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); 156 } 157 158 return implode(' || ', $ranges); 159 } 160 161 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 162 } 163 164 /** 165 * @param string $packageName 166 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present 167 */ 168 public static function getVersion($packageName) 169 { 170 foreach (self::getInstalled() as $installed) { 171 if (!isset($installed['versions'][$packageName])) { 172 continue; 173 } 174 175 if (!isset($installed['versions'][$packageName]['version'])) { 176 return null; 177 } 178 179 return $installed['versions'][$packageName]['version']; 180 } 181 182 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 183 } 184 185 /** 186 * @param string $packageName 187 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present 188 */ 189 public static function getPrettyVersion($packageName) 190 { 191 foreach (self::getInstalled() as $installed) { 192 if (!isset($installed['versions'][$packageName])) { 193 continue; 194 } 195 196 if (!isset($installed['versions'][$packageName]['pretty_version'])) { 197 return null; 198 } 199 200 return $installed['versions'][$packageName]['pretty_version']; 201 } 202 203 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 204 } 205 206 /** 207 * @param string $packageName 208 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference 209 */ 210 public static function getReference($packageName) 211 { 212 foreach (self::getInstalled() as $installed) { 213 if (!isset($installed['versions'][$packageName])) { 214 continue; 215 } 216 217 if (!isset($installed['versions'][$packageName]['reference'])) { 218 return null; 219 } 220 221 return $installed['versions'][$packageName]['reference']; 222 } 223 224 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 225 } 226 227 /** 228 * @param string $packageName 229 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. 230 */ 231 public static function getInstallPath($packageName) 232 { 233 foreach (self::getInstalled() as $installed) { 234 if (!isset($installed['versions'][$packageName])) { 235 continue; 236 } 237 238 return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; 239 } 240 241 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 242 } 243 244 /** 245 * @return array 246 * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} 247 */ 248 public static function getRootPackage() 249 { 250 $installed = self::getInstalled(); 251 252 return $installed[0]['root']; 253 } 254 255 /** 256 * Returns the raw installed.php data for custom implementations 257 * 258 * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. 259 * @return array[] 260 * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} 261 */ 262 public static function getRawData() 263 { 264 @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); 265 266 if (null === self::$installed) { 267 // only require the installed.php file if this file is loaded from its dumped location, 268 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 269 if (substr(__DIR__, -8, 1) !== 'C') { 270 self::$installed = include __DIR__ . '/installed.php'; 271 } else { 272 self::$installed = array(); 273 } 274 } 275 276 return self::$installed; 277 } 278 279 /** 280 * Returns the raw data of all installed.php which are currently loaded for custom implementations 281 * 282 * @return array[] 283 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 284 */ 285 public static function getAllRawData() 286 { 287 return self::getInstalled(); 288 } 289 290 /** 291 * Lets you reload the static array from another file 292 * 293 * This is only useful for complex integrations in which a project needs to use 294 * this class but then also needs to execute another project's autoloader in process, 295 * and wants to ensure both projects have access to their version of installed.php. 296 * 297 * A typical case would be PHPUnit, where it would need to make sure it reads all 298 * the data it needs from this class, then call reload() with 299 * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure 300 * the project in which it runs can then also use this class safely, without 301 * interference between PHPUnit's dependencies and the project's dependencies. 302 * 303 * @param array[] $data A vendor/composer/installed.php data set 304 * @return void 305 * 306 * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data 307 */ 308 public static function reload($data) 309 { 310 self::$installed = $data; 311 self::$installedByVendor = array(); 312 } 313 314 /** 315 * @return array[] 316 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 317 */ 318 private static function getInstalled() 319 { 320 if (null === self::$canGetVendors) { 321 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); 322 } 323 324 $installed = array(); 325 326 if (self::$canGetVendors) { 327 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 328 if (isset(self::$installedByVendor[$vendorDir])) { 329 $installed[] = self::$installedByVendor[$vendorDir]; 330 } elseif (is_file($vendorDir.'/composer/installed.php')) { 331 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 336 } 337 } 338 } 339 } 340 341 if (null === self::$installed) { 342 // only require the installed.php file if this file is loaded from its dumped location, 343 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 344 if (substr(__DIR__, -8, 1) !== 'C') { 345 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 346 $required = require __DIR__ . '/installed.php'; 347 self::$installed = $required; 348 } else { 349 self::$installed = array(); 350 } 351 } 352 353 if (self::$installed !== array()) { 354 $installed[] = self::$installed; 355 } 356 357 return $installed; 358 } 74 359 } 75 76 if (1 === \count($packages)) {77 return $packages[0];78 }79 80 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));81 }82 83 84 85 86 87 88 89 90 91 public static function isInstalled($packageName)92 {93 foreach (self::getInstalled() as $installed) {94 if (isset($installed['versions'][$packageName])) {95 return true;96 }97 }98 99 return false;100 }101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 public static function satisfies(VersionParser $parser, $packageName, $constraint)116 {117 $constraint = $parser->parseConstraints($constraint);118 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));119 120 return $provided->matches($constraint);121 }122 123 124 125 126 127 128 129 130 131 132 public static function getVersionRanges($packageName)133 {134 foreach (self::getInstalled() as $installed) {135 if (!isset($installed['versions'][$packageName])) {136 continue;137 }138 139 $ranges = array();140 if (isset($installed['versions'][$packageName]['pretty_version'])) {141 $ranges[] = $installed['versions'][$packageName]['pretty_version'];142 }143 if (array_key_exists('aliases', $installed['versions'][$packageName])) {144 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);145 }146 if (array_key_exists('replaced', $installed['versions'][$packageName])) {147 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);148 }149 if (array_key_exists('provided', $installed['versions'][$packageName])) {150 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);151 }152 153 return implode(' || ', $ranges);154 }155 156 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');157 }158 159 160 161 162 163 public static function getVersion($packageName)164 {165 foreach (self::getInstalled() as $installed) {166 if (!isset($installed['versions'][$packageName])) {167 continue;168 }169 170 if (!isset($installed['versions'][$packageName]['version'])) {171 return null;172 }173 174 return $installed['versions'][$packageName]['version'];175 }176 177 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');178 }179 180 181 182 183 184 public static function getPrettyVersion($packageName)185 {186 foreach (self::getInstalled() as $installed) {187 if (!isset($installed['versions'][$packageName])) {188 continue;189 }190 191 if (!isset($installed['versions'][$packageName]['pretty_version'])) {192 return null;193 }194 195 return $installed['versions'][$packageName]['pretty_version'];196 }197 198 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');199 }200 201 202 203 204 205 public static function getReference($packageName)206 {207 foreach (self::getInstalled() as $installed) {208 if (!isset($installed['versions'][$packageName])) {209 continue;210 }211 212 if (!isset($installed['versions'][$packageName]['reference'])) {213 return null;214 }215 216 return $installed['versions'][$packageName]['reference'];217 }218 219 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');220 }221 222 223 224 225 226 public static function getRootPackage()227 {228 $installed = self::getInstalled();229 230 return $installed[0]['root'];231 }232 233 234 235 236 237 238 239 240 public static function getRawData()241 {242 @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);243 244 return self::$installed;245 }246 247 248 249 250 251 252 253 public static function getAllRawData()254 {255 return self::getInstalled();256 }257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 public static function reload($data)277 {278 self::$installed = $data;279 self::$installedByVendor = array();280 }281 282 283 284 285 286 private static function getInstalled()287 {288 if (null === self::$canGetVendors) {289 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');290 }291 292 $installed = array();293 294 if (self::$canGetVendors) {295 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {296 if (isset(self::$installedByVendor[$vendorDir])) {297 $installed[] = self::$installedByVendor[$vendorDir];298 } elseif (is_file($vendorDir.'/composer/installed.php')) {299 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';300 }301 }302 }303 304 $installed[] = self::$installed;305 306 return $installed;307 }308 } -
digest/tags/3.0.0/vendor/composer/autoload_classmap.php
r2541316 r2887683 3 3 // autoload_classmap.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
digest/tags/3.0.0/vendor/composer/autoload_namespaces.php
r2541316 r2887683 3 3 // autoload_namespaces.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
digest/tags/3.0.0/vendor/composer/autoload_psr4.php
r2541316 r2887683 3 3 // autoload_psr4.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
digest/tags/3.0.0/vendor/composer/autoload_real.php
r2541316 r2887683 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit f67ba7642a570c4ff5f84f5e36d69f3a5 class ComposerAutoloaderInitead4f9c2a59a5fd6f80b16e3e46a6781 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 require __DIR__ . '/platform_check.php'; 25 spl_autoload_register(array('ComposerAutoloaderInitead4f9c2a59a5fd6f80b16e3e46a6781', 'loadClassLoader'), true, true); 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInitead4f9c2a59a5fd6f80b16e3e46a6781', 'loadClassLoader')); 26 28 27 spl_autoload_register(array('ComposerAutoloaderInitf67ba7642a570c4ff5f84f5e36d69f3a', 'loadClassLoader'), true, true); 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInitf67ba7642a570c4ff5f84f5e36d69f3a', 'loadClassLoader')); 30 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 32 if ($useStaticLoader) { 33 require __DIR__ . '/autoload_static.php'; 34 35 call_user_func(\Composer\Autoload\ComposerStaticInitf67ba7642a570c4ff5f84f5e36d69f3a::getInitializer($loader)); 36 } else { 37 $map = require __DIR__ . '/autoload_namespaces.php'; 38 foreach ($map as $namespace => $path) { 39 $loader->set($namespace, $path); 40 } 41 42 $map = require __DIR__ . '/autoload_psr4.php'; 43 foreach ($map as $namespace => $path) { 44 $loader->setPsr4($namespace, $path); 45 } 46 47 $classMap = require __DIR__ . '/autoload_classmap.php'; 48 if ($classMap) { 49 $loader->addClassMap($classMap); 50 } 51 } 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781::getInitializer($loader)); 52 31 53 32 $loader->register(true); -
digest/tags/3.0.0/vendor/composer/autoload_static.php
r2541316 r2887683 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit f67ba7642a570c4ff5f84f5e36d69f3a7 class ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 42 42 { 43 43 return \Closure::bind(function () use ($loader) { 44 $loader->prefixLengthsPsr4 = ComposerStaticInit f67ba7642a570c4ff5f84f5e36d69f3a::$prefixLengthsPsr4;45 $loader->prefixDirsPsr4 = ComposerStaticInit f67ba7642a570c4ff5f84f5e36d69f3a::$prefixDirsPsr4;46 $loader->classMap = ComposerStaticInit f67ba7642a570c4ff5f84f5e36d69f3a::$classMap;44 $loader->prefixLengthsPsr4 = ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781::$prefixLengthsPsr4; 45 $loader->prefixDirsPsr4 = ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781::$prefixDirsPsr4; 46 $loader->classMap = ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781::$classMap; 47 47 48 48 }, null, ClassLoader::class); -
digest/tags/3.0.0/vendor/composer/installed.php
r2541316 r2887683 1 <?php return array ( 2 'root' => 3 array ( 4 'pretty_version' => '2.0.0', 5 'version' => '2.0.0.0', 6 'aliases' => 7 array ( 1 <?php return array( 2 'root' => array( 3 'name' => 'wearerequired/digest', 4 'pretty_version' => '3.0.0', 5 'version' => '3.0.0.0', 6 'reference' => 'e043be1dcfafde2b782d61cce5aa4e359f25dcc3', 7 'type' => 'wordpress-plugin', 8 'install_path' => __DIR__ . '/../../', 9 'aliases' => array(), 10 'dev' => false, 8 11 ), 9 'reference' => '5fe66ddc9b561109c4d3b1509824319319185c73', 10 'name' => 'wearerequired/digest', 11 ), 12 'versions' => 13 array ( 14 'wearerequired/digest' => 15 array ( 16 'pretty_version' => '2.0.0', 17 'version' => '2.0.0.0', 18 'aliases' => 19 array ( 20 ), 21 'reference' => '5fe66ddc9b561109c4d3b1509824319319185c73', 12 'versions' => array( 13 'wearerequired/digest' => array( 14 'pretty_version' => '3.0.0', 15 'version' => '3.0.0.0', 16 'reference' => 'e043be1dcfafde2b782d61cce5aa4e359f25dcc3', 17 'type' => 'wordpress-plugin', 18 'install_path' => __DIR__ . '/../../', 19 'aliases' => array(), 20 'dev_requirement' => false, 21 ), 22 'wearerequired/wp-requirements-check' => array( 23 'pretty_version' => '1.1.0', 24 'version' => '1.1.0.0', 25 'reference' => '82b8a6c4b953f59e7e534df2d4287e34af950812', 26 'type' => 'library', 27 'install_path' => __DIR__ . '/../wearerequired/wp-requirements-check', 28 'aliases' => array(), 29 'dev_requirement' => false, 30 ), 22 31 ), 23 'wearerequired/wp-requirements-check' =>24 array (25 'pretty_version' => '1.1.0',26 'version' => '1.1.0.0',27 'aliases' =>28 array (29 ),30 'reference' => '82b8a6c4b953f59e7e534df2d4287e34af950812',31 ),32 ),33 32 ); -
digest/trunk/digest.php
r2541316 r2887683 1 1 <?php 2 2 /** 3 * Plugin Name: Digest Notifications 4 * Plugin URI: https://required.com/services/wordpress-plugins/digest-notifications/ 5 * Description: Get a daily or weekly digest of what's happening on your site 6 * instead of receiving a single email each time. 7 * Version: 2.0.0 8 * Author: required 9 * Author URI: https://required.com 10 * License: GPLv2+ 11 * Text Domain: digest 12 * Requires at least: 4.7 13 * Requires PHP: 5.6 3 * Plugin Name: Digest Notifications 4 * Plugin URI: https://required.com/services/wordpress-plugins/digest-notifications/ 5 * Description: Get a daily, weekly, or monthly digest of what's happening on your site instead of receiving a single email each time. 6 * Version: 3.0.0 7 * Requires at least: 6.0 8 * Requires PHP: 7.4 9 * Author: required 10 * Author URI: https://required.com 11 * License: GPLv2+ 12 * Text Domain: digest 14 13 */ 15 14 16 15 /** 17 * Copyright (c) 2015-2 107required (email : support@required.ch)16 * Copyright (c) 2015-2023 required (email : support@required.ch) 18 17 * 19 18 * This program is free software; you can redistribute it and/or modify … … 55 54 array( 56 55 'title' => __( 'Digest Notifications', 'digest' ), 57 'php' => ' 5.6',58 'wp' => ' 4.7',56 'php' => '7.4', 57 'wp' => '6.0', 59 58 'file' => __FILE__, 60 59 ) -
digest/trunk/inc/Cron.php
r2541316 r2887683 50 50 protected static function ready() { 51 51 // Return early if the hour is wrong. 52 if ( absint( self::$options['hour'] ) !== absint( date_i18n( 'G' ) ) ) {52 if ( absint( self::$options['hour'] ) !== absint( wp_date( 'G' ) ) ) { 53 53 return false; 54 54 } … … 57 57 if ( 58 58 'weekly' === self::$options['period'] && 59 absint( self::$options['day'] ) !== absint( date_i18n( 'w' ) ) 59 absint( self::$options['day'] ) !== absint( wp_date( 'w' ) ) 60 ) { 61 return false; 62 } 63 64 // Return early if it's not the first day of the month. 65 if ( 66 'monthly' === self::$options['period'] && 67 wp_date( 'Y-m-d' ) !== wp_date( 'Y-m-01' ) 60 68 ) { 61 69 return false; … … 85 93 // translators: %s: Site name. 86 94 $subject = __( 'Today on %s', 'digest' ); 95 } elseif ( 'monthly' === self::$options['period'] ) { 96 // translators: %s: Site name. 97 $subject = __( 'Past Month on %s', 'digest' ); 87 98 } 88 99 -
digest/trunk/inc/Setting/FrequencySetting.php
r2541316 r2887683 51 51 __( 'Email Notifications', 'digest' ), 52 52 function () { 53 esc_html_e( "You get a daily or weekly digest of what's happening on your site. Here you can configure its frequency.", 'digest' );53 esc_html_e( "You get a daily, weekly, or monthly digest of what's happening on your site. Here you can configure its frequency.", 'digest' ); 54 54 }, 55 55 'general' … … 89 89 <option value="weekly" <?php selected( 'weekly', $options['period'] ); ?>> 90 90 <?php echo esc_attr_x( 'every week', 'frequency', 'digest' ); ?> 91 </option> 92 <option value="monthly" <?php selected( 'monthly', $options['period'] ); ?>> 93 <?php echo esc_attr_x( 'every month', 'frequency', 'digest' ); ?> 91 94 </option> 92 95 </select> … … 136 139 $new_value['day'] = isset( $value['day'] ) ? $value['day'] : get_option( 'start_of_week', 0 ); 137 140 138 if ( 'daily' !== $new_value['period']) {141 if ( ! \in_array( $new_value['period'], [ 'daily', 'weekly', 'monthly' ], true ) ) { 139 142 $new_value['period'] = 'weekly'; 140 143 } -
digest/trunk/inc/namespace.php
r2541316 r2887683 16 16 define( __NAMESPACE__ . '\PLUGIN_FILE', dirname( __DIR__ ) . '/digest.php' ); 17 17 define( __NAMESPACE__ . '\PLUGIN_DIR', dirname( __DIR__ ) ); 18 define( __NAMESPACE__ . '\VERSION', ' 2.0.0-alpha' );18 define( __NAMESPACE__ . '\VERSION', '3.0.0' ); 19 19 20 20 /** -
digest/trunk/js/digest.js
r2541316 r2887683 1 !function(){ vare=document.getElementById("digest_frequency_period"),n=document.getElementById("digest-frequency-day-wrapper");function t(){"weekly"===(this.value||e.value)?n.className="":n.className="digest-hidden"}e.onchange=t,t()}();1 !function(){const e=document.getElementById("digest_frequency_period"),n=document.getElementById("digest-frequency-day-wrapper");function t(){"weekly"===(this.value||e.value)?n.className="":n.className="digest-hidden"}e.onchange=t,t()}(); -
digest/trunk/vendor/autoload.php
r2541316 r2887683 3 3 // autoload.php @generated by Composer 4 4 5 if (PHP_VERSION_ID < 50600) { 6 if (!headers_sent()) { 7 header('HTTP/1.1 500 Internal Server Error'); 8 } 9 $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; 10 if (!ini_get('display_errors')) { 11 if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { 12 fwrite(STDERR, $err); 13 } elseif (!headers_sent()) { 14 echo $err; 15 } 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 21 } 22 5 23 require_once __DIR__ . '/composer/autoload_real.php'; 6 24 7 return ComposerAutoloaderInit f67ba7642a570c4ff5f84f5e36d69f3a::getLoader();25 return ComposerAutoloaderInitead4f9c2a59a5fd6f80b16e3e46a6781::getLoader(); -
digest/trunk/vendor/composer/ClassLoader.php
r2541316 r2887683 43 43 class ClassLoader 44 44 { 45 /** @var \Closure(string):void */ 46 private static $includeFile; 47 48 /** @var ?string */ 45 49 private $vendorDir; 46 50 47 51 // PSR-4 52 /** 53 * @var array[] 54 * @psalm-var array<string, array<string, int>> 55 */ 48 56 private $prefixLengthsPsr4 = array(); 57 /** 58 * @var array[] 59 * @psalm-var array<string, array<int, string>> 60 */ 49 61 private $prefixDirsPsr4 = array(); 62 /** 63 * @var array[] 64 * @psalm-var array<string, string> 65 */ 50 66 private $fallbackDirsPsr4 = array(); 51 67 52 68 // PSR-0 69 /** 70 * @var array[] 71 * @psalm-var array<string, array<string, string[]>> 72 */ 53 73 private $prefixesPsr0 = array(); 74 /** 75 * @var array[] 76 * @psalm-var array<string, string> 77 */ 54 78 private $fallbackDirsPsr0 = array(); 55 79 80 /** @var bool */ 56 81 private $useIncludePath = false; 82 83 /** 84 * @var string[] 85 * @psalm-var array<string, string> 86 */ 57 87 private $classMap = array(); 88 89 /** @var bool */ 58 90 private $classMapAuthoritative = false; 91 92 /** 93 * @var bool[] 94 * @psalm-var array<string, bool> 95 */ 59 96 private $missingClasses = array(); 97 98 /** @var ?string */ 60 99 private $apcuPrefix; 61 100 101 /** 102 * @var self[] 103 */ 62 104 private static $registeredLoaders = array(); 63 105 106 /** 107 * @param ?string $vendorDir 108 */ 64 109 public function __construct($vendorDir = null) 65 110 { 66 111 $this->vendorDir = $vendorDir; 67 } 68 112 self::initializeIncludeClosure(); 113 } 114 115 /** 116 * @return string[] 117 */ 69 118 public function getPrefixes() 70 119 { … … 76 125 } 77 126 127 /** 128 * @return array[] 129 * @psalm-return array<string, array<int, string>> 130 */ 78 131 public function getPrefixesPsr4() 79 132 { … … 81 134 } 82 135 136 /** 137 * @return array[] 138 * @psalm-return array<string, string> 139 */ 83 140 public function getFallbackDirs() 84 141 { … … 86 143 } 87 144 145 /** 146 * @return array[] 147 * @psalm-return array<string, string> 148 */ 88 149 public function getFallbackDirsPsr4() 89 150 { … … 91 152 } 92 153 154 /** 155 * @return string[] Array of classname => path 156 * @psalm-return array<string, string> 157 */ 93 158 public function getClassMap() 94 159 { … … 97 162 98 163 /** 99 * @param array $classMap Class to filename map 164 * @param string[] $classMap Class to filename map 165 * @psalm-param array<string, string> $classMap 166 * 167 * @return void 100 168 */ 101 169 public function addClassMap(array $classMap) … … 112 180 * appending or prepending to the ones previously set for this prefix. 113 181 * 114 * @param string $prefix The prefix 115 * @param array|string $paths The PSR-0 root directories 116 * @param bool $prepend Whether to prepend the directories 182 * @param string $prefix The prefix 183 * @param string[]|string $paths The PSR-0 root directories 184 * @param bool $prepend Whether to prepend the directories 185 * 186 * @return void 117 187 */ 118 188 public function add($prefix, $paths, $prepend = false) … … 157 227 * appending or prepending to the ones previously set for this namespace. 158 228 * 159 * @param string $prefix The prefix/namespace, with trailing '\\'160 * @param array|string $paths The PSR-4 base directories161 * @param bool $prepend Whether to prepend the directories229 * @param string $prefix The prefix/namespace, with trailing '\\' 230 * @param string[]|string $paths The PSR-4 base directories 231 * @param bool $prepend Whether to prepend the directories 162 232 * 163 233 * @throws \InvalidArgumentException 234 * 235 * @return void 164 236 */ 165 237 public function addPsr4($prefix, $paths, $prepend = false) … … 205 277 * replacing any others previously set for this prefix. 206 278 * 207 * @param string $prefix The prefix 208 * @param array|string $paths The PSR-0 base directories 279 * @param string $prefix The prefix 280 * @param string[]|string $paths The PSR-0 base directories 281 * 282 * @return void 209 283 */ 210 284 public function set($prefix, $paths) … … 221 295 * replacing any others previously set for this namespace. 222 296 * 223 * @param string $prefix The prefix/namespace, with trailing '\\'224 * @param array|string $paths The PSR-4 base directories297 * @param string $prefix The prefix/namespace, with trailing '\\' 298 * @param string[]|string $paths The PSR-4 base directories 225 299 * 226 300 * @throws \InvalidArgumentException 301 * 302 * @return void 227 303 */ 228 304 public function setPsr4($prefix, $paths) … … 244 320 * 245 321 * @param bool $useIncludePath 322 * 323 * @return void 246 324 */ 247 325 public function setUseIncludePath($useIncludePath) … … 266 344 * 267 345 * @param bool $classMapAuthoritative 346 * 347 * @return void 268 348 */ 269 349 public function setClassMapAuthoritative($classMapAuthoritative) … … 286 366 * 287 367 * @param string|null $apcuPrefix 368 * 369 * @return void 288 370 */ 289 371 public function setApcuPrefix($apcuPrefix) … … 306 388 * 307 389 * @param bool $prepend Whether to prepend the autoloader or not 390 * 391 * @return void 308 392 */ 309 393 public function register($prepend = false) … … 325 409 /** 326 410 * Unregisters this instance as an autoloader. 411 * 412 * @return void 327 413 */ 328 414 public function unregister() … … 339 425 * 340 426 * @param string $class The name of the class 341 * @return bool|null True if loaded, null otherwise427 * @return true|null True if loaded, null otherwise 342 428 */ 343 429 public function loadClass($class) 344 430 { 345 431 if ($file = $this->findFile($class)) { 346 includeFile($file); 432 $includeFile = self::$includeFile; 433 $includeFile($file); 347 434 348 435 return true; 349 436 } 437 438 return null; 350 439 } 351 440 … … 402 491 } 403 492 493 /** 494 * @param string $class 495 * @param string $ext 496 * @return string|false 497 */ 404 498 private function findFileWithExtension($class, $ext) 405 499 { … … 467 561 return false; 468 562 } 563 564 /** 565 * @return void 566 */ 567 private static function initializeIncludeClosure() 568 { 569 if (self::$includeFile !== null) { 570 return; 571 } 572 573 /** 574 * Scope isolated include. 575 * 576 * Prevents access to $this/self from included files. 577 * 578 * @param string $file 579 * @return void 580 */ 581 self::$includeFile = \Closure::bind(static function($file) { 582 include $file; 583 }, null, null); 584 } 469 585 } 470 471 /**472 * Scope isolated include.473 *474 * Prevents access to $this/self from included files.475 */476 function includeFile($file)477 {478 include $file;479 } -
digest/trunk/vendor/composer/InstalledVersions.php
r2541316 r2887683 1 1 <?php 2 2 3 4 5 6 7 8 9 10 11 3 /* 4 * This file is part of Composer. 5 * 6 * (c) Nils Adermann <naderman@naderman.de> 7 * Jordi Boggiano <j.boggiano@seld.be> 8 * 9 * For the full copyright and license information, please view the LICENSE 10 * file that was distributed with this source code. 11 */ 12 12 13 13 namespace Composer; … … 16 16 use Composer\Semver\VersionParser; 17 17 18 19 20 21 22 23 24 18 /** 19 * This class is copied in every Composer installed project and available to all 20 * 21 * See also https://getcomposer.org/doc/07-runtime.md#installed-versions 22 * 23 * To require its presence, you can require `composer-runtime-api ^2.0` 24 * 25 * @final 26 */ 25 27 class InstalledVersions 26 28 { 27 private static $installed = array ( 28 'root' => 29 array ( 30 'pretty_version' => '2.0.0', 31 'version' => '2.0.0.0', 32 'aliases' => 33 array ( 34 ), 35 'reference' => '5fe66ddc9b561109c4d3b1509824319319185c73', 36 'name' => 'wearerequired/digest', 37 ), 38 'versions' => 39 array ( 40 'wearerequired/digest' => 41 array ( 42 'pretty_version' => '2.0.0', 43 'version' => '2.0.0.0', 44 'aliases' => 45 array ( 46 ), 47 'reference' => '5fe66ddc9b561109c4d3b1509824319319185c73', 48 ), 49 'wearerequired/wp-requirements-check' => 50 array ( 51 'pretty_version' => '1.1.0', 52 'version' => '1.1.0.0', 53 'aliases' => 54 array ( 55 ), 56 'reference' => '82b8a6c4b953f59e7e534df2d4287e34af950812', 57 ), 58 ), 59 ); 60 private static $canGetVendors; 61 private static $installedByVendor = array(); 62 63 64 65 66 67 68 69 public static function getInstalledPackages() 70 { 71 $packages = array(); 72 foreach (self::getInstalled() as $installed) { 73 $packages[] = array_keys($installed['versions']); 29 /** 30 * @var mixed[]|null 31 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 32 */ 33 private static $installed; 34 35 /** 36 * @var bool|null 37 */ 38 private static $canGetVendors; 39 40 /** 41 * @var array[] 42 * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 43 */ 44 private static $installedByVendor = array(); 45 46 /** 47 * Returns a list of all package names which are present, either by being installed, replaced or provided 48 * 49 * @return string[] 50 * @psalm-return list<string> 51 */ 52 public static function getInstalledPackages() 53 { 54 $packages = array(); 55 foreach (self::getInstalled() as $installed) { 56 $packages[] = array_keys($installed['versions']); 57 } 58 59 if (1 === \count($packages)) { 60 return $packages[0]; 61 } 62 63 return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); 64 } 65 66 /** 67 * Returns a list of all package names with a specific type e.g. 'library' 68 * 69 * @param string $type 70 * @return string[] 71 * @psalm-return list<string> 72 */ 73 public static function getInstalledPackagesByType($type) 74 { 75 $packagesByType = array(); 76 77 foreach (self::getInstalled() as $installed) { 78 foreach ($installed['versions'] as $name => $package) { 79 if (isset($package['type']) && $package['type'] === $type) { 80 $packagesByType[] = $name; 81 } 82 } 83 } 84 85 return $packagesByType; 86 } 87 88 /** 89 * Checks whether the given package is installed 90 * 91 * This also returns true if the package name is provided or replaced by another package 92 * 93 * @param string $packageName 94 * @param bool $includeDevRequirements 95 * @return bool 96 */ 97 public static function isInstalled($packageName, $includeDevRequirements = true) 98 { 99 foreach (self::getInstalled() as $installed) { 100 if (isset($installed['versions'][$packageName])) { 101 return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; 102 } 103 } 104 105 return false; 106 } 107 108 /** 109 * Checks whether the given package satisfies a version constraint 110 * 111 * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: 112 * 113 * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') 114 * 115 * @param VersionParser $parser Install composer/semver to have access to this class and functionality 116 * @param string $packageName 117 * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package 118 * @return bool 119 */ 120 public static function satisfies(VersionParser $parser, $packageName, $constraint) 121 { 122 $constraint = $parser->parseConstraints((string) $constraint); 123 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 124 125 return $provided->matches($constraint); 126 } 127 128 /** 129 * Returns a version constraint representing all the range(s) which are installed for a given package 130 * 131 * It is easier to use this via isInstalled() with the $constraint argument if you need to check 132 * whether a given version of a package is installed, and not just whether it exists 133 * 134 * @param string $packageName 135 * @return string Version constraint usable with composer/semver 136 */ 137 public static function getVersionRanges($packageName) 138 { 139 foreach (self::getInstalled() as $installed) { 140 if (!isset($installed['versions'][$packageName])) { 141 continue; 142 } 143 144 $ranges = array(); 145 if (isset($installed['versions'][$packageName]['pretty_version'])) { 146 $ranges[] = $installed['versions'][$packageName]['pretty_version']; 147 } 148 if (array_key_exists('aliases', $installed['versions'][$packageName])) { 149 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); 150 } 151 if (array_key_exists('replaced', $installed['versions'][$packageName])) { 152 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); 153 } 154 if (array_key_exists('provided', $installed['versions'][$packageName])) { 155 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); 156 } 157 158 return implode(' || ', $ranges); 159 } 160 161 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 162 } 163 164 /** 165 * @param string $packageName 166 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present 167 */ 168 public static function getVersion($packageName) 169 { 170 foreach (self::getInstalled() as $installed) { 171 if (!isset($installed['versions'][$packageName])) { 172 continue; 173 } 174 175 if (!isset($installed['versions'][$packageName]['version'])) { 176 return null; 177 } 178 179 return $installed['versions'][$packageName]['version']; 180 } 181 182 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 183 } 184 185 /** 186 * @param string $packageName 187 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present 188 */ 189 public static function getPrettyVersion($packageName) 190 { 191 foreach (self::getInstalled() as $installed) { 192 if (!isset($installed['versions'][$packageName])) { 193 continue; 194 } 195 196 if (!isset($installed['versions'][$packageName]['pretty_version'])) { 197 return null; 198 } 199 200 return $installed['versions'][$packageName]['pretty_version']; 201 } 202 203 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 204 } 205 206 /** 207 * @param string $packageName 208 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference 209 */ 210 public static function getReference($packageName) 211 { 212 foreach (self::getInstalled() as $installed) { 213 if (!isset($installed['versions'][$packageName])) { 214 continue; 215 } 216 217 if (!isset($installed['versions'][$packageName]['reference'])) { 218 return null; 219 } 220 221 return $installed['versions'][$packageName]['reference']; 222 } 223 224 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 225 } 226 227 /** 228 * @param string $packageName 229 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. 230 */ 231 public static function getInstallPath($packageName) 232 { 233 foreach (self::getInstalled() as $installed) { 234 if (!isset($installed['versions'][$packageName])) { 235 continue; 236 } 237 238 return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; 239 } 240 241 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 242 } 243 244 /** 245 * @return array 246 * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} 247 */ 248 public static function getRootPackage() 249 { 250 $installed = self::getInstalled(); 251 252 return $installed[0]['root']; 253 } 254 255 /** 256 * Returns the raw installed.php data for custom implementations 257 * 258 * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. 259 * @return array[] 260 * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} 261 */ 262 public static function getRawData() 263 { 264 @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); 265 266 if (null === self::$installed) { 267 // only require the installed.php file if this file is loaded from its dumped location, 268 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 269 if (substr(__DIR__, -8, 1) !== 'C') { 270 self::$installed = include __DIR__ . '/installed.php'; 271 } else { 272 self::$installed = array(); 273 } 274 } 275 276 return self::$installed; 277 } 278 279 /** 280 * Returns the raw data of all installed.php which are currently loaded for custom implementations 281 * 282 * @return array[] 283 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 284 */ 285 public static function getAllRawData() 286 { 287 return self::getInstalled(); 288 } 289 290 /** 291 * Lets you reload the static array from another file 292 * 293 * This is only useful for complex integrations in which a project needs to use 294 * this class but then also needs to execute another project's autoloader in process, 295 * and wants to ensure both projects have access to their version of installed.php. 296 * 297 * A typical case would be PHPUnit, where it would need to make sure it reads all 298 * the data it needs from this class, then call reload() with 299 * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure 300 * the project in which it runs can then also use this class safely, without 301 * interference between PHPUnit's dependencies and the project's dependencies. 302 * 303 * @param array[] $data A vendor/composer/installed.php data set 304 * @return void 305 * 306 * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data 307 */ 308 public static function reload($data) 309 { 310 self::$installed = $data; 311 self::$installedByVendor = array(); 312 } 313 314 /** 315 * @return array[] 316 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 317 */ 318 private static function getInstalled() 319 { 320 if (null === self::$canGetVendors) { 321 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); 322 } 323 324 $installed = array(); 325 326 if (self::$canGetVendors) { 327 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 328 if (isset(self::$installedByVendor[$vendorDir])) { 329 $installed[] = self::$installedByVendor[$vendorDir]; 330 } elseif (is_file($vendorDir.'/composer/installed.php')) { 331 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 336 } 337 } 338 } 339 } 340 341 if (null === self::$installed) { 342 // only require the installed.php file if this file is loaded from its dumped location, 343 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 344 if (substr(__DIR__, -8, 1) !== 'C') { 345 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 346 $required = require __DIR__ . '/installed.php'; 347 self::$installed = $required; 348 } else { 349 self::$installed = array(); 350 } 351 } 352 353 if (self::$installed !== array()) { 354 $installed[] = self::$installed; 355 } 356 357 return $installed; 358 } 74 359 } 75 76 if (1 === \count($packages)) {77 return $packages[0];78 }79 80 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));81 }82 83 84 85 86 87 88 89 90 91 public static function isInstalled($packageName)92 {93 foreach (self::getInstalled() as $installed) {94 if (isset($installed['versions'][$packageName])) {95 return true;96 }97 }98 99 return false;100 }101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 public static function satisfies(VersionParser $parser, $packageName, $constraint)116 {117 $constraint = $parser->parseConstraints($constraint);118 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));119 120 return $provided->matches($constraint);121 }122 123 124 125 126 127 128 129 130 131 132 public static function getVersionRanges($packageName)133 {134 foreach (self::getInstalled() as $installed) {135 if (!isset($installed['versions'][$packageName])) {136 continue;137 }138 139 $ranges = array();140 if (isset($installed['versions'][$packageName]['pretty_version'])) {141 $ranges[] = $installed['versions'][$packageName]['pretty_version'];142 }143 if (array_key_exists('aliases', $installed['versions'][$packageName])) {144 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);145 }146 if (array_key_exists('replaced', $installed['versions'][$packageName])) {147 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);148 }149 if (array_key_exists('provided', $installed['versions'][$packageName])) {150 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);151 }152 153 return implode(' || ', $ranges);154 }155 156 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');157 }158 159 160 161 162 163 public static function getVersion($packageName)164 {165 foreach (self::getInstalled() as $installed) {166 if (!isset($installed['versions'][$packageName])) {167 continue;168 }169 170 if (!isset($installed['versions'][$packageName]['version'])) {171 return null;172 }173 174 return $installed['versions'][$packageName]['version'];175 }176 177 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');178 }179 180 181 182 183 184 public static function getPrettyVersion($packageName)185 {186 foreach (self::getInstalled() as $installed) {187 if (!isset($installed['versions'][$packageName])) {188 continue;189 }190 191 if (!isset($installed['versions'][$packageName]['pretty_version'])) {192 return null;193 }194 195 return $installed['versions'][$packageName]['pretty_version'];196 }197 198 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');199 }200 201 202 203 204 205 public static function getReference($packageName)206 {207 foreach (self::getInstalled() as $installed) {208 if (!isset($installed['versions'][$packageName])) {209 continue;210 }211 212 if (!isset($installed['versions'][$packageName]['reference'])) {213 return null;214 }215 216 return $installed['versions'][$packageName]['reference'];217 }218 219 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');220 }221 222 223 224 225 226 public static function getRootPackage()227 {228 $installed = self::getInstalled();229 230 return $installed[0]['root'];231 }232 233 234 235 236 237 238 239 240 public static function getRawData()241 {242 @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);243 244 return self::$installed;245 }246 247 248 249 250 251 252 253 public static function getAllRawData()254 {255 return self::getInstalled();256 }257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 public static function reload($data)277 {278 self::$installed = $data;279 self::$installedByVendor = array();280 }281 282 283 284 285 286 private static function getInstalled()287 {288 if (null === self::$canGetVendors) {289 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');290 }291 292 $installed = array();293 294 if (self::$canGetVendors) {295 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {296 if (isset(self::$installedByVendor[$vendorDir])) {297 $installed[] = self::$installedByVendor[$vendorDir];298 } elseif (is_file($vendorDir.'/composer/installed.php')) {299 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';300 }301 }302 }303 304 $installed[] = self::$installed;305 306 return $installed;307 }308 } -
digest/trunk/vendor/composer/autoload_classmap.php
r2541316 r2887683 3 3 // autoload_classmap.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
digest/trunk/vendor/composer/autoload_namespaces.php
r2541316 r2887683 3 3 // autoload_namespaces.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
digest/trunk/vendor/composer/autoload_psr4.php
r2541316 r2887683 3 3 // autoload_psr4.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
digest/trunk/vendor/composer/autoload_real.php
r2541316 r2887683 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit f67ba7642a570c4ff5f84f5e36d69f3a5 class ComposerAutoloaderInitead4f9c2a59a5fd6f80b16e3e46a6781 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 require __DIR__ . '/platform_check.php'; 25 spl_autoload_register(array('ComposerAutoloaderInitead4f9c2a59a5fd6f80b16e3e46a6781', 'loadClassLoader'), true, true); 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInitead4f9c2a59a5fd6f80b16e3e46a6781', 'loadClassLoader')); 26 28 27 spl_autoload_register(array('ComposerAutoloaderInitf67ba7642a570c4ff5f84f5e36d69f3a', 'loadClassLoader'), true, true); 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInitf67ba7642a570c4ff5f84f5e36d69f3a', 'loadClassLoader')); 30 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 32 if ($useStaticLoader) { 33 require __DIR__ . '/autoload_static.php'; 34 35 call_user_func(\Composer\Autoload\ComposerStaticInitf67ba7642a570c4ff5f84f5e36d69f3a::getInitializer($loader)); 36 } else { 37 $map = require __DIR__ . '/autoload_namespaces.php'; 38 foreach ($map as $namespace => $path) { 39 $loader->set($namespace, $path); 40 } 41 42 $map = require __DIR__ . '/autoload_psr4.php'; 43 foreach ($map as $namespace => $path) { 44 $loader->setPsr4($namespace, $path); 45 } 46 47 $classMap = require __DIR__ . '/autoload_classmap.php'; 48 if ($classMap) { 49 $loader->addClassMap($classMap); 50 } 51 } 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781::getInitializer($loader)); 52 31 53 32 $loader->register(true); -
digest/trunk/vendor/composer/autoload_static.php
r2541316 r2887683 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit f67ba7642a570c4ff5f84f5e36d69f3a7 class ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 42 42 { 43 43 return \Closure::bind(function () use ($loader) { 44 $loader->prefixLengthsPsr4 = ComposerStaticInit f67ba7642a570c4ff5f84f5e36d69f3a::$prefixLengthsPsr4;45 $loader->prefixDirsPsr4 = ComposerStaticInit f67ba7642a570c4ff5f84f5e36d69f3a::$prefixDirsPsr4;46 $loader->classMap = ComposerStaticInit f67ba7642a570c4ff5f84f5e36d69f3a::$classMap;44 $loader->prefixLengthsPsr4 = ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781::$prefixLengthsPsr4; 45 $loader->prefixDirsPsr4 = ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781::$prefixDirsPsr4; 46 $loader->classMap = ComposerStaticInitead4f9c2a59a5fd6f80b16e3e46a6781::$classMap; 47 47 48 48 }, null, ClassLoader::class); -
digest/trunk/vendor/composer/installed.php
r2541316 r2887683 1 <?php return array ( 2 'root' => 3 array ( 4 'pretty_version' => '2.0.0', 5 'version' => '2.0.0.0', 6 'aliases' => 7 array ( 1 <?php return array( 2 'root' => array( 3 'name' => 'wearerequired/digest', 4 'pretty_version' => '3.0.0', 5 'version' => '3.0.0.0', 6 'reference' => 'e043be1dcfafde2b782d61cce5aa4e359f25dcc3', 7 'type' => 'wordpress-plugin', 8 'install_path' => __DIR__ . '/../../', 9 'aliases' => array(), 10 'dev' => false, 8 11 ), 9 'reference' => '5fe66ddc9b561109c4d3b1509824319319185c73', 10 'name' => 'wearerequired/digest', 11 ), 12 'versions' => 13 array ( 14 'wearerequired/digest' => 15 array ( 16 'pretty_version' => '2.0.0', 17 'version' => '2.0.0.0', 18 'aliases' => 19 array ( 20 ), 21 'reference' => '5fe66ddc9b561109c4d3b1509824319319185c73', 12 'versions' => array( 13 'wearerequired/digest' => array( 14 'pretty_version' => '3.0.0', 15 'version' => '3.0.0.0', 16 'reference' => 'e043be1dcfafde2b782d61cce5aa4e359f25dcc3', 17 'type' => 'wordpress-plugin', 18 'install_path' => __DIR__ . '/../../', 19 'aliases' => array(), 20 'dev_requirement' => false, 21 ), 22 'wearerequired/wp-requirements-check' => array( 23 'pretty_version' => '1.1.0', 24 'version' => '1.1.0.0', 25 'reference' => '82b8a6c4b953f59e7e534df2d4287e34af950812', 26 'type' => 'library', 27 'install_path' => __DIR__ . '/../wearerequired/wp-requirements-check', 28 'aliases' => array(), 29 'dev_requirement' => false, 30 ), 22 31 ), 23 'wearerequired/wp-requirements-check' =>24 array (25 'pretty_version' => '1.1.0',26 'version' => '1.1.0.0',27 'aliases' =>28 array (29 ),30 'reference' => '82b8a6c4b953f59e7e534df2d4287e34af950812',31 ),32 ),33 32 );
Note: See TracChangeset
for help on using the changeset viewer.