Skip to content

Commit

Permalink
see #1245: initialize key validation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen17797 committed Jan 6, 2021
1 parent dbdb5d6 commit 91a4e0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/includes/class-wordlift.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @subpackage Wordlift/includes
*/

use Wordlift\Admin\Key_Validation_Notice;
use Wordlift\Analysis\Response\Analysis_Response_Ops_Factory;
use Wordlift\Autocomplete\All_Autocomplete_Service;
use Wordlift\Autocomplete\Linked_Data_Autocomplete_Service;
Expand Down Expand Up @@ -1555,6 +1556,7 @@ private function load_dependencies() {
* Add the faq duplicate markup hook.
*/
new Faq_Duplicate_Markup_Remover();
new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service );
}

/**
Expand Down
18 changes: 12 additions & 6 deletions src/wordlift/admin/class-key-validation-notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ public function __construct( $key_validation_service, $configuration_service ) {
}


public function get_notification_template() {
return <<<EOF
<p></p>
EOF;

public function show_notification() {
?>
<div class="updated">
<p><?php esc_html_e( 'Wordlift key is not valid', 'wordlift' ); ?></p>
<p class="submit">
<a class="button-secondary skip"
href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wl-hide-notice', 'install' ), 'wordlift_hide_notices_nonce', '_wl_notice_nonce' ) ); ?>">
<?php esc_html_e( 'Close', 'wordlift' ); ?></a>
</p>
</div>
<?php
}

private function is_key_valid() {
Expand Down Expand Up @@ -83,7 +89,7 @@ private function display_key_validation_notice() {
return;
}

echo $this->get_notification_template();
$this->show_notification();

} );
}
Expand Down

0 comments on commit 91a4e0e

Please sign in to comment.