| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | +// Exit if accessed directly | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | 4 | |
| 3 | 5 | class WPPB_Review_Request { |
| 4 | 6 | |
| 5 | 7 | // Number of days to wait until review request is displayed |
| @@ -62,34 +64,49 @@ | ||
| 62 | 64 | global $pagenow; |
| 63 | 65 | |
| 64 | 66 | $user_id = $current_user->ID; |
| 65 | 67 | |
| 66 | - if ( current_user_can( 'manage_options' ) ) { | |
| 68 | + if ( current_user_can( 'manage_options' ) && apply_filters( 'wppb_enable_review_request_notice', true ) ) { | |
| 67 | 69 | // Check that the user hasn't already dismissed the message |
| 68 | 70 | if ( !get_user_meta( $user_id, $this->notificationId . '_dismiss_notification' ) ) { |
| 69 | 71 | do_action( $this->notificationId . '_before_notification_displayed', $current_user, $pagenow ); |
| 72 | + $ul_icon_url = ( file_exists( WPPB_PLUGIN_DIR . 'assets/images/pb-logo.svg' )) ? WPPB_PLUGIN_URL . 'assets/images/pb-logo.svg' : ''; | |
| 70 | 73 | ?> |
| 71 | 74 | <div class="wppb-review-notice wppb-notice notice is-dismissible"> |
| 72 | - <p style="margin-top: 16px; font-size: 15px;"> | |
| 73 | - <?php esc_html_e("Hello! Seems like you've been using Profile Builder to create front-end user forms. That's awesome!", 'profile-builder'); ?> | |
| 74 | - <br/> | |
| 75 | - <?php esc_html_e("If you can spare a few moments to rate it on WordPress.org, it would help us a lot (and boost my motivation).", 'profile-builder'); ?> | |
| 76 | - </p> | |
| 77 | - <p> | |
| 78 | - <?php esc_html_e("~ Paul, developer of Profile Builder", 'profile-builder'); ?> | |
| 79 | - </p> | |
| 80 | - <p></p> | |
| 81 | - <p> | |
| 82 | - <a href="https://wordpress.org/support/plugin/profile-builder/reviews/?filter=5#new-post" | |
| 83 | - target="_blank" rel="noopener" class="button-primary" style="margin-right: 20px"> | |
| 84 | - <?php esc_html_e('Ok, I will gladly help!', 'profile-builder'); ?> | |
| 85 | - </a> | |
| 86 | - <a href="<?php echo esc_url( add_query_arg(array($this->query_arg => $this->notificationId)) ) ?>" | |
| 87 | - class="button-secondary"> | |
| 88 | - <?php esc_html_e('No, thanks.', 'profile-builder'); ?> | |
| 89 | - </a> | |
| 90 | - </p> | |
| 91 | - <a href="<?php echo esc_url( add_query_arg(array($this->query_arg => $this->notificationId)) ) ?>" | |
| 75 | + <div style="display: flex;"> | |
| 76 | + <div> | |
| 77 | + <img style="width: 80px; height: 80px; margin-right: 20px; margin-top: 20px;" src="<?php echo esc_url($ul_icon_url); ?>" > | |
| 78 | + </div> | |
| 79 | + <div> | |
| 80 | + <p style="margin-top: 16px; font-size: 15px;"> | |
| 81 | + <?php esc_html_e("Hello! Seems like you've been using Profile Builder to create front-end user forms. That's awesome!", 'profile-builder'); ?> | |
| 82 | + <br/> | |
| 83 | + <?php esc_html_e("If you can spare a few moments to rate it on WordPress.org, it would help us a lot (and boost my motivation).", 'profile-builder'); ?> | |
| 84 | + </p> | |
| 85 | + <p> | |
| 86 | + <?php esc_html_e("~ Paul, developer of Profile Builder", 'profile-builder'); ?> | |
| 87 | + </p> | |
| 88 | + <p></p> | |
| 89 | + </div> | |
| 90 | + </div> | |
| 91 | + | |
| 92 | + <div style="display: flex; margin-bottom: 24px; padding-left: 95px;"> | |
| 93 | + <div> | |
| 94 | + <a href="https://wordpress.org/support/plugin/profile-builder/reviews/#new-post" | |
| 95 | + target="_blank" rel="noopener" class="button-primary" style="margin-right: 20px"> | |
| 96 | + <?php esc_html_e('Ok, I will gladly help!', 'profile-builder'); ?> | |
| 97 | + </a> | |
| 98 | + </div> | |
| 99 | + | |
| 100 | + <div> | |
| 101 | + <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( $this->query_arg => $this->notificationId ) ), 'wppb_review_notice_dismiss' ) ) ?>" | |
| 102 | + class="button-secondary"> | |
| 103 | + <?php esc_html_e('No, thanks.', 'profile-builder'); ?> | |
| 104 | + </a> | |
| 105 | + </div> | |
| 106 | + </div> | |
| 107 | + | |
| 108 | + <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( $this->query_arg => $this->notificationId ) ), 'wppb_review_notice_dismiss' ) ) ?>" | |
| 92 | 109 | type="button" class="notice-dismiss" style="text-decoration: none;"> |
| 93 | 110 | <span class="screen-reader-text"> |
| 94 | 111 | <?php esc_html_e('Dismiss this notice.', 'profile-builder'); ?> |
| 95 | 112 | </span> |
| @@ -103,8 +120,12 @@ | ||
| 103 | 120 | } |
| 104 | 121 | |
| 105 | 122 | // Function that saves the notification dismissal to the user meta |
| 106 | 123 | public function dismiss_notification() { |
| 124 | + | |
| 125 | + if( empty( $_GET['_wpnonce'] ) || !wp_verify_nonce( sanitize_text_field( $_GET['_wpnonce'] ), 'wppb_review_notice_dismiss' ) ) | |
| 126 | + return; | |
| 127 | + | |
| 107 | 128 | global $current_user; |
| 108 | 129 | |
| 109 | 130 | $user_id = $current_user->ID; |
| 110 | 131 | |
| @@ -122,9 +143,9 @@ | ||
| 122 | 143 | |
| 123 | 144 | if ( $current_screen->parent_base == 'profile-builder' ){ |
| 124 | 145 | $rate_text = sprintf( __( 'If you enjoy using <strong> %1$s </strong> please <a href="%2$s" target="_blank">rate us on WordPress.org</a>. More happy users means more features, less bugs and better support for everyone. ', 'profile-builder' ), |
| 125 | 146 | PROFILE_BUILDER, |
| 126 | - 'https://wordpress.org/support/view/plugin-reviews/profile-builder?filter=5#postform' | |
| 147 | + 'https://wordpress.org/support/view/plugin-reviews/profile-builder#postform' | |
| 127 | 148 | ); |
| 128 | 149 | return '<span id="footer-thankyou">' .$rate_text . '</span>'; |
| 129 | 150 | } else { |
| 130 | 151 | return $footer_text; |