PluginProbe
SALERT – Fake Sales Notification WooCommerce / 1.2.7
SALERT – Fake Sales Notification WooCommerce v1.2.7
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.7, at salert.php

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