$time, 'dismissed' => false, ); update_option( 'wpconsent_admin_notices', $notices ); return; } // Check if it has been dismissed or not. if ( ( isset( $notices['review_request']['dismissed'] ) && ! $notices['review_request']['dismissed'] ) && ( isset( $notices['review_request']['time'] ) && ( ( $notices['review_request']['time'] + DAY_IN_SECONDS ) <= $time ) ) ) { $load = true; } // If we cannot load, return early. if ( ! $load ) { return; } $this->review(); } /** * Maybe show Lite review request. */ public function review() { // Fetch when plugin was initially installed. $activated = get_option( 'wpconsent_activated', array() ); if ( ! empty( $activated['wpconsent'] ) ) { // Only continue if plugin has been installed for at least 14 days. if ( ( $activated['wpconsent'] + ( DAY_IN_SECONDS * 14 ) ) > time() ) { return; } } else { $activated['wpconsent'] = time(); update_option( 'wpconsent_activated', $activated ); return; } // Only proceed with displaying if the user completed onboarding. if ( ! wpconsent()->settings->get_option( 'onboarding_completed' ) ) { return; } $feedback_url = add_query_arg( array( 'siteurl' => untrailingslashit( home_url() ), 'plugin' => class_exists( 'WPConsent_Premium' ) ? 'pro' : 'lite', 'version' => WPCONSENT_VERSION, ), 'https://www.wpconsent.com/plugin-feedback/' ); $feedback_url = wpconsent_utm_url( $feedback_url, 'review-notice', 'feedback' ); ob_start(); // We have a candidate! Output a review message. ?>
WPConsent_Notice::DISMISS_GLOBAL, 'slug' => 'review_request', 'autop' => false, 'class' => 'wpconsent-review-notice', ) ); } /** * When user is on a WPConsent related admin page, display footer text * that graciously asks them to rate us. * * @param string $text Footer text. * * @return string * * */ public function admin_footer( $text ) { global $current_screen; if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'wpconsent' ) !== false ) { $url = 'https://wordpress.org/support/plugin/wpconsent-cookies-banner-privacy-suite/reviews/#new-post'; $text = sprintf( wp_kses( /* translators: $1$s - WPConsent plugin name; $2$s - WP.org review link; $3$s - WP.org review link. */ __( 'Please rate %1$s ★★★★★ on WordPress.org to help us spread the word. Thank you from the WPConsent team!', 'wpconsent-cookies-banner-privacy-suite' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array(), ), ) ), 'WPConsent', $url, $url ); } return $text; } } new WPConsent_Review();