PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 3.1
Hustle – Email Marketing, Lead Generation, Optins, Popups v3.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
functions.php 15 years ago popoveradmin.php 15 years ago popoverpublic.php 15 years ago
popoverpublic.php
231 lines
1 <?php
2
3 if(!class_exists('popoverpublic')) {
4
5 class popoverpublic {
6
7 var $mylocation = '';
8 var $build = 3;
9
10 function __construct() {
11
12 add_action('init', array(&$this, 'selective_message_display'), 1);
13 add_action('wp_footer', array(&$this, 'selective_message_display'));
14
15 add_action( 'plugins_loaded', array(&$this, 'load_textdomain'));
16
17 $directories = explode(DIRECTORY_SEPARATOR,dirname(__FILE__));
18 $this->mylocation = $directories[count($directories)-1];
19
20 }
21
22 function popoverpublic() {
23 $this->__construct();
24 }
25
26 function load_textdomain() {
27
28 $locale = apply_filters( 'popover_locale', get_locale() );
29 $mofile = popover_dir( "popoverincludes/languages/popover-$locale.mo" );
30
31 if ( file_exists( $mofile ) )
32 load_textdomain( 'popover', $mofile );
33
34 }
35
36 function selective_message_display() {
37
38 if(is_multisite() && defined('PO_GLOBAL')) {
39 $getoption = 'get_site_option';
40 } else {
41 $getoption = 'get_option';
42 }
43
44 $popover_check = $getoption('popover_check', array());
45
46 $show = false;
47
48 if(!empty($popover_check)) {
49
50 $order = explode(',', $popover_check['order']);
51
52 foreach($order as $key) {
53 switch ($key) {
54
55 case "supporter":
56 if(function_exists('is_supporter') && !is_supporter()) {
57 $show = true;
58 } else {
59 return false;
60 }
61 break;
62
63 case "loggedin": if(!$this->is_loggedin()) {
64 $show = true;
65 } else {
66 return false;
67 }
68 break;
69
70 case "isloggedin": if($this->is_loggedin()) {
71 $show = true;
72 } else {
73 return false;
74 }
75 break;
76
77 case "commented": if(!$this->has_commented()) {
78 $show = true;
79 } else {
80 return false;
81 }
82 break;
83
84 case "internal": $internal = str_replace('http://','',get_option('siteurl'));
85 if(!$this->referrer_matches(addcslashes($internal,"/"))) {
86 $show = true;
87 } else {
88 return false;
89 }
90 break;
91
92 case "count": $popover_count = $getoption('popover_count', '3');
93 if($this->has_reached_limit($popover_count)) {
94 return false;
95 }
96 break;
97
98 }
99 }
100 }
101
102 if($show == true) {
103
104 if($this->clear_forever()) {
105 $show = false;
106 }
107
108 }
109
110 if($show == true) {
111 // Show the advert
112 wp_enqueue_style('popovercss', popover_url('popoverincludes/css/popover.css'), array(), $this->build);
113 wp_enqueue_script('popoverjs', popover_url('popoverincludes/js/popover.js'), array('jquery'), $this->build);
114
115 if($getoption('popover_usejs', 'no') == 'yes') {
116 wp_enqueue_script('popoveroverridejs', popover_url('popoverincludes/js/popoversizing.js'), array('jquery'), $this->build);
117 }
118
119 add_action('wp_footer', array(&$this, 'page_footer'));
120 wp_enqueue_script('jquery');
121
122 // Add the cookie
123 if ( isset($_COOKIE['popover_view_'.COOKIEHASH]) ) {
124 $count = intval($_COOKIE['popover_view_'.COOKIEHASH]);
125 if(!is_numeric($count)) $count = 0;
126 $count++;
127 } else {
128 $count = 1;
129 }
130 if(!headers_sent()) setcookie('popover_view_'.COOKIEHASH, $count , time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
131 }
132
133 }
134
135 function sanitise_array($arrayin) {
136
137 foreach($arrayin as $key => $value) {
138 $arrayin[$key] = htmlentities(stripslashes($value) ,ENT_QUOTES, 'UTF-8');
139 }
140
141 return $arrayin;
142 }
143
144 function page_footer() {
145
146 if(is_multisite() && defined('PO_GLOBAL')) {
147 $getoption = 'get_site_option';
148 } else {
149 $getoption = 'get_option';
150 }
151
152 $content = stripslashes($getoption('popover_content', ''));
153
154 $popover_size = $getoption('popover_size', array('width' => '500px', 'height' => '200px'));
155 $popover_location = $getoption('popover_location', array('left' => '100px', 'top' => '100px'));
156 $popover_colour = $getoption('popover_colour', array('back' => 'FFFFFF', 'fore' => '000000'));
157 $popover_margin = $getoption('popover_margin', array('left' => '0px', 'top' => '0px', 'right' => '0px', 'bottom' => '0px'));
158
159 $popover_size = $this->sanitise_array($popover_size);
160 $popover_location = $this->sanitise_array($popover_location);
161 $popover_colour = $this->sanitise_array($popover_colour);
162 $popover_margin = $this->sanitise_array($popover_margin);
163
164 if($getoption('popover_usejs', 'no') == 'yes') {
165 $style = '';
166 $box = 'color: #' . $popover_colour['fore'] . '; background: #' . $popover_colour['back'] . ';';
167
168 } else {
169 $style = 'left: ' . $popover_location['left'] . '; top: ' . $popover_location['top'] . ';';
170 $style .= 'margin-top: ' . $popover_margin['top'] . '; margin-bottom: ' . $popover_margin['bottom'] . '; margin-right: ' . $popover_margin['right'] . '; margin-left: ' . $popover_margin['left'] . ';';
171
172 $box = 'width: ' . $popover_size['width'] . '; height: ' . $popover_size['height'] . '; color: #' . $popover_colour['fore'] . '; background: #' . $popover_colour['back'] . ';';
173
174 }
175
176
177 ?>
178 <div id='messagebox' class='visiblebox' style='<?php echo $style; ?>'>
179 <a href='' id='closebox' title='Close this box'></a>
180 <div id='message' style='<?php echo $box; ?>'>
181 <?php echo $content; ?>
182 <div class='clear'></div>
183 <div class='claimbutton hide'><a href='#' id='clearforever'><?php _e('Never see this message again.','popover'); ?></a></div>
184 </div>
185 <div class='clear'></div>
186 </div>
187 <?php
188 }
189
190 function is_ie()
191 {
192 if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
193 return true;
194 else
195 return false;
196 }
197
198 function is_loggedin() {
199 return is_user_logged_in();
200 }
201
202 function has_commented() {
203 if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
204 return true;
205 } else {
206 return false;
207 }
208 }
209
210
211 function has_reached_limit($count = 3) {
212 if ( isset($_COOKIE['popover_view_'.COOKIEHASH]) && addslashes($_COOKIE['popover_view_'.COOKIEHASH]) >= $count ) {
213 return true;
214 } else {
215 return false;
216 }
217 }
218
219 function clear_forever() {
220 if ( isset($_COOKIE['popover_never_view']) ) {
221 return true;
222 } else {
223 return false;
224 }
225 }
226
227 }
228
229 }
230
231 ?>