Skip to content
Snippets Groups Projects

feature(petition): added text petition

Merged Krzysztof Dyszczyk requested to merge feature/text-petition into master
All threads resolved!
1 file
+ 14
1
Compare changes
  • Side-by-side
  • Inline
+ 14
1
@@ -44,18 +44,31 @@ class TextPetition implements Hookable {
/**
* @param string $display_on_action
* @param DisplayDecision $display_decision
* @param string $plugin_author
* @param string $plugin_title
* @param string $rating_url
* @param string $text_align
*/
public function __construct( string $display_on_action, DisplayDecision $display_decision ) {
public function __construct( string $display_on_action, DisplayDecision $display_decision, string $plugin_author, string $plugin_title, string $rating_url, string $text_align = 'center' ) {
$this->display_on_action = $display_on_action;
$this->display_decision = $display_decision;
$this->text_align = $text_align;
$this->plugin_author = $plugin_author;
$this->plugin_title = $plugin_title;
$this->rating_url = $rating_url;
}
public function hooks() {
add_action( $this->display_on_action, [ $this, 'display_petition_if_should' ] );
}
public function display_petition_if_should() {
if ( $this->display_decision->should_display() ) {
$text_align = $this->text_align;
$plugin_author = $this->plugin_author;
$plugin_title = $this->plugin_title;
$rating_url = $this->rating_url;
include __DIR__ . '/views/html-text-petition.php';
}
}
Loading