PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 2.0.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v2.0.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 2.0.0, at src/Performance/Telemetry/Modal.php

85 lines 2.5 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'] = esc_attr__( 'Kadence Performance Logo', 'solid-performance' );
61 $args['plugin_name'] = esc_html__( 'Kadence Performance', '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 { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
82 return esc_html__( 'Want to help shape the future of Kadence Performance? Opting in shares anonymous usage data with our team at Liquid Web, the company behind Kadence Performance, so we can keep building tools that work better for you. You\'ll also receive product updates and important announcements via email—unsubscribe any time. Click \'Allow & Continue\' below to join us.', 'solid-performance' );
83 }
84 }
85