Plugin Directory

Changeset 3096954


Ignore:
Timestamp:
06/03/2024 08:07:50 PM (22 months ago)
Author:
saifulananda
Message:

Update plugin version 2.1.0

Location:
wpappsdev-pcbuilder
Files:
130 added
13 edited

Legend:

Unmodified
Added
Removed
  • wpappsdev-pcbuilder/trunk/readme.txt

    r3094855 r3096954  
    22Contributors:      saifulananda
    33Plugin Name:       WooCommerce Custom Product Builder or Configurator - Especially PC Builder Toolkit
    4 Tags:              PC builder, WooCommerce computer builder, Computer component, product builder, product configurator
     4Tags:              PC builder, product configurator, WooCommerce computer builder, Computer component, product builder
    55Author URI:        https://siananda.me/
    66Author:            Saiful Islam Ananda
    7 Requires at least: 5.0
     7Requires PHP:      7.4
     8Requires at least: 6.0
    89Tested up to:      6.5.3
    9 Version:           2.0.0
    10 Stable tag:        2.0.0
     10Version:           2.1.0
     11Stable tag:        2.1.0
    1112License:           GPLv2 or later
    1213License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    8182[youtube https://www.youtube.com/watch?v=mLDAMtF7_XQ]
    8283
     84## Privacy Policy
     85
     86WooCommerce Custom Product Builder or Configurator – Especially PC Builder Toolkit uses [Appsero](https://appsero.com) SDK to collect some telemetry data upon user's confirmation. This helps us to troubleshoot problems faster & make product improvements.
     87
     88Appsero SDK **does not gather any data by default.** The SDK only starts gathering basic telemetry data **when a user allows it via the admin notice**. We collect the data to ensure a great user experience for all our users.
     89
     90Integrating Appsero SDK **DOES NOT IMMEDIATELY** start gathering data, **without confirmation from users in any case.**
     91
     92Learn more about how [Appsero collects and uses this data](https://appsero.com/privacy-policy/).
     93
    8394== Installation ==
    8495
     
    114125== Changelog ==
    115126
     127= 2.1.0 =
     128* Added: Appsero tracker for plugin analytics.
     129
    116130= 2.0.0 =
    117131* Updated: Builder page UI.
  • wpappsdev-pcbuilder/trunk/vendor/autoload.php

    r2607896 r3096954  
    33// autoload.php @generated by Composer
    44
     5if (PHP_VERSION_ID < 50600) {
     6    if (!headers_sent()) {
     7        header('HTTP/1.1 500 Internal Server Error');
     8    }
     9    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
     10    if (!ini_get('display_errors')) {
     11        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
     12            fwrite(STDERR, $err);
     13        } elseif (!headers_sent()) {
     14            echo $err;
     15        }
     16    }
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
     21}
     22
    523require_once __DIR__ . '/composer/autoload_real.php';
    624
  • wpappsdev-pcbuilder/trunk/vendor/composer/ClassLoader.php

    r2607896 r3096954  
    4343class ClassLoader
    4444{
     45    /** @var \Closure(string):void */
     46    private static $includeFile;
     47
     48    /** @var string|null */
     49    private $vendorDir;
     50
    4551    // PSR-4
     52    /**
     53     * @var array<string, array<string, int>>
     54     */
    4655    private $prefixLengthsPsr4 = array();
     56    /**
     57     * @var array<string, list<string>>
     58     */
    4759    private $prefixDirsPsr4 = array();
     60    /**
     61     * @var list<string>
     62     */
    4863    private $fallbackDirsPsr4 = array();
    4964
    5065    // PSR-0
     66    /**
     67     * List of PSR-0 prefixes
     68     *
     69     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
     70     *
     71     * @var array<string, array<string, list<string>>>
     72     */
    5173    private $prefixesPsr0 = array();
     74    /**
     75     * @var list<string>
     76     */
    5277    private $fallbackDirsPsr0 = array();
    5378
     79    /** @var bool */
    5480    private $useIncludePath = false;
     81
     82    /**
     83     * @var array<string, string>
     84     */
    5585    private $classMap = array();
     86
     87    /** @var bool */
    5688    private $classMapAuthoritative = false;
     89
     90    /**
     91     * @var array<string, bool>
     92     */
    5793    private $missingClasses = array();
     94
     95    /** @var string|null */
    5896    private $apcuPrefix;
    5997
     98    /**
     99     * @var array<string, self>
     100     */
     101    private static $registeredLoaders = array();
     102
     103    /**
     104     * @param string|null $vendorDir
     105     */
     106    public function __construct($vendorDir = null)
     107    {
     108        $this->vendorDir = $vendorDir;
     109        self::initializeIncludeClosure();
     110    }
     111
     112    /**
     113     * @return array<string, list<string>>
     114     */
    60115    public function getPrefixes()
    61116    {
     
    67122    }
    68123
     124    /**
     125     * @return array<string, list<string>>
     126     */
    69127    public function getPrefixesPsr4()
    70128    {
     
    72130    }
    73131
     132    /**
     133     * @return list<string>
     134     */
    74135    public function getFallbackDirs()
    75136    {
     
    77138    }
    78139
     140    /**
     141     * @return list<string>
     142     */
    79143    public function getFallbackDirsPsr4()
    80144    {
     
    82146    }
    83147
     148    /**
     149     * @return array<string, string> Array of classname => path
     150     */
    84151    public function getClassMap()
    85152    {
     
    88155
    89156    /**
    90      * @param array $classMap Class to filename map
     157     * @param array<string, string> $classMap Class to filename map
     158     *
     159     * @return void
    91160     */
    92161    public function addClassMap(array $classMap)
     
    103172     * appending or prepending to the ones previously set for this prefix.
    104173     *
    105      * @param string       $prefix  The prefix
    106      * @param array|string $paths   The PSR-0 root directories
    107      * @param bool         $prepend Whether to prepend the directories
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
     177     *
     178     * @return void
    108179     */
    109180    public function add($prefix, $paths, $prepend = false)
    110181    {
     182        $paths = (array) $paths;
    111183        if (!$prefix) {
    112184            if ($prepend) {
    113185                $this->fallbackDirsPsr0 = array_merge(
    114                     (array) $paths,
     186                    $paths,
    115187                    $this->fallbackDirsPsr0
    116188                );
     
    118190                $this->fallbackDirsPsr0 = array_merge(
    119191                    $this->fallbackDirsPsr0,
    120                     (array) $paths
     192                    $paths
    121193                );
    122194            }
     
    127199        $first = $prefix[0];
    128200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    129             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    130202
    131203            return;
     
    133205        if ($prepend) {
    134206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    135                 (array) $paths,
     207                $paths,
    136208                $this->prefixesPsr0[$first][$prefix]
    137209            );
     
    139211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    140212                $this->prefixesPsr0[$first][$prefix],
    141                 (array) $paths
     213                $paths
    142214            );
    143215        }
     
    148220     * appending or prepending to the ones previously set for this namespace.
    149221     *
    150      * @param string       $prefix  The prefix/namespace, with trailing '\\'
    151      * @param array|string $paths   The PSR-4 base directories
    152      * @param bool         $prepend Whether to prepend the directories
     222     * @param string              $prefix  The prefix/namespace, with trailing '\\'
     223     * @param list<string>|string $paths   The PSR-4 base directories
     224     * @param bool                $prepend Whether to prepend the directories
    153225     *
    154226     * @throws \InvalidArgumentException
     227     *
     228     * @return void
    155229     */
    156230    public function addPsr4($prefix, $paths, $prepend = false)
    157231    {
     232        $paths = (array) $paths;
    158233        if (!$prefix) {
    159234            // Register directories for the root namespace.
    160235            if ($prepend) {
    161236                $this->fallbackDirsPsr4 = array_merge(
    162                     (array) $paths,
     237                    $paths,
    163238                    $this->fallbackDirsPsr4
    164239                );
     
    166241                $this->fallbackDirsPsr4 = array_merge(
    167242                    $this->fallbackDirsPsr4,
    168                     (array) $paths
     243                    $paths
    169244                );
    170245            }
     
    176251            }
    177252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    178             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    179254        } elseif ($prepend) {
    180255            // Prepend directories for an already registered namespace.
    181256            $this->prefixDirsPsr4[$prefix] = array_merge(
    182                 (array) $paths,
     257                $paths,
    183258                $this->prefixDirsPsr4[$prefix]
    184259            );
     
    187262            $this->prefixDirsPsr4[$prefix] = array_merge(
    188263                $this->prefixDirsPsr4[$prefix],
    189                 (array) $paths
     264                $paths
    190265            );
    191266        }
     
    196271     * replacing any others previously set for this prefix.
    197272     *
    198      * @param string       $prefix The prefix
    199      * @param array|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
     275     *
     276     * @return void
    200277     */
    201278    public function set($prefix, $paths)
     
    212289     * replacing any others previously set for this namespace.
    213290     *
    214      * @param string       $prefix The prefix/namespace, with trailing '\\'
    215      * @param array|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    216293     *
    217294     * @throws \InvalidArgumentException
     295     *
     296     * @return void
    218297     */
    219298    public function setPsr4($prefix, $paths)
     
    235314     *
    236315     * @param bool $useIncludePath
     316     *
     317     * @return void
    237318     */
    238319    public function setUseIncludePath($useIncludePath)
     
    257338     *
    258339     * @param bool $classMapAuthoritative
     340     *
     341     * @return void
    259342     */
    260343    public function setClassMapAuthoritative($classMapAuthoritative)
     
    277360     *
    278361     * @param string|null $apcuPrefix
     362     *
     363     * @return void
    279364     */
    280365    public function setApcuPrefix($apcuPrefix)
     
    297382     *
    298383     * @param bool $prepend Whether to prepend the autoloader or not
     384     *
     385     * @return void
    299386     */
    300387    public function register($prepend = false)
    301388    {
    302389        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
     390
     391        if (null === $this->vendorDir) {
     392            return;
     393        }
     394
     395        if ($prepend) {
     396            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
     397        } else {
     398            unset(self::$registeredLoaders[$this->vendorDir]);
     399            self::$registeredLoaders[$this->vendorDir] = $this;
     400        }
    303401    }
    304402
    305403    /**
    306404     * Unregisters this instance as an autoloader.
     405     *
     406     * @return void
    307407     */
    308408    public function unregister()
    309409    {
    310410        spl_autoload_unregister(array($this, 'loadClass'));
     411
     412        if (null !== $this->vendorDir) {
     413            unset(self::$registeredLoaders[$this->vendorDir]);
     414        }
    311415    }
    312416
     
    315419     *
    316420     * @param  string    $class The name of the class
    317      * @return bool|null True if loaded, null otherwise
     421     * @return true|null True if loaded, null otherwise
    318422     */
    319423    public function loadClass($class)
    320424    {
    321425        if ($file = $this->findFile($class)) {
    322             includeFile($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    323428
    324429            return true;
    325430        }
     431
     432        return null;
    326433    }
    327434
     
    368475    }
    369476
     477    /**
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
     481     */
     482    public static function getRegisteredLoaders()
     483    {
     484        return self::$registeredLoaders;
     485    }
     486
     487    /**
     488     * @param  string       $class
     489     * @param  string       $ext
     490     * @return string|false
     491     */
    370492    private function findFileWithExtension($class, $ext)
    371493    {
     
    433555        return false;
    434556    }
     557
     558    /**
     559     * @return void
     560     */
     561    private static function initializeIncludeClosure()
     562    {
     563        if (self::$includeFile !== null) {
     564            return;
     565        }
     566
     567        /**
     568         * Scope isolated include.
     569         *
     570         * Prevents access to $this/self from included files.
     571         *
     572         * @param  string $file
     573         * @return void
     574         */
     575        self::$includeFile = \Closure::bind(static function($file) {
     576            include $file;
     577        }, null, null);
     578    }
    435579}
    436 
    437 /**
    438  * Scope isolated include.
    439  *
    440  * Prevents access to $this/self from included files.
    441  */
    442 function includeFile($file)
    443 {
    444     include $file;
    445 }
  • wpappsdev-pcbuilder/trunk/vendor/composer/InstalledVersions.php

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

    r2607896 r3096954  
    33// autoload_classmap.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • wpappsdev-pcbuilder/trunk/vendor/composer/autoload_files.php

    r2607896 r3096954  
    33// autoload_files.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • wpappsdev-pcbuilder/trunk/vendor/composer/autoload_namespaces.php

    r2607896 r3096954  
    33// autoload_namespaces.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • wpappsdev-pcbuilder/trunk/vendor/composer/autoload_psr4.php

    r2607896 r3096954  
    33// autoload_psr4.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
     
    99    'WPAppsDev\\PCBU\\' => array($baseDir . '/includes'),
    1010    'WPAppsDev\\' => array($vendorDir . '/WPAppsDev'),
     11    'Appsero\\' => array($vendorDir . '/appsero/client/src'),
    1112);
  • wpappsdev-pcbuilder/trunk/vendor/composer/autoload_real.php

    r2607896 r3096954  
    2323        }
    2424
     25        require __DIR__ . '/platform_check.php';
     26
    2527        spl_autoload_register(array('ComposerAutoloaderInit5645c28ddb44a6c147bae9a9a469ff33', 'loadClassLoader'), true, true);
    26         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     28        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    2729        spl_autoload_unregister(array('ComposerAutoloaderInit5645c28ddb44a6c147bae9a9a469ff33', 'loadClassLoader'));
    2830
    29         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
    30         if ($useStaticLoader) {
    31             require __DIR__ . '/autoload_static.php';
    32 
    33             call_user_func(\Composer\Autoload\ComposerStaticInit5645c28ddb44a6c147bae9a9a469ff33::getInitializer($loader));
    34         } else {
    35             $map = require __DIR__ . '/autoload_namespaces.php';
    36             foreach ($map as $namespace => $path) {
    37                 $loader->set($namespace, $path);
    38             }
    39 
    40             $map = require __DIR__ . '/autoload_psr4.php';
    41             foreach ($map as $namespace => $path) {
    42                 $loader->setPsr4($namespace, $path);
    43             }
    44 
    45             $classMap = require __DIR__ . '/autoload_classmap.php';
    46             if ($classMap) {
    47                 $loader->addClassMap($classMap);
    48             }
    49         }
     31        require __DIR__ . '/autoload_static.php';
     32        call_user_func(\Composer\Autoload\ComposerStaticInit5645c28ddb44a6c147bae9a9a469ff33::getInitializer($loader));
    5033
    5134        $loader->register(true);
    5235
    53         if ($useStaticLoader) {
    54             $includeFiles = Composer\Autoload\ComposerStaticInit5645c28ddb44a6c147bae9a9a469ff33::$files;
    55         } else {
    56             $includeFiles = require __DIR__ . '/autoload_files.php';
    57         }
    58         foreach ($includeFiles as $fileIdentifier => $file) {
    59             composerRequire5645c28ddb44a6c147bae9a9a469ff33($fileIdentifier, $file);
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit5645c28ddb44a6c147bae9a9a469ff33::$files;
     37        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
     38            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
     39                $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
     40
     41                require $file;
     42            }
     43        }, null, null);
     44        foreach ($filesToLoad as $fileIdentifier => $file) {
     45            $requireFile($fileIdentifier, $file);
    6046        }
    6147
     
    6349    }
    6450}
    65 
    66 function composerRequire5645c28ddb44a6c147bae9a9a469ff33($fileIdentifier, $file)
    67 {
    68     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
    69         require $file;
    70 
    71         $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    72     }
    73 }
  • wpappsdev-pcbuilder/trunk/vendor/composer/autoload_static.php

    r2607896 r3096954  
    1717            'WPAppsDev\\' => 10,
    1818        ),
     19        'A' =>
     20        array (
     21            'Appsero\\' => 8,
     22        ),
    1923    );
    2024
     
    2731        array (
    2832            0 => __DIR__ . '/..' . '/WPAppsDev',
     33        ),
     34        'Appsero\\' =>
     35        array (
     36            0 => __DIR__ . '/..' . '/appsero/client/src',
    2937        ),
    3038    );
  • wpappsdev-pcbuilder/trunk/vendor/composer/installed.json

    r2607896 r3096954  
    11{
    2     "packages": [],
    3     "dev": true
     2    "packages": [
     3        {
     4            "name": "appsero/client",
     5            "version": "dev-develop",
     6            "version_normalized": "dev-develop",
     7            "source": {
     8                "type": "git",
     9                "url": "https://github.com/Appsero/client.git",
     10                "reference": "a8e02e8a5a862671f04ff00a456e2711d807a598"
     11            },
     12            "dist": {
     13                "type": "zip",
     14                "url": "https://api.github.com/repos/Appsero/client/zipball/a8e02e8a5a862671f04ff00a456e2711d807a598",
     15                "reference": "a8e02e8a5a862671f04ff00a456e2711d807a598",
     16                "shasum": ""
     17            },
     18            "require": {
     19                "php": ">=5.6"
     20            },
     21            "require-dev": {
     22                "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
     23                "phpcompatibility/phpcompatibility-wp": "dev-master",
     24                "phpunit/phpunit": "^8.5.31",
     25                "squizlabs/php_codesniffer": "^3.7",
     26                "tareq1988/wp-php-cs-fixer": "dev-master",
     27                "wp-coding-standards/wpcs": "dev-develop"
     28            },
     29            "time": "2024-01-30T08:15:23+00:00",
     30            "default-branch": true,
     31            "type": "library",
     32            "installation-source": "dist",
     33            "autoload": {
     34                "psr-4": {
     35                    "Appsero\\": "src/"
     36                }
     37            },
     38            "notification-url": "https://packagist.org/downloads/",
     39            "license": [
     40                "MIT"
     41            ],
     42            "authors": [
     43                {
     44                    "name": "Tareq Hasan",
     45                    "email": "tareq@appsero.com"
     46                }
     47            ],
     48            "description": "Appsero Client",
     49            "keywords": [
     50                "analytics",
     51                "plugin",
     52                "theme",
     53                "wordpress"
     54            ],
     55            "support": {
     56                "issues": "https://github.com/Appsero/client/issues",
     57                "source": "https://github.com/Appsero/client/tree/develop"
     58            },
     59            "install-path": "../appsero/client"
     60        }
     61    ],
     62    "dev": true,
     63    "dev-package-names": []
    464}
  • wpappsdev-pcbuilder/trunk/vendor/composer/installed.php

    r2607896 r3096954  
    1 <?php return array (
    2   'root' =>
    3   array (
    4     'pretty_version' => 'No version set (parsed as 1.0.0)',
    5     'version' => '1.0.0.0',
    6     'aliases' =>
    7     array (
     1<?php return array(
     2    'root' => array(
     3        'name' => 'siananda/wpappsdev-pcbuilder',
     4        'pretty_version' => 'dev-master',
     5        'version' => 'dev-master',
     6        'reference' => 'c91594424ac7782a84aebe79a9216ba38e16aeeb',
     7        'type' => 'wordpress-plugin',
     8        'install_path' => __DIR__ . '/../../',
     9        'aliases' => array(),
     10        'dev' => true,
    811    ),
    9     'reference' => NULL,
    10     'name' => 'siananda/wpappsdev-pcbuilder',
    11   ),
    12   'versions' =>
    13   array (
    14     'siananda/wpappsdev-pcbuilder' =>
    15     array (
    16       'pretty_version' => 'No version set (parsed as 1.0.0)',
    17       'version' => '1.0.0.0',
    18       'aliases' =>
    19       array (
    20       ),
    21       'reference' => NULL,
     12    'versions' => array(
     13        'appsero/client' => array(
     14            'pretty_version' => 'dev-develop',
     15            'version' => 'dev-develop',
     16            'reference' => 'a8e02e8a5a862671f04ff00a456e2711d807a598',
     17            'type' => 'library',
     18            'install_path' => __DIR__ . '/../appsero/client',
     19            'aliases' => array(
     20                0 => '9999999-dev',
     21            ),
     22            'dev_requirement' => false,
     23        ),
     24        'siananda/wpappsdev-pcbuilder' => array(
     25            'pretty_version' => 'dev-master',
     26            'version' => 'dev-master',
     27            'reference' => 'c91594424ac7782a84aebe79a9216ba38e16aeeb',
     28            'type' => 'wordpress-plugin',
     29            'install_path' => __DIR__ . '/../../',
     30            'aliases' => array(),
     31            'dev_requirement' => false,
     32        ),
    2233    ),
    23   ),
    2434);
  • wpappsdev-pcbuilder/trunk/wpappsdev-pcbuilder.php

    r3094849 r3096954  
    33 * Plugin Name:       WooCommerce Custom Product Builder or Configurator - Especially PC Builder Toolkit
    44 * Description:       Complete personal computer (PC) components selling solution toolkit for WooCommerce. This increases sales by Creating a product configuration for your online store. Assist in the assembly of a finished product from individual components.
    5  * Version:           2.0.0
     5 * Version:           2.1.0
    66 * Author:            Saiful Islam Ananda
    77 * Author URI:        http://siananda.me/
     
    1010 * Text Domain:       wpappsdev-pcbuilder
    1111 * Domain Path:       /languages
     12 * Requires at least: 6.0
     13 * Requires PHP:      7.4
    1214 * WC tested up to:   8.9
    1315 */
     
    3335     * @var string
    3436     */
    35     public $version = '2.0.0';
     37    public $version = '2.1.0';
    3638
    3739    /**
     
    6567        register_activation_hook( __FILE__, [ $this, 'activate' ] );
    6668        register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
     69
     70        $this->init_appsero_tracker();
    6771
    6872        add_action( 'plugins_loaded', [ $this, 'init_plugin' ] );
     
    300304     */
    301305    public static function check_required_plugin() {
    302         if ( in_array( 'woocommerce/woocommerce.php', (array) get_option( 'active_plugins', [] ) ) ) {
    303             return true;
    304         }
    305 
    306         return false;
     306        $required_install = false;
     307
     308        if ( ! function_exists( 'is_plugin_active_for_network' ) || ! function_exists( 'is_plugin_active' ) ) {
     309            require_once ABSPATH . '/wp-admin/includes/plugin.php';
     310        }
     311
     312        if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
     313            $required_install = true;
     314        }
     315
     316        if ( is_multisite() ) {
     317            if ( is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) {
     318                $required_install = true;
     319            }
     320        }
     321
     322        return $required_install;
    307323    }
    308324
     
    311327     *
    312328     * @return void
    313      *
    314329     */
    315330    public function required_plugin_notice() {
     
    317332
    318333        include_once WPADPCBU_DIR . 'templates/admin/admin-notice.php';
     334    }
     335
     336    /**
     337     * Initialize the plugin tracker.
     338     *
     339     * @since 2.1.0
     340     *
     341     * @return void
     342     */
     343    public function init_appsero_tracker() {
     344        if ( ! class_exists( 'Appsero\Client' ) ) {
     345            require_once __DIR__ . '/vendor/appsero/src/Client.php';
     346        }
     347
     348        $client = new Appsero\Client( 'faa1d4fa-159c-48f1-8cfd-a4da805e9931', 'WooCommerce Custom Product Builder or Configurator &#8211; Especially PC Builder Toolkit', WPADPCBU );
     349
     350        // Active insights
     351        $client->insights()->init();
    319352    }
    320353
Note: See TracChangeset for help on using the changeset viewer.