forked from groundhoggwp/holler-box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathholler-box.php
executable file
·150 lines (121 loc) · 3.66 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
<?php
/**
* Plugin Name: Holler Box
* Plugin URI: http://hollerwp.com
* Description: Sales and marketing automation for eCommerce stores. Lead generation and conversion popups and more.
* Version: 1.5.1
* Author: Scott Bolinger
* Author URI: http://scottbolinger.com
* Text Domain: holler-box
*
* @author Scott Bolinger
* @copyright Copyright (c) Scott Bolinger 2017
*
*/
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) exit;
if( !class_exists( 'Holler_Box' ) ) {
/**
* Main Holler_Box class
*
* @since 0.1.0
*/
class Holler_Box {
/**
* @var Holler_Box $instance The one true Holler_Box
* @since 0.1.0
*/
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();
self::$instance->setup_constants();
self::$instance->includes();
self::$instance->load_textdomain();
self::$instance->hooks();
}
return self::$instance;
}
/**
* Setup plugin constants
*
* @access private
* @since 0.1.0
* @return void
*/
private function setup_constants() {
// Plugin version
define( 'Holler_Box_VER', '1.5.1' );
// 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 Holler_Box_DIR . 'includes/class-holler-functions.php';
require_once Holler_Box_DIR . 'includes/class-holler-ajax.php';
if( is_admin() )
require_once Holler_Box_DIR . 'includes/class-holler-admin.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() {
return Holler_Box::instance();
}
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 */
}
register_activation_hook( __FILE__, 'holler_box_activation' );