diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000000000000000000000000000000000000..9002a6ae6861fa017f161dfe6d92cd9085836edd --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,43 @@ +.wpdesk-rating-petition { + font-size: 15px; + width: 100%; +} + +.wpdesk-rating-petition a { + text-decoration: none; + color: inherit; + font-weight: 600; +} + +.wpdesk-rating-petition span.plugin-title { + font-weight: 600; +} + +.wpdesk-rating-petition span.heart:before { + speak: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: #dc3232; + font-size: 16px; + font-family: "dashicons"; + content: "\f487"; + font-style: normal; + font-variant: normal; + font-weight: 400; + text-transform: none; +} + +.wpdesk-rating-petition span.star:before { + speak: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: #ffb900; + font-size: 16px; + font-family: "dashicons"; + content: "\f155"; + font-style: normal; + font-variant: normal; + font-weight: 400; + text-transform: none; + text-decoration: none; +} diff --git a/src/TextPetitionDisplayer.php b/src/TextPetitionDisplayer.php index 3fd0f1fbaff94fbf6ca9561d7ae02ce5daf419a7..ed179b413d19e7e91eafab2e6640c89d77f0b085 100644 --- a/src/TextPetitionDisplayer.php +++ b/src/TextPetitionDisplayer.php @@ -10,6 +10,8 @@ use WPDesk\RepositoryRating\DisplayStrategy\DisplayDecision; */ class TextPetitionDisplayer implements Hookable { + const SCRIPTS_VERSION = '2'; + /** * @var string */ @@ -38,8 +40,21 @@ class TextPetitionDisplayer implements Hookable { public function hooks() { add_action( $this->display_on_action, [ $this, 'display_petition_if_should' ] ); + add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_css_if_should' ] ); } + /** + * @internal + */ + public function enqueue_css_if_should() { + if ( $this->display_decision->should_display() ) { + wp_enqueue_style( 'wpdesk-rating-petition', plugin_dir_url( __DIR__ . '/../assets/css' ) . 'style.css', array(), self::SCRIPTS_VERSION ); + } + } + + /** + * @internal + */ public function display_petition_if_should() { if ( $this->display_decision->should_display() ) { echo wp_kses_post( $this->petition_text_generator->get_petition_text() ); diff --git a/src/views/html-text-petition.php b/src/views/html-text-petition.php index d4b54f774bd2884a2ec17641ddc09cbce8488439..1513aca9113e86549fe01ca45cd64bdef40309c2 100644 --- a/src/views/html-text-petition.php +++ b/src/views/html-text-petition.php @@ -5,53 +5,13 @@ * @var string $plugin_title * @var string $rating_url */ -?><style> - .wpdesk-rating-petition { - font-size: 15px; - text-align: <?php echo esc_attr( $text_align ); ?>; - width: 100%; - } - - .wpdesk-rating-petition a { - text-decoration: none; - color: inherit; - } - - .wpdesk-rating-petition span.heart:before { - speak: none; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - color: #dc3232; - font-size: 16px; - font-family: "dashicons"; - content: "\f487"; - font-style: normal; - font-variant: normal; - font-weight: 400; - text-transform: none; - } - .wpdesk-rating-petition span.star:before { - speak: none; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - color: #ffb900; - font-size: 16px; - font-family: "dashicons"; - content: "\f155"; - font-style: normal; - font-variant: normal; - font-weight: 400; - text-transform: none; - text-decoration: none; - } -</style> -<div class="wpdesk-rating-petition"> +?><div class="wpdesk-rating-petition" style="text-align: <?php echo esc_attr( $text_align ); ?>;"> <?php echo wp_kses_post( sprintf( - __( 'Created with %1$s by %2$s - If you like %3$s %4$srate us %5$s%6$s', 'wp-wpdesk-rating-petition' ), + __( 'Created with %1$s by %2$s - If you like %3$s %4$srate us %5$s in plugins repository%6$s', 'wp-wpdesk-rating-petition' ), '<span class="heart"></span>', $plugin_author, - $plugin_title, + '<span class="plugin-title">' . $plugin_title . '</span>', '<a href="' . $rating_url . '" target="_blank">', '<span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span>', '</a>'