compatibility
1 year ago
class-astra-sites-elementor-images.php
6 years ago
class-astra-sites-elementor-pages.php
2 years ago
class-astra-sites-error-handler.php
2 years ago
class-astra-sites-file-system.php
2 years ago
class-astra-sites-importer-log.php
2 years ago
class-astra-sites-importer.php
1 year ago
class-astra-sites-nps-notice.php
1 year ago
class-astra-sites-page.php
1 year ago
class-astra-sites-update.php
1 year ago
class-astra-sites-utils.php
2 years ago
class-astra-sites-white-label.php
2 years ago
class-astra-sites-wp-cli.php
2 years ago
class-astra-sites.php
1 year ago
functions.php
2 years ago
class-astra-sites-nps-notice.php
101 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Init |
| 4 | * |
| 5 | * @since 1.0.0 |
| 6 | * @package NPS Survey |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | if ( ! class_exists( 'Astra_Sites_Nps_Notice' ) ) : |
| 14 | |
| 15 | /** |
| 16 | * Admin |
| 17 | */ |
| 18 | class Astra_Sites_Nps_Notice { |
| 19 | /** |
| 20 | * Instance |
| 21 | * |
| 22 | * @since 1.0.0 |
| 23 | * @var (Object) Astra_Sites_Nps_Notice |
| 24 | */ |
| 25 | private static $instance = null; |
| 26 | |
| 27 | /** |
| 28 | * Get Instance |
| 29 | * |
| 30 | * @since 1.0.0 |
| 31 | * |
| 32 | * @return object Class object. |
| 33 | */ |
| 34 | public static function get_instance() { |
| 35 | if ( ! isset( self::$instance ) ) { |
| 36 | self::$instance = new self(); |
| 37 | } |
| 38 | |
| 39 | return self::$instance; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Constructor. |
| 44 | * |
| 45 | * @since 1.0.0 |
| 46 | */ |
| 47 | private function __construct() { |
| 48 | add_action( 'admin_footer', array( $this, 'render_nps_survey' ), 999 ); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Render NPS Survey |
| 53 | * |
| 54 | * @return void |
| 55 | */ |
| 56 | public function render_nps_survey() { |
| 57 | |
| 58 | if ( ! class_exists( 'Nps_Survey' ) ) { |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | if ( class_exists( 'Astra_Sites_White_Label' ) && is_callable( 'Astra_Sites_White_Label::get_instance' ) && Astra_Sites_White_Label::get_instance()->is_white_labeled() ) { |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | Nps_Survey::show_nps_notice( |
| 67 | 'nps-survey-astra-sites', |
| 68 | array( |
| 69 | 'show_if' => get_option( 'astra_sites_import_complete', false ), |
| 70 | 'dismiss_timespan' => 2 * WEEK_IN_SECONDS, |
| 71 | 'display_after' => 0, |
| 72 | 'plugin_slug' => 'astra-sites', |
| 73 | 'message' => array( |
| 74 | |
| 75 | // Step 1 i.e rating input. |
| 76 | 'logo' => esc_url( INTELLIGENT_TEMPLATES_URI . 'assets/images/logo.svg' ), |
| 77 | 'plugin_name' => __( 'Starter Templates', 'astra-sites' ), |
| 78 | 'nps_rating_message' => __( 'How likely are you to recommend #pluginname to your friends or colleagues?', 'astra-sites' ), |
| 79 | |
| 80 | // Step 2A i.e. positive. |
| 81 | 'feedback_title' => __( 'Thanks a lot for your feedback! 😍', 'astra-sites' ), |
| 82 | 'feedback_content' => __( 'Could you please do us a favor and give us a 5-star rating on WordPress? It would help others choose Starter Templates with confidence. Thank you!', 'astra-sites' ), |
| 83 | 'plugin_rating_link' => esc_url( 'https://wordpress.org/support/plugin/astra-sites/reviews/#new-post' ), |
| 84 | |
| 85 | // Step 2B i.e. negative. |
| 86 | 'plugin_rating_title' => __( 'Thank you for your feedback', 'astra-sites' ), |
| 87 | 'plugin_rating_content' => __( 'We value your input. How can we improve your experience?', 'astra-sites' ), |
| 88 | ), |
| 89 | ) |
| 90 | ); |
| 91 | } |
| 92 | |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Kicking this off by calling 'get_instance()' method |
| 97 | */ |
| 98 | Astra_Sites_Nps_Notice::get_instance(); |
| 99 | |
| 100 | endif; |
| 101 |