Skip to content
Snippets Groups Projects
Commit 96efa149 authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

feature(petition): added text petition

parent 07f89ac0
No related branches found
1 merge request!1feature(petition): added text petition
.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;
}
...@@ -10,6 +10,8 @@ use WPDesk\RepositoryRating\DisplayStrategy\DisplayDecision; ...@@ -10,6 +10,8 @@ use WPDesk\RepositoryRating\DisplayStrategy\DisplayDecision;
*/ */
class TextPetitionDisplayer implements Hookable { class TextPetitionDisplayer implements Hookable {
const SCRIPTS_VERSION = '2';
/** /**
* @var string * @var string
*/ */
...@@ -38,8 +40,21 @@ class TextPetitionDisplayer implements Hookable { ...@@ -38,8 +40,21 @@ class TextPetitionDisplayer implements Hookable {
public function hooks() { public function hooks() {
add_action( $this->display_on_action, [ $this, 'display_petition_if_should' ] ); 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() { public function display_petition_if_should() {
if ( $this->display_decision->should_display() ) { if ( $this->display_decision->should_display() ) {
echo wp_kses_post( $this->petition_text_generator->get_petition_text() ); echo wp_kses_post( $this->petition_text_generator->get_petition_text() );
......
...@@ -5,53 +5,13 @@ ...@@ -5,53 +5,13 @@
* @var string $plugin_title * @var string $plugin_title
* @var string $rating_url * @var string $rating_url
*/ */
?><style> ?><div class="wpdesk-rating-petition" style="text-align: <?php echo esc_attr( $text_align ); ?>;">
.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">
<?php echo wp_kses_post( <?php echo wp_kses_post(
sprintf( 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>', '<span class="heart"></span>',
$plugin_author, $plugin_author,
$plugin_title, '<span class="plugin-title">' . $plugin_title . '</span>',
'<a href="' . $rating_url . '" target="_blank">', '<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>', '<span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span>',
'</a>' '</a>'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment