PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 4.4.4
Hustle – Email Marketing, Lead Generation, Optins, Popups v4.4.4
7.8.14.2 7.8.14 7.8.14.1 7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / popoverincludes / classes / popoverpublic.php
wordpress-popup / popoverincludes / classes Last commit date
popover.help.php 13 years ago popoveradmin.php 13 years ago popoverajax.php 13 years ago popoverpublic.php 13 years ago
popoverpublic.php
206 lines
1 <?php
2
3 if(!class_exists('popoverpublic')) {
4
5 class popoverpublic {
6
7 var $mylocation = '';
8 var $build = 5;
9 var $db;
10
11 var $tables = array( 'popover', 'popover_ip_cache' );
12 var $popover;
13 var $popover_ip_cache;
14
15 var $activepopover = false;
16
17 var $thepopover;
18
19 function __construct() {
20
21 global $wpdb;
22
23 $this->db =& $wpdb;
24
25 foreach($this->tables as $table) {
26 $this->$table = popover_db_prefix($this->db, $table);
27 }
28
29 // Adds the JS to the themes header - this replaces all previous methods of loading
30 add_action( 'init', array( &$this, 'initialise_plugin') );
31
32 add_action( 'plugins_loaded', array(&$this, 'load_textdomain'));
33
34 $directories = explode(DIRECTORY_SEPARATOR,dirname(__FILE__));
35 $this->mylocation = $directories[count($directories)-1];
36
37 $installed = get_option('popover_installed', false);
38
39 if($installed === false || $installed != $this->build) {
40 $this->install();
41
42 update_option('popover_installed', $this->build);
43 }
44
45 }
46
47 function popoverpublic() {
48 $this->__construct();
49 }
50
51 function install() {
52
53 if($this->db->get_var( "SHOW TABLES LIKE '" . $this->popover . "' ") != $this->popover) {
54 $sql = "CREATE TABLE `" . $this->popover . "` (
55 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
56 `popover_title` varchar(250) DEFAULT NULL,
57 `popover_content` text,
58 `popover_settings` text,
59 `popover_order` bigint(20) DEFAULT '0',
60 `popover_active` int(11) DEFAULT '0',
61 PRIMARY KEY (`id`)
62 )";
63
64 $this->db->query($sql);
65
66 }
67
68 // Add in IP cache table
69 if($this->db->get_var( "SHOW TABLES LIKE '" . $this->popover_ip_cache . "' ") != $this->popover_ip_cache) {
70 $sql = "CREATE TABLE `" . $this->popover_ip_cache . "` (
71 `IP` varchar(12) NOT NULL DEFAULT '',
72 `country` varchar(2) DEFAULT NULL,
73 `cached` bigint(20) DEFAULT NULL,
74 PRIMARY KEY (`IP`),
75 KEY `cached` (`cached`)
76 )";
77
78 $this->db->query($sql);
79
80 }
81
82 }
83
84 function load_textdomain() {
85
86 $locale = apply_filters( 'popover_locale', get_locale() );
87 $mofile = popover_dir( "popoverincludes/languages/popover-$locale.mo" );
88
89 if ( file_exists( $mofile ) )
90 load_textdomain( 'popover', $mofile );
91
92 }
93
94 function initialise_plugin() {
95
96 $settings = get_popover_option('popover-settings', array( 'loadingmethod' => 'external'));
97
98 switch( $settings['loadingmethod'] ) {
99
100 case 'external': $this->add_selective_javascript();
101 break;
102
103 case 'footer': $this->add_popover_files();
104 break;
105
106 }
107
108 }
109
110 function add_selective_javascript() {
111 global $pagenow;
112
113 if(!in_array($pagenow, array('wp-login.php', 'wp-register.php'))) {
114 // We need javascript so make sure we load it here
115 wp_enqueue_script('jquery');
116
117 // Now to register our new js file
118 wp_register_script( 'popoverselective', popover_url('popover-load-js.php') );
119 wp_enqueue_script( 'popoverselective' );
120 }
121
122 }
123
124 function add_frontend_selective_javascript() {
125 global $pagenow;
126
127 if(!in_array($pagenow, array('wp-login.php', 'wp-register.php'))) {
128 // We need javascript so make sure we load it here
129 wp_enqueue_script('jquery');
130
131 // Now to register our new js file
132 wp_register_script( 'popoverselective', popover_url('popover-load-custom-js.php') );
133 wp_enqueue_script( 'popoverselective' );
134 }
135
136 }
137
138 function myURL() {
139
140 if ( isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) == "on") {
141 $url .= "https://";
142 } else {
143 $url = 'http://';
144 }
145
146 if ($_SERVER["SERVER_PORT"] != "80") {
147 $url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
148 } else {
149 $url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
150 }
151
152 return trailingslashit($url);
153 }
154
155 function add_popover_files() {
156
157 global $popoverajax;
158
159 if( method_exists( $popoverajax, 'selective_message_display') ) {
160
161 // Set up the rquest information from here - this is passed in using the standard JS interface so we need to fake it
162 $_REQUEST['thereferrer'] = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '';
163 $_REQUEST['thefrom'] = $this->myURL();
164
165 $this->thepopover = $popoverajax->selective_message_display();
166
167 if( isset($this->thepopover['name']) && $this->thepopover['name'] != 'nopopover' ) {
168 wp_enqueue_script('jquery');
169
170 wp_enqueue_script('popoverlegacyjs', popover_url('popoverincludes/js/popoverlegacy.js'), array('jquery'), $this->build);
171 wp_localize_script('popoverlegacyjs', 'popover', array( 'divname' => $this->thepopover['name'],
172 'usejs' => $this->thepopover['usejs'],
173 'delay' => $this->thepopover['delay']
174 ));
175
176 add_action('wp_head', array(&$this, 'output_header_content'));
177 add_action('wp_footer', array(&$this, 'output_footer_content'));
178
179 }
180
181 }
182
183 }
184
185 function output_header_content() {
186 // Output the styles
187 ?>
188 <style type="text/css">
189 <?php
190 echo $this->thepopover['style'];
191 ?>
192 </style>
193 <?php
194 }
195
196 function output_footer_content() {
197
198 echo $this->thepopover['html'];
199
200 }
201
202 }
203
204 }
205
206 ?>