Changeset 3283684
- Timestamp:
- 04/28/2025 10:04:41 PM (8 months ago)
- Location:
- restrict-content/tags/3.2.14.1
- Files:
-
- 5 added
- 28 edited
- 1 copied
-
. (copied) (copied from restrict-content/trunk)
-
composer.json (modified) (3 diffs)
-
core/includes/class-restrict-content.php (modified) (1 diff)
-
core/includes/integrations/class-rcp-telemetry.php (modified) (2 diffs)
-
lang/restrict-content.pot (modified) (14 diffs)
-
legacy/restrictcontent.php (modified) (1 diff)
-
package.json (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
restrictcontent.php (modified) (2 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (2 diffs)
-
vendor/composer/autoload_static.php (modified) (2 diffs)
-
vendor/strauss/autoload-classmap.php (modified) (2 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Admin/Admin_Subscriber.php (modified) (4 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Admin/Resources.php (modified) (1 diff)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Config.php (modified) (8 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Abstract_Subscriber.php (modified) (1 diff)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Subscriber_Interface.php (modified) (1 diff)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Template_Interface.php (modified) (2 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Core.php (modified) (3 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Data_Providers/Null_Data_Provider.php (added)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Events (added)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Events/Event.php (added)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Events/Event_Subscriber.php (added)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Events/index.php (added)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Exit_Interview_Subscriber.php (modified) (10 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php (modified) (5 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Last_Send/Last_Send.php (modified) (1 diff)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Subscriber.php (modified) (7 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php (modified) (4 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php (modified) (7 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Telemetry/Telemetry.php (modified) (10 diffs)
-
vendor/strauss/stellarwp/telemetry/src/Telemetry/Uninstall.php (modified) (2 diffs)
-
vendor/strauss/stellarwp/telemetry/src/views/optin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
restrict-content/tags/3.2.14.1/composer.json
r3227065 r3283684 1 1 { 2 2 "name": "restrictcontent/restrict-content", 3 "version": "3.2.14 ",3 "version": "3.2.14.1", 4 4 "type": "wordpress-plugin", 5 5 "description": "A simple, yet powerful membership solution for WordPress.", … … 39 39 "psr/container": "^1.0", 40 40 "stellarwp/container-contract": "^1.0", 41 "stellarwp/telemetry": " ^1.0.5"41 "stellarwp/telemetry": "2.3.4" 42 42 }, 43 43 "autoload": { … … 70 70 "packages": [ 71 71 "lucatume/di52", 72 "psr/container",73 72 "stellarwp/container-contract", 74 73 "stellarwp/telemetry" -
restrict-content/tags/3.2.14.1/core/includes/class-restrict-content.php
r3227065 r3283684 27 27 */ 28 28 final class Restrict_Content_Pro { 29 const VERSION = '3.5.45 ';29 const VERSION = '3.5.45.1'; 30 30 31 31 /** -
restrict-content/tags/3.2.14.1/core/includes/integrations/class-rcp-telemetry.php
r3227065 r3283684 121 121 } 122 122 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 } 125 134 126 135 if ( ( $opt_in_status && ( basename( RCP_ROOT ) . '/restrict-content-pro.php' === $plugin_file ) ) … … 183 192 $redirect = add_query_arg( 'rcp_message', '', esc_url( admin_url( 'admin.php?page=rcp-settings' ) ) ); 184 193 } else { 185 $this->container->get( Status::class )->set_status( $value);194 $this->container->get( Status::class )->set_status( false, $stellar_slug ); 186 195 $redirect = add_query_arg( 'rcp_message', 'opt_out_message', esc_url( admin_url( 'admin.php?page=rcp-settings' ) ) ); 187 196 } -
restrict-content/tags/3.2.14.1/lang/restrict-content.pot
r3227065 r3283684 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Restrict Content 3.2.14 \n"5 "Project-Id-Version: Restrict Content 3.2.14.1\n" 6 6 "Report-Msgid-Bugs-To: http://ithemes.com/support/\n" 7 "POT-Creation-Date: 2025-0 1-22 19:36:31+00:00\n"7 "POT-Creation-Date: 2025-04-28 21:57:22+00:00\n" 8 8 "PO-Revision-Date: 2025-MO-DA HO:MI+ZONE\n" 9 9 "MIME-Version: 1.0\n" … … 1704 1704 #: core/includes/admin/subscriptions/subscription-levels.php:170 1705 1705 #: core/includes/misc-functions.php:1600 1706 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:2 461706 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:263 1707 1707 msgid "Active" 1708 1708 msgstr "" … … 4726 4726 #: core/includes/admin/subscriptions/subscription-levels.php:171 4727 4727 #: core/includes/misc-functions.php:1601 4728 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:2 494728 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:266 4729 4729 msgid "Inactive" 4730 4730 msgstr "" … … 6253 6253 #. translators: %s: The admin URL. 6254 6254 6255 #: core/includes/integrations/class-rcp-telemetry.php:13 06255 #: core/includes/integrations/class-rcp-telemetry.php:139 6256 6256 msgid "<a href=\"%1$s\" alt=\"%2$s\">Opt-Out</a>" 6257 6257 msgstr "" … … 6259 6259 #. translators: %s: The Opt-Out alt text. 6260 6260 6261 #: core/includes/integrations/class-rcp-telemetry.php:1 336261 #: core/includes/integrations/class-rcp-telemetry.php:142 6262 6262 msgid "Change to Opt Out Status" 6263 6263 msgstr "" … … 6265 6265 #. translators: %s: The admin URL. 6266 6266 6267 #: core/includes/integrations/class-rcp-telemetry.php:1 396267 #: core/includes/integrations/class-rcp-telemetry.php:148 6268 6268 msgid "<a href=\"%1$s\" alt=\"%2$s\">Opt In</a>" 6269 6269 msgstr "" … … 6271 6271 #. translators: %s: The Opt-Out alt text. 6272 6272 6273 #: core/includes/integrations/class-rcp-telemetry.php:1 426273 #: core/includes/integrations/class-rcp-telemetry.php:151 6274 6274 msgid "Change to Opt In Status" 6275 6275 msgstr "" … … 6277 6277 #. translators: %s: The RCP Title. 6278 6278 6279 #: core/includes/integrations/class-rcp-telemetry.php:3 326279 #: core/includes/integrations/class-rcp-telemetry.php:341 6280 6280 msgid "These are %s fields that we use for analysis and to make the product better." 6281 6281 msgstr "" 6282 6282 6283 #: core/includes/integrations/class-rcp-telemetry.php:3 376283 #: core/includes/integrations/class-rcp-telemetry.php:346 6284 6284 msgid "Version" 6285 6285 msgstr "" 6286 6286 6287 #: core/includes/integrations/class-rcp-telemetry.php:3 416287 #: core/includes/integrations/class-rcp-telemetry.php:350 6288 6288 msgid "Last Updated" 6289 6289 msgstr "" 6290 6290 6291 #: core/includes/integrations/class-rcp-telemetry.php:3 456291 #: core/includes/integrations/class-rcp-telemetry.php:354 6292 6292 msgid "Total Membership Levels" 6293 6293 msgstr "" 6294 6294 6295 #: core/includes/integrations/class-rcp-telemetry.php:3 496295 #: core/includes/integrations/class-rcp-telemetry.php:358 6296 6296 msgid "Total Paid Membership Levels" 6297 6297 msgstr "" 6298 6298 6299 #: core/includes/integrations/class-rcp-telemetry.php:3 536299 #: core/includes/integrations/class-rcp-telemetry.php:362 6300 6300 msgid "Total Free Membership Levels" 6301 6301 msgstr "" 6302 6302 6303 #: core/includes/integrations/class-rcp-telemetry.php:3 576303 #: core/includes/integrations/class-rcp-telemetry.php:366 6304 6304 msgid "Total One-Time Membership Levels" 6305 6305 msgstr "" 6306 6306 6307 #: core/includes/integrations/class-rcp-telemetry.php:3 616307 #: core/includes/integrations/class-rcp-telemetry.php:370 6308 6308 msgid "Total Recurring Membership Levels" 6309 6309 msgstr "" 6310 6310 6311 #: core/includes/integrations/class-rcp-telemetry.php:3 656311 #: core/includes/integrations/class-rcp-telemetry.php:374 6312 6312 msgid "Total Paying Customers" 6313 6313 msgstr "" 6314 6314 6315 #: core/includes/integrations/class-rcp-telemetry.php:3 696315 #: core/includes/integrations/class-rcp-telemetry.php:378 6316 6316 msgid "Total Free Customers" 6317 6317 msgstr "" 6318 6318 6319 #: core/includes/integrations/class-rcp-telemetry.php:3 736319 #: core/includes/integrations/class-rcp-telemetry.php:382 6320 6320 msgid "Total No-Membership Customers" 6321 6321 msgstr "" 6322 6322 6323 #: core/includes/integrations/class-rcp-telemetry.php:3 776323 #: core/includes/integrations/class-rcp-telemetry.php:386 6324 6324 msgid "Is Multiple Memberships" 6325 6325 msgstr "" 6326 6326 6327 #: core/includes/integrations/class-rcp-telemetry.php:3 816327 #: core/includes/integrations/class-rcp-telemetry.php:390 6328 6328 msgid "Total Revenue This Month" 6329 6329 msgstr "" 6330 6330 6331 #: core/includes/integrations/class-rcp-telemetry.php:3 856331 #: core/includes/integrations/class-rcp-telemetry.php:394 6332 6332 msgid "Payment Gateways" 6333 6333 msgstr "" 6334 6334 6335 #: core/includes/integrations/class-rcp-telemetry.php:3 896335 #: core/includes/integrations/class-rcp-telemetry.php:398 6336 6336 msgid "Active Add-ons" 6337 6337 msgstr "" 6338 6338 6339 #: core/includes/integrations/class-rcp-telemetry.php: 3936339 #: core/includes/integrations/class-rcp-telemetry.php:402 6340 6340 msgid "Deactivated Add-ons" 6341 6341 msgstr "" … … 7868 7868 msgstr "" 7869 7869 7870 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php: 747870 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:68 7871 7871 msgid "We’re sorry to see you go." 7872 7872 msgstr "" 7873 7873 7874 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php: 757874 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:69 7875 7875 msgid "We’d love to know why you’re leaving so we can improve our plugin." 7876 7876 msgstr "" 7877 7877 7878 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:7 97878 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:73 7879 7879 msgid "I couldn’t understand how to make it work." 7880 7880 msgstr "" 7881 7881 7882 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php: 837882 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:77 7883 7883 msgid "I found a better plugin." 7884 7884 msgstr "" 7885 7885 7886 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:8 77886 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:81 7887 7887 msgid "I need a specific feature it doesn’t provide." 7888 7888 msgstr "" 7889 7889 7890 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php: 917890 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:85 7891 7891 msgid "The plugin doesn’t work." 7892 7892 msgstr "" 7893 7893 7894 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php: 957894 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php:89 7895 7895 msgid "Other" 7896 7896 msgstr "" 7897 7897 7898 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:7 97898 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:73 7899 7899 msgid "See which plugins you have opted in to tracking for" 7900 7900 msgstr "" … … 7902 7902 #. Translators: The plugin name. 7903 7903 7904 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:8 67904 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:80 7905 7905 msgid "We hope you love %s." 7906 7906 msgstr "" … … 7908 7908 #. Translators: The user name and the plugin name. 7909 7909 7910 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php: 917910 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Template.php:246 7911 7911 msgid "" 7912 7912 "Hi, %1$s! This is an invitation to help our StellarWP community.\n" … … 7916 7916 msgstr "" 7917 7917 7918 #: vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php:2527919 msgid "Mixed"7920 msgstr ""7921 7922 7918 #: vendor/strauss/stellarwp/telemetry/src/views/exit-interview.php:26 7923 7919 msgid "Tell us more..." … … 7929 7925 7930 7926 #: vendor/strauss/stellarwp/telemetry/src/views/exit-interview.php:37 7931 #: vendor/strauss/stellarwp/telemetry/src/views/optin.php:6 37927 #: vendor/strauss/stellarwp/telemetry/src/views/optin.php:65 7932 7928 msgid "Skip" 7933 7929 msgstr "" … … 7949 7945 msgstr "" 7950 7946 7951 #: vendor/strauss/stellarwp/telemetry/src/views/optin.php:6 07947 #: vendor/strauss/stellarwp/telemetry/src/views/optin.php:62 7952 7948 msgid "Allow & Continue" 7953 7949 msgstr "" -
restrict-content/tags/3.2.14.1/legacy/restrictcontent.php
r3227065 r3283684 22 22 23 23 if ( ! defined( 'RC_PLUGIN_VERSION' ) ) { 24 define( 'RC_PLUGIN_VERSION', '3.2.14 ' );24 define( 'RC_PLUGIN_VERSION', '3.2.14.1' ); 25 25 } 26 26 -
restrict-content/tags/3.2.14.1/package.json
r3227065 r3283684 1 1 { 2 2 "name": "restrict-content", 3 "version": "3.2.14 ",3 "version": "3.2.14.1", 4 4 "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.", 5 5 "homepage": "https://restrictcontentpro.com/", -
restrict-content/tags/3.2.14.1/readme.txt
r3227065 r3283684 6 6 Requires at least: 6.0 7 7 Requires PHP: 7.4 8 Tested up to: 6. 79 Stable tag: 3.2.14 8 Tested up to: 6.8 9 Stable tag: 3.2.14.1 10 10 11 11 Restrict Content is a powerful WordPress membership plugin that gives you full control over who can and cannot view content on your WordPress site. … … 258 258 == Changelog == 259 259 260 = 3.2.14.1 = 261 * Security: Added more safety checks to telemetry opt-ins/opt-outs. 262 260 263 = 3.2.14 = 261 264 * Fix: Updated PayPal's transaction and subscription details URLs -
restrict-content/tags/3.2.14.1/restrictcontent.php
r3227065 r3283684 4 4 * Plugin URI: https://restrictcontentpro.com 5 5 * 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 7 7 * Author: StellarWP 8 8 * Author URI: https://stellarwp.com/ … … 19 19 define('RCP_ROOT', plugin_dir_path(__FILE__)); 20 20 define('RCP_WEB_ROOT', plugin_dir_url(__FILE__)); 21 define('RCF_VERSION', '3.2.14 ');21 define('RCF_VERSION', '3.2.14.1'); 22 22 23 23 // Load Strauss autoload. -
restrict-content/tags/3.2.14.1/vendor/autoload.php
r3227065 r3283684 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 7c8c0149486a62d837507dbce9babced::getLoader();25 return ComposerAutoloaderInitf0134d9d141ea683567d02f6dd907ba6::getLoader(); -
restrict-content/tags/3.2.14.1/vendor/composer/autoload_real.php
r3227065 r3283684 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 7c8c0149486a62d837507dbce9babced5 class ComposerAutoloaderInitf0134d9d141ea683567d02f6dd907ba6 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 7c8c0149486a62d837507dbce9babced', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitf0134d9d141ea683567d02f6dd907ba6', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 7c8c0149486a62d837507dbce9babced', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitf0134d9d141ea683567d02f6dd907ba6', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 7c8c0149486a62d837507dbce9babced::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
restrict-content/tags/3.2.14.1/vendor/composer/autoload_static.php
r3227065 r3283684 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 7c8c0149486a62d837507dbce9babced7 class ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 67 67 { 68 68 return \Closure::bind(function () use ($loader) { 69 $loader->prefixLengthsPsr4 = ComposerStaticInit 7c8c0149486a62d837507dbce9babced::$prefixLengthsPsr4;70 $loader->prefixDirsPsr4 = ComposerStaticInit 7c8c0149486a62d837507dbce9babced::$prefixDirsPsr4;71 $loader->classMap = ComposerStaticInit 7c8c0149486a62d837507dbce9babced::$classMap;69 $loader->prefixLengthsPsr4 = ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6::$prefixLengthsPsr4; 70 $loader->prefixDirsPsr4 = ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6::$prefixDirsPsr4; 71 $loader->classMap = ComposerStaticInitf0134d9d141ea683567d02f6dd907ba6::$classMap; 72 72 73 73 }, null, ClassLoader::class); -
restrict-content/tags/3.2.14.1/vendor/strauss/autoload-classmap.php
r3227065 r3283684 11 11 'RCP\StellarWP\Telemetry\Opt_In\Status' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php', 12 12 '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', 13 15 'RCP\StellarWP\Telemetry\Uninstall' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Uninstall.php', 14 16 'RCP\StellarWP\Telemetry\Telemetry\Telemetry_Subscriber' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Telemetry/Telemetry_Subscriber.php', … … 25 27 'RCP\StellarWP\Telemetry\Contracts\Subscriber_Interface' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Contracts/Subscriber_Interface.php', 26 28 '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', 27 30 'RCP\StellarWP\Telemetry\Admin\Resources' => $strauss_src . '/stellarwp/telemetry/src/Telemetry/Admin/Resources.php', 28 31 '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 14 14 namespace RCP\StellarWP\Telemetry\Admin; 15 15 16 use RCP\StellarWP\Telemetry\Config; 16 17 use RCP\StellarWP\Telemetry\Contracts\Abstract_Subscriber; 17 18 use RCP\StellarWP\Telemetry\Opt_In\Opt_In_Template; … … 35 36 public function register(): void { 36 37 add_action( 'admin_init', [ $this, 'maybe_enqueue_admin_assets' ] ); 37 38 38 } 39 39 … … 42 42 * 43 43 * @since 1.0.0 44 * @since 2.0.0 - Adjust to output assets if any stellar slug should render its modal. 44 45 * 45 46 * @return void … … 48 49 global $pagenow; 49 50 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 ) { 51 62 $this->container->get( Resources::class )->enqueue_admin_assets(); 52 63 } 53 64 } 54 55 65 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Admin/Resources.php
r2886519 r3283684 135 135 return plugin_dir_url( dirname( __DIR__ ) ); 136 136 } 137 138 137 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Config.php
r2886519 r3283684 30 30 * @since 1.0.0 31 31 * 32 * @var \RCP\StellarWP\ContainerContract\ContainerInterface32 * @var ?\RCP\StellarWP\ContainerContract\ContainerInterface 33 33 */ 34 34 protected static $container; … … 51 51 */ 52 52 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 = []; 53 62 54 63 /** … … 101 110 102 111 /** 103 * Gets the stellar slug server url.112 * Gets the stellar slug. 104 113 * 105 114 * @since 1.0.0 … … 109 118 public static function get_stellar_slug() { 110 119 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; 111 131 } 112 132 … … 133 153 static::$server_url = 'https://telemetry.stellarwp.com/api/v1'; 134 154 static::$stellar_slug = ''; 155 static::$container = null; 135 156 } 136 157 … … 166 187 } 167 188 168 169 189 /** 170 190 * Sets the stellar slug. … … 178 198 public static function set_stellar_slug( string $stellar_slug ) { 179 199 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; 180 221 } 181 222 … … 192 233 static::$server_url = $url; 193 234 } 194 195 235 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Abstract_Subscriber.php
r2886519 r3283684 34 34 $this->container = $container; 35 35 } 36 37 36 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Subscriber_Interface.php
r2886519 r3283684 25 25 */ 26 26 public function register(); 27 28 27 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Contracts/Template_Interface.php
r2886519 r3283684 22 22 * 23 23 * @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. 24 27 * 25 28 * @return void 26 29 */ 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 ); 37 31 38 32 /** … … 40 34 * 41 35 * @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. 42 39 * 43 40 * @return boolean 44 41 */ 45 public function should_render( );42 public function should_render( string $stellar_slug ); 46 43 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Core.php
r2886519 r3283684 19 19 use RCP\StellarWP\Telemetry\Contracts\Data_Provider; 20 20 use RCP\StellarWP\Telemetry\Data_Providers\Debug_Data; 21 use RCP\StellarWP\Telemetry\Events\Event_Subscriber; 21 22 use RCP\StellarWP\Telemetry\Exit_Interview\Exit_Interview_Subscriber; 22 23 use RCP\StellarWP\Telemetry\Exit_Interview\Template; 24 use RCP\StellarWP\Telemetry\Last_Send\Last_Send; 23 25 use RCP\StellarWP\Telemetry\Last_Send\Last_Send_Subscriber; 24 26 use RCP\StellarWP\Telemetry\Opt_In\Opt_In_Subscriber; … … 50 52 Admin_Subscriber::class, 51 53 Exit_Interview_Subscriber::class, 54 Event_Subscriber::class, 52 55 Last_Send_Subscriber::class, 53 56 Opt_In_Subscriber::class, … … 130 133 $container = Config::get_container(); 131 134 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 132 144 $container->bind( self::PLUGIN_BASENAME, plugin_basename( $plugin_path ) ); 133 145 $container->bind( self::PLUGIN_FILE, $plugin_path ); 134 146 $container->bind( self::SITE_PLUGIN_DIR, dirname( plugin_dir_path( $plugin_path ) ) ); 135 147 $container->bind( Data_Provider::class, Debug_Data::class ); 148 $container->bind( Status::class, Status::class ); 149 $container->bind( Last_Send::class, Last_Send::class ); 136 150 $container->bind( 137 151 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 16 16 use RCP\StellarWP\Telemetry\Contracts\Abstract_Subscriber; 17 17 use RCP\StellarWP\Telemetry\Config; 18 use RCP\StellarWP\Telemetry\Core;19 18 use RCP\StellarWP\Telemetry\Opt_In\Status; 20 19 use RCP\StellarWP\Telemetry\Telemetry\Telemetry; … … 48 47 add_action( 'wp_ajax_' . self::AJAX_ACTION, [ $this, 'ajax_exit_interview' ] ); 49 48 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 } 52 54 } 53 55 … … 63 65 64 66 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 } 66 75 } 67 76 } … … 71 80 * 72 81 * @since 1.0.0 82 * @since 2.3.4 - Added user capability check. 73 83 * 74 84 * @return void 75 85 */ 76 86 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 ); 78 90 $uninstall_reason_id = ! empty( $uninstall_reason_id ) ? $uninstall_reason_id : false; 79 91 if ( ! $uninstall_reason_id ) { … … 81 93 } 82 94 83 $uninstall_reason = filter_input( INPUT_POST, 'uninstall_reason', FILTER_SANITIZE_S TRING);95 $uninstall_reason = filter_input( INPUT_POST, 'uninstall_reason', FILTER_SANITIZE_SPECIAL_CHARS ); 84 96 $uninstall_reason = ! empty( $uninstall_reason ) ? $uninstall_reason : false; 85 97 if ( ! $uninstall_reason ) { … … 87 99 } 88 100 89 $plugin_slug = filter_input( INPUT_POST, 'plugin_slug', FILTER_SANITIZE_S TRING);101 $plugin_slug = filter_input( INPUT_POST, 'plugin_slug', FILTER_SANITIZE_SPECIAL_CHARS ); 90 102 91 $comment = filter_input( INPUT_POST, 'comment', FILTER_SANITIZE_S TRING);103 $comment = filter_input( INPUT_POST, 'comment', FILTER_SANITIZE_SPECIAL_CHARS ); 92 104 $comment = ! empty( $comment ) ? $comment : ''; 93 105 94 $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING ); 106 // Validate nonce. 107 $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_SPECIAL_CHARS ); 95 108 $nonce = ! empty( $nonce ) ? $nonce : ''; 96 109 97 110 if ( ! wp_verify_nonce( $nonce, self::AJAX_ACTION ) ) { 98 111 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' ); 99 117 } 100 118 … … 110 128 * The deactivation is deferred to the modal displayed. 111 129 * 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. 113 132 * 114 133 * @since 1.0.0 … … 116 135 * @return array 117 136 */ 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 119 148 $passed_deactivate = false; 120 149 $deactivate_link = ''; … … 137 166 138 167 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>'; 140 169 141 170 // Append deactivation link. … … 145 174 return array_merge( $before_deactivate, $after_deactivate ); 146 175 } 147 148 176 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Exit_Interview/Template.php
r2886519 r3283684 18 18 use RCP\StellarWP\Telemetry\Config; 19 19 use RCP\StellarWP\Telemetry\Contracts\Template_Interface; 20 use RCP\StellarWP\Telemetry\Core;21 20 22 21 /** … … 53 52 * 54 53 * @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. 55 57 * 56 58 * @return array 57 59 */ 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 59 95 /** 60 96 * Filters the "Exit Interview" modal arguments. 61 97 * 98 * Planned deprecation: 3.0.0 99 * Use stellarwp/telemetry/exit_interview_args filter instead. 100 * 62 101 * @since 1.0.0 102 * @since 2.0.0 - Added the current stellar slug. 63 103 * 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. 65 106 */ 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; 101 122 } 102 123 … … 106 127 * @since 1.0.0 107 128 * 129 * @param string $stellar_slug The stellar slug to be referenced when the modal is rendered. 130 * 108 131 * @return void 109 132 */ 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 ) ); 112 135 } 113 136 … … 117 140 * @since 1.0.0 118 141 * 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. 129 143 * 130 144 * @return boolean 131 145 */ 132 public function should_render( ) {146 public function should_render( string $stellar_slug ) { 133 147 /** 134 148 * Filters whether the "Exit Interview" modal should render. 135 149 * 136 150 * @since 1.0.0 151 * @since 2.0.0 - Update to include current stellar slug. 137 152 * 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. 139 155 */ 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 ); 141 157 } 142 158 … … 146 162 * @since 1.0.0 147 163 * 164 * @param string $stellar_slug The stellar slug that could be rendered. 165 * 148 166 * @return void 149 167 */ 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 ); 153 171 } 154 172 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Last_Send/Last_Send.php
r2886519 r3283684 135 135 return $result; 136 136 } 137 138 137 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Opt_In_Subscriber.php
r2886519 r3283684 33 33 */ 34 34 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 36 44 add_action( 'admin_init', [ $this, 'set_optin_status' ] ); 37 45 add_action( 'init', [ $this, 'initialize_optin_option' ] ); … … 42 50 * 43 51 * @since 1.0.0 52 * @since 2.3.4 - Added user capability check. 44 53 * 45 54 * @return void … … 58 67 } 59 68 69 // Check sent data before we do any database checks for faster failures. 60 70 // We're not attempting a telemetry action. 61 71 if ( isset( $_POST['action'] ) && 'stellarwp-telemetry' !== $_POST['action'] ) { … … 68 78 } 69 79 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 70 97 // User agreed to opt-in to Telemetry. 71 98 if ( 'true' === $_POST['optin-agreed'] ) { 72 $this->opt_in( );99 $this->opt_in( $stellar_slug, $opt_in_text ); 73 100 } 74 101 75 102 // 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' ); 77 104 } 78 105 … … 81 108 * 82 109 * @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. 83 113 * 84 114 * @return void 85 115 */ 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 ); 88 122 } 89 123 … … 99 133 */ 100 134 public function initialize_optin_option() { 101 $stellar_slug = Config::get_stellar_slug();102 135 $opt_in_template = $this->container->get( Opt_In_Template::class ); 103 136 $opt_in_status = $this->container->get( Status::class ); 104 137 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 ); 108 143 109 update_option( $opt_in_template->get_option_name(), '1' ); 144 update_option( $opt_in_template->get_option_name( $stellar_slug ), '1' ); 145 } 110 146 } 111 147 } … … 115 151 * 116 152 * @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. 117 158 * 118 159 * @return void 119 160 */ 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 ); 122 163 123 164 try { 124 165 $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 ); 126 167 } catch ( \Error $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch 127 168 // 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 49 49 50 50 /** 51 * @inheritDoc52 *53 * @return void54 */55 public function enqueue(): void {56 // TODO: Once FE template is done, enqueue it here.57 }58 59 /**60 51 * Gets the arguments for configuring how the Opt-In modal is rendered. 61 52 * 62 53 * @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. 63 57 * 64 58 * @return array 65 59 */ 66 p rotected function get_args() {60 public function get_args( string $stellar_slug ) { 67 61 68 62 $optin_args = [ … … 72 66 'plugin_logo_alt' => 'StellarWP Logo', 73 67 'plugin_name' => 'StellarWP', 74 'plugin_slug' => Config::get_stellar_slug(),68 'plugin_slug' => $stellar_slug, 75 69 'user_name' => wp_get_current_user()->display_name, 76 70 'permissions_url' => '#', … … 87 81 $optin_args['plugin_name'] 88 82 ); 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( 90 245 // Translators: The user name and the plugin name. 91 __(246 esc_html__( 92 247 'Hi, %1$s! This is an invitation to help our StellarWP community. 93 248 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). … … 96 251 'stellarwp-telemetry' 97 252 ), 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 ); 188 256 } 189 257 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Opt_In/Status.php
r2886519 r3283684 25 25 */ 26 26 class 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; 31 31 32 32 /** … … 56 56 */ 57 57 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 : []; 59 61 } 60 62 … … 65 67 * 1 = Active 66 68 * 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. 70 73 * 71 74 * @return integer The status value. 72 75 */ 73 76 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'] ) { 86 90 $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;93 91 break; 94 92 } 93 94 $status = self::STATUS_ACTIVE; 95 95 } 96 96 … … 146 146 * @since 1.0.0 147 147 * 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 } 155 160 156 161 $option['plugins'][ $stellar_slug ] = [ 157 'wp_slug' => Config::get_container()->get( Core::PLUGIN_BASENAME ),162 'wp_slug' => $plugin_basename, 158 163 'optin' => $status, 159 164 ]; … … 202 207 203 208 foreach ( $option['plugins'] as $stellar_slug => $plugin ) { 209 if ( ! isset( $plugin['wp_slug'] ) ) { 210 continue; 211 } 212 204 213 $plugin_data = get_plugin_data( trailingslashit( $site_plugins_dir ) . $plugin['wp_slug'] ); 205 214 206 if ( true === $plugin['optin'] ) {215 if ( isset( $plugin['optin'] ) && true === $plugin['optin'] ) { 207 216 $opted_in_plugins[] = [ 208 217 'slug' => $stellar_slug, … … 219 228 * 220 229 * @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; 230 246 231 247 return update_option( $this->get_option_name(), $option ); … … 240 256 */ 241 257 public function get_status() { 258 242 259 $optin_label = ''; 243 260 244 261 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' ); 247 264 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' ); 253 267 break; 254 268 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Telemetry/Telemetry.php
r2886519 r3283684 16 16 use RCP\StellarWP\Telemetry\Config; 17 17 use RCP\StellarWP\Telemetry\Contracts\Data_Provider; 18 use RCP\StellarWP\Telemetry\ Core;18 use RCP\StellarWP\Telemetry\Opt_In\Opt_In_Template; 19 19 use RCP\StellarWP\Telemetry\Opt_In\Status; 20 20 … … 63 63 * @since 1.0.0 64 64 * 65 * @param bool ean$force Force the creation of the site on the server.66 * 67 * @return bool ean65 * @param bool $force Force the creation of the site on the server. 66 * 67 * @return bool True if the site was registered, false otherwise. 68 68 */ 69 69 public function register_site( bool $force = false ) { … … 84 84 * 85 85 * @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. 86 90 * 87 91 * @return void 88 92 */ 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 90 100 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 ); 92 105 } catch ( \Error $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch 93 106 // We don't want to throw errors if the server fails. … … 108 121 */ 109 122 public function send_uninstall( string $plugin_slug, string $uninstall_reason_id, string $uninstall_reason, string $comment = '' ) { 110 $ response = $this->send(123 $this->send( 111 124 [ 112 125 'access_token' => $this->get_token(), … … 116 129 'comment' => $comment, 117 130 ], 118 $this->get_uninstall_url() 131 $this->get_uninstall_url(), 132 false 119 133 ); 120 134 } 121 135 122 136 /** 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 /** 123 205 * Sends requests to the telemetry server and parses the response. 124 206 * 125 207 * @since 1.0.0 126 208 * 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. 129 213 * 130 214 * @return array|null 131 215 */ 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 ); 134 223 135 224 if ( is_wp_error( $response ) ) { … … 151 240 * @since 1.0.0 152 241 * 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. 155 246 * 156 247 * @return array|\WP_Error 157 248 */ 158 protected function request( string $url, array $data ) {249 protected function request( string $url, array $data, bool $blocking = true, float $timeout = 5.0 ) { 159 250 return wp_remote_post( 160 251 $url, 161 252 [ 162 'body' => $data, 253 'blocking' => $blocking, 254 'timeout' => $timeout, 255 'body' => $data, 163 256 ] 164 257 ); … … 251 344 * 252 345 * @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. 253 350 * 254 351 * @return array 255 352 */ 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 ]; 258 367 259 368 /** … … 261 370 * 262 371 * @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. 265 376 */ 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 ); 274 378 275 379 return [ 'user' => wp_json_encode( $user_info ) ]; … … 288 392 289 393 /** 290 * Saves the telemetry server's auth token for the site.291 *292 * @since 1.0.0293 *294 * @param string $token The site token to authenticate the request with.295 *296 * @return bool297 */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.0313 *314 * @return boolean315 */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.0327 *328 * @return boolean329 */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 /**345 394 * Gets the args for sending data to the telemetry server. 346 395 * 347 396 * @since 1.0.0 397 * @since 2.3.0 - Updated to include the opted in user with the telemetry json. 348 398 * 349 399 * @return array 350 400 */ 351 401 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 352 415 return apply_filters( 353 416 '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 359 418 ); 360 419 } … … 377 436 return apply_filters( 'stellarwp/telemetry/' . Config::get_hook_prefix() . 'send_data_url', Config::get_server_url() . '/telemetry' ); 378 437 } 379 380 /**381 * Gets the stored auth token for the current site.382 *383 * @since 1.0.0384 *385 * @return string386 */387 protected function get_token() {388 $option = $this->get_option();389 390 return $option['token'] ?? '';391 }392 393 438 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/Telemetry/Uninstall.php
r2886519 r3283684 34 34 * @return void 35 35 */ 36 public static function run( string$stellar_slug ) {36 public static function run( $stellar_slug ) { 37 37 $opt_in_status = new Status(); 38 38 … … 61 61 $optin = get_option( 'stellarwp_telemetry' ); 62 62 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 ) { 65 65 return; 66 66 } -
restrict-content/tags/3.2.14.1/vendor/strauss/stellarwp/telemetry/src/views/optin.php
r2886519 r3283684 56 56 <form method="post" action="" data-js="optin-form"> 57 57 <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'] ); ?>"> 58 60 <?php wp_nonce_field( 'stellarwp-telemetry' ); ?> 59 61 <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.