PluginProbe
Patchstack – WordPress & Plugins Security / 2.2.6
Patchstack – WordPress & Plugins Security v2.2.6
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
patchstack / includes / views / pages / license.php

license.php in Patchstack – WordPress & Plugins Security 2.2.6, at includes/views/pages/license.php

104 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Do not allow the file to be called directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 // Determine if the subscription of the account is expired.
9 $status = $this->plugin->client_id != 'PATCHSTACK_CLIENT_ID' || get_option( 'patchstack_clientid', false ) != false;
10 $free = get_option( 'patchstack_license_free', 0 ) == 1;
11 $planClass = get_option( 'patchstack_subscription_class', '');
12 $managed = get_option( 'patchstack_managed', false );
13 $site_id = get_option( 'patchstack_site_id', 0 );
14 $app_url = $site_id != 0 ? 'https://app.patchstack.com/app/' . $site_id . '/"' : 'https://app.patchstack.com/apps/overview';
15 if ( isset( $_GET['ps_activated'] ) && $status ) {
16 echo "<script>window.location = 'admin.php?page=patchstack&tab=license&active=1';</script>";
17 }
18
19 // Generate the link to turn on settings management.
20 $url = '?page=' . esc_attr( $page ) . '&tab=license&action=enable_settings&patchstack_settings_nonce=' . wp_create_nonce( 'patchstack_settings_nonce' );
21 $url_enabled = '?page=patchstack' . (!$free ? '&tab=firewall' : '');
22
23 if (!$show_settings) {
24 ?>
25 <div class="patchstack-free" style="<?php echo $show_settings ? 'display: none;' : ''; ?>">
26 <div>
27 <div class="patchstack-plan patchstack-plan2">
28 <div class="patchstack-status">
29 <span>Sync status</span>
30 <?php
31 if ($this->is_connected()) {
32 echo '<span class="patchstack-status-label">Connected</span>';
33 } else {
34 echo '<span class="patchstack-status-label patchstack-status-label-error">Disconnected</span>';
35 }
36 ?>
37 </div>
38
39 <div style="clear: both;"></div>
40
41 <div class="patchstack-protection" <?php echo !$this->is_protected() && empty($planClass) ? 'style="display: none;"' : ''; ?>>
42 <img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/shield.svg">
43 <span>Protection enabled</span>
44 </div>
45
46 <div class="patchstack-protection" <?php echo $this->is_protected() || $planClass > 0 || $managed ? 'style="display: none;"' : ''; ?>>
47 <span>Protection disabled</span>
48 <a href="<?php echo $app_url; ?>" target="_blank" class="button-primary">
49 Activate for $9 / mo
50 </a>
51 </div>
52
53 <div class="form-table patchstack-form-table" <?php echo $managed ? 'style="margin-top: 32px;"' : ''; ?>>
54 <label for="patchstack_api_key">
55 API key
56 <?php
57 if ($planClass != '' && !$managed ) {
58 $plan = $this->get_subscription_name( $planClass );
59 ?>
60 <span><?php echo $plan; ?> plan</span>
61 <?php
62 }
63 ?>
64 </label>
65 <input class="regular-text" type="text" id="patchstack_api_key" value="<?php echo get_option( 'patchstack_clientid', false ) ? esc_attr( $this->get_secret_key() . '-' . get_option( 'patchstack_clientid', false ) ) : ''; ?>" placeholder="Enter your API key here...">
66 </div>
67
68 <?php
69 if ( ! get_option( 'patchstack_clientid', false ) ) {
70 echo '<p class="patchstack-error">To use this plugin, login and add it to the App dashboard and sync using the API key provided there.</p>';
71 }
72 ?>
73
74 <div class="patchstack-license-button">
75 <input type="submit" id="patchstack-activate" value="<?php echo $status ? __( 'Re-sync with App', 'patchstack' ) : __( 'Activate', 'patchstack' ); ?>" class="button-primary patchstack-fullwidth" />
76 </div>
77
78 <div style="clear: both;"></div>
79
80 <?php
81 if (isset($_GET['resync'])) {
82 echo '<p class="patchstack-resync">The plugin is connected and synchronized.</p>';
83 }
84 ?>
85
86 <div class="patchstack-loading"><div></div><div></div><div></div><div></div></div>
87 </div>
88 <div style="clear: both;"></div>
89 </div>
90
91
92 <p class="patchstack-upsell">
93 <?php if ( ! $managed ) { ?>
94 <a href="<?php echo $app_url; ?>" target="_blank"><?php echo __( 'Log in', 'patchstack' ); ?></a>
95 <?php echo __( 'to the central App to view vulnerabilities, activate protection and manage settings for this web application.', 'patchstack' ); ?>
96 <?php } ?>
97 <?php if ( ! $free && $planClass >= 1 ) { ?>
98 <a href="<?php echo $this->get_option( 'patchstack_show_settings', 0 ) == 1 ? $url_enabled : esc_url( $url ); ?>">Manage</a> the Patchstack plugin settings through WordPress.
99 <?php } ?>
100 </p>
101 </div>
102 <?php
103 }
104 ?>