Changeset 2632279
- Timestamp:
- 11/18/2021 07:17:44 PM (4 years ago)
- Location:
- ownerrez
- Files:
-
- 22 edited
- 1 copied
-
tags/1.1.9 (copied) (copied from ownerrez/trunk)
-
tags/1.1.9/lib/autoload.php (modified) (1 diff)
-
tags/1.1.9/lib/composer/ClassLoader.php (modified) (20 diffs)
-
tags/1.1.9/lib/composer/InstalledVersions.php (modified) (2 diffs)
-
tags/1.1.9/lib/composer/autoload_real.php (modified) (5 diffs)
-
tags/1.1.9/lib/composer/autoload_static.php (modified) (2 diffs)
-
tags/1.1.9/lib/composer/installed.php (modified) (1 diff)
-
tags/1.1.9/ownerrez.php (modified) (2 diffs)
-
tags/1.1.9/public/class-ownerrez-shortcodes.php (modified) (4 diffs)
-
tags/1.1.9/public/css/ownerrez-public.css (modified) (4 diffs)
-
tags/1.1.9/public/js/ownerrez-photo-carousel.js (modified) (2 diffs)
-
tags/1.1.9/readme.txt (modified) (2 diffs)
-
trunk/lib/autoload.php (modified) (1 diff)
-
trunk/lib/composer/ClassLoader.php (modified) (20 diffs)
-
trunk/lib/composer/InstalledVersions.php (modified) (2 diffs)
-
trunk/lib/composer/autoload_real.php (modified) (5 diffs)
-
trunk/lib/composer/autoload_static.php (modified) (2 diffs)
-
trunk/lib/composer/installed.php (modified) (1 diff)
-
trunk/ownerrez.php (modified) (2 diffs)
-
trunk/public/class-ownerrez-shortcodes.php (modified) (4 diffs)
-
trunk/public/css/ownerrez-public.css (modified) (4 diffs)
-
trunk/public/js/ownerrez-photo-carousel.js (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ownerrez/tags/1.1.9/lib/autoload.php
r2492370 r2632279 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 32993f4f10380a055df9a453a342ebf1::getLoader();7 return ComposerAutoloaderInitb2c63143273ca805b250984dbfb91745::getLoader(); -
ownerrez/tags/1.1.9/lib/composer/ClassLoader.php
r2492370 r2632279 43 43 class ClassLoader 44 44 { 45 /** @var ?string */ 45 46 private $vendorDir; 46 47 47 48 // PSR-4 49 /** 50 * @var array[] 51 * @psalm-var array<string, array<string, int>> 52 */ 48 53 private $prefixLengthsPsr4 = array(); 54 /** 55 * @var array[] 56 * @psalm-var array<string, array<int, string>> 57 */ 49 58 private $prefixDirsPsr4 = array(); 59 /** 60 * @var array[] 61 * @psalm-var array<string, string> 62 */ 50 63 private $fallbackDirsPsr4 = array(); 51 64 52 65 // PSR-0 66 /** 67 * @var array[] 68 * @psalm-var array<string, array<string, string[]>> 69 */ 53 70 private $prefixesPsr0 = array(); 71 /** 72 * @var array[] 73 * @psalm-var array<string, string> 74 */ 54 75 private $fallbackDirsPsr0 = array(); 55 76 77 /** @var bool */ 56 78 private $useIncludePath = false; 79 80 /** 81 * @var string[] 82 * @psalm-var array<string, string> 83 */ 57 84 private $classMap = array(); 85 86 /** @var bool */ 58 87 private $classMapAuthoritative = false; 88 89 /** 90 * @var bool[] 91 * @psalm-var array<string, bool> 92 */ 59 93 private $missingClasses = array(); 94 95 /** @var ?string */ 60 96 private $apcuPrefix; 61 97 98 /** 99 * @var self[] 100 */ 62 101 private static $registeredLoaders = array(); 63 102 103 /** 104 * @param ?string $vendorDir 105 */ 64 106 public function __construct($vendorDir = null) 65 107 { … … 67 109 } 68 110 111 /** 112 * @return string[] 113 */ 69 114 public function getPrefixes() 70 115 { … … 76 121 } 77 122 123 /** 124 * @return array[] 125 * @psalm-return array<string, array<int, string>> 126 */ 78 127 public function getPrefixesPsr4() 79 128 { … … 81 130 } 82 131 132 /** 133 * @return array[] 134 * @psalm-return array<string, string> 135 */ 83 136 public function getFallbackDirs() 84 137 { … … 86 139 } 87 140 141 /** 142 * @return array[] 143 * @psalm-return array<string, string> 144 */ 88 145 public function getFallbackDirsPsr4() 89 146 { … … 91 148 } 92 149 150 /** 151 * @return string[] Array of classname => path 152 * @psalm-var array<string, string> 153 */ 93 154 public function getClassMap() 94 155 { … … 97 158 98 159 /** 99 * @param array $classMap Class to filename map 160 * @param string[] $classMap Class to filename map 161 * @psalm-param array<string, string> $classMap 162 * 163 * @return void 100 164 */ 101 165 public function addClassMap(array $classMap) … … 112 176 * appending or prepending to the ones previously set for this prefix. 113 177 * 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 178 * @param string $prefix The prefix 179 * @param string[]|string $paths The PSR-0 root directories 180 * @param bool $prepend Whether to prepend the directories 181 * 182 * @return void 117 183 */ 118 184 public function add($prefix, $paths, $prepend = false) … … 157 223 * appending or prepending to the ones previously set for this namespace. 158 224 * 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 directories225 * @param string $prefix The prefix/namespace, with trailing '\\' 226 * @param string[]|string $paths The PSR-4 base directories 227 * @param bool $prepend Whether to prepend the directories 162 228 * 163 229 * @throws \InvalidArgumentException 230 * 231 * @return void 164 232 */ 165 233 public function addPsr4($prefix, $paths, $prepend = false) … … 205 273 * replacing any others previously set for this prefix. 206 274 * 207 * @param string $prefix The prefix 208 * @param array|string $paths The PSR-0 base directories 275 * @param string $prefix The prefix 276 * @param string[]|string $paths The PSR-0 base directories 277 * 278 * @return void 209 279 */ 210 280 public function set($prefix, $paths) … … 221 291 * replacing any others previously set for this namespace. 222 292 * 223 * @param string $prefix The prefix/namespace, with trailing '\\'224 * @param array|string $paths The PSR-4 base directories293 * @param string $prefix The prefix/namespace, with trailing '\\' 294 * @param string[]|string $paths The PSR-4 base directories 225 295 * 226 296 * @throws \InvalidArgumentException 297 * 298 * @return void 227 299 */ 228 300 public function setPsr4($prefix, $paths) … … 244 316 * 245 317 * @param bool $useIncludePath 318 * 319 * @return void 246 320 */ 247 321 public function setUseIncludePath($useIncludePath) … … 266 340 * 267 341 * @param bool $classMapAuthoritative 342 * 343 * @return void 268 344 */ 269 345 public function setClassMapAuthoritative($classMapAuthoritative) … … 286 362 * 287 363 * @param string|null $apcuPrefix 364 * 365 * @return void 288 366 */ 289 367 public function setApcuPrefix($apcuPrefix) … … 306 384 * 307 385 * @param bool $prepend Whether to prepend the autoloader or not 386 * 387 * @return void 308 388 */ 309 389 public function register($prepend = false) … … 325 405 /** 326 406 * Unregisters this instance as an autoloader. 407 * 408 * @return void 327 409 */ 328 410 public function unregister() … … 339 421 * 340 422 * @param string $class The name of the class 341 * @return bool|null True if loaded, null otherwise423 * @return true|null True if loaded, null otherwise 342 424 */ 343 425 public function loadClass($class) … … 348 430 return true; 349 431 } 432 433 return null; 350 434 } 351 435 … … 402 486 } 403 487 488 /** 489 * @param string $class 490 * @param string $ext 491 * @return string|false 492 */ 404 493 private function findFileWithExtension($class, $ext) 405 494 { … … 473 562 * 474 563 * Prevents access to $this/self from included files. 564 * 565 * @param string $file 566 * @return void 567 * @private 475 568 */ 476 569 function includeFile($file) -
ownerrez/tags/1.1.9/lib/composer/InstalledVersions.php
r2492370 r2632279 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 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 */ 23 25 class InstalledVersions 24 26 { 25 private static $installed = array ( 26 'root' => 27 array ( 28 'pretty_version' => 'v1.1.6', 29 'version' => '1.1.6.0', 30 'aliases' => 31 array ( 32 ), 33 'reference' => 'd3cc35419e0abe1c8bd7560755a3660d7ea23ce1', 34 'name' => 'ownerrez/orez-wp', 35 ), 36 'versions' => 37 array ( 38 'guzzlehttp/guzzle' => 39 array ( 40 'pretty_version' => '7.2.0', 41 'version' => '7.2.0.0', 42 'aliases' => 43 array ( 44 ), 45 'reference' => '0aa74dfb41ae110835923ef10a9d803a22d50e79', 46 ), 47 'guzzlehttp/promises' => 48 array ( 49 'pretty_version' => '1.4.0', 50 'version' => '1.4.0.0', 51 'aliases' => 52 array ( 53 ), 54 'reference' => '60d379c243457e073cff02bc323a2a86cb355631', 55 ), 56 'guzzlehttp/psr7' => 57 array ( 58 'pretty_version' => '1.7.0', 59 'version' => '1.7.0.0', 60 'aliases' => 61 array ( 62 ), 63 'reference' => '53330f47520498c0ae1f61f7e2c90f55690c06a3', 64 ), 65 'ownerrez/orez-api' => 66 array ( 67 'pretty_version' => '1.0.5', 68 'version' => '1.0.5.0', 69 'aliases' => 70 array ( 71 ), 72 'reference' => '7b103b412eb359848cbde50bfc3c8b18a898b461', 73 ), 74 'ownerrez/orez-wp' => 75 array ( 76 'pretty_version' => 'v1.1.6', 77 'version' => '1.1.6.0', 78 'aliases' => 79 array ( 80 ), 81 'reference' => 'd3cc35419e0abe1c8bd7560755a3660d7ea23ce1', 82 ), 83 'psr/http-client' => 84 array ( 85 'pretty_version' => '1.0.1', 86 'version' => '1.0.1.0', 87 'aliases' => 88 array ( 89 ), 90 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', 91 ), 92 'psr/http-client-implementation' => 93 array ( 94 'provided' => 95 array ( 96 0 => '1.0', 97 ), 98 ), 99 'psr/http-message' => 100 array ( 101 'pretty_version' => '1.0.1', 102 'version' => '1.0.1.0', 103 'aliases' => 104 array ( 105 ), 106 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', 107 ), 108 'psr/http-message-implementation' => 109 array ( 110 'provided' => 111 array ( 112 0 => '1.0', 113 ), 114 ), 115 'ralouphie/getallheaders' => 116 array ( 117 'pretty_version' => '3.0.3', 118 'version' => '3.0.3.0', 119 'aliases' => 120 array ( 121 ), 122 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 123 ), 124 ), 125 ); 126 private static $canGetVendors; 127 private static $installedByVendor = array(); 128 129 130 131 132 133 134 135 public static function getInstalledPackages() 136 { 137 $packages = array(); 138 foreach (self::getInstalled() as $installed) { 139 $packages[] = array_keys($installed['versions']); 27 /** 28 * @var mixed[]|null 29 * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null 30 */ 31 private static $installed; 32 33 /** 34 * @var bool|null 35 */ 36 private static $canGetVendors; 37 38 /** 39 * @var array[] 40 * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> 41 */ 42 private static $installedByVendor = array(); 43 44 /** 45 * Returns a list of all package names which are present, either by being installed, replaced or provided 46 * 47 * @return string[] 48 * @psalm-return list<string> 49 */ 50 public static function getInstalledPackages() 51 { 52 $packages = array(); 53 foreach (self::getInstalled() as $installed) { 54 $packages[] = array_keys($installed['versions']); 55 } 56 57 if (1 === \count($packages)) { 58 return $packages[0]; 59 } 60 61 return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); 62 } 63 64 /** 65 * Returns a list of all package names with a specific type e.g. 'library' 66 * 67 * @param string $type 68 * @return string[] 69 * @psalm-return list<string> 70 */ 71 public static function getInstalledPackagesByType($type) 72 { 73 $packagesByType = array(); 74 75 foreach (self::getInstalled() as $installed) { 76 foreach ($installed['versions'] as $name => $package) { 77 if (isset($package['type']) && $package['type'] === $type) { 78 $packagesByType[] = $name; 79 } 80 } 81 } 82 83 return $packagesByType; 84 } 85 86 /** 87 * Checks whether the given package is installed 88 * 89 * This also returns true if the package name is provided or replaced by another package 90 * 91 * @param string $packageName 92 * @param bool $includeDevRequirements 93 * @return bool 94 */ 95 public static function isInstalled($packageName, $includeDevRequirements = true) 96 { 97 foreach (self::getInstalled() as $installed) { 98 if (isset($installed['versions'][$packageName])) { 99 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); 100 } 101 } 102 103 return false; 104 } 105 106 /** 107 * Checks whether the given package satisfies a version constraint 108 * 109 * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: 110 * 111 * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') 112 * 113 * @param VersionParser $parser Install composer/semver to have access to this class and functionality 114 * @param string $packageName 115 * @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 116 * @return bool 117 */ 118 public static function satisfies(VersionParser $parser, $packageName, $constraint) 119 { 120 $constraint = $parser->parseConstraints($constraint); 121 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 122 123 return $provided->matches($constraint); 124 } 125 126 /** 127 * Returns a version constraint representing all the range(s) which are installed for a given package 128 * 129 * It is easier to use this via isInstalled() with the $constraint argument if you need to check 130 * whether a given version of a package is installed, and not just whether it exists 131 * 132 * @param string $packageName 133 * @return string Version constraint usable with composer/semver 134 */ 135 public static function getVersionRanges($packageName) 136 { 137 foreach (self::getInstalled() as $installed) { 138 if (!isset($installed['versions'][$packageName])) { 139 continue; 140 } 141 142 $ranges = array(); 143 if (isset($installed['versions'][$packageName]['pretty_version'])) { 144 $ranges[] = $installed['versions'][$packageName]['pretty_version']; 145 } 146 if (array_key_exists('aliases', $installed['versions'][$packageName])) { 147 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); 148 } 149 if (array_key_exists('replaced', $installed['versions'][$packageName])) { 150 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); 151 } 152 if (array_key_exists('provided', $installed['versions'][$packageName])) { 153 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); 154 } 155 156 return implode(' || ', $ranges); 157 } 158 159 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 160 } 161 162 /** 163 * @param string $packageName 164 * @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 165 */ 166 public static function getVersion($packageName) 167 { 168 foreach (self::getInstalled() as $installed) { 169 if (!isset($installed['versions'][$packageName])) { 170 continue; 171 } 172 173 if (!isset($installed['versions'][$packageName]['version'])) { 174 return null; 175 } 176 177 return $installed['versions'][$packageName]['version']; 178 } 179 180 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 181 } 182 183 /** 184 * @param string $packageName 185 * @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 186 */ 187 public static function getPrettyVersion($packageName) 188 { 189 foreach (self::getInstalled() as $installed) { 190 if (!isset($installed['versions'][$packageName])) { 191 continue; 192 } 193 194 if (!isset($installed['versions'][$packageName]['pretty_version'])) { 195 return null; 196 } 197 198 return $installed['versions'][$packageName]['pretty_version']; 199 } 200 201 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 202 } 203 204 /** 205 * @param string $packageName 206 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference 207 */ 208 public static function getReference($packageName) 209 { 210 foreach (self::getInstalled() as $installed) { 211 if (!isset($installed['versions'][$packageName])) { 212 continue; 213 } 214 215 if (!isset($installed['versions'][$packageName]['reference'])) { 216 return null; 217 } 218 219 return $installed['versions'][$packageName]['reference']; 220 } 221 222 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 223 } 224 225 /** 226 * @param string $packageName 227 * @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. 228 */ 229 public static function getInstallPath($packageName) 230 { 231 foreach (self::getInstalled() as $installed) { 232 if (!isset($installed['versions'][$packageName])) { 233 continue; 234 } 235 236 return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; 237 } 238 239 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 240 } 241 242 /** 243 * @return array 244 * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} 245 */ 246 public static function getRootPackage() 247 { 248 $installed = self::getInstalled(); 249 250 return $installed[0]['root']; 251 } 252 253 /** 254 * Returns the raw installed.php data for custom implementations 255 * 256 * @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. 257 * @return array[] 258 * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} 259 */ 260 public static function getRawData() 261 { 262 @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); 263 264 if (null === self::$installed) { 265 // only require the installed.php file if this file is loaded from its dumped location, 266 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 267 if (substr(__DIR__, -8, 1) !== 'C') { 268 self::$installed = include __DIR__ . '/installed.php'; 269 } else { 270 self::$installed = array(); 271 } 272 } 273 274 return self::$installed; 275 } 276 277 /** 278 * Returns the raw data of all installed.php which are currently loaded for custom implementations 279 * 280 * @return array[] 281 * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> 282 */ 283 public static function getAllRawData() 284 { 285 return self::getInstalled(); 286 } 287 288 /** 289 * Lets you reload the static array from another file 290 * 291 * This is only useful for complex integrations in which a project needs to use 292 * this class but then also needs to execute another project's autoloader in process, 293 * and wants to ensure both projects have access to their version of installed.php. 294 * 295 * A typical case would be PHPUnit, where it would need to make sure it reads all 296 * the data it needs from this class, then call reload() with 297 * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure 298 * the project in which it runs can then also use this class safely, without 299 * interference between PHPUnit's dependencies and the project's dependencies. 300 * 301 * @param array[] $data A vendor/composer/installed.php data set 302 * @return void 303 * 304 * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data 305 */ 306 public static function reload($data) 307 { 308 self::$installed = $data; 309 self::$installedByVendor = array(); 310 } 311 312 /** 313 * @return array[] 314 * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> 315 */ 316 private static function getInstalled() 317 { 318 if (null === self::$canGetVendors) { 319 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); 320 } 321 322 $installed = array(); 323 324 if (self::$canGetVendors) { 325 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 326 if (isset(self::$installedByVendor[$vendorDir])) { 327 $installed[] = self::$installedByVendor[$vendorDir]; 328 } elseif (is_file($vendorDir.'/composer/installed.php')) { 329 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; 330 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 331 self::$installed = $installed[count($installed) - 1]; 332 } 333 } 334 } 335 } 336 337 if (null === self::$installed) { 338 // only require the installed.php file if this file is loaded from its dumped location, 339 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 340 if (substr(__DIR__, -8, 1) !== 'C') { 341 self::$installed = require __DIR__ . '/installed.php'; 342 } else { 343 self::$installed = array(); 344 } 345 } 346 $installed[] = self::$installed; 347 348 return $installed; 349 } 140 350 } 141 142 143 if (1 === \count($packages)) {144 return $packages[0];145 }146 147 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));148 }149 150 151 152 153 154 155 156 157 158 public static function isInstalled($packageName)159 {160 foreach (self::getInstalled() as $installed) {161 if (isset($installed['versions'][$packageName])) {162 return true;163 }164 }165 166 return false;167 }168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 public static function satisfies(VersionParser $parser, $packageName, $constraint)183 {184 $constraint = $parser->parseConstraints($constraint);185 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));186 187 return $provided->matches($constraint);188 }189 190 191 192 193 194 195 196 197 198 199 public static function getVersionRanges($packageName)200 {201 foreach (self::getInstalled() as $installed) {202 if (!isset($installed['versions'][$packageName])) {203 continue;204 }205 206 $ranges = array();207 if (isset($installed['versions'][$packageName]['pretty_version'])) {208 $ranges[] = $installed['versions'][$packageName]['pretty_version'];209 }210 if (array_key_exists('aliases', $installed['versions'][$packageName])) {211 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);212 }213 if (array_key_exists('replaced', $installed['versions'][$packageName])) {214 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);215 }216 if (array_key_exists('provided', $installed['versions'][$packageName])) {217 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);218 }219 220 return implode(' || ', $ranges);221 }222 223 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');224 }225 226 227 228 229 230 public static function getVersion($packageName)231 {232 foreach (self::getInstalled() as $installed) {233 if (!isset($installed['versions'][$packageName])) {234 continue;235 }236 237 if (!isset($installed['versions'][$packageName]['version'])) {238 return null;239 }240 241 return $installed['versions'][$packageName]['version'];242 }243 244 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');245 }246 247 248 249 250 251 public static function getPrettyVersion($packageName)252 {253 foreach (self::getInstalled() as $installed) {254 if (!isset($installed['versions'][$packageName])) {255 continue;256 }257 258 if (!isset($installed['versions'][$packageName]['pretty_version'])) {259 return null;260 }261 262 return $installed['versions'][$packageName]['pretty_version'];263 }264 265 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');266 }267 268 269 270 271 272 public static function getReference($packageName)273 {274 foreach (self::getInstalled() as $installed) {275 if (!isset($installed['versions'][$packageName])) {276 continue;277 }278 279 if (!isset($installed['versions'][$packageName]['reference'])) {280 return null;281 }282 283 return $installed['versions'][$packageName]['reference'];284 }285 286 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');287 }288 289 290 291 292 293 public static function getRootPackage()294 {295 $installed = self::getInstalled();296 297 return $installed[0]['root'];298 }299 300 301 302 303 304 305 306 public static function getRawData()307 {308 return self::$installed;309 }310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 public static function reload($data)330 {331 self::$installed = $data;332 self::$installedByVendor = array();333 }334 335 336 337 338 private static function getInstalled()339 {340 if (null === self::$canGetVendors) {341 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');342 }343 344 $installed = array();345 346 if (self::$canGetVendors) {347 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {348 if (isset(self::$installedByVendor[$vendorDir])) {349 $installed[] = self::$installedByVendor[$vendorDir];350 } elseif (is_file($vendorDir.'/composer/installed.php')) {351 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';352 }353 }354 }355 356 $installed[] = self::$installed;357 358 return $installed;359 }360 } -
ownerrez/tags/1.1.9/lib/composer/autoload_real.php
r2492370 r2632279 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 32993f4f10380a055df9a453a342ebf15 class ComposerAutoloaderInitb2c63143273ca805b250984dbfb91745 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 32993f4f10380a055df9a453a342ebf1', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitb2c63143273ca805b250984dbfb91745', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 32993f4f10380a055df9a453a342ebf1', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitb2c63143273ca805b250984dbfb91745', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInitb2c63143273ca805b250984dbfb91745::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; … … 54 54 55 55 if ($useStaticLoader) { 56 $includeFiles = Composer\Autoload\ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::$files;56 $includeFiles = Composer\Autoload\ComposerStaticInitb2c63143273ca805b250984dbfb91745::$files; 57 57 } else { 58 58 $includeFiles = require __DIR__ . '/autoload_files.php'; 59 59 } 60 60 foreach ($includeFiles as $fileIdentifier => $file) { 61 composerRequire 32993f4f10380a055df9a453a342ebf1($fileIdentifier, $file);61 composerRequireb2c63143273ca805b250984dbfb91745($fileIdentifier, $file); 62 62 } 63 63 … … 66 66 } 67 67 68 function composerRequire 32993f4f10380a055df9a453a342ebf1($fileIdentifier, $file)68 function composerRequireb2c63143273ca805b250984dbfb91745($fileIdentifier, $file) 69 69 { 70 70 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
ownerrez/tags/1.1.9/lib/composer/autoload_static.php
r2492370 r2632279 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 32993f4f10380a055df9a453a342ebf17 class ComposerStaticInitb2c63143273ca805b250984dbfb91745 8 8 { 9 9 public static $files = array ( … … 76 76 { 77 77 return \Closure::bind(function () use ($loader) { 78 $loader->prefixLengthsPsr4 = ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::$prefixLengthsPsr4;79 $loader->prefixDirsPsr4 = ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::$prefixDirsPsr4;80 $loader->classMap = ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::$classMap;78 $loader->prefixLengthsPsr4 = ComposerStaticInitb2c63143273ca805b250984dbfb91745::$prefixLengthsPsr4; 79 $loader->prefixDirsPsr4 = ComposerStaticInitb2c63143273ca805b250984dbfb91745::$prefixDirsPsr4; 80 $loader->classMap = ComposerStaticInitb2c63143273ca805b250984dbfb91745::$classMap; 81 81 82 82 }, null, ClassLoader::class); -
ownerrez/tags/1.1.9/lib/composer/installed.php
r2492370 r2632279 1 <?php return array ( 2 'root' => 3 array ( 4 'pretty_version' => 'v1.1.6', 5 'version' => '1.1.6.0', 6 'aliases' => 7 array ( 1 <?php return array( 2 'root' => array( 3 'pretty_version' => 'v1.1.9', 4 'version' => '1.1.9.0', 5 'type' => 'wordpress-plugin', 6 'install_path' => __DIR__ . '/../../../', 7 'aliases' => array(), 8 'reference' => '9a913e03f1939826e93b1da4755993874c9e79f9', 9 'name' => 'ownerrez/orez-wp', 10 'dev' => true, 8 11 ), 9 'reference' => 'd3cc35419e0abe1c8bd7560755a3660d7ea23ce1', 10 'name' => 'ownerrez/orez-wp', 11 ), 12 'versions' => 13 array ( 14 'guzzlehttp/guzzle' => 15 array ( 16 'pretty_version' => '7.2.0', 17 'version' => '7.2.0.0', 18 'aliases' => 19 array ( 20 ), 21 'reference' => '0aa74dfb41ae110835923ef10a9d803a22d50e79', 12 'versions' => array( 13 'guzzlehttp/guzzle' => array( 14 'pretty_version' => '7.2.0', 15 'version' => '7.2.0.0', 16 'type' => 'library', 17 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 18 'aliases' => array(), 19 'reference' => '0aa74dfb41ae110835923ef10a9d803a22d50e79', 20 'dev_requirement' => false, 21 ), 22 'guzzlehttp/promises' => array( 23 'pretty_version' => '1.4.0', 24 'version' => '1.4.0.0', 25 'type' => 'library', 26 'install_path' => __DIR__ . '/../guzzlehttp/promises', 27 'aliases' => array(), 28 'reference' => '60d379c243457e073cff02bc323a2a86cb355631', 29 'dev_requirement' => false, 30 ), 31 'guzzlehttp/psr7' => array( 32 'pretty_version' => '1.7.0', 33 'version' => '1.7.0.0', 34 'type' => 'library', 35 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 36 'aliases' => array(), 37 'reference' => '53330f47520498c0ae1f61f7e2c90f55690c06a3', 38 'dev_requirement' => false, 39 ), 40 'ownerrez/orez-api' => array( 41 'pretty_version' => '1.0.5', 42 'version' => '1.0.5.0', 43 'type' => 'library', 44 'install_path' => __DIR__ . '/../ownerrez/orez-api', 45 'aliases' => array(), 46 'reference' => '7b103b412eb359848cbde50bfc3c8b18a898b461', 47 'dev_requirement' => false, 48 ), 49 'ownerrez/orez-wp' => array( 50 'pretty_version' => 'v1.1.9', 51 'version' => '1.1.9.0', 52 'type' => 'wordpress-plugin', 53 'install_path' => __DIR__ . '/../../../', 54 'aliases' => array(), 55 'reference' => '9a913e03f1939826e93b1da4755993874c9e79f9', 56 'dev_requirement' => false, 57 ), 58 'psr/http-client' => array( 59 'pretty_version' => '1.0.1', 60 'version' => '1.0.1.0', 61 'type' => 'library', 62 'install_path' => __DIR__ . '/../psr/http-client', 63 'aliases' => array(), 64 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', 65 'dev_requirement' => false, 66 ), 67 'psr/http-client-implementation' => array( 68 'dev_requirement' => false, 69 'provided' => array( 70 0 => '1.0', 71 ), 72 ), 73 'psr/http-message' => array( 74 'pretty_version' => '1.0.1', 75 'version' => '1.0.1.0', 76 'type' => 'library', 77 'install_path' => __DIR__ . '/../psr/http-message', 78 'aliases' => array(), 79 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', 80 'dev_requirement' => false, 81 ), 82 'psr/http-message-implementation' => array( 83 'dev_requirement' => false, 84 'provided' => array( 85 0 => '1.0', 86 ), 87 ), 88 'ralouphie/getallheaders' => array( 89 'pretty_version' => '3.0.3', 90 'version' => '3.0.3.0', 91 'type' => 'library', 92 'install_path' => __DIR__ . '/../ralouphie/getallheaders', 93 'aliases' => array(), 94 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 95 'dev_requirement' => false, 96 ), 22 97 ), 23 'guzzlehttp/promises' =>24 array (25 'pretty_version' => '1.4.0',26 'version' => '1.4.0.0',27 'aliases' =>28 array (29 ),30 'reference' => '60d379c243457e073cff02bc323a2a86cb355631',31 ),32 'guzzlehttp/psr7' =>33 array (34 'pretty_version' => '1.7.0',35 'version' => '1.7.0.0',36 'aliases' =>37 array (38 ),39 'reference' => '53330f47520498c0ae1f61f7e2c90f55690c06a3',40 ),41 'ownerrez/orez-api' =>42 array (43 'pretty_version' => '1.0.5',44 'version' => '1.0.5.0',45 'aliases' =>46 array (47 ),48 'reference' => '7b103b412eb359848cbde50bfc3c8b18a898b461',49 ),50 'ownerrez/orez-wp' =>51 array (52 'pretty_version' => 'v1.1.6',53 'version' => '1.1.6.0',54 'aliases' =>55 array (56 ),57 'reference' => 'd3cc35419e0abe1c8bd7560755a3660d7ea23ce1',58 ),59 'psr/http-client' =>60 array (61 'pretty_version' => '1.0.1',62 'version' => '1.0.1.0',63 'aliases' =>64 array (65 ),66 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',67 ),68 'psr/http-client-implementation' =>69 array (70 'provided' =>71 array (72 0 => '1.0',73 ),74 ),75 'psr/http-message' =>76 array (77 'pretty_version' => '1.0.1',78 'version' => '1.0.1.0',79 'aliases' =>80 array (81 ),82 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',83 ),84 'psr/http-message-implementation' =>85 array (86 'provided' =>87 array (88 0 => '1.0',89 ),90 ),91 'ralouphie/getallheaders' =>92 array (93 'pretty_version' => '3.0.3',94 'version' => '3.0.3.0',95 'aliases' =>96 array (97 ),98 'reference' => '120b605dfeb996808c31b6477290a714d356e822',99 ),100 ),101 98 ); -
ownerrez/tags/1.1.9/ownerrez.php
r2492370 r2632279 17 17 * Plugin URI: https://www.ownerreservations.com/support/wordpress 18 18 * Description: The official WordPress plugin for the OwnerRez API. 19 * Version: 1.1. 619 * Version: 1.1.9 20 20 * Author: OwnerRez, Inc. 21 21 * Author URI: https://www.ownerreservations.com/ … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('OWNERREZ_VERSION', '1.1. 6');38 define('OWNERREZ_VERSION', '1.1.9'); 39 39 40 40 /** -
ownerrez/tags/1.1.9/public/class-ownerrez-shortcodes.php
r2455543 r2632279 23 23 class OwnerRez_ShortCodes { 24 24 25 /**26 * The ID of this plugin.27 *28 * @since 1.0.029 * @access private30 * @var string $ownerrez The ID of this plugin.31 */32 private $ownerrez;33 34 /**35 * The version of this plugin.36 *37 * @since 1.0.038 * @access private39 * @var string $version The current version of this plugin.40 */41 private $version;25 /** 26 * The ID of this plugin. 27 * 28 * @since 1.0.0 29 * @access private 30 * @var string $ownerrez The ID of this plugin. 31 */ 32 private $ownerrez; 33 34 /** 35 * The version of this plugin. 36 * 37 * @since 1.0.0 38 * @access private 39 * @var string $version The current version of this plugin. 40 */ 41 private $version; 42 42 43 43 private $api; 44 44 45 /**46 * Initialize the class and set its properties.47 *48 * @since 1.0.049 * @param string $ownerrez The name of the plugin.50 * @param string $version The version of this plugin.51 */52 public function __construct( $ownerrez, $version ) {53 54 $this->ownerrez = $ownerrez;55 $this->version = $version;45 /** 46 * Initialize the class and set its properties. 47 * 48 * @since 1.0.0 49 * @param string $ownerrez The name of the plugin. 50 * @param string $version The version of this plugin. 51 */ 52 public function __construct( $ownerrez, $version ) { 53 54 $this->ownerrez = $ownerrez; 55 $this->version = $version; 56 56 $this->api = new OwnerRez_ApiWrapper(); 57 }58 59 /**60 * Register the shortcodes for the public-facing side of the site.61 *62 * @since 1.0.063 */64 public function register_shortcodes()57 } 58 59 /** 60 * Register the shortcodes for the public-facing side of the site. 61 * 62 * @since 1.0.0 63 */ 64 public function register_shortcodes() 65 65 { 66 66 add_shortcode('ownerrez', array($this, 'shortcode')); … … 325 325 { 326 326 if (!$this->photoCarouselEnqueued) { 327 wp_enqueue_style("ownerrez-lgstyle1", "https://cdn.orez.io/hc/content/lightslider.min.css", null, $this->version); 328 wp_enqueue_style("ownerrez-lgstyle2", "https://cdn.orez.io/hc/content/lightgallery.min.css", null, $this->version); 327 wp_enqueue_style("ownerrez-lgstyle", "https://cdn.orez.io/hc/content/lgbundle.min.css", null, $this->version); 329 328 wp_enqueue_script("ownerrez-lgscript", "https://cdn.orez.io/hc/scripts/lgbundle.min.js", array( 'jquery' ), $this->version); 329 // wp_enqueue_style("ownerrez-lgstyle", "https://hosteddev.ownerrez.com/content/lgbundle.min.css", null, $this->version); 330 // wp_enqueue_script("ownerrez-lgscript", "https://hosteddev.ownerrez.com/scripts/lgbundle.min.js", array( 'jquery' ), $this->version); 330 331 wp_enqueue_script("ownerrez-photo-carousel.js", plugins_url('/ownerrez/public/js/ownerrez-photo-carousel.js'), array( 'jquery' ), $this->version); 331 332 … … 342 343 $caption = $image->caption; 343 344 344 $sliderUl .= "<li data-thumb='" . $image->croppedUrl . "' data-src='" . $image->originalUrl . "'><img src='" . $image->largeUrl . "' data-sub-html='" . $caption . "' />"; 345 $srcUrl = $image->originalUrl; 346 $posterAttr = ""; 347 348 if (property_exists($image, "videoUrl") && !is_null($image->videoUrl)) { 349 $srcUrl = $image->videoUrl . (strpos($image->videoUrl, "?") ? "&" : "?") . 'mute=0&muted=false'; 350 $posterAttr = " data-poster='" . $image->originalUrl . "'"; 351 } 352 353 $sliderUl .= "<li data-thumb='" . $image->croppedUrl . "' data-src='" . $srcUrl . "'" . $posterAttr . "><img src='" . $image->largeUrl . "' data-sub-html='" . $caption . "' />"; 354 355 if (property_exists($image, "videoUrl") && !is_null($image->videoUrl)) { 356 $sliderUl .= '<svg viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" focusable="false" aria-labelledby="Play video" role="img" class="lg-video-play-icon"> 357 <title>Play video</title> 358 <circle cx="50%" cy="50%" r="48"></circle> 359 <polygon points="35,30 35,70 70,50"></polygon> 360 </svg>'; 361 } 345 362 346 363 if (strlen($caption) > 0) … … 350 367 } 351 368 352 $sliderUl .= "</ul>"; 369 $sliderUl .= '</ul> 370 <ul class="loading-pager"><li>Loading...</li></ul>'; 353 371 354 372 return $sliderUl; -
ownerrez/tags/1.1.9/public/css/ownerrez-public.css
r2450742 r2632279 1 1 .loading-slider { 2 2 padding: 0; 3 padding-bottom: 70% /* a bit extra for the thumbs */ 4 } 5 6 .loading-slider li { 7 margin: 0; 8 padding: 0; 9 list-style: none 3 margin: 0; 4 border: 1px solid rgb(204, 204, 204); 5 box-shadow: rgb(204 204 204) 1px 1px 3px; 6 } 7 8 .loading-slider li, 9 .lightSlider li { 10 margin: 0; 11 padding: 0; 12 list-style: none; 13 line-height: 0; 14 } 15 16 ul.loading-pager { 17 margin: 0; 18 padding: 0; 19 list-style: none; 20 text-align: center; 21 height: 81px; 22 } 23 ul.loading-pager li { 24 line-height: 5; 10 25 } 11 26 … … 20 35 } 21 36 37 .loading-slider .caption, 22 38 .lightSlider .caption { 23 39 text-align: center; 24 40 position: absolute; 25 bottom: 0 px;26 left: 0 px;27 right: 0 px;41 bottom: 0; 42 left: 0; 43 right: 0; 28 44 font-size: 16px; 29 45 margin: 0; … … 32 48 padding: 5px 10px 5px 5px; 33 49 background-color: rgba(255,255,255,.8); 50 line-height: 1.2; 34 51 } 35 52 … … 190 207 margin-left: 5px; 191 208 } 209 210 .loading-slider li, 211 .lslide { 212 position: relative; 213 cursor: pointer; 214 } 215 .loading-slider li .lg-video-play-icon, 216 .lslide .lg-video-play-icon { 217 width: 150px; 218 } 219 220 .lslide:hover .lg-video-play-icon { 221 opacity: 0.9; 222 cursor: pointer; 223 } 224 225 .loading-slider li .lg-video-play-icon polygon, 226 .lslide .lg-video-play-icon polygon { 227 fill: #fcfcfc; 228 } 229 .loading-slider li .lg-video-play-icon circle, 230 .lslide .lg-video-play-icon circle { 231 fill: none; 232 stroke: #fcfcfc; 233 stroke-width: 3%; 234 } 235 .lg-video-play-button .lg-video-play-icon { 236 width: 35%; 237 left: 53%; 238 top: 48%; 239 } 240 241 .loading-slider img, 242 .lslide img { 243 min-width: 100%; 244 } -
ownerrez/tags/1.1.9/public/js/ownerrez-photo-carousel.js
r2450742 r2632279 1 1 jQuery(".ownerrez-photo-carousel").each(function() { 2 var div = jQuery(this);3 div.lightSlider({2 var loadingPager = jQuery(this).nextAll("ul.loading-pager");loadingPager 3 jQuery(this).lightSlider({ 4 4 gallery: true, 5 5 item: 1, … … 14 14 mode: 'fade', 15 15 onSliderLoad: function (el) { 16 el.lightGallery({ 16 loadingPager.remove(); 17 lightGallery(el.get(0), { 18 licenseKey: "5CD6B56C-064145F1-A29A5203-5655C26F", 17 19 selector: '.ownerrez-photo-carousel .lslide', 18 preload: 4 20 preload: 4, 21 plugins: [lgVideo,lgThumbnail], 22 loadYouTubeThumbnail: false, 23 gotoNextSlideOnVideoEnd: false, 24 youTubePlayerParams: { 25 modestbranding: 1, 26 iv_load_policy: 3 27 } 19 28 }); 20 29 }, -
ownerrez/tags/1.1.9/readme.txt
r2492370 r2632279 4 4 Requires at least: 5.4 5 5 Tested up to: 5.7 6 Stable tag: 1.1. 66 Stable tag: 1.1.9 7 7 License: MIT 8 8 License URI: https://github.com/ownerrez/orez-wp/blob/master/LICENSE … … 33 33 34 34 == Changelog == 35 = 1.1.9 = 36 - Added video support to photo carousel. 37 38 = 1.1.6 = 39 - Add support for WordPress 5.7 40 - Add support for PHP 8 41 35 42 = 1.1.5 = 36 - Upgrade to orez-api version 1.0.4: Now validates integer quote properties and errors for invalid.43 - Upgraded to orez-api version 1.0.4: Now validates integer quote properties and errors for invalid. 37 44 38 45 = 1.1.0 = -
ownerrez/trunk/lib/autoload.php
r2492370 r2632279 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 32993f4f10380a055df9a453a342ebf1::getLoader();7 return ComposerAutoloaderInitb2c63143273ca805b250984dbfb91745::getLoader(); -
ownerrez/trunk/lib/composer/ClassLoader.php
r2492370 r2632279 43 43 class ClassLoader 44 44 { 45 /** @var ?string */ 45 46 private $vendorDir; 46 47 47 48 // PSR-4 49 /** 50 * @var array[] 51 * @psalm-var array<string, array<string, int>> 52 */ 48 53 private $prefixLengthsPsr4 = array(); 54 /** 55 * @var array[] 56 * @psalm-var array<string, array<int, string>> 57 */ 49 58 private $prefixDirsPsr4 = array(); 59 /** 60 * @var array[] 61 * @psalm-var array<string, string> 62 */ 50 63 private $fallbackDirsPsr4 = array(); 51 64 52 65 // PSR-0 66 /** 67 * @var array[] 68 * @psalm-var array<string, array<string, string[]>> 69 */ 53 70 private $prefixesPsr0 = array(); 71 /** 72 * @var array[] 73 * @psalm-var array<string, string> 74 */ 54 75 private $fallbackDirsPsr0 = array(); 55 76 77 /** @var bool */ 56 78 private $useIncludePath = false; 79 80 /** 81 * @var string[] 82 * @psalm-var array<string, string> 83 */ 57 84 private $classMap = array(); 85 86 /** @var bool */ 58 87 private $classMapAuthoritative = false; 88 89 /** 90 * @var bool[] 91 * @psalm-var array<string, bool> 92 */ 59 93 private $missingClasses = array(); 94 95 /** @var ?string */ 60 96 private $apcuPrefix; 61 97 98 /** 99 * @var self[] 100 */ 62 101 private static $registeredLoaders = array(); 63 102 103 /** 104 * @param ?string $vendorDir 105 */ 64 106 public function __construct($vendorDir = null) 65 107 { … … 67 109 } 68 110 111 /** 112 * @return string[] 113 */ 69 114 public function getPrefixes() 70 115 { … … 76 121 } 77 122 123 /** 124 * @return array[] 125 * @psalm-return array<string, array<int, string>> 126 */ 78 127 public function getPrefixesPsr4() 79 128 { … … 81 130 } 82 131 132 /** 133 * @return array[] 134 * @psalm-return array<string, string> 135 */ 83 136 public function getFallbackDirs() 84 137 { … … 86 139 } 87 140 141 /** 142 * @return array[] 143 * @psalm-return array<string, string> 144 */ 88 145 public function getFallbackDirsPsr4() 89 146 { … … 91 148 } 92 149 150 /** 151 * @return string[] Array of classname => path 152 * @psalm-var array<string, string> 153 */ 93 154 public function getClassMap() 94 155 { … … 97 158 98 159 /** 99 * @param array $classMap Class to filename map 160 * @param string[] $classMap Class to filename map 161 * @psalm-param array<string, string> $classMap 162 * 163 * @return void 100 164 */ 101 165 public function addClassMap(array $classMap) … … 112 176 * appending or prepending to the ones previously set for this prefix. 113 177 * 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 178 * @param string $prefix The prefix 179 * @param string[]|string $paths The PSR-0 root directories 180 * @param bool $prepend Whether to prepend the directories 181 * 182 * @return void 117 183 */ 118 184 public function add($prefix, $paths, $prepend = false) … … 157 223 * appending or prepending to the ones previously set for this namespace. 158 224 * 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 directories225 * @param string $prefix The prefix/namespace, with trailing '\\' 226 * @param string[]|string $paths The PSR-4 base directories 227 * @param bool $prepend Whether to prepend the directories 162 228 * 163 229 * @throws \InvalidArgumentException 230 * 231 * @return void 164 232 */ 165 233 public function addPsr4($prefix, $paths, $prepend = false) … … 205 273 * replacing any others previously set for this prefix. 206 274 * 207 * @param string $prefix The prefix 208 * @param array|string $paths The PSR-0 base directories 275 * @param string $prefix The prefix 276 * @param string[]|string $paths The PSR-0 base directories 277 * 278 * @return void 209 279 */ 210 280 public function set($prefix, $paths) … … 221 291 * replacing any others previously set for this namespace. 222 292 * 223 * @param string $prefix The prefix/namespace, with trailing '\\'224 * @param array|string $paths The PSR-4 base directories293 * @param string $prefix The prefix/namespace, with trailing '\\' 294 * @param string[]|string $paths The PSR-4 base directories 225 295 * 226 296 * @throws \InvalidArgumentException 297 * 298 * @return void 227 299 */ 228 300 public function setPsr4($prefix, $paths) … … 244 316 * 245 317 * @param bool $useIncludePath 318 * 319 * @return void 246 320 */ 247 321 public function setUseIncludePath($useIncludePath) … … 266 340 * 267 341 * @param bool $classMapAuthoritative 342 * 343 * @return void 268 344 */ 269 345 public function setClassMapAuthoritative($classMapAuthoritative) … … 286 362 * 287 363 * @param string|null $apcuPrefix 364 * 365 * @return void 288 366 */ 289 367 public function setApcuPrefix($apcuPrefix) … … 306 384 * 307 385 * @param bool $prepend Whether to prepend the autoloader or not 386 * 387 * @return void 308 388 */ 309 389 public function register($prepend = false) … … 325 405 /** 326 406 * Unregisters this instance as an autoloader. 407 * 408 * @return void 327 409 */ 328 410 public function unregister() … … 339 421 * 340 422 * @param string $class The name of the class 341 * @return bool|null True if loaded, null otherwise423 * @return true|null True if loaded, null otherwise 342 424 */ 343 425 public function loadClass($class) … … 348 430 return true; 349 431 } 432 433 return null; 350 434 } 351 435 … … 402 486 } 403 487 488 /** 489 * @param string $class 490 * @param string $ext 491 * @return string|false 492 */ 404 493 private function findFileWithExtension($class, $ext) 405 494 { … … 473 562 * 474 563 * Prevents access to $this/self from included files. 564 * 565 * @param string $file 566 * @return void 567 * @private 475 568 */ 476 569 function includeFile($file) -
ownerrez/trunk/lib/composer/InstalledVersions.php
r2492370 r2632279 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 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 */ 23 25 class InstalledVersions 24 26 { 25 private static $installed = array ( 26 'root' => 27 array ( 28 'pretty_version' => 'v1.1.6', 29 'version' => '1.1.6.0', 30 'aliases' => 31 array ( 32 ), 33 'reference' => 'd3cc35419e0abe1c8bd7560755a3660d7ea23ce1', 34 'name' => 'ownerrez/orez-wp', 35 ), 36 'versions' => 37 array ( 38 'guzzlehttp/guzzle' => 39 array ( 40 'pretty_version' => '7.2.0', 41 'version' => '7.2.0.0', 42 'aliases' => 43 array ( 44 ), 45 'reference' => '0aa74dfb41ae110835923ef10a9d803a22d50e79', 46 ), 47 'guzzlehttp/promises' => 48 array ( 49 'pretty_version' => '1.4.0', 50 'version' => '1.4.0.0', 51 'aliases' => 52 array ( 53 ), 54 'reference' => '60d379c243457e073cff02bc323a2a86cb355631', 55 ), 56 'guzzlehttp/psr7' => 57 array ( 58 'pretty_version' => '1.7.0', 59 'version' => '1.7.0.0', 60 'aliases' => 61 array ( 62 ), 63 'reference' => '53330f47520498c0ae1f61f7e2c90f55690c06a3', 64 ), 65 'ownerrez/orez-api' => 66 array ( 67 'pretty_version' => '1.0.5', 68 'version' => '1.0.5.0', 69 'aliases' => 70 array ( 71 ), 72 'reference' => '7b103b412eb359848cbde50bfc3c8b18a898b461', 73 ), 74 'ownerrez/orez-wp' => 75 array ( 76 'pretty_version' => 'v1.1.6', 77 'version' => '1.1.6.0', 78 'aliases' => 79 array ( 80 ), 81 'reference' => 'd3cc35419e0abe1c8bd7560755a3660d7ea23ce1', 82 ), 83 'psr/http-client' => 84 array ( 85 'pretty_version' => '1.0.1', 86 'version' => '1.0.1.0', 87 'aliases' => 88 array ( 89 ), 90 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', 91 ), 92 'psr/http-client-implementation' => 93 array ( 94 'provided' => 95 array ( 96 0 => '1.0', 97 ), 98 ), 99 'psr/http-message' => 100 array ( 101 'pretty_version' => '1.0.1', 102 'version' => '1.0.1.0', 103 'aliases' => 104 array ( 105 ), 106 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', 107 ), 108 'psr/http-message-implementation' => 109 array ( 110 'provided' => 111 array ( 112 0 => '1.0', 113 ), 114 ), 115 'ralouphie/getallheaders' => 116 array ( 117 'pretty_version' => '3.0.3', 118 'version' => '3.0.3.0', 119 'aliases' => 120 array ( 121 ), 122 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 123 ), 124 ), 125 ); 126 private static $canGetVendors; 127 private static $installedByVendor = array(); 128 129 130 131 132 133 134 135 public static function getInstalledPackages() 136 { 137 $packages = array(); 138 foreach (self::getInstalled() as $installed) { 139 $packages[] = array_keys($installed['versions']); 27 /** 28 * @var mixed[]|null 29 * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null 30 */ 31 private static $installed; 32 33 /** 34 * @var bool|null 35 */ 36 private static $canGetVendors; 37 38 /** 39 * @var array[] 40 * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> 41 */ 42 private static $installedByVendor = array(); 43 44 /** 45 * Returns a list of all package names which are present, either by being installed, replaced or provided 46 * 47 * @return string[] 48 * @psalm-return list<string> 49 */ 50 public static function getInstalledPackages() 51 { 52 $packages = array(); 53 foreach (self::getInstalled() as $installed) { 54 $packages[] = array_keys($installed['versions']); 55 } 56 57 if (1 === \count($packages)) { 58 return $packages[0]; 59 } 60 61 return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); 62 } 63 64 /** 65 * Returns a list of all package names with a specific type e.g. 'library' 66 * 67 * @param string $type 68 * @return string[] 69 * @psalm-return list<string> 70 */ 71 public static function getInstalledPackagesByType($type) 72 { 73 $packagesByType = array(); 74 75 foreach (self::getInstalled() as $installed) { 76 foreach ($installed['versions'] as $name => $package) { 77 if (isset($package['type']) && $package['type'] === $type) { 78 $packagesByType[] = $name; 79 } 80 } 81 } 82 83 return $packagesByType; 84 } 85 86 /** 87 * Checks whether the given package is installed 88 * 89 * This also returns true if the package name is provided or replaced by another package 90 * 91 * @param string $packageName 92 * @param bool $includeDevRequirements 93 * @return bool 94 */ 95 public static function isInstalled($packageName, $includeDevRequirements = true) 96 { 97 foreach (self::getInstalled() as $installed) { 98 if (isset($installed['versions'][$packageName])) { 99 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); 100 } 101 } 102 103 return false; 104 } 105 106 /** 107 * Checks whether the given package satisfies a version constraint 108 * 109 * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: 110 * 111 * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') 112 * 113 * @param VersionParser $parser Install composer/semver to have access to this class and functionality 114 * @param string $packageName 115 * @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 116 * @return bool 117 */ 118 public static function satisfies(VersionParser $parser, $packageName, $constraint) 119 { 120 $constraint = $parser->parseConstraints($constraint); 121 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 122 123 return $provided->matches($constraint); 124 } 125 126 /** 127 * Returns a version constraint representing all the range(s) which are installed for a given package 128 * 129 * It is easier to use this via isInstalled() with the $constraint argument if you need to check 130 * whether a given version of a package is installed, and not just whether it exists 131 * 132 * @param string $packageName 133 * @return string Version constraint usable with composer/semver 134 */ 135 public static function getVersionRanges($packageName) 136 { 137 foreach (self::getInstalled() as $installed) { 138 if (!isset($installed['versions'][$packageName])) { 139 continue; 140 } 141 142 $ranges = array(); 143 if (isset($installed['versions'][$packageName]['pretty_version'])) { 144 $ranges[] = $installed['versions'][$packageName]['pretty_version']; 145 } 146 if (array_key_exists('aliases', $installed['versions'][$packageName])) { 147 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); 148 } 149 if (array_key_exists('replaced', $installed['versions'][$packageName])) { 150 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); 151 } 152 if (array_key_exists('provided', $installed['versions'][$packageName])) { 153 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); 154 } 155 156 return implode(' || ', $ranges); 157 } 158 159 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 160 } 161 162 /** 163 * @param string $packageName 164 * @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 165 */ 166 public static function getVersion($packageName) 167 { 168 foreach (self::getInstalled() as $installed) { 169 if (!isset($installed['versions'][$packageName])) { 170 continue; 171 } 172 173 if (!isset($installed['versions'][$packageName]['version'])) { 174 return null; 175 } 176 177 return $installed['versions'][$packageName]['version']; 178 } 179 180 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 181 } 182 183 /** 184 * @param string $packageName 185 * @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 186 */ 187 public static function getPrettyVersion($packageName) 188 { 189 foreach (self::getInstalled() as $installed) { 190 if (!isset($installed['versions'][$packageName])) { 191 continue; 192 } 193 194 if (!isset($installed['versions'][$packageName]['pretty_version'])) { 195 return null; 196 } 197 198 return $installed['versions'][$packageName]['pretty_version']; 199 } 200 201 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 202 } 203 204 /** 205 * @param string $packageName 206 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference 207 */ 208 public static function getReference($packageName) 209 { 210 foreach (self::getInstalled() as $installed) { 211 if (!isset($installed['versions'][$packageName])) { 212 continue; 213 } 214 215 if (!isset($installed['versions'][$packageName]['reference'])) { 216 return null; 217 } 218 219 return $installed['versions'][$packageName]['reference']; 220 } 221 222 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 223 } 224 225 /** 226 * @param string $packageName 227 * @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. 228 */ 229 public static function getInstallPath($packageName) 230 { 231 foreach (self::getInstalled() as $installed) { 232 if (!isset($installed['versions'][$packageName])) { 233 continue; 234 } 235 236 return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; 237 } 238 239 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 240 } 241 242 /** 243 * @return array 244 * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} 245 */ 246 public static function getRootPackage() 247 { 248 $installed = self::getInstalled(); 249 250 return $installed[0]['root']; 251 } 252 253 /** 254 * Returns the raw installed.php data for custom implementations 255 * 256 * @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. 257 * @return array[] 258 * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} 259 */ 260 public static function getRawData() 261 { 262 @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); 263 264 if (null === self::$installed) { 265 // only require the installed.php file if this file is loaded from its dumped location, 266 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 267 if (substr(__DIR__, -8, 1) !== 'C') { 268 self::$installed = include __DIR__ . '/installed.php'; 269 } else { 270 self::$installed = array(); 271 } 272 } 273 274 return self::$installed; 275 } 276 277 /** 278 * Returns the raw data of all installed.php which are currently loaded for custom implementations 279 * 280 * @return array[] 281 * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> 282 */ 283 public static function getAllRawData() 284 { 285 return self::getInstalled(); 286 } 287 288 /** 289 * Lets you reload the static array from another file 290 * 291 * This is only useful for complex integrations in which a project needs to use 292 * this class but then also needs to execute another project's autoloader in process, 293 * and wants to ensure both projects have access to their version of installed.php. 294 * 295 * A typical case would be PHPUnit, where it would need to make sure it reads all 296 * the data it needs from this class, then call reload() with 297 * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure 298 * the project in which it runs can then also use this class safely, without 299 * interference between PHPUnit's dependencies and the project's dependencies. 300 * 301 * @param array[] $data A vendor/composer/installed.php data set 302 * @return void 303 * 304 * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data 305 */ 306 public static function reload($data) 307 { 308 self::$installed = $data; 309 self::$installedByVendor = array(); 310 } 311 312 /** 313 * @return array[] 314 * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> 315 */ 316 private static function getInstalled() 317 { 318 if (null === self::$canGetVendors) { 319 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); 320 } 321 322 $installed = array(); 323 324 if (self::$canGetVendors) { 325 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 326 if (isset(self::$installedByVendor[$vendorDir])) { 327 $installed[] = self::$installedByVendor[$vendorDir]; 328 } elseif (is_file($vendorDir.'/composer/installed.php')) { 329 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; 330 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 331 self::$installed = $installed[count($installed) - 1]; 332 } 333 } 334 } 335 } 336 337 if (null === self::$installed) { 338 // only require the installed.php file if this file is loaded from its dumped location, 339 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 340 if (substr(__DIR__, -8, 1) !== 'C') { 341 self::$installed = require __DIR__ . '/installed.php'; 342 } else { 343 self::$installed = array(); 344 } 345 } 346 $installed[] = self::$installed; 347 348 return $installed; 349 } 140 350 } 141 142 143 if (1 === \count($packages)) {144 return $packages[0];145 }146 147 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));148 }149 150 151 152 153 154 155 156 157 158 public static function isInstalled($packageName)159 {160 foreach (self::getInstalled() as $installed) {161 if (isset($installed['versions'][$packageName])) {162 return true;163 }164 }165 166 return false;167 }168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 public static function satisfies(VersionParser $parser, $packageName, $constraint)183 {184 $constraint = $parser->parseConstraints($constraint);185 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));186 187 return $provided->matches($constraint);188 }189 190 191 192 193 194 195 196 197 198 199 public static function getVersionRanges($packageName)200 {201 foreach (self::getInstalled() as $installed) {202 if (!isset($installed['versions'][$packageName])) {203 continue;204 }205 206 $ranges = array();207 if (isset($installed['versions'][$packageName]['pretty_version'])) {208 $ranges[] = $installed['versions'][$packageName]['pretty_version'];209 }210 if (array_key_exists('aliases', $installed['versions'][$packageName])) {211 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);212 }213 if (array_key_exists('replaced', $installed['versions'][$packageName])) {214 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);215 }216 if (array_key_exists('provided', $installed['versions'][$packageName])) {217 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);218 }219 220 return implode(' || ', $ranges);221 }222 223 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');224 }225 226 227 228 229 230 public static function getVersion($packageName)231 {232 foreach (self::getInstalled() as $installed) {233 if (!isset($installed['versions'][$packageName])) {234 continue;235 }236 237 if (!isset($installed['versions'][$packageName]['version'])) {238 return null;239 }240 241 return $installed['versions'][$packageName]['version'];242 }243 244 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');245 }246 247 248 249 250 251 public static function getPrettyVersion($packageName)252 {253 foreach (self::getInstalled() as $installed) {254 if (!isset($installed['versions'][$packageName])) {255 continue;256 }257 258 if (!isset($installed['versions'][$packageName]['pretty_version'])) {259 return null;260 }261 262 return $installed['versions'][$packageName]['pretty_version'];263 }264 265 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');266 }267 268 269 270 271 272 public static function getReference($packageName)273 {274 foreach (self::getInstalled() as $installed) {275 if (!isset($installed['versions'][$packageName])) {276 continue;277 }278 279 if (!isset($installed['versions'][$packageName]['reference'])) {280 return null;281 }282 283 return $installed['versions'][$packageName]['reference'];284 }285 286 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');287 }288 289 290 291 292 293 public static function getRootPackage()294 {295 $installed = self::getInstalled();296 297 return $installed[0]['root'];298 }299 300 301 302 303 304 305 306 public static function getRawData()307 {308 return self::$installed;309 }310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 public static function reload($data)330 {331 self::$installed = $data;332 self::$installedByVendor = array();333 }334 335 336 337 338 private static function getInstalled()339 {340 if (null === self::$canGetVendors) {341 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');342 }343 344 $installed = array();345 346 if (self::$canGetVendors) {347 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {348 if (isset(self::$installedByVendor[$vendorDir])) {349 $installed[] = self::$installedByVendor[$vendorDir];350 } elseif (is_file($vendorDir.'/composer/installed.php')) {351 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';352 }353 }354 }355 356 $installed[] = self::$installed;357 358 return $installed;359 }360 } -
ownerrez/trunk/lib/composer/autoload_real.php
r2492370 r2632279 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 32993f4f10380a055df9a453a342ebf15 class ComposerAutoloaderInitb2c63143273ca805b250984dbfb91745 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 32993f4f10380a055df9a453a342ebf1', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitb2c63143273ca805b250984dbfb91745', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 32993f4f10380a055df9a453a342ebf1', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitb2c63143273ca805b250984dbfb91745', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInitb2c63143273ca805b250984dbfb91745::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; … … 54 54 55 55 if ($useStaticLoader) { 56 $includeFiles = Composer\Autoload\ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::$files;56 $includeFiles = Composer\Autoload\ComposerStaticInitb2c63143273ca805b250984dbfb91745::$files; 57 57 } else { 58 58 $includeFiles = require __DIR__ . '/autoload_files.php'; 59 59 } 60 60 foreach ($includeFiles as $fileIdentifier => $file) { 61 composerRequire 32993f4f10380a055df9a453a342ebf1($fileIdentifier, $file);61 composerRequireb2c63143273ca805b250984dbfb91745($fileIdentifier, $file); 62 62 } 63 63 … … 66 66 } 67 67 68 function composerRequire 32993f4f10380a055df9a453a342ebf1($fileIdentifier, $file)68 function composerRequireb2c63143273ca805b250984dbfb91745($fileIdentifier, $file) 69 69 { 70 70 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
ownerrez/trunk/lib/composer/autoload_static.php
r2492370 r2632279 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 32993f4f10380a055df9a453a342ebf17 class ComposerStaticInitb2c63143273ca805b250984dbfb91745 8 8 { 9 9 public static $files = array ( … … 76 76 { 77 77 return \Closure::bind(function () use ($loader) { 78 $loader->prefixLengthsPsr4 = ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::$prefixLengthsPsr4;79 $loader->prefixDirsPsr4 = ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::$prefixDirsPsr4;80 $loader->classMap = ComposerStaticInit 32993f4f10380a055df9a453a342ebf1::$classMap;78 $loader->prefixLengthsPsr4 = ComposerStaticInitb2c63143273ca805b250984dbfb91745::$prefixLengthsPsr4; 79 $loader->prefixDirsPsr4 = ComposerStaticInitb2c63143273ca805b250984dbfb91745::$prefixDirsPsr4; 80 $loader->classMap = ComposerStaticInitb2c63143273ca805b250984dbfb91745::$classMap; 81 81 82 82 }, null, ClassLoader::class); -
ownerrez/trunk/lib/composer/installed.php
r2492370 r2632279 1 <?php return array ( 2 'root' => 3 array ( 4 'pretty_version' => 'v1.1.6', 5 'version' => '1.1.6.0', 6 'aliases' => 7 array ( 1 <?php return array( 2 'root' => array( 3 'pretty_version' => 'v1.1.9', 4 'version' => '1.1.9.0', 5 'type' => 'wordpress-plugin', 6 'install_path' => __DIR__ . '/../../../', 7 'aliases' => array(), 8 'reference' => '9a913e03f1939826e93b1da4755993874c9e79f9', 9 'name' => 'ownerrez/orez-wp', 10 'dev' => true, 8 11 ), 9 'reference' => 'd3cc35419e0abe1c8bd7560755a3660d7ea23ce1', 10 'name' => 'ownerrez/orez-wp', 11 ), 12 'versions' => 13 array ( 14 'guzzlehttp/guzzle' => 15 array ( 16 'pretty_version' => '7.2.0', 17 'version' => '7.2.0.0', 18 'aliases' => 19 array ( 20 ), 21 'reference' => '0aa74dfb41ae110835923ef10a9d803a22d50e79', 12 'versions' => array( 13 'guzzlehttp/guzzle' => array( 14 'pretty_version' => '7.2.0', 15 'version' => '7.2.0.0', 16 'type' => 'library', 17 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 18 'aliases' => array(), 19 'reference' => '0aa74dfb41ae110835923ef10a9d803a22d50e79', 20 'dev_requirement' => false, 21 ), 22 'guzzlehttp/promises' => array( 23 'pretty_version' => '1.4.0', 24 'version' => '1.4.0.0', 25 'type' => 'library', 26 'install_path' => __DIR__ . '/../guzzlehttp/promises', 27 'aliases' => array(), 28 'reference' => '60d379c243457e073cff02bc323a2a86cb355631', 29 'dev_requirement' => false, 30 ), 31 'guzzlehttp/psr7' => array( 32 'pretty_version' => '1.7.0', 33 'version' => '1.7.0.0', 34 'type' => 'library', 35 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 36 'aliases' => array(), 37 'reference' => '53330f47520498c0ae1f61f7e2c90f55690c06a3', 38 'dev_requirement' => false, 39 ), 40 'ownerrez/orez-api' => array( 41 'pretty_version' => '1.0.5', 42 'version' => '1.0.5.0', 43 'type' => 'library', 44 'install_path' => __DIR__ . '/../ownerrez/orez-api', 45 'aliases' => array(), 46 'reference' => '7b103b412eb359848cbde50bfc3c8b18a898b461', 47 'dev_requirement' => false, 48 ), 49 'ownerrez/orez-wp' => array( 50 'pretty_version' => 'v1.1.9', 51 'version' => '1.1.9.0', 52 'type' => 'wordpress-plugin', 53 'install_path' => __DIR__ . '/../../../', 54 'aliases' => array(), 55 'reference' => '9a913e03f1939826e93b1da4755993874c9e79f9', 56 'dev_requirement' => false, 57 ), 58 'psr/http-client' => array( 59 'pretty_version' => '1.0.1', 60 'version' => '1.0.1.0', 61 'type' => 'library', 62 'install_path' => __DIR__ . '/../psr/http-client', 63 'aliases' => array(), 64 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', 65 'dev_requirement' => false, 66 ), 67 'psr/http-client-implementation' => array( 68 'dev_requirement' => false, 69 'provided' => array( 70 0 => '1.0', 71 ), 72 ), 73 'psr/http-message' => array( 74 'pretty_version' => '1.0.1', 75 'version' => '1.0.1.0', 76 'type' => 'library', 77 'install_path' => __DIR__ . '/../psr/http-message', 78 'aliases' => array(), 79 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', 80 'dev_requirement' => false, 81 ), 82 'psr/http-message-implementation' => array( 83 'dev_requirement' => false, 84 'provided' => array( 85 0 => '1.0', 86 ), 87 ), 88 'ralouphie/getallheaders' => array( 89 'pretty_version' => '3.0.3', 90 'version' => '3.0.3.0', 91 'type' => 'library', 92 'install_path' => __DIR__ . '/../ralouphie/getallheaders', 93 'aliases' => array(), 94 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 95 'dev_requirement' => false, 96 ), 22 97 ), 23 'guzzlehttp/promises' =>24 array (25 'pretty_version' => '1.4.0',26 'version' => '1.4.0.0',27 'aliases' =>28 array (29 ),30 'reference' => '60d379c243457e073cff02bc323a2a86cb355631',31 ),32 'guzzlehttp/psr7' =>33 array (34 'pretty_version' => '1.7.0',35 'version' => '1.7.0.0',36 'aliases' =>37 array (38 ),39 'reference' => '53330f47520498c0ae1f61f7e2c90f55690c06a3',40 ),41 'ownerrez/orez-api' =>42 array (43 'pretty_version' => '1.0.5',44 'version' => '1.0.5.0',45 'aliases' =>46 array (47 ),48 'reference' => '7b103b412eb359848cbde50bfc3c8b18a898b461',49 ),50 'ownerrez/orez-wp' =>51 array (52 'pretty_version' => 'v1.1.6',53 'version' => '1.1.6.0',54 'aliases' =>55 array (56 ),57 'reference' => 'd3cc35419e0abe1c8bd7560755a3660d7ea23ce1',58 ),59 'psr/http-client' =>60 array (61 'pretty_version' => '1.0.1',62 'version' => '1.0.1.0',63 'aliases' =>64 array (65 ),66 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',67 ),68 'psr/http-client-implementation' =>69 array (70 'provided' =>71 array (72 0 => '1.0',73 ),74 ),75 'psr/http-message' =>76 array (77 'pretty_version' => '1.0.1',78 'version' => '1.0.1.0',79 'aliases' =>80 array (81 ),82 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',83 ),84 'psr/http-message-implementation' =>85 array (86 'provided' =>87 array (88 0 => '1.0',89 ),90 ),91 'ralouphie/getallheaders' =>92 array (93 'pretty_version' => '3.0.3',94 'version' => '3.0.3.0',95 'aliases' =>96 array (97 ),98 'reference' => '120b605dfeb996808c31b6477290a714d356e822',99 ),100 ),101 98 ); -
ownerrez/trunk/ownerrez.php
r2492370 r2632279 17 17 * Plugin URI: https://www.ownerreservations.com/support/wordpress 18 18 * Description: The official WordPress plugin for the OwnerRez API. 19 * Version: 1.1. 619 * Version: 1.1.9 20 20 * Author: OwnerRez, Inc. 21 21 * Author URI: https://www.ownerreservations.com/ … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('OWNERREZ_VERSION', '1.1. 6');38 define('OWNERREZ_VERSION', '1.1.9'); 39 39 40 40 /** -
ownerrez/trunk/public/class-ownerrez-shortcodes.php
r2455543 r2632279 23 23 class OwnerRez_ShortCodes { 24 24 25 /**26 * The ID of this plugin.27 *28 * @since 1.0.029 * @access private30 * @var string $ownerrez The ID of this plugin.31 */32 private $ownerrez;33 34 /**35 * The version of this plugin.36 *37 * @since 1.0.038 * @access private39 * @var string $version The current version of this plugin.40 */41 private $version;25 /** 26 * The ID of this plugin. 27 * 28 * @since 1.0.0 29 * @access private 30 * @var string $ownerrez The ID of this plugin. 31 */ 32 private $ownerrez; 33 34 /** 35 * The version of this plugin. 36 * 37 * @since 1.0.0 38 * @access private 39 * @var string $version The current version of this plugin. 40 */ 41 private $version; 42 42 43 43 private $api; 44 44 45 /**46 * Initialize the class and set its properties.47 *48 * @since 1.0.049 * @param string $ownerrez The name of the plugin.50 * @param string $version The version of this plugin.51 */52 public function __construct( $ownerrez, $version ) {53 54 $this->ownerrez = $ownerrez;55 $this->version = $version;45 /** 46 * Initialize the class and set its properties. 47 * 48 * @since 1.0.0 49 * @param string $ownerrez The name of the plugin. 50 * @param string $version The version of this plugin. 51 */ 52 public function __construct( $ownerrez, $version ) { 53 54 $this->ownerrez = $ownerrez; 55 $this->version = $version; 56 56 $this->api = new OwnerRez_ApiWrapper(); 57 }58 59 /**60 * Register the shortcodes for the public-facing side of the site.61 *62 * @since 1.0.063 */64 public function register_shortcodes()57 } 58 59 /** 60 * Register the shortcodes for the public-facing side of the site. 61 * 62 * @since 1.0.0 63 */ 64 public function register_shortcodes() 65 65 { 66 66 add_shortcode('ownerrez', array($this, 'shortcode')); … … 325 325 { 326 326 if (!$this->photoCarouselEnqueued) { 327 wp_enqueue_style("ownerrez-lgstyle1", "https://cdn.orez.io/hc/content/lightslider.min.css", null, $this->version); 328 wp_enqueue_style("ownerrez-lgstyle2", "https://cdn.orez.io/hc/content/lightgallery.min.css", null, $this->version); 327 wp_enqueue_style("ownerrez-lgstyle", "https://cdn.orez.io/hc/content/lgbundle.min.css", null, $this->version); 329 328 wp_enqueue_script("ownerrez-lgscript", "https://cdn.orez.io/hc/scripts/lgbundle.min.js", array( 'jquery' ), $this->version); 329 // wp_enqueue_style("ownerrez-lgstyle", "https://hosteddev.ownerrez.com/content/lgbundle.min.css", null, $this->version); 330 // wp_enqueue_script("ownerrez-lgscript", "https://hosteddev.ownerrez.com/scripts/lgbundle.min.js", array( 'jquery' ), $this->version); 330 331 wp_enqueue_script("ownerrez-photo-carousel.js", plugins_url('/ownerrez/public/js/ownerrez-photo-carousel.js'), array( 'jquery' ), $this->version); 331 332 … … 342 343 $caption = $image->caption; 343 344 344 $sliderUl .= "<li data-thumb='" . $image->croppedUrl . "' data-src='" . $image->originalUrl . "'><img src='" . $image->largeUrl . "' data-sub-html='" . $caption . "' />"; 345 $srcUrl = $image->originalUrl; 346 $posterAttr = ""; 347 348 if (property_exists($image, "videoUrl") && !is_null($image->videoUrl)) { 349 $srcUrl = $image->videoUrl . (strpos($image->videoUrl, "?") ? "&" : "?") . 'mute=0&muted=false'; 350 $posterAttr = " data-poster='" . $image->originalUrl . "'"; 351 } 352 353 $sliderUl .= "<li data-thumb='" . $image->croppedUrl . "' data-src='" . $srcUrl . "'" . $posterAttr . "><img src='" . $image->largeUrl . "' data-sub-html='" . $caption . "' />"; 354 355 if (property_exists($image, "videoUrl") && !is_null($image->videoUrl)) { 356 $sliderUl .= '<svg viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" focusable="false" aria-labelledby="Play video" role="img" class="lg-video-play-icon"> 357 <title>Play video</title> 358 <circle cx="50%" cy="50%" r="48"></circle> 359 <polygon points="35,30 35,70 70,50"></polygon> 360 </svg>'; 361 } 345 362 346 363 if (strlen($caption) > 0) … … 350 367 } 351 368 352 $sliderUl .= "</ul>"; 369 $sliderUl .= '</ul> 370 <ul class="loading-pager"><li>Loading...</li></ul>'; 353 371 354 372 return $sliderUl; -
ownerrez/trunk/public/css/ownerrez-public.css
r2450742 r2632279 1 1 .loading-slider { 2 2 padding: 0; 3 padding-bottom: 70% /* a bit extra for the thumbs */ 4 } 5 6 .loading-slider li { 7 margin: 0; 8 padding: 0; 9 list-style: none 3 margin: 0; 4 border: 1px solid rgb(204, 204, 204); 5 box-shadow: rgb(204 204 204) 1px 1px 3px; 6 } 7 8 .loading-slider li, 9 .lightSlider li { 10 margin: 0; 11 padding: 0; 12 list-style: none; 13 line-height: 0; 14 } 15 16 ul.loading-pager { 17 margin: 0; 18 padding: 0; 19 list-style: none; 20 text-align: center; 21 height: 81px; 22 } 23 ul.loading-pager li { 24 line-height: 5; 10 25 } 11 26 … … 20 35 } 21 36 37 .loading-slider .caption, 22 38 .lightSlider .caption { 23 39 text-align: center; 24 40 position: absolute; 25 bottom: 0 px;26 left: 0 px;27 right: 0 px;41 bottom: 0; 42 left: 0; 43 right: 0; 28 44 font-size: 16px; 29 45 margin: 0; … … 32 48 padding: 5px 10px 5px 5px; 33 49 background-color: rgba(255,255,255,.8); 50 line-height: 1.2; 34 51 } 35 52 … … 190 207 margin-left: 5px; 191 208 } 209 210 .loading-slider li, 211 .lslide { 212 position: relative; 213 cursor: pointer; 214 } 215 .loading-slider li .lg-video-play-icon, 216 .lslide .lg-video-play-icon { 217 width: 150px; 218 } 219 220 .lslide:hover .lg-video-play-icon { 221 opacity: 0.9; 222 cursor: pointer; 223 } 224 225 .loading-slider li .lg-video-play-icon polygon, 226 .lslide .lg-video-play-icon polygon { 227 fill: #fcfcfc; 228 } 229 .loading-slider li .lg-video-play-icon circle, 230 .lslide .lg-video-play-icon circle { 231 fill: none; 232 stroke: #fcfcfc; 233 stroke-width: 3%; 234 } 235 .lg-video-play-button .lg-video-play-icon { 236 width: 35%; 237 left: 53%; 238 top: 48%; 239 } 240 241 .loading-slider img, 242 .lslide img { 243 min-width: 100%; 244 } -
ownerrez/trunk/public/js/ownerrez-photo-carousel.js
r2450742 r2632279 1 1 jQuery(".ownerrez-photo-carousel").each(function() { 2 var div = jQuery(this);3 div.lightSlider({2 var loadingPager = jQuery(this).nextAll("ul.loading-pager");loadingPager 3 jQuery(this).lightSlider({ 4 4 gallery: true, 5 5 item: 1, … … 14 14 mode: 'fade', 15 15 onSliderLoad: function (el) { 16 el.lightGallery({ 16 loadingPager.remove(); 17 lightGallery(el.get(0), { 18 licenseKey: "5CD6B56C-064145F1-A29A5203-5655C26F", 17 19 selector: '.ownerrez-photo-carousel .lslide', 18 preload: 4 20 preload: 4, 21 plugins: [lgVideo,lgThumbnail], 22 loadYouTubeThumbnail: false, 23 gotoNextSlideOnVideoEnd: false, 24 youTubePlayerParams: { 25 modestbranding: 1, 26 iv_load_policy: 3 27 } 19 28 }); 20 29 }, -
ownerrez/trunk/readme.txt
r2492370 r2632279 4 4 Requires at least: 5.4 5 5 Tested up to: 5.7 6 Stable tag: 1.1. 66 Stable tag: 1.1.9 7 7 License: MIT 8 8 License URI: https://github.com/ownerrez/orez-wp/blob/master/LICENSE … … 33 33 34 34 == Changelog == 35 = 1.1.9 = 36 - Added video support to photo carousel. 37 38 = 1.1.6 = 39 - Add support for WordPress 5.7 40 - Add support for PHP 8 41 35 42 = 1.1.5 = 36 - Upgrade to orez-api version 1.0.4: Now validates integer quote properties and errors for invalid.43 - Upgraded to orez-api version 1.0.4: Now validates integer quote properties and errors for invalid. 37 44 38 45 = 1.1.0 =
Note: See TracChangeset
for help on using the changeset viewer.