PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.2.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.2.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Telemetry / Modal.php

Modal.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.2.0, at src/Performance/Telemetry/Modal.php

89 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Handles all customizations for the opt-in modal.
4 *
5 * @since 0.1.0
6 *
7 * @package SolidWP\Performance
8 */
9
10 declare( strict_types=1 );
11
12 namespace SolidWP\Performance\Telemetry;
13
14 use SolidWP\Performance\Assets\Asset;
15
16 /**
17 * Handles all customizations for the opt-in modal.
18 *
19 * @since 0.1.0
20 *
21 * @package SolidWP\Performance
22 */
23 final class Modal {
24
25 /**
26 * @var Asset
27 */
28 private Asset $asset;
29
30 /**
31 * @param Asset $asset The asset instance.
32 */
33 public function __construct( Asset $asset ) {
34 $this->asset = $asset;
35 }
36
37 /**
38 * Customizes the optin_args.
39 *
40 * @filter stellarwp/telemetry/optin_args
41 *
42 * @since 0.1.0
43 *
44 * @param array $args The arguments used to render the modal.
45 * @param string $stellar_slug The stellar slug of the plugin displaying the modal.
46 *
47 * @return array<string,mixed>
48 */
49 public function optin_args( array $args, string $stellar_slug ): array {
50 if ( $stellar_slug !== 'solid-performance' ) {
51 return $args;
52 }
53
54 $args['plugin_logo'] = $this->asset->get_url( 'images/solid_performance_logo.svg' );
55 $args['plugin_logo_width'] = 300;
56 $args['plugin_logo_height'] = 50;
57 $args['permissions_url'] = 'https://go.solidwp.com/solid-performance-opt-in-usage-sharing';
58 $args['tos_url'] = 'https://go.solidwp.com/solid-performance-terms-usage-modal';
59 $args['privacy_url'] = 'https://go.solidwp.com/solid-performance-privacy-usage-modal';
60 $args['plugin_logo_alt'] = 'Solid Performance Logo';
61 $args['plugin_name'] = 'Solid Performance';
62
63 $args['heading'] = sprintf(
64 // Translators: The plugin name.
65 esc_html__( 'We hope you love %s.', 'solid-performance' ),
66 $args['plugin_name']
67 );
68
69 $args['intro'] = $this->get_intro( $args['user_name'] );
70
71 return $args;
72 }
73
74 /**
75 * Provides the intro text with the current users's display name inserted.
76 *
77 * @param string $user_name The user to which the modal is shown.
78 *
79 * @return string
80 */
81 public function get_intro( string $user_name ): string {
82 return sprintf(
83 // Translators: The User's name.
84 esc_html__( 'Hi %s. SolidWP is dedicated to delivering top-notch services, and your input helps us deliver on that promise. By opting into our feedback program, you help enhance the Solid Performance experience for yourself and all of our users. When you opt in, you allow us to access certain data related to how you use our products, which we use responsibly to tailor our products to your needs. You will additionally receive updates, important product and marketing information, and exclusive offers via email. You may unsubscribe at any time. We take data privacy seriously and adhere to the highest standards respecting all relevant regulations and guidelines. To join and help shape the future of Solid Performance and StellarWP, simply click “Allow & Continue” below.', 'solid-performance' ),
85 $user_name,
86 );
87 }
88 }
89