version = $this->resolve_version( $args );
$this->is_pro = $this->resolve_pro_status( $args );
$this->api_status = isset( $args['api_status'] ) && is_string( $args['api_status'] ) ? $args['api_status'] : null;
$this->review_url = isset( $args['review_url'] ) && is_string( $args['review_url'] ) ? $args['review_url'] : $this->get_default_review_url();
$this->review_phrases = array(
__( 'Loving Chimpmatic? Leave a review', 'chimpmatic-lite' ),
__( 'We run on coffee & 5-star reviews', 'chimpmatic-lite' ),
__( 'Make a developer smile today', 'chimpmatic-lite' ),
__( 'Got 10 seconds? Rate us!', 'chimpmatic-lite' ),
__( 'Fuel our plugin addiction', 'chimpmatic-lite' ),
__( 'Stars make us code faster', 'chimpmatic-lite' ),
__( 'Help us stay free & caffeinated', 'chimpmatic-lite' ),
__( "Love us? Don't keep it a secret", 'chimpmatic-lite' ),
__( 'Your review = our dopamine', 'chimpmatic-lite' ),
__( 'Be our hero on WordPress.org', 'chimpmatic-lite' ),
__( 'Psst... we love 5 stars', 'chimpmatic-lite' ),
__( 'Worth 5 stars? Let us know', 'chimpmatic-lite' ),
__( 'Support indie plugins', 'chimpmatic-lite' ),
__( 'Reviews keep the lights on', 'chimpmatic-lite' ),
__( 'Spread the Chimpmatic love', 'chimpmatic-lite' ),
__( 'Got love? Leave stars', 'chimpmatic-lite' ),
__( 'One click, endless gratitude', 'chimpmatic-lite' ),
__( 'Help other WP folks find us', 'chimpmatic-lite' ),
__( 'Like us? Rate us!', 'chimpmatic-lite' ),
__( 'Your stars = our motivation', 'chimpmatic-lite' ),
);
}
private function resolve_version( array $args ): string {
if ( isset( $args['version'] ) && is_string( $args['version'] ) ) {
return $args['version'];
}
if ( defined( 'CMATIC_VERSION' ) ) {
return (string) CMATIC_VERSION;
}
if ( defined( 'SPARTAN_MCE_VERSION' ) ) {
return (string) SPARTAN_MCE_VERSION;
}
return '0.0.0';
}
private function resolve_pro_status( array $args ): bool {
if ( isset( $args['is_pro'] ) ) {
return (bool) $args['is_pro'];
}
if ( function_exists( 'cmatic_is_blessed' ) ) {
return (bool) cmatic_is_blessed();
}
return false;
}
private function get_default_review_url(): string {
return 'https://wordpress.org/support/plugin/contact-form-7-mailchimp-extension/reviews/';
}
private function get_review_phrase(): string {
$index = wp_rand( 0, count( $this->review_phrases ) - 1 );
return $this->review_phrases[ $index ];
}
public function render(): void {
$badge_class = $this->is_pro ? 'cmatic-header__badge--pro' : 'cmatic-header__badge--lite';
$badge_text = $this->is_pro ? __( 'PRO', 'chimpmatic-lite' ) : __( 'Lite', 'chimpmatic-lite' );
?>