-
Notifications
You must be signed in to change notification settings - Fork 10
/
holler-box.php
executable file
·178 lines (144 loc) · 3.94 KB
/
holler-box.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
/**
* Plugin Name: HollerBox
* Plugin URI: https://hollerwp.com
* Description: Powerful Popups & Lead Generation for Small Businesses & Agencies using WordPress
* Version: 2.3.8
* Author: Groundhogg Inc.
* Author URI: https://groundhogg.io
* Text Domain: holler-box
*
* @author Groundhogg Inc.
* @copyright Copyright (c) Groundhogg Inc 2022
*
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'HOLLERBOX_VERSION', '2.3.8' );
if ( ! class_exists( 'Holler_Box' ) ) {
/**
* Main Holler_Box class
*
*/
class Holler_Box {
/**
* @var Holler_Box $instance The one true Holler_Box
*/
private static $instance;
/**
* Get active instance
*
* @access public
* @since 0.1.0
* @return self The one true Holler_Box
*/
public static function instance() {
if ( ! self::$instance ) {
self::$instance = new Holler_Box();
}
return self::$instance;
}
public function __construct() {
if ( self::$instance ) {
return;
}
$this->setup_constants();
$this->includes();
$this->load_textdomain();
$this->hooks();
Holler_Admin::instance();
new Holler_Api();
new Holler_Frontend();
new Holler_Telemetry();
new Holler_Updater();
Holler_Licensing::instance();
}
/**
* Setup plugin constants
*
* @access private
* @since 0.1.0
* @return void
*/
private function setup_constants() {
// Plugin version
define( 'Holler_Box_VER', HOLLERBOX_VERSION );
// Plugin path
define( 'Holler_Box_DIR', plugin_dir_path( __FILE__ ) );
// Plugin URL
define( 'Holler_Box_URL', plugin_dir_url( __FILE__ ) );
}
/**
* Include necessary files
*
* @access private
* @since 0.1.0
* @return void
*/
private function includes() {
require_once __DIR__ . '/includes/class-holler-api.php';
require_once __DIR__ . '/includes/class-holler-admin.php';
require_once __DIR__ . '/includes/class-holler-popup.php';
require_once __DIR__ . '/includes/class-holler-frontend.php';
require_once __DIR__ . '/includes/class-holler-lead.php';
require_once __DIR__ . '/includes/class-holler-integrations.php';
require_once __DIR__ . '/includes/class-holler-reporting.php';
require_once __DIR__ . '/includes/class-holler-settings.php';
require_once __DIR__ . '/includes/class-holler-licensing.php';
require_once __DIR__ . '/includes/class-holler-telemetry.php';
require_once __DIR__ . '/includes/class-holler-updater.php';
require_once __DIR__ . '/includes/Holler_EDD_SL_Plugin_Updater.php';
}
/**
* Run action and filter hooks
*
* @access private
* @since 0.1.0
* @return void
*
*
*/
private function hooks() {
}
/**
* Internationalization
*
* @access public
* @since 0.1.0
* @return void
*/
public function load_textdomain() {
load_plugin_textdomain( 'holler-box' );
}
}
} // End if class_exists check
/**
* The main function responsible for returning the one true EDD_Metrics
* instance to functions everywhere
*
* @since 0.1.0
* @return \Holler_Box The one true Holler_Box
*
*/
function holler_box_load() {
Holler_Box::instance();
do_action( 'hollerbox/loaded' );
}
add_action( 'plugins_loaded', 'holler_box_load' );
/**
* The activation hook is called outside of the singleton because WordPress doesn't
* register the call from within the class, since we are preferring the plugins_loaded
* hook for compatibility, we also can't reference a function inside the plugin class
* for the activation function. If you need an activation function, put it here.
*
* @since 0.1.0
* @return void
*/
function holler_box_activation() {
/* Activation functions here */
holler_box_load();
Holler_Reporting::instance()->create_table();
}
register_activation_hook( __FILE__, 'holler_box_activation' );