public function __construct()
 {
     self::$ALLOWED_TRIGGERS = array(array('text' => __('When a post is published.', 'web-push'), 'key' => 'new-post', 'enable_by_default' => true, 'hook' => 'transition_post_status', 'action' => 'on_transition_post_status'), array('text' => __('When a post is updated.', 'web-push'), 'key' => 'update-post', 'parentKey' => 'new-post', 'enable_by_default' => true, 'hook' => 'transition_post_status', 'action' => 'on_transition_post_status'), array('text' => __('Right after subscription (useful to show to users what notifications look like).', 'web-push'), 'key' => 'on-subscription', 'enable_by_default' => true));
     self::add_trigger_handlers();
     if (get_option('webpush_subscription_button')) {
         add_action('wp_footer', array($this, 'add_subscription_button'), 9999);
     }
     Mozilla\WP_SW_Manager::get_manager()->sw()->add_content(array($this, 'service_worker'));
     add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_scripts'));
     add_filter('query_vars', array($this, 'on_query_vars'), 10, 1);
     add_action('parse_request', array($this, 'on_parse_request'));
     add_action('wp_ajax_webpush_register', array($this, 'handle_register'));
     add_action('wp_ajax_nopriv_webpush_register', array($this, 'handle_register'));
     add_action('wp_ajax_webpush_unregister', array($this, 'handle_unregister'));
     add_action('wp_ajax_nopriv_webpush_unregister', array($this, 'handle_unregister'));
     add_action('wp_ajax_webpush_get_payload', array($this, 'handle_get_payload'));
     add_action('wp_ajax_nopriv_webpush_get_payload', array($this, 'handle_get_payload'));
     add_action('wp_ajax_webpush_prompt', array($this, 'handle_prompt'));
     add_action('wp_ajax_nopriv_webpush_prompt', array($this, 'handle_prompt'));
     $senderID = get_option('webpush_gcm_sender_id');
     if ($senderID && get_option('webpush_generate_manifest')) {
         $manifestGenerator = Mozilla\WebAppManifestGenerator::getInstance();
     }
     $wpServeFile = Mozilla\WP_Serve_File::getInstance();
     $wpServeFile->add_file('subscription_button.css', array($this, 'subscriptionButtonCSSGenerator'));
     $wpServeFile->add_file('bell.svg', array($this, 'bellSVGGenerator'));
 }
 public function __construct()
 {
     add_action('wp_head', array($this, 'add_manifest'));
     self::$ALLOWED_TRIGGERS = array(array('text' => __('New Post', 'wpwebpush'), 'key' => 'new-post', 'enable_by_default' => true, 'hook' => 'transition_post_status', 'action' => 'on_transition_post_status'));
     self::add_trigger_handlers();
     add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_scripts'));
     add_filter('query_vars', array($this, 'on_query_vars'), 10, 1);
     add_action('parse_request', array($this, 'on_parse_request'));
     add_action('wp_ajax_nopriv_webpush_register', array($this, 'handle_webpush_register'));
     add_action('wp_ajax_nopriv_webpush_get_payload', array($this, 'handle_webpush_get_payload'));
 }