messages = array( 'notice' => esc_html__( "Hi there! Stoked to see you're using Simple Custom Post Order for a few days now - hope you like it! And if you do, please consider rating it. It would mean the world to us. Keep on rocking!", 'simple-custom-post-order' ), 'rate' => esc_html__( 'Rate the plugin', 'simple-custom-post-order' ), 'rated' => esc_html__( 'Remind me later', 'simple-custom-post-order' ), 'no_rate' => esc_html__( 'Don\'t show again', 'simple-custom-post-order' ), ); if ( isset( $args['messages'] ) ) { $this->messages = wp_parse_args( $args['messages'], $this->messages ); } add_action( 'init', array( $this, 'init' ) ); } public function init() { if ( ! is_admin() ) { return; } $this->value = $this->value(); if ( $this->check() ) { add_action( 'admin_notices', array( $this, 'five_star_wp_rate_notice' ) ); add_action( 'wp_ajax_epsilon_simple_review', array( $this, 'ajax' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); add_action( 'admin_print_footer_scripts', array( $this, 'ajax_script' ) ); } } private function check() { if ( ! current_user_can('manage_options') ) { return false; } return( time() > $this->value ); } private function value() { $value = get_option( 'simple-rate-time', false ); if ( $value ) { return $value; } $value = time() + DAY_IN_SECONDS; update_option( 'simple-rate-time', $value ); return $value; } public function five_star_wp_rate_notice() { $url = sprintf( $this->link, $this->slug ); ?>
messages['notice'] ), $this->value ) ; ?>
messages['rate'] ); ?> messages['rated'] ); ?> messages['no_rate'] ); ?>