Plugin Directory

Changeset 2591401


Ignore:
Timestamp:
08/31/2021 10:16:19 AM (4 years ago)
Author:
giuseppectmobi
Message:

Update to version 1.2.3 from GitHub

Location:
wubtitle
Files:
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wubtitle/tags/1.2.3/includes/Core/Sources/YouTube.php

    r2539088 r2591401  
    8686        }
    8787        $id_video     = $query_params['v'];
    88         $get_info_url = "https://www.youtube.com/get_video_info?html5=1&video_id=$id_video";
    89 
    90         $file_info = array();
    91 
    92         $response = wp_remote_get(
     88        $get_info_url = 'https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8';
     89
     90        $body = array(
     91            'context'         => array(
     92                'client'  => array(
     93                    'hl'               => 'en',
     94                    'clientName'       => 'WEB',
     95                    'clientVersion'    => '2.20210721.00.00',
     96                    'clientFormFactor' => 'UNKNOWN_FORM_FACTOR',
     97                    'clientScreen'     => 'WATCH',
     98                    'mainAppWebInfo'   => array(
     99                        'graftUrl' => "/watch?v=$id_video",
     100                    ),
     101                ),
     102                'user'    => array(
     103                    'lockedSafetyMode' => false,
     104                ),
     105                'request' => array(
     106                    'useSsl'                  => true,
     107                    'internalExperimentFlags' => array(),
     108                    'consistencyTokenJars'    => array(),
     109                ),
     110            ),
     111            'videoId'         => $id_video,
     112            'playbackContext' => array(
     113                'contentPlaybackContext' => array(
     114                    'vis'                   => 0,
     115                    'splay'                 => false,
     116                    'autoCaptionsDefaultOn' => false,
     117                    'autonavState'          => 'STATE_NONE',
     118                    'html5Preference'       => 'HTML5_PREF_WANTS',
     119                    'lactMilliseconds'      => '-1',
     120                ),
     121            ),
     122            'racyCheckOk'     => false,
     123            'contentCheckOk'  => false,
     124        );
     125
     126        $response      = wp_remote_post(
    93127            $get_info_url,
    94128            array(
    95                 'headers' => array( 'Accept-Language' => get_locale() ),
     129                'headers' => array(
     130                    'Accept-Language' => get_locale(),
     131                    'Content-Type'    => 'application/json; charset=utf-8',
     132                ),
     133                'body'    => wp_json_encode( $body ),
    96134            )
    97135        );
    98         $file     = wp_remote_retrieve_body( $response );
    99 
    100         parse_str( $file, $file_info );
    101         if ( 'fail' === $file_info['status'] ) {
     136        $response_body = json_decode( wp_remote_retrieve_body( $response ) );
     137        if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
    102138            return array(
    103139                'success' => false,
     
    105141            );
    106142        }
    107         $title_video = json_decode( $file_info['player_response'] )->videoDetails->title;
    108         $languages   = json_decode( $file_info['player_response'] )->captions->playerCaptionsTracklistRenderer->captionTracks;
    109         $video_info  = array(
     143        // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     144        // warning camel case.
     145        $title_video = $response_body->videoDetails->title;
     146        // phpcs:enable
     147        $languages  = $response_body->captions->playerCaptionsTracklistRenderer->captionTracks;
     148        $video_info = array(
    110149            'success'   => true,
    111150            'source'    => 'youtube',
  • wubtitle/tags/1.2.3/output.log

    r2539088 r2591401  
    66Login Succeeded
    77Pulling docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
    8 WARNING: ⚠️ Failed to pull manifest by the resolved digest. This registry does not
    9     appear to conform to the distribution registry specification; falling back to
    10     pull by tag.  This fallback is DEPRECATED, and will be removed in a future
    11     release.  Please contact admins of https://docker.pkg.github.com. ⚠️
    12 
    138php-7.4-build2: Pulling from ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin
    149596ba82af5aa: Pulling fs layer
     
    22179356474b59db: Pulling fs layer
    2318e9cab5988275: Pulling fs layer
    24 64889fa545ec: Waiting
    25 f807504c7162: Waiting
    26193950d3df66cb: Waiting
    272009a3aba4cdc0: Waiting
     
    29229356474b59db: Waiting
    3023e9cab5988275: Waiting
     2464889fa545ec: Waiting
     25f807504c7162: Waiting
    31262ab8440e5667: Verifying Checksum
    32272ab8440e5667: Download complete
    33 af74f285bb27: Verifying Checksum
     28596ba82af5aa: Verifying Checksum
    3429af74f285bb27: Download complete
    353064889fa545ec: Verifying Checksum
    363164889fa545ec: Download complete
    37 596ba82af5aa: Download complete
    3832596ba82af5aa: Pull complete
    39 f807504c7162: Verifying Checksum
    40 f807504c7162: Download complete
    41333950d3df66cb: Verifying Checksum
    42343950d3df66cb: Download complete
    4335af74f285bb27: Pull complete
     36f807504c7162: Verifying Checksum
     37f807504c7162: Download complete
    4438177ad834d54f: Verifying Checksum
    4539177ad834d54f: Download complete
    46 9356474b59db: Verifying Checksum
     402ab8440e5667: Pull complete
     4109a3aba4cdc0: Verifying Checksum
     4209a3aba4cdc0: Download complete
     4364889fa545ec: Pull complete
    47449356474b59db: Download complete
    48 2ab8440e5667: Pull complete
    49 64889fa545ec: Pull complete
    50 09a3aba4cdc0: Download complete
    5145f807504c7162: Pull complete
    52 3950d3df66cb: Pull complete
    5346e9cab5988275: Verifying Checksum
    5447e9cab5988275: Download complete
     483950d3df66cb: Pull complete
    554909a3aba4cdc0: Pull complete
    5650177ad834d54f: Pull complete
    57519356474b59db: Pull complete
    5852e9cab5988275: Pull complete
    59 Digest: sha256:51432a0d68befb440ce8e54c001e213ec6c2f861b7dd21205588a985455428ae
     53Digest: sha256:9b36491c20827f119921f86ecf0a31842822e17e1d04e11f289aad18ffef7a03
    6054Status: Downloaded newer image for docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
    6155docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
     
    7064Login Succeeded
    7165Pulling docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
    72 WARNING: ⚠️ Failed to pull manifest by the resolved digest. This registry does not
    73     appear to conform to the distribution registry specification; falling back to
    74     pull by tag.  This fallback is DEPRECATED, and will be removed in a future
    75     release.  Please contact admins of https://docker.pkg.github.com. ⚠️
    76 
    7766php-7.4-build2: Pulling from ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin
    78 Digest: sha256:51432a0d68befb440ce8e54c001e213ec6c2f861b7dd21205588a985455428ae
     67Digest: sha256:9b36491c20827f119921f86ecf0a31842822e17e1d04e11f289aad18ffef7a03
    7968Status: Image is up to date for docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
    8069docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
  • wubtitle/tags/1.2.3/readme.txt

    r2539088 r2591401  
    44Tags: subtitle, subtitles, video, Transcription, SEO, speech-to-text, video to text, Youtube to text, Vimeo, Vimeo to text, Youtube, Youtube Transcription, Vimeo Transcription
    55Requires at least: 5.3
    6 Tested up to: 5.6
     6Tested up to: 5.8
    77Stable tag: trunk
    88Requires PHP: 7.2
     
    9696== Changelog ==
    9797
     98= 1.2.3 =
     99Release Date: August 31th, 2021
     100
     101Enhancements:
     102* Added support to Wordpress 5.8
     103
     104Bugfixes:
     105
     106* Stability improvements
     107* Fix support for youtube transcribe
     108
    98109= 1.2.2 =
    99110Release Date: May 28th, 2021
  • wubtitle/tags/1.2.3/vendor/autoload.php

    r2539088 r2591401  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit16b1f7c2422ac449a30efbe496bd2d31::getLoader();
     7return ComposerAutoloaderInitbea5ab2a1dc7db4ea7d25159db746463::getLoader();
  • wubtitle/tags/1.2.3/vendor/composer/ClassLoader.php

    r2539088 r2591401  
    339339     *
    340340     * @param  string    $class The name of the class
    341      * @return bool|null True if loaded, null otherwise
     341     * @return true|null True if loaded, null otherwise
    342342     */
    343343    public function loadClass($class)
     
    348348            return true;
    349349        }
     350
     351        return null;
    350352    }
    351353
  • wubtitle/tags/1.2.3/vendor/composer/InstalledVersions.php

    r2539088 r2591401  
    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 <[email protected]>
     7 *     Jordi Boggiano <[email protected]>
     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 it's 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.2.2',
    31     'version' => '1.2.2.0',
    32     'aliases' =>
    33     array (
    34     ),
    35     'reference' => '550d9da72e6bd33736cfeca114ccfb2f2f4390e6',
    36     'name' => 'ctmobi/wubtitle',
    37   ),
    38   'versions' =>
    39   array (
    40     'ctmobi/wubtitle' =>
    41     array (
    42       'pretty_version' => '1.2.2',
    43       'version' => '1.2.2.0',
    44       'aliases' =>
    45       array (
    46       ),
    47       'reference' => '550d9da72e6bd33736cfeca114ccfb2f2f4390e6',
    48     ),
    49     'firebase/php-jwt' =>
    50     array (
    51       'pretty_version' => 'v5.2.1',
    52       'version' => '5.2.1.0',
    53       'aliases' =>
    54       array (
    55       ),
    56       'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23',
    57     ),
    58   ),
    59 );
    60 private static $canGetVendors;
    61 private static $installedByVendor = array();
    62 
    63 
    64 
    65 
    66 
    67 
    68 
    69 public static function getInstalledPackages()
    70 {
    71 $packages = array();
    72 foreach (self::getInstalled() as $installed) {
    73 $packages[] = array_keys($installed['versions']);
     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}
     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}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: 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}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: 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}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: 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}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: 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    }
    74337}
    75 
    76 if (1 === \count($packages)) {
    77 return $packages[0];
    78 }
    79 
    80 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
    81 }
    82 
    83 
    84 
    85 
    86 
    87 
    88 
    89 
    90 
    91 public static function isInstalled($packageName)
    92 {
    93 foreach (self::getInstalled() as $installed) {
    94 if (isset($installed['versions'][$packageName])) {
    95 return true;
    96 }
    97 }
    98 
    99 return false;
    100 }
    101 
    102 
    103 
    104 
    105 
    106 
    107 
    108 
    109 
    110 
    111 
    112 
    113 
    114 
    115 public static function satisfies(VersionParser $parser, $packageName, $constraint)
    116 {
    117 $constraint = $parser->parseConstraints($constraint);
    118 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    119 
    120 return $provided->matches($constraint);
    121 }
    122 
    123 
    124 
    125 
    126 
    127 
    128 
    129 
    130 
    131 
    132 public static function getVersionRanges($packageName)
    133 {
    134 foreach (self::getInstalled() as $installed) {
    135 if (!isset($installed['versions'][$packageName])) {
    136 continue;
    137 }
    138 
    139 $ranges = array();
    140 if (isset($installed['versions'][$packageName]['pretty_version'])) {
    141 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
    142 }
    143 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
    144 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
    145 }
    146 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
    147 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
    148 }
    149 if (array_key_exists('provided', $installed['versions'][$packageName])) {
    150 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
    151 }
    152 
    153 return implode(' || ', $ranges);
    154 }
    155 
    156 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    157 }
    158 
    159 
    160 
    161 
    162 
    163 public static function getVersion($packageName)
    164 {
    165 foreach (self::getInstalled() as $installed) {
    166 if (!isset($installed['versions'][$packageName])) {
    167 continue;
    168 }
    169 
    170 if (!isset($installed['versions'][$packageName]['version'])) {
    171 return null;
    172 }
    173 
    174 return $installed['versions'][$packageName]['version'];
    175 }
    176 
    177 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    178 }
    179 
    180 
    181 
    182 
    183 
    184 public static function getPrettyVersion($packageName)
    185 {
    186 foreach (self::getInstalled() as $installed) {
    187 if (!isset($installed['versions'][$packageName])) {
    188 continue;
    189 }
    190 
    191 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
    192 return null;
    193 }
    194 
    195 return $installed['versions'][$packageName]['pretty_version'];
    196 }
    197 
    198 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    199 }
    200 
    201 
    202 
    203 
    204 
    205 public static function getReference($packageName)
    206 {
    207 foreach (self::getInstalled() as $installed) {
    208 if (!isset($installed['versions'][$packageName])) {
    209 continue;
    210 }
    211 
    212 if (!isset($installed['versions'][$packageName]['reference'])) {
    213 return null;
    214 }
    215 
    216 return $installed['versions'][$packageName]['reference'];
    217 }
    218 
    219 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    220 }
    221 
    222 
    223 
    224 
    225 
    226 public static function getRootPackage()
    227 {
    228 $installed = self::getInstalled();
    229 
    230 return $installed[0]['root'];
    231 }
    232 
    233 
    234 
    235 
    236 
    237 
    238 
    239 
    240 public static function getRawData()
    241 {
    242 @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
    243 
    244 return self::$installed;
    245 }
    246 
    247 
    248 
    249 
    250 
    251 
    252 
    253 public static function getAllRawData()
    254 {
    255 return self::getInstalled();
    256 }
    257 
    258 
    259 
    260 
    261 
    262 
    263 
    264 
    265 
    266 
    267 
    268 
    269 
    270 
    271 
    272 
    273 
    274 
    275 
    276 public static function reload($data)
    277 {
    278 self::$installed = $data;
    279 self::$installedByVendor = array();
    280 }
    281 
    282 
    283 
    284 
    285 
    286 private static function getInstalled()
    287 {
    288 if (null === self::$canGetVendors) {
    289 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
    290 }
    291 
    292 $installed = array();
    293 
    294 if (self::$canGetVendors) {
    295 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    296 if (isset(self::$installedByVendor[$vendorDir])) {
    297 $installed[] = self::$installedByVendor[$vendorDir];
    298 } elseif (is_file($vendorDir.'/composer/installed.php')) {
    299 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    300 }
    301 }
    302 }
    303 
    304 $installed[] = self::$installed;
    305 
    306 return $installed;
    307 }
    308 }
  • wubtitle/tags/1.2.3/vendor/composer/autoload_real.php

    r2539088 r2591401  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit16b1f7c2422ac449a30efbe496bd2d31
     5class ComposerAutoloaderInitbea5ab2a1dc7db4ea7d25159db746463
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit16b1f7c2422ac449a30efbe496bd2d31', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitbea5ab2a1dc7db4ea7d25159db746463', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit16b1f7c2422ac449a30efbe496bd2d31', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitbea5ab2a1dc7db4ea7d25159db746463', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • wubtitle/tags/1.2.3/vendor/composer/autoload_static.php

    r2539088 r2591401  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31
     7class ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3636    {
    3737        return \Closure::bind(function () use ($loader) {
    38             $loader->prefixLengthsPsr4 = ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31::$prefixLengthsPsr4;
    39             $loader->prefixDirsPsr4 = ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31::$prefixDirsPsr4;
    40             $loader->classMap = ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31::$classMap;
     38            $loader->prefixLengthsPsr4 = ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463::$prefixLengthsPsr4;
     39            $loader->prefixDirsPsr4 = ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463::$prefixDirsPsr4;
     40            $loader->classMap = ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463::$classMap;
    4141
    4242        }, null, ClassLoader::class);
  • wubtitle/tags/1.2.3/vendor/composer/installed.php

    r2539088 r2591401  
    1 <?php return array (
    2   'root' =>
    3   array (
    4     'pretty_version' => '1.2.2',
    5     'version' => '1.2.2.0',
    6     'aliases' =>
    7     array (
     1<?php return array(
     2    'root' => array(
     3        'pretty_version' => '1.2.3',
     4        'version' => '1.2.3.0',
     5        'type' => 'project',
     6        'install_path' => __DIR__ . '/../../',
     7        'aliases' => array(),
     8        'reference' => 'be401e9e166c7b7fbfe40fed97b9f803dc6e49ea',
     9        'name' => 'ctmobi/wubtitle',
     10        'dev' => false,
    811    ),
    9     'reference' => '550d9da72e6bd33736cfeca114ccfb2f2f4390e6',
    10     'name' => 'ctmobi/wubtitle',
    11   ),
    12   'versions' =>
    13   array (
    14     'ctmobi/wubtitle' =>
    15     array (
    16       'pretty_version' => '1.2.2',
    17       'version' => '1.2.2.0',
    18       'aliases' =>
    19       array (
    20       ),
    21       'reference' => '550d9da72e6bd33736cfeca114ccfb2f2f4390e6',
     12    'versions' => array(
     13        'ctmobi/wubtitle' => array(
     14            'pretty_version' => '1.2.3',
     15            'version' => '1.2.3.0',
     16            'type' => 'project',
     17            'install_path' => __DIR__ . '/../../',
     18            'aliases' => array(),
     19            'reference' => 'be401e9e166c7b7fbfe40fed97b9f803dc6e49ea',
     20            'dev_requirement' => false,
     21        ),
     22        'firebase/php-jwt' => array(
     23            'pretty_version' => 'v5.2.1',
     24            'version' => '5.2.1.0',
     25            'type' => 'library',
     26            'install_path' => __DIR__ . '/../firebase/php-jwt',
     27            'aliases' => array(),
     28            'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23',
     29            'dev_requirement' => false,
     30        ),
    2231    ),
    23     'firebase/php-jwt' =>
    24     array (
    25       'pretty_version' => 'v5.2.1',
    26       'version' => '5.2.1.0',
    27       'aliases' =>
    28       array (
    29       ),
    30       'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23',
    31     ),
    32   ),
    3332);
  • wubtitle/tags/1.2.3/wubtitle.php

    r2539088 r2591401  
    88 * Text Domain:     wubtitle
    99 * Domain Path:     /languages
    10  * Version:         1.2.2
     10 * Version:         1.2.3
    1111 *
    1212 * @package         Wubtitle
     
    2222define( 'WUBTITLE_URL', plugin_dir_url( __FILE__ ) );
    2323define( 'WUBTITLE_NAME', dirname( plugin_basename( __FILE__ ) ) );
    24 define( 'WUBTITLE_VER', '1.2.2' );
     24define( 'WUBTITLE_VER', '1.2.3' );
    2525$endpoint = 'https://api.wubtitle.com/';
    2626if ( defined( 'WP_WUBTITLE_ENV' ) && 'development' === WP_WUBTITLE_ENV ) {
  • wubtitle/trunk/includes/Core/Sources/YouTube.php

    r2539088 r2591401  
    8686        }
    8787        $id_video     = $query_params['v'];
    88         $get_info_url = "https://www.youtube.com/get_video_info?html5=1&video_id=$id_video";
    89 
    90         $file_info = array();
    91 
    92         $response = wp_remote_get(
     88        $get_info_url = 'https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8';
     89
     90        $body = array(
     91            'context'         => array(
     92                'client'  => array(
     93                    'hl'               => 'en',
     94                    'clientName'       => 'WEB',
     95                    'clientVersion'    => '2.20210721.00.00',
     96                    'clientFormFactor' => 'UNKNOWN_FORM_FACTOR',
     97                    'clientScreen'     => 'WATCH',
     98                    'mainAppWebInfo'   => array(
     99                        'graftUrl' => "/watch?v=$id_video",
     100                    ),
     101                ),
     102                'user'    => array(
     103                    'lockedSafetyMode' => false,
     104                ),
     105                'request' => array(
     106                    'useSsl'                  => true,
     107                    'internalExperimentFlags' => array(),
     108                    'consistencyTokenJars'    => array(),
     109                ),
     110            ),
     111            'videoId'         => $id_video,
     112            'playbackContext' => array(
     113                'contentPlaybackContext' => array(
     114                    'vis'                   => 0,
     115                    'splay'                 => false,
     116                    'autoCaptionsDefaultOn' => false,
     117                    'autonavState'          => 'STATE_NONE',
     118                    'html5Preference'       => 'HTML5_PREF_WANTS',
     119                    'lactMilliseconds'      => '-1',
     120                ),
     121            ),
     122            'racyCheckOk'     => false,
     123            'contentCheckOk'  => false,
     124        );
     125
     126        $response      = wp_remote_post(
    93127            $get_info_url,
    94128            array(
    95                 'headers' => array( 'Accept-Language' => get_locale() ),
     129                'headers' => array(
     130                    'Accept-Language' => get_locale(),
     131                    'Content-Type'    => 'application/json; charset=utf-8',
     132                ),
     133                'body'    => wp_json_encode( $body ),
    96134            )
    97135        );
    98         $file     = wp_remote_retrieve_body( $response );
    99 
    100         parse_str( $file, $file_info );
    101         if ( 'fail' === $file_info['status'] ) {
     136        $response_body = json_decode( wp_remote_retrieve_body( $response ) );
     137        if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
    102138            return array(
    103139                'success' => false,
     
    105141            );
    106142        }
    107         $title_video = json_decode( $file_info['player_response'] )->videoDetails->title;
    108         $languages   = json_decode( $file_info['player_response'] )->captions->playerCaptionsTracklistRenderer->captionTracks;
    109         $video_info  = array(
     143        // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     144        // warning camel case.
     145        $title_video = $response_body->videoDetails->title;
     146        // phpcs:enable
     147        $languages  = $response_body->captions->playerCaptionsTracklistRenderer->captionTracks;
     148        $video_info = array(
    110149            'success'   => true,
    111150            'source'    => 'youtube',
  • wubtitle/trunk/output.log

    r2539088 r2591401  
    66Login Succeeded
    77Pulling docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
    8 WARNING: ⚠️ Failed to pull manifest by the resolved digest. This registry does not
    9     appear to conform to the distribution registry specification; falling back to
    10     pull by tag.  This fallback is DEPRECATED, and will be removed in a future
    11     release.  Please contact admins of https://docker.pkg.github.com. ⚠️
    12 
    138php-7.4-build2: Pulling from ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin
    149596ba82af5aa: Pulling fs layer
     
    22179356474b59db: Pulling fs layer
    2318e9cab5988275: Pulling fs layer
    24 64889fa545ec: Waiting
    25 f807504c7162: Waiting
    26193950d3df66cb: Waiting
    272009a3aba4cdc0: Waiting
     
    29229356474b59db: Waiting
    3023e9cab5988275: Waiting
     2464889fa545ec: Waiting
     25f807504c7162: Waiting
    31262ab8440e5667: Verifying Checksum
    32272ab8440e5667: Download complete
    33 af74f285bb27: Verifying Checksum
     28596ba82af5aa: Verifying Checksum
    3429af74f285bb27: Download complete
    353064889fa545ec: Verifying Checksum
    363164889fa545ec: Download complete
    37 596ba82af5aa: Download complete
    3832596ba82af5aa: Pull complete
    39 f807504c7162: Verifying Checksum
    40 f807504c7162: Download complete
    41333950d3df66cb: Verifying Checksum
    42343950d3df66cb: Download complete
    4335af74f285bb27: Pull complete
     36f807504c7162: Verifying Checksum
     37f807504c7162: Download complete
    4438177ad834d54f: Verifying Checksum
    4539177ad834d54f: Download complete
    46 9356474b59db: Verifying Checksum
     402ab8440e5667: Pull complete
     4109a3aba4cdc0: Verifying Checksum
     4209a3aba4cdc0: Download complete
     4364889fa545ec: Pull complete
    47449356474b59db: Download complete
    48 2ab8440e5667: Pull complete
    49 64889fa545ec: Pull complete
    50 09a3aba4cdc0: Download complete
    5145f807504c7162: Pull complete
    52 3950d3df66cb: Pull complete
    5346e9cab5988275: Verifying Checksum
    5447e9cab5988275: Download complete
     483950d3df66cb: Pull complete
    554909a3aba4cdc0: Pull complete
    5650177ad834d54f: Pull complete
    57519356474b59db: Pull complete
    5852e9cab5988275: Pull complete
    59 Digest: sha256:51432a0d68befb440ce8e54c001e213ec6c2f861b7dd21205588a985455428ae
     53Digest: sha256:9b36491c20827f119921f86ecf0a31842822e17e1d04e11f289aad18ffef7a03
    6054Status: Downloaded newer image for docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
    6155docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
     
    7064Login Succeeded
    7165Pulling docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
    72 WARNING: ⚠️ Failed to pull manifest by the resolved digest. This registry does not
    73     appear to conform to the distribution registry specification; falling back to
    74     pull by tag.  This fallback is DEPRECATED, and will be removed in a future
    75     release.  Please contact admins of https://docker.pkg.github.com. ⚠️
    76 
    7766php-7.4-build2: Pulling from ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin
    78 Digest: sha256:51432a0d68befb440ce8e54c001e213ec6c2f861b7dd21205588a985455428ae
     67Digest: sha256:9b36491c20827f119921f86ecf0a31842822e17e1d04e11f289aad18ffef7a03
    7968Status: Image is up to date for docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
    8069docker.pkg.github.com/ctmobi/wubtitle-wordpress-plugin/php-actions_composer_wubtitle-wordpress-plugin:php-7.4-build2
  • wubtitle/trunk/readme.txt

    r2539088 r2591401  
    44Tags: subtitle, subtitles, video, Transcription, SEO, speech-to-text, video to text, Youtube to text, Vimeo, Vimeo to text, Youtube, Youtube Transcription, Vimeo Transcription
    55Requires at least: 5.3
    6 Tested up to: 5.6
     6Tested up to: 5.8
    77Stable tag: trunk
    88Requires PHP: 7.2
     
    9696== Changelog ==
    9797
     98= 1.2.3 =
     99Release Date: August 31th, 2021
     100
     101Enhancements:
     102* Added support to Wordpress 5.8
     103
     104Bugfixes:
     105
     106* Stability improvements
     107* Fix support for youtube transcribe
     108
    98109= 1.2.2 =
    99110Release Date: May 28th, 2021
  • wubtitle/trunk/vendor/autoload.php

    r2539088 r2591401  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit16b1f7c2422ac449a30efbe496bd2d31::getLoader();
     7return ComposerAutoloaderInitbea5ab2a1dc7db4ea7d25159db746463::getLoader();
  • wubtitle/trunk/vendor/composer/ClassLoader.php

    r2539088 r2591401  
    339339     *
    340340     * @param  string    $class The name of the class
    341      * @return bool|null True if loaded, null otherwise
     341     * @return true|null True if loaded, null otherwise
    342342     */
    343343    public function loadClass($class)
     
    348348            return true;
    349349        }
     350
     351        return null;
    350352    }
    351353
  • wubtitle/trunk/vendor/composer/InstalledVersions.php

    r2539088 r2591401  
    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 <[email protected]>
     7 *     Jordi Boggiano <[email protected]>
     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 it's 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.2.2',
    31     'version' => '1.2.2.0',
    32     'aliases' =>
    33     array (
    34     ),
    35     'reference' => '550d9da72e6bd33736cfeca114ccfb2f2f4390e6',
    36     'name' => 'ctmobi/wubtitle',
    37   ),
    38   'versions' =>
    39   array (
    40     'ctmobi/wubtitle' =>
    41     array (
    42       'pretty_version' => '1.2.2',
    43       'version' => '1.2.2.0',
    44       'aliases' =>
    45       array (
    46       ),
    47       'reference' => '550d9da72e6bd33736cfeca114ccfb2f2f4390e6',
    48     ),
    49     'firebase/php-jwt' =>
    50     array (
    51       'pretty_version' => 'v5.2.1',
    52       'version' => '5.2.1.0',
    53       'aliases' =>
    54       array (
    55       ),
    56       'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23',
    57     ),
    58   ),
    59 );
    60 private static $canGetVendors;
    61 private static $installedByVendor = array();
    62 
    63 
    64 
    65 
    66 
    67 
    68 
    69 public static function getInstalledPackages()
    70 {
    71 $packages = array();
    72 foreach (self::getInstalled() as $installed) {
    73 $packages[] = array_keys($installed['versions']);
     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}
     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}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: 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}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: 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}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: 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}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: 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    }
    74337}
    75 
    76 if (1 === \count($packages)) {
    77 return $packages[0];
    78 }
    79 
    80 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
    81 }
    82 
    83 
    84 
    85 
    86 
    87 
    88 
    89 
    90 
    91 public static function isInstalled($packageName)
    92 {
    93 foreach (self::getInstalled() as $installed) {
    94 if (isset($installed['versions'][$packageName])) {
    95 return true;
    96 }
    97 }
    98 
    99 return false;
    100 }
    101 
    102 
    103 
    104 
    105 
    106 
    107 
    108 
    109 
    110 
    111 
    112 
    113 
    114 
    115 public static function satisfies(VersionParser $parser, $packageName, $constraint)
    116 {
    117 $constraint = $parser->parseConstraints($constraint);
    118 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    119 
    120 return $provided->matches($constraint);
    121 }
    122 
    123 
    124 
    125 
    126 
    127 
    128 
    129 
    130 
    131 
    132 public static function getVersionRanges($packageName)
    133 {
    134 foreach (self::getInstalled() as $installed) {
    135 if (!isset($installed['versions'][$packageName])) {
    136 continue;
    137 }
    138 
    139 $ranges = array();
    140 if (isset($installed['versions'][$packageName]['pretty_version'])) {
    141 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
    142 }
    143 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
    144 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
    145 }
    146 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
    147 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
    148 }
    149 if (array_key_exists('provided', $installed['versions'][$packageName])) {
    150 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
    151 }
    152 
    153 return implode(' || ', $ranges);
    154 }
    155 
    156 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    157 }
    158 
    159 
    160 
    161 
    162 
    163 public static function getVersion($packageName)
    164 {
    165 foreach (self::getInstalled() as $installed) {
    166 if (!isset($installed['versions'][$packageName])) {
    167 continue;
    168 }
    169 
    170 if (!isset($installed['versions'][$packageName]['version'])) {
    171 return null;
    172 }
    173 
    174 return $installed['versions'][$packageName]['version'];
    175 }
    176 
    177 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    178 }
    179 
    180 
    181 
    182 
    183 
    184 public static function getPrettyVersion($packageName)
    185 {
    186 foreach (self::getInstalled() as $installed) {
    187 if (!isset($installed['versions'][$packageName])) {
    188 continue;
    189 }
    190 
    191 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
    192 return null;
    193 }
    194 
    195 return $installed['versions'][$packageName]['pretty_version'];
    196 }
    197 
    198 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    199 }
    200 
    201 
    202 
    203 
    204 
    205 public static function getReference($packageName)
    206 {
    207 foreach (self::getInstalled() as $installed) {
    208 if (!isset($installed['versions'][$packageName])) {
    209 continue;
    210 }
    211 
    212 if (!isset($installed['versions'][$packageName]['reference'])) {
    213 return null;
    214 }
    215 
    216 return $installed['versions'][$packageName]['reference'];
    217 }
    218 
    219 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    220 }
    221 
    222 
    223 
    224 
    225 
    226 public static function getRootPackage()
    227 {
    228 $installed = self::getInstalled();
    229 
    230 return $installed[0]['root'];
    231 }
    232 
    233 
    234 
    235 
    236 
    237 
    238 
    239 
    240 public static function getRawData()
    241 {
    242 @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
    243 
    244 return self::$installed;
    245 }
    246 
    247 
    248 
    249 
    250 
    251 
    252 
    253 public static function getAllRawData()
    254 {
    255 return self::getInstalled();
    256 }
    257 
    258 
    259 
    260 
    261 
    262 
    263 
    264 
    265 
    266 
    267 
    268 
    269 
    270 
    271 
    272 
    273 
    274 
    275 
    276 public static function reload($data)
    277 {
    278 self::$installed = $data;
    279 self::$installedByVendor = array();
    280 }
    281 
    282 
    283 
    284 
    285 
    286 private static function getInstalled()
    287 {
    288 if (null === self::$canGetVendors) {
    289 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
    290 }
    291 
    292 $installed = array();
    293 
    294 if (self::$canGetVendors) {
    295 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    296 if (isset(self::$installedByVendor[$vendorDir])) {
    297 $installed[] = self::$installedByVendor[$vendorDir];
    298 } elseif (is_file($vendorDir.'/composer/installed.php')) {
    299 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    300 }
    301 }
    302 }
    303 
    304 $installed[] = self::$installed;
    305 
    306 return $installed;
    307 }
    308 }
  • wubtitle/trunk/vendor/composer/autoload_real.php

    r2539088 r2591401  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit16b1f7c2422ac449a30efbe496bd2d31
     5class ComposerAutoloaderInitbea5ab2a1dc7db4ea7d25159db746463
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit16b1f7c2422ac449a30efbe496bd2d31', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitbea5ab2a1dc7db4ea7d25159db746463', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit16b1f7c2422ac449a30efbe496bd2d31', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitbea5ab2a1dc7db4ea7d25159db746463', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • wubtitle/trunk/vendor/composer/autoload_static.php

    r2539088 r2591401  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31
     7class ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3636    {
    3737        return \Closure::bind(function () use ($loader) {
    38             $loader->prefixLengthsPsr4 = ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31::$prefixLengthsPsr4;
    39             $loader->prefixDirsPsr4 = ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31::$prefixDirsPsr4;
    40             $loader->classMap = ComposerStaticInit16b1f7c2422ac449a30efbe496bd2d31::$classMap;
     38            $loader->prefixLengthsPsr4 = ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463::$prefixLengthsPsr4;
     39            $loader->prefixDirsPsr4 = ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463::$prefixDirsPsr4;
     40            $loader->classMap = ComposerStaticInitbea5ab2a1dc7db4ea7d25159db746463::$classMap;
    4141
    4242        }, null, ClassLoader::class);
  • wubtitle/trunk/vendor/composer/installed.php

    r2539088 r2591401  
    1 <?php return array (
    2   'root' =>
    3   array (
    4     'pretty_version' => '1.2.2',
    5     'version' => '1.2.2.0',
    6     'aliases' =>
    7     array (
     1<?php return array(
     2    'root' => array(
     3        'pretty_version' => '1.2.3',
     4        'version' => '1.2.3.0',
     5        'type' => 'project',
     6        'install_path' => __DIR__ . '/../../',
     7        'aliases' => array(),
     8        'reference' => 'be401e9e166c7b7fbfe40fed97b9f803dc6e49ea',
     9        'name' => 'ctmobi/wubtitle',
     10        'dev' => false,
    811    ),
    9     'reference' => '550d9da72e6bd33736cfeca114ccfb2f2f4390e6',
    10     'name' => 'ctmobi/wubtitle',
    11   ),
    12   'versions' =>
    13   array (
    14     'ctmobi/wubtitle' =>
    15     array (
    16       'pretty_version' => '1.2.2',
    17       'version' => '1.2.2.0',
    18       'aliases' =>
    19       array (
    20       ),
    21       'reference' => '550d9da72e6bd33736cfeca114ccfb2f2f4390e6',
     12    'versions' => array(
     13        'ctmobi/wubtitle' => array(
     14            'pretty_version' => '1.2.3',
     15            'version' => '1.2.3.0',
     16            'type' => 'project',
     17            'install_path' => __DIR__ . '/../../',
     18            'aliases' => array(),
     19            'reference' => 'be401e9e166c7b7fbfe40fed97b9f803dc6e49ea',
     20            'dev_requirement' => false,
     21        ),
     22        'firebase/php-jwt' => array(
     23            'pretty_version' => 'v5.2.1',
     24            'version' => '5.2.1.0',
     25            'type' => 'library',
     26            'install_path' => __DIR__ . '/../firebase/php-jwt',
     27            'aliases' => array(),
     28            'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23',
     29            'dev_requirement' => false,
     30        ),
    2231    ),
    23     'firebase/php-jwt' =>
    24     array (
    25       'pretty_version' => 'v5.2.1',
    26       'version' => '5.2.1.0',
    27       'aliases' =>
    28       array (
    29       ),
    30       'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23',
    31     ),
    32   ),
    3332);
  • wubtitle/trunk/wubtitle.php

    r2539088 r2591401  
    88 * Text Domain:     wubtitle
    99 * Domain Path:     /languages
    10  * Version:         1.2.2
     10 * Version:         1.2.3
    1111 *
    1212 * @package         Wubtitle
     
    2222define( 'WUBTITLE_URL', plugin_dir_url( __FILE__ ) );
    2323define( 'WUBTITLE_NAME', dirname( plugin_basename( __FILE__ ) ) );
    24 define( 'WUBTITLE_VER', '1.2.2' );
     24define( 'WUBTITLE_VER', '1.2.3' );
    2525$endpoint = 'https://api.wubtitle.com/';
    2626if ( defined( 'WP_WUBTITLE_ENV' ) && 'development' === WP_WUBTITLE_ENV ) {
Note: See TracChangeset for help on using the changeset viewer.