Plugin Directory

Changeset 2620788


Ignore:
Timestamp:
10/27/2021 12:42:16 PM (4 years ago)
Author:
ecomailcz
Message:

Update to version 1.0.3

Location:
ecomail
Files:
2 deleted
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ecomail/tags/1.0.3/ecomail.php

    r2541828 r2620788  
    55 * Plugin Name:       Ecomail
    66 * Description:       Official Ecomail integration for WordPress and WooCommerce
    7  * Version:           1.0.2
     7 * Version:           1.0.3
    88 * Requires PHP:      7.3.0
    99 * Requires at least: 5.3.0
  • ecomail/tags/1.0.3/readme.txt

    r2541828 r2620788  
    66Tested up to: 5.7
    77Requires PHP: 7.3
    8 Stable tag: 1.0.2
     8Stable tag: 1.0.3
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3939
    4040== Changelog ==
     41= 1.0.3 =
     42* Fix fatal error when session does not exist
    4143
    4244= 1.0.2 =
  • ecomail/tags/1.0.3/src/Plugin.php

    r2541828 r2620788  
    2222class Plugin extends AbstractPlugin {
    2323    /** Plugin version */
    24     public const VERSION = '1.0.2';
     24    public const VERSION = '1.0.3';
    2525
    2626    /** Plugin slug name */
  • ecomail/tags/1.0.3/src/WooCommerce.php

    r2541789 r2620788  
    118118     */
    119119    public function set_cart_tracking_data() {
    120         if ( ! WC()->session->get( 'ecomail_update_cart' ) ) {
     120        if ( empty(WC()->session) || ! WC()->session->get( 'ecomail_update_cart' ) ) {
    121121            return;
    122122        }
  • ecomail/tags/1.0.3/vendor/autoload.php

    r2541828 r2620788  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitb953ccc0f97424d471bb6b2a8ea26e29::getLoader();
     7return ComposerAutoloaderInit49a17f76807aba4f688c98c753ab31a2::getLoader();
  • ecomail/tags/1.0.3/vendor/composer/ClassLoader.php

    r2541789 r2620788  
    4343class ClassLoader
    4444{
     45    /** @var ?string */
    4546    private $vendorDir;
    4647
    4748    // PSR-4
     49    /**
     50     * @var array[]
     51     * @psalm-var array<string, array<string, int>>
     52     */
    4853    private $prefixLengthsPsr4 = array();
     54    /**
     55     * @var array[]
     56     * @psalm-var array<string, array<int, string>>
     57     */
    4958    private $prefixDirsPsr4 = array();
     59    /**
     60     * @var array[]
     61     * @psalm-var array<string, string>
     62     */
    5063    private $fallbackDirsPsr4 = array();
    5164
    5265    // PSR-0
     66    /**
     67     * @var array[]
     68     * @psalm-var array<string, array<string, string[]>>
     69     */
    5370    private $prefixesPsr0 = array();
     71    /**
     72     * @var array[]
     73     * @psalm-var array<string, string>
     74     */
    5475    private $fallbackDirsPsr0 = array();
    5576
     77    /** @var bool */
    5678    private $useIncludePath = false;
     79
     80    /**
     81     * @var string[]
     82     * @psalm-var array<string, string>
     83     */
    5784    private $classMap = array();
     85
     86    /** @var bool */
    5887    private $classMapAuthoritative = false;
     88
     89    /**
     90     * @var bool[]
     91     * @psalm-var array<string, bool>
     92     */
    5993    private $missingClasses = array();
     94
     95    /** @var ?string */
    6096    private $apcuPrefix;
    6197
     98    /**
     99     * @var self[]
     100     */
    62101    private static $registeredLoaders = array();
    63102
     103    /**
     104     * @param ?string $vendorDir
     105     */
    64106    public function __construct($vendorDir = null)
    65107    {
     
    67109    }
    68110
     111    /**
     112     * @return string[]
     113     */
    69114    public function getPrefixes()
    70115    {
     
    76121    }
    77122
     123    /**
     124     * @return array[]
     125     * @psalm-return array<string, array<int, string>>
     126     */
    78127    public function getPrefixesPsr4()
    79128    {
     
    81130    }
    82131
     132    /**
     133     * @return array[]
     134     * @psalm-return array<string, string>
     135     */
    83136    public function getFallbackDirs()
    84137    {
     
    86139    }
    87140
     141    /**
     142     * @return array[]
     143     * @psalm-return array<string, string>
     144     */
    88145    public function getFallbackDirsPsr4()
    89146    {
     
    91148    }
    92149
     150    /**
     151     * @return string[] Array of classname => path
     152     * @psalm-var array<string, string>
     153     */
    93154    public function getClassMap()
    94155    {
     
    97158
    98159    /**
    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
    100164     */
    101165    public function addClassMap(array $classMap)
     
    112176     * appending or prepending to the ones previously set for this prefix.
    113177     *
    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
    117183     */
    118184    public function add($prefix, $paths, $prepend = false)
     
    157223     * appending or prepending to the ones previously set for this namespace.
    158224     *
    159      * @param string       $prefix  The prefix/namespace, with trailing '\\'
    160      * @param array|string $paths   The PSR-4 base directories
    161      * @param bool         $prepend Whether to prepend the directories
     225     * @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
    162228     *
    163229     * @throws \InvalidArgumentException
     230     *
     231     * @return void
    164232     */
    165233    public function addPsr4($prefix, $paths, $prepend = false)
     
    205273     * replacing any others previously set for this prefix.
    206274     *
    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
    209279     */
    210280    public function set($prefix, $paths)
     
    221291     * replacing any others previously set for this namespace.
    222292     *
    223      * @param string       $prefix The prefix/namespace, with trailing '\\'
    224      * @param array|string $paths  The PSR-4 base directories
     293     * @param string          $prefix The prefix/namespace, with trailing '\\'
     294     * @param string[]|string $paths  The PSR-4 base directories
    225295     *
    226296     * @throws \InvalidArgumentException
     297     *
     298     * @return void
    227299     */
    228300    public function setPsr4($prefix, $paths)
     
    244316     *
    245317     * @param bool $useIncludePath
     318     *
     319     * @return void
    246320     */
    247321    public function setUseIncludePath($useIncludePath)
     
    266340     *
    267341     * @param bool $classMapAuthoritative
     342     *
     343     * @return void
    268344     */
    269345    public function setClassMapAuthoritative($classMapAuthoritative)
     
    286362     *
    287363     * @param string|null $apcuPrefix
     364     *
     365     * @return void
    288366     */
    289367    public function setApcuPrefix($apcuPrefix)
     
    306384     *
    307385     * @param bool $prepend Whether to prepend the autoloader or not
     386     *
     387     * @return void
    308388     */
    309389    public function register($prepend = false)
     
    325405    /**
    326406     * Unregisters this instance as an autoloader.
     407     *
     408     * @return void
    327409     */
    328410    public function unregister()
     
    339421     *
    340422     * @param  string    $class The name of the class
    341      * @return bool|null True if loaded, null otherwise
     423     * @return true|null True if loaded, null otherwise
    342424     */
    343425    public function loadClass($class)
     
    348430            return true;
    349431        }
     432
     433        return null;
    350434    }
    351435
     
    402486    }
    403487
     488    /**
     489     * @param  string       $class
     490     * @param  string       $ext
     491     * @return string|false
     492     */
    404493    private function findFileWithExtension($class, $ext)
    405494    {
     
    473562 *
    474563 * Prevents access to $this/self from included files.
     564 *
     565 * @param  string $file
     566 * @return void
     567 * @private
    475568 */
    476569function includeFile($file)
  • ecomail/tags/1.0.3/vendor/composer/InstalledVersions.php

    r2541828 r2620788  
    11<?php
    22
    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 */
    1212
    1313namespace Composer;
     
    1616use Composer\Semver\VersionParser;
    1717
    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 */
    2525class InstalledVersions
    2626{
    27 private static $installed = array (
    28   'root' =>
    29   array (
    30     'pretty_version' => '1.0.2',
    31     'version' => '1.0.2.0',
    32     'aliases' =>
    33     array (
    34     ),
    35     'reference' => '8e6835545fee8bb3b472d412be1f2b4719cc10ab',
    36     'name' => 'ecomailcz/ecomail-woocommerce',
    37   ),
    38   'versions' =>
    39   array (
    40     'ecomailcz/ecomail-woocommerce' =>
    41     array (
    42       'pretty_version' => '1.0.2',
    43       'version' => '1.0.2.0',
    44       'aliases' =>
    45       array (
    46       ),
    47       'reference' => '8e6835545fee8bb3b472d412be1f2b4719cc10ab',
    48     ),
    49   ),
    50 );
    51 private static $canGetVendors;
    52 private static $installedByVendor = array();
    53 
    54 
    55 
    56 
    57 
    58 
    59 
    60 public static function getInstalledPackages()
    61 {
    62 $packages = array();
    63 foreach (self::getInstalled() as $installed) {
    64 $packages[] = array_keys($installed['versions']);
     27    private static $installed;
     28    private static $canGetVendors;
     29    private static $installedByVendor = array();
     30
     31    /**
     32     * Returns a list of all package names which are present, either by being installed, replaced or provided
     33     *
     34     * @return string[]
     35     * @psalm-return list<string>
     36     */
     37    public static function getInstalledPackages()
     38    {
     39        $packages = array();
     40        foreach (self::getInstalled() as $installed) {
     41            $packages[] = array_keys($installed['versions']);
     42        }
     43
     44        if (1 === \count($packages)) {
     45            return $packages[0];
     46        }
     47
     48        return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
     49    }
     50
     51    /**
     52     * Returns a list of all package names with a specific type e.g. 'library'
     53     *
     54     * @param  string   $type
     55     * @return string[]
     56     * @psalm-return list<string>
     57     */
     58    public static function getInstalledPackagesByType($type)
     59    {
     60        $packagesByType = array();
     61
     62        foreach (self::getInstalled() as $installed) {
     63            foreach ($installed['versions'] as $name => $package) {
     64                if (isset($package['type']) && $package['type'] === $type) {
     65                    $packagesByType[] = $name;
     66                }
     67            }
     68        }
     69
     70        return $packagesByType;
     71    }
     72
     73    /**
     74     * Checks whether the given package is installed
     75     *
     76     * This also returns true if the package name is provided or replaced by another package
     77     *
     78     * @param  string $packageName
     79     * @param  bool   $includeDevRequirements
     80     * @return bool
     81     */
     82    public static function isInstalled($packageName, $includeDevRequirements = true)
     83    {
     84        foreach (self::getInstalled() as $installed) {
     85            if (isset($installed['versions'][$packageName])) {
     86                return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     87            }
     88        }
     89
     90        return false;
     91    }
     92
     93    /**
     94     * Checks whether the given package satisfies a version constraint
     95     *
     96     * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
     97     *
     98     *   Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
     99     *
     100     * @param  VersionParser $parser      Install composer/semver to have access to this class and functionality
     101     * @param  string        $packageName
     102     * @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
     103     * @return bool
     104     */
     105    public static function satisfies(VersionParser $parser, $packageName, $constraint)
     106    {
     107        $constraint = $parser->parseConstraints($constraint);
     108        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
     109
     110        return $provided->matches($constraint);
     111    }
     112
     113    /**
     114     * Returns a version constraint representing all the range(s) which are installed for a given package
     115     *
     116     * It is easier to use this via isInstalled() with the $constraint argument if you need to check
     117     * whether a given version of a package is installed, and not just whether it exists
     118     *
     119     * @param  string $packageName
     120     * @return string Version constraint usable with composer/semver
     121     */
     122    public static function getVersionRanges($packageName)
     123    {
     124        foreach (self::getInstalled() as $installed) {
     125            if (!isset($installed['versions'][$packageName])) {
     126                continue;
     127            }
     128
     129            $ranges = array();
     130            if (isset($installed['versions'][$packageName]['pretty_version'])) {
     131                $ranges[] = $installed['versions'][$packageName]['pretty_version'];
     132            }
     133            if (array_key_exists('aliases', $installed['versions'][$packageName])) {
     134                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
     135            }
     136            if (array_key_exists('replaced', $installed['versions'][$packageName])) {
     137                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
     138            }
     139            if (array_key_exists('provided', $installed['versions'][$packageName])) {
     140                $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
     141            }
     142
     143            return implode(' || ', $ranges);
     144        }
     145
     146        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     147    }
     148
     149    /**
     150     * @param  string      $packageName
     151     * @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
     152     */
     153    public static function getVersion($packageName)
     154    {
     155        foreach (self::getInstalled() as $installed) {
     156            if (!isset($installed['versions'][$packageName])) {
     157                continue;
     158            }
     159
     160            if (!isset($installed['versions'][$packageName]['version'])) {
     161                return null;
     162            }
     163
     164            return $installed['versions'][$packageName]['version'];
     165        }
     166
     167        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     168    }
     169
     170    /**
     171     * @param  string      $packageName
     172     * @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
     173     */
     174    public static function getPrettyVersion($packageName)
     175    {
     176        foreach (self::getInstalled() as $installed) {
     177            if (!isset($installed['versions'][$packageName])) {
     178                continue;
     179            }
     180
     181            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
     182                return null;
     183            }
     184
     185            return $installed['versions'][$packageName]['pretty_version'];
     186        }
     187
     188        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     189    }
     190
     191    /**
     192     * @param  string      $packageName
     193     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
     194     */
     195    public static function getReference($packageName)
     196    {
     197        foreach (self::getInstalled() as $installed) {
     198            if (!isset($installed['versions'][$packageName])) {
     199                continue;
     200            }
     201
     202            if (!isset($installed['versions'][$packageName]['reference'])) {
     203                return null;
     204            }
     205
     206            return $installed['versions'][$packageName]['reference'];
     207        }
     208
     209        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     210    }
     211
     212    /**
     213     * @param  string      $packageName
     214     * @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.
     215     */
     216    public static function getInstallPath($packageName)
     217    {
     218        foreach (self::getInstalled() as $installed) {
     219            if (!isset($installed['versions'][$packageName])) {
     220                continue;
     221            }
     222
     223            return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
     224        }
     225
     226        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     227    }
     228
     229    /**
     230     * @return array
     231     * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
     232     */
     233    public static function getRootPackage()
     234    {
     235        $installed = self::getInstalled();
     236
     237        return $installed[0]['root'];
     238    }
     239
     240    /**
     241     * Returns the raw installed.php data for custom implementations
     242     *
     243     * @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.
     244     * @return array[]
     245     * @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}>}
     246     */
     247    public static function getRawData()
     248    {
     249        @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);
     250
     251        if (null === self::$installed) {
     252            // only require the installed.php file if this file is loaded from its dumped location,
     253            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     254            if (substr(__DIR__, -8, 1) !== 'C') {
     255                self::$installed = include __DIR__ . '/installed.php';
     256            } else {
     257                self::$installed = array();
     258            }
     259        }
     260
     261        return self::$installed;
     262    }
     263
     264    /**
     265     * Returns the raw data of all installed.php which are currently loaded for custom implementations
     266     *
     267     * @return array[]
     268     * @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}>}>
     269     */
     270    public static function getAllRawData()
     271    {
     272        return self::getInstalled();
     273    }
     274
     275    /**
     276     * Lets you reload the static array from another file
     277     *
     278     * This is only useful for complex integrations in which a project needs to use
     279     * this class but then also needs to execute another project's autoloader in process,
     280     * and wants to ensure both projects have access to their version of installed.php.
     281     *
     282     * A typical case would be PHPUnit, where it would need to make sure it reads all
     283     * the data it needs from this class, then call reload() with
     284     * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
     285     * the project in which it runs can then also use this class safely, without
     286     * interference between PHPUnit's dependencies and the project's dependencies.
     287     *
     288     * @param  array[] $data A vendor/composer/installed.php data set
     289     * @return void
     290     *
     291     * @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
     292     */
     293    public static function reload($data)
     294    {
     295        self::$installed = $data;
     296        self::$installedByVendor = array();
     297    }
     298
     299    /**
     300     * @return array[]
     301     * @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}>}>
     302     */
     303    private static function getInstalled()
     304    {
     305        if (null === self::$canGetVendors) {
     306            self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
     307        }
     308
     309        $installed = array();
     310
     311        if (self::$canGetVendors) {
     312            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     313                if (isset(self::$installedByVendor[$vendorDir])) {
     314                    $installed[] = self::$installedByVendor[$vendorDir];
     315                } elseif (is_file($vendorDir.'/composer/installed.php')) {
     316                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
     317                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
     318                        self::$installed = $installed[count($installed) - 1];
     319                    }
     320                }
     321            }
     322        }
     323
     324        if (null === self::$installed) {
     325            // only require the installed.php file if this file is loaded from its dumped location,
     326            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     327            if (substr(__DIR__, -8, 1) !== 'C') {
     328                self::$installed = require __DIR__ . '/installed.php';
     329            } else {
     330                self::$installed = array();
     331            }
     332        }
     333        $installed[] = self::$installed;
     334
     335        return $installed;
     336    }
    65337}
    66 
    67 if (1 === \count($packages)) {
    68 return $packages[0];
    69 }
    70 
    71 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
    72 }
    73 
    74 
    75 
    76 
    77 
    78 
    79 
    80 
    81 
    82 public static function isInstalled($packageName)
    83 {
    84 foreach (self::getInstalled() as $installed) {
    85 if (isset($installed['versions'][$packageName])) {
    86 return true;
    87 }
    88 }
    89 
    90 return false;
    91 }
    92 
    93 
    94 
    95 
    96 
    97 
    98 
    99 
    100 
    101 
    102 
    103 
    104 
    105 
    106 public static function satisfies(VersionParser $parser, $packageName, $constraint)
    107 {
    108 $constraint = $parser->parseConstraints($constraint);
    109 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    110 
    111 return $provided->matches($constraint);
    112 }
    113 
    114 
    115 
    116 
    117 
    118 
    119 
    120 
    121 
    122 
    123 public static function getVersionRanges($packageName)
    124 {
    125 foreach (self::getInstalled() as $installed) {
    126 if (!isset($installed['versions'][$packageName])) {
    127 continue;
    128 }
    129 
    130 $ranges = array();
    131 if (isset($installed['versions'][$packageName]['pretty_version'])) {
    132 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
    133 }
    134 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
    135 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
    136 }
    137 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
    138 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
    139 }
    140 if (array_key_exists('provided', $installed['versions'][$packageName])) {
    141 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
    142 }
    143 
    144 return implode(' || ', $ranges);
    145 }
    146 
    147 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    148 }
    149 
    150 
    151 
    152 
    153 
    154 public static function getVersion($packageName)
    155 {
    156 foreach (self::getInstalled() as $installed) {
    157 if (!isset($installed['versions'][$packageName])) {
    158 continue;
    159 }
    160 
    161 if (!isset($installed['versions'][$packageName]['version'])) {
    162 return null;
    163 }
    164 
    165 return $installed['versions'][$packageName]['version'];
    166 }
    167 
    168 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    169 }
    170 
    171 
    172 
    173 
    174 
    175 public static function getPrettyVersion($packageName)
    176 {
    177 foreach (self::getInstalled() as $installed) {
    178 if (!isset($installed['versions'][$packageName])) {
    179 continue;
    180 }
    181 
    182 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
    183 return null;
    184 }
    185 
    186 return $installed['versions'][$packageName]['pretty_version'];
    187 }
    188 
    189 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    190 }
    191 
    192 
    193 
    194 
    195 
    196 public static function getReference($packageName)
    197 {
    198 foreach (self::getInstalled() as $installed) {
    199 if (!isset($installed['versions'][$packageName])) {
    200 continue;
    201 }
    202 
    203 if (!isset($installed['versions'][$packageName]['reference'])) {
    204 return null;
    205 }
    206 
    207 return $installed['versions'][$packageName]['reference'];
    208 }
    209 
    210 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    211 }
    212 
    213 
    214 
    215 
    216 
    217 public static function getRootPackage()
    218 {
    219 $installed = self::getInstalled();
    220 
    221 return $installed[0]['root'];
    222 }
    223 
    224 
    225 
    226 
    227 
    228 
    229 
    230 
    231 public static function getRawData()
    232 {
    233 @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);
    234 
    235 return self::$installed;
    236 }
    237 
    238 
    239 
    240 
    241 
    242 
    243 
    244 public static function getAllRawData()
    245 {
    246 return self::getInstalled();
    247 }
    248 
    249 
    250 
    251 
    252 
    253 
    254 
    255 
    256 
    257 
    258 
    259 
    260 
    261 
    262 
    263 
    264 
    265 
    266 
    267 public static function reload($data)
    268 {
    269 self::$installed = $data;
    270 self::$installedByVendor = array();
    271 }
    272 
    273 
    274 
    275 
    276 
    277 private static function getInstalled()
    278 {
    279 if (null === self::$canGetVendors) {
    280 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
    281 }
    282 
    283 $installed = array();
    284 
    285 if (self::$canGetVendors) {
    286 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    287 if (isset(self::$installedByVendor[$vendorDir])) {
    288 $installed[] = self::$installedByVendor[$vendorDir];
    289 } elseif (is_file($vendorDir.'/composer/installed.php')) {
    290 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    291 }
    292 }
    293 }
    294 
    295 $installed[] = self::$installed;
    296 
    297 return $installed;
    298 }
    299 }
  • ecomail/tags/1.0.3/vendor/composer/autoload_real.php

    r2541828 r2620788  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitb953ccc0f97424d471bb6b2a8ea26e29
     5class ComposerAutoloaderInit49a17f76807aba4f688c98c753ab31a2
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInitb953ccc0f97424d471bb6b2a8ea26e29', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInit49a17f76807aba4f688c98c753ab31a2', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    27         spl_autoload_unregister(array('ComposerAutoloaderInitb953ccc0f97424d471bb6b2a8ea26e29', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInit49a17f76807aba4f688c98c753ab31a2', 'loadClassLoader'));
    2828
    2929        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3131            require __DIR__ . '/autoload_static.php';
    3232
    33             call_user_func(\Composer\Autoload\ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29::getInitializer($loader));
     33            call_user_func(\Composer\Autoload\ComposerStaticInit49a17f76807aba4f688c98c753ab31a2::getInitializer($loader));
    3434        } else {
    3535            $map = require __DIR__ . '/autoload_namespaces.php';
  • ecomail/tags/1.0.3/vendor/composer/autoload_static.php

    r2541828 r2620788  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29
     7class ComposerStaticInit49a17f76807aba4f688c98c753ab31a2
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    4242    {
    4343        return \Closure::bind(function () use ($loader) {
    44             $loader->prefixLengthsPsr4 = ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29::$prefixLengthsPsr4;
    45             $loader->prefixDirsPsr4 = ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29::$prefixDirsPsr4;
    46             $loader->classMap = ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29::$classMap;
     44            $loader->prefixLengthsPsr4 = ComposerStaticInit49a17f76807aba4f688c98c753ab31a2::$prefixLengthsPsr4;
     45            $loader->prefixDirsPsr4 = ComposerStaticInit49a17f76807aba4f688c98c753ab31a2::$prefixDirsPsr4;
     46            $loader->classMap = ComposerStaticInit49a17f76807aba4f688c98c753ab31a2::$classMap;
    4747
    4848        }, null, ClassLoader::class);
  • ecomail/tags/1.0.3/vendor/composer/installed.php

    r2541828 r2620788  
    1 <?php return array (
    2   'root' =>
    3   array (
    4     'pretty_version' => '1.0.2',
    5     'version' => '1.0.2.0',
    6     'aliases' =>
    7     array (
     1<?php return array(
     2    'root' => array(
     3        'pretty_version' => '1.0.3',
     4        'version' => '1.0.3.0',
     5        'type' => 'project',
     6        'install_path' => __DIR__ . '/../../',
     7        'aliases' => array(),
     8        'reference' => '9079998d7827d5c8a30adf9239ecc021dc94dae6',
     9        'name' => 'ecomailcz/ecomail-woocommerce',
     10        'dev' => false,
    811    ),
    9     'reference' => '8e6835545fee8bb3b472d412be1f2b4719cc10ab',
    10     'name' => 'ecomailcz/ecomail-woocommerce',
    11   ),
    12   'versions' =>
    13   array (
    14     'ecomailcz/ecomail-woocommerce' =>
    15     array (
    16       'pretty_version' => '1.0.2',
    17       'version' => '1.0.2.0',
    18       'aliases' =>
    19       array (
    20       ),
    21       'reference' => '8e6835545fee8bb3b472d412be1f2b4719cc10ab',
     12    'versions' => array(
     13        'ecomailcz/ecomail-woocommerce' => array(
     14            'pretty_version' => '1.0.3',
     15            'version' => '1.0.3.0',
     16            'type' => 'project',
     17            'install_path' => __DIR__ . '/../../',
     18            'aliases' => array(),
     19            'reference' => '9079998d7827d5c8a30adf9239ecc021dc94dae6',
     20            'dev_requirement' => false,
     21        ),
    2222    ),
    23   ),
    2423);
  • ecomail/trunk/ecomail.php

    r2541828 r2620788  
    55 * Plugin Name:       Ecomail
    66 * Description:       Official Ecomail integration for WordPress and WooCommerce
    7  * Version:           1.0.2
     7 * Version:           1.0.3
    88 * Requires PHP:      7.3.0
    99 * Requires at least: 5.3.0
  • ecomail/trunk/readme.txt

    r2541828 r2620788  
    66Tested up to: 5.7
    77Requires PHP: 7.3
    8 Stable tag: 1.0.2
     8Stable tag: 1.0.3
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3939
    4040== Changelog ==
     41= 1.0.3 =
     42* Fix fatal error when session does not exist
    4143
    4244= 1.0.2 =
  • ecomail/trunk/src/Plugin.php

    r2541828 r2620788  
    2222class Plugin extends AbstractPlugin {
    2323    /** Plugin version */
    24     public const VERSION = '1.0.2';
     24    public const VERSION = '1.0.3';
    2525
    2626    /** Plugin slug name */
  • ecomail/trunk/src/WooCommerce.php

    r2541789 r2620788  
    118118     */
    119119    public function set_cart_tracking_data() {
    120         if ( ! WC()->session->get( 'ecomail_update_cart' ) ) {
     120        if ( empty(WC()->session) || ! WC()->session->get( 'ecomail_update_cart' ) ) {
    121121            return;
    122122        }
  • ecomail/trunk/vendor/autoload.php

    r2541828 r2620788  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitb953ccc0f97424d471bb6b2a8ea26e29::getLoader();
     7return ComposerAutoloaderInit49a17f76807aba4f688c98c753ab31a2::getLoader();
  • ecomail/trunk/vendor/composer/ClassLoader.php

    r2541789 r2620788  
    4343class ClassLoader
    4444{
     45    /** @var ?string */
    4546    private $vendorDir;
    4647
    4748    // PSR-4
     49    /**
     50     * @var array[]
     51     * @psalm-var array<string, array<string, int>>
     52     */
    4853    private $prefixLengthsPsr4 = array();
     54    /**
     55     * @var array[]
     56     * @psalm-var array<string, array<int, string>>
     57     */
    4958    private $prefixDirsPsr4 = array();
     59    /**
     60     * @var array[]
     61     * @psalm-var array<string, string>
     62     */
    5063    private $fallbackDirsPsr4 = array();
    5164
    5265    // PSR-0
     66    /**
     67     * @var array[]
     68     * @psalm-var array<string, array<string, string[]>>
     69     */
    5370    private $prefixesPsr0 = array();
     71    /**
     72     * @var array[]
     73     * @psalm-var array<string, string>
     74     */
    5475    private $fallbackDirsPsr0 = array();
    5576
     77    /** @var bool */
    5678    private $useIncludePath = false;
     79
     80    /**
     81     * @var string[]
     82     * @psalm-var array<string, string>
     83     */
    5784    private $classMap = array();
     85
     86    /** @var bool */
    5887    private $classMapAuthoritative = false;
     88
     89    /**
     90     * @var bool[]
     91     * @psalm-var array<string, bool>
     92     */
    5993    private $missingClasses = array();
     94
     95    /** @var ?string */
    6096    private $apcuPrefix;
    6197
     98    /**
     99     * @var self[]
     100     */
    62101    private static $registeredLoaders = array();
    63102
     103    /**
     104     * @param ?string $vendorDir
     105     */
    64106    public function __construct($vendorDir = null)
    65107    {
     
    67109    }
    68110
     111    /**
     112     * @return string[]
     113     */
    69114    public function getPrefixes()
    70115    {
     
    76121    }
    77122
     123    /**
     124     * @return array[]
     125     * @psalm-return array<string, array<int, string>>
     126     */
    78127    public function getPrefixesPsr4()
    79128    {
     
    81130    }
    82131
     132    /**
     133     * @return array[]
     134     * @psalm-return array<string, string>
     135     */
    83136    public function getFallbackDirs()
    84137    {
     
    86139    }
    87140
     141    /**
     142     * @return array[]
     143     * @psalm-return array<string, string>
     144     */
    88145    public function getFallbackDirsPsr4()
    89146    {
     
    91148    }
    92149
     150    /**
     151     * @return string[] Array of classname => path
     152     * @psalm-var array<string, string>
     153     */
    93154    public function getClassMap()
    94155    {
     
    97158
    98159    /**
    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
    100164     */
    101165    public function addClassMap(array $classMap)
     
    112176     * appending or prepending to the ones previously set for this prefix.
    113177     *
    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
    117183     */
    118184    public function add($prefix, $paths, $prepend = false)
     
    157223     * appending or prepending to the ones previously set for this namespace.
    158224     *
    159      * @param string       $prefix  The prefix/namespace, with trailing '\\'
    160      * @param array|string $paths   The PSR-4 base directories
    161      * @param bool         $prepend Whether to prepend the directories
     225     * @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
    162228     *
    163229     * @throws \InvalidArgumentException
     230     *
     231     * @return void
    164232     */
    165233    public function addPsr4($prefix, $paths, $prepend = false)
     
    205273     * replacing any others previously set for this prefix.
    206274     *
    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
    209279     */
    210280    public function set($prefix, $paths)
     
    221291     * replacing any others previously set for this namespace.
    222292     *
    223      * @param string       $prefix The prefix/namespace, with trailing '\\'
    224      * @param array|string $paths  The PSR-4 base directories
     293     * @param string          $prefix The prefix/namespace, with trailing '\\'
     294     * @param string[]|string $paths  The PSR-4 base directories
    225295     *
    226296     * @throws \InvalidArgumentException
     297     *
     298     * @return void
    227299     */
    228300    public function setPsr4($prefix, $paths)
     
    244316     *
    245317     * @param bool $useIncludePath
     318     *
     319     * @return void
    246320     */
    247321    public function setUseIncludePath($useIncludePath)
     
    266340     *
    267341     * @param bool $classMapAuthoritative
     342     *
     343     * @return void
    268344     */
    269345    public function setClassMapAuthoritative($classMapAuthoritative)
     
    286362     *
    287363     * @param string|null $apcuPrefix
     364     *
     365     * @return void
    288366     */
    289367    public function setApcuPrefix($apcuPrefix)
     
    306384     *
    307385     * @param bool $prepend Whether to prepend the autoloader or not
     386     *
     387     * @return void
    308388     */
    309389    public function register($prepend = false)
     
    325405    /**
    326406     * Unregisters this instance as an autoloader.
     407     *
     408     * @return void
    327409     */
    328410    public function unregister()
     
    339421     *
    340422     * @param  string    $class The name of the class
    341      * @return bool|null True if loaded, null otherwise
     423     * @return true|null True if loaded, null otherwise
    342424     */
    343425    public function loadClass($class)
     
    348430            return true;
    349431        }
     432
     433        return null;
    350434    }
    351435
     
    402486    }
    403487
     488    /**
     489     * @param  string       $class
     490     * @param  string       $ext
     491     * @return string|false
     492     */
    404493    private function findFileWithExtension($class, $ext)
    405494    {
     
    473562 *
    474563 * Prevents access to $this/self from included files.
     564 *
     565 * @param  string $file
     566 * @return void
     567 * @private
    475568 */
    476569function includeFile($file)
  • ecomail/trunk/vendor/composer/InstalledVersions.php

    r2541828 r2620788  
    11<?php
    22
    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 */
    1212
    1313namespace Composer;
     
    1616use Composer\Semver\VersionParser;
    1717
    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 */
    2525class InstalledVersions
    2626{
    27 private static $installed = array (
    28   'root' =>
    29   array (
    30     'pretty_version' => '1.0.2',
    31     'version' => '1.0.2.0',
    32     'aliases' =>
    33     array (
    34     ),
    35     'reference' => '8e6835545fee8bb3b472d412be1f2b4719cc10ab',
    36     'name' => 'ecomailcz/ecomail-woocommerce',
    37   ),
    38   'versions' =>
    39   array (
    40     'ecomailcz/ecomail-woocommerce' =>
    41     array (
    42       'pretty_version' => '1.0.2',
    43       'version' => '1.0.2.0',
    44       'aliases' =>
    45       array (
    46       ),
    47       'reference' => '8e6835545fee8bb3b472d412be1f2b4719cc10ab',
    48     ),
    49   ),
    50 );
    51 private static $canGetVendors;
    52 private static $installedByVendor = array();
    53 
    54 
    55 
    56 
    57 
    58 
    59 
    60 public static function getInstalledPackages()
    61 {
    62 $packages = array();
    63 foreach (self::getInstalled() as $installed) {
    64 $packages[] = array_keys($installed['versions']);
     27    private static $installed;
     28    private static $canGetVendors;
     29    private static $installedByVendor = array();
     30
     31    /**
     32     * Returns a list of all package names which are present, either by being installed, replaced or provided
     33     *
     34     * @return string[]
     35     * @psalm-return list<string>
     36     */
     37    public static function getInstalledPackages()
     38    {
     39        $packages = array();
     40        foreach (self::getInstalled() as $installed) {
     41            $packages[] = array_keys($installed['versions']);
     42        }
     43
     44        if (1 === \count($packages)) {
     45            return $packages[0];
     46        }
     47
     48        return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
     49    }
     50
     51    /**
     52     * Returns a list of all package names with a specific type e.g. 'library'
     53     *
     54     * @param  string   $type
     55     * @return string[]
     56     * @psalm-return list<string>
     57     */
     58    public static function getInstalledPackagesByType($type)
     59    {
     60        $packagesByType = array();
     61
     62        foreach (self::getInstalled() as $installed) {
     63            foreach ($installed['versions'] as $name => $package) {
     64                if (isset($package['type']) && $package['type'] === $type) {
     65                    $packagesByType[] = $name;
     66                }
     67            }
     68        }
     69
     70        return $packagesByType;
     71    }
     72
     73    /**
     74     * Checks whether the given package is installed
     75     *
     76     * This also returns true if the package name is provided or replaced by another package
     77     *
     78     * @param  string $packageName
     79     * @param  bool   $includeDevRequirements
     80     * @return bool
     81     */
     82    public static function isInstalled($packageName, $includeDevRequirements = true)
     83    {
     84        foreach (self::getInstalled() as $installed) {
     85            if (isset($installed['versions'][$packageName])) {
     86                return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     87            }
     88        }
     89
     90        return false;
     91    }
     92
     93    /**
     94     * Checks whether the given package satisfies a version constraint
     95     *
     96     * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
     97     *
     98     *   Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
     99     *
     100     * @param  VersionParser $parser      Install composer/semver to have access to this class and functionality
     101     * @param  string        $packageName
     102     * @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
     103     * @return bool
     104     */
     105    public static function satisfies(VersionParser $parser, $packageName, $constraint)
     106    {
     107        $constraint = $parser->parseConstraints($constraint);
     108        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
     109
     110        return $provided->matches($constraint);
     111    }
     112
     113    /**
     114     * Returns a version constraint representing all the range(s) which are installed for a given package
     115     *
     116     * It is easier to use this via isInstalled() with the $constraint argument if you need to check
     117     * whether a given version of a package is installed, and not just whether it exists
     118     *
     119     * @param  string $packageName
     120     * @return string Version constraint usable with composer/semver
     121     */
     122    public static function getVersionRanges($packageName)
     123    {
     124        foreach (self::getInstalled() as $installed) {
     125            if (!isset($installed['versions'][$packageName])) {
     126                continue;
     127            }
     128
     129            $ranges = array();
     130            if (isset($installed['versions'][$packageName]['pretty_version'])) {
     131                $ranges[] = $installed['versions'][$packageName]['pretty_version'];
     132            }
     133            if (array_key_exists('aliases', $installed['versions'][$packageName])) {
     134                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
     135            }
     136            if (array_key_exists('replaced', $installed['versions'][$packageName])) {
     137                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
     138            }
     139            if (array_key_exists('provided', $installed['versions'][$packageName])) {
     140                $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
     141            }
     142
     143            return implode(' || ', $ranges);
     144        }
     145
     146        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     147    }
     148
     149    /**
     150     * @param  string      $packageName
     151     * @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
     152     */
     153    public static function getVersion($packageName)
     154    {
     155        foreach (self::getInstalled() as $installed) {
     156            if (!isset($installed['versions'][$packageName])) {
     157                continue;
     158            }
     159
     160            if (!isset($installed['versions'][$packageName]['version'])) {
     161                return null;
     162            }
     163
     164            return $installed['versions'][$packageName]['version'];
     165        }
     166
     167        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     168    }
     169
     170    /**
     171     * @param  string      $packageName
     172     * @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
     173     */
     174    public static function getPrettyVersion($packageName)
     175    {
     176        foreach (self::getInstalled() as $installed) {
     177            if (!isset($installed['versions'][$packageName])) {
     178                continue;
     179            }
     180
     181            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
     182                return null;
     183            }
     184
     185            return $installed['versions'][$packageName]['pretty_version'];
     186        }
     187
     188        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     189    }
     190
     191    /**
     192     * @param  string      $packageName
     193     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
     194     */
     195    public static function getReference($packageName)
     196    {
     197        foreach (self::getInstalled() as $installed) {
     198            if (!isset($installed['versions'][$packageName])) {
     199                continue;
     200            }
     201
     202            if (!isset($installed['versions'][$packageName]['reference'])) {
     203                return null;
     204            }
     205
     206            return $installed['versions'][$packageName]['reference'];
     207        }
     208
     209        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     210    }
     211
     212    /**
     213     * @param  string      $packageName
     214     * @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.
     215     */
     216    public static function getInstallPath($packageName)
     217    {
     218        foreach (self::getInstalled() as $installed) {
     219            if (!isset($installed['versions'][$packageName])) {
     220                continue;
     221            }
     222
     223            return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
     224        }
     225
     226        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     227    }
     228
     229    /**
     230     * @return array
     231     * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
     232     */
     233    public static function getRootPackage()
     234    {
     235        $installed = self::getInstalled();
     236
     237        return $installed[0]['root'];
     238    }
     239
     240    /**
     241     * Returns the raw installed.php data for custom implementations
     242     *
     243     * @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.
     244     * @return array[]
     245     * @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}>}
     246     */
     247    public static function getRawData()
     248    {
     249        @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);
     250
     251        if (null === self::$installed) {
     252            // only require the installed.php file if this file is loaded from its dumped location,
     253            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     254            if (substr(__DIR__, -8, 1) !== 'C') {
     255                self::$installed = include __DIR__ . '/installed.php';
     256            } else {
     257                self::$installed = array();
     258            }
     259        }
     260
     261        return self::$installed;
     262    }
     263
     264    /**
     265     * Returns the raw data of all installed.php which are currently loaded for custom implementations
     266     *
     267     * @return array[]
     268     * @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}>}>
     269     */
     270    public static function getAllRawData()
     271    {
     272        return self::getInstalled();
     273    }
     274
     275    /**
     276     * Lets you reload the static array from another file
     277     *
     278     * This is only useful for complex integrations in which a project needs to use
     279     * this class but then also needs to execute another project's autoloader in process,
     280     * and wants to ensure both projects have access to their version of installed.php.
     281     *
     282     * A typical case would be PHPUnit, where it would need to make sure it reads all
     283     * the data it needs from this class, then call reload() with
     284     * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
     285     * the project in which it runs can then also use this class safely, without
     286     * interference between PHPUnit's dependencies and the project's dependencies.
     287     *
     288     * @param  array[] $data A vendor/composer/installed.php data set
     289     * @return void
     290     *
     291     * @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
     292     */
     293    public static function reload($data)
     294    {
     295        self::$installed = $data;
     296        self::$installedByVendor = array();
     297    }
     298
     299    /**
     300     * @return array[]
     301     * @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}>}>
     302     */
     303    private static function getInstalled()
     304    {
     305        if (null === self::$canGetVendors) {
     306            self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
     307        }
     308
     309        $installed = array();
     310
     311        if (self::$canGetVendors) {
     312            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     313                if (isset(self::$installedByVendor[$vendorDir])) {
     314                    $installed[] = self::$installedByVendor[$vendorDir];
     315                } elseif (is_file($vendorDir.'/composer/installed.php')) {
     316                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
     317                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
     318                        self::$installed = $installed[count($installed) - 1];
     319                    }
     320                }
     321            }
     322        }
     323
     324        if (null === self::$installed) {
     325            // only require the installed.php file if this file is loaded from its dumped location,
     326            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     327            if (substr(__DIR__, -8, 1) !== 'C') {
     328                self::$installed = require __DIR__ . '/installed.php';
     329            } else {
     330                self::$installed = array();
     331            }
     332        }
     333        $installed[] = self::$installed;
     334
     335        return $installed;
     336    }
    65337}
    66 
    67 if (1 === \count($packages)) {
    68 return $packages[0];
    69 }
    70 
    71 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
    72 }
    73 
    74 
    75 
    76 
    77 
    78 
    79 
    80 
    81 
    82 public static function isInstalled($packageName)
    83 {
    84 foreach (self::getInstalled() as $installed) {
    85 if (isset($installed['versions'][$packageName])) {
    86 return true;
    87 }
    88 }
    89 
    90 return false;
    91 }
    92 
    93 
    94 
    95 
    96 
    97 
    98 
    99 
    100 
    101 
    102 
    103 
    104 
    105 
    106 public static function satisfies(VersionParser $parser, $packageName, $constraint)
    107 {
    108 $constraint = $parser->parseConstraints($constraint);
    109 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    110 
    111 return $provided->matches($constraint);
    112 }
    113 
    114 
    115 
    116 
    117 
    118 
    119 
    120 
    121 
    122 
    123 public static function getVersionRanges($packageName)
    124 {
    125 foreach (self::getInstalled() as $installed) {
    126 if (!isset($installed['versions'][$packageName])) {
    127 continue;
    128 }
    129 
    130 $ranges = array();
    131 if (isset($installed['versions'][$packageName]['pretty_version'])) {
    132 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
    133 }
    134 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
    135 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
    136 }
    137 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
    138 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
    139 }
    140 if (array_key_exists('provided', $installed['versions'][$packageName])) {
    141 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
    142 }
    143 
    144 return implode(' || ', $ranges);
    145 }
    146 
    147 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    148 }
    149 
    150 
    151 
    152 
    153 
    154 public static function getVersion($packageName)
    155 {
    156 foreach (self::getInstalled() as $installed) {
    157 if (!isset($installed['versions'][$packageName])) {
    158 continue;
    159 }
    160 
    161 if (!isset($installed['versions'][$packageName]['version'])) {
    162 return null;
    163 }
    164 
    165 return $installed['versions'][$packageName]['version'];
    166 }
    167 
    168 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    169 }
    170 
    171 
    172 
    173 
    174 
    175 public static function getPrettyVersion($packageName)
    176 {
    177 foreach (self::getInstalled() as $installed) {
    178 if (!isset($installed['versions'][$packageName])) {
    179 continue;
    180 }
    181 
    182 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
    183 return null;
    184 }
    185 
    186 return $installed['versions'][$packageName]['pretty_version'];
    187 }
    188 
    189 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    190 }
    191 
    192 
    193 
    194 
    195 
    196 public static function getReference($packageName)
    197 {
    198 foreach (self::getInstalled() as $installed) {
    199 if (!isset($installed['versions'][$packageName])) {
    200 continue;
    201 }
    202 
    203 if (!isset($installed['versions'][$packageName]['reference'])) {
    204 return null;
    205 }
    206 
    207 return $installed['versions'][$packageName]['reference'];
    208 }
    209 
    210 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    211 }
    212 
    213 
    214 
    215 
    216 
    217 public static function getRootPackage()
    218 {
    219 $installed = self::getInstalled();
    220 
    221 return $installed[0]['root'];
    222 }
    223 
    224 
    225 
    226 
    227 
    228 
    229 
    230 
    231 public static function getRawData()
    232 {
    233 @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);
    234 
    235 return self::$installed;
    236 }
    237 
    238 
    239 
    240 
    241 
    242 
    243 
    244 public static function getAllRawData()
    245 {
    246 return self::getInstalled();
    247 }
    248 
    249 
    250 
    251 
    252 
    253 
    254 
    255 
    256 
    257 
    258 
    259 
    260 
    261 
    262 
    263 
    264 
    265 
    266 
    267 public static function reload($data)
    268 {
    269 self::$installed = $data;
    270 self::$installedByVendor = array();
    271 }
    272 
    273 
    274 
    275 
    276 
    277 private static function getInstalled()
    278 {
    279 if (null === self::$canGetVendors) {
    280 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
    281 }
    282 
    283 $installed = array();
    284 
    285 if (self::$canGetVendors) {
    286 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    287 if (isset(self::$installedByVendor[$vendorDir])) {
    288 $installed[] = self::$installedByVendor[$vendorDir];
    289 } elseif (is_file($vendorDir.'/composer/installed.php')) {
    290 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    291 }
    292 }
    293 }
    294 
    295 $installed[] = self::$installed;
    296 
    297 return $installed;
    298 }
    299 }
  • ecomail/trunk/vendor/composer/autoload_real.php

    r2541828 r2620788  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitb953ccc0f97424d471bb6b2a8ea26e29
     5class ComposerAutoloaderInit49a17f76807aba4f688c98c753ab31a2
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInitb953ccc0f97424d471bb6b2a8ea26e29', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInit49a17f76807aba4f688c98c753ab31a2', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    27         spl_autoload_unregister(array('ComposerAutoloaderInitb953ccc0f97424d471bb6b2a8ea26e29', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInit49a17f76807aba4f688c98c753ab31a2', 'loadClassLoader'));
    2828
    2929        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3131            require __DIR__ . '/autoload_static.php';
    3232
    33             call_user_func(\Composer\Autoload\ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29::getInitializer($loader));
     33            call_user_func(\Composer\Autoload\ComposerStaticInit49a17f76807aba4f688c98c753ab31a2::getInitializer($loader));
    3434        } else {
    3535            $map = require __DIR__ . '/autoload_namespaces.php';
  • ecomail/trunk/vendor/composer/autoload_static.php

    r2541828 r2620788  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29
     7class ComposerStaticInit49a17f76807aba4f688c98c753ab31a2
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    4242    {
    4343        return \Closure::bind(function () use ($loader) {
    44             $loader->prefixLengthsPsr4 = ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29::$prefixLengthsPsr4;
    45             $loader->prefixDirsPsr4 = ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29::$prefixDirsPsr4;
    46             $loader->classMap = ComposerStaticInitb953ccc0f97424d471bb6b2a8ea26e29::$classMap;
     44            $loader->prefixLengthsPsr4 = ComposerStaticInit49a17f76807aba4f688c98c753ab31a2::$prefixLengthsPsr4;
     45            $loader->prefixDirsPsr4 = ComposerStaticInit49a17f76807aba4f688c98c753ab31a2::$prefixDirsPsr4;
     46            $loader->classMap = ComposerStaticInit49a17f76807aba4f688c98c753ab31a2::$classMap;
    4747
    4848        }, null, ClassLoader::class);
  • ecomail/trunk/vendor/composer/installed.php

    r2541828 r2620788  
    1 <?php return array (
    2   'root' =>
    3   array (
    4     'pretty_version' => '1.0.2',
    5     'version' => '1.0.2.0',
    6     'aliases' =>
    7     array (
     1<?php return array(
     2    'root' => array(
     3        'pretty_version' => '1.0.3',
     4        'version' => '1.0.3.0',
     5        'type' => 'project',
     6        'install_path' => __DIR__ . '/../../',
     7        'aliases' => array(),
     8        'reference' => '9079998d7827d5c8a30adf9239ecc021dc94dae6',
     9        'name' => 'ecomailcz/ecomail-woocommerce',
     10        'dev' => false,
    811    ),
    9     'reference' => '8e6835545fee8bb3b472d412be1f2b4719cc10ab',
    10     'name' => 'ecomailcz/ecomail-woocommerce',
    11   ),
    12   'versions' =>
    13   array (
    14     'ecomailcz/ecomail-woocommerce' =>
    15     array (
    16       'pretty_version' => '1.0.2',
    17       'version' => '1.0.2.0',
    18       'aliases' =>
    19       array (
    20       ),
    21       'reference' => '8e6835545fee8bb3b472d412be1f2b4719cc10ab',
     12    'versions' => array(
     13        'ecomailcz/ecomail-woocommerce' => array(
     14            'pretty_version' => '1.0.3',
     15            'version' => '1.0.3.0',
     16            'type' => 'project',
     17            'install_path' => __DIR__ . '/../../',
     18            'aliases' => array(),
     19            'reference' => '9079998d7827d5c8a30adf9239ecc021dc94dae6',
     20            'dev_requirement' => false,
     21        ),
    2222    ),
    23   ),
    2423);
Note: See TracChangeset for help on using the changeset viewer.