PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.5.4
GiveWP – Donation Plugin and Fundraising Platform v2.5.4
4.16.3 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 / add-ons / actions.php
give / includes / admin / add-ons Last commit date
actions.php 6 years ago add-ons.php 6 years ago
actions.php
645 lines
1 <?php
2 /**
3 * Admin Add-ons Actions
4 *
5 * @package Give
6 * @subpackage Admin/Add-ons/Actions
7 * @copyright Copyright (c) 2019, GiveWP
8 * @license https://opensource.org/licenses/gpl-license GNU Public License
9 * @since 2.5.0
10 */
11
12 // Exit if accessed directly.
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Ajax addon upload handler
19 *
20 * Note: only for internal use
21 *
22 * @since 2.5.0
23 */
24 function give_upload_addon_handler() {
25 /* @var WP_Filesystem_Direct $wp_filesystem */
26 global $wp_filesystem;
27
28 check_admin_referer( 'give-upload-addon' );
29
30 // Remove version from file name.
31 $filename = preg_replace( '/(.\d)+.zip/', '', $_FILES['file']['name'] );
32 $filename = basename( $filename, '.zip' );
33
34
35 // Bailout if user does not has permission.
36 if ( ! current_user_can( 'upload_plugins' ) ) {
37 wp_send_json_error( array( 'errorMsg' => __( 'Sorry, you are not allowed to upload add-ons on this site.', 'give' ) ) );
38 }
39
40 $access_type = get_filesystem_method();
41
42 if ( 'direct' !== $access_type ) {
43 wp_send_json_error(
44 array(
45 'errorMsg' => sprintf(
46 __( 'Sorry, you can not upload plugins because Give does not have direct access to the file system. Please <a href="%1$s" target="_blank">click here</a> to upload the add-on.', 'give' ),
47 admin_url( 'plugin-install.php?tab=upload' )
48 ),
49 )
50 );
51 }
52
53 $file_type = wp_check_filetype( $_FILES['file']['name'], array( 'zip' => 'application/zip' ) );
54
55 if ( empty( $file_type['ext'] ) ) {
56 wp_send_json_error( array( 'errorMsg' => __( 'Only zip file type allowed to upload. Please upload a valid add-on file.', 'give' ) ) );
57 }
58
59 $give_addons_list = give_get_plugins();
60 $is_addon_installed = array();
61
62 if ( ! empty( $give_addons_list ) ) {
63 foreach ( $give_addons_list as $addon => $give_addon ) {
64 if ( false !== stripos( $addon, $filename ) ) {
65 $is_addon_installed = $give_addon;
66 }
67 }
68 }
69
70 // Bailout if addon already installed
71 if ( ! empty( $is_addon_installed ) ) {
72 wp_send_json_error( array(
73 'errorMsg' => __( 'This add-on is already installed.', 'give' ),
74 'pluginInfo' => $is_addon_installed,
75 ) );
76 }
77
78 $upload_status = wp_handle_upload( $_FILES['file'], array( 'test_form' => false ) );
79
80 // Bailout if has any upload error
81 if ( empty( $upload_status['file'] ) ) {
82 wp_send_json_error( $upload_status );
83 }
84
85 // @todo: check how wordpress verify plugin files before uploading to plugin directory
86
87 /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
88 $creds = request_filesystem_credentials( site_url() . '/wp-admin/', '', false, false, array() );
89
90 /* initialize the API */
91 if ( ! WP_Filesystem( $creds ) ) {
92 /* any problems and we exit */
93 wp_send_json_error(array(
94 'errorMsg' => __( 'File system does not load correctly.', 'give' )
95 ));
96 }
97
98 $unzip_status = unzip_file( $upload_status['file'], $wp_filesystem->wp_plugins_dir() );
99
100 // Remove file.
101 @unlink( $upload_status['file'] );
102
103 // Bailout if not able to unzip file successfully
104 if ( is_wp_error( $unzip_status ) ) {
105 wp_send_json_error( array(
106 'errorMsg' => $unzip_status
107 ) );
108 }
109
110 // Delete cache and get current installed addon plugin path.
111 wp_cache_delete( 'plugins', 'plugins' );
112 $give_addons_list = give_get_plugins();
113 $installed_addon = array();
114
115 if ( ! empty( $give_addons_list ) ) {
116 foreach ( $give_addons_list as $addon => $give_addon ) {
117 if ( false !== stripos( $addon, $filename ) ) {
118 $installed_addon = $give_addon;
119 $installed_addon['path'] = $addon;
120 }
121 }
122 }
123
124 wp_send_json_success( array(
125 'pluginPath' => $installed_addon['path'],
126 'pluginName' => $installed_addon['Name'],
127 'nonce' => wp_create_nonce( "give_activate-{$installed_addon['path']}" ),
128 'licenseSectionHtml' => Give_License::render_licenses_list(),
129 ) );
130 }
131
132 add_action( 'wp_ajax_give_upload_addon', 'give_upload_addon_handler' );
133
134 /**
135 * Ajax license inquiry handler
136 *
137 * Note: only for internal use
138 *
139 * @since 2.5.0
140 */
141 function give_get_license_info_handler() {
142 check_admin_referer( 'give-license-activator-nonce' );
143
144 // check user permission.
145 if ( ! current_user_can( 'manage_give_settings' ) ) {
146 give_die();
147 }
148
149 $license_key = ! empty( $_POST['license'] ) ? give_clean( $_POST['license'] ) : '';
150 $is_activating_single_license = ! empty( $_POST['single'] ) ? absint( $_POST['single'] ) : '';
151 $is_reactivating_license = ! empty( $_POST['reactivate'] ) ? absint( $_POST['reactivate'] ) : '';
152 $plugin_slug = $is_activating_single_license ? give_clean( $_POST['addon'] ) : '';
153 $licenses = get_option( 'give_licenses', array() );
154
155
156 if ( ! $license_key ) {
157 wp_send_json_error( array(
158 'errorMsg' => __( 'Sorry, you entered an invalid key.', 'give' ),
159 ) );
160
161 } else if (
162 ! $is_reactivating_license
163 && array_key_exists( $license_key, $licenses )
164 ) {
165 // If admin already activated license but did not install add-on then send license info show notice to admin with download link.
166 $license = $licenses[$license_key];
167 if( empty( $license['is_all_access_pass'] ) ) {
168 $plugin_data = Give_License::get_plugin_by_slug( $license['plugin_slug' ] );
169
170 // Plugin license activated but does not install, sent notice which allow admin to download add-on.
171 if( empty( $plugin_data ) ) {
172 wp_send_json_success( $license );
173 }
174 }
175
176 wp_send_json_error( array(
177 'errorMsg' => __( 'This license key is already in use on this website.', 'give' ),
178 ) );
179 }
180
181
182 // Check license.
183 $check_license_res = Give_License::request_license_api( array(
184 'edd_action' => 'check_license',
185 'license' => $license_key,
186 ), true );
187
188 // Make sure there are no errors.
189 if ( is_wp_error( $check_license_res ) ) {
190 wp_send_json_error( array(
191 'errorMsg' => $check_license_res->get_error_message(),
192 ) );
193 }
194
195 // Check if license valid or not.
196 if ( ! $check_license_res['success'] ) {
197 wp_send_json_error( array(
198 'errorMsg' => sprintf(
199 __( 'Sorry, this license was unable to activate because the license status returned as <code>%2$s</code>. Please visit your <a href="%1$s" target="_blank">license dashboard</a> to check the details and access priority support.' ),
200 Give_License::get_account_url(),
201 $check_license_res['license']
202 ),
203 ) );
204 }
205
206 if(
207 $is_activating_single_license
208 && ! empty( $check_license_res['plugin_slug'] )
209 && $plugin_slug !== $check_license_res['plugin_slug']
210 ) {
211 wp_send_json_error( array(
212 'errorMsg' => sprintf(
213 __( 'Sorry, we are unable to activate this license because this key does not belong to this add-on. Please visit your <a href="%1$s" target="_blank">license dashboard</a> to check the details and access priority support.' ),
214 Give_License::get_account_url()
215 ),
216 ) );
217 }
218
219 // Activate license.
220 $activate_license_res = Give_License::request_license_api( array(
221 'edd_action' => 'activate_license',
222 'item_name' => $check_license_res['item_name'],
223 'license' => $license_key,
224 ), true );
225
226 if ( is_wp_error( $activate_license_res ) ) {
227 wp_send_json_error( array(
228 'errorMsg' => $check_license_res->get_error_message(),
229 ) );
230 }
231
232 // Return error if license activation is not success and admin is not reactivating add-on.
233 if ( ! $is_reactivating_license && ! $activate_license_res['success'] ) {
234
235 $response['errorMsg'] = sprintf(
236 __( 'Sorry, this license was unable to activate because the license status returned as <code>%2$s</code>. Please visit your <a href="%1$s" target="_blank">license dashboard</a> to check the details and access priority support.' ),
237 Give_License::get_account_url(),
238 $check_license_res['license']
239 );
240
241 wp_send_json_error( $response );
242 }
243
244 $check_license_res['license'] = $activate_license_res['license'];
245 $check_license_res['site_count'] = $activate_license_res['site_count'];
246 $check_license_res['activations_left'] = $activate_license_res['activations_left'];
247
248 $licenses[ $check_license_res['license_key'] ] = $check_license_res;
249 update_option( 'give_licenses', $licenses );
250
251 // Get license section HTML.
252 $response = $check_license_res;
253 $response['html'] = $is_activating_single_license && empty( $check_license_res['is_all_access_pass'] )
254 ? Give_License::html_by_plugin( Give_License::get_plugin_by_slug( $check_license_res['plugin_slug'] ) )
255 : Give_License::render_licenses_list();
256
257 // Return error if license activation is not success and admin is reactivating add-on.
258 if ( $is_reactivating_license && ! $activate_license_res['success'] ) {
259
260 $response['errorMsg'] = sprintf(
261 __( 'Sorry, this license was unable to activate because the license status returned as <code>%2$s</code>. Please visit your <a href="%1$s" target="_blank">license dashboard</a> to check the details and access priority support.' ),
262 Give_License::get_account_url(),
263 $check_license_res['license']
264 );
265
266 wp_send_json_error( $response );
267 }
268
269
270 // Tell WordPress to look for updates.
271 give_refresh_licenses();
272
273 wp_send_json_success( $response );
274 }
275
276 add_action( 'wp_ajax_give_get_license_info', 'give_get_license_info_handler' );
277
278
279 /**
280 * Activate addon handler
281 *
282 * Note: only for internal use
283 *
284 * @since 2.5.0
285 */
286 function give_activate_addon_handler() {
287 $plugin_path = give_clean( $_POST['plugin'] );
288
289 check_admin_referer( "give_activate-{$plugin_path}" );
290
291 // check user permission.
292 if ( ! current_user_can( 'manage_give_settings' ) ) {
293 give_die();
294 }
295
296 $status = activate_plugin( $plugin_path );
297
298 if ( is_wp_error( $status ) ) {
299 wp_send_json_error( array( 'errorMsg' => $status->get_error_message() ) );
300 }
301
302 // Tell WordPress to look for updates.
303 give_refresh_licenses();
304
305 wp_send_json_success( array(
306 'licenseSectionHtml' => Give_License::render_licenses_list(),
307 ) );
308 }
309
310 add_action( 'wp_ajax_give_activate_addon', 'give_activate_addon_handler' );
311
312
313 /**
314 * deactivate addon handler
315 *
316 * Note: only for internal use
317 *
318 * @since 2.5.0
319 */
320 function give_deactivate_license_handler() {
321 $license = give_clean( $_POST['license'] );
322 $item_name = give_clean( $_POST['item_name'] );
323 $plugin_dirname = give_clean( $_POST['plugin_dirname'] );
324
325 if ( ! $license || ! $item_name ) {
326 wp_send_json_error();
327 }
328
329 check_admin_referer( "give-deactivate-license-{$item_name}" );
330
331 // check user permission.
332 if ( ! current_user_can( 'manage_give_settings' ) ) {
333 give_die();
334 }
335
336 $give_licenses = get_option( 'give_licenses', array() );
337
338 if ( empty( $give_licenses[ $license ] ) ) {
339 wp_send_json_error( array(
340 'errorMsg' => __( 'We are unable to deactivate invalid license', 'give' ),
341 )
342 );
343 }
344
345 /* @var array|WP_Error $response */
346 $response = Give_License::request_license_api( array(
347 'edd_action' => 'deactivate_license',
348 'license' => $license,
349 'item_name' => $item_name,
350 ), true );
351
352 if ( is_wp_error( $response ) ) {
353 wp_send_json_error( array(
354 'errorMsg' => $response->get_error_message(),
355 'response' => $license,
356 ) );
357 }
358
359 $is_all_access_pass = $give_licenses[ $license ]['is_all_access_pass'];
360
361 if ( ! empty( $give_licenses[ $license ] ) ) {
362 unset( $give_licenses[ $license ] );
363 update_option( 'give_licenses', $give_licenses );
364 }
365
366 $response['html'] = $is_all_access_pass
367 ? Give_License::render_licenses_list()
368 : Give_License::html_by_plugin( Give_License::get_plugin_by_slug( $plugin_dirname ) );
369
370 $response['msg'] = __( 'You have successfully deactivated the license.', 'give' );
371
372 // Tell WordPress to look for updates.
373 give_refresh_licenses();
374
375 wp_send_json_success( $response );
376 }
377
378 add_action( 'wp_ajax_give_deactivate_license', 'give_deactivate_license_handler' );
379
380
381 /**
382 * Refresh all addons licenses handler
383 *
384 * Note: only for internal use
385 *
386 * @since 2.5.0
387 */
388 function give_refresh_all_licenses_handler() {
389 check_admin_referer( 'give-refresh-all-licenses' );
390
391 // check user permission.
392 if ( ! current_user_can( 'manage_give_settings' ) ) {
393 give_die();
394 }
395
396 $data = Give_License::refresh_license_status();
397
398 // Update date and reset counter.
399 if ( $data['compare'] === date( 'Ymd' ) && 5 <= $data['count'] ) {
400 wp_send_json_error();
401 }
402
403 // Update date and reset counter.
404 if ( $data['compare'] < date( 'Ymd' ) ) {
405 $data['compare'] = date( 'Ymd' );
406 $data['count'] = 0;
407 }
408
409 // Update time.
410 $data['time'] = current_time( 'timestamp', 1 );
411
412 ++ $data['count'];
413
414 update_option( 'give_licenses_refreshed_last_checked', $data, 'no' );
415
416 give_refresh_licenses();
417
418 $local_date = strtotime( get_date_from_gmt( date( 'Y-m-d H:i:s', $data['time'] ) ) );
419 wp_send_json_success( array(
420 'html' => Give_License::render_licenses_list(),
421 'refreshButton' => 5 <= $data['count'],
422 'refreshStatus' => $data,
423 'lastUpdateMsg' => sprintf(
424 __( 'Last refreshed on %1$s at %2$s', 'give' ),
425 date( give_date_format(), $local_date ),
426 date( 'g:i a', $local_date )
427 ),
428 ) );
429 }
430
431 add_action( 'wp_ajax_give_refresh_all_licenses', 'give_refresh_all_licenses_handler' );
432
433
434 /**
435 * Updates information on the "View version x.x details" page with custom data.
436 * Note: only for internal use
437 *
438 * @param mixed $_data
439 * @param string $_action
440 * @param object $_args
441 *
442 * @return object $_data
443 * @since 2.5.0
444 * @uses api_request()
445 *
446 */
447 function give_plugins_api_filter( $_data, $_action = '', $_args = null ) {
448 // Exit.
449 if ( 'plugin_information' !== $_action ) {
450 return $_data;
451 }
452
453
454 $plugin = Give_License::get_plugin_by_slug( $_args->slug );
455
456 if (
457 ! $plugin
458 || 'add-on' !== $plugin['Type']
459 || false === strpos( $_args->slug, 'give-' )
460 ) {
461 return $_data;
462 }
463
464 $plugin_data = get_site_transient( 'update_plugins' );
465
466 if ( ! $plugin_data ) {
467 give_refresh_licenses();
468 }
469
470 $plugin_data = ! empty( $plugin_data->response[ $plugin['Path'] ] )
471 ? $plugin_data->response[ $plugin['Path'] ]
472 : array();
473
474 if ( ! $plugin_data ) {
475 return $_data;
476 }
477
478 $_data = $plugin_data;
479
480 return $_data;
481 }
482
483 add_filter( 'plugins_api', 'give_plugins_api_filter', 9999, 3 );
484
485
486 /**
487 * Check add-ons updates when WordPress check plugin updates
488 *
489 * @since 2.5.0
490 */
491 add_filter( 'pre_set_site_transient_update_plugins', 'give_check_addon_updates', 999, 1 );
492
493
494 /**
495 * Show plugin update notification on multi-site
496 *
497 * @param string $file
498 * @param array $plugin
499 *
500 * @since 2.5.0
501 */
502 function give_show_update_notification_on_multisite( $file, $plugin ) {
503 if ( is_network_admin() ) {
504 return;
505 }
506
507 if ( ! current_user_can( 'update_plugins' ) ) {
508 return;
509 }
510
511 if ( ! is_multisite() ) {
512 return;
513 }
514
515 if (
516 ! $plugin
517 || empty( $plugin['slug'] )
518 || false === strpos( $plugin['slug'], 'give-' )
519 ) {
520 return;
521 }
522
523 $plugin_data = Give_License::get_plugin_by_slug( $plugin['slug'] );
524
525 // Only show notices for Give add-ons
526 if ( 'add-on' !== $plugin_data['Type'] ) {
527 return;
528 }
529
530 // Do not print any message if updates does not exist.
531 $update_cache = get_site_transient( 'update_plugins' );
532
533 if( ! isset( $update_cache->response[$file] ) ) {
534 return;
535 }
536
537
538 if ( ! empty( $update_cache->response[ $plugin_data['Path'] ] ) && version_compare( $plugin_data['Version'], $plugin['new_version'], '<' ) ) {
539 printf(
540 '<tr class="plugin-update-tr %3$s" id="%1$s-update" data-slug="%1$s" data-plugin="%2$s">',
541 $plugin['slug'],
542 $file,
543 'active' === $plugin_data['Status'] ? 'active' : 'inactive'
544 );
545
546 echo '<td colspan="3" class="plugin-update colspanchange">';
547 echo '<div class="update-message notice inline notice-warning notice-alt"><p>';
548
549 $changelog_link = self_admin_url( "plugin-install.php?tab=plugin-information&plugin={$plugin['slug']}&section=changelog&TB_iframe=true&width=772&height=299" );
550
551 if ( empty( $plugin['download_link'] ) ) {
552 printf(
553 __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ),
554 esc_html( $plugin_data['Name'] ),
555 '<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
556 esc_html( $plugin['new_version'] ),
557 '</a>'
558 );
559 } else {
560 printf(
561 __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ),
562 esc_html( $plugin_data['Name'] ),
563 '<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
564 esc_html( $plugin['new_version'] ),
565 '</a>',
566 '<a target="_blank" class="update-link" href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file, 'upgrade-plugin_' . $file ) ) . '">',
567 '</a>'
568 );
569 }
570
571 do_action( "in_plugin_update_message-{$file}", $plugin, $plugin );
572
573 echo '</p></div></td></tr>';
574 }
575 }
576
577 add_action( 'after_plugin_row', 'give_show_update_notification_on_multisite', 10, 2 );
578
579 /**
580 * Show plugin update notification on single site
581 *
582 * @param $file
583 * @param $plugin
584 *
585 * @since 2.5.0
586 */
587 function give_show_update_notification_on_single_site( $file, $plugin ) {
588 if ( ! current_user_can( 'update_plugins' ) || is_multisite() ) {
589 return;
590 }
591
592
593 if (
594 ! $plugin
595 || empty( $plugin['slug'] )
596 || false === strpos( $plugin['slug'], 'give-' )
597 ) {
598 return;
599 }
600
601 $plugin_data = Give_License::get_plugin_by_slug( $plugin['slug'] );
602
603 // Only show notices for Give add-ons
604 if (
605 'add-on' !== $plugin_data['Type']
606 || $plugin_data['License']
607 ) {
608 return;
609 }
610
611 // Do not print any message if updates does not exist.
612 $update_plugins = get_site_transient( 'update_plugins' );
613 if( ! isset( $update_plugins->response[$file] ) ) {
614 return;
615 }
616
617
618 // Remove core update notice.
619 remove_action( "after_plugin_row_{$file}", 'wp_plugin_update_row' );
620
621 $update_notice_wrap = '<tr class="plugin-update-tr %3$s"><td colspan="3" class="colspanchange"><div class="update-message notice inline notice-warning notice-alt give-invalid-license"><p>%1$s %2$s</p></div></td></tr>';
622 $changelog_link = self_admin_url( "plugin-install.php?tab=plugin-information&plugin={$plugin['slug']}&section=changelog&TB_iframe=true&width=772&height=299" );
623
624 echo sprintf(
625 $update_notice_wrap,
626 sprintf(
627 __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ),
628 esc_html( $plugin_data['Name'] ),
629 '<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
630 esc_html( $plugin['new_version'] ),
631 '</a>'
632 ),
633 sprintf(
634 'Please <a href="%1$s" target="_blank">activate your license</a> to receive updates and support.',
635 esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) )
636 ),
637 'active' === $plugin_data['Status'] ? 'active' : 'inactive'
638 );
639 }
640
641 add_action( 'after_plugin_row', 'give_show_update_notification_on_single_site', 1, 2 );
642
643
644
645