Version Description
IMPROVED: system info on the popup admin page ADDED: force table installation in case something gone wrong during plugin activation
Download this release
Release Info
Developer | ITRO |
Plugin | ITRO Popup Plugin |
Version | 5.0.2 |
Comparing to | |
See all releases |
Code changes from version 5.0.1 to 5.0.2
- admin/popup-admin.php +50 -30
- css/itro-style-functions.php +224 -192
- functions/core-function.php +400 -409
- functions/database-function.php +127 -117
- mc-main.php +2 -2
- readme.txt +10 -2
- scripts/itro-admin-scripts.js +65 -50
- scripts/itro-scripts.js +104 -100
- templates/itro-popup-template.php +4 -5
admin/popup-admin.php
CHANGED
@@ -10,6 +10,15 @@ global $ITRO_VER;
|
|
10 |
if ( !current_user_can( 'manage_options' ) ) {
|
11 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
12 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/* variables for the field and option names */
|
14 |
if( !isset($submitted_form ))
|
15 |
{
|
@@ -63,15 +72,15 @@ for($i=0;$i<count($opt_name); $i++)
|
|
63 |
/* See if the user has posted us some information */
|
64 |
/* If they did, this hidden field will be set to 'Y' */
|
65 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
|
66 |
-
{
|
67 |
// wp token check
|
68 |
check_admin_referer('ipp_save_data','ipp_sec_nonce_fld');
|
69 |
|
70 |
/* Read their posted value */
|
71 |
if(isset($_POST[$opt_name[$i]])){
|
72 |
$opt_val[$i] = ipp_validate_data($opt_name[$i], $_POST[$opt_name[$i]]);
|
73 |
-
}else{
|
74 |
-
$opt_val[$i] = NULL;
|
75 |
}
|
76 |
|
77 |
/* Save the posted value in the database */
|
@@ -88,9 +97,9 @@ for($i=0;$i<count($opt_name); $i++)
|
|
88 |
}
|
89 |
else{ itro_update_option( 'select_' . $opt_name[$i], NULL ); }
|
90 |
}else{
|
91 |
-
/* Read in existing option value from database */
|
92 |
-
$opt_val[$i] = itro_get_option( $opt_name[$i] );
|
93 |
-
$px_opt_val[$i] = itro_get_option( 'px_' . $opt_name[$i] );
|
94 |
$perc_opt_val[$i] = itro_get_option( 'perc_' . $opt_name[$i] );
|
95 |
}
|
96 |
}
|
@@ -98,17 +107,17 @@ for($i=0;$i<count($opt_name); $i++)
|
|
98 |
/* unsorted option and field */
|
99 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
|
100 |
{
|
101 |
-
//wp token check
|
102 |
check_admin_referer('ipp_save_data','ipp_sec_nonce_fld');
|
103 |
|
104 |
//WP Editor content
|
105 |
-
if(isset($_POST['custom_html'])){
|
106 |
-
$field_value = ipp_validate_data('custom_html', $_POST['custom_html']);
|
107 |
-
}else{
|
108 |
-
$field_value = NULL;
|
109 |
-
}
|
110 |
-
|
111 |
-
/* Save the posted value in the database */
|
112 |
itro_update_field( 'custom_html', $field_value );
|
113 |
|
114 |
|
@@ -126,7 +135,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
|
|
126 |
itro_update_option('background_source',$_POST['background_source']);
|
127 |
}
|
128 |
}else{
|
129 |
-
//WP Editor Content
|
130 |
$field_value = stripslashes(itro_get_field( 'custom_html' ));
|
131 |
}
|
132 |
|
@@ -383,7 +392,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
|
|
383 |
<option value="white_border" <?php if(itro_get_option($opt_name[33])=='white_border') {echo 'selected="select"';} ?> ><?php _e("White with border", 'itro-plugin' ); ?></option>
|
384 |
<option value="url" <?php if(itro_get_option($opt_name[33])=='url') {echo 'selected="select"';} ?> ><?php _e("Custom URL", 'itro-plugin' ); ?></option>
|
385 |
</select>
|
386 |
-
<!--
|
387 |
<p>
|
388 |
<?php _e("Image custom URL",'itro-plugin');?>
|
389 |
<a href="<?php if ( $opt_val[37] == NULL ) {echo 'javascript:void(0)';} else { echo $opt_val[37]; }?>"><?php _e('Show image','itro-plugin')?></a>
|
@@ -501,7 +510,17 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
|
|
501 |
</div>
|
502 |
<p class="wpstyle" onClick="jQuery('#debug_info').toggle();"><?php _e("System Status", 'itro-plugin' ); ?> </p>
|
503 |
<div method="POST" action="" id="debug_info" style="display:none;">
|
504 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
</div>
|
506 |
</div>
|
507 |
|
@@ -517,18 +536,19 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
|
|
517 |
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
|
518 |
</form>
|
519 |
|
|
|
520 |
<?php
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
?>
|
10 |
if ( !current_user_can( 'manage_options' ) ) {
|
11 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
12 |
}
|
13 |
+
|
14 |
+
/* force table installation */
|
15 |
+
if( isset($_POST['force_tables_installation']) )
|
16 |
+
{
|
17 |
+
// wp token check
|
18 |
+
check_admin_referer('ipp_save_data','ipp_cleardb_nonce_fld');
|
19 |
+
itro_db_init();
|
20 |
+
}
|
21 |
+
|
22 |
/* variables for the field and option names */
|
23 |
if( !isset($submitted_form ))
|
24 |
{
|
72 |
/* See if the user has posted us some information */
|
73 |
/* If they did, this hidden field will be set to 'Y' */
|
74 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
|
75 |
+
{
|
76 |
// wp token check
|
77 |
check_admin_referer('ipp_save_data','ipp_sec_nonce_fld');
|
78 |
|
79 |
/* Read their posted value */
|
80 |
if(isset($_POST[$opt_name[$i]])){
|
81 |
$opt_val[$i] = ipp_validate_data($opt_name[$i], $_POST[$opt_name[$i]]);
|
82 |
+
}else{
|
83 |
+
$opt_val[$i] = NULL;
|
84 |
}
|
85 |
|
86 |
/* Save the posted value in the database */
|
97 |
}
|
98 |
else{ itro_update_option( 'select_' . $opt_name[$i], NULL ); }
|
99 |
}else{
|
100 |
+
/* Read in existing option value from database */
|
101 |
+
$opt_val[$i] = itro_get_option( $opt_name[$i] );
|
102 |
+
$px_opt_val[$i] = itro_get_option( 'px_' . $opt_name[$i] );
|
103 |
$perc_opt_val[$i] = itro_get_option( 'perc_' . $opt_name[$i] );
|
104 |
}
|
105 |
}
|
107 |
/* unsorted option and field */
|
108 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
|
109 |
{
|
110 |
+
//wp token check
|
111 |
check_admin_referer('ipp_save_data','ipp_sec_nonce_fld');
|
112 |
|
113 |
//WP Editor content
|
114 |
+
if(isset($_POST['custom_html'])){
|
115 |
+
$field_value = ipp_validate_data('custom_html', $_POST['custom_html']);
|
116 |
+
}else{
|
117 |
+
$field_value = NULL;
|
118 |
+
}
|
119 |
+
|
120 |
+
/* Save the posted value in the database */
|
121 |
itro_update_field( 'custom_html', $field_value );
|
122 |
|
123 |
|
135 |
itro_update_option('background_source',$_POST['background_source']);
|
136 |
}
|
137 |
}else{
|
138 |
+
//WP Editor Content
|
139 |
$field_value = stripslashes(itro_get_field( 'custom_html' ));
|
140 |
}
|
141 |
|
392 |
<option value="white_border" <?php if(itro_get_option($opt_name[33])=='white_border') {echo 'selected="select"';} ?> ><?php _e("White with border", 'itro-plugin' ); ?></option>
|
393 |
<option value="url" <?php if(itro_get_option($opt_name[33])=='url') {echo 'selected="select"';} ?> ><?php _e("Custom URL", 'itro-plugin' ); ?></option>
|
394 |
</select>
|
395 |
+
<!-- custom cross image url !-->
|
396 |
<p>
|
397 |
<?php _e("Image custom URL",'itro-plugin');?>
|
398 |
<a href="<?php if ( $opt_val[37] == NULL ) {echo 'javascript:void(0)';} else { echo $opt_val[37]; }?>"><?php _e('Show image','itro-plugin')?></a>
|
510 |
</div>
|
511 |
<p class="wpstyle" onClick="jQuery('#debug_info').toggle();"><?php _e("System Status", 'itro-plugin' ); ?> </p>
|
512 |
<div method="POST" action="" id="debug_info" style="display:none;">
|
513 |
+
<?php echo itro_get_serverinfo(); ?>
|
514 |
+
<form method="post" style="clear:both;">
|
515 |
+
<?php wp_nonce_field('ipp_save_data', 'ipp_cleardb_nonce_fld'); ?>
|
516 |
+
<br>
|
517 |
+
<hr>
|
518 |
+
<input type="hidden" name="force_tables_installation" value="Y">
|
519 |
+
<span><?php _e("FORCE TABLE INSTALLATION", 'itro-plugin' ); ?></span>
|
520 |
+
<img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>"title="<?php _e('If in the System Status you see "Plugin DB Status - Installed tables: no tables" click this button to force the installation of our plugin tables','itro-plugin');?>" >
|
521 |
+
|
522 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('FORCE') ?>" />
|
523 |
+
</form>
|
524 |
</div>
|
525 |
</div>
|
526 |
|
536 |
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
|
537 |
</form>
|
538 |
|
539 |
+
|
540 |
<?php
|
541 |
+
$itro_hide_args = array(
|
542 |
+
$opt_name[24] . '_div',
|
543 |
+
$opt_name[29] . '_div',
|
544 |
+
$opt_name[17] . '_div',
|
545 |
+
$opt_name[20] . '_div',
|
546 |
+
$opt_name[27] . '_div',
|
547 |
+
$opt_name[30] . '_div',
|
548 |
+
$opt_name[31] . '_div',
|
549 |
+
$opt_name[23] . '_div',
|
550 |
+
$opt_name[6] . '_advanced_1',
|
551 |
+
$opt_name[6] . '_advanced_2',
|
552 |
+
);
|
553 |
+
echo itro_show_hide( $itro_hide_args, $opt_name[28], 'table', true, array('yellow',10000));
|
554 |
?>
|
css/itro-style-functions.php
CHANGED
@@ -1,209 +1,241 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
4 |
-
*/
|
5 |
|
6 |
-
if (
|
|
|
7 |
|
8 |
function itro_style() {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
#ageEnterButton
|
33 |
-
{
|
34 |
-
border-color:<?php echo itro_get_option('enter_button_border_color')?>;
|
35 |
-
background:<?php echo itro_get_option('enter_button_bg_color')?>;
|
36 |
-
color: <?php echo itro_get_option('enter_button_font_color');?>;
|
37 |
-
}
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
#popup_content
|
47 |
-
{
|
48 |
-
<?php
|
49 |
-
if( itro_get_option('select_popup_height') == 'px' || itro_get_option('select_popup_height') == '%' )
|
50 |
-
{echo 'overflow-y:auto;' ;}
|
51 |
-
else { echo 'overflow-y:hidden;' ;}
|
52 |
-
?>
|
53 |
-
overflow-x: auto;
|
54 |
-
height: 100%;
|
55 |
-
width:100%;
|
56 |
-
}
|
57 |
-
|
58 |
-
#itro_popup
|
59 |
-
{
|
60 |
-
visibility: hidden;
|
61 |
-
opacity: 0;
|
62 |
-
position: <?php echo itro_get_option('popup_position');?>;
|
63 |
-
background-image: <?php if( itro_get_option('background_select') != NULL ) { echo 'url("' . itro_get_option('background_source') . '");'; } ?>
|
64 |
-
background-repeat: no-repeat;
|
65 |
-
background-position: center center;
|
66 |
-
margin: 0 auto;
|
67 |
-
left:1px;
|
68 |
-
right:1px;
|
69 |
-
z-index: 2147483647 !important;
|
70 |
-
<?php if( itro_get_option('popup_padding') != NULL ) { echo 'padding:' . itro_get_option('popup_padding') . 'px !important;'; }?>
|
71 |
-
<?php
|
72 |
-
if( itro_get_option('auto_margin_check') == NULL )
|
73 |
-
{
|
74 |
-
if (itro_get_option('popup_top_margin') != NULL )
|
75 |
-
{ echo 'top:' . itro_get_option('popup_top_margin') . 'px;' ; }
|
76 |
-
else
|
77 |
-
{echo 'top: 0px;' ;}
|
78 |
-
}
|
79 |
-
if (itro_get_option('popup_border_color') != NULL )
|
80 |
-
{
|
81 |
-
echo 'border: solid;';
|
82 |
-
echo 'border-color:' . itro_get_option('popup_border_color') . ';';
|
83 |
-
}
|
84 |
-
?>
|
85 |
-
border-radius: <?php echo itro_get_option('popup_border_radius'); ?>px;
|
86 |
-
border-width: <?php echo itro_get_option('popup_border_width'); ?>px;
|
87 |
-
width: <?php
|
88 |
-
if( itro_get_option('select_popup_width') == 'px') { echo itro_get_option('px_popup_width') . 'px'; }
|
89 |
-
if( itro_get_option('select_popup_width') == 'perc') { echo itro_get_option('perc_popup_width') . '%'; }
|
90 |
-
?>;
|
91 |
-
height: <?php
|
92 |
-
switch (itro_get_option('select_popup_height')){
|
93 |
-
case 'px':
|
94 |
-
echo itro_get_option('px_popup_height') . 'px';
|
95 |
-
break;
|
96 |
-
case 'perc':
|
97 |
-
echo itro_get_option('perc_popup_height') . '%';
|
98 |
-
break;
|
99 |
-
case 'auto':
|
100 |
-
echo 'auto';
|
101 |
-
break;
|
102 |
-
default:
|
103 |
-
echo 'auto';
|
104 |
-
}?>;
|
105 |
-
background-color: <?php echo itro_get_option('popup_background'); ?>;
|
106 |
-
<?php if( itro_get_option('show_countdown') != NULL ) { echo 'padding-bottom: 15px;'; } ?>
|
107 |
-
}
|
108 |
-
|
109 |
-
#close_cross
|
110 |
-
{
|
111 |
-
cursor:pointer;
|
112 |
-
width:20px;
|
113 |
-
position:absolute;
|
114 |
-
top:-22px;
|
115 |
-
right:-22px;
|
116 |
-
}
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
background-color: <?php echo itro_get_option('popup_border_color');?>;
|
125 |
-
height: <?php if( itro_get_option('show_countdown') != 'yes' ) { echo '0px'; }?> ;
|
126 |
-
overflow: hidden;
|
127 |
-
position:absolute;
|
128 |
-
bottom:0px;
|
129 |
-
left:0px;
|
130 |
-
border-bottom-left:<?php echo itro_get_option('popup_border_radius'); ?>px;
|
131 |
-
border-bottom-right:<?php echo itro_get_option('popup_border_radius'); ?>px;
|
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 |
-
<?php
|
176 |
-
|
177 |
-
if(itro_get_option('absolute_mobile_pos') == 'yes'){
|
178 |
-
echo "position: absolute; top: 50px";
|
179 |
-
}
|
180 |
-
?>
|
181 |
-
}
|
182 |
-
#close_cross{
|
183 |
-
display: none;
|
184 |
-
}
|
185 |
-
#ipp_mobile_close_tab{
|
186 |
-
display: block;
|
187 |
-
}
|
188 |
-
}
|
189 |
-
@media screen and (max-width: 480px){
|
190 |
-
#itro_popup{
|
191 |
-
max-width: 300px
|
192 |
-
}
|
193 |
}
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
<?php
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
@media screen and (max-width: 1024px)
|
200 |
{
|
201 |
#itro_popup{display: none !important;}
|
202 |
#itro_opaco{display: none !important;}
|
203 |
}';
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
<?php
|
208 |
}
|
209 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
+
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
4 |
+
*/
|
5 |
|
6 |
+
if (!defined('ABSPATH'))
|
7 |
+
exit; // Exit if accessed directly
|
8 |
|
9 |
function itro_style() {
|
10 |
+
// check if user inputs no-sense values
|
11 |
+
if ((itro_get_option('select_popup_height') == 'px' && itro_get_option('px_popup_height') == 0) || (itro_get_option('select_popup_height') == 'perc' && itro_get_option('perc_popup_height') == 0)) {
|
12 |
+
itro_update_option('select_popup_height', 'auto');
|
13 |
+
}
|
14 |
+
if (itro_get_option('select_popup_width') == 'px' && itro_get_option('px_popup_width') == 0) {
|
15 |
+
itro_update_option('px_popup_width', '600');
|
16 |
+
}
|
17 |
+
if (itro_get_option('select_popup_width') == 'perc' && itro_get_option('perc_popup_width') == 0) {
|
18 |
+
itro_update_option('perc_popup_width', '60');
|
19 |
+
}
|
20 |
+
?>
|
21 |
+
<style>
|
22 |
+
/* POP-UP */
|
23 |
+
#age_button_area
|
24 |
+
{
|
25 |
+
padding-top:10px;
|
26 |
+
position: relative;
|
27 |
+
width: 100%;
|
28 |
+
bottom: 5px;
|
29 |
+
padding-top:5px;
|
30 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
#ageEnterButton
|
33 |
+
{
|
34 |
+
border-color:<?php echo itro_get_option('enter_button_border_color') ?>;
|
35 |
+
background:<?php echo itro_get_option('enter_button_bg_color') ?>;
|
36 |
+
color: <?php echo itro_get_option('enter_button_font_color'); ?>;
|
37 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
#ageLeaveButton
|
40 |
+
{
|
41 |
+
border-color:<?php echo itro_get_option('leave_button_border_color') ?>;
|
42 |
+
background:<?php echo itro_get_option('leave_button_bg_color') ?>;
|
43 |
+
color: <?php echo itro_get_option('leave_button_font_color'); ?>;
|
44 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
#popup_content
|
47 |
+
{
|
48 |
+
<?php
|
49 |
+
if (itro_get_option('select_popup_height') == 'px' || itro_get_option('select_popup_height') == '%') {
|
50 |
+
echo 'overflow-y:auto;';
|
51 |
+
} else {
|
52 |
+
echo 'overflow-y:hidden;';
|
53 |
+
}
|
54 |
+
?>
|
55 |
+
overflow-x: auto;
|
56 |
+
height: 100%;
|
57 |
+
width:100%;
|
58 |
+
}
|
59 |
+
|
60 |
+
#itro_popup
|
61 |
+
{
|
62 |
+
visibility: hidden;
|
63 |
+
opacity: 0;
|
64 |
+
position: <?php echo itro_get_option('popup_position'); ?>;
|
65 |
+
background-image: <?php
|
66 |
+
if (itro_get_option('background_select') != NULL) {
|
67 |
+
echo 'url("' . itro_get_option('background_source') . '")';
|
68 |
+
}
|
69 |
+
?>;
|
70 |
+
background-repeat: no-repeat;
|
71 |
+
background-position: center center;
|
72 |
+
margin: 0 auto;
|
73 |
+
left:1px;
|
74 |
+
right:1px;
|
75 |
+
z-index: 2147483647 !important;
|
76 |
+
<?php
|
77 |
+
if (itro_get_option('popup_padding') != NULL) {
|
78 |
+
echo 'padding:' . itro_get_option('popup_padding') . 'px !important;';
|
79 |
+
}
|
80 |
+
?>
|
81 |
+
<?php
|
82 |
+
if (itro_get_option('auto_margin_check') == NULL) {
|
83 |
+
if (itro_get_option('popup_top_margin') != NULL) {
|
84 |
+
echo 'top:' . itro_get_option('popup_top_margin') . 'px;';
|
85 |
+
} else {
|
86 |
+
echo 'top: 0px;';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
+
}
|
89 |
+
if (itro_get_option('popup_border_color') != NULL) {
|
90 |
+
echo 'border: solid;';
|
91 |
+
echo 'border-color:' . itro_get_option('popup_border_color') . ';';
|
92 |
+
}
|
93 |
+
?>
|
94 |
+
border-radius: <?php echo itro_get_option('popup_border_radius'); ?>px;
|
95 |
+
border-width: <?php echo itro_get_option('popup_border_width'); ?>px;
|
96 |
+
width: <?php
|
97 |
+
if (itro_get_option('select_popup_width') == 'px') {
|
98 |
+
echo itro_get_option('px_popup_width') . 'px';
|
99 |
+
}
|
100 |
+
if (itro_get_option('select_popup_width') == 'perc') {
|
101 |
+
echo itro_get_option('perc_popup_width') . '%';
|
102 |
+
}
|
103 |
+
?>;
|
104 |
+
height: <?php
|
105 |
+
switch (itro_get_option('select_popup_height')) {
|
106 |
+
case 'px':
|
107 |
+
echo itro_get_option('px_popup_height') . 'px';
|
108 |
+
break;
|
109 |
+
case 'perc':
|
110 |
+
echo itro_get_option('perc_popup_height') . '%';
|
111 |
+
break;
|
112 |
+
case 'auto':
|
113 |
+
echo 'auto';
|
114 |
+
break;
|
115 |
+
default:
|
116 |
+
echo 'auto';
|
117 |
+
}
|
118 |
+
?>;
|
119 |
+
background-color: <?php echo itro_get_option('popup_background'); ?>;
|
120 |
+
<?php
|
121 |
+
if (itro_get_option('show_countdown') != NULL) {
|
122 |
+
echo 'padding-bottom: 15px;';
|
123 |
+
}
|
124 |
+
?>
|
125 |
+
}
|
126 |
+
|
127 |
+
#close_cross
|
128 |
+
{
|
129 |
+
cursor:pointer;
|
130 |
+
width:20px;
|
131 |
+
position:absolute;
|
132 |
+
top:-22px;
|
133 |
+
right:-22px;
|
134 |
+
}
|
135 |
+
|
136 |
+
#popup_countdown
|
137 |
+
{
|
138 |
+
color: <?php echo itro_get_option('count_font_color') ?>;
|
139 |
+
width: 100%;
|
140 |
+
padding-top: <?php
|
141 |
+
if (itro_get_option('show_countdown') != 'yes') {
|
142 |
+
echo '0px';
|
143 |
+
} else {
|
144 |
+
echo '1px';
|
145 |
+
}
|
146 |
+
?> ;
|
147 |
+
padding-bottom:<?php
|
148 |
+
if (itro_get_option('show_countdown') != 'yes') {
|
149 |
+
echo '0px';
|
150 |
+
} else {
|
151 |
+
echo '1px';
|
152 |
+
}
|
153 |
+
?> ;
|
154 |
+
background-color: <?php echo itro_get_option('popup_border_color'); ?>;
|
155 |
+
height: <?php
|
156 |
+
if (itro_get_option('show_countdown') != 'yes') {
|
157 |
+
echo '0px';
|
158 |
+
}
|
159 |
+
?> ;
|
160 |
+
overflow: hidden;
|
161 |
+
position:absolute;
|
162 |
+
bottom:0px;
|
163 |
+
left:0px;
|
164 |
+
border-bottom-left:<?php echo itro_get_option('popup_border_radius'); ?>px;
|
165 |
+
border-bottom-right:<?php echo itro_get_option('popup_border_radius'); ?>px;
|
166 |
+
}
|
167 |
+
|
168 |
+
#itro_opaco{
|
169 |
+
display: none;
|
170 |
+
position:fixed;
|
171 |
+
background-color: <?php echo itro_get_option('opaco_bg_color'); ?>;
|
172 |
+
font-size: 10px;
|
173 |
+
font-family: Verdana;
|
174 |
+
top: 100px;
|
175 |
+
width: 100%;
|
176 |
+
height: 100%;
|
177 |
+
z-index: 2147483646 !important;
|
178 |
+
left: 0px ;
|
179 |
+
right: 0px;
|
180 |
+
top: 0px;
|
181 |
+
bottom: 0px;
|
182 |
+
opacity: <?php echo itro_get_option('popup_bg_opacity'); ?> ;
|
183 |
+
filter:alpha(opacity = <?php echo ( itro_get_option('popup_bg_opacity') * 100); ?>); /* For IE8 and earlier */
|
184 |
+
}
|
185 |
+
|
186 |
+
/* label under the popup used to close it for mobile devices */
|
187 |
+
#ipp_mobile_close_tab{
|
188 |
+
display: none;
|
189 |
+
border:none;
|
190 |
+
position: absolute;
|
191 |
+
padding: 5px;
|
192 |
+
width: 80px;
|
193 |
+
text-align: center;
|
194 |
+
left: 1px;
|
195 |
+
right: 1px;
|
196 |
+
margin: auto;
|
197 |
+
background-color: <?php echo (itro_get_option('popup_border_color') != NULL ? itro_get_option('popup_border_color') : 'white' ); ?>
|
198 |
+
}
|
199 |
+
#ipp_mobile_close_txt{
|
200 |
+
font-weight: bold;
|
201 |
+
cursor: pointer;
|
202 |
+
}
|
203 |
+
|
204 |
+
/* RESPONSIVE CSS */
|
205 |
+
@media screen and (max-width: 780px)
|
206 |
+
{
|
207 |
+
#itro_popup{
|
208 |
+
max-width: 470px;
|
209 |
<?php
|
210 |
+
if (itro_get_option('absolute_mobile_pos') == 'yes') {
|
211 |
+
echo "position: absolute; top: 50px";
|
212 |
+
}
|
213 |
+
?>
|
214 |
+
}
|
215 |
+
#close_cross{
|
216 |
+
display: none;
|
217 |
+
}
|
218 |
+
#ipp_mobile_close_tab{
|
219 |
+
display: block;
|
220 |
+
}
|
221 |
+
}
|
222 |
+
@media screen and (max-width: 480px){
|
223 |
+
#itro_popup{
|
224 |
+
max-width: 300px
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
<?php
|
229 |
+
if (itro_get_option('disable_mobile') == 'yes') {
|
230 |
+
echo '
|
231 |
@media screen and (max-width: 1024px)
|
232 |
{
|
233 |
#itro_popup{display: none !important;}
|
234 |
#itro_opaco{display: none !important;}
|
235 |
}';
|
236 |
+
}
|
237 |
+
?>
|
238 |
+
</style>
|
239 |
+
<?php
|
240 |
}
|
241 |
?>
|
functions/core-function.php
CHANGED
@@ -1,455 +1,446 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
4 |
-
*/
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
|
8 |
-
/* ------------------ADD MENU PAGE */
|
9 |
function itro_plugin_menu() {
|
10 |
-
|
11 |
}
|
12 |
|
13 |
/* -------------- INITIALIZATION */
|
14 |
|
15 |
-
function itro_init()
|
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 |
-
break;
|
50 |
-
default:
|
51 |
-
$welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Hello, this is a pop-up sample.</span></h1><p style="text-align: center;"><span style="color: #000000; font-size: 20;">The basic stetting to get started are: Popup height, Popup time, Next visualization, Popup border color, Popup background.</span></p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Write watever you want in the Custom text editor and enjoy our plugin!</span></p><p> </p>';
|
52 |
-
}
|
53 |
-
itro_update_field('custom_html',$welcome_text);
|
54 |
-
|
55 |
-
itro_update_option('sample_popup','done');
|
56 |
}
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
/* --------------------------CHECK THE PLUGIN VERSION */
|
60 |
-
|
61 |
-
{
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
ob_end_clean();
|
73 |
}
|
74 |
|
75 |
/* --------------------------DISPLAY THE POPUP */
|
76 |
-
|
77 |
-
{
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
$woo_shop = true;
|
100 |
-
$woo_shop_id = woocommerce_get_page_id( 'shop' );
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
/* this condition, control if the popup must or not by displayed in a specified page */
|
105 |
-
$selected_page_id = json_decode(itro_get_option('selected_page_id'));
|
106 |
-
$id_match = NULL;
|
107 |
-
|
108 |
-
/* get the page id */
|
109 |
-
global $wp_query;
|
110 |
$current_page_id = $wp_query->get_queried_object_id();
|
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 |
-
$popup_fired = true;
|
148 |
-
itro_style();
|
149 |
-
itro_popup_template();
|
150 |
-
itro_popup_js();
|
151 |
-
}
|
152 |
-
break;
|
153 |
-
|
154 |
-
}
|
155 |
}
|
156 |
|
157 |
/* ------------------------- SELECT PAGES FUNCTIONS */
|
158 |
-
|
159 |
-
{
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
}
|
169 |
}
|
|
|
170 |
}
|
171 |
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
$option
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
<?php
|
190 |
}
|
191 |
|
192 |
-
/**
|
193 |
-
* Sanitize data of popup options and custom content
|
194 |
-
*
|
195 |
* @since 4.9.3
|
196 |
*
|
197 |
* @param string $data_name : the name of the data to sanitize/validate
|
198 |
* @param string $data : string value to sanitize/validate
|
199 |
*
|
200 |
-
* @return string, int : the clean data
|
201 |
-
*
|
202 |
*/
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
return $data;
|
296 |
}
|
297 |
|
298 |
-
/**
|
299 |
-
* Shortcode for popup appearing
|
300 |
-
*
|
301 |
-
* @since 4.9
|
302 |
-
*
|
303 |
*/
|
|
|
|
|
|
|
|
|
|
|
304 |
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
itro_style();
|
312 |
-
itro_popup_template();
|
313 |
-
itro_popup_js();
|
314 |
-
|
315 |
-
return ob_get_clean();
|
316 |
}
|
|
|
317 |
add_shortcode('itroshowpopup', 'itro_popup_shortcode');
|
318 |
|
319 |
/* ------------------------- DEBUG INFORMATION ON ADMIN PANNEL */
|
320 |
-
function itro_get_serverinfo()
|
321 |
-
{
|
322 |
-
global $wpdb;
|
323 |
-
global $wp_version;
|
324 |
-
|
325 |
-
$sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
|
326 |
-
$mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
|
327 |
-
if (is_array($mysqlinfo)) $sql_mode = $mysqlinfo[0]->Value;
|
328 |
-
if (empty($sql_mode)) $sql_mode = __('Not set', 'itro-plugin' );
|
329 |
-
if(ini_get('safe_mode')) $safe_mode = __('On', 'itro-plugin' );
|
330 |
-
else $safe_mode = __('Off', 'itro-plugin' );
|
331 |
-
if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'itro-plugin' );
|
332 |
-
else $allow_url_fopen = __('Off', 'itro-plugin' );
|
333 |
-
if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize');
|
334 |
-
else $upload_max = __('N/A', 'itro-plugin' );
|
335 |
-
if(ini_get('post_max_size')) $post_max = ini_get('post_max_size');
|
336 |
-
else $post_max = __('N/A', 'itro-plugin' );
|
337 |
-
if(ini_get('max_execution_time')) $max_execute = ini_get('max_execution_time');
|
338 |
-
else $max_execute = __('N/A', 'itro-plugin' );
|
339 |
-
if(ini_get('memory_limit')) $memory_limit = ini_get('memory_limit');
|
340 |
-
else $memory_limit = __('N/A', 'itro-plugin' );
|
341 |
-
if (function_exists('memory_get_usage')) $memory_usage = round(memory_get_usage() / 1024 / 1024, 2) . __(' MByte', 'itro-plugin' );
|
342 |
-
else $memory_usage = __('N/A', 'itro-plugin' );
|
343 |
-
if (is_callable('exif_read_data')) $exif = __('Yes', 'itro-plugin' ). " ( V" . substr(phpversion('exif'),0,4) . ")" ;
|
344 |
-
else $exif = __('No', 'itro-plugin' );
|
345 |
-
if (is_callable('iptcparse')) $iptc = __('Yes', 'itro-plugin' );
|
346 |
-
else $iptc = __('No', 'itro-plugin' );
|
347 |
-
if (is_callable('xml_parser_create')) $xml = __('Yes', 'itro-plugin' );
|
348 |
-
else $xml = __('No', 'itro-plugin' );
|
349 |
-
|
350 |
-
if ( function_exists( 'wp_get_theme' ) )
|
351 |
-
{
|
352 |
-
$theme = wp_get_theme();
|
353 |
-
} else {
|
354 |
-
$theme = get_theme( get_current_theme() );
|
355 |
-
}
|
356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
358 |
-
if ( function_exists( 'is_multisite' ) )
|
359 |
-
{
|
360 |
-
if ( is_multisite() )
|
361 |
-
{
|
362 |
-
$ms = __('Yes', 'itro-plugin' );
|
363 |
-
}
|
364 |
-
else
|
365 |
-
{
|
366 |
-
$ms = __('No', 'itro-plugin' );
|
367 |
-
}
|
368 |
|
|
|
|
|
|
|
|
|
|
|
369 |
}
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
)
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
}
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
}
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
if ($_REQUEST['itro_debug_send_email'])
|
436 |
-
{
|
437 |
-
if (wp_mail($_REQUEST['itro_debug_send_email'], sprintf( __( "ITRO Debug Mail From Site %s.", 'itro-plugin'), $siteurl), $mail_text ) )
|
438 |
-
{
|
439 |
-
echo "<div class='itro_debug_mail_sent'>" . sprintf( __( "Sent to %s.", 'itro-plugin' ), $_REQUEST['itro_debug_send_email'] ) . "</div>";
|
440 |
-
}
|
441 |
-
else
|
442 |
-
{
|
443 |
-
echo "<div class='itro_debug_error'>" . sprintf( __( "Failed to send to %s.", 'itro-plugin' ), $_REQUEST['itro_debug_send_email'] ) . "</div>";
|
444 |
-
}
|
445 |
-
}
|
446 |
-
else
|
447 |
-
{
|
448 |
-
echo "<div class='itro_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'itro-plugin' ) . "</div>";
|
449 |
-
}
|
450 |
-
} while(0); // control structure for use with break
|
451 |
-
$nonce = wp_create_nonce('itro-debug-nonce');
|
452 |
-
$buf = '<textarea style="width:100%; height:400px; resize:none;" onclick="select();">' . $mail_text . '</textarea>';
|
453 |
-
return $buf;
|
454 |
-
}
|
455 |
-
?>
|
1 |
<?php
|
2 |
/*
|
3 |
+
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
4 |
+
*/
|
5 |
+
|
6 |
+
if (!defined('ABSPATH'))
|
7 |
+
exit; // Exit if accessed directly
|
8 |
|
9 |
+
/* ------------------ADD MENU PAGE */
|
10 |
|
|
|
11 |
function itro_plugin_menu() {
|
12 |
+
add_options_page('Popup Plugin Options', 'ITRO Popup', 'manage_options', itroRootPath . 'admin/popup-admin.php', '');
|
13 |
}
|
14 |
|
15 |
/* -------------- INITIALIZATION */
|
16 |
|
17 |
+
function itro_init() {
|
18 |
+
/* -----load sample popup settings */
|
19 |
+
if (get_option("itro_curr_ver") == NULL) {
|
20 |
+
/* --------- initialize database */
|
21 |
+
itro_db_init();
|
22 |
+
|
23 |
+
itro_update_option('popup_time', 20);
|
24 |
+
itro_update_option('popup_delay', 0);
|
25 |
+
itro_update_option('cookie_time_exp', 0);
|
26 |
+
itro_update_option('popup_background', '#FFFFFF');
|
27 |
+
itro_update_option('popup_border_color', '#F7FF00');
|
28 |
+
itro_update_option('px_popup_width', 600);
|
29 |
+
itro_update_option('px_popup_height', 0);
|
30 |
+
itro_update_option('show_countdown', 'yes');
|
31 |
+
itro_update_option('auto_margin_check', 'yes');
|
32 |
+
itro_update_option('select_popup_width', 'px');
|
33 |
+
itro_update_option('select_popup_height', 'auto');
|
34 |
+
itro_update_option('popup_bg_opacity', 0.40);
|
35 |
+
itro_update_option('opaco_bg_color', '#8A8A8A');
|
36 |
+
itro_update_option('popup_position', 'fixed');
|
37 |
+
itro_update_option('popup_border_width', 3);
|
38 |
+
itro_update_option('popup_border_radius', 8);
|
39 |
+
itro_update_option('popup_padding', 2);
|
40 |
+
itro_update_option('page_selection', 'none');
|
41 |
+
|
42 |
+
switch (get_locale()) {
|
43 |
+
case 'en_US':
|
44 |
+
$welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Hello, this is a pop-up sample.</span></h1><p style="text-align: center;"><span style="color: #000000; font-size: 20;">The basic stetting to get started are: Popup height, Popup time, Next visualization, Popup border color, Popup background.</span></p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Write watever you want in the Custom text editor and enjoy our plugin!</span></p><p> </p>';
|
45 |
+
break;
|
46 |
+
case 'it_IT':
|
47 |
+
$welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Questo è un esempio di popup.</span></h1><p style="text-align: center;"> </p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Le impostazioni base per iniziare sono: Altezza popup, Tempo popup, Prossima visualizzazione, Colore bordo, Colore sfondo.</span></p><p style="text-align: center;"> </p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Scrivi qualunque cosa vuoi nell'editor di testo di wordpress e buon lavoro!</span></p><p style="text-align: center;"> </p>';
|
48 |
+
break;
|
49 |
+
default:
|
50 |
+
$welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Hello, this is a pop-up sample.</span></h1><p style="text-align: center;"><span style="color: #000000; font-size: 20;">The basic stetting to get started are: Popup height, Popup time, Next visualization, Popup border color, Popup background.</span></p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Write watever you want in the Custom text editor and enjoy our plugin!</span></p><p> </p>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
+
itro_update_field('custom_html', $welcome_text);
|
53 |
+
|
54 |
+
itro_update_option('sample_popup', 'done');
|
55 |
+
}
|
56 |
}
|
57 |
|
58 |
/* --------------------------CHECK THE PLUGIN VERSION */
|
59 |
+
|
60 |
+
function itro_check_ver() {
|
61 |
+
ob_start();
|
62 |
+
if ($GLOBALS['ITRO_VER'] != get_option('itro_curr_ver')) {
|
63 |
+
/* check and update the db */
|
64 |
+
itro_update_db();
|
65 |
+
|
66 |
+
$ver = get_option('itro_curr_ver');
|
67 |
+
update_option('itro_prev_ver', $ver);
|
68 |
+
update_option('itro_curr_ver', $GLOBALS['ITRO_VER']);
|
69 |
+
}
|
70 |
+
ob_end_clean();
|
|
|
71 |
}
|
72 |
|
73 |
/* --------------------------DISPLAY THE POPUP */
|
74 |
+
|
75 |
+
function itro_display_popup() {
|
76 |
+
global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
|
77 |
+
//if a shortcode was fired it stop everything
|
78 |
+
if ($popup_fired === true) {
|
79 |
+
return;
|
80 |
+
}
|
81 |
+
|
82 |
+
/* check if it is the preview visualization */
|
83 |
+
if (!empty($_GET['itro_preview']) && $_GET['itro_preview'] == 'yes' && is_user_logged_in()) {
|
84 |
+
$is_preview = true;
|
85 |
+
} else {
|
86 |
+
$is_preview = false;
|
87 |
+
}
|
88 |
+
|
89 |
+
/* woocommerce shop page identification */
|
90 |
+
$woo_shop = NULL;
|
91 |
+
$woo_shop_id = NULL;
|
92 |
+
if (function_exists('is_shop') && function_exists('woocommerce_get_page_id')) /* if this functions exist, woocommerce is installed! */ {
|
93 |
+
if (is_shop()) /* if the actual page is the standard woocommerce shop page */ {
|
94 |
+
$woo_shop = true;
|
95 |
+
$woo_shop_id = woocommerce_get_page_id('shop');
|
96 |
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/* this condition, control if the popup must or not by displayed in a specified page */
|
100 |
+
$selected_page_id = json_decode(itro_get_option('selected_page_id'));
|
101 |
+
$id_match = NULL;
|
102 |
+
|
103 |
+
/* get the page id */
|
104 |
+
global $wp_query;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
$current_page_id = $wp_query->get_queried_object_id();
|
106 |
+
|
107 |
+
|
108 |
+
switch (itro_get_option('page_selection')) {
|
109 |
+
case 'some':
|
110 |
+
if (isset($selected_page_id)) {
|
111 |
+
foreach ($selected_page_id as $single_id) {
|
112 |
+
if ($single_id == $current_page_id || ( $single_id == $woo_shop_id && $woo_shop )) /* if the selected id is the current page id popup will be displayed OR if the woo_shop_id has been selected and you are in the woocommerce standard shop page ($woo_shop == true), popup will be displayed. */ {
|
113 |
+
$id_match++;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
if ((is_front_page() && itro_get_option('blog_home') == 'yes') || (is_home() && itro_get_option('blog_home') == 'yes')) {
|
118 |
+
$id_match++;
|
119 |
+
}
|
120 |
+
if ($id_match != NULL || $is_preview) {
|
121 |
+
$popup_fired = true;
|
122 |
+
itro_style();
|
123 |
+
itro_popup_template();
|
124 |
+
itro_popup_js();
|
125 |
+
}
|
126 |
+
break;
|
127 |
+
case 'all':
|
128 |
+
$popup_fired = true;
|
129 |
+
itro_style();
|
130 |
+
itro_popup_template();
|
131 |
+
itro_popup_js();
|
132 |
+
break;
|
133 |
+
case 'none':
|
134 |
+
if ($is_preview) {
|
135 |
+
$popup_fired = true;
|
136 |
+
itro_style();
|
137 |
+
itro_popup_template();
|
138 |
+
itro_popup_js();
|
139 |
+
}
|
140 |
+
break;
|
141 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
/* ------------------------- SELECT PAGES FUNCTIONS */
|
145 |
+
|
146 |
+
function itro_check_selected_id($id_to_check) {
|
147 |
+
if (itro_get_option('selected_page_id') != NULL) {
|
148 |
+
$selected_page_id = json_decode(itro_get_option('selected_page_id'));
|
149 |
+
$id_match = NULL;
|
150 |
+
if (isset($selected_page_id)) {
|
151 |
+
foreach ($selected_page_id as $single_id) {
|
152 |
+
if ($single_id == $id_to_check)
|
153 |
+
return (true);
|
154 |
+
}
|
|
|
155 |
}
|
156 |
+
}
|
157 |
}
|
158 |
|
159 |
+
function itro_list_pages() {
|
160 |
+
?>
|
161 |
+
<select name="selected_page_id[]" multiple>
|
162 |
+
<?php
|
163 |
+
$pages = get_pages();
|
164 |
+
foreach ($pages as $page) {
|
165 |
+
$option = '<option value="' . $page->ID . '"';
|
166 |
+
if (itro_check_selected_id($page->ID)) {
|
167 |
+
$option .= 'selected="select"';
|
168 |
+
}
|
169 |
+
$option .= 'onmouseover="itro_check_state(this)" onmouseup="itro_select(this);">';
|
170 |
+
$option .= $page->post_title;
|
171 |
+
$option .= '</option>';
|
172 |
+
echo $option;
|
173 |
+
}
|
174 |
+
?>
|
175 |
+
</select>
|
176 |
+
<?php
|
177 |
}
|
178 |
|
179 |
+
/**
|
180 |
+
* Sanitize data of popup options and custom content
|
181 |
+
*
|
182 |
* @since 4.9.3
|
183 |
*
|
184 |
* @param string $data_name : the name of the data to sanitize/validate
|
185 |
* @param string $data : string value to sanitize/validate
|
186 |
*
|
187 |
+
* @return string, int : the clean data
|
188 |
+
*
|
189 |
*/
|
190 |
+
function ipp_validate_data($data_name, $data) {
|
191 |
+
switch ($data_name) {
|
192 |
+
case 'popup_time':
|
193 |
+
case 'popup_delay':
|
194 |
+
case 'popup_padding':
|
195 |
+
case 'popup_border_width':
|
196 |
+
case 'popup_border_radius':
|
197 |
+
case 'popup_top_margin':
|
198 |
+
case 'cookie_time_exp':
|
199 |
+
case 'px_popup_width':
|
200 |
+
case 'px_popup_height':
|
201 |
+
case 'perc_popup_width':
|
202 |
+
case 'perc_popup_height':
|
203 |
+
$data = intval($data);
|
204 |
+
break;
|
205 |
+
case 'enter_button_url':
|
206 |
+
case 'leave_button_url':
|
207 |
+
case 'background_source':
|
208 |
+
case 'close_cross_url':
|
209 |
+
$data = esc_url_raw($data);
|
210 |
+
break;
|
211 |
+
case 'auto_margin_check':
|
212 |
+
case 'advanced_settings':
|
213 |
+
case 'show_countdown':
|
214 |
+
case 'popup_unlockable':
|
215 |
+
case 'disable_mobile':
|
216 |
+
case 'absolute_mobile_pos':
|
217 |
+
case 'blog_home':
|
218 |
+
case 'age_restriction':
|
219 |
+
case 'background_select':
|
220 |
+
case 'delete_data':
|
221 |
+
$data = ($data != 'yes' ? NULL : $data );
|
222 |
+
break;
|
223 |
+
case 'page_selection':
|
224 |
+
if (!in_array($data, array('some', 'all', 'none'))) {
|
225 |
+
$data = 'none';
|
226 |
+
}
|
227 |
+
break;
|
228 |
+
case 'countdown_text':
|
229 |
+
case 'enter_button_text':
|
230 |
+
case 'leave_button_text':
|
231 |
+
$data = sanitize_text_field($data);
|
232 |
+
break;
|
233 |
+
case 'custom_html':
|
234 |
+
$data = balanceTags($data);
|
235 |
+
break;
|
236 |
+
case 'enter_button_bg_color':
|
237 |
+
case 'enter_button_border_color':
|
238 |
+
case 'leave_button_bg_color':
|
239 |
+
case 'leave_button_border_color':
|
240 |
+
case 'enter_button_font_color':
|
241 |
+
case 'leave_button_font_color':
|
242 |
+
case 'popup_border_color':
|
243 |
+
case 'opaco_bg_color':
|
244 |
+
case 'popup_background':
|
245 |
+
case 'count_font_color':
|
246 |
+
if (preg_match("/^#[0-9a-fA-F]{6}$/", $data) !== 1) {
|
247 |
+
$data = NULL;
|
248 |
+
}
|
249 |
+
break;
|
250 |
+
case 'popup_bg_opacity';
|
251 |
+
if (preg_match("/^[0-1]\.[0-9]{2}$/", $data) !== 1) {
|
252 |
+
$data = '0.40';
|
253 |
+
}
|
254 |
+
break;
|
255 |
+
case 'cross_selected':
|
256 |
+
if (!in_array($data, array('white', 'black', 'white_border', 'url'))) {
|
257 |
+
$data = 'black';
|
258 |
+
}
|
259 |
+
break;
|
260 |
+
case 'popup_position':
|
261 |
+
if (!in_array($data, array('fixed', 'absolute'))) {
|
262 |
+
$data = 'absolute';
|
263 |
+
}
|
264 |
+
break;
|
265 |
+
case 'select_popup_width':
|
266 |
+
if (!in_array($data, array('perc', 'px'))) {
|
267 |
+
$data = 'px';
|
268 |
+
}
|
269 |
+
break;
|
270 |
+
case 'select_popup_height':
|
271 |
+
if (!in_array($data, array('perc', 'px', 'auto'))) {
|
272 |
+
$data = 'auto';
|
273 |
+
}
|
274 |
+
break;
|
275 |
+
//cleaned by json_encode() **to improve
|
276 |
+
case 'selected_page_id':
|
277 |
+
break;
|
278 |
+
default:
|
279 |
+
$data = NULL;
|
280 |
+
}
|
281 |
+
return $data;
|
|
|
282 |
}
|
283 |
|
284 |
+
/**
|
285 |
+
* Shortcode for popup appearing
|
286 |
+
*
|
287 |
+
* @since 4.9
|
288 |
+
*
|
289 |
*/
|
290 |
+
function itro_popup_shortcode() {
|
291 |
+
global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
|
292 |
+
$popup_fired = true;
|
293 |
+
|
294 |
+
ob_start();
|
295 |
|
296 |
+
itro_style();
|
297 |
+
itro_popup_template();
|
298 |
+
itro_popup_js();
|
299 |
+
|
300 |
+
return ob_get_clean();
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
}
|
302 |
+
|
303 |
add_shortcode('itroshowpopup', 'itro_popup_shortcode');
|
304 |
|
305 |
/* ------------------------- DEBUG INFORMATION ON ADMIN PANNEL */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
+
function itro_get_serverinfo() {
|
308 |
+
global $wpdb;
|
309 |
+
global $wp_version;
|
310 |
+
|
311 |
+
$sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
|
312 |
+
$mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
|
313 |
+
if (is_array($mysqlinfo))
|
314 |
+
$sql_mode = $mysqlinfo[0]->Value;
|
315 |
+
if (empty($sql_mode))
|
316 |
+
$sql_mode = __('Not set', 'itro-plugin');
|
317 |
+
if (ini_get('safe_mode'))
|
318 |
+
$safe_mode = __('On', 'itro-plugin');
|
319 |
+
else
|
320 |
+
$safe_mode = __('Off', 'itro-plugin');
|
321 |
+
if (ini_get('allow_url_fopen'))
|
322 |
+
$allow_url_fopen = __('On', 'itro-plugin');
|
323 |
+
else
|
324 |
+
$allow_url_fopen = __('Off', 'itro-plugin');
|
325 |
+
if (ini_get('upload_max_filesize'))
|
326 |
+
$upload_max = ini_get('upload_max_filesize');
|
327 |
+
else
|
328 |
+
$upload_max = __('N/A', 'itro-plugin');
|
329 |
+
if (ini_get('post_max_size'))
|
330 |
+
$post_max = ini_get('post_max_size');
|
331 |
+
else
|
332 |
+
$post_max = __('N/A', 'itro-plugin');
|
333 |
+
if (ini_get('max_execution_time'))
|
334 |
+
$max_execute = ini_get('max_execution_time');
|
335 |
+
else
|
336 |
+
$max_execute = __('N/A', 'itro-plugin');
|
337 |
+
if (ini_get('memory_limit'))
|
338 |
+
$memory_limit = ini_get('memory_limit');
|
339 |
+
else
|
340 |
+
$memory_limit = __('N/A', 'itro-plugin');
|
341 |
+
if (function_exists('memory_get_usage'))
|
342 |
+
$memory_usage = round(memory_get_usage() / 1024 / 1024, 2) . __(' MByte', 'itro-plugin');
|
343 |
+
else
|
344 |
+
$memory_usage = __('N/A', 'itro-plugin');
|
345 |
+
if (is_callable('exif_read_data'))
|
346 |
+
$exif = __('Yes', 'itro-plugin') . " ( V" . substr(phpversion('exif'), 0, 4) . ")";
|
347 |
+
else
|
348 |
+
$exif = __('No', 'itro-plugin');
|
349 |
+
if (is_callable('iptcparse'))
|
350 |
+
$iptc = __('Yes', 'itro-plugin');
|
351 |
+
else
|
352 |
+
$iptc = __('No', 'itro-plugin');
|
353 |
+
if (is_callable('xml_parser_create'))
|
354 |
+
$xml = __('Yes', 'itro-plugin');
|
355 |
+
else
|
356 |
+
$xml = __('No', 'itro-plugin');
|
357 |
+
|
358 |
+
if (function_exists('wp_get_theme')) {
|
359 |
+
$theme = wp_get_theme();
|
360 |
+
} else {
|
361 |
+
$theme = get_theme(get_current_theme());
|
362 |
+
}
|
363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
|
365 |
+
if (function_exists('is_multisite')) {
|
366 |
+
if (is_multisite()) {
|
367 |
+
$ms = __('Yes', 'itro-plugin');
|
368 |
+
} else {
|
369 |
+
$ms = __('No', 'itro-plugin');
|
370 |
}
|
371 |
+
} else
|
372 |
+
$ms = __('N/A', 'itro-plugin');
|
373 |
+
|
374 |
+
$siteurl = get_option('siteurl');
|
375 |
+
$homeurl = get_option('home');
|
376 |
+
$db_version = get_option('db_version');
|
377 |
+
|
378 |
+
$debug_info = Array(
|
379 |
+
__('Operating System', 'itro-plugin') => PHP_OS,
|
380 |
+
__('Server', 'itro-plugin') => $_SERVER["SERVER_SOFTWARE"],
|
381 |
+
__('Memory usage', 'itro-plugin') => $memory_usage,
|
382 |
+
__('MYSQL Version', 'itro-plugin') => $sqlversion,
|
383 |
+
__('SQL Mode', 'itro-plugin') => $sql_mode,
|
384 |
+
__('PHP Version', 'itro-plugin') => PHP_VERSION,
|
385 |
+
__('PHP Safe Mode', 'itro-plugin') => $safe_mode,
|
386 |
+
__('PHP Allow URL fopen', 'itro-plugin') => $allow_url_fopen,
|
387 |
+
__('PHP Memory Limit', 'itro-plugin') => $memory_limit,
|
388 |
+
__('PHP Max Upload Size', 'itro-plugin') => $upload_max,
|
389 |
+
__('PHP Max Post Size', 'itro-plugin') => $post_max,
|
390 |
+
__('PHP Max Script Execute Time', 'itro-plugin') => $max_execute,
|
391 |
+
__('PHP Exif support', 'itro-plugin') => $exif,
|
392 |
+
__('PHP IPTC support', 'itro-plugin') => $iptc,
|
393 |
+
__('PHP XML support', 'itro-plugin') => $xml,
|
394 |
+
__('Site URL', 'itro-plugin') => $siteurl,
|
395 |
+
__('Home URL', 'itro-plugin') => $homeurl,
|
396 |
+
__('WordPress Version', 'itro-plugin') => $wp_version,
|
397 |
+
__('WordPress DB Version', 'itro-plugin') => $db_version,
|
398 |
+
__('Multisite', 'itro-plugin') => $ms,
|
399 |
+
__('Active Theme', 'itro-plugin') => $theme['Name'] . ' ' . $theme['Version'],
|
400 |
+
);
|
401 |
+
$debug_info['Active Plugins'] = null;
|
402 |
+
$active_plugins = $inactive_plugins = Array();
|
403 |
+
$plugins = get_plugins();
|
404 |
+
foreach ($plugins as $path => $plugin) {
|
405 |
+
if (is_plugin_active($path)) {
|
406 |
+
$debug_info[$plugin['Name']] = $plugin['Version'];
|
407 |
+
} else {
|
408 |
+
$inactive_plugins[$plugin['Name']] = $plugin['Version'];
|
409 |
}
|
410 |
+
}
|
411 |
+
$debug_info['Inactive Plugins'] = null;
|
412 |
+
$debug_info = array_merge($debug_info, (array) $inactive_plugins);
|
413 |
+
|
414 |
+
$debug_info['Plugin DB Status'] = null;
|
415 |
+
|
416 |
+
$table_list = check_tables_ipp();
|
417 |
+
if(empty($table_list)){
|
418 |
+
$table_list = "no tables";
|
419 |
+
}
|
420 |
+
|
421 |
+
$db_status = array(
|
422 |
+
"Current version" => get_option('itro_curr_ver'),
|
423 |
+
"Previous version" => get_option('itro_prev_ver'),
|
424 |
+
"Installed Tables" => $table_list,
|
425 |
+
);
|
426 |
+
|
427 |
+
$debug_info = array_merge($debug_info, (array) $db_status);
|
428 |
+
|
429 |
+
$debug_text = __("ITRO Popup Plugin - Debug info", 'itro-plugin') . "\r\n------------------\r\n\r\n";
|
430 |
+
$page_text = "";
|
431 |
+
if (!empty($debug_info)) {
|
432 |
+
foreach ($debug_info as $name => $value) {
|
433 |
+
if ($value !== null) {
|
434 |
+
$page_text .= "<li><strong>$name</strong> $value</li>";
|
435 |
+
$debug_text .= "$name: $value\r\n";
|
436 |
+
} else {
|
437 |
+
$page_text .= "</ul><h2>$name</h2><ul class='itro_debug_settings'>";
|
438 |
+
$debug_text .= "\r\n$name\r\n----------\r\n";
|
439 |
+
}
|
440 |
}
|
441 |
+
}
|
442 |
+
|
443 |
+
$nonce = wp_create_nonce('itro-debug-nonce');
|
444 |
+
$buf = '<textarea style="width:100%; height:400px; resize:none;" onclick="select();">' . $debug_text . '</textarea>';
|
445 |
+
return $buf;
|
446 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/database-function.php
CHANGED
@@ -1,152 +1,162 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
-
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
4 |
-
*/
|
5 |
-
if (
|
|
|
6 |
|
7 |
global $wpdb;
|
8 |
-
define
|
9 |
-
define
|
10 |
|
11 |
/* -------Create plugin tables */
|
12 |
-
|
13 |
-
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
(
|
19 |
option_id int NOT NULL AUTO_INCREMENT,
|
20 |
PRIMARY KEY(option_id),
|
21 |
option_name varchar(255),
|
22 |
option_val varchar(255)
|
23 |
) CHARACTER SET=utf8 COLLATE utf8_general_ci";
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
(
|
31 |
field_id int NOT NULL AUTO_INCREMENT,
|
32 |
PRIMARY KEY(field_id),
|
33 |
field_name varchar(255),
|
34 |
field_value TEXT
|
35 |
) CHARACTER SET=utf8 COLLATE utf8_general_ci";
|
36 |
-
|
37 |
-
|
38 |
}
|
39 |
|
40 |
/* update old fixed 'wp_' prefix to the current one' */
|
41 |
-
|
42 |
-
{
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
if
|
59 |
-
|
60 |
-
/* delete the obsolete and useless preview post */
|
61 |
-
if(itro_get_option('preview_id') != NULL){
|
62 |
-
wp_delete_post(itro_get_option('preview_id'), true);
|
63 |
-
}
|
64 |
-
}
|
65 |
-
// added the text for countdown
|
66 |
-
if( version_compare($prev_ver, 4.91 ) == -1 )
|
67 |
-
{
|
68 |
-
itro_update_option('countdown_text', 'This popup will close in:');
|
69 |
}
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
76 |
}
|
|
|
77 |
}
|
78 |
|
79 |
/* ------------------ PLUGIN OPTION DB MANAGEMENT -------------- */
|
80 |
-
|
81 |
-
{
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
{
|
97 |
-
$wpdb->update( $option_table_name , $data_to_send, $where_line );
|
98 |
-
}
|
99 |
}
|
100 |
|
101 |
-
function itro_get_option($opt_name)
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
return (NULL);
|
114 |
-
}
|
115 |
}
|
116 |
|
117 |
/* ------------------ CUSTOM FIELD CONTENT DB MANAGEMENT -------------- */
|
118 |
-
|
119 |
-
{
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
{
|
132 |
-
$wpdb->update( $field_table_name , $data_to_send, $where_line );
|
133 |
-
}
|
134 |
}
|
135 |
|
136 |
-
function itro_get_field($field_name)
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
|
|
|
|
|
|
151 |
}
|
152 |
-
?>
|
1 |
<?php
|
2 |
+
|
3 |
/*
|
4 |
+
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
5 |
+
*/
|
6 |
+
if (!defined('ABSPATH'))
|
7 |
+
exit; // Exit if accessed directly
|
8 |
|
9 |
global $wpdb;
|
10 |
+
define('OPTION_TABLE_NAME', $wpdb->prefix . 'itro_plugin_option');
|
11 |
+
define('FIELD_TABLE_NAME', $wpdb->prefix . 'itro_plugin_field');
|
12 |
|
13 |
/* -------Create plugin tables */
|
14 |
+
|
15 |
+
function itro_db_init() {
|
16 |
+
global $wpdb;
|
17 |
+
/* ------------------Option table */
|
18 |
+
$option_table_name = OPTION_TABLE_NAME;
|
19 |
+
$sql = "CREATE TABLE IF NOT EXISTS $option_table_name
|
20 |
(
|
21 |
option_id int NOT NULL AUTO_INCREMENT,
|
22 |
PRIMARY KEY(option_id),
|
23 |
option_name varchar(255),
|
24 |
option_val varchar(255)
|
25 |
) CHARACTER SET=utf8 COLLATE utf8_general_ci";
|
26 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
27 |
+
dbDelta($sql);
|
28 |
+
|
29 |
+
/* --------------Custom field table */
|
30 |
+
$field_table_name = FIELD_TABLE_NAME;
|
31 |
+
$sql = "CREATE TABLE IF NOT EXISTS $field_table_name
|
32 |
(
|
33 |
field_id int NOT NULL AUTO_INCREMENT,
|
34 |
PRIMARY KEY(field_id),
|
35 |
field_name varchar(255),
|
36 |
field_value TEXT
|
37 |
) CHARACTER SET=utf8 COLLATE utf8_general_ci";
|
38 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
39 |
+
dbDelta($sql);
|
40 |
}
|
41 |
|
42 |
/* update old fixed 'wp_' prefix to the current one' */
|
43 |
+
|
44 |
+
function itro_update_db() {
|
45 |
+
global $wpdb;
|
46 |
+
$prev_ver = get_option('itro_prev_ver');
|
47 |
+
|
48 |
+
if ($prev_ver <= 3.68) {
|
49 |
+
itro_update_option('popup_border_width', 3);
|
50 |
+
itro_update_option('popup_border_radius', 8);
|
51 |
+
}
|
52 |
+
|
53 |
+
if (version_compare($prev_ver, 4.6) == -1 && $wpdb->prefix != 'wp_') {
|
54 |
+
$wpdb->query("RENAME TABLE wp_itro_plugin_option TO " . $wpdb->prefix . "itro_plugin_option");
|
55 |
+
$wpdb->query("RENAME TABLE wp_itro_plugin_field TO " . $wpdb->prefix . "itro_plugin_field");
|
56 |
+
}
|
57 |
+
|
58 |
+
if (version_compare($prev_ver, 4.7) == -1) {
|
59 |
+
/* delete the obsolete and useless preview post */
|
60 |
+
if (itro_get_option('preview_id') != NULL) {
|
61 |
+
wp_delete_post(itro_get_option('preview_id'), true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
+
}
|
64 |
+
// added the text for countdown
|
65 |
+
if (version_compare($prev_ver, 4.91) == -1) {
|
66 |
+
itro_update_option('countdown_text', 'This popup will close in:');
|
67 |
+
}
|
68 |
+
// reset the popup height after error for data sanitization
|
69 |
+
if (version_compare($prev_ver, 4.95) == -1) {
|
70 |
+
if (itro_get_option('select_popup_height') == 'px' && itro_get_option('px_popup_height') == 0) {
|
71 |
+
itro_update_option('select_popup_height', 'auto');
|
72 |
}
|
73 |
+
}
|
74 |
}
|
75 |
|
76 |
/* ------------------ PLUGIN OPTION DB MANAGEMENT -------------- */
|
77 |
+
|
78 |
+
function itro_update_option($opt_name, $opt_val) {
|
79 |
+
global $wpdb;
|
80 |
+
|
81 |
+
$opt_val = ipp_validate_data($opt_name, $opt_val);
|
82 |
+
|
83 |
+
$option_table_name = OPTION_TABLE_NAME;
|
84 |
+
$data_to_send = array('option_val' => $opt_val);
|
85 |
+
$where_line = array('option_name' => $opt_name);
|
86 |
+
$wp_query = $wpdb->get_results("SELECT * FROM $option_table_name WHERE option_name='$opt_name'");
|
87 |
+
if ($wp_query == NULL) {
|
88 |
+
$wpdb->insert($option_table_name, $where_line);
|
89 |
+
$wpdb->update($option_table_name, $data_to_send, $where_line);
|
90 |
+
} else {
|
91 |
+
$wpdb->update($option_table_name, $data_to_send, $where_line);
|
92 |
+
}
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
+
function itro_get_option($opt_name) {
|
96 |
+
global $wpdb;
|
97 |
+
$option_table_name = OPTION_TABLE_NAME;
|
98 |
+
$result = $wpdb->get_results("SELECT * FROM $option_table_name WHERE option_name='$opt_name'");
|
99 |
+
foreach ($result as $pippo) {
|
100 |
+
$opt_val = $pippo->option_val;
|
101 |
+
}
|
102 |
+
if (isset($opt_val)) {
|
103 |
+
return ipp_validate_data($opt_name, $opt_val);
|
104 |
+
} else {
|
105 |
+
return (NULL);
|
106 |
+
}
|
|
|
|
|
107 |
}
|
108 |
|
109 |
/* ------------------ CUSTOM FIELD CONTENT DB MANAGEMENT -------------- */
|
110 |
+
|
111 |
+
function itro_update_field($field_name, $field_value) {
|
112 |
+
global $wpdb;
|
113 |
+
$field_table_name = FIELD_TABLE_NAME;
|
114 |
+
$data_to_send = array('field_value' => $field_value);
|
115 |
+
$where_line = array('field_name' => $field_name);
|
116 |
+
$wp_query = $wpdb->get_results("SELECT * FROM $field_table_name WHERE field_name='$field_name'");
|
117 |
+
if ($wp_query == NULL) {
|
118 |
+
$wpdb->insert($field_table_name, $where_line);
|
119 |
+
$wpdb->update($field_table_name, $data_to_send, $where_line);
|
120 |
+
} else {
|
121 |
+
$wpdb->update($field_table_name, $data_to_send, $where_line);
|
122 |
+
}
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
+
function itro_get_field($field_name) {
|
126 |
+
global $wpdb;
|
127 |
+
$field_table_name = FIELD_TABLE_NAME;
|
128 |
+
$result = $wpdb->get_results("SELECT * FROM $field_table_name WHERE field_name='$field_name'");
|
129 |
+
foreach ($result as $pippo) {
|
130 |
+
$field_value = $pippo->field_value;
|
131 |
+
}
|
132 |
+
|
133 |
+
if (isset($field_value)) {
|
134 |
+
return ipp_validate_data($field_name, $field_value);
|
135 |
+
} else {
|
136 |
+
return (NULL);
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Check if the plugin tables exist
|
142 |
+
*
|
143 |
+
* @since 5.0.2
|
144 |
+
*
|
145 |
+
* @return string empty string if find no tables, else the coma separated list
|
146 |
+
*
|
147 |
+
* */
|
148 |
+
function check_tables_ipp() {
|
149 |
+
global $wpdb;
|
150 |
+
|
151 |
+
$all_tables = $wpdb->get_results("SHOW TABLES");
|
152 |
+
$table_list = array();
|
153 |
+
foreach ($all_tables as $table) {
|
154 |
+
foreach ($table as $t) {
|
155 |
+
if ($t == $wpdb->prefix . "itro_plugin_field" || $t == $wpdb->prefix . "itro_plugin_option") {
|
156 |
+
$table_list[] = $t;
|
157 |
+
}
|
158 |
}
|
159 |
+
}
|
160 |
+
|
161 |
+
return $table_list = implode(",", $table_list);
|
162 |
}
|
|
mc-main.php
CHANGED
@@ -6,14 +6,14 @@ Description: EN - Show a perfecly centered customizable popup and a popup-system
|
|
6 |
Author: ITRO Team
|
7 |
E-mail: support@itroteam.com
|
8 |
Text Domain: itro-popup
|
9 |
-
Version: 5.0.
|
10 |
Author URI: http://www.itroteam.com
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
|
15 |
global $ITRO_VER;
|
16 |
-
$ITRO_VER = '5.0.
|
17 |
|
18 |
global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
|
19 |
$popup_fired = false;
|
6 |
Author: ITRO Team
|
7 |
E-mail: support@itroteam.com
|
8 |
Text Domain: itro-popup
|
9 |
+
Version: 5.0.2
|
10 |
Author URI: http://www.itroteam.com
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
|
15 |
global $ITRO_VER;
|
16 |
+
$ITRO_VER = '5.0.2';
|
17 |
|
18 |
global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
|
19 |
$popup_fired = false;
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: ITRO
|
|
3 |
Donate link: https://www.itroteam.com/leave-a-review/
|
4 |
Tags: multilingual popup, popup, popup message, popuup optin, popup box, popup ads, popup advertising, popup block, popup content warning, fancy box, fancy popup, advertising popup, pop-up, lightbox popup
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 4.7.
|
7 |
-
Stable tag: 5.0.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -131,6 +131,10 @@ LIVE DEMOS - [CLICK HERE!](https://www.itroteam.com/wordpress-popup-samples-demo
|
|
131 |
BACKEND SCREENSHOT - [CLICK HERE!](https://www.itroteam.com/wordpress-popup-samples-demos/#backend)
|
132 |
|
133 |
== Changelog ==
|
|
|
|
|
|
|
|
|
134 |
= 5.0.1 =
|
135 |
ADDED: force_balance_tags used to prevent popup content break the DOM
|
136 |
|
@@ -396,6 +400,10 @@ bug fixed: color table now works in admin pannel.
|
|
396 |
First released version.
|
397 |
|
398 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
399 |
= 5.0.1 =
|
400 |
ADDED: force_balance_tags used to prevent popup content break the DOM
|
401 |
|
3 |
Donate link: https://www.itroteam.com/leave-a-review/
|
4 |
Tags: multilingual popup, popup, popup message, popuup optin, popup box, popup ads, popup advertising, popup block, popup content warning, fancy box, fancy popup, advertising popup, pop-up, lightbox popup
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 4.7.3
|
7 |
+
Stable tag: 5.0.2
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
131 |
BACKEND SCREENSHOT - [CLICK HERE!](https://www.itroteam.com/wordpress-popup-samples-demos/#backend)
|
132 |
|
133 |
== Changelog ==
|
134 |
+
= 5.0.2 =
|
135 |
+
IMPROVED: system info on the popup admin page
|
136 |
+
ADDED: force table installation in case something gone wrong during plugin activation
|
137 |
+
|
138 |
= 5.0.1 =
|
139 |
ADDED: force_balance_tags used to prevent popup content break the DOM
|
140 |
|
400 |
First released version.
|
401 |
|
402 |
== Upgrade Notice ==
|
403 |
+
= 5.0.2 =
|
404 |
+
IMPROVED: system info on the popup admin page
|
405 |
+
ADDED: force table installation in case something gone wrong during plugin activation
|
406 |
+
|
407 |
= 5.0.1 =
|
408 |
ADDED: force_balance_tags used to prevent popup content break the DOM
|
409 |
|
scripts/itro-admin-scripts.js
CHANGED
@@ -1,81 +1,96 @@
|
|
1 |
/*
|
2 |
-
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
3 |
-
*/
|
4 |
|
5 |
/* -------------- SCRIPTS FOR ADMIN PANNEL */
|
6 |
|
7 |
function itro_pos(e)
|
8 |
{
|
9 |
-
|
10 |
-
|
11 |
}
|
12 |
|
13 |
-
function itro_mutual_check(checkbox_id_1,checkbox_id_2,box)
|
14 |
{
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
{
|
17 |
-
|
18 |
-
if( checkbox_id_1 == '' ) {return 0;}
|
19 |
-
if(checkbox_id_1 == checkbox_id_2) { return 0; }
|
20 |
-
document.getElementById(checkbox_id_1).checked = !document.getElementById(checkbox_id_1).checked;
|
21 |
-
if( document.getElementById(checkbox_id_1).checked || document.getElementById(checkbox_id_2).checked )
|
22 |
-
{ document.getElementById(checkbox_id_2).checked = !document.getElementById(checkbox_id_1).checked; }
|
23 |
}
|
24 |
-
|
|
|
|
|
25 |
{
|
26 |
-
|
27 |
-
{ document.getElementById(checkbox_id_2).checked = !document.getElementById(checkbox_id_1).checked; }
|
28 |
}
|
|
|
29 |
}
|
30 |
|
31 |
-
jQuery(document).ready(function()
|
32 |
-
{
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
{
|
38 |
-
|
39 |
-
uploadID = jQuery(this).prev('input'); /*set the uploadID variable to the value of the input before the upload button*/
|
40 |
-
tb_show('', 'media-upload.php?type=image&amp;amp;TB_iframe=true');
|
41 |
-
|
42 |
-
/* restore send_to_editor() when tb closed */
|
43 |
-
jQuery("#TB_window").bind('tb_unload', function ()
|
44 |
-
{
|
45 |
-
window.send_to_editor = orig_send_to_editor;
|
46 |
-
});
|
47 |
-
|
48 |
-
/* temporarily redefine send_to_editor() */
|
49 |
-
window.send_to_editor = function(html)
|
50 |
-
{
|
51 |
-
imgurl = jQuery('img',html).attr('src');
|
52 |
-
uploadID.val(imgurl); /*assign the value of the image src to the input*/
|
53 |
-
//check the radio button if it is the background source
|
54 |
-
if(upload_button.attr('name') == 'bg_upload_button'){
|
55 |
-
jQuery('#yes_bg').prop("checked", true);
|
56 |
-
}
|
57 |
-
tb_remove();
|
58 |
-
};
|
59 |
-
return false;
|
60 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
});
|
62 |
|
63 |
var itro_option_state;
|
64 |
function itro_check_state(state_check_id)
|
65 |
{
|
66 |
-
|
67 |
}
|
68 |
|
69 |
function itro_select(target_id)
|
70 |
{
|
71 |
-
|
72 |
-
|
73 |
}
|
74 |
|
75 |
-
function itro_set_cookie(c_name,value,exhours)
|
76 |
{
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
}
|
1 |
/*
|
2 |
+
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
3 |
+
*/
|
4 |
|
5 |
/* -------------- SCRIPTS FOR ADMIN PANNEL */
|
6 |
|
7 |
function itro_pos(e)
|
8 |
{
|
9 |
+
e = e || window.event;
|
10 |
+
x_pos = e.clientX;
|
11 |
}
|
12 |
|
13 |
+
function itro_mutual_check(checkbox_id_1, checkbox_id_2, box)
|
14 |
{
|
15 |
+
if (!box)
|
16 |
+
{
|
17 |
+
if (checkbox_id_2 == '') {
|
18 |
+
document.getElementById(checkbox_id_1).checked = !document.getElementById(checkbox_id_1).checked;
|
19 |
+
return 1;
|
20 |
+
}
|
21 |
+
if (checkbox_id_1 == '') {
|
22 |
+
return 0;
|
23 |
+
}
|
24 |
+
if (checkbox_id_1 == checkbox_id_2) {
|
25 |
+
return 0;
|
26 |
+
}
|
27 |
+
document.getElementById(checkbox_id_1).checked = !document.getElementById(checkbox_id_1).checked;
|
28 |
+
if (document.getElementById(checkbox_id_1).checked || document.getElementById(checkbox_id_2).checked)
|
29 |
{
|
30 |
+
document.getElementById(checkbox_id_2).checked = !document.getElementById(checkbox_id_1).checked;
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
+
} else
|
33 |
+
{
|
34 |
+
if (document.getElementById(checkbox_id_1).checked || document.getElementById(checkbox_id_2).checked)
|
35 |
{
|
36 |
+
document.getElementById(checkbox_id_2).checked = !document.getElementById(checkbox_id_1).checked;
|
|
|
37 |
}
|
38 |
+
}
|
39 |
}
|
40 |
|
41 |
+
jQuery(document).ready(function ()
|
42 |
+
{
|
43 |
+
var orig_send_to_editor = window.send_to_editor;
|
44 |
+
var uploadID = ''; /*setup the var in a global scope*/
|
45 |
|
46 |
+
jQuery('.ipp_upload_button').click(function ()
|
47 |
+
{
|
48 |
+
upload_button = jQuery(this);
|
49 |
+
uploadID = jQuery(this).prev('input'); /*set the uploadID variable to the value of the input before the upload button*/
|
50 |
+
tb_show('', 'media-upload.php?type=image&amp;amp;TB_iframe=true');
|
51 |
+
|
52 |
+
/* restore send_to_editor() when tb closed */
|
53 |
+
jQuery("#TB_window").bind('tb_unload', function ()
|
54 |
{
|
55 |
+
window.send_to_editor = orig_send_to_editor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
});
|
57 |
+
|
58 |
+
/* temporarily redefine send_to_editor() */
|
59 |
+
window.send_to_editor = function (html)
|
60 |
+
{
|
61 |
+
if (jQuery('img', html).attr('src') === undefined) {
|
62 |
+
imgurl = jQuery(html).attr('src');
|
63 |
+
} else {
|
64 |
+
imgurl = jQuery('img', html).attr('src');
|
65 |
+
}
|
66 |
+
uploadID.val(imgurl); /*assign the value of the image src to the input*/
|
67 |
+
|
68 |
+
//check the radio button if it is the background source
|
69 |
+
if (upload_button.attr('name') == 'bg_upload_button') {
|
70 |
+
jQuery('#yes_bg').prop("checked", true);
|
71 |
+
}
|
72 |
+
tb_remove();
|
73 |
+
};
|
74 |
+
return false;
|
75 |
+
});
|
76 |
});
|
77 |
|
78 |
var itro_option_state;
|
79 |
function itro_check_state(state_check_id)
|
80 |
{
|
81 |
+
itro_option_state = state_check_id.selected;
|
82 |
}
|
83 |
|
84 |
function itro_select(target_id)
|
85 |
{
|
86 |
+
target_id.selected = !itro_option_state;
|
87 |
+
itro_option_state = !itro_option_state;
|
88 |
}
|
89 |
|
90 |
+
function itro_set_cookie(c_name, value, exhours)
|
91 |
{
|
92 |
+
var exdate = new Date();
|
93 |
+
exdate.setTime(exdate.getTime() + (exhours * 3600 * 1000));
|
94 |
+
var c_value = escape(value) + ((exhours == null) ? "" : "; expires=" + exdate.toUTCString());
|
95 |
+
document.cookie = c_name + "=" + c_value + "; path=/";
|
96 |
}
|
scripts/itro-scripts.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*
|
2 |
-
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
3 |
-
*/
|
4 |
|
5 |
/* init variables */
|
6 |
var itro_is_preview;
|
@@ -15,35 +15,36 @@ var itro_age_restriction;
|
|
15 |
*
|
16 |
*/
|
17 |
function itro_enter_anim(auto_margin)
|
18 |
-
{
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
jQuery("#itro_popup").css('display', 'none');
|
27 |
-
jQuery("#itro_popup").css('opacity', 1);
|
28 |
-
jQuery("#itro_popup").css('visibility', 'visible');
|
29 |
-
|
30 |
-
jQuery("#itro_opaco").fadeIn(function()
|
31 |
-
{
|
32 |
-
jQuery("#itro_popup").fadeIn();
|
33 |
-
if( itro_age_restriction === false )
|
34 |
-
{
|
35 |
-
itro_set_cookie("popup_cookie","one_time_popup", itro_cookie_expiration);
|
36 |
-
}
|
37 |
-
// refresh every 0.5 second the popup top margin (needed for browser window resizeing)
|
38 |
-
if(auto_margin == 'yes'){
|
39 |
-
setInterval(function(){itro_margin_refresh();},500);
|
40 |
-
}
|
41 |
-
});
|
42 |
-
}
|
43 |
-
else{
|
44 |
-
jQuery("#itro_popup").css('display', 'none');
|
45 |
}
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -53,60 +54,62 @@ function itro_enter_anim(auto_margin)
|
|
53 |
* @since 1.0
|
54 |
*
|
55 |
*/
|
56 |
-
function itro_exit_anim(){
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
}
|
62 |
|
63 |
|
64 |
/**
|
65 |
* Center the popup vertically
|
66 |
*
|
67 |
-
* @param int speed: the milesec speed fo the alignment animation
|
68 |
*
|
69 |
* @since 1.0
|
70 |
*
|
71 |
*/
|
72 |
-
function itro_margin_refresh(speed){
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
desTopWindowMargin = Math.round((browserHeight - popupHeight)/2); //desired top margin of popup (window related)
|
96 |
-
desTopWindowMargin = desTopWindowMargin < 0 ? 0 : desTopWindowMargin; //avoid that negative top position will hide the popup
|
97 |
-
popupTopMargin = desTopWindowMargin - docOffset + parentOffset;
|
98 |
-
|
99 |
-
if(jQuery('#itro_popup').css('position') == 'absolute'){
|
100 |
-
//set a tollerance to avoid flickering
|
101 |
-
if(Math.abs(popupTopMargin - parentOffset) > 2){
|
102 |
-
jQuery('#itro_popup').animate({top: popupTopMargin}, speed);
|
103 |
-
}
|
104 |
-
}else{
|
105 |
-
if(Math.abs(popupTopMargin - parentOffset) > 2){
|
106 |
-
jQuery('#itro_popup').animate({top: desTopWindowMargin}, speed);
|
107 |
-
}
|
108 |
}
|
109 |
-
|
|
|
110 |
}
|
111 |
|
112 |
/**
|
@@ -135,24 +138,25 @@ function itro_invert_color(hexTripletColor) {
|
|
135 |
* @since 4.9
|
136 |
*
|
137 |
*/
|
138 |
-
function itro_rgb2hex(rgbString){
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
146 |
}
|
147 |
|
148 |
/* function for countdown to show popup when the delay is set */
|
149 |
-
function popup_delay(auto_margin){
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
}
|
157 |
|
158 |
|
@@ -162,20 +166,20 @@ function popup_delay(auto_margin){
|
|
162 |
* @since 1.0
|
163 |
*
|
164 |
*/
|
165 |
-
function popTimer(){
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
}
|
174 |
|
175 |
/* function use to set the cookie for next visualization time */
|
176 |
-
function itro_set_cookie(c_name,value,exhours){
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
}
|
1 |
/*
|
2 |
+
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
3 |
+
*/
|
4 |
|
5 |
/* init variables */
|
6 |
var itro_is_preview;
|
15 |
*
|
16 |
*/
|
17 |
function itro_enter_anim(auto_margin)
|
18 |
+
{
|
19 |
+
if (document.cookie.indexOf("popup_cookie") == -1 || itro_is_preview === true)
|
20 |
+
{
|
21 |
+
//align the popup before fadein
|
22 |
+
if (auto_margin == 'yes') {
|
23 |
+
itro_margin_refresh(50);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
+
|
26 |
+
jQuery("#itro_popup").css('display', 'none');
|
27 |
+
jQuery("#itro_popup").css('opacity', 1);
|
28 |
+
jQuery("#itro_popup").css('visibility', 'visible');
|
29 |
+
|
30 |
+
jQuery("#itro_opaco").fadeIn(function ()
|
31 |
+
{
|
32 |
+
jQuery("#itro_popup").fadeIn();
|
33 |
+
if (itro_age_restriction === false)
|
34 |
+
{
|
35 |
+
itro_set_cookie("popup_cookie", "one_time_popup", itro_cookie_expiration);
|
36 |
+
}
|
37 |
+
// refresh every 0.5 second the popup top margin (needed for browser window resizeing)
|
38 |
+
if (auto_margin == 'yes') {
|
39 |
+
setInterval(function () {
|
40 |
+
itro_margin_refresh();
|
41 |
+
}, 500);
|
42 |
+
}
|
43 |
+
});
|
44 |
+
} else {
|
45 |
+
jQuery("#itro_popup").css('display', 'none');
|
46 |
+
}
|
47 |
+
|
48 |
}
|
49 |
|
50 |
/**
|
54 |
* @since 1.0
|
55 |
*
|
56 |
*/
|
57 |
+
function itro_exit_anim() {
|
58 |
+
jQuery('#itro_popup').fadeOut(function () {
|
59 |
+
jQuery('#popup_content').remove();
|
60 |
+
jQuery('#itro_opaco').fadeOut();
|
61 |
+
});
|
62 |
}
|
63 |
|
64 |
|
65 |
/**
|
66 |
* Center the popup vertically
|
67 |
*
|
68 |
+
* @param {int} speed : the milesec speed fo the alignment animation
|
69 |
*
|
70 |
* @since 1.0
|
71 |
*
|
72 |
*/
|
73 |
+
function itro_margin_refresh(speed) {
|
74 |
+
if (typeof (speed) == undefined) {
|
75 |
+
speed = 200;
|
76 |
+
}
|
77 |
+
|
78 |
+
if (typeof (window.innerWidth) == 'number')
|
79 |
+
{
|
80 |
+
/* Non-IE */
|
81 |
+
browserWidth = window.innerWidth;
|
82 |
+
browserHeight = window.innerHeight;
|
83 |
+
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
|
84 |
+
{
|
85 |
+
/* IE 6+ in 'standards compliant mode' */
|
86 |
+
browserWidth = document.documentElement.clientWidth;
|
87 |
+
browserHeight = document.documentElement.clientHeight;
|
88 |
+
} else if (document.body && (document.body.clientWidth || document.body.clientHeight))
|
89 |
+
{
|
90 |
+
/* IE 4 compatible */
|
91 |
+
browserWidth = document.body.clientWidth;
|
92 |
+
browserHeight = document.body.clientHeight;
|
93 |
+
}
|
94 |
+
popupHeight = document.getElementById('itro_popup').offsetHeight; //get the px size of popup div
|
95 |
+
parentOffset = jQuery('#itro_popup').position().top;
|
96 |
+
docOffset = jQuery('#itro_popup').offset().top;
|
97 |
+
|
98 |
+
desTopWindowMargin = Math.round((browserHeight - popupHeight) / 2); //desired top margin of popup (window related)
|
99 |
+
desTopWindowMargin = desTopWindowMargin < 0 ? 0 : desTopWindowMargin; //avoid that negative top position will hide the popup
|
100 |
+
popupTopMargin = desTopWindowMargin - docOffset + parentOffset;
|
101 |
+
|
102 |
+
if (jQuery('#itro_popup').css('position') == 'absolute') {
|
103 |
+
//set a tollerance to avoid flickering
|
104 |
+
if (Math.abs(popupTopMargin - parentOffset) > 2) {
|
105 |
+
jQuery('#itro_popup').animate({top: popupTopMargin}, speed);
|
106 |
}
|
107 |
+
} else {
|
108 |
+
if (Math.abs(popupTopMargin - parentOffset) > 2) {
|
109 |
+
jQuery('#itro_popup').animate({top: desTopWindowMargin}, speed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
}
|
111 |
+
}
|
112 |
+
|
113 |
}
|
114 |
|
115 |
/**
|
138 |
* @since 4.9
|
139 |
*
|
140 |
*/
|
141 |
+
function itro_rgb2hex(rgbString) {
|
142 |
+
var parts = rgbString.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
143 |
+
delete (parts[0]);
|
144 |
+
for (var i = 1; i <= 3; ++i) {
|
145 |
+
parts[i] = parseInt(parts[i]).toString(16);
|
146 |
+
if (parts[i].length == 1)
|
147 |
+
parts[i] = '0' + parts[i];
|
148 |
+
}
|
149 |
+
return '#' + parts.join('').toUpperCase();
|
150 |
}
|
151 |
|
152 |
/* function for countdown to show popup when the delay is set */
|
153 |
+
function popup_delay(auto_margin) {
|
154 |
+
delay--;
|
155 |
+
if (delay <= 0)
|
156 |
+
{
|
157 |
+
clearInterval(interval_id_delay);
|
158 |
+
itro_enter_anim(auto_margin);
|
159 |
+
}
|
160 |
}
|
161 |
|
162 |
|
166 |
* @since 1.0
|
167 |
*
|
168 |
*/
|
169 |
+
function popTimer() {
|
170 |
+
if (popTime > 0) {
|
171 |
+
document.getElementById("timer").innerHTML = popTime;
|
172 |
+
popTime--;
|
173 |
+
} else {
|
174 |
+
clearInterval(interval_id);
|
175 |
+
itro_exit_anim();
|
176 |
+
}
|
177 |
}
|
178 |
|
179 |
/* function use to set the cookie for next visualization time */
|
180 |
+
function itro_set_cookie(c_name, value, exhours) {
|
181 |
+
var exdate = new Date();
|
182 |
+
exdate.setTime(exdate.getTime() + (exhours * 3600 * 1000));
|
183 |
+
var c_value = escape(value) + ((exhours == null) ? "" : "; expires=" + exdate.toUTCString());
|
184 |
+
document.cookie = c_name + "=" + c_value + "; path=/";
|
185 |
}
|
templates/itro-popup-template.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
-
/*
|
3 |
-
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
4 |
*/
|
5 |
|
6 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -36,7 +36,7 @@ function itro_popup_template()
|
|
36 |
<div id="popup_content"><?php
|
37 |
$custom_field = stripslashes(itro_get_field('custom_html')); /* insert custom html code */
|
38 |
$custom_field = str_replace("\r\n",'',$custom_field);
|
39 |
-
_e( do_shortcode( $custom_field) ); /* return the string whitout new line */
|
40 |
if ( itro_get_option('age_restriction') == 'yes' )
|
41 |
{?>
|
42 |
<p id="age_button_area" style="text-align: center;">
|
@@ -54,5 +54,4 @@ function itro_popup_template()
|
|
54 |
</div>
|
55 |
<div id="itro_opaco" <?php if ( itro_get_option('age_restriction') != 'yes' && itro_get_option('popup_unlockable') != 'yes' ){ ?> onclick="itro_exit_anim();" <?php } ?> ></div>
|
56 |
<?php
|
57 |
-
}
|
58 |
-
?>
|
1 |
<?php
|
2 |
+
/*
|
3 |
+
This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
|
4 |
*/
|
5 |
|
6 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
36 |
<div id="popup_content"><?php
|
37 |
$custom_field = stripslashes(itro_get_field('custom_html')); /* insert custom html code */
|
38 |
$custom_field = str_replace("\r\n",'',$custom_field);
|
39 |
+
_e( force_balance_tags(do_shortcode( $custom_field)) ); /* return the string whitout new line */
|
40 |
if ( itro_get_option('age_restriction') == 'yes' )
|
41 |
{?>
|
42 |
<p id="age_button_area" style="text-align: center;">
|
54 |
</div>
|
55 |
<div id="itro_opaco" <?php if ( itro_get_option('age_restriction') != 'yes' && itro_get_option('popup_unlockable') != 'yes' ){ ?> onclick="itro_exit_anim();" <?php } ?> ></div>
|
56 |
<?php
|
57 |
+
}
|
|