mainfile = $mainfile; $this->domain = $domain; $this->prefix = $prefix; register_activation_hook( $mainfile, array( $this, 'show_meowapps_create_rating_date' ) ); if ( is_admin() ) { $rating_date = $this->create_rating_date(); if ( time() > $rating_date ) { add_action( 'admin_notices', array( $this, 'admin_notices_rating' ) ); } } } function show_meowapps_create_rating_date() { delete_option( 'meowapps_hide_meowapps' ); $this->create_rating_date(); } function create_rating_date() { $rating_date = get_option( $this->prefix . '_rating_date' ); if ( empty( $rating_date ) ) { $two_months = strtotime( '+2 months' ); $six_months = strtotime( '+4 months' ); $rating_date = mt_rand( $two_months, $six_months ); update_option( $this->prefix . '_rating_date', $rating_date, false ); } return $rating_date; } function admin_notices_rating() { if ( isset( $_POST[$this->prefix . '_remind_me'] ) ) { $two_weeks = strtotime( '+2 weeks' ); $six_weeks = strtotime( '+6 weeks' ); $future_date = mt_rand( $two_weeks, $six_weeks ); update_option( $this->prefix . '_rating_date', $future_date, false ); return; } else if ( isset( $_POST[$this->prefix . '_never_remind_me'] ) ) { $twenty_years = strtotime( '+5 years' ); update_option( $this->prefix . '_rating_date', $twenty_years, false ); return; } else if ( isset( $_POST[$this->prefix . '_did_it'] ) ) { $twenty_years = strtotime( '+10 years' ); update_option( $this->prefix . '_rating_date', $twenty_years, false ); return; } $rating_date = get_option( $this->prefix . '_rating_date' ); $html = '
'; $html .= sprintf( // translators: %1$s is a plugin nicename, %2$s is a short url (slug) __( 'You have been using %1$s for some time now. Thank you! Could you kindly share your opinion with me, along with, maybe, features you would like to see implemented? Then, please write a little review. That will also bring me joy and motivation! I will get back to you :)', $this->domain ), $this->nice_name_from_file( $this->mainfile ), $this->nice_short_url_from_file( $this->mainfile ) ); $html .= '
'; $html .= '