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' ) ); add_filter( 'safe_style_css', function( $styles ) { $styles[] = 'display'; return $styles; } ); } } } 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_weeks = strtotime( '+2 weeks' ); $three_weeks = strtotime( '+3 weeks' ); $rating_date = mt_rand( $two_weeks, $three_weeks ); 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( '+100 years' ); update_option( $this->prefix . '_rating_date', $twenty_years, false ); return; } $rating_date = get_option( $this->prefix . '_rating_date' ); $html = wp_kses_post( '
'; // Translators: %1$s is a plugin nicename, %2$s is a short url (slug) $html .= sprintf( __( '