PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.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 All 257 releases
← All changes | includes/admin/class-addon-activation-banner.php +35 -21 2.3.0 → 4.18.0 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2 /**
3 3 * Give Activation Banner
4 4 *
5 - * @author WordImpress
5 + * @author GiveWP
6 6 * @version 1.0
7 7 */
8 8
9 9 // Exit if accessed directly.
@@ -15,13 +15,19 @@
15 15
16 16 /**
17 17 * Class Give_Addon_Activation_Banner
18 18 *
19 + * @since 3.17.2 added $user_id property to class
19 20 * @since 2.1.0 Added pleasing interface when multiple add-ons are activated.
20 21 */
21 22 class Give_Addon_Activation_Banner {
23 + /**
24 + * @since 3.17.2
25 + * @var int
26 + */
27 + protected $user_id;
22 28
23 - /**
29 + /**
24 30 * Class constructor.
25 31 *
26 32 * @since 1.0
27 33 * @access public
@@ -161,16 +167,22 @@
161 167 $give_addons = $this->get_plugin_file_names();
162 168
163 169 if ( ! empty( $give_addons ) ) {
164 170
165 - // Go through rach add-ons and add meta data.
171 + // Go through each add-ons and add meta data.
166 172 foreach ( $give_addons as $banner_addon_name => $addon ) {
167 173
168 174 // User meta key.
169 - $user_id = __give_get_active_by_user_meta( $banner_addon_name );
175 + $user_id = give_get_active_by_user_meta( $banner_addon_name );
170 176
171 177 if ( ! $user_id ) {
172 - update_option( self::get_banner_user_meta_key( $banner_addon_name ), $this->user_id, false );
178 + $option_key = self::get_banner_user_meta_key( $banner_addon_name );
179 +
180 + // store user id who activated add-on.
181 + update_option( $option_key, $this->user_id, false );
182 +
183 + // Update global cache.
184 + $GLOBALS['give_addon_activated_by_user'][ $option_key ] = $this->user_id;
173 185 }
174 186 }
175 187 }
176 188 }
@@ -191,9 +203,9 @@
191 203 $admin_notice_callbacks = array_keys( $wp_filter['admin_notices']->callbacks[10] );
192 204
193 205 if ( ! empty( $admin_notice_callbacks ) ) {
194 206 foreach ( $admin_notice_callbacks as $key ) {
195 - //If the key is found in your string, set $found to true
207 + // If the key is found in your string, set $found to true
196 208 if ( false !== strpos( $key, 'addon_activation_banner_notices' ) ) {
197 209 $notice_already_hooked = true;
198 210 }
199 211 }
@@ -238,9 +250,9 @@
238 250 // Get the add-on dismiss status.
239 251 $add_on_state = get_user_meta( $this->user_id, "give_addon_activation_ignore_{$addon_sanitized_name}", true );
240 252
241 253 // Get the option key.
242 - $activate_by_user = (int) __give_get_active_by_user_meta( $addon_sanitized_name );
254 + $activate_by_user = (int) give_get_active_by_user_meta( $addon_sanitized_name );
243 255
244 256 // Remove plugin file and get the Add-on's folder name only.
245 257 $file_path = $this->get_plugin_folder_name( $addon['file'] );
246 258
@@ -302,14 +314,16 @@
302 314 <?php
303 315 $notice_html = ob_get_clean();
304 316
305 317 // Register notice.
306 - Give()->notices->register_notice( array(
307 - 'id' => 'give_add_on_activation_notice',
308 - 'type' => 'updated',
309 - 'description_html' => $notice_html,
310 - 'show' => true,
311 - ) );
318 + Give()->notices->register_notice(
319 + array(
320 + 'id' => 'give_add_on_activation_notice',
321 + 'type' => 'updated',
322 + 'description_html' => $notice_html,
323 + 'show' => true,
324 + )
325 + );
312 326 }
313 327 }
314 328
315 329 /**
@@ -351,9 +365,9 @@
351 365
352 366 // Get the add-on details.
353 367 $plugin_data = get_plugin_data( $plugin_file );
354 368 ?>
355 - <img src="<?php echo esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg' ); ?>" class="give-logo" />
369 + <img src="<?php echo esc_url( GIVE_PLUGIN_URL . 'build/assets/dist/images/give-icon-full-circle.svg' ); ?>" class="give-logo" />
356 370 <div class="give-alert-message">
357 371 <h3>
358 372 <?php
359 373 printf(
@@ -358,9 +372,9 @@
358 372 <?php
359 373 printf(
360 374 /* translators: %s: Add-on name */
361 375 '%s<span>%s</span>',
362 - __( 'New Give Add-on Activated: ', 'give' ),
376 + __( 'New GiveWP Add-on Activated: ', 'give' ),
363 377 esc_html( $banner_arr['name'] )
364 378 );
365 379 ?>
366 380 </h3>
@@ -368,9 +382,9 @@
368 382 <span class="dashicons dashicons-dismiss"></span>
369 383 </a>
370 384 <div class="alert-actions">
371 385 <?php
372 - //Point them to your settings page.
386 + // Point them to your settings page.
373 387 if ( ! empty( $plugin_data['Description'] ) ) {
374 388 ?>
375 389 <span class="give-addon-description">
376 390 <em><?php echo esc_html( strip_tags( $plugin_data['Description'] ) ); ?></em></span><br />
@@ -395,9 +409,9 @@
395 409 )
396 410 );
397 411 }
398 412
399 - //Let them signup for plugin updates
413 + // Let them signup for plugin updates
400 414 if ( isset( $banner_arr['support_url'] ) ) {
401 415 printf(
402 416 '<a href="%s" target="_blank"><span class="dashicons dashicons-sos"></span>%s</a>',
403 417 esc_url( $banner_arr['support_url'] ),
@@ -471,9 +485,9 @@
471 485 foreach ( $give_addons as $banner_addon_name => $addon ) {
472 486 if ( $plugin_file === $addon['plugin_main_file'] ) {
473 487
474 488 // Get the user meta key.
475 - $user_id = (int) __give_get_active_by_user_meta( $banner_addon_name );
489 + $user_id = (int) give_get_active_by_user_meta( $banner_addon_name );
476 490
477 491 if ( $user_id ) {
478 492 // Get user meta for this add-on.
479 493 $nag_meta_key = "give_addon_activation_ignore_{$banner_addon_name}";
@@ -529,9 +543,9 @@
529 543 <style>
530 544 div.give-addon-alert.updated {
531 545 padding: 20px;
532 546 position: relative;
533 - border-color: #66BB6A;
547 + border-color: #69B868;
534 548 min-height: 85px;
535 549 }
536 550
537 551 div.give-alert-message {
@@ -551,13 +565,13 @@
551 565 }
552 566
553 567 div.give-addon-alert h3 span {
554 568 font-weight: 700;
555 - color: #66BB6A;
569 + color: #69B868;
556 570 }
557 571
558 572 div.give-addon-alert a {
559 - color: #66BB6A;
573 + color: #69B868;
560 574 }
561 575
562 576 div.give-addon-alert .alert-actions a {
563 577 margin-right: 2em;