PluginProbe
SALERT – Fake Sales Notification WooCommerce / 1.2.4
SALERT – Fake Sales Notification WooCommerce v1.2.4
trunk 1.0.0 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 All 30 releases
salert / salert.php

salert.php in SALERT – Fake Sales Notification WooCommerce 1.2.4, at salert.php

118 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
3 /*
4 Plugin Name: Salert
5 Plugin URI: https://wpoperation.com/plugins/salert/
6 Description: The plugin will generate fake sales notifications, which will help to boost your sales.Also works without WooCommerce Plugin.
7 Version: 1.2.4
8 Author: WPoperation
9 Author URI: https://wpoperation.com/
10 License: GPL2 or later
11 License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12 Domain Path: /languages/
13 Text Domain: salert
14 */
15
16 defined('SALERT_FRONT_CSS_DIR') or define('SALERT_FRONT_CSS_DIR',plugin_dir_url(__FILE__).'/assets/frontend/css');
17 defined('SALERT_FRONT_JS_DIR') or define('SALERT_FRONT_JS_DIR',plugin_dir_url(__FILE__).'/assets/frontend/js');
18 defined('SALERT_BACK_CSS_DIR') or define('SALERT_BACK_CSS_DIR',plugin_dir_url(__FILE__).'/assets/backend/css');
19 defined('SALERT_BACK_JS_DIR') or define('SALERT_BACK_JS_DIR',plugin_dir_url(__FILE__).'/assets/backend/js');
20 defined('SALERT_PATH') or define('SALERT_PATH',plugin_dir_path(__FILE__));
21 defined('SALERT_DIR') or define('SALERT_DIR',plugin_dir_url(__FILE__));
22 defined('SALERT_VERSION') or define('SALERT_VERSION','1.2.4');
23 /*
24 **Require File Directories
25 */
26 require_once SALERT_PATH.'inc/settings.php';
27
28
29 if(!class_exists('Salert')){
30 class Salert{
31
32 // Construtor to load all hooks
33 public function __construct(){
34 add_action( 'init', array($this,'salert_init') );
35 add_action( 'admin_enqueue_scripts',array($this,'register_backend_assets') );
36 $salert_settings = get_option('salert_save_settings');
37 $show_popup = isset($salert_settings['popup-enable']) ? $salert_settings['popup-enable'] : 0;
38 if($show_popup){
39 add_action( 'wp_enqueue_scripts', array($this, 'register_frontend_assets') );
40 add_action( 'wp_footer', array($this,'salert_display_wrapper' ) );
41 add_action( 'wp_ajax_salert_get_content', array($this,'salert_get_content' ) );
42 add_action( 'wp_ajax_nopriv_salert_get_content', array($this,'salert_get_content' ) );
43 }
44 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array($this,'salert_pro_plugin_action_links') );
45 }
46
47 // Register Text Domain
48 public function salert_init(){
49 load_plugin_textdomain( 'salert', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
50 }
51
52 //Registering of backend js and css
53 public function register_backend_assets() {
54 if( isset( $_GET['page'] ) && $_GET['page'] == 'salert-settings' ) {
55
56 wp_enqueue_style( 'salert-admin-css', SALERT_BACK_CSS_DIR . '/salert-admin.css', array(), SALERT_VERSION );
57 wp_enqueue_style( 'animate-css', SALERT_BACK_CSS_DIR . '/animate.css', array(), SALERT_VERSION );
58 wp_enqueue_style( 'sweetalert-css', SALERT_BACK_CSS_DIR . '/sweetalert2.min.css', array(), SALERT_VERSION );
59 wp_enqueue_style( 'wp-color-picker' );
60 if ( function_exists( 'wp_enqueue_media' ) ) {
61 wp_enqueue_media();
62 }
63 wp_enqueue_script( 'sweetalert-core-js', SALERT_BACK_JS_DIR.'/core.js', array( 'jquery' ), SALERT_VERSION, true );
64 wp_enqueue_script( 'sweetalert2-js', SALERT_BACK_JS_DIR.'/sweetalert2.min.js', array( 'jquery', 'sweetalert-core-js' ), SALERT_VERSION, true );
65 wp_enqueue_script( 'salert-custom-js', SALERT_BACK_JS_DIR.'/custom.js', array( 'jquery' ), SALERT_VERSION, true );
66 wp_enqueue_script( 'salert-admin-js', SALERT_BACK_JS_DIR.'/salert-admin.js', array( 'jquery', 'wp-color-picker' ), SALERT_VERSION, true );
67 $js_info = array(
68 'ajax_url' => admin_url( 'admin-ajax.php' ),
69 'ajax_nonce' => wp_create_nonce('salert_ajax_nonce_wpop')
70 );
71 wp_localize_script( 'salert-custom-js', 'admin_settings', $js_info );
72 }
73 }
74
75 //Registering Frontend Assets
76 public function register_frontend_assets(){
77 //styles
78 wp_enqueue_style( 'animate-css', SALERT_BACK_CSS_DIR . '/animate.css', array(), SALERT_VERSION );
79 wp_enqueue_style( 'salert-main-css', SALERT_FRONT_CSS_DIR.'/style.css' );
80
81 //scripts
82 wp_enqueue_script('salert-main-js',SALERT_FRONT_JS_DIR . '/main.js', array('jquery'), SALERT_VERSION);
83
84 include(SALERT_PATH.'inc/dynamic-styles.php') ;
85 }
86
87 //Add display wrapper
88 public function salert_display_wrapper(){
89 $salert_settings = get_option('salert_save_settings');
90 ?>
91 <div id="salertWrapper">
92 <div class="popup_position <?php echo $salert_settings['popup-position'];?>">
93 <div class="popup_box">
94 <div class="popup_template animated clearfix" id="popup_template" style="display: none;">
95 <!-- Content will be loaded dynamically through ajax -->
96 </div>
97 </div>
98 </div>
99 </div>
100 <?php
101 }
102
103 //Get salert contents
104 public function salert_get_content(){
105 $path = SALERT_PATH. '/inc/display.php';
106 require_once($path);
107 exit();
108 }
109
110 public function salert_pro_plugin_action_links( $links ) {
111
112 $links[] = '<a href="https://wpoperation.com/plugins/sale-alert/" target="_blank" style="color:#05c305; font-weight:bold;">'.esc_html__('Go Pro','salert').'</a>';
113 return $links;
114 }
115 }
116
117 $salert_object = new Salert(); //initialization of plugin
118 }