Plugin Directory

Changeset 3049246


Ignore:
Timestamp:
03/11/2024 03:52:50 PM (2 years ago)
Author:
teamgrow
Message:

Update trunk to 1.1.0

Location:
grow-for-wp
Files:
30 added
32 deleted
38 edited
1 copied

Legend:

Unmodified
Added
Removed
  • grow-for-wp/tags/1.1.0/changelog.txt

    r2980893 r3049246  
    11# Changelog
     2
     3## 1.1.0 - 2024-03-11
     4 - Automatically redirect to Grow login page on activation.
    25
    36## 1.0.0 - 2023-10-18
     
    2629 - Fix Frontent Test
    2730
    28 
    29 ## 1.0.0 - 2023-10-18
    30 
    31 
    32 
    33 ## 0.1.7 - 2023-08-11
     31## 0.1.7 - 2023-08-11
    3432  * fix: Adjust Typography on Settings Page
    3533  * fix: Bigger Images for Settings Page
     
    3937  * fix: Open Help Doc Links in New Tab
    4038
    41 ## 0.1.5 - 2023-07-10 
     39## 0.1.5 - 2023-07-10
    4240  * fix: Open Authenticated Link in new tab
    4341  * chore: Add Test for Authenticated View
     
    4644 * chore: Remove Author URI
    4745
    48 ## 0.1.3 - 2023-06-23 
     46## 0.1.3 - 2023-06-23
    4947 * chore: Name changed to Grow for WP
    5048
  • grow-for-wp/tags/1.1.0/constants.php

    r2980893 r3049246  
    66
    77// Environment setup.
     8define('GROW_PLUGIN_FILE', __DIR__ . '/grow-for-wp.php');
    89define('GROW_PLUGIN_BASENAME', plugin_basename(__DIR__ . '/grow-for-wp.php'));
    910define('GROW_PLUGIN_DIR', __DIR__);
  • grow-for-wp/tags/1.1.0/grow-for-wp.php

    r2980893 r3049246  
    44 * Plugin URI:          https://grow.me/publishers
    55 * Description:         Integrate your WordPress Site with Grow
    6  * Version:             1.0.0
     6 * Version:             1.1.0
    77 * Requires at least:   5.2
    88 * Requires PHP:        7.4
  • grow-for-wp/tags/1.1.0/inc/Grow/Activation.php

    r2980893 r3049246  
    3131        $this->options = $repository->get_options();
    3232        $this->version = $repository->get_config()->get_version();
    33         $this->actions = [ new HookArguments( self::ACTIVATION_HOOK, 'run' ) ];
     33        $this->actions = [
     34            new HookArguments( self::ACTIVATION_HOOK, 'run' ),
     35            new HookArguments( 'admin_init', 'redirect_after_activation' ),
     36        ];
    3437    }
    3538
     
    4750            $this->options->set_grow_first_install_version( $this->version );
    4851        }
     52
     53        if ( $this->can_redirect_after_activation() ) {
     54            // Set flag here to auto-redirect to settings next WP cycle.
     55            $this->options->set_grow_should_redirect_after_activation( '1' );
     56        }
     57    }
     58
     59    /**
     60     * Handles redirecting to the settings page directly after the plugin has been enabled.
     61     */
     62    public function redirect_after_activation() : void {
     63        if ( empty( $this->options->get_grow_should_redirect_after_activation() ) ) {
     64            return;
     65        }
     66
     67        if ( ! WordPress::is_admin() ) {
     68            return;
     69        }
     70
     71        $this->options->set_grow_should_redirect_after_activation( '' );
     72        //phpcs:disable WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit
     73        WordPress::wp_safe_redirect( WordPress::esc_url( WordPress::admin_url( 'admin.php?page=' . AdminPage::MENU_SLUG ) ) );
     74        if ( ! defined( 'GROW_TEST_MODE' ) ) {
     75            exit;
     76        }
     77    }
     78
     79    /**
     80     * Verifies that a redirect after activation is possible.
     81     *
     82     * @return bool
     83     */
     84    public function can_redirect_after_activation() : bool {
     85        // Don't redirect on multi-site install.
     86        if ( WordPress::is_network_admin() ) {
     87            return false;
     88        }
     89
     90        // Don't redirect if this was activated as part of a bulk-enable.
     91        $maybe_multi = filter_input( INPUT_GET, 'activate-multi', FILTER_VALIDATE_BOOLEAN );
     92        if ( $maybe_multi ) {
     93            return false;
     94        }
     95
     96        return true;
    4997    }
    5098}
  • grow-for-wp/tags/1.1.0/inc/Grow/AdminPage.php

    r2980893 r3049246  
    1515    private const PAGE_TITLE = 'Grow';
    1616
    17     private const MENU_SLUG = 'grow';
     17    public const MENU_SLUG = 'grow';
    1818
    1919    private const CAPABILITY_LEVEL = 'manage_options';
  • grow-for-wp/tags/1.1.0/inc/Grow/Options.php

    r2980893 r3049246  
    112112
    113113    /**
     114     * @param string $default Value to return if the stored value is empty
     115     * @param bool   $force check the database again even if we have a value in memoryd value is empty
     116     *
     117     * @return string
     118     */
     119    public function get_grow_should_redirect_after_activation( string $default = '', bool $force = false ) : string {
     120        return strval($this->get( 'grow_just_activated', $default, $force ));
     121    }
     122
     123    /**
     124     * @param string $value New value to set
     125     *
     126     * @return bool
     127     */
     128    public function set_grow_should_redirect_after_activation( string $value ) : bool {
     129        return $this->set( 'grow_just_activated', $value );
     130    }
     131
     132    /**
    114133     * @param string $key Key for the option to set
    115134     * @param string $value New value to set
  • grow-for-wp/tags/1.1.0/inc/Grow/OptionsInterface.php

    r2980893 r3049246  
    6363     */
    6464    public function set_grow_first_install_version( string $value ) : bool;
     65
     66    /**
     67     * @param string $default the default value to get if the property is empty
     68     * @param bool   $force check the database again even if we have a value in memory
     69     *
     70     * @return string
     71     */
     72    public function get_grow_should_redirect_after_activation( string $default = '', bool $force = false) : string;
     73
     74    /**
     75     * @param string $value New value to set
     76     *
     77     * @return bool
     78     */
     79    public function set_grow_should_redirect_after_activation( string $value ) : bool;
    6580}
  • grow-for-wp/tags/1.1.0/inc/Grow/Plugin.php

    r2980893 r3049246  
    1515
    1616    /** @var string|null VERSION */
    17     const VERSION = '1.0.0';
     17    const VERSION = '1.1.0';
    1818
    1919    /** @var Repository */
     
    2929     */
    3030    public function __construct() {
     31        WordPress::register_activation_hook( GROW_PLUGIN_FILE, [ $this, 'register_activation' ] );
     32        WordPress::register_deactivation_hook( GROW_PLUGIN_FILE, [ $this, 'register_deactivation' ] );
    3133        WordPress::add_action('plugins_loaded', [ $this, 'main' ]);
    3234    }
     
    98100    }
    99101
     102    /**
     103     * Handles plugin activation.
     104     *
     105     * @return void
     106     */
     107    public function register_activation() {
     108        if ( empty( $this->wordpress_lifecycle ) ) {
     109            $this->main();
     110        }
     111        $this->wordpress_lifecycle->register_activation();
     112    }
     113
     114    /**
     115     * Handles plugin deactivation.
     116     *
     117     * @return void
     118     */
     119    public function register_deactivation() {
     120        if ( empty( $this->wordpress_lifecycle ) ) {
     121            $this->main();
     122        }
     123        $this->wordpress_lifecycle->register_deactivation();
     124    }
     125
    100126
    101127}
  • grow-for-wp/tags/1.1.0/inc/Grow/WordPress.php

    r2980893 r3049246  
    330330        return admin_url( $path, $scheme );
    331331    }
     332
     333    /**
     334     * Performs a safe (local) redirect, using wp_redirect().
     335     *
     336     * Checks whether the $location is using an allowed host, if it has an absolute
     337     * path. A plugin can therefore set or remove allowed host(s) to or from the
     338     * list.
     339     *
     340     * If the host is not allowed, then the redirect defaults to wp-admin on the siteurl
     341     * instead. This prevents malicious redirects which redirect to another host,
     342     * but only used in a few places.
     343     *
     344     * Note: wp_safe_redirect() does not exit automatically, and should almost always be
     345     * followed by a call to `exit;`:
     346     *
     347     *     wp_safe_redirect( $url );
     348     *     exit;
     349     *
     350     * Exiting can also be selectively manipulated by using wp_safe_redirect() as a conditional
     351     * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_status'} filters:
     352     *
     353     *     if ( wp_safe_redirect( $url ) ) {
     354     *         exit;
     355     *     }
     356     *
     357     * @since 2.3.0
     358     * @since 5.1.0 The return value from wp_redirect() is now passed on, and the `$x_redirect_by` parameter was added.
     359     *
     360     * @param string $location      The path or URL to redirect to.
     361     * @param int    $status        Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
     362     * @param string $x_redirect_by Optional. The application doing the redirect. Default 'WordPress'.
     363     * @return bool False if the redirect was canceled, true otherwise.
     364     */
     365    public static function wp_safe_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) { //phpcs:disable WordPressVIPMinimum.Security.ExitAfterRedirect.NoExitInConditional
     366        //phpcs:disable WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit
     367        return wp_safe_redirect( $location, $status, $x_redirect_by );
     368    }
     369
     370    /**
     371     * Determines whether the current request is for an administrative interface page.
     372     *
     373     * Does not check if the user is an administrator; use current_user_can()
     374     * for checking roles and capabilities.
     375     *
     376     * For more information on this and similar theme functions, check out
     377     * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
     378     * Conditional Tags} article in the Theme Developer Handbook.
     379     *
     380     * @since 1.5.1
     381     *
     382     * @global \WP_Screen $current_screen WordPress current screen object.
     383     *
     384     * @return bool True if inside WordPress administration interface, false otherwise.
     385     */
     386    public static function is_admin() {
     387        return is_admin();
     388    }
     389
     390    /**
     391     * Determines whether the current request is for the network administrative interface.
     392     *
     393     * Does not check if the user is an administrator; use current_user_can()
     394     * for checking roles and capabilities.
     395     *
     396     * Does not check if the site is a Multisite network; use is_multisite()
     397     * for checking if Multisite is enabled.
     398     *
     399     * @since 3.1.0
     400     *
     401     * @global \WP_Screen $current_screen WordPress current screen object.
     402     *
     403     * @return bool True if inside WordPress network administration pages.
     404     */
     405    public static function is_network_admin() {
     406        return is_network_admin();
     407    }
    332408}
  • grow-for-wp/tags/1.1.0/inc/Grow/WordPressLifecycle.php

    r2980893 r3049246  
    3535        $this->options = $repository->get_options();
    3636        $this->version = $repository->get_config()->get_version();
    37         $this->register_activation();
    38         $this->register_deactivation();
    3937        $this->create_update_action();
    4038    }
     
    9492     * @return void
    9593     */
    96     private function register_activation() : void {
    97         WordPress::register_activation_hook( GROW_PLUGIN_BASENAME, function () {
    98             WordPress::do_action( Activation::ACTIVATION_HOOK );
    99         } );
     94    public function register_activation() : void {
     95        WordPress::do_action( Activation::ACTIVATION_HOOK );
    10096    }
    10197
     
    105101     * @return void
    106102     */
    107     private function register_deactivation() : void {
    108         WordPress::register_deactivation_hook( GROW_PLUGIN_BASENAME, function () {
    109             WordPress::do_action( Activation::DEACTIVATION_HOOK );
    110         } );
     103    public function register_deactivation() : void {
     104        WordPress::do_action( Activation::DEACTIVATION_HOOK );
    111105    }
    112106}
  • grow-for-wp/tags/1.1.0/inc/Grow/WordPressLifecycleInterface.php

    r2980893 r3049246  
    2121     */
    2222    public function collect_many( array $classes): void;
     23
     24    /**
     25     * Registers and creates a hook to be run when plugin is activated
     26     *
     27     * @return void
     28     */
     29    public function register_activation() : void;
     30
     31    /**
     32     * Register and create a hook to be run when plugin is deactivated
     33     *
     34     * @return void
     35     */
     36    public function register_deactivation() : void;
    2337}
  • grow-for-wp/tags/1.1.0/readme.txt

    r2980898 r3049246  
    33Tags: social, sharing, grow, subscribe
    44Requires at least: 5.2
    5 Tested up to: 6.3.2
     5Tested up to: 6.4.2
    66Requires PHP: 7.4
    7 Stable tag: 1.0.0
     7Stable tag: 1.1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    102102
    103103== Changelog ==
    104 
    105 = 1.0.0 =
    106 - Plugin released.
     104- See changelog.txt
  • grow-for-wp/tags/1.1.0/vendor/autoload.php

    r2980893 r3049246  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInitd5c7d34d5dc2d28dcc3e3440918ed5d0::getLoader();
     25return ComposerAutoloaderInit9af5da13f4403eb9f79d593b10f1a97e::getLoader();
  • grow-for-wp/tags/1.1.0/vendor/composer/ClassLoader.php

    r2980893 r3049246  
    4646    private static $includeFile;
    4747
    48     /** @var string|null */
     48    /** @var ?string */
    4949    private $vendorDir;
    5050
    5151    // PSR-4
    5252    /**
    53      * @var array<string, array<string, int>>
     53     * @var array[]
     54     * @psalm-var array<string, array<string, int>>
    5455     */
    5556    private $prefixLengthsPsr4 = array();
    5657    /**
    57      * @var array<string, list<string>>
     58     * @var array[]
     59     * @psalm-var array<string, array<int, string>>
    5860     */
    5961    private $prefixDirsPsr4 = array();
    6062    /**
    61      * @var list<string>
     63     * @var array[]
     64     * @psalm-var array<string, string>
    6265     */
    6366    private $fallbackDirsPsr4 = array();
     
    6568    // PSR-0
    6669    /**
    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>>>
     70     * @var array[]
     71     * @psalm-var array<string, array<string, string[]>>
    7272     */
    7373    private $prefixesPsr0 = array();
    7474    /**
    75      * @var list<string>
     75     * @var array[]
     76     * @psalm-var array<string, string>
    7677     */
    7778    private $fallbackDirsPsr0 = array();
     
    8182
    8283    /**
    83      * @var array<string, string>
     84     * @var string[]
     85     * @psalm-var array<string, string>
    8486     */
    8587    private $classMap = array();
     
    8991
    9092    /**
    91      * @var array<string, bool>
     93     * @var bool[]
     94     * @psalm-var array<string, bool>
    9295     */
    9396    private $missingClasses = array();
    9497
    95     /** @var string|null */
     98    /** @var ?string */
    9699    private $apcuPrefix;
    97100
    98101    /**
    99      * @var array<string, self>
     102     * @var self[]
    100103     */
    101104    private static $registeredLoaders = array();
    102105
    103106    /**
    104      * @param string|null $vendorDir
     107     * @param ?string $vendorDir
    105108     */
    106109    public function __construct($vendorDir = null)
     
    111114
    112115    /**
    113      * @return array<string, list<string>>
     116     * @return string[]
    114117     */
    115118    public function getPrefixes()
     
    123126
    124127    /**
    125      * @return array<string, list<string>>
     128     * @return array[]
     129     * @psalm-return array<string, array<int, string>>
    126130     */
    127131    public function getPrefixesPsr4()
     
    131135
    132136    /**
    133      * @return list<string>
     137     * @return array[]
     138     * @psalm-return array<string, string>
    134139     */
    135140    public function getFallbackDirs()
     
    139144
    140145    /**
    141      * @return list<string>
     146     * @return array[]
     147     * @psalm-return array<string, string>
    142148     */
    143149    public function getFallbackDirsPsr4()
     
    147153
    148154    /**
    149      * @return array<string, string> Array of classname => path
     155     * @return string[] Array of classname => path
     156     * @psalm-return array<string, string>
    150157     */
    151158    public function getClassMap()
     
    155162
    156163    /**
    157      * @param array<string, string> $classMap Class to filename map
     164     * @param string[] $classMap Class to filename map
     165     * @psalm-param array<string, string> $classMap
    158166     *
    159167     * @return void
     
    172180     * appending or prepending to the ones previously set for this prefix.
    173181     *
    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
     182     * @param string          $prefix  The prefix
     183     * @param string[]|string $paths   The PSR-0 root directories
     184     * @param bool            $prepend Whether to prepend the directories
    177185     *
    178186     * @return void
     
    180188    public function add($prefix, $paths, $prepend = false)
    181189    {
    182         $paths = (array) $paths;
    183190        if (!$prefix) {
    184191            if ($prepend) {
    185192                $this->fallbackDirsPsr0 = array_merge(
    186                     $paths,
     193                    (array) $paths,
    187194                    $this->fallbackDirsPsr0
    188195                );
     
    190197                $this->fallbackDirsPsr0 = array_merge(
    191198                    $this->fallbackDirsPsr0,
    192                     $paths
     199                    (array) $paths
    193200                );
    194201            }
     
    199206        $first = $prefix[0];
    200207        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    201             $this->prefixesPsr0[$first][$prefix] = $paths;
     208            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
    202209
    203210            return;
     
    205212        if ($prepend) {
    206213            $this->prefixesPsr0[$first][$prefix] = array_merge(
    207                 $paths,
     214                (array) $paths,
    208215                $this->prefixesPsr0[$first][$prefix]
    209216            );
     
    211218            $this->prefixesPsr0[$first][$prefix] = array_merge(
    212219                $this->prefixesPsr0[$first][$prefix],
    213                 $paths
     220                (array) $paths
    214221            );
    215222        }
     
    220227     * appending or prepending to the ones previously set for this namespace.
    221228     *
    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
     229     * @param string          $prefix  The prefix/namespace, with trailing '\\'
     230     * @param string[]|string $paths   The PSR-4 base directories
     231     * @param bool            $prepend Whether to prepend the directories
    225232     *
    226233     * @throws \InvalidArgumentException
     
    230237    public function addPsr4($prefix, $paths, $prepend = false)
    231238    {
    232         $paths = (array) $paths;
    233239        if (!$prefix) {
    234240            // Register directories for the root namespace.
    235241            if ($prepend) {
    236242                $this->fallbackDirsPsr4 = array_merge(
    237                     $paths,
     243                    (array) $paths,
    238244                    $this->fallbackDirsPsr4
    239245                );
     
    241247                $this->fallbackDirsPsr4 = array_merge(
    242248                    $this->fallbackDirsPsr4,
    243                     $paths
     249                    (array) $paths
    244250                );
    245251            }
     
    251257            }
    252258            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    253             $this->prefixDirsPsr4[$prefix] = $paths;
     259            $this->prefixDirsPsr4[$prefix] = (array) $paths;
    254260        } elseif ($prepend) {
    255261            // Prepend directories for an already registered namespace.
    256262            $this->prefixDirsPsr4[$prefix] = array_merge(
    257                 $paths,
     263                (array) $paths,
    258264                $this->prefixDirsPsr4[$prefix]
    259265            );
     
    262268            $this->prefixDirsPsr4[$prefix] = array_merge(
    263269                $this->prefixDirsPsr4[$prefix],
    264                 $paths
     270                (array) $paths
    265271            );
    266272        }
     
    271277     * replacing any others previously set for this prefix.
    272278     *
    273      * @param string              $prefix The prefix
    274      * @param list<string>|string $paths  The PSR-0 base directories
     279     * @param string          $prefix The prefix
     280     * @param string[]|string $paths  The PSR-0 base directories
    275281     *
    276282     * @return void
     
    289295     * replacing any others previously set for this namespace.
    290296     *
    291      * @param string              $prefix The prefix/namespace, with trailing '\\'
    292      * @param list<string>|string $paths  The PSR-4 base directories
     297     * @param string          $prefix The prefix/namespace, with trailing '\\'
     298     * @param string[]|string $paths  The PSR-4 base directories
    293299     *
    294300     * @throws \InvalidArgumentException
     
    424430    {
    425431        if ($file = $this->findFile($class)) {
    426             $includeFile = self::$includeFile;
    427             $includeFile($file);
     432            (self::$includeFile)($file);
    428433
    429434            return true;
     
    476481
    477482    /**
    478      * Returns the currently registered loaders keyed by their corresponding vendor directories.
    479      *
    480      * @return array<string, self>
     483     * Returns the currently registered loaders indexed by their corresponding vendor directories.
     484     *
     485     * @return self[]
    481486     */
    482487    public static function getRegisteredLoaders()
     
    556561    }
    557562
    558     /**
    559      * @return void
    560      */
    561     private static function initializeIncludeClosure()
     563    private static function initializeIncludeClosure(): void
    562564    {
    563565        if (self::$includeFile !== null) {
     
    573575         * @return void
    574576         */
    575         self::$includeFile = \Closure::bind(static function($file) {
     577        self::$includeFile = static function($file) {
    576578            include $file;
    577         }, null, null);
     579        };
    578580    }
    579581}
  • grow-for-wp/tags/1.1.0/vendor/composer/InstalledVersions.php

    r2980893 r3049246  
    9999        foreach (self::getInstalled() as $installed) {
    100100            if (isset($installed['versions'][$packageName])) {
    101                 return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
     101                return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
    102102            }
    103103        }
     
    120120    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    121121    {
    122         $constraint = $parser->parseConstraints((string) $constraint);
     122        $constraint = $parser->parseConstraints($constraint);
    123123        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    124124
     
    329329                    $installed[] = self::$installedByVendor[$vendorDir];
    330330                } 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;
     331                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    334332                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335333                        self::$installed = $installed[count($installed) - 1];
     
    343341            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    344342            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;
     343                self::$installed = require __DIR__ . '/installed.php';
    348344            } else {
    349345                self::$installed = array();
    350346            }
    351347        }
    352 
    353         if (self::$installed !== array()) {
    354             $installed[] = self::$installed;
    355         }
     348        $installed[] = self::$installed;
    356349
    357350        return $installed;
  • grow-for-wp/tags/1.1.0/vendor/composer/autoload_classmap.php

    r2980893 r3049246  
    3838    'Grow\\SettingsAPIController' => $baseDir . '/inc/Grow/SettingsAPIController.php',
    3939    'Grow\\StatusAPIController' => $baseDir . '/inc/Grow/StatusAPIController.php',
     40    'Grow\\Tests\\Integration\\TestContent' => $baseDir . '/inc/Grow/Tests/Integration/TestContent.php',
     41    'Grow\\Tests\\Integration\\TestEndpoint' => $baseDir . '/inc/Grow/Tests/Integration/TestEndpoint.php',
     42    'Grow\\Tests\\Integration\\TestFrontendData' => $baseDir . '/inc/Grow/Tests/Integration/TestFrontendData.php',
     43    'Grow\\Tests\\Integration\\TestSettingsAPIController' => $baseDir . '/inc/Grow/Tests/Integration/TestSettingsAPIController.php',
     44    'Grow\\Tests\\Integration\\TestStatusAPIController' => $baseDir . '/inc/Grow/Tests/Integration/TestStatusAPIController.php',
     45    'Grow\\Tests\\Integration\\TestWordPress' => $baseDir . '/inc/Grow/Tests/Integration/TestWordPress.php',
     46    'Grow\\Tests\\Unit\\TestActivation' => $baseDir . '/inc/Grow/Tests/Unit/TestActivation.php',
     47    'Grow\\Tests\\Unit\\TestAdminPage' => $baseDir . '/inc/Grow/Tests/Unit/TestAdminPage.php',
     48    'Grow\\Tests\\Unit\\TestAssetLoader' => $baseDir . '/inc/Grow/Tests/Unit/TestAssetLoader.php',
     49    'Grow\\Tests\\Unit\\TestGrowRemote' => $baseDir . '/inc/Grow/Tests/Unit/TestGrowRemote.php',
     50    'Grow\\Tests\\Unit\\TestHook' => $baseDir . '/inc/Grow/Tests/Unit/TestHook.php',
     51    'Grow\\Tests\\Unit\\TestOptions' => $baseDir . '/inc/Grow/Tests/Unit/TestOptions.php',
     52    'Grow\\Tests\\Unit\\TestPlugin' => $baseDir . '/inc/Grow/Tests/Unit/TestPlugin.php',
     53    'Grow\\Tests\\Unit\\TestUpdate' => $baseDir . '/inc/Grow/Tests/Unit/TestUpdate.php',
     54    'Grow\\Tests\\Unit\\TestViewLoader' => $baseDir . '/inc/Grow/Tests/Unit/TestViewLoader.php',
     55    'Grow\\Tests\\Unit\\TestWordPressLifecycle' => $baseDir . '/inc/Grow/Tests/Unit/TestWordPressLifecycle.php',
    4056    'Grow\\Update' => $baseDir . '/inc/Grow/Update.php',
    4157    'Grow\\Views\\ViewLoader' => $baseDir . '/inc/Grow/Views/ViewLoader.php',
  • grow-for-wp/tags/1.1.0/vendor/composer/autoload_real.php

    r2980893 r3049246  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitd5c7d34d5dc2d28dcc3e3440918ed5d0
     5class ComposerAutoloaderInit9af5da13f4403eb9f79d593b10f1a97e
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInitd5c7d34d5dc2d28dcc3e3440918ed5d0', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInit9af5da13f4403eb9f79d593b10f1a97e', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    27         spl_autoload_unregister(array('ComposerAutoloaderInitd5c7d34d5dc2d28dcc3e3440918ed5d0', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInit9af5da13f4403eb9f79d593b10f1a97e', 'loadClassLoader'));
    2828
    2929        require __DIR__ . '/autoload_static.php';
    30         call_user_func(\Composer\Autoload\ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0::getInitializer($loader));
     30        call_user_func(\Composer\Autoload\ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e::getInitializer($loader));
    3131
    3232        $loader->register(true);
  • grow-for-wp/tags/1.1.0/vendor/composer/autoload_static.php

    r2980893 r3049246  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0
     7class ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    5353        'Grow\\SettingsAPIController' => __DIR__ . '/../..' . '/inc/Grow/SettingsAPIController.php',
    5454        'Grow\\StatusAPIController' => __DIR__ . '/../..' . '/inc/Grow/StatusAPIController.php',
     55        'Grow\\Tests\\Integration\\TestContent' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestContent.php',
     56        'Grow\\Tests\\Integration\\TestEndpoint' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestEndpoint.php',
     57        'Grow\\Tests\\Integration\\TestFrontendData' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestFrontendData.php',
     58        'Grow\\Tests\\Integration\\TestSettingsAPIController' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestSettingsAPIController.php',
     59        'Grow\\Tests\\Integration\\TestStatusAPIController' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestStatusAPIController.php',
     60        'Grow\\Tests\\Integration\\TestWordPress' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestWordPress.php',
     61        'Grow\\Tests\\Unit\\TestActivation' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestActivation.php',
     62        'Grow\\Tests\\Unit\\TestAdminPage' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestAdminPage.php',
     63        'Grow\\Tests\\Unit\\TestAssetLoader' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestAssetLoader.php',
     64        'Grow\\Tests\\Unit\\TestGrowRemote' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestGrowRemote.php',
     65        'Grow\\Tests\\Unit\\TestHook' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestHook.php',
     66        'Grow\\Tests\\Unit\\TestOptions' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestOptions.php',
     67        'Grow\\Tests\\Unit\\TestPlugin' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestPlugin.php',
     68        'Grow\\Tests\\Unit\\TestUpdate' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestUpdate.php',
     69        'Grow\\Tests\\Unit\\TestViewLoader' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestViewLoader.php',
     70        'Grow\\Tests\\Unit\\TestWordPressLifecycle' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestWordPressLifecycle.php',
    5571        'Grow\\Update' => __DIR__ . '/../..' . '/inc/Grow/Update.php',
    5672        'Grow\\Views\\ViewLoader' => __DIR__ . '/../..' . '/inc/Grow/Views/ViewLoader.php',
     
    6480    {
    6581        return \Closure::bind(function () use ($loader) {
    66             $loader->prefixLengthsPsr4 = ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0::$prefixLengthsPsr4;
    67             $loader->prefixDirsPsr4 = ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0::$prefixDirsPsr4;
    68             $loader->classMap = ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0::$classMap;
     82            $loader->prefixLengthsPsr4 = ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e::$prefixLengthsPsr4;
     83            $loader->prefixDirsPsr4 = ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e::$prefixDirsPsr4;
     84            $loader->classMap = ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e::$classMap;
    6985
    7086        }, null, ClassLoader::class);
  • grow-for-wp/tags/1.1.0/vendor/composer/installed.php

    r2980893 r3049246  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'eeaa6b1e5efaa243b511da71ce66086513c30254',
     6        'reference' => 'd05e3d2f53f120e72365e931a93103193bfd3bca',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'eeaa6b1e5efaa243b511da71ce66086513c30254',
     16            'reference' => 'd05e3d2f53f120e72365e931a93103193bfd3bca',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • grow-for-wp/trunk/changelog.txt

    r2980893 r3049246  
    11# Changelog
     2
     3## 1.1.0 - 2024-03-11
     4 - Automatically redirect to Grow login page on activation.
    25
    36## 1.0.0 - 2023-10-18
     
    2629 - Fix Frontent Test
    2730
    28 
    29 ## 1.0.0 - 2023-10-18
    30 
    31 
    32 
    33 ## 0.1.7 - 2023-08-11
     31## 0.1.7 - 2023-08-11
    3432  * fix: Adjust Typography on Settings Page
    3533  * fix: Bigger Images for Settings Page
     
    3937  * fix: Open Help Doc Links in New Tab
    4038
    41 ## 0.1.5 - 2023-07-10 
     39## 0.1.5 - 2023-07-10
    4240  * fix: Open Authenticated Link in new tab
    4341  * chore: Add Test for Authenticated View
     
    4644 * chore: Remove Author URI
    4745
    48 ## 0.1.3 - 2023-06-23 
     46## 0.1.3 - 2023-06-23
    4947 * chore: Name changed to Grow for WP
    5048
  • grow-for-wp/trunk/constants.php

    r2980893 r3049246  
    66
    77// Environment setup.
     8define('GROW_PLUGIN_FILE', __DIR__ . '/grow-for-wp.php');
    89define('GROW_PLUGIN_BASENAME', plugin_basename(__DIR__ . '/grow-for-wp.php'));
    910define('GROW_PLUGIN_DIR', __DIR__);
  • grow-for-wp/trunk/grow-for-wp.php

    r2980893 r3049246  
    44 * Plugin URI:          https://grow.me/publishers
    55 * Description:         Integrate your WordPress Site with Grow
    6  * Version:             1.0.0
     6 * Version:             1.1.0
    77 * Requires at least:   5.2
    88 * Requires PHP:        7.4
  • grow-for-wp/trunk/inc/Grow/Activation.php

    r2980893 r3049246  
    3131        $this->options = $repository->get_options();
    3232        $this->version = $repository->get_config()->get_version();
    33         $this->actions = [ new HookArguments( self::ACTIVATION_HOOK, 'run' ) ];
     33        $this->actions = [
     34            new HookArguments( self::ACTIVATION_HOOK, 'run' ),
     35            new HookArguments( 'admin_init', 'redirect_after_activation' ),
     36        ];
    3437    }
    3538
     
    4750            $this->options->set_grow_first_install_version( $this->version );
    4851        }
     52
     53        if ( $this->can_redirect_after_activation() ) {
     54            // Set flag here to auto-redirect to settings next WP cycle.
     55            $this->options->set_grow_should_redirect_after_activation( '1' );
     56        }
     57    }
     58
     59    /**
     60     * Handles redirecting to the settings page directly after the plugin has been enabled.
     61     */
     62    public function redirect_after_activation() : void {
     63        if ( empty( $this->options->get_grow_should_redirect_after_activation() ) ) {
     64            return;
     65        }
     66
     67        if ( ! WordPress::is_admin() ) {
     68            return;
     69        }
     70
     71        $this->options->set_grow_should_redirect_after_activation( '' );
     72        //phpcs:disable WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit
     73        WordPress::wp_safe_redirect( WordPress::esc_url( WordPress::admin_url( 'admin.php?page=' . AdminPage::MENU_SLUG ) ) );
     74        if ( ! defined( 'GROW_TEST_MODE' ) ) {
     75            exit;
     76        }
     77    }
     78
     79    /**
     80     * Verifies that a redirect after activation is possible.
     81     *
     82     * @return bool
     83     */
     84    public function can_redirect_after_activation() : bool {
     85        // Don't redirect on multi-site install.
     86        if ( WordPress::is_network_admin() ) {
     87            return false;
     88        }
     89
     90        // Don't redirect if this was activated as part of a bulk-enable.
     91        $maybe_multi = filter_input( INPUT_GET, 'activate-multi', FILTER_VALIDATE_BOOLEAN );
     92        if ( $maybe_multi ) {
     93            return false;
     94        }
     95
     96        return true;
    4997    }
    5098}
  • grow-for-wp/trunk/inc/Grow/AdminPage.php

    r2980893 r3049246  
    1515    private const PAGE_TITLE = 'Grow';
    1616
    17     private const MENU_SLUG = 'grow';
     17    public const MENU_SLUG = 'grow';
    1818
    1919    private const CAPABILITY_LEVEL = 'manage_options';
  • grow-for-wp/trunk/inc/Grow/Options.php

    r2980893 r3049246  
    112112
    113113    /**
     114     * @param string $default Value to return if the stored value is empty
     115     * @param bool   $force check the database again even if we have a value in memoryd value is empty
     116     *
     117     * @return string
     118     */
     119    public function get_grow_should_redirect_after_activation( string $default = '', bool $force = false ) : string {
     120        return strval($this->get( 'grow_just_activated', $default, $force ));
     121    }
     122
     123    /**
     124     * @param string $value New value to set
     125     *
     126     * @return bool
     127     */
     128    public function set_grow_should_redirect_after_activation( string $value ) : bool {
     129        return $this->set( 'grow_just_activated', $value );
     130    }
     131
     132    /**
    114133     * @param string $key Key for the option to set
    115134     * @param string $value New value to set
  • grow-for-wp/trunk/inc/Grow/OptionsInterface.php

    r2980893 r3049246  
    6363     */
    6464    public function set_grow_first_install_version( string $value ) : bool;
     65
     66    /**
     67     * @param string $default the default value to get if the property is empty
     68     * @param bool   $force check the database again even if we have a value in memory
     69     *
     70     * @return string
     71     */
     72    public function get_grow_should_redirect_after_activation( string $default = '', bool $force = false) : string;
     73
     74    /**
     75     * @param string $value New value to set
     76     *
     77     * @return bool
     78     */
     79    public function set_grow_should_redirect_after_activation( string $value ) : bool;
    6580}
  • grow-for-wp/trunk/inc/Grow/Plugin.php

    r2980893 r3049246  
    1515
    1616    /** @var string|null VERSION */
    17     const VERSION = '1.0.0';
     17    const VERSION = '1.1.0';
    1818
    1919    /** @var Repository */
     
    2929     */
    3030    public function __construct() {
     31        WordPress::register_activation_hook( GROW_PLUGIN_FILE, [ $this, 'register_activation' ] );
     32        WordPress::register_deactivation_hook( GROW_PLUGIN_FILE, [ $this, 'register_deactivation' ] );
    3133        WordPress::add_action('plugins_loaded', [ $this, 'main' ]);
    3234    }
     
    98100    }
    99101
     102    /**
     103     * Handles plugin activation.
     104     *
     105     * @return void
     106     */
     107    public function register_activation() {
     108        if ( empty( $this->wordpress_lifecycle ) ) {
     109            $this->main();
     110        }
     111        $this->wordpress_lifecycle->register_activation();
     112    }
     113
     114    /**
     115     * Handles plugin deactivation.
     116     *
     117     * @return void
     118     */
     119    public function register_deactivation() {
     120        if ( empty( $this->wordpress_lifecycle ) ) {
     121            $this->main();
     122        }
     123        $this->wordpress_lifecycle->register_deactivation();
     124    }
     125
    100126
    101127}
  • grow-for-wp/trunk/inc/Grow/WordPress.php

    r2980893 r3049246  
    330330        return admin_url( $path, $scheme );
    331331    }
     332
     333    /**
     334     * Performs a safe (local) redirect, using wp_redirect().
     335     *
     336     * Checks whether the $location is using an allowed host, if it has an absolute
     337     * path. A plugin can therefore set or remove allowed host(s) to or from the
     338     * list.
     339     *
     340     * If the host is not allowed, then the redirect defaults to wp-admin on the siteurl
     341     * instead. This prevents malicious redirects which redirect to another host,
     342     * but only used in a few places.
     343     *
     344     * Note: wp_safe_redirect() does not exit automatically, and should almost always be
     345     * followed by a call to `exit;`:
     346     *
     347     *     wp_safe_redirect( $url );
     348     *     exit;
     349     *
     350     * Exiting can also be selectively manipulated by using wp_safe_redirect() as a conditional
     351     * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_status'} filters:
     352     *
     353     *     if ( wp_safe_redirect( $url ) ) {
     354     *         exit;
     355     *     }
     356     *
     357     * @since 2.3.0
     358     * @since 5.1.0 The return value from wp_redirect() is now passed on, and the `$x_redirect_by` parameter was added.
     359     *
     360     * @param string $location      The path or URL to redirect to.
     361     * @param int    $status        Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
     362     * @param string $x_redirect_by Optional. The application doing the redirect. Default 'WordPress'.
     363     * @return bool False if the redirect was canceled, true otherwise.
     364     */
     365    public static function wp_safe_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) { //phpcs:disable WordPressVIPMinimum.Security.ExitAfterRedirect.NoExitInConditional
     366        //phpcs:disable WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit
     367        return wp_safe_redirect( $location, $status, $x_redirect_by );
     368    }
     369
     370    /**
     371     * Determines whether the current request is for an administrative interface page.
     372     *
     373     * Does not check if the user is an administrator; use current_user_can()
     374     * for checking roles and capabilities.
     375     *
     376     * For more information on this and similar theme functions, check out
     377     * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
     378     * Conditional Tags} article in the Theme Developer Handbook.
     379     *
     380     * @since 1.5.1
     381     *
     382     * @global \WP_Screen $current_screen WordPress current screen object.
     383     *
     384     * @return bool True if inside WordPress administration interface, false otherwise.
     385     */
     386    public static function is_admin() {
     387        return is_admin();
     388    }
     389
     390    /**
     391     * Determines whether the current request is for the network administrative interface.
     392     *
     393     * Does not check if the user is an administrator; use current_user_can()
     394     * for checking roles and capabilities.
     395     *
     396     * Does not check if the site is a Multisite network; use is_multisite()
     397     * for checking if Multisite is enabled.
     398     *
     399     * @since 3.1.0
     400     *
     401     * @global \WP_Screen $current_screen WordPress current screen object.
     402     *
     403     * @return bool True if inside WordPress network administration pages.
     404     */
     405    public static function is_network_admin() {
     406        return is_network_admin();
     407    }
    332408}
  • grow-for-wp/trunk/inc/Grow/WordPressLifecycle.php

    r2980893 r3049246  
    3535        $this->options = $repository->get_options();
    3636        $this->version = $repository->get_config()->get_version();
    37         $this->register_activation();
    38         $this->register_deactivation();
    3937        $this->create_update_action();
    4038    }
     
    9492     * @return void
    9593     */
    96     private function register_activation() : void {
    97         WordPress::register_activation_hook( GROW_PLUGIN_BASENAME, function () {
    98             WordPress::do_action( Activation::ACTIVATION_HOOK );
    99         } );
     94    public function register_activation() : void {
     95        WordPress::do_action( Activation::ACTIVATION_HOOK );
    10096    }
    10197
     
    105101     * @return void
    106102     */
    107     private function register_deactivation() : void {
    108         WordPress::register_deactivation_hook( GROW_PLUGIN_BASENAME, function () {
    109             WordPress::do_action( Activation::DEACTIVATION_HOOK );
    110         } );
     103    public function register_deactivation() : void {
     104        WordPress::do_action( Activation::DEACTIVATION_HOOK );
    111105    }
    112106}
  • grow-for-wp/trunk/inc/Grow/WordPressLifecycleInterface.php

    r2980893 r3049246  
    2121     */
    2222    public function collect_many( array $classes): void;
     23
     24    /**
     25     * Registers and creates a hook to be run when plugin is activated
     26     *
     27     * @return void
     28     */
     29    public function register_activation() : void;
     30
     31    /**
     32     * Register and create a hook to be run when plugin is deactivated
     33     *
     34     * @return void
     35     */
     36    public function register_deactivation() : void;
    2337}
  • grow-for-wp/trunk/readme.txt

    r2980898 r3049246  
    33Tags: social, sharing, grow, subscribe
    44Requires at least: 5.2
    5 Tested up to: 6.3.2
     5Tested up to: 6.4.2
    66Requires PHP: 7.4
    7 Stable tag: 1.0.0
     7Stable tag: 1.1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    102102
    103103== Changelog ==
    104 
    105 = 1.0.0 =
    106 - Plugin released.
     104- See changelog.txt
  • grow-for-wp/trunk/vendor/autoload.php

    r2980893 r3049246  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInitd5c7d34d5dc2d28dcc3e3440918ed5d0::getLoader();
     25return ComposerAutoloaderInit9af5da13f4403eb9f79d593b10f1a97e::getLoader();
  • grow-for-wp/trunk/vendor/composer/ClassLoader.php

    r2980893 r3049246  
    4646    private static $includeFile;
    4747
    48     /** @var string|null */
     48    /** @var ?string */
    4949    private $vendorDir;
    5050
    5151    // PSR-4
    5252    /**
    53      * @var array<string, array<string, int>>
     53     * @var array[]
     54     * @psalm-var array<string, array<string, int>>
    5455     */
    5556    private $prefixLengthsPsr4 = array();
    5657    /**
    57      * @var array<string, list<string>>
     58     * @var array[]
     59     * @psalm-var array<string, array<int, string>>
    5860     */
    5961    private $prefixDirsPsr4 = array();
    6062    /**
    61      * @var list<string>
     63     * @var array[]
     64     * @psalm-var array<string, string>
    6265     */
    6366    private $fallbackDirsPsr4 = array();
     
    6568    // PSR-0
    6669    /**
    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>>>
     70     * @var array[]
     71     * @psalm-var array<string, array<string, string[]>>
    7272     */
    7373    private $prefixesPsr0 = array();
    7474    /**
    75      * @var list<string>
     75     * @var array[]
     76     * @psalm-var array<string, string>
    7677     */
    7778    private $fallbackDirsPsr0 = array();
     
    8182
    8283    /**
    83      * @var array<string, string>
     84     * @var string[]
     85     * @psalm-var array<string, string>
    8486     */
    8587    private $classMap = array();
     
    8991
    9092    /**
    91      * @var array<string, bool>
     93     * @var bool[]
     94     * @psalm-var array<string, bool>
    9295     */
    9396    private $missingClasses = array();
    9497
    95     /** @var string|null */
     98    /** @var ?string */
    9699    private $apcuPrefix;
    97100
    98101    /**
    99      * @var array<string, self>
     102     * @var self[]
    100103     */
    101104    private static $registeredLoaders = array();
    102105
    103106    /**
    104      * @param string|null $vendorDir
     107     * @param ?string $vendorDir
    105108     */
    106109    public function __construct($vendorDir = null)
     
    111114
    112115    /**
    113      * @return array<string, list<string>>
     116     * @return string[]
    114117     */
    115118    public function getPrefixes()
     
    123126
    124127    /**
    125      * @return array<string, list<string>>
     128     * @return array[]
     129     * @psalm-return array<string, array<int, string>>
    126130     */
    127131    public function getPrefixesPsr4()
     
    131135
    132136    /**
    133      * @return list<string>
     137     * @return array[]
     138     * @psalm-return array<string, string>
    134139     */
    135140    public function getFallbackDirs()
     
    139144
    140145    /**
    141      * @return list<string>
     146     * @return array[]
     147     * @psalm-return array<string, string>
    142148     */
    143149    public function getFallbackDirsPsr4()
     
    147153
    148154    /**
    149      * @return array<string, string> Array of classname => path
     155     * @return string[] Array of classname => path
     156     * @psalm-return array<string, string>
    150157     */
    151158    public function getClassMap()
     
    155162
    156163    /**
    157      * @param array<string, string> $classMap Class to filename map
     164     * @param string[] $classMap Class to filename map
     165     * @psalm-param array<string, string> $classMap
    158166     *
    159167     * @return void
     
    172180     * appending or prepending to the ones previously set for this prefix.
    173181     *
    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
     182     * @param string          $prefix  The prefix
     183     * @param string[]|string $paths   The PSR-0 root directories
     184     * @param bool            $prepend Whether to prepend the directories
    177185     *
    178186     * @return void
     
    180188    public function add($prefix, $paths, $prepend = false)
    181189    {
    182         $paths = (array) $paths;
    183190        if (!$prefix) {
    184191            if ($prepend) {
    185192                $this->fallbackDirsPsr0 = array_merge(
    186                     $paths,
     193                    (array) $paths,
    187194                    $this->fallbackDirsPsr0
    188195                );
     
    190197                $this->fallbackDirsPsr0 = array_merge(
    191198                    $this->fallbackDirsPsr0,
    192                     $paths
     199                    (array) $paths
    193200                );
    194201            }
     
    199206        $first = $prefix[0];
    200207        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    201             $this->prefixesPsr0[$first][$prefix] = $paths;
     208            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
    202209
    203210            return;
     
    205212        if ($prepend) {
    206213            $this->prefixesPsr0[$first][$prefix] = array_merge(
    207                 $paths,
     214                (array) $paths,
    208215                $this->prefixesPsr0[$first][$prefix]
    209216            );
     
    211218            $this->prefixesPsr0[$first][$prefix] = array_merge(
    212219                $this->prefixesPsr0[$first][$prefix],
    213                 $paths
     220                (array) $paths
    214221            );
    215222        }
     
    220227     * appending or prepending to the ones previously set for this namespace.
    221228     *
    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
     229     * @param string          $prefix  The prefix/namespace, with trailing '\\'
     230     * @param string[]|string $paths   The PSR-4 base directories
     231     * @param bool            $prepend Whether to prepend the directories
    225232     *
    226233     * @throws \InvalidArgumentException
     
    230237    public function addPsr4($prefix, $paths, $prepend = false)
    231238    {
    232         $paths = (array) $paths;
    233239        if (!$prefix) {
    234240            // Register directories for the root namespace.
    235241            if ($prepend) {
    236242                $this->fallbackDirsPsr4 = array_merge(
    237                     $paths,
     243                    (array) $paths,
    238244                    $this->fallbackDirsPsr4
    239245                );
     
    241247                $this->fallbackDirsPsr4 = array_merge(
    242248                    $this->fallbackDirsPsr4,
    243                     $paths
     249                    (array) $paths
    244250                );
    245251            }
     
    251257            }
    252258            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    253             $this->prefixDirsPsr4[$prefix] = $paths;
     259            $this->prefixDirsPsr4[$prefix] = (array) $paths;
    254260        } elseif ($prepend) {
    255261            // Prepend directories for an already registered namespace.
    256262            $this->prefixDirsPsr4[$prefix] = array_merge(
    257                 $paths,
     263                (array) $paths,
    258264                $this->prefixDirsPsr4[$prefix]
    259265            );
     
    262268            $this->prefixDirsPsr4[$prefix] = array_merge(
    263269                $this->prefixDirsPsr4[$prefix],
    264                 $paths
     270                (array) $paths
    265271            );
    266272        }
     
    271277     * replacing any others previously set for this prefix.
    272278     *
    273      * @param string              $prefix The prefix
    274      * @param list<string>|string $paths  The PSR-0 base directories
     279     * @param string          $prefix The prefix
     280     * @param string[]|string $paths  The PSR-0 base directories
    275281     *
    276282     * @return void
     
    289295     * replacing any others previously set for this namespace.
    290296     *
    291      * @param string              $prefix The prefix/namespace, with trailing '\\'
    292      * @param list<string>|string $paths  The PSR-4 base directories
     297     * @param string          $prefix The prefix/namespace, with trailing '\\'
     298     * @param string[]|string $paths  The PSR-4 base directories
    293299     *
    294300     * @throws \InvalidArgumentException
     
    424430    {
    425431        if ($file = $this->findFile($class)) {
    426             $includeFile = self::$includeFile;
    427             $includeFile($file);
     432            (self::$includeFile)($file);
    428433
    429434            return true;
     
    476481
    477482    /**
    478      * Returns the currently registered loaders keyed by their corresponding vendor directories.
    479      *
    480      * @return array<string, self>
     483     * Returns the currently registered loaders indexed by their corresponding vendor directories.
     484     *
     485     * @return self[]
    481486     */
    482487    public static function getRegisteredLoaders()
     
    556561    }
    557562
    558     /**
    559      * @return void
    560      */
    561     private static function initializeIncludeClosure()
     563    private static function initializeIncludeClosure(): void
    562564    {
    563565        if (self::$includeFile !== null) {
     
    573575         * @return void
    574576         */
    575         self::$includeFile = \Closure::bind(static function($file) {
     577        self::$includeFile = static function($file) {
    576578            include $file;
    577         }, null, null);
     579        };
    578580    }
    579581}
  • grow-for-wp/trunk/vendor/composer/InstalledVersions.php

    r2980893 r3049246  
    9999        foreach (self::getInstalled() as $installed) {
    100100            if (isset($installed['versions'][$packageName])) {
    101                 return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
     101                return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
    102102            }
    103103        }
     
    120120    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    121121    {
    122         $constraint = $parser->parseConstraints((string) $constraint);
     122        $constraint = $parser->parseConstraints($constraint);
    123123        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    124124
     
    329329                    $installed[] = self::$installedByVendor[$vendorDir];
    330330                } 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;
     331                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    334332                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335333                        self::$installed = $installed[count($installed) - 1];
     
    343341            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    344342            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;
     343                self::$installed = require __DIR__ . '/installed.php';
    348344            } else {
    349345                self::$installed = array();
    350346            }
    351347        }
    352 
    353         if (self::$installed !== array()) {
    354             $installed[] = self::$installed;
    355         }
     348        $installed[] = self::$installed;
    356349
    357350        return $installed;
  • grow-for-wp/trunk/vendor/composer/autoload_classmap.php

    r2980893 r3049246  
    3838    'Grow\\SettingsAPIController' => $baseDir . '/inc/Grow/SettingsAPIController.php',
    3939    'Grow\\StatusAPIController' => $baseDir . '/inc/Grow/StatusAPIController.php',
     40    'Grow\\Tests\\Integration\\TestContent' => $baseDir . '/inc/Grow/Tests/Integration/TestContent.php',
     41    'Grow\\Tests\\Integration\\TestEndpoint' => $baseDir . '/inc/Grow/Tests/Integration/TestEndpoint.php',
     42    'Grow\\Tests\\Integration\\TestFrontendData' => $baseDir . '/inc/Grow/Tests/Integration/TestFrontendData.php',
     43    'Grow\\Tests\\Integration\\TestSettingsAPIController' => $baseDir . '/inc/Grow/Tests/Integration/TestSettingsAPIController.php',
     44    'Grow\\Tests\\Integration\\TestStatusAPIController' => $baseDir . '/inc/Grow/Tests/Integration/TestStatusAPIController.php',
     45    'Grow\\Tests\\Integration\\TestWordPress' => $baseDir . '/inc/Grow/Tests/Integration/TestWordPress.php',
     46    'Grow\\Tests\\Unit\\TestActivation' => $baseDir . '/inc/Grow/Tests/Unit/TestActivation.php',
     47    'Grow\\Tests\\Unit\\TestAdminPage' => $baseDir . '/inc/Grow/Tests/Unit/TestAdminPage.php',
     48    'Grow\\Tests\\Unit\\TestAssetLoader' => $baseDir . '/inc/Grow/Tests/Unit/TestAssetLoader.php',
     49    'Grow\\Tests\\Unit\\TestGrowRemote' => $baseDir . '/inc/Grow/Tests/Unit/TestGrowRemote.php',
     50    'Grow\\Tests\\Unit\\TestHook' => $baseDir . '/inc/Grow/Tests/Unit/TestHook.php',
     51    'Grow\\Tests\\Unit\\TestOptions' => $baseDir . '/inc/Grow/Tests/Unit/TestOptions.php',
     52    'Grow\\Tests\\Unit\\TestPlugin' => $baseDir . '/inc/Grow/Tests/Unit/TestPlugin.php',
     53    'Grow\\Tests\\Unit\\TestUpdate' => $baseDir . '/inc/Grow/Tests/Unit/TestUpdate.php',
     54    'Grow\\Tests\\Unit\\TestViewLoader' => $baseDir . '/inc/Grow/Tests/Unit/TestViewLoader.php',
     55    'Grow\\Tests\\Unit\\TestWordPressLifecycle' => $baseDir . '/inc/Grow/Tests/Unit/TestWordPressLifecycle.php',
    4056    'Grow\\Update' => $baseDir . '/inc/Grow/Update.php',
    4157    'Grow\\Views\\ViewLoader' => $baseDir . '/inc/Grow/Views/ViewLoader.php',
  • grow-for-wp/trunk/vendor/composer/autoload_real.php

    r2980893 r3049246  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitd5c7d34d5dc2d28dcc3e3440918ed5d0
     5class ComposerAutoloaderInit9af5da13f4403eb9f79d593b10f1a97e
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInitd5c7d34d5dc2d28dcc3e3440918ed5d0', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInit9af5da13f4403eb9f79d593b10f1a97e', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    27         spl_autoload_unregister(array('ComposerAutoloaderInitd5c7d34d5dc2d28dcc3e3440918ed5d0', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInit9af5da13f4403eb9f79d593b10f1a97e', 'loadClassLoader'));
    2828
    2929        require __DIR__ . '/autoload_static.php';
    30         call_user_func(\Composer\Autoload\ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0::getInitializer($loader));
     30        call_user_func(\Composer\Autoload\ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e::getInitializer($loader));
    3131
    3232        $loader->register(true);
  • grow-for-wp/trunk/vendor/composer/autoload_static.php

    r2980893 r3049246  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0
     7class ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    5353        'Grow\\SettingsAPIController' => __DIR__ . '/../..' . '/inc/Grow/SettingsAPIController.php',
    5454        'Grow\\StatusAPIController' => __DIR__ . '/../..' . '/inc/Grow/StatusAPIController.php',
     55        'Grow\\Tests\\Integration\\TestContent' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestContent.php',
     56        'Grow\\Tests\\Integration\\TestEndpoint' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestEndpoint.php',
     57        'Grow\\Tests\\Integration\\TestFrontendData' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestFrontendData.php',
     58        'Grow\\Tests\\Integration\\TestSettingsAPIController' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestSettingsAPIController.php',
     59        'Grow\\Tests\\Integration\\TestStatusAPIController' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestStatusAPIController.php',
     60        'Grow\\Tests\\Integration\\TestWordPress' => __DIR__ . '/../..' . '/inc/Grow/Tests/Integration/TestWordPress.php',
     61        'Grow\\Tests\\Unit\\TestActivation' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestActivation.php',
     62        'Grow\\Tests\\Unit\\TestAdminPage' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestAdminPage.php',
     63        'Grow\\Tests\\Unit\\TestAssetLoader' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestAssetLoader.php',
     64        'Grow\\Tests\\Unit\\TestGrowRemote' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestGrowRemote.php',
     65        'Grow\\Tests\\Unit\\TestHook' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestHook.php',
     66        'Grow\\Tests\\Unit\\TestOptions' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestOptions.php',
     67        'Grow\\Tests\\Unit\\TestPlugin' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestPlugin.php',
     68        'Grow\\Tests\\Unit\\TestUpdate' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestUpdate.php',
     69        'Grow\\Tests\\Unit\\TestViewLoader' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestViewLoader.php',
     70        'Grow\\Tests\\Unit\\TestWordPressLifecycle' => __DIR__ . '/../..' . '/inc/Grow/Tests/Unit/TestWordPressLifecycle.php',
    5571        'Grow\\Update' => __DIR__ . '/../..' . '/inc/Grow/Update.php',
    5672        'Grow\\Views\\ViewLoader' => __DIR__ . '/../..' . '/inc/Grow/Views/ViewLoader.php',
     
    6480    {
    6581        return \Closure::bind(function () use ($loader) {
    66             $loader->prefixLengthsPsr4 = ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0::$prefixLengthsPsr4;
    67             $loader->prefixDirsPsr4 = ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0::$prefixDirsPsr4;
    68             $loader->classMap = ComposerStaticInitd5c7d34d5dc2d28dcc3e3440918ed5d0::$classMap;
     82            $loader->prefixLengthsPsr4 = ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e::$prefixLengthsPsr4;
     83            $loader->prefixDirsPsr4 = ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e::$prefixDirsPsr4;
     84            $loader->classMap = ComposerStaticInit9af5da13f4403eb9f79d593b10f1a97e::$classMap;
    6985
    7086        }, null, ClassLoader::class);
  • grow-for-wp/trunk/vendor/composer/installed.php

    r2980893 r3049246  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'eeaa6b1e5efaa243b511da71ce66086513c30254',
     6        'reference' => 'd05e3d2f53f120e72365e931a93103193bfd3bca',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'eeaa6b1e5efaa243b511da71ce66086513c30254',
     16            'reference' => 'd05e3d2f53f120e72365e931a93103193bfd3bca',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.