/**
  * Get singleton instance
  */
 public static function init()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
<?php

if ($_POST) {
    if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['message']) && !empty($_POST['message']) && isset($_POST['wp_chrome_new_notification']) && wp_verify_nonce($_POST['wp_chrome_new_notification'], 'wp_chrome_new_notification')) {
        $data = array('title' => sanitize_text_field($_POST['title']), 'message' => sanitize_text_field($_POST['message']), 'url' => sanitize_text_field($_POST['url']));
        $result = WPChromePush::init()->sendGCM($data, 'message');
        $answer = json_decode($result);
        if ($answer) {
            $suc = $answer->{'success'};
            $fail = $answer->{'failure'};
            //if debug
            if (get_option('web_push_debuger')) {
                $gcm_output = "<div id='message' class='updated'><p><b>Push Notification Sent</b><i>&nbsp;&nbsp;</i></p><p>{$result}</p></div>";
            } else {
                $gcm_output = "<div id='message' class='updated'><p><b>Push Notification Sent</b><i>&nbsp;&nbsp;</i></p><p>" . __('Success:', 'px_gcm') . " {$suc}  &nbsp;&nbsp;" . __('Failed:', 'px_gcm') . " {$fail} </p></div>";
            }
        } else {
            $error_message = "<div id='message' class='error'><p><b>Error: </b>{$result}</p></div>";
        }
    } else {
        $error_message = "<div id='message' class='error'><p><b>Error: </b>Please complete all the fields.</p></div>";
    }
}
?>

<div class="wrap">
<h2>New Push Notification</h2>
<p><?php 
echo isset($gcm_output) ? $gcm_output : '';
?>
</p>
<?php

if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
/*
Plugin Name: Chrome Push Notifications
Plugin URI: http://www.github.com/aglipanci
Description: Chrome Push Notifications GCM
Version: 1.1.5
Author: Agli Panci
Author URI: http://www.aglipanci.com/
*/
if (!defined('CHROME_PUSH_PLUGIN_DIR')) {
    define('CHROME_PUSH_PLUGIN_DIR', plugin_dir_path(__FILE__));
}
if (!defined('CHROME_PUSH_PLUGIN_URL')) {
    define('CHROME_PUSH_PLUGIN_URL', plugin_dir_url(__FILE__));
}
require_once CHROME_PUSH_PLUGIN_DIR . 'includes/class-chrome-push.php';
register_activation_hook(__FILE__, array('WPChromePush', 'installFunctions'));
//start the plugin
WPChromePush::init();
        update_option('web_push_project_number', sanitize_text_field($_POST['web_push_project_number']));
        $form_url = 'admin.php?page=chrome-push';
        $manifest_file = '{"gcm_sender_id": "' . get_option('web_push_project_number') . '"}';
        WPChromePush::writeFile($form_url, $manifest_file, 'manifest.json');
    }
    if (isset($_POST['web_push_api_key']) && !empty($_POST['web_push_api_key'])) {
        update_option('web_push_api_key', sanitize_text_field($_POST['web_push_api_key']));
    }
    if (isset($_POST['web_push_debuger']) && !empty($_POST['web_push_debuger'])) {
        update_option('web_push_debuger', true);
    } else {
        update_option('web_push_debuger', false);
    }
    if (isset($_POST['web_push_icon']) && !empty($_POST['web_push_icon'])) {
        update_option('web_push_icon', sanitize_text_field($_POST['web_push_icon']));
        WPChromePush::writeServiceWorker();
    }
    if (isset($_POST['web_push_post_types']) && !empty($_POST['web_push_post_types']) && is_array($_POST['web_push_post_types'])) {
        update_option('web_push_post_types', $_POST['web_push_post_types']);
    }
}
?>

<form method="post" action="">
    <?php 
wp_nonce_field('wp_chrome_settings', 'wp_chrome_settings');
?>
    <h3>Web Push GCM API Credentials</h3>
    <table class="form-table">
        <tr valign="top">
        <th scope="row">Project Number</th>