| 1 |
<?php |
| 2 |
/** |
| 3 |
Plugin Name: Push Notification |
| 4 |
Plugin URI: https://wordpress.org/plugins/push-notification/ |
| 5 |
Description: Push Notification allow admin to automatically notify your audience when you have published new content on your site or custom notices |
| 6 |
Author: Magazine3 |
| 7 |
Version: 1.2 |
| 8 |
Author URI: http://pushnotifications.io/ |
| 9 |
Text Domain: push-notification |
| 10 |
Domain Path: /languages |
| 11 |
License: GPL2+ |
| 12 |
*/ |
| 13 |
|
| 14 |
// Exit if accessed directly. |
| 15 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 16 |
|
| 17 |
define('PUSH_NOTIFICATION_PLUGIN_FILE', __FILE__ ); |
| 18 |
define('PUSH_NOTIFICATION_PLUGIN_DIR', plugin_dir_path( __FILE__ )); |
| 19 |
define('PUSH_NOTIFICATION_PLUGIN_URL', plugin_dir_url( __FILE__ )); |
| 20 |
define('PUSH_NOTIFICATION_PLUGIN_VERSION', '1.2'); |
| 21 |
define('PUSH_NOTIFICATION_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
| 22 |
|
| 23 |
add_action('plugins_loaded', 'push_notification_initialize'); |
| 24 |
function push_notification_initialize(){ |
| 25 |
require_once PUSH_NOTIFICATION_PLUGIN_DIR."inc/admin/admin.php"; |
| 26 |
if(is_admin()){ |
| 27 |
add_filter( 'plugin_action_links_' . PUSH_NOTIFICATION_PLUGIN_BASENAME,'push_notification_add_action_links', 10, 4); |
| 28 |
} |
| 29 |
} |
| 30 |
require_once PUSH_NOTIFICATION_PLUGIN_DIR."inc/frontend/pn-frontend.php"; |
| 31 |
|
| 32 |
|
| 33 |
function push_notification_add_action_links($actions, $plugin_file, $plugin_data, $context){ |
| 34 |
$mylinks = array('<a href="' . esc_url_raw(admin_url( 'admin.php?page=push-notification' )) . '">'.esc_html__( 'Settings', 'push-notification' ).'</a>'); |
| 35 |
return array_merge( $actions, $mylinks ); |
| 36 |
} |
| 37 |
|
| 38 |
register_activation_hook( PUSH_NOTIFICATION_PLUGIN_FILE, 'push_notification_on_activate' ); |
| 39 |
function push_notification_on_activate(){ |
| 40 |
/** Setup notification feature in PWA-for-wp*/ |
| 41 |
$pwaforwp_settings = get_option( 'pwaforwp_settings'); |
| 42 |
if(isset($pwaforwp_settings['notification_feature']) && $pwaforwp_settings['notification_feature']==0){ |
| 43 |
$pwaforwp_settings['notification_feature'] = 1; |
| 44 |
update_option( 'pwaforwp_settings', $pwaforwp_settings); |
| 45 |
} |
| 46 |
} |