Plugin Directory

Changeset 3283684


Ignore:
Timestamp:
04/28/2025 10:04:41 PM (8 months ago)
Author:
claudiosanches
Message:

Tagging version 3.2.14.1

Location:
restrict-content/tags/3.2.14.1
Files:
5 added
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • restrict-content/tags/3.2.14.1/composer.json

    r3227065 r3283684  
    11{
    22    "name": "restrictcontent/restrict-content",
    3     "version": "3.2.14",
     3    "version": "3.2.14.1",
    44    "type": "wordpress-plugin",
    55    "description": "A simple, yet powerful membership solution for WordPress.",
     
    3939        "psr/container": "^1.0",
    4040        "stellarwp/container-contract": "^1.0",
    41         "stellarwp/telemetry": "^1.0.5"
     41        "stellarwp/telemetry": "2.3.4"
    4242    },
    4343    "autoload": {
     
    7070            "packages": [
    7171                "lucatume/di52",
    72                 "psr/container",
    7372                "stellarwp/container-contract",
    7473                "stellarwp/telemetry"
  • restrict-content/tags/3.2.14.1/core/includes/class-restrict-content.php

    r3227065 r3283684  
    2727     */
    2828    final class Restrict_Content_Pro {
    29         const VERSION = '3.5.45';
     29        const VERSION = '3.5.45.1';
    3030
    3131        /**
  • restrict-content/tags/3.2.14.1/core/includes/integrations/class-rcp-telemetry.php

    r3227065 r3283684  
    121121        }
    122122
    123         $new_actions   = array();
    124         $opt_in_status = $this->container->get( Status::class )->is_active();
     123        $new_actions   = [];
     124        $options       = $this->container->get( Status::class )->get_option();
     125        $plugins       = isset( $options['plugins'] ) ? (array) $options['plugins'] : [];
     126        $opt_in_status = false; // Inactive.
     127
     128        foreach ( $plugins as $plugin ) {
     129            if ( $plugin['wp_slug'] === $plugin_file ) {
     130                $opt_in_status = RCP_Helper_Cast::to_bool( $plugin['optin'] );
     131                break;
     132            }
     133        }
    125134
    126135        if ( ( $opt_in_status && ( basename( RCP_ROOT ) . '/restrict-content-pro.php' === $plugin_file ) )
     
    183192            $redirect = add_query_arg( 'rcp_message', '', esc_url( admin_url( 'admin.php?page=rcp-settings' ) ) );
    184193        } else {
    185             $this->container->get( Status::class )->set_status( $value );
     194            $this->container->get( Status::class )->set_status( false, $stellar_slug );
    186195            $redirect = add_query_arg( 'rcp_message', 'opt_out_message', esc_url( admin_url( 'admin.php?page=rcp-settings' ) ) );
    187196        }
  • restrict-content/tags/3.2.14.1/lang/restrict-content.pot

    r3227065 r3283684  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Restrict Content 3.2.14\n"
     5"Project-Id-Version: Restrict Content 3.2.14.1\n"
    66"Report-Msgid-Bugs-To: http://ithemes.com/support/\n"
    7 "POT-Creation-Date: 2025-01-22 19:36:31+00:00\n"
     7"POT-Creation-Date: 2025-04-28 21:57:22+00:00\n"
    88"PO-Revision-Date: 2025-MO-DA HO:MI+ZONE\n"
    99"MIME-Version: 1.0\n"
     
    17041704#: core/includes/admin/subscriptions/subscription-levels.php:170
    17051705#: core/includes/misc-functions.php:1600
    1706 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:246
     1706#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:263
    17071707msgid "Active"
    17081708msgstr ""
     
    47264726#: core/includes/admin/subscriptions/subscription-levels.php:171
    47274727#: core/includes/misc-functions.php:1601
    4728 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:249
     4728#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:266
    47294729msgid "Inactive"
    47304730msgstr ""
     
    62536253#. translators: %s: The admin URL.
    62546254
    6255 #: core/includes/integrations/class-rcp-telemetry.php:130
     6255#: core/includes/integrations/class-rcp-telemetry.php:139
    62566256msgid "<a href=\"%1$s\" alt=\"%2$s\">Opt-Out</a>"
    62576257msgstr ""
     
    62596259#. translators: %s: The Opt-Out alt text.
    62606260
    6261 #: core/includes/integrations/class-rcp-telemetry.php:133
     6261#: core/includes/integrations/class-rcp-telemetry.php:142
    62626262msgid "Change to Opt Out Status"
    62636263msgstr ""
     
    62656265#. translators: %s: The admin URL.
    62666266
    6267 #: core/includes/integrations/class-rcp-telemetry.php:139
     6267#: core/includes/integrations/class-rcp-telemetry.php:148
    62686268msgid "<a href=\"%1$s\" alt=\"%2$s\">Opt In</a>"
    62696269msgstr ""
     
    62716271#. translators: %s: The Opt-Out alt text.
    62726272
    6273 #: core/includes/integrations/class-rcp-telemetry.php:142
     6273#: core/includes/integrations/class-rcp-telemetry.php:151
    62746274msgid "Change to Opt In Status"
    62756275msgstr ""
     
    62776277#. translators: %s: The RCP Title.
    62786278
    6279 #: core/includes/integrations/class-rcp-telemetry.php:332
     6279#: core/includes/integrations/class-rcp-telemetry.php:341
    62806280msgid "These are %s fields that we use for analysis and to make the product better."
    62816281msgstr ""
    62826282
    6283 #: core/includes/integrations/class-rcp-telemetry.php:337
     6283#: core/includes/integrations/class-rcp-telemetry.php:346
    62846284msgid "Version"
    62856285msgstr ""
    62866286
    6287 #: core/includes/integrations/class-rcp-telemetry.php:341
     6287#: core/includes/integrations/class-rcp-telemetry.php:350
    62886288msgid "Last Updated"
    62896289msgstr ""
    62906290
    6291 #: core/includes/integrations/class-rcp-telemetry.php:345
     6291#: core/includes/integrations/class-rcp-telemetry.php:354
    62926292msgid "Total Membership Levels"
    62936293msgstr ""
    62946294
    6295 #: core/includes/integrations/class-rcp-telemetry.php:349
     6295#: core/includes/integrations/class-rcp-telemetry.php:358
    62966296msgid "Total Paid Membership Levels"
    62976297msgstr ""
    62986298
    6299 #: core/includes/integrations/class-rcp-telemetry.php:353
     6299#: core/includes/integrations/class-rcp-telemetry.php:362
    63006300msgid "Total Free Membership Levels"
    63016301msgstr ""
    63026302
    6303 #: core/includes/integrations/class-rcp-telemetry.php:357
     6303#: core/includes/integrations/class-rcp-telemetry.php:366
    63046304msgid "Total One-Time Membership Levels"
    63056305msgstr ""
    63066306
    6307 #: core/includes/integrations/class-rcp-telemetry.php:361
     6307#: core/includes/integrations/class-rcp-telemetry.php:370
    63086308msgid "Total Recurring Membership Levels"
    63096309msgstr ""
    63106310
    6311 #: core/includes/integrations/class-rcp-telemetry.php:365
     6311#: core/includes/integrations/class-rcp-telemetry.php:374
    63126312msgid "Total Paying Customers"
    63136313msgstr ""
    63146314
    6315 #: core/includes/integrations/class-rcp-telemetry.php:369
     6315#: core/includes/integrations/class-rcp-telemetry.php:378
    63166316msgid "Total Free Customers"
    63176317msgstr ""
    63186318
    6319 #: core/includes/integrations/class-rcp-telemetry.php:373
     6319#: core/includes/integrations/class-rcp-telemetry.php:382
    63206320msgid "Total No-Membership Customers"
    63216321msgstr ""
    63226322
    6323 #: core/includes/integrations/class-rcp-telemetry.php:377
     6323#: core/includes/integrations/class-rcp-telemetry.php:386
    63246324msgid "Is Multiple Memberships"
    63256325msgstr ""
    63266326
    6327 #: core/includes/integrations/class-rcp-telemetry.php:381
     6327#: core/includes/integrations/class-rcp-telemetry.php:390
    63286328msgid "Total Revenue This Month"
    63296329msgstr ""
    63306330
    6331 #: core/includes/integrations/class-rcp-telemetry.php:385
     6331#: core/includes/integrations/class-rcp-telemetry.php:394
    63326332msgid "Payment Gateways"
    63336333msgstr ""
    63346334
    6335 #: core/includes/integrations/class-rcp-telemetry.php:389
     6335#: core/includes/integrations/class-rcp-telemetry.php:398
    63366336msgid "Active Add-ons"
    63376337msgstr ""
    63386338
    6339 #: core/includes/integrations/class-rcp-telemetry.php:393
     6339#: core/includes/integrations/class-rcp-telemetry.php:402
    63406340msgid "Deactivated Add-ons"
    63416341msgstr ""
     
    78687868msgstr ""
    78697869
    7870 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:74
     7870#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:68
    78717871msgid "We’re sorry to see you go."
    78727872msgstr ""
    78737873
    7874 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:75
     7874#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:69
    78757875msgid "We’d love to know why you’re leaving so we can improve our plugin."
    78767876msgstr ""
    78777877
    7878 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:79
     7878#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:73
    78797879msgid "I couldn’t understand how to make it work."
    78807880msgstr ""
    78817881
    7882 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:83
     7882#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:77
    78837883msgid "I found a better plugin."
    78847884msgstr ""
    78857885
    7886 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:87
     7886#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:81
    78877887msgid "I need a specific feature it doesn’t provide."
    78887888msgstr ""
    78897889
    7890 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:91
     7890#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:85
    78917891msgid "The plugin doesn’t work."
    78927892msgstr ""
    78937893
    7894 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:95
     7894#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:89
    78957895msgid "Other"
    78967896msgstr ""
    78977897
    7898 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:79
     7898#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:73
    78997899msgid "See which plugins you have opted in to tracking for"
    79007900msgstr ""
     
    79027902#. Translators: The plugin name.
    79037903
    7904 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:86
     7904#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:80
    79057905msgid "We hope you love %s."
    79067906msgstr ""
     
    79087908#. Translators: The user name and the plugin name.
    79097909
    7910 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:91
     7910#: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:246
    79117911msgid ""
    79127912"Hi, %1$s! This is an invitation to help our StellarWP community.\n"
     
    79167916msgstr ""
    79177917
    7918 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:252
    7919 msgid "Mixed"
    7920 msgstr ""
    7921 
    79227918#: vendor/strauss/stellarwp/telemetry/src/views/exit-interview.php:26
    79237919msgid "Tell us more..."
     
    79297925
    79307926#: vendor/strauss/stellarwp/telemetry/src/views/exit-interview.php:37
    7931 #: vendor/strauss/stellarwp/telemetry/src/views/optin.php:63
     7927#: vendor/strauss/stellarwp/telemetry/src/views/optin.php:65
    79327928msgid "Skip"
    79337929msgstr ""
     
    79497945msgstr ""
    79507946
    7951 #: vendor/strauss/stellarwp/telemetry/src/views/optin.php:60
     7947#: vendor/strauss/stellarwp/telemetry/src/views/optin.php:62
    79527948msgid "Allow & Continue"
    79537949msgstr ""
  • restrict-content/tags/3.2.14.1/legacy/restrictcontent.php

    r3227065 r3283684  
    2222
    2323if ( ! defined( 'RC_PLUGIN_VERSION' ) ) {
    24     define( 'RC_PLUGIN_VERSION', '3.2.14' );
     24    define( 'RC_PLUGIN_VERSION', '3.2.14.1' );
    2525}
    2626
  • restrict-content/tags/3.2.14.1/package.json

    r3227065 r3283684  
    11{
    22  "name": "restrict-content",
    3   "version": "3.2.14",
     3  "version": "3.2.14.1",
    44  "description": "Set up a complete membership system for your WordPress site and deliver premium content to your members. Unlimited membership packages, membership management, discount codes, registration / login forms, and more.",
    55  "homepage": "https://restrictcontentpro.com/",
  • restrict-content/tags/3.2.14.1/readme.txt

    r3227065 r3283684  
    66Requires at least: 6.0
    77Requires PHP: 7.4
    8 Tested up to: 6.7
    9 Stable tag: 3.2.14
     8Tested up to: 6.8
     9Stable tag: 3.2.14.1
    1010
    1111Restrict Content is a powerful WordPress membership plugin that gives you full control over who can and cannot view content on your WordPress site.
     
    258258== Changelog ==
    259259
     260= 3.2.14.1 =
     261* Security: Added more safety checks to telemetry opt-ins/opt-outs.
     262
    260263= 3.2.14 =
    261264* Fix: Updated PayPal's transaction and subscription details URLs
  • restrict-content/tags/3.2.14.1/restrictcontent.php

    r3227065 r3283684  
    44 * Plugin URI: https://restrictcontentpro.com
    55 * Description: Set up a complete membership system for your WordPress site and deliver premium content to your members. Unlimited membership packages, membership management, discount codes, registration / login forms, and more.
    6  * Version: 3.2.14
     6 * Version: 3.2.14.1
    77 * Author: StellarWP
    88 * Author URI: https://stellarwp.com/
     
    1919define('RCP_ROOT', plugin_dir_path(__FILE__));
    2020define('RCP_WEB_ROOT', plugin_dir_url(__FILE__));
    21 define('RCF_VERSION', '3.2.14');
     21define('RCF_VERSION', '3.2.14.1');
    2222
    2323// Load Strauss autoload.
  • restrict-content/tags/3.2.14.1/vendor/autoload.php

    r3227065 r3283684  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInit7c8c0149486a62d837507dbce9babced::getLoader();
     25return ComposerAutoloaderInitf0134d9d141ea683567d02f6dd907ba6::getLoader();
  • restrict-content/tags/3.2.14.1/vendor/composer/autoload_real.php

    r3227065 r3283684  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit7c8c0149486a62d837507dbce9babced
     5class ComposerAutoloaderInitf0134d9d141ea683567d02f6dd907ba6
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit7c8c0149486a62d837507dbce9babced', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitf0134d9d141ea683567d02f6dd907ba6', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit7c8c0149486a62d837507dbce9babced', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitf0134d9d141ea683567d02f6dd907ba6', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit7c8c0149486a62d837507dbce9babced::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • restrict-content/tags/3.2.14.1/vendor/composer/autoload_static.php

    r3227065 r3283684  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit7c8c0149486a62d837507dbce9babced
     7class ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    6767    {
    6868        return \Closure::bind(function () use ($loader) {
    69             $loader->prefixLengthsPsr4 = ComposerStaticInit7c8c0149486a62d837507dbce9babced::$prefixLengthsPsr4;
    70             $loader->prefixDirsPsr4 = ComposerStaticInit7c8c0149486a62d837507dbce9babced::$prefixDirsPsr4;
    71             $loader->classMap = ComposerStaticInit7c8c0149486a62d837507dbce9babced::$classMap;
     69            $loader->prefixLengthsPsr4 = ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6::$prefixLengthsPsr4;
     70            $loader->prefixDirsPsr4 = ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6::$prefixDirsPsr4;
     71            $loader->classMap = ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6::$classMap;
    7272
    7373        }, null, ClassLoader::class);
  • restrict-content/tags/3.2.14.1/vendor/strauss/autoload-classmap.php

    r3227065 r3283684  
    1111   'RCP\StellarWP\Telemetry\Opt_In\Status' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php',
    1212   'RCP\StellarWP\Telemetry\Core' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Core.php',
     13   'RCP\StellarWP\Telemetry\Events\Event' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Events/Event.php',
     14   'RCP\StellarWP\Telemetry\Events\Event_Subscriber' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Events/Event_Subscriber.php',
    1315   'RCP\StellarWP\Telemetry\Uninstall' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Uninstall.php',
    1416   'RCP\StellarWP\Telemetry\Telemetry\Telemetry_Subscriber' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Telemetry/Telemetry_Subscriber.php',
     
    2527   'RCP\StellarWP\Telemetry\Contracts\Subscriber_Interface' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Contracts/Subscriber_Interface.php',
    2628   'RCP\StellarWP\Telemetry\Data_Providers\Debug_Data' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Data_Providers/Debug_Data.php',
     29   'RCP\StellarWP\Telemetry\Data_Providers\Null_Data_Provider' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Data_Providers/Null_Data_Provider.php',
    2730   'RCP\StellarWP\Telemetry\Admin\Resources' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Admin/Resources.php',
    2831   'RCP\StellarWP\Telemetry\Admin\Admin_Subscriber' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Admin/Admin_Subscriber.php',
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Admin/Admin_Subscriber.php

    r2886519 r3283684  
    1414namespace RCP\StellarWP\Telemetry\Admin;
    1515
     16use RCP\StellarWP\Telemetry\Config;
    1617use RCP\StellarWP\Telemetry\Contracts\Abstract_Subscriber;
    1718use RCP\StellarWP\Telemetry\Opt_In\Opt_In_Template;
     
    3536    public function register(): void {
    3637        add_action( 'admin_init', [ $this, 'maybe_enqueue_admin_assets' ] );
    37 
    3838    }
    3939
     
    4242     *
    4343     * @since 1.0.0
     44     * @since 2.0.0 - Adjust to output assets if any stellar slug should render its modal.
    4445     *
    4546     * @return void
     
    4849        global $pagenow;
    4950
    50         if ( 'plugins.php' === $pagenow || $this->container->get( Opt_In_Template::class )->should_render() ) {
     51        $should_render = false;
     52
     53        foreach ( Config::get_all_stellar_slugs() as $stellar_slug => $wp_slug ) {
     54            $should_render = $this->container->get( Opt_In_Template::class )->should_render( $stellar_slug );
     55
     56            if ( $should_render ) {
     57                break;
     58            }
     59        }
     60
     61        if ( 'plugins.php' === $pagenow || $should_render ) {
    5162            $this->container->get( Resources::class )->enqueue_admin_assets();
    5263        }
    5364    }
    54 
    5565}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Admin/Resources.php

    r2886519 r3283684  
    135135        return plugin_dir_url( dirname( __DIR__ ) );
    136136    }
    137 
    138137}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Config.php

    r2886519 r3283684  
    3030     * @since 1.0.0
    3131     *
    32      * @var \RCP\StellarWP\ContainerContract\ContainerInterface
     32     * @var ?\RCP\StellarWP\ContainerContract\ContainerInterface
    3333     */
    3434    protected static $container;
     
    5151     */
    5252    protected static $stellar_slug = '';
     53
     54    /**
     55     * Unique IDs and optional plugin slugs for StellarWP slugs.
     56     *
     57     * @since 2.0.0
     58     *
     59     * @var array
     60     */
     61    protected static $stellar_slugs = [];
    5362
    5463    /**
     
    101110
    102111    /**
    103      * Gets the stellar slug server url.
     112     * Gets the stellar slug.
    104113     *
    105114     * @since 1.0.0
     
    109118    public static function get_stellar_slug() {
    110119        return static::$stellar_slug;
     120    }
     121
     122    /**
     123     * Gets the registered stellar slugs.
     124     *
     125     * @since 2.0.0
     126     *
     127     * @return array<string,string>
     128     */
     129    public static function get_all_stellar_slugs() {
     130        return static::$stellar_slugs;
    111131    }
    112132
     
    133153        static::$server_url   = 'https://telemetry.stellarwp.com/api/v1';
    134154        static::$stellar_slug = '';
     155        static::$container    = null;
    135156    }
    136157
     
    166187    }
    167188
    168 
    169189    /**
    170190     * Sets the stellar slug.
     
    178198    public static function set_stellar_slug( string $stellar_slug ) {
    179199        static::$stellar_slug = $stellar_slug;
     200
     201        // Also add the stellar slug to the array of all registered stellar slugs.
     202        static::$stellar_slugs[ $stellar_slug ] = '';
     203    }
     204
     205    /**
     206     * Adds a new stellar slug to the stellar slugs array.
     207     *
     208     * Utilizing an array of stellar slugs, the library can be tailored for use in a single plugin
     209     * or use within a shared library for several plugins. Each stellar slug registered will
     210     * generate unique filters and hooks that give further customization for each slug
     211     *
     212     * @since 2.0.0
     213     *
     214     * @param string $stellar_slug A unique slug to add to the config.
     215     * @param string $wp_slug      The plugin's basename (used for capturing deactivation "Exit Interview" info).
     216     *
     217     * @return void
     218     */
     219    public static function add_stellar_slug( string $stellar_slug, string $wp_slug = '' ) {
     220        static::$stellar_slugs[ $stellar_slug ] = $wp_slug;
    180221    }
    181222
     
    192233        static::$server_url = $url;
    193234    }
    194 
    195235}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Abstract_Subscriber.php

    r2886519 r3283684  
    3434        $this->container = $container;
    3535    }
    36 
    3736}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Subscriber_Interface.php

    r2886519 r3283684  
    2525     */
    2626    public function register();
    27 
    2827}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Template_Interface.php

    r2886519 r3283684  
    2222     *
    2323     * @since 1.0.0
     24     * @since 2.0.0 - Update to handle passed in stellar slug.
     25     *
     26     * @param string $stellar_slug The stellar slug to be referenced when the modal is rendered.
    2427     *
    2528     * @return void
    2629     */
    27     public function render();
    28 
    29     /**
    30      * Enqueues assets for the rendered template.
    31      *
    32      * @since 1.0.0
    33      *
    34      * @return void
    35      */
    36     public function enqueue();
     30    public function render( string $stellar_slug );
    3731
    3832    /**
     
    4034     *
    4135     * @since 1.0.0
     36     * @since 2.0.0 - Update to handle passed in stellar slug.
     37     *
     38     * @param string $stellar_slug The stellar slug for which the modal should be rendered.
    4239     *
    4340     * @return boolean
    4441     */
    45     public function should_render();
     42    public function should_render( string $stellar_slug );
    4643}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Core.php

    r2886519 r3283684  
    1919use RCP\StellarWP\Telemetry\Contracts\Data_Provider;
    2020use RCP\StellarWP\Telemetry\Data_Providers\Debug_Data;
     21use RCP\StellarWP\Telemetry\Events\Event_Subscriber;
    2122use RCP\StellarWP\Telemetry\Exit_Interview\Exit_Interview_Subscriber;
    2223use RCP\StellarWP\Telemetry\Exit_Interview\Template;
     24use RCP\StellarWP\Telemetry\Last_Send\Last_Send;
    2325use RCP\StellarWP\Telemetry\Last_Send\Last_Send_Subscriber;
    2426use RCP\StellarWP\Telemetry\Opt_In\Opt_In_Subscriber;
     
    5052        Admin_Subscriber::class,
    5153        Exit_Interview_Subscriber::class,
     54        Event_Subscriber::class,
    5255        Last_Send_Subscriber::class,
    5356        Opt_In_Subscriber::class,
     
    130133        $container = Config::get_container();
    131134
     135        // For all registered stellar slugs, use the plugin basename for those that do not have a wp_slug set.
     136        foreach ( Config::get_all_stellar_slugs() as $stellar_slug => $wp_slug ) {
     137            if ( '' !== $wp_slug ) {
     138                continue;
     139            }
     140
     141            Config::add_stellar_slug( $stellar_slug, plugin_basename( $plugin_path ) );
     142        }
     143
    132144        $container->bind( self::PLUGIN_BASENAME, plugin_basename( $plugin_path ) );
    133145        $container->bind( self::PLUGIN_FILE, $plugin_path );
    134146        $container->bind( self::SITE_PLUGIN_DIR, dirname( plugin_dir_path( $plugin_path ) ) );
    135147        $container->bind( Data_Provider::class, Debug_Data::class );
     148        $container->bind( Status::class, Status::class );
     149        $container->bind( Last_Send::class, Last_Send::class );
    136150        $container->bind(
    137151            Opt_In_Template::class,
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Exit_Interview_Subscriber.php

    r2886519 r3283684  
    1616use RCP\StellarWP\Telemetry\Contracts\Abstract_Subscriber;
    1717use RCP\StellarWP\Telemetry\Config;
    18 use RCP\StellarWP\Telemetry\Core;
    1918use RCP\StellarWP\Telemetry\Opt_In\Status;
    2019use RCP\StellarWP\Telemetry\Telemetry\Telemetry;
     
    4847        add_action( 'wp_ajax_' . self::AJAX_ACTION, [ $this, 'ajax_exit_interview' ] );
    4948
    50         add_filter( 'network_admin_plugin_action_links_' . $this->container->get( Core::PLUGIN_BASENAME ), [ $this, 'plugin_action_links' ], 10, 1 );
    51         add_filter( 'plugin_action_links_' . $this->container->get( Core::PLUGIN_BASENAME ), [ $this, 'plugin_action_links' ], 10, 1 );
     49        // Implement the exit interview trigger for each registerred plugin.
     50        foreach ( Config::get_all_stellar_slugs() as $basename ) {
     51            add_filter( 'network_admin_plugin_action_links_' . $basename, [ $this, 'plugin_action_links' ], 10, 2 );
     52            add_filter( 'plugin_action_links_' . $basename, [ $this, 'plugin_action_links' ], 10, 2 );
     53        }
    5254    }
    5355
     
    6365
    6466        if ( 'plugins.php' === $pagenow ) {
    65             $this->container->get( Template::class )->maybe_render();
     67            // Swap key/values since we need to map stellar slugs by plugin basename.
     68            $stellar_slugs = array_flip( Config::get_all_stellar_slugs() );
     69            $plugins       = get_plugins();
     70            foreach ( $plugins as $slug => $data ) {
     71                if ( key_exists( $slug, $stellar_slugs ) ) {
     72                    $this->container->get( Template::class )->maybe_render( $stellar_slugs[ $slug ] );
     73                }
     74            }
    6675        }
    6776    }
     
    7180     *
    7281     * @since 1.0.0
     82     * @since 2.3.4 - Added user capability check.
    7383     *
    7484     * @return void
    7585     */
    7686    public function ajax_exit_interview() {
    77         $uninstall_reason_id = filter_input( INPUT_POST, 'uninstall_reason_id', FILTER_SANITIZE_STRING );
     87
     88        // Check sent data before we do any database checks for faster failures.
     89        $uninstall_reason_id = filter_input( INPUT_POST, 'uninstall_reason_id', FILTER_SANITIZE_SPECIAL_CHARS );
    7890        $uninstall_reason_id = ! empty( $uninstall_reason_id ) ? $uninstall_reason_id : false;
    7991        if ( ! $uninstall_reason_id ) {
     
    8193        }
    8294
    83         $uninstall_reason = filter_input( INPUT_POST, 'uninstall_reason', FILTER_SANITIZE_STRING );
     95        $uninstall_reason = filter_input( INPUT_POST, 'uninstall_reason', FILTER_SANITIZE_SPECIAL_CHARS );
    8496        $uninstall_reason = ! empty( $uninstall_reason ) ? $uninstall_reason : false;
    8597        if ( ! $uninstall_reason ) {
     
    8799        }
    88100
    89         $plugin_slug = filter_input( INPUT_POST, 'plugin_slug', FILTER_SANITIZE_STRING );
     101        $plugin_slug = filter_input( INPUT_POST, 'plugin_slug', FILTER_SANITIZE_SPECIAL_CHARS );
    90102
    91         $comment = filter_input( INPUT_POST, 'comment', FILTER_SANITIZE_STRING );
     103        $comment = filter_input( INPUT_POST, 'comment', FILTER_SANITIZE_SPECIAL_CHARS );
    92104        $comment = ! empty( $comment ) ? $comment : '';
    93105
    94         $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING );
     106        // Validate nonce.
     107        $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_SPECIAL_CHARS );
    95108        $nonce = ! empty( $nonce ) ? $nonce : '';
    96109
    97110        if ( ! wp_verify_nonce( $nonce, self::AJAX_ACTION ) ) {
    98111            wp_send_json_error( 'Invalid nonce' );
     112        }
     113
     114        // Sent data validated, check if the user has the necessary permissions.
     115        if ( ! current_user_can( 'manage_options' ) ) {
     116            wp_send_json_error( 'User does not have proper permissions to modify plugins' );
    99117        }
    100118
     
    110128     * The deactivation is deferred to the modal displayed.
    111129     *
    112      * @param array $links The links of the plugin in the plugin list.
     130     * @param array  $links        The links of the plugin in the plugin list.
     131     * @param string $plugin_file The plugin file of the current plugin in the list.
    113132     *
    114133     * @since 1.0.0
     
    116135     * @return array
    117136     */
    118     public function plugin_action_links( $links ) {
     137    public function plugin_action_links( $links, $plugin_file ) {
     138
     139        $stellar_slug = '';
     140
     141        foreach ( Config::get_all_stellar_slugs() as $slug => $basename ) {
     142            if ( plugin_basename( $plugin_file ) === $basename ) {
     143                $stellar_slug = $slug;
     144                continue;
     145            }
     146        }
     147
    119148        $passed_deactivate = false;
    120149        $deactivate_link   = '';
     
    137166
    138167        if ( ! empty( $deactivate_link ) ) {
    139             $deactivate_link .= '<i class="telemetry-plugin-slug" data-plugin-slug="' . Config::get_stellar_slug() . '"></i>';
     168            $deactivate_link .= '<i class="telemetry-plugin-slug" data-plugin-slug="' . $stellar_slug . '"></i>';
    140169
    141170            // Append deactivation link.
     
    145174        return array_merge( $before_deactivate, $after_deactivate );
    146175    }
    147 
    148176}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php

    r2886519 r3283684  
    1818use RCP\StellarWP\Telemetry\Config;
    1919use RCP\StellarWP\Telemetry\Contracts\Template_Interface;
    20 use RCP\StellarWP\Telemetry\Core;
    2120
    2221/**
     
    5352     *
    5453     * @since 1.0.0
     54     * @since 2.0.0 - Updated to accept a passed stellar slug.
     55     *
     56     * @param string $stellar_slug The stellar slug used when outputting the modal.
    5557     *
    5658     * @return array
    5759     */
    58     protected function get_args() {
     60    protected function get_args( string $stellar_slug ) {
     61
     62        $args = [
     63            'plugin_slug'        => $stellar_slug,
     64            'plugin_logo'        => Resources::get_asset_path() . 'resources/images/stellar-logo.svg',
     65            'plugin_logo_width'  => 151,
     66            'plugin_logo_height' => 32,
     67            'plugin_logo_alt'    => 'StellarWP Logo',
     68            'heading'            => __( 'We’re sorry to see you go.', 'stellarwp-telemetry' ),
     69            'intro'              => __( 'We’d love to know why you’re leaving so we can improve our plugin.', 'stellarwp-telemetry' ),
     70            'uninstall_reasons'  => [
     71                [
     72                    'uninstall_reason_id' => 'confusing',
     73                    'uninstall_reason'    => __( 'I couldn’t understand how to make it work.', 'stellarwp-telemetry' ),
     74                ],
     75                [
     76                    'uninstall_reason_id' => 'better-plugin',
     77                    'uninstall_reason'    => __( 'I found a better plugin.', 'stellarwp-telemetry' ),
     78                ],
     79                [
     80                    'uninstall_reason_id' => 'no-feature',
     81                    'uninstall_reason'    => __( 'I need a specific feature it doesn’t provide.', 'stellarwp-telemetry' ),
     82                ],
     83                [
     84                    'uninstall_reason_id' => 'broken',
     85                    'uninstall_reason'    => __( 'The plugin doesn’t work.', 'stellarwp-telemetry' ),
     86                ],
     87                [
     88                    'uninstall_reason_id' => 'other',
     89                    'uninstall_reason'    => __( 'Other', 'stellarwp-telemetry' ),
     90                    'show_comment'        => true,
     91                ],
     92            ],
     93        ];
     94
    5995        /**
    6096         * Filters the "Exit Interview" modal arguments.
    6197         *
     98         * Planned deprecation: 3.0.0
     99         * Use stellarwp/telemetry/exit_interview_args filter instead.
     100         *
    62101         * @since 1.0.0
     102         * @since 2.0.0 - Added the current stellar slug.
    63103         *
    64          * @param array $args The arguments used to configure the modal.
     104         * @param array  $args         The arguments used to configure the modal.
     105         * @param string $stellar_slug The current stellar slug for the plugin outputting the modal.
    65106         */
    66         return apply_filters(
    67             'stellarwp/telemetry/' . Config::get_stellar_slug() . '/exit_interview_args',
    68             [
    69                 'plugin_slug'        => Config::get_stellar_slug(),
    70                 'plugin_logo'        => Resources::get_asset_path() . 'resources/images/stellar-logo.svg',
    71                 'plugin_logo_width'  => 151,
    72                 'plugin_logo_height' => 32,
    73                 'plugin_logo_alt'    => 'StellarWP Logo',
    74                 'heading'            => __( 'We’re sorry to see you go.', 'stellarwp-telemetry' ),
    75                 'intro'              => __( 'We’d love to know why you’re leaving so we can improve our plugin.', 'stellarwp-telemetry' ),
    76                 'uninstall_reasons'  => [
    77                     [
    78                         'uninstall_reason_id' => 'confusing',
    79                         'uninstall_reason'    => __( 'I couldn’t understand how to make it work.', 'stellarwp-telemetry' ),
    80                     ],
    81                     [
    82                         'uninstall_reason_id' => 'better-plugin',
    83                         'uninstall_reason'    => __( 'I found a better plugin.', 'stellarwp-telemetry' ),
    84                     ],
    85                     [
    86                         'uninstall_reason_id' => 'no-feature',
    87                         'uninstall_reason'    => __( 'I need a specific feature it doesn’t provide.', 'stellarwp-telemetry' ),
    88                     ],
    89                     [
    90                         'uninstall_reason_id' => 'broken',
    91                         'uninstall_reason'    => __( 'The plugin doesn’t work.', 'stellarwp-telemetry' ),
    92                     ],
    93                     [
    94                         'uninstall_reason_id' => 'other',
    95                         'uninstall_reason'    => __( 'Other', 'stellarwp-telemetry' ),
    96                         'show_comment'        => true,
    97                     ],
    98                 ],
    99             ]
    100         );
     107        $args = apply_filters( 'stellarwp/telemetry/' . $stellar_slug . '/exit_interview_args', $args, $stellar_slug );
     108
     109        /**
     110         * Filters the "Exit Interview" modal arguments.
     111         *
     112         * @since 2.0.0
     113         *
     114         * @param array  $args         The arguments used to configure the modal.
     115         * @param string $stellar_slug The current stellar slug for the plugin outputting the modal.
     116         *
     117         * @return void
     118         */
     119        $args = apply_filters( 'stellarwp/telemetry/exit_interview_args', $args, $stellar_slug );
     120
     121        return $args;
    101122    }
    102123
     
    106127     * @since 1.0.0
    107128     *
     129     * @param string $stellar_slug The stellar slug to be referenced when the modal is rendered.
     130     *
    108131     * @return void
    109132     */
    110     public function render() {
    111         load_template( dirname( dirname( __DIR__ ) ) . '/views/exit-interview.php', true, $this->get_args() );
     133    public function render( string $stellar_slug ) {
     134        load_template( dirname( dirname( __DIR__ ) ) . '/views/exit-interview.php', false, $this->get_args( $stellar_slug ) );
    112135    }
    113136
     
    117140     * @since 1.0.0
    118141     *
    119      * @return void
    120      */
    121     public function enqueue() {
    122         // TODO: Implement enqueue() method.
    123     }
    124 
    125     /**
    126      * @inheritDoc
    127      *
    128      * @since 1.0.0
     142     * @param string $stellar_slug The stellar slug for which the modal should be rendered.
    129143     *
    130144     * @return boolean
    131145     */
    132     public function should_render() {
     146    public function should_render( string $stellar_slug ) {
    133147        /**
    134148         * Filters whether the "Exit Interview" modal should render.
    135149         *
    136150         * @since 1.0.0
     151         * @since 2.0.0 - Update to include current stellar slug.
    137152         *
    138          * @param bool $should_render Whether the modal should render.
     153         * @param bool   $should_render  Whether the modal should render.
     154         * @param string $stellar_slug The current stellar slug of the plugin for which the modal is shown.
    139155         */
    140         return apply_filters( 'stellarwp/telemetry/' . Config::get_hook_prefix() . 'exit_interview_should_render', true );
     156        return apply_filters( 'stellarwp/telemetry/' . Config::get_hook_prefix() . 'exit_interview_should_render', true, $stellar_slug );
    141157    }
    142158
     
    146162     * @since 1.0.0
    147163     *
     164     * @param string $stellar_slug The stellar slug that could be rendered.
     165     *
    148166     * @return void
    149167     */
    150     public function maybe_render() {
    151         if ( $this->should_render() ) {
    152             $this->render();
     168    public function maybe_render( string $stellar_slug ) {
     169        if ( $this->should_render( $stellar_slug ) ) {
     170            $this->render( $stellar_slug );
    153171        }
    154172    }
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Last_Send/Last_Send.php

    r2886519 r3283684  
    135135        return $result;
    136136    }
    137 
    138137}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Subscriber.php

    r2886519 r3283684  
    3333     */
    3434    public function register(): void {
    35         add_action( 'stellarwp/telemetry/' . Config::get_stellar_slug() . '/optin', [ $this, 'maybe_render_optin' ] );
     35        /**
     36         * Planned deprecation: 3.0.0
     37         *
     38         * Use stellarwp/telemetry/optin filter instead.
     39         */
     40        add_action( 'stellarwp/telemetry/' . Config::get_stellar_slug() . '/optin', [ $this, 'maybe_render_optin' ], 10, 1 );
     41
     42        add_action( 'stellarwp/telemetry/optin', [ $this, 'maybe_render_optin' ], 10, 1 );
     43
    3644        add_action( 'admin_init', [ $this, 'set_optin_status' ] );
    3745        add_action( 'init', [ $this, 'initialize_optin_option' ] );
     
    4250     *
    4351     * @since 1.0.0
     52     * @since 2.3.4 - Added user capability check.
    4453     *
    4554     * @return void
     
    5867        }
    5968
     69        // Check sent data before we do any database checks for faster failures.
    6070        // We're not attempting a telemetry action.
    6171        if ( isset( $_POST['action'] ) && 'stellarwp-telemetry' !== $_POST['action'] ) {
     
    6878        }
    6979
     80        // Sent data validated, check if the user has the necessary permissions.
     81        if ( ! current_user_can( 'manage_options' ) ) {
     82            return;
     83        }
     84
     85        $stellar_slug = Config::get_stellar_slug();
     86
     87        if ( isset( $_POST['stellar_slug'] ) ) {
     88            $stellar_slug = sanitize_text_field( $_POST['stellar_slug'] );
     89        }
     90
     91        $opt_in_text = '';
     92
     93        if ( isset( $_POST['opt_in_text'] ) ) {
     94            $opt_in_text = sanitize_text_field( $_POST['opt_in_text'] );
     95        }
     96
    7097        // User agreed to opt-in to Telemetry.
    7198        if ( 'true' === $_POST['optin-agreed'] ) {
    72             $this->opt_in();
     99            $this->opt_in( $stellar_slug, $opt_in_text );
    73100        }
    74101
    75102        // Don't show the opt-in modal again.
    76         update_option( $this->container->get( Opt_In_Template::class )->get_option_name(), '0' );
     103        update_option( $this->container->get( Opt_In_Template::class )->get_option_name( $stellar_slug ), '0' );
    77104    }
    78105
     
    81108     *
    82109     * @since 1.0.0
     110     * @since 2.0.0 - Update to handle rendering multiple modals.
     111     *
     112     * @param string $stellar_slug The stellar slug to use in determining when and how the modal is displayed.
    83113     *
    84114     * @return void
    85115     */
    86     public function maybe_render_optin() {
    87         $this->container->get( Opt_In_Template::class )->maybe_render();
     116    public function maybe_render_optin( string $stellar_slug = '' ) {
     117        if ( '' === $stellar_slug ) {
     118            $stellar_slug = Config::get_stellar_slug();
     119        }
     120
     121        $this->container->get( Opt_In_Template::class )->maybe_render( $stellar_slug );
    88122    }
    89123
     
    99133     */
    100134    public function initialize_optin_option() {
    101         $stellar_slug    = Config::get_stellar_slug();
    102135        $opt_in_template = $this->container->get( Opt_In_Template::class );
    103136        $opt_in_status   = $this->container->get( Status::class );
    104137
    105         // Check if plugin slug exists within array.
    106         if ( ! $opt_in_status->plugin_exists( $stellar_slug ) ) {
    107             $opt_in_status->add_plugin( $stellar_slug );
     138        // Loop through all registered stellar slugs and add them to the optin option.
     139        foreach ( Config::get_all_stellar_slugs() as $stellar_slug => $wp_slug ) {
     140            // Check if plugin slug exists within array.
     141            if ( ! $opt_in_status->plugin_exists( $stellar_slug ) ) {
     142                $opt_in_status->add_plugin( $stellar_slug, false, $wp_slug );
    108143
    109             update_option( $opt_in_template->get_option_name(), '1' );
     144                update_option( $opt_in_template->get_option_name( $stellar_slug ), '1' );
     145            }
    110146        }
    111147    }
     
    115151     *
    116152     * @since 1.0.0
     153     * @since 2.0.0 - Updated to allow specifying the stellar slug.
     154     * @since 2.2.0 - Updated to add opt-in text.
     155     *
     156     * @param string $stellar_slug The slug to use when opting in.
     157     * @param string $opt_in_text  The text displayed to the user when they agreed to opt-in.
    117158     *
    118159     * @return void
    119160     */
    120     public function opt_in() {
    121         $this->container->get( Status::class )->set_status( true );
     161    public function opt_in( string $stellar_slug, string $opt_in_text = '' ) {
     162        $this->container->get( Status::class )->set_status( true, $stellar_slug );
    122163
    123164        try {
    124165            $this->container->get( Telemetry::class )->register_site();
    125             $this->container->get( Telemetry::class )->register_user();
     166            $this->container->get( Telemetry::class )->register_user( $stellar_slug, $opt_in_text );
    126167        } catch ( \Error $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
    127168            // We don't want to throw errors if the server cannot be reached.
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php

    r2886519 r3283684  
    4949
    5050    /**
    51      * @inheritDoc
    52      *
    53      * @return void
    54      */
    55     public function enqueue(): void {
    56         // TODO: Once FE template is done, enqueue it here.
    57     }
    58 
    59     /**
    6051     * Gets the arguments for configuring how the Opt-In modal is rendered.
    6152     *
    6253     * @since 1.0.0
     54     * @since 2.0.0 - Updated to handle passed in stellar slug
     55     *
     56     * @param string $stellar_slug The slug to use when configuring the modal args.
    6357     *
    6458     * @return array
    6559     */
    66     protected function get_args() {
     60    public function get_args( string $stellar_slug ) {
    6761
    6862        $optin_args = [
     
    7266            'plugin_logo_alt'       => 'StellarWP Logo',
    7367            'plugin_name'           => 'StellarWP',
    74             'plugin_slug'           => Config::get_stellar_slug(),
     68            'plugin_slug'           => $stellar_slug,
    7569            'user_name'             => wp_get_current_user()->display_name,
    7670            'permissions_url'       => '#',
     
    8781            $optin_args['plugin_name']
    8882        );
    89         $optin_args['intro'] = sprintf(
     83
     84        $optin_args['intro'] = $this->get_intro( $optin_args['user_name'], $optin_args['plugin_name'] );
     85
     86        /**
     87         * Filters the arguments for rendering the Opt-In modal.
     88         *
     89         * @since 2.0.0
     90         *
     91         * @param array $optin_args
     92         * @param string $stellar_slug
     93         */
     94        $optin_args = apply_filters( 'stellarwp/telemetry/optin_args', $optin_args, $stellar_slug );
     95
     96        /**
     97         * Filters the arguments for rendering the Opt-In modal.
     98         *
     99         * Planned Deprecation: 3.0.0
     100         *
     101         * @since 1.0.0
     102         *
     103         * @param array $optin_args
     104         */
     105        $optin_args = apply_filters( 'stellarwp/telemetry/' . $stellar_slug . '/optin_args', $optin_args );
     106
     107        return $optin_args;
     108    }
     109
     110    /**
     111     * @inheritDoc
     112     *
     113     * @since 1.0.0
     114     * @since 2.0.0 - Update to handle passed in stellar slug.
     115     *
     116     * @param string $stellar_slug The slug to render the modal with.
     117     *
     118     * @return void
     119     */
     120    public function render( string $stellar_slug ) {
     121        load_template( dirname( dirname( __DIR__ ) ) . '/views/optin.php', false, $this->get_args( $stellar_slug ) );
     122    }
     123
     124    /**
     125     * Gets the option that determines if the modal should be rendered.
     126     *
     127     * @since 1.0.0
     128     * @since 2.0.0 - Update to handle passed in stellar_slug.
     129     *
     130     * @param string $stellar_slug The current stellar slug to be used in the option name.
     131     *
     132     * @return string
     133     */
     134    public function get_option_name( string $stellar_slug ) {
     135        $option_name = sprintf(
     136            'stellarwp_telemetry_%s_show_optin',
     137            $stellar_slug
     138        );
     139
     140        /**
     141         * Filters the name of the option stored in the options table.
     142         * This filter can be used to apply a generic option name.
     143         * Usage of this filter is highly discouraged.
     144         *
     145         * @since 2.3
     146         *
     147         * @param string $option_name
     148         * @param string $stellar_slug The current stellar slug.
     149         */
     150        $option_name = apply_filters(
     151            'stellarwp/telemetry/show_optin_option_name',
     152            $option_name,
     153            $stellar_slug
     154        );
     155
     156        /**
     157         * Filters the name of the option stored in the options table.
     158         *
     159         * @since 1.0.0
     160         * @since 2.0.0 - Update to pass stellar slug for checking the current filter context.
     161         *
     162         * @param string $option_name
     163         * @param string $stellar_slug The current stellar slug.
     164         */
     165        return apply_filters(
     166            'stellarwp/telemetry/' . Config::get_hook_prefix() . 'show_optin_option_name',
     167            $option_name,
     168            $stellar_slug
     169        );
     170    }
     171
     172    /**
     173     * Helper function to determine if the modal should be rendered.
     174     *
     175     * @since 1.0.0
     176     * @since 2.0.0 - update to handle passed in stellar_slug.
     177     *
     178     * @param string $stellar_slug The stellar slug to get the option name for.
     179     *
     180     * @return boolean
     181     */
     182    public function should_render( string $stellar_slug ) {
     183        return (bool) get_option( $this->get_option_name( $stellar_slug ), false );
     184    }
     185
     186    /**
     187     * Renders the modal if it should be rendered.
     188     *
     189     * @since 1.0.0
     190     * @since 2.0.0 - Add ability to render multiple modals.
     191     *
     192     * @param string $stellar_slug The stellar slug for which the modal should be rendered.
     193     *
     194     * @return void
     195     */
     196    public function maybe_render( string $stellar_slug ) {
     197        if ( $this->should_render( $stellar_slug ) ) {
     198            $this->render( $stellar_slug );
     199        }
     200    }
     201
     202    /**
     203     * Gets an array of opted-in plugin names.
     204     *
     205     * @since 1.0.0
     206     *
     207     * @return string[]
     208     */
     209    public function get_opted_in_plugin_names() {
     210        $option           = Config::get_container()->get( Status::class )->get_option();
     211        $site_plugins_dir = Config::get_container()->get( Core::SITE_PLUGIN_DIR );
     212        $opted_in_plugins = [];
     213
     214        foreach ( $option['plugins'] as $plugin ) {
     215            if ( true !== $plugin['optin'] ) {
     216                continue;
     217            }
     218
     219            $plugin_path = trailingslashit( $site_plugins_dir ) . $plugin['wp_slug'];
     220            if ( ! file_exists( $plugin_path ) ) {
     221                continue;
     222            }
     223
     224            $plugin_data = get_plugin_data( $plugin_path );
     225            if ( empty( $plugin_data['Name'] ) ) {
     226                continue;
     227            }
     228
     229            $opted_in_plugins[] = $plugin_data['Name'];
     230        }
     231
     232        return $opted_in_plugins;
     233    }
     234
     235    /**
     236     * Gets the primary message displayed on the opt-in modal.
     237     *
     238     * @param string $user_name   The display name of the user.
     239     * @param string $plugin_name The name of the plugin.
     240     *
     241     * @return string
     242     */
     243    public function get_intro( $user_name, $plugin_name ) {
     244        return sprintf(
    90245            // Translators: The user name and the plugin name.
    91             __(
     246            esc_html__(
    92247                'Hi, %1$s! This is an invitation to help our StellarWP community.
    93248                If you opt-in, some data about your usage of %2$s and future StellarWP Products will be shared with our teams (so they can work their butts off to improve).
     
    96251                'stellarwp-telemetry'
    97252            ),
    98             $optin_args['user_name'],
    99             $optin_args['plugin_name']
    100         );
    101 
    102         /**
    103          * Filters the arguments for rendering the Opt-In modal.
    104          *
    105          * @since 1.0.0
    106          *
    107          * @param array $optin_args
    108          */
    109         return apply_filters( 'stellarwp/telemetry/' . Config::get_stellar_slug() . '/optin_args', $optin_args );
    110     }
    111 
    112     /**
    113      * @inheritDoc
    114      *
    115      * @since 1.0.0
    116      *
    117      * @return void
    118      */
    119     public function render() {
    120         load_template( dirname( dirname( __DIR__ ) ) . '/views/optin.php', true, $this->get_args() );
    121     }
    122 
    123     /**
    124      * Gets the option that determines if the modal should be rendered.
    125      *
    126      * @since 1.0.0
    127      *
    128      * @return string
    129      */
    130     public function get_option_name() {
    131         /**
    132          * Filters the name of the option stored in the options table.
    133          *
    134          * @since 1.0.0
    135          *
    136          * @param string $show_optin_option_name
    137          */
    138         return apply_filters(
    139             'stellarwp/telemetry/' . Config::get_hook_prefix() . 'show_optin_option_name',
    140             'stellarwp_telemetry_' . Config::get_stellar_slug() . '_show_optin'
    141         );
    142     }
    143 
    144     /**
    145      * Helper function to determine if the modal should be rendered.
    146      *
    147      * @since 1.0.0
    148      *
    149      * @return boolean
    150      */
    151     public function should_render() {
    152         return (bool) get_option( $this->get_option_name(), false );
    153     }
    154 
    155     /**
    156      * Renders the modal if it should be rendered.
    157      *
    158      * @since 1.0.0
    159      *
    160      * @return void
    161      */
    162     public function maybe_render() {
    163         if ( $this->should_render() ) {
    164             $this->render();
    165         }
    166     }
    167 
    168     /**
    169      * Gets an array of opted-in plugin names.
    170      *
    171      * @since 1.0.0
    172      *
    173      * @return string[]
    174      */
    175     public function get_opted_in_plugin_names() {
    176         $option           = Config::get_container()->get( Status::class )->get_option();
    177         $site_plugins_dir = Config::get_container()->get( Core::SITE_PLUGIN_DIR );
    178         $opted_in_plugins = [];
    179 
    180         foreach ( $option['plugins'] as $plugin ) {
    181             $plugin_data = get_plugin_data( trailingslashit( $site_plugins_dir ) . $plugin['wp_slug'] );
    182             if ( true === $plugin['optin'] ) {
    183                 $opted_in_plugins[] = $plugin_data['Name'];
    184             }
    185         }
    186 
    187         return $opted_in_plugins;
     253            $user_name,
     254            $plugin_name
     255        );
    188256    }
    189257}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php

    r2886519 r3283684  
    2525 */
    2626class Status {
    27     public const OPTION_NAME     = 'stellarwp_telemetry';
    28     public const STATUS_ACTIVE   = 1;
    29     public const STATUS_INACTIVE = 2;
    30     public const STATUS_MIXED    = 3;
     27    public const OPTION_NAME           = 'stellarwp_telemetry';
     28    public const OPTION_NAME_USER_INFO = 'stellarwp_telemetry_user_info';
     29    public const STATUS_ACTIVE         = 1;
     30    public const STATUS_INACTIVE       = 2;
    3131
    3232    /**
     
    5656     */
    5757    public function get_option() {
    58         return get_option( $this->get_option_name(), [] );
     58        $option = get_option( $this->get_option_name(), [] );
     59
     60        return is_array( $option ) ? $option : [];
    5961    }
    6062
     
    6567     * 1 = Active
    6668     * 2 = Inactive
    67      * 3 = Mixed
    68      *
    69      * @since 1.0.0
     69     *
     70     * @since 1.0.0
     71     * @since 2.0.1 Correct logic so it is not subject to the order of the plugins.
     72     * @since 2.2.0 Update to remove unnecessary "mixed" status.
    7073     *
    7174     * @return integer The status value.
    7275     */
    7376    public function get() {
    74         $status = self::STATUS_ACTIVE;
    75         $option = $this->get_option();
    76 
    77         // If the status option is not an option, default to inactive.
    78         if ( ! isset( $option['plugins'] ) ) {
    79             return self::STATUS_INACTIVE;
    80         }
    81 
    82         foreach ( $option['plugins'] as $plugin ) {
    83 
    84             // If a plugin's status is false, we set the status as inactive.
    85             if ( false === (bool) $plugin['optin'] ) {
     77
     78        $status  = self::STATUS_INACTIVE;
     79        $option  = $this->get_option();
     80        $plugins = $option['plugins'] ?? [];
     81
     82        if ( count( $plugins ) === 0 ) {
     83            $status = self::STATUS_INACTIVE;
     84        }
     85
     86        foreach ( $plugins as $plugin ) {
     87
     88            // If any plugins are missing an optin status or at least one is false, set status to false.
     89            if ( ! isset( $plugin['optin'] ) || false === $plugin['optin'] ) {
    8690                $status = self::STATUS_INACTIVE;
    87                 continue;
    88             }
    89 
    90             // If another plugin's status is true and the status is already inactive, we set the status as mixed.
    91             if ( true === $plugin['optin'] && self::STATUS_INACTIVE === $status ) {
    92                 $status = self::STATUS_MIXED;
    9391                break;
    9492            }
     93
     94            $status = self::STATUS_ACTIVE;
    9595        }
    9696
     
    146146     * @since 1.0.0
    147147     *
    148      * @param string  $stellar_slug The unique slug identifier for the plugin.
    149      * @param boolean $status       The opt-in status for the plugin.
    150      *
    151      * @return boolean
    152      */
    153     public function add_plugin( string $stellar_slug, bool $status = false ) {
    154         $option = $this->get_option();
     148     * @param string  $stellar_slug    The unique slug identifier for the plugin.
     149     * @param boolean $status          The opt-in status for the plugin.
     150     * @param string  $plugin_basename The specific basename for the plugin.
     151     *
     152     * @return boolean
     153     */
     154    public function add_plugin( string $stellar_slug, bool $status = false, string $plugin_basename = '' ) {
     155        $option = $this->get_option();
     156
     157        if ( '' === $plugin_basename ) {
     158            $plugin_basename = Config::get_container()->get( Core::PLUGIN_BASENAME );
     159        }
    155160
    156161        $option['plugins'][ $stellar_slug ] = [
    157             'wp_slug' => Config::get_container()->get( Core::PLUGIN_BASENAME ),
     162            'wp_slug' => $plugin_basename,
    158163            'optin'   => $status,
    159164        ];
     
    202207
    203208        foreach ( $option['plugins'] as $stellar_slug => $plugin ) {
     209            if ( ! isset( $plugin['wp_slug'] ) ) {
     210                continue;
     211            }
     212
    204213            $plugin_data = get_plugin_data( trailingslashit( $site_plugins_dir ) . $plugin['wp_slug'] );
    205214
    206             if ( true === $plugin['optin'] ) {
     215            if ( isset( $plugin['optin'] ) && true === $plugin['optin'] ) {
    207216                $opted_in_plugins[] = [
    208217                    'slug'    => $stellar_slug,
     
    219228     *
    220229     * @since 1.0.0
    221      *
    222      * @param boolean $status The status to set (Active = 1, Inactive = 2, Mixed = 3).
    223      *
    224      * @return boolean
    225      */
    226     public function set_status( bool $status ) {
    227         $option = $this->get_option();
    228 
    229         $option['plugins'][ Config::get_stellar_slug() ]['optin'] = $status;
     230     * @since 2.0.0 - Updated to allow defined stellar_slug.
     231     *
     232     * @param boolean $status       The status to set.
     233     * @param string  $stellar_slug The stellar_slug to set the status of.
     234     *
     235     * @return boolean
     236     */
     237    public function set_status( bool $status, string $stellar_slug = '' ) {
     238        // If no stellar slug is passed, use the singular value.
     239        if ( '' === $stellar_slug ) {
     240            $stellar_slug = Config::get_stellar_slug();
     241        }
     242
     243        $option = $this->get_option();
     244
     245        $option['plugins'][ $stellar_slug ]['optin'] = $status;
    230246
    231247        return update_option( $this->get_option_name(), $option );
     
    240256     */
    241257    public function get_status() {
     258
    242259        $optin_label = '';
    243260
    244261        switch ( $this->get() ) {
    245             case self::STATUS_ACTIVE:
    246                 $optin_label = __( 'Active', 'stellarwp-telemetry-starter' );
     262            case 1:
     263                $optin_label = esc_html__( 'Active', 'stellarwp-telemetry' );
    247264                break;
    248             case self::STATUS_INACTIVE:
    249                 $optin_label = __( 'Inactive', 'stellarwp-telemetry-starter' );
    250                 break;
    251             case self::STATUS_MIXED:
    252                 $optin_label = __( 'Mixed', 'stellarwp-telemetry-starter' );
     265            case 2:
     266                $optin_label = esc_html__( 'Inactive', 'stellarwp-telemetry' );
    253267                break;
    254268        }
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Telemetry/Telemetry.php

    r2886519 r3283684  
    1616use RCP\StellarWP\Telemetry\Config;
    1717use RCP\StellarWP\Telemetry\Contracts\Data_Provider;
    18 use RCP\StellarWP\Telemetry\Core;
     18use RCP\StellarWP\Telemetry\Opt_In\Opt_In_Template;
    1919use RCP\StellarWP\Telemetry\Opt_In\Status;
    2020
     
    6363     * @since 1.0.0
    6464     *
    65      * @param boolean $force Force the creation of the site on the server.
    66      *
    67      * @return boolean
     65     * @param bool $force Force the creation of the site on the server.
     66     *
     67     * @return bool True if the site was registered, false otherwise.
    6868     */
    6969    public function register_site( bool $force = false ) {
     
    8484     *
    8585     * @since 1.0.0
     86     * @since 2.0.0 - Add support for setting the stellar slug.
     87     *
     88     * @param string $stellar_slug The slug to pass to the server when registering the site user.
     89     * @param string $opt_in_text  The opt-in text displayed to the user when they agreed to share their data.
    8690     *
    8791     * @return void
    8892     */
    89     public function register_user() {
     93    public function register_user( string $stellar_slug = '', string $opt_in_text = '' ) {
     94        if ( '' === $stellar_slug ) {
     95            $stellar_slug = Config::get_stellar_slug();
     96        }
     97
     98        $user_details = $this->get_user_details( $stellar_slug, $opt_in_text );
     99
    90100        try {
    91             $this->send( $this->get_user_details(), Config::get_server_url() . '/opt-in' );
     101            // Store the user info in the options table.
     102            update_option( Status::OPTION_NAME_USER_INFO, $user_details, false );
     103
     104            $this->send( $user_details, Config::get_server_url() . '/opt-in', false );
    92105        } catch ( \Error $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
    93106            // We don't want to throw errors if the server fails.
     
    108121     */
    109122    public function send_uninstall( string $plugin_slug, string $uninstall_reason_id, string $uninstall_reason, string $comment = '' ) {
    110         $response = $this->send(
     123        $this->send(
    111124            [
    112125                'access_token'        => $this->get_token(),
     
    116129                'comment'             => $comment,
    117130            ],
    118             $this->get_uninstall_url()
     131            $this->get_uninstall_url(),
     132            false
    119133        );
    120134    }
    121135
    122136    /**
     137     * Saves the telemetry server's auth token for the site.
     138     *
     139     * @since 1.0.0
     140     *
     141     * @param string $token The site token to authenticate the request with.
     142     *
     143     * @return bool
     144     */
     145    public function save_token( string $token ) {
     146        $option = array_merge(
     147            $this->get_option(),
     148            [
     149                'token' => $token,
     150            ]
     151        );
     152
     153        return update_option( $this->opt_in_status->get_option_name(), $option );
     154    }
     155
     156    /**
     157     * Determines if the current site is registered on the telemetry server.
     158     *
     159     * @since 1.0.0
     160     *
     161     * @return bool
     162     */
     163    public function is_registered() {
     164        // Check if the site is registered by checking if the token is set.
     165        $option = $this->get_option();
     166
     167        return ! empty( $option['token'] );
     168    }
     169
     170    /**
     171     * Sends data to the telemetry server.
     172     *
     173     * @since 1.0.0
     174     *
     175     * @return bool
     176     */
     177    public function send_data() {
     178        if ( ! $this->is_registered() ) {
     179            return false;
     180        }
     181
     182        if ( ! $this->opt_in_status->is_active() ) {
     183            return false;
     184        }
     185
     186        $response = $this->send( $this->get_send_data_args(), $this->get_send_data_url() );
     187
     188        return isset( $response['status'] );
     189    }
     190
     191    /**
     192     * Gets the stored auth token for the current site.
     193     *
     194     * @since 1.0.0
     195     *
     196     * @return string
     197     */
     198    public function get_token() {
     199        $option = $this->get_option();
     200
     201        return $option['token'] ?? '';
     202    }
     203
     204    /**
    123205     * Sends requests to the telemetry server and parses the response.
    124206     *
    125207     * @since 1.0.0
    126208     *
    127      * @param array  $data The array of data to send.
    128      * @param string $url  The url of the telemetry server.
     209     * @param array  $data     The array of data to send.
     210     * @param string $url      The url of the telemetry server.
     211     * @param bool   $blocking Whether the request should be blocking or not.
     212     * @param float  $timeout  The timeout for the request, `0` for no timeout.
    129213     *
    130214     * @return array|null
    131215     */
    132     protected function send( array $data, string $url ) {
    133         $response = $this->request( $url, $data );
     216    public function send( array $data, string $url, bool $blocking = true, float $timeout = 5.0 ) {
     217
     218        if ( ! $this->opt_in_status->is_active() ) {
     219            return null;
     220        }
     221
     222        $response = $this->request( $url, $data, $blocking, $timeout );
    134223
    135224        if ( is_wp_error( $response ) ) {
     
    151240     * @since 1.0.0
    152241     *
    153      * @param string $url  The url of the telemetry server.
    154      * @param array  $data The data to send.
     242     * @param string $url      The url of the telemetry server.
     243     * @param array  $data     The data to send.
     244     * @param bool   $blocking Whether the request should be blocking or not.
     245     * @param float  $timeout  The timeout for the request, `0` for no timeout.
    155246     *
    156247     * @return array|\WP_Error
    157248     */
    158     protected function request( string $url, array $data ) {
     249    protected function request( string $url, array $data, bool $blocking = true, float $timeout = 5.0 ) {
    159250        return wp_remote_post(
    160251            $url,
    161252            [
    162                 'body' => $data,
     253                'blocking' => $blocking,
     254                'timeout'  => $timeout,
     255                'body'     => $data,
    163256            ]
    164257        );
     
    251344     *
    252345     * @since 1.0.0
     346     * @since 2.0.0 - Add support for passing stellar_slug directly.
     347     *
     348     * @param string $stellar_slug The plugin slug to pass to the server when registering a site user.
     349     * @param string $opt_in_text  The opt-in text displayed to the user when they agreed to share their data.
    253350     *
    254351     * @return array
    255352     */
    256     protected function get_user_details() {
    257         $user = wp_get_current_user();
     353    protected function get_user_details( string $stellar_slug = '', string $opt_in_text = '' ) {
     354        if ( '' == $stellar_slug ) {
     355            $stellar_slug = Config::get_stellar_slug();
     356        }
     357
     358        $user     = wp_get_current_user();
     359        $template = Config::get_container()->get( Opt_In_Template::class );
     360
     361        $args = [
     362            'name'        => $user->display_name,
     363            'email'       => $user->user_email,
     364            'plugin_slug' => $stellar_slug,
     365            'opt_in_text' => $opt_in_text,
     366        ];
    258367
    259368        /**
     
    261370         *
    262371         * @since 1.0.0
    263          *
    264          * @param array $site_user_details
     372         * @since 2.0.0 - Add parameter for the current stellar_slug.
     373         *
     374         * @param array  $site_user_details The details passed to the telemetry server for registering a new site user.
     375         * @param string $stellar_slug      The current stellar slug passed with the user.
    265376         */
    266         $user_info = apply_filters(
    267             'stellarwp/telemetry/' . Config::get_hook_prefix() . 'register_site_user_details',
    268             [
    269                 'name'        => $user->display_name,
    270                 'email'       => $user->user_email,
    271                 'plugin_slug' => Config::get_stellar_slug(),
    272             ]
    273         );
     377        $user_info = apply_filters( 'stellarwp/telemetry/' . Config::get_hook_prefix() . 'register_site_user_details', $args, $stellar_slug );
    274378
    275379        return [ 'user' => wp_json_encode( $user_info ) ];
     
    288392
    289393    /**
    290      * Saves the telemetry server's auth token for the site.
    291      *
    292      * @since 1.0.0
    293      *
    294      * @param string $token The site token to authenticate the request with.
    295      *
    296      * @return bool
    297      */
    298     public function save_token( string $token ) {
    299         $option = array_merge(
    300             $this->get_option(),
    301             [
    302                 'token' => $token,
    303             ]
    304         );
    305 
    306         return update_option( $this->opt_in_status->get_option_name(), $option );
    307     }
    308 
    309     /**
    310      * Determines if the current site is registered on the telemetry server.
    311      *
    312      * @since 1.0.0
    313      *
    314      * @return boolean
    315      */
    316     public function is_registered() {
    317         // Check if the site is registered by checking if the token is set.
    318         $option = $this->get_option();
    319 
    320         return ! empty( $option['token'] );
    321     }
    322 
    323     /**
    324      * Sends data to the telemetry server.
    325      *
    326      * @since 1.0.0
    327      *
    328      * @return boolean
    329      */
    330     public function send_data() {
    331         if ( ! $this->is_registered() ) {
    332             return false;
    333         }
    334 
    335         if ( ! $this->opt_in_status->is_active() ) {
    336             return false;
    337         }
    338 
    339         $response = $this->send( $this->get_send_data_args(), $this->get_send_data_url() );
    340 
    341         return $response['status'] ?? false;
    342     }
    343 
    344     /**
    345394     * Gets the args for sending data to the telemetry server.
    346395     *
    347396     * @since 1.0.0
     397     * @since 2.3.0 - Updated to include the opted in user with the telemetry json.
    348398     *
    349399     * @return array
    350400     */
    351401    protected function get_send_data_args() {
     402        $opt_in_user = get_option( Status::OPTION_NAME_USER_INFO, [] );
     403        $telemetry   = $this->provider->get_data();
     404
     405        if ( count( $opt_in_user ) > 0 ) {
     406            $telemetry['opt_in_user'] = json_decode( $opt_in_user['user'], true );
     407        }
     408
     409        $args = [
     410            'token'         => $this->get_token(),
     411            'telemetry'     => wp_json_encode( $telemetry ),
     412            'stellar_slugs' => wp_json_encode( $this->opt_in_status->get_opted_in_plugins() ),
     413        ];
     414
    352415        return apply_filters(
    353416            'stellarwp/telemetry/' . Config::get_hook_prefix() . 'send_data_args',
    354             [
    355                 'token'         => $this->get_token(),
    356                 'telemetry'     => wp_json_encode( $this->provider->get_data() ),
    357                 'stellar_slugs' => wp_json_encode( $this->opt_in_status->get_opted_in_plugins() ),
    358             ]
     417            $args
    359418        );
    360419    }
     
    377436        return apply_filters( 'stellarwp/telemetry/' . Config::get_hook_prefix() . 'send_data_url', Config::get_server_url() . '/telemetry' );
    378437    }
    379 
    380     /**
    381      * Gets the stored auth token for the current site.
    382      *
    383      * @since 1.0.0
    384      *
    385      * @return string
    386      */
    387     protected function get_token() {
    388         $option = $this->get_option();
    389 
    390         return $option['token'] ?? '';
    391     }
    392 
    393438}
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Uninstall.php

    r2886519 r3283684  
    3434     * @return void
    3535     */
    36     public static function run( string $stellar_slug ) {
     36    public static function run( $stellar_slug ) {
    3737        $opt_in_status = new Status();
    3838
     
    6161        $optin = get_option( 'stellarwp_telemetry' );
    6262
    63         // Bail if option has more than 'token' in the array.
    64         if ( count( $optin ) > 1 ) {
     63        // Bail if option is not set or has more than 'token' in the array.
     64        if ( false === $optin || count( $optin ) > 1 ) {
    6565            return;
    6666        }
  • restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/views/optin.php

    r2886519 r3283684  
    5656            <form method="post" action="" data-js="optin-form">
    5757                <input type="hidden" name="action" value="stellarwp-telemetry">
     58                <input type="hidden" name="stellar_slug" value="<?php echo esc_attr( $args['plugin_slug'] ); ?>">
     59                <input type="hidden" name="opt_in_text" value="<?php echo esc_attr( $args['intro'] ); ?>">
    5860                <?php wp_nonce_field( 'stellarwp-telemetry' ); ?>
    5961                <button class="stellarwp-telemetry-btn-primary" data-js="form-submit" type="submit" name="optin-agreed" value="true">
Note: See TracChangeset for help on using the changeset viewer.