PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / trunk
GiveWP – Donation Plugin and Fundraising Platform vtrunk
4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / includes / admin / settings / class-settings-license.php
give / includes / admin / settings Last commit date
class-settings-addon.php 6 years ago class-settings-advanced.php 5 months ago class-settings-display.php 2 years ago class-settings-email.php 11 months ago class-settings-gateways.php 1 year ago class-settings-general.php 1 year ago class-settings-license.php 1 month ago class-settings-recurring.php 1 year ago
class-settings-license.php
282 lines
1 <?php
2 /**
3 * Give Settings Page/Tab
4 *
5 * @package Give
6 * @subpackage Classes/Give_Settings_License
7 * @copyright Copyright (c) 2016, GiveWP
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.8
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15
16 if ( ! class_exists( 'Give_Settings_License' ) ) :
17
18 /**
19 * Give_Settings_License.
20 *
21 * @since 4.15.0 added legacy license page notice
22 * @since 1.8
23 */
24 class Give_Settings_License extends Give_Settings_Page {
25 protected $enable_save = false;
26
27 /**
28 * Constructor.
29 */
30 public function __construct() {
31 $this->id = 'licenses';
32 $this->label = esc_html__( 'Licenses', 'give' );
33
34 parent::__construct();
35
36 // Do not use main form for this tab.
37 if ( give_get_current_setting_tab() === $this->id ) {
38
39 // Remove default parent form.
40 add_action( 'give-settings_open_form', '__return_empty_string' );
41 add_action( 'give-settings_close_form', '__return_empty_string' );
42
43 lw_harbor_display_legacy_license_page_notice('GiveWP');
44
45 // Refresh licenses when visit license setting page.
46 give_refresh_licenses();
47 }
48 }
49
50 /**
51 * Get settings array.
52 *
53 * @return array
54 * @since 1.8
55 */
56 public function get_settings() {
57 $settings = array();
58
59 /**
60 * Filter the licenses settings.
61 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
62 */
63 $settings = apply_filters( 'give_settings_licenses', $settings );
64
65 /**
66 * Filter the settings.
67 *
68 * @param array $settings
69 *
70 * @since 1.8
71 */
72 $settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
73
74 // Output.
75 return $settings;
76 }
77
78 /**
79 * Render license key field
80 *
81 * @since 2.5.0
82 */
83 public function output() {
84 ob_start();
85 ?>
86 <div class="give-license-settings-wrap">
87
88 <div class="give-grid-row">
89
90 <div class="give-grid-col-6">
91 <div id="give-license-activator-wrap" class="give-license-top-widget">
92 <div id="give-license-activator-inner">
93
94 <h2 class="give-license-widget-heading">
95 <span class="dashicons dashicons-plugins-checked"></span>
96 <?php _e( 'Activate an Add-on License', 'give' ); ?>
97 </h2>
98
99 <p class="give-field-description">
100 <?php
101 printf(
102 __( 'Enter your license key below to unlock your GiveWP add-ons. You can access your licenses anytime from the <a href="%1$s" target="_blank">My Account</a> section on the GiveWP website. ', 'give' ),
103 Give_License::get_account_url()
104 );
105 ?>
106 </p>
107
108 <form method="post" action="" class="give-license-activation-form">
109
110 <div class="give-license-notices"></div>
111
112 <?php wp_nonce_field( 'give-license-activator-nonce', 'give_license_activator_nonce' ); ?>
113
114 <label
115 for="give-license-activator"
116 class="screen-reader-text">
117 <?php _e( 'Activate License', 'give' ); ?>
118 </label>
119
120 <input
121 id="give-license-activator"
122 type="text"
123 name="give_license_key"
124 placeholder="<?php _e( 'Enter your license key', 'give' ); ?>"
125 />
126
127 <input
128 data-activate="<?php _e( 'Activate License', 'give' ); ?>"
129 data-activating="<?php _e( 'Verifying License...', 'give' ); ?>"
130 value="<?php _e( 'Activate License', 'give' ); ?>"
131 type="submit"
132 class="button button-primary"
133 />
134
135 </form>
136
137 </div>
138 </div>
139 </div><!-- /.give-grid-col-6 -->
140
141 <div class="give-grid-col-6">
142 <div id="give-addon-uploader-wrap" class="give-license-top-widget"
143 ondragover="event.preventDefault()">
144 <div id="give-addon-uploader-inner">
145 <h2 class="give-license-widget-heading">
146 <span class="dashicons dashicons-upload"></span>
147 <?php _e( 'Upload and Activate an Add-on', 'give' ); ?>
148 </h2>
149
150 <?php if ( ! is_multisite() ) : ?>
151
152 <p class="give-field-description">
153 <?php
154 printf(
155 __( 'Drag an add-on zip file below to upload and activate it. Access your downloads by activating a license or via the <a href="%1$s" target="_blank">My Downloads</a> section on the GiveWP website. ', 'give' ),
156 Give_License::get_downloads_url()
157 );
158 ?>
159 </p>
160
161 <?php if ( 'direct' !== get_filesystem_method() ) : ?>
162 <div class="give-notice notice notice-error inline">
163 <p>
164 <?php
165 echo sprintf(
166 __( 'Sorry, you can not upload plugin from here because we do not have direct access to file system. Please <a href="%1$s" target="_blank">click here</a> to upload GiveWP Add-on.', 'give' ),
167 admin_url( 'plugin-install.php?tab=upload' )
168 );
169 ?>
170 </p>
171 </div>
172 <?php else : ?>
173 <div class="give-upload-addon-form-wrap">
174 <form
175 method="post"
176 enctype="multipart/form-data"
177 class="give-upload-addon-form"
178 action="/">
179
180 <div class="give-addon-upload-notices"></div>
181
182 <div class="give-activate-addon-wrap">
183 <p><span
184 class="dashicons dashicons-yes"></span> <?php _e( 'Add-on succesfully uploaded.', 'give' ); ?>
185 </p>
186 <button
187 class="give-activate-addon-btn button-primary"
188 data-activate="<?php _e( 'Activate Add-on', 'give' ); ?>"
189 data-activating="<?php _e( 'Activating Add-on...', 'give' ); ?>"
190 ><?php _e( 'Activate Add-on', 'give' ); ?></button>
191 </div>
192
193 <?php wp_nonce_field( 'give-upload-addon', '_give_upload_addon' ); ?>
194
195 <p class="give-upload-addon-instructions">
196 <?php _e( 'Drag a plugin zip file here to upload', 'give' ); ?><br>
197 <span><?php _e( 'or', 'give' ); ?></span>
198 </p>
199
200 <label for="give-upload-addon-file-select" class="button button-small">
201 <?php _e( 'Select a File', 'give' ); ?>
202 </label>
203
204 <input
205 id="give-upload-addon-file-select"
206 type="file"
207 name="addon"
208 value="<?php _e( 'Select File', 'give' ); ?>"
209 />
210
211 </form>
212 </div>
213 <?php endif; ?>
214 <?php
215 else :
216 printf(
217 __( 'Because of security reasons you can not upload add-ons from here. Please <a href="%1$s" target="_blank">visit network plugin install page</a> to install add-ons.', 'give' ),
218 network_admin_url( 'plugin-install.php' )
219 );
220 ?>
221 <?php endif; ?>
222 </div>
223 </div>
224 </div>
225 </div>
226
227 <div class="give-grid-row<?php echo get_option( 'give_licenses', array() ) ? '' : ' give-hidden'; ?>">
228 <div class="give-grid-col-12">
229
230 <div class="give-licenses-list-header give-clearfix">
231 <h2><?php _e( 'Licenses and Add-ons', 'give' ); ?></h2>
232
233 <?php
234 $refresh_status = Give_License::refresh_license_status();
235 $is_allow_refresh = ( $refresh_status['compare'] === date( 'Ymd' ) && 5 > $refresh_status['count'] ) || ( $refresh_status['compare'] < date( 'Ymd' ) );
236 $button_title = __( 'Refresh limit reached. Licenses can only be refreshed 5 times per day.', 'give' );
237 $local_date = strtotime( get_date_from_gmt( date( 'Y-m-d H:i:s', $refresh_status['time'] ) ) );
238 ?>
239
240 <div id="give-refresh-button-wrap">
241 <button id="give-button__refresh-licenses"
242 class="button-secondary"
243 data-activate="<?php _e( 'Refresh All Licenses', 'give' ); ?>"
244 data-activating="<?php _e( 'Refreshing All Licenses...', 'give' ); ?>"
245 data-nonce="<?php echo wp_create_nonce( 'give-refresh-all-licenses' ); ?>"
246 <?php echo $is_allow_refresh ? '' : 'disabled'; ?>
247 <?php echo $is_allow_refresh ? '' : sprintf( 'title="%1$s"', $button_title ); ?>>
248 <?php _e( 'Refresh All Licenses', 'give' ); ?>
249 </button>
250 <span id="give-last-refresh-notice">
251 <?php
252 echo sprintf(
253 __( 'Last refreshed on %1$s at %2$s', 'give' ),
254 date( give_date_format(), $local_date ),
255 date( 'g:i a', $local_date )
256 );
257 ?>
258 </span>
259 </div>
260
261 <hr>
262 <p class="give-field-description"><?php _e( 'The following list displays your add-ons and their corresponding activation and license statuses.', 'give' ); ?></p>
263
264 </div>
265
266 <section id="give-licenses-container">
267 <?php echo Give_License::render_licenses_list(); ?>
268 </section>
269
270 </div>
271 </div>
272 </div>
273
274 <?php
275 echo ob_get_clean();
276 }
277 }
278
279 endif;
280
281 return new Give_Settings_License();
282