<?php
/**
* Plugin Name: Push Notifications Reloaded
* Version: 1.0
* Requires at least: 4.9
* Requires PHP: 5.6
* Plugin URI: https://lunacreativity.in/
* Description: Send notifications on post/page publish,update etc
* Author: Mr. Kanhu
* Author URI: https://lunacreativity.in/
* Text Domain: push-notifications-reloaded
* Domain Path: /languages
*/
//denied direct access of the file
defined(‘ABSPATH’) || die( “Permission Denied”);
//define plugin constants
define(‘PNR_URL’, plugin_dir_url( __FILE__ ));
define(‘PNR_PATH’, plugin_dir_path( __FILE__ ));
define(‘PNR_ASSETS_URL’, plugin_dir_url( __FILE__ ).‘assets’);
define(‘PNR_INCLUDE_PATH’,plugin_dir_path( __FILE__ ).‘includes’);
define(‘PNR_ADMIN_URL’, admin_url(‘admin.php?page=push-notifications-reloaded’));
//load textdomain
add_action(‘plugins_loaded’, ‘pnr_text_domain’);
function pnr_text_domain() {
load_plugin_textdomain( ‘push-notifications-reloaded’, false, dirname( plugin_basename( __FILE__ ) ). ‘/languages/’ );
}
// added to the for js and css files
add_action( ‘admin_init’, ‘pnr_css_js’ );
function pnr_css_js() {
if(isset($_GET[‘page’]) && $_GET[‘page’]==‘push-notifications-reloaded’){
wp_enqueue_style( “pnr-font-awesome”, “https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css”);
wp_enqueue_script( “pnr-jquery-latest”, PNR_ASSETS_URL.“/js/jquery.min.js”);
wp_enqueue_script( “pnr-jquery-validation”, PNR_ASSETS_URL.“/js/jquery.validate.min.js”);
wp_enqueue_script( “pnr-custom-js”, PNR_ASSETS_URL.“/js/pnr-js.js”, array( ‘jquery’ ), ‘1.0’, false);
wp_enqueue_style( “pnr-custom-css”, PNR_ASSETS_URL.‘/css/pnr-css.css’);
//add ajax url
wp_localize_script( ‘pnr-custom-js’, ‘pnr’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ )));
//for ajax call
add_action( ‘wp_ajax_pnr_api_ajax’, ‘pnr_api_ajax’ );
//for media uploader
wp_enqueue_media();
}
}