ITRO Popup Plugin - Version 4.9.2

Version Description

FIXED: no data validation/sanitization

Download this release

Release Info

Developer ITRO
Plugin Icon 128x128 ITRO Popup Plugin
Version 4.9.2
Comparing to
See all releases

Code changes from version 4.7.2 to 4.9.2

admin/popup-admin.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /*
3
- Copyright 2013 I.T.RO.® (email : support.itro@live.com)
4
- This file is part of ITRO Popup Plugin.
5
  */
 
 
 
6
  global $ITRO_VER;
7
 
8
  if ( !current_user_can( 'manage_options' ) ) {
@@ -47,28 +49,29 @@ if( !isset($submitted_form ))
47
  /*opt 32*/'disable_mobile',
48
  /*opt 33*/'cross_selected',
49
  /*opt 34*/'enter_button_url',
 
 
50
  );
51
- $field_name=array(
52
- /*fld 0*/'custom_html',
53
- );
54
  $submitted_form = 'mt_submit_hidden';
55
  }
56
 
57
  /* ordered options */
58
  for($i=0;$i<count($opt_name); $i++)
59
  {
60
- /* Read in existing option value from database */
61
- $opt_val[$i] = itro_get_option( $opt_name[$i] );
62
- $px_opt_val[$i] = itro_get_option( 'px_' . $opt_name[$i] );
63
- $perc_opt_val[$i] = itro_get_option( 'perc_' . $opt_name[$i] );
64
-
65
  /* See if the user has posted us some information */
66
  /* If they did, this hidden field will be set to 'Y' */
67
  if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
68
- {
 
 
 
69
  /* Read their posted value */
70
- if(isset($_POST[$opt_name[$i]])){$opt_val[$i] = $_POST[ $opt_name[$i] ];}
71
- else{$opt_val[$i] = NULL;}
 
 
 
72
 
73
  /* Save the posted value in the database */
74
  itro_update_option( $opt_name[$i], $opt_val[$i] );
@@ -77,38 +80,37 @@ for($i=0;$i<count($opt_name); $i++)
77
  {
78
  itro_update_option( 'select_' . $opt_name[$i], $_POST['select_' . $opt_name[$i]] );
79
 
80
- $px_opt_val[$i] = $_POST['px_' . $opt_name[$i]];
81
  itro_update_option( 'px_' . $opt_name[$i], $_POST['px_' . $opt_name[$i]] );
82
- $perc_opt_val[$i] = $_POST['perc_' . $opt_name[$i]];
83
  itro_update_option( 'perc_' . $opt_name[$i], $_POST['perc_' . $opt_name[$i]] );
84
  }
85
  else{ itro_update_option( 'select_' . $opt_name[$i], NULL ); }
86
- }
87
- }
88
-
89
- /* ordered field */
90
- for($i=0;$i<count($field_name); $i++)
91
- {
92
- /* Read in existing option value from database */
93
-
94
- $field_value[$i] = itro_get_field( $field_name[$i] );
95
-
96
- /* See if the user has posted us some information */
97
- /* If they did, this hidden field will be set to 'Y' */
98
- if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
99
- {
100
- /* Read their posted value */
101
- if(isset($_POST[$field_name[$i]])) {$field_value[$i] = $_POST[ $field_name[$i] ]; }
102
- else{$field_value[$i] = NULL;}
103
-
104
- /* Save the posted value in the database */
105
- itro_update_field( $field_name[$i], $field_value[$i] );
106
  }
107
  }
108
 
109
  /* unsorted option and field */
110
  if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
111
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  if( isset($_POST['selected_page_id']) )
113
  {
114
  $selected_page_id=json_encode($_POST['selected_page_id']);
@@ -119,13 +121,19 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
119
  itro_update_option('selected_page_id',NULL);
120
  }
121
 
122
- if( empty($_POST['background_source']) ) { $opt_val[22] = NULL; itro_update_option('background_source',NULL); }
123
- else { itro_update_option('background_source',$_POST['background_source']); }
 
 
 
 
124
  }
125
 
126
  /* delete tables on plugin uninstall option */
127
  if( isset($_POST['delete_data_hidden']) && $_POST['delete_data_hidden'] == 'Y' )
128
  {
 
 
129
  if( isset($_POST['delete_data']) )
130
  {
131
  itro_update_option('delete_data', $_POST['delete_data']);
@@ -151,7 +159,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
151
  </div>
152
 
153
  <form id="optionForm" method="post">
154
-
155
  <div id="leftColumn">
156
  <!-- Settings form !-->
157
  <div id="formContainer">
@@ -190,16 +198,12 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
190
  </div>
191
  </p>
192
 
193
- <!-- disable esc key and mobile !-->
194
  <h3><?php _e("GENERAL SETTINGS","itro-plugin")?></h3>
195
  <p id="<?php echo $opt_name[24]; ?>_div">
196
- <input type="checkbox" id="<?php echo $opt_name[32]; ?>" name="<?php echo $opt_name[32]; ?>" value="yes" <?php if($opt_val[32] == 'yes' ){echo 'checked="checked"';} ?> />
197
- <span onclick="itro_mutual_check('<?php echo $opt_name[32]; ?>','','')"><?php _e("Disable on mobile device", 'itro-plugin' ); ?></span>
198
- <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>"title="<?php _e('Check this to disable popup on mobile devices','itro-plugin');?>" >
199
- &nbsp;&nbsp;&nbsp;
200
  <input type="checkbox" id="<?php echo $opt_name[24]; ?>" name="<?php echo $opt_name[24]; ?>" value="yes" <?php if($opt_val[24] == 'yes' ){echo 'checked="checked"';} ?> />
201
- <span onclick="itro_mutual_check('<?php echo $opt_name[24]; ?>','','')"><?php _e("Disable ESC key", 'itro-plugin' ); ?></span>
202
- <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>"title="<?php _e('If you set this option, popup can not be closed with ESC button of keyboard.','itro-plugin');?>" >
203
  </p>
204
 
205
  <!-- popup seconds!-->
@@ -234,13 +238,17 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
234
  <input type="checkbox" name="<?php echo $opt_name[29]; ?>" id="<?php echo $opt_name[29]; ?>" value="yes" <?php if(itro_get_option($opt_name[29])=='yes' ){echo 'checked="checked"';} ?> />&nbsp;&nbsp;
235
  <span onclick="itro_mutual_check('<?php echo $opt_name[29]; ?>','','')"><?php _e("Show countdown", 'itro-plugin' ); ?></span>
236
  <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e('Show the countdown at the bottom of the popup which dispay the time before popup will close. If is hidden, it run anyway.','itro-plugin');?>" >
237
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
 
 
 
238
  <?php _e("Countdown font color:", 'itro-plugin' ); ?>
239
  <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e('Select the countdown font color.','itro-plugin');?>" >
240
  <input type="text" class="color" name="<?php echo $opt_name[21]; ?>" value="<?php echo $opt_val[21]; ?>" size="10">
241
  </p>
242
 
243
- <h3><?php _e("POPUP ASPECT","itro-plugin")?></h3>
244
 
245
  <!-- popup width !-->
246
  <div style="display:table; height:10px; padding-bottom:5px;">
@@ -304,9 +312,9 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
304
 
305
  <!-- background image !-->
306
  <p><?php _e("BACKGROUND IMAGE",'itro-plugin');?></p>
307
- <a href="<?php if ( itro_get_option('background_source') == NULL ) {echo '#' . $opt_name[22];} else { echo itro_get_option('background_source'); }?>"><?php _e('Show image','itro-plugin')?></a>
308
 
309
- <input type="radio" name="<?php echo $opt_name[22];?>" value="" <?php if($opt_val[22]== 'no' || $opt_val[22]== NULL ){echo 'checked="checked"';} ?>/>
310
  <?php _e("No background",'itro-plugin');?><br>
311
  <input type="radio" id="yes_bg" name="<?php echo $opt_name[22];?>" value="yes" <?php if( $opt_val[22]== 'yes' ){echo 'checked="checked"';} ?>/>
312
  <input class="upload" onClick="select(); document.getElementById('yes_bg').checked=true" type="text" name="background_source" size="50" value="<?php echo itro_get_option('background_source'); ?>" />
@@ -373,6 +381,21 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
373
  <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>
374
  </select>
375
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  </div>
377
 
378
  </div>
@@ -414,7 +437,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
414
 
415
  <div id="<?php echo $opt_name[6] . '_advanced_2'; ?>">
416
  <p><?php _e("Leave button background color:", 'itro-plugin' ); ?>
417
- <input type="text" name="<?php echo $opt_name[12]; ?>" value="<?php echo $opt_val[12]; ?>" size="10">
418
  </p>
419
  <p><?php _e("Leave button border color:", 'itro-plugin' ); ?>
420
  <input type="text" class="color" name="<?php echo $opt_name[13]; ?>" value="<?php echo $opt_val[13]; ?>" size="10">
@@ -431,7 +454,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
431
  <hr>
432
  <p class="submit">
433
  <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />&nbsp;&nbsp;&nbsp;&nbsp;
434
- <input type="button" target="_blank" class="button" onClick="window.open('<?php echo get_site_url() . '/?page_id=' . itro_get_option('preview_id'); ?>')" value="<?php echo _e('Preview page','itro-plugin' )?>">
435
  </p>
436
  </div>
437
 
@@ -439,7 +462,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
439
  <!-- A simple not annoying banner, please do not remove, we use it to quickly comunicate with you about premium and free! !-->
440
  <p class="wpstyle" onClick="jQuery('#premium_ads').toggle('blind');"><?php _e('ITRO Popup messages', 'itro-plugin'); ?> </p>
441
  <div id="premium_ads" style="text-align: center;">
442
- <a target="_blank" href="http://www.itro.eu"><img title="TRY IT FOR FREE!!!" src="http://www.itroteam.com/plugins/premium_banner.png"></a>
443
  </div>
444
 
445
  <input type="hidden" name="<?php echo $submitted_form; ?>" value="Y">
@@ -447,19 +470,18 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
447
  <p class="wpstyle" onClick="jQuery('#customHtmlForm').toggle();"><?php _e("Your text (or HTML code):", 'itro-plugin' ); ?> </p>
448
  <div id="customHtmlForm">
449
  <?php
450
- $content = stripslashes($field_value[0]);
451
  wp_editor( $content, 'custom_html', array('textarea_name'=> 'custom_html','teeny'=>false, 'media_buttons'=>true, 'wpautop'=>false ) ); ?>
452
  <br><br>
453
  <hr>
454
  <p class="submit">
455
  <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />&nbsp;&nbsp;&nbsp;&nbsp;
456
- <input type="button" target="_blank" class="button" onClick="window.open('<?php echo get_site_url() . '/?page_id=' . itro_get_option('preview_id'); ?>')" value="<?php echo _e('Preview page','itro-plugin' )?>">
457
  </p>
458
  </div>
459
  </div>
460
  </form>
461
  <div id="rightColumn2">
462
- <!-- Donation form - please don't change or remove!!! thanks !-->
463
  <div id="donateForm">
464
  <h3><?php _e("Like it? Offer us a coffee! ;-)","itro-plugin")?> <img width="35px" src="<?php echo itroImages . 'coffee.png';?>"></h3>
465
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
@@ -470,12 +492,13 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
470
  </form>
471
  </div>
472
  <p class="wpstyle" onClick="jQuery('#debug_info').toggle();"><?php _e("System Status", 'itro-plugin' ); ?> </p>
473
- <form method="POST" action="" id="debug_info" style="display:none;">
474
  <?php echo itro_get_serverinfo(); ?>
475
- </form>
476
  </div>
477
 
478
  <form id="delete_data" method="post" style="clear:both;">
 
479
  <br>
480
  <hr>
481
  <input type="hidden" name="delete_data_hidden" value="Y">
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
7
+
8
  global $ITRO_VER;
9
 
10
  if ( !current_user_can( 'manage_options' ) ) {
49
  /*opt 32*/'disable_mobile',
50
  /*opt 33*/'cross_selected',
51
  /*opt 34*/'enter_button_url',
52
+ /*opt 35*/'absolute_mobile_pos',
53
+ /*opt 36*/'countdown_text'
54
  );
55
+
 
 
56
  $submitted_form = 'mt_submit_hidden';
57
  }
58
 
59
  /* ordered options */
60
  for($i=0;$i<count($opt_name); $i++)
61
  {
 
 
 
 
 
62
  /* See if the user has posted us some information */
63
  /* If they did, this hidden field will be set to 'Y' */
64
  if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
65
+ {
66
+ // wp token check
67
+ check_admin_referer('ipp_save_data','ipp_sec_nonce_fld');
68
+
69
  /* Read their posted value */
70
+ if(isset($_POST[$opt_name[$i]])){
71
+ $opt_val[$i] = ipp_validate_data($opt_name[$i], $_POST[$opt_name[$i]]);
72
+ }else{
73
+ $opt_val[$i] = NULL;
74
+ }
75
 
76
  /* Save the posted value in the database */
77
  itro_update_option( $opt_name[$i], $opt_val[$i] );
80
  {
81
  itro_update_option( 'select_' . $opt_name[$i], $_POST['select_' . $opt_name[$i]] );
82
 
83
+ $px_opt_val[$i] = ipp_validate_data('px_' . $opt_name[$i], $_POST['px_' . $opt_name[$i]]);
84
  itro_update_option( 'px_' . $opt_name[$i], $_POST['px_' . $opt_name[$i]] );
85
+ $perc_opt_val[$i] = ipp_validate_data('perc_' . $opt_name[$i], $_POST['perc_' . $opt_name[$i]]);
86
  itro_update_option( 'perc_' . $opt_name[$i], $_POST['perc_' . $opt_name[$i]] );
87
  }
88
  else{ itro_update_option( 'select_' . $opt_name[$i], NULL ); }
89
+ }else{
90
+ /* Read in existing option value from database */
91
+ $opt_val[$i] = itro_get_option( $opt_name[$i] );
92
+ $px_opt_val[$i] = itro_get_option( 'px_' . $opt_name[$i] );
93
+ $perc_opt_val[$i] = itro_get_option( 'perc_' . $opt_name[$i] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
95
  }
96
 
97
  /* unsorted option and field */
98
  if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
99
  {
100
+ //wp token check
101
+ check_admin_referer('ipp_save_data','ipp_sec_nonce_fld');
102
+
103
+ //WP Editor content
104
+ if(isset($_POST['custom_html'])){
105
+ $field_value = wp_kses_post($_POST['custom_html']);
106
+ }else{
107
+ $field_value = NULL;
108
+ }
109
+
110
+ /* Save the posted value in the database */
111
+ itro_update_field( 'custom_html', $field_value );
112
+
113
+
114
  if( isset($_POST['selected_page_id']) )
115
  {
116
  $selected_page_id=json_encode($_POST['selected_page_id']);
121
  itro_update_option('selected_page_id',NULL);
122
  }
123
 
124
+ if( !empty($_POST['background_source']) ){
125
+ itro_update_option('background_source',$_POST['background_source']);
126
+ }
127
+ }else{
128
+ //WP Editor Content
129
+ $field_value = stripslashes(itro_get_field( 'custom_html' ));
130
  }
131
 
132
  /* delete tables on plugin uninstall option */
133
  if( isset($_POST['delete_data_hidden']) && $_POST['delete_data_hidden'] == 'Y' )
134
  {
135
+ // wp token check
136
+ check_admin_referer('ipp_save_data','ipp_cleardb_nonce_fld');
137
  if( isset($_POST['delete_data']) )
138
  {
139
  itro_update_option('delete_data', $_POST['delete_data']);
159
  </div>
160
 
161
  <form id="optionForm" method="post">
162
+ <?php wp_nonce_field('ipp_save_data', 'ipp_sec_nonce_fld'); ?>
163
  <div id="leftColumn">
164
  <!-- Settings form !-->
165
  <div id="formContainer">
198
  </div>
199
  </p>
200
 
201
+ <!-- disable esc key !-->
202
  <h3><?php _e("GENERAL SETTINGS","itro-plugin")?></h3>
203
  <p id="<?php echo $opt_name[24]; ?>_div">
 
 
 
 
204
  <input type="checkbox" id="<?php echo $opt_name[24]; ?>" name="<?php echo $opt_name[24]; ?>" value="yes" <?php if($opt_val[24] == 'yes' ){echo 'checked="checked"';} ?> />
205
+ <span onclick="itro_mutual_check('<?php echo $opt_name[24]; ?>','','')"><?php _e("Disable easy closing", 'itro-plugin' ); ?></span>
206
+ <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>"title="<?php _e('If you set this option, popup can not be closed with ESC button of keyboard or clicking outside the popup.','itro-plugin');?>" >
207
  </p>
208
 
209
  <!-- popup seconds!-->
238
  <input type="checkbox" name="<?php echo $opt_name[29]; ?>" id="<?php echo $opt_name[29]; ?>" value="yes" <?php if(itro_get_option($opt_name[29])=='yes' ){echo 'checked="checked"';} ?> />&nbsp;&nbsp;
239
  <span onclick="itro_mutual_check('<?php echo $opt_name[29]; ?>','','')"><?php _e("Show countdown", 'itro-plugin' ); ?></span>
240
  <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e('Show the countdown at the bottom of the popup which dispay the time before popup will close. If is hidden, it run anyway.','itro-plugin');?>" >
241
+ <br>
242
+ <?php _e("Countdown text:", 'itro-plugin' ); ?>
243
+ <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e('Countdown text at the bottom border of the popup','itro-plugin');?>" >
244
+ <input type="text" placeholder="This popup will close in:" name="<?php echo $opt_name[36]; ?>" value="<?php echo $opt_val[36]; ?>" size="40">
245
+ <br>
246
  <?php _e("Countdown font color:", 'itro-plugin' ); ?>
247
  <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e('Select the countdown font color.','itro-plugin');?>" >
248
  <input type="text" class="color" name="<?php echo $opt_name[21]; ?>" value="<?php echo $opt_val[21]; ?>" size="10">
249
  </p>
250
 
251
+ <h3><?php _e("POPUP ASPECT","itro-plugin")?></h3>
252
 
253
  <!-- popup width !-->
254
  <div style="display:table; height:10px; padding-bottom:5px;">
312
 
313
  <!-- background image !-->
314
  <p><?php _e("BACKGROUND IMAGE",'itro-plugin');?></p>
315
+ <a href="<?php if ( itro_get_option('background_source') == NULL ) {echo '#';} else { echo itro_get_option('background_source'); }?>"><?php _e('Show image','itro-plugin')?></a>
316
 
317
+ <input type="radio" name="<?php echo $opt_name[22];?>" value="" <?php if($opt_val[22]== 'no' || $opt_val[22] == NULL ){echo 'checked="checked"';} ?>/>
318
  <?php _e("No background",'itro-plugin');?><br>
319
  <input type="radio" id="yes_bg" name="<?php echo $opt_name[22];?>" value="yes" <?php if( $opt_val[22]== 'yes' ){echo 'checked="checked"';} ?>/>
320
  <input class="upload" onClick="select(); document.getElementById('yes_bg').checked=true" type="text" name="background_source" size="50" value="<?php echo itro_get_option('background_source'); ?>" />
381
  <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>
382
  </select>
383
  </p>
384
+
385
+ <!-- RESPONSIVE SETTINGS -->
386
+ <h3><?php _e("RESPONSIVE SETTINGS","itro-plugin")?></h3>
387
+ <p>
388
+ <!-- disable on mobile -->
389
+ <input type="checkbox" id="<?php echo $opt_name[32]; ?>" name="<?php echo $opt_name[32]; ?>" value="yes" <?php if($opt_val[32] == 'yes' ){echo 'checked="checked"';} ?> />
390
+ <span onclick="itro_mutual_check('<?php echo $opt_name[32]; ?>','','')"><?php _e("Disable on mobile device", 'itro-plugin' ); ?></span>
391
+ <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>"title="<?php _e('Check this to disable popup on mobile devices','itro-plugin');?>" >
392
+ &nbsp;&nbsp;&nbsp;&nbsp;
393
+ <!-- absolute position for mobile -->
394
+ <input type="checkbox" id="<?php echo $opt_name[35]; ?>" name="<?php echo $opt_name[35]; ?>" value="yes" <?php if($opt_val[35] == 'yes' ){echo 'checked="checked"';} ?> />
395
+ <span onclick="itro_mutual_check('<?php echo $opt_name[35]; ?>','','')"><?php _e("Absolute position for mobile", 'itro-plugin' ); ?></span>
396
+ <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>"title="<?php _e('Set an absolute position for the pop-up. It is useful for mobile devices if your popup is too high','itro-plugin');?>" >
397
+
398
+ </p>
399
  </div>
400
 
401
  </div>
437
 
438
  <div id="<?php echo $opt_name[6] . '_advanced_2'; ?>">
439
  <p><?php _e("Leave button background color:", 'itro-plugin' ); ?>
440
+ <input type="text" class="color" name="<?php echo $opt_name[12]; ?>" value="<?php echo $opt_val[12]; ?>" size="10">
441
  </p>
442
  <p><?php _e("Leave button border color:", 'itro-plugin' ); ?>
443
  <input type="text" class="color" name="<?php echo $opt_name[13]; ?>" value="<?php echo $opt_val[13]; ?>" size="10">
454
  <hr>
455
  <p class="submit">
456
  <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />&nbsp;&nbsp;&nbsp;&nbsp;
457
+ <input type="button" target="_blank" class="button" onClick="window.open('<?php echo get_site_url() . '/?itro_preview=yes'?>')" value="<?php echo _e('Preview page','itro-plugin' )?>">
458
  </p>
459
  </div>
460
 
462
  <!-- A simple not annoying banner, please do not remove, we use it to quickly comunicate with you about premium and free! !-->
463
  <p class="wpstyle" onClick="jQuery('#premium_ads').toggle('blind');"><?php _e('ITRO Popup messages', 'itro-plugin'); ?> </p>
464
  <div id="premium_ads" style="text-align: center;">
465
+ <a target="_blank" href="http://www.itroteam.com"><img title="TRY IT FOR FREE!!!" src="https://www.itroteam.com/plugins/premium_banner.png"></a>
466
  </div>
467
 
468
  <input type="hidden" name="<?php echo $submitted_form; ?>" value="Y">
470
  <p class="wpstyle" onClick="jQuery('#customHtmlForm').toggle();"><?php _e("Your text (or HTML code):", 'itro-plugin' ); ?> </p>
471
  <div id="customHtmlForm">
472
  <?php
473
+ $content = $field_value;
474
  wp_editor( $content, 'custom_html', array('textarea_name'=> 'custom_html','teeny'=>false, 'media_buttons'=>true, 'wpautop'=>false ) ); ?>
475
  <br><br>
476
  <hr>
477
  <p class="submit">
478
  <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />&nbsp;&nbsp;&nbsp;&nbsp;
479
+ <input type="button" target="_blank" class="button" onClick="window.open('<?php echo get_site_url() . '/?itro_preview=yes'?>')" value="<?php echo _e('Preview page','itro-plugin' )?>">
480
  </p>
481
  </div>
482
  </div>
483
  </form>
484
  <div id="rightColumn2">
 
485
  <div id="donateForm">
486
  <h3><?php _e("Like it? Offer us a coffee! ;-)","itro-plugin")?> <img width="35px" src="<?php echo itroImages . 'coffee.png';?>"></h3>
487
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
492
  </form>
493
  </div>
494
  <p class="wpstyle" onClick="jQuery('#debug_info').toggle();"><?php _e("System Status", 'itro-plugin' ); ?> </p>
495
+ <div method="POST" action="" id="debug_info" style="display:none;">
496
  <?php echo itro_get_serverinfo(); ?>
497
+ </div>
498
  </div>
499
 
500
  <form id="delete_data" method="post" style="clear:both;">
501
+ <?php wp_nonce_field('ipp_save_data', 'ipp_cleardb_nonce_fld'); ?>
502
  <br>
503
  <hr>
504
  <input type="hidden" name="delete_data_hidden" value="Y">
css/itro-admin-style.css CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  /* Admin pages styles */
2
  .wpstyle
3
  {
1
+ /*
2
+ This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
3
+ */
4
+
5
  /* Admin pages styles */
6
  .wpstyle
7
  {
css/itro-style-functions.php CHANGED
@@ -1,10 +1,18 @@
1
  <?php
2
  /*
3
- Copyright 2013 I.T.RO.® (email : support.itro@live.com)
4
- This file is part of ITRO Popup Plugin.
5
  */
 
 
 
6
  function itro_style() { ?>
7
  <style>
 
 
 
 
 
 
8
  #age_button_area
9
  {
10
  padding-top:10px;
@@ -43,12 +51,12 @@ function itro_style() { ?>
43
  #itro_popup
44
  {
45
  position: <?php echo itro_get_option('popup_position');?>;
46
- background-image: <?php if (itro_get_option('background_select') != NULL ) { echo 'url("' . itro_get_option('background_source') . '");'; } ?>
47
  background-repeat: no-repeat;
48
  background-position: center center;
49
  margin: 0 auto;
50
- left:30px;
51
- right:30px;
52
  z-index: 2147483647 !important;
53
  <?php if( itro_get_option('popup_padding') != NULL ) { echo 'padding:' . itro_get_option('popup_padding') . 'px !important;'; }?>
54
  <?php
@@ -119,7 +127,52 @@ function itro_style() { ?>
119
  bottom: 0px;
120
  opacity: <?php echo itro_get_option('popup_bg_opacity'); ?> ;
121
  filter:alpha(opacity = <?php echo ( itro_get_option('popup_bg_opacity') * 100); ?>); /* For IE8 and earlier */
122
- }<?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
  if( itro_get_option('disable_mobile') == 'yes' )
125
  {
@@ -129,7 +182,9 @@ function itro_style() { ?>
129
  #itro_popup{display: none !important;}
130
  #itro_opaco{display: none !important;}
131
  }';
132
- }?>
 
 
133
  </style>
134
  <?php
135
  }
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
7
+
8
  function itro_style() { ?>
9
  <style>
10
+ /* General styling to prevent white spaces or unwanted visual results */
11
+ p{
12
+ margin-bottom: 0px;
13
+ }
14
+
15
+ /* POP-UP */
16
  #age_button_area
17
  {
18
  padding-top:10px;
51
  #itro_popup
52
  {
53
  position: <?php echo itro_get_option('popup_position');?>;
54
+ background-image: <?php if( itro_get_option('background_select') != NULL ) { echo 'url("' . itro_get_option('background_source') . '");'; } ?>
55
  background-repeat: no-repeat;
56
  background-position: center center;
57
  margin: 0 auto;
58
+ left:1px;
59
+ right:1px;
60
  z-index: 2147483647 !important;
61
  <?php if( itro_get_option('popup_padding') != NULL ) { echo 'padding:' . itro_get_option('popup_padding') . 'px !important;'; }?>
62
  <?php
127
  bottom: 0px;
128
  opacity: <?php echo itro_get_option('popup_bg_opacity'); ?> ;
129
  filter:alpha(opacity = <?php echo ( itro_get_option('popup_bg_opacity') * 100); ?>); /* For IE8 and earlier */
130
+ }
131
+
132
+ /* label under the popup used to close it for mobile devices */
133
+ #ipp_mobile_close_tab{
134
+ display: none;
135
+ border:none;
136
+ position: absolute;
137
+ padding: 5px;
138
+ width: 80px;
139
+ text-align: center;
140
+ left: 1px;
141
+ right: 1px;
142
+ margin: auto;
143
+ background-color: <?php echo (itro_get_option('popup_border_color') != NULL ? itro_get_option('popup_border_color') : 'white' ); ?>
144
+ }
145
+ #ipp_mobile_close_txt{
146
+ font-weight: bold;
147
+ cursor: pointer;
148
+ }
149
+
150
+ /* RESPONSIVE CSS */
151
+ @media screen and (max-width: 780px)
152
+ {
153
+ #itro_popup{
154
+ max-width: 470px;
155
+ <?php
156
+
157
+ if(itro_get_option('absolute_mobile_pos') == 'yes'){
158
+ echo "position: absolute; top: 50px";
159
+ }
160
+ ?>
161
+ }
162
+ #close_cross{
163
+ display: none;
164
+ }
165
+ #ipp_mobile_close_tab{
166
+ display: block;
167
+ }
168
+ }
169
+ @media screen and (max-width: 480px){
170
+ #itro_popup{
171
+ max-width: 300px
172
+ }
173
+ }
174
+
175
+ <?php
176
 
177
  if( itro_get_option('disable_mobile') == 'yes' )
178
  {
182
  #itro_popup{display: none !important;}
183
  #itro_opaco{display: none !important;}
184
  }';
185
+ }
186
+
187
+ ?>
188
  </style>
189
  <?php
190
  }
functions/core-function.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /*
3
- Copyright 2013 I.T.RO.® (email : support.itro@live.com)
4
- This file is part of ITRO Popup Plugin.
5
  */
 
 
 
6
  /* ------------------ADD MENU PAGE */
7
  function itro_plugin_menu() {
8
  add_options_page( 'Popup Plugin Options', 'ITRO Popup', 'manage_options', 'itro-popup/admin/popup-admin.php', '' );
@@ -19,6 +21,7 @@ function itro_init()
19
  itro_db_init();
20
 
21
  itro_update_option('popup_time',20);
 
22
  itro_update_option('cookie_time_exp',0);
23
  itro_update_option('popup_background','#FFFFFF');
24
  itro_update_option('popup_border_color','#F7FF00');
@@ -28,7 +31,7 @@ function itro_init()
28
  itro_update_option('auto_margin_check','yes');
29
  itro_update_option('select_popup_width','px');
30
  itro_update_option('select_popup_height','auto');
31
- itro_update_option('popup_bg_opacity',0.4);
32
  itro_update_option('opaco_bg_color','#8A8A8A');
33
  itro_update_option('popup_position','fixed');
34
  itro_update_option('popup_border_width',3);
@@ -51,34 +54,6 @@ function itro_init()
51
 
52
  itro_update_option('sample_popup','done');
53
  }
54
-
55
- /* ---------------create preview page */
56
- switch(WPLANG)
57
- {
58
- case 'en_US':
59
- $preview_text = 'ITRO - Preview page. This page is used to rightly display preview of your popup with site theme.';
60
- break;
61
- case 'it_IT':
62
- $preview_text = 'ITRO - Pagina di anteprima. Questa pagina &egrave; utilizzata per visualizzare correttamente il popup, integrato con lo stile del tema.';
63
- break;
64
- default:
65
- $preview_text = 'ITRO - Preview page. This page is used to rightly display preview of your popup with site theme.';
66
- }
67
- if ( itro_get_option('preview_id') == NULL )
68
- {
69
- /* Create post object */
70
- $preview_post = array(
71
- 'post_title' => 'ITRO - Preview',
72
- 'post_name' => 'itro-preview',
73
- 'post_content' => $preview_text,
74
- 'post_status' => 'private',
75
- 'post_author' => 1,
76
- 'post_type' => 'page',
77
- );
78
- /* Insert the post into the database */
79
- @$preview_id = wp_insert_post( $preview_post );
80
- itro_update_option('preview_id',$preview_id);
81
- }
82
  }
83
 
84
  /* --------------------------CHECK THE PLUGIN VERSION */
@@ -100,7 +75,23 @@ function itro_check_ver()
100
  /* --------------------------DISPLAY THE POPUP */
101
  function itro_display_popup()
102
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  /* woocommerce shop page identification */
 
 
104
  if( function_exists('is_shop') && function_exists('woocommerce_get_page_id') ) /* if this functions exist, woocommerce is installed! */
105
  {
106
  if ( is_shop() ) /* if the actual page is the standard woocommerce shop page */
@@ -108,20 +99,17 @@ function itro_display_popup()
108
  $woo_shop = true;
109
  $woo_shop_id = woocommerce_get_page_id( 'shop' );
110
  }
111
- }
112
- else
113
- {
114
- $woo_shop = NULL;
115
- $woo_shop_id = NULL;
116
  }
117
 
118
  /* this condition, control if the popup must or not by displayed in a specified page */
119
  $selected_page_id = json_decode(itro_get_option('selected_page_id'));
120
  $id_match = NULL;
 
121
  /* get the page id */
122
  global $wp_query;
123
  $current_page_id = $wp_query->get_queried_object_id();
124
-
 
125
  switch (itro_get_option('page_selection'))
126
  {
127
  case 'some':
@@ -139,21 +127,24 @@ function itro_display_popup()
139
  {
140
  $id_match++;
141
  }
142
- if( $id_match != NULL || itro_get_option('preview_id') == $current_page_id )
143
  {
 
144
  itro_style();
145
  itro_popup_template();
146
  itro_popup_js();
147
  }
148
  break;
149
  case 'all':
 
150
  itro_style();
151
  itro_popup_template();
152
  itro_popup_js();
153
  break;
154
  case 'none':
155
- if( itro_get_option('preview_id') == $current_page_id )
156
  {
 
157
  itro_style();
158
  itro_popup_template();
159
  itro_popup_js();
@@ -178,6 +169,7 @@ function itro_check_selected_id($id_to_check)
178
  }
179
  }
180
 
 
181
  function itro_list_pages()
182
  {?>
183
  <select name="selected_page_id[]" multiple>
@@ -197,6 +189,125 @@ function itro_list_pages()
197
  <?php
198
  }
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  /* ------------------------- DEBUG INFORMATION ON ADMIN PANNEL */
201
  function itro_get_serverinfo()
202
  {
@@ -331,8 +442,6 @@ function itro_get_serverinfo()
331
  } while(0); // control structure for use with break
332
  $nonce = wp_create_nonce('itro-debug-nonce');
333
  $buf = '<textarea style="width:100%; height:400px; resize:none;" onclick="select();">' . $mail_text . '</textarea>';
334
- //'<input name="itro_debug_send_email" type="text" value="" placeholder="' . __( "E-mail debug information", 'itro-plugin' ) . '"><input name="itro_debug_nonce" type="hidden" value="' .
335
- //$nonce . '"><input name="itro_debug_submit" type="submit" value="' . __( 'Submit', 'itro-plugin' ) . '" class="button-primary"><p>';
336
  return $buf;
337
  }
338
  ?>
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
7
+
8
  /* ------------------ADD MENU PAGE */
9
  function itro_plugin_menu() {
10
  add_options_page( 'Popup Plugin Options', 'ITRO Popup', 'manage_options', 'itro-popup/admin/popup-admin.php', '' );
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');
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);
54
 
55
  itro_update_option('sample_popup','done');
56
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
  /* --------------------------CHECK THE PLUGIN VERSION */
75
  /* --------------------------DISPLAY THE POPUP */
76
  function itro_display_popup()
77
  {
78
+ global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
79
+
80
+ //if a shortcode was fired it stop everything
81
+ if($popup_fired === true){
82
+ return;
83
+ }
84
+
85
+ /* check if it is the preview visualization */
86
+ if(!empty($_GET['itro_preview']) && $_GET['itro_preview']=='yes' && is_user_logged_in() ){
87
+ $is_preview = true;
88
+ }else {
89
+ $is_preview = false;
90
+ }
91
+
92
  /* woocommerce shop page identification */
93
+ $woo_shop = NULL;
94
+ $woo_shop_id = NULL;
95
  if( function_exists('is_shop') && function_exists('woocommerce_get_page_id') ) /* if this functions exist, woocommerce is installed! */
96
  {
97
  if ( is_shop() ) /* if the actual page is the standard woocommerce shop page */
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
  switch (itro_get_option('page_selection'))
114
  {
115
  case 'some':
127
  {
128
  $id_match++;
129
  }
130
+ if( $id_match != NULL || $is_preview )
131
  {
132
+ $popup_fired = true;
133
  itro_style();
134
  itro_popup_template();
135
  itro_popup_js();
136
  }
137
  break;
138
  case 'all':
139
+ $popup_fired = true;
140
  itro_style();
141
  itro_popup_template();
142
  itro_popup_js();
143
  break;
144
  case 'none':
145
+ if( $is_preview )
146
  {
147
+ $popup_fired = true;
148
  itro_style();
149
  itro_popup_template();
150
  itro_popup_js();
169
  }
170
  }
171
 
172
+
173
  function itro_list_pages()
174
  {?>
175
  <select name="selected_page_id[]" multiple>
189
  <?php
190
  }
191
 
192
+ /**
193
+ * Sanitize data of popup options and custom content
194
+ *
195
+ * @since 4.10
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
+ function ipp_validate_data($data_name, $data){
205
+ switch ($data_name){
206
+ case 'popup_time':
207
+ case 'popup_delay':
208
+ case 'popup_padding':
209
+ case 'popup_border_width':
210
+ case 'popup_border_radius':
211
+ case 'popup_top_margin':
212
+ case 'cookie_time_exp':
213
+ case 'px_popup_width':
214
+ case 'px_popup_height':
215
+ case 'perc_popup_width':
216
+ case 'perc_popup_height':
217
+ $data = intval($data);
218
+ break;
219
+ case 'enter_button_url':
220
+ case 'leave_button_url':
221
+ case 'background_source':
222
+ $data = esc_url_raw($data);
223
+ break;
224
+ case 'auto_margin_check':
225
+ case 'advanced_settings':
226
+ case 'show_countdown':
227
+ case 'popup_unlockable':
228
+ case 'disable_mobile':
229
+ case 'absolute_mobile_pos':
230
+ case 'blog_home':
231
+ case 'age_restriction':
232
+ case 'background_select':
233
+ case 'delete_data':
234
+ $data = ($data != 'yes' ? NULL : $data );
235
+ break;
236
+ case 'page_selection':
237
+ if(!in_array($data, array('some','all','none'))){
238
+ $data = 'none';
239
+ }
240
+ break;
241
+ case 'countdown_text':
242
+ case 'enter_button_text':
243
+ case 'leave_button_text':
244
+ $data = sanitize_text_field($data);
245
+ break;
246
+ case 'custom_html':
247
+ $data = wp_kses_post($data);
248
+ break;
249
+ case 'enter_button_bg_color':
250
+ case 'enter_button_border_color':
251
+ case 'leave_button_bg_color':
252
+ case 'leave_button_border_color':
253
+ case 'enter_button_font_color':
254
+ case 'leave_button_font_color':
255
+ case 'popup_border_color':
256
+ case 'opaco_bg_color':
257
+ case 'popup_background':
258
+ case 'count_font_color':
259
+ if(preg_match("/^#[0-9a-fA-F]{6}$/", $data) !== 1){
260
+ $data = NULL;
261
+ }
262
+ break;
263
+ case 'popup_bg_opacity';
264
+ if(preg_match("/^[0-1]\.[0-9]{2}$/", $data) !== 1){
265
+ $data = '0.40';
266
+ }
267
+ break;
268
+ case 'cross_selected':
269
+ if(!in_array($data, array('white','black','white_border'))){
270
+ $data = 'black';
271
+ }
272
+ break;
273
+ case 'popup_position':
274
+ if(!in_array($data, array('fixed','absolute'))){
275
+ $data = 'absolute';
276
+ }
277
+ break;
278
+ case 'select_popup_width':
279
+ case 'select_popup_height':
280
+ if(!in_array($data, array('perc','px'))){
281
+ $data = 'px';
282
+ }
283
+ break;
284
+ default:
285
+ $data = NULL;
286
+ }
287
+ return $data;
288
+ }
289
+
290
+ /**
291
+ * Shortcode for popup appearing
292
+ *
293
+ * @since 4.9
294
+ *
295
+ */
296
+
297
+ function itro_popup_shortcode(){
298
+ global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
299
+ $popup_fired = true;
300
+
301
+ ob_start();
302
+
303
+ itro_style();
304
+ itro_popup_template();
305
+ itro_popup_js();
306
+
307
+ return ob_get_clean();
308
+ }
309
+ add_shortcode('itroshowpopup', 'itro_popup_shortcode');
310
+
311
  /* ------------------------- DEBUG INFORMATION ON ADMIN PANNEL */
312
  function itro_get_serverinfo()
313
  {
442
  } while(0); // control structure for use with break
443
  $nonce = wp_create_nonce('itro-debug-nonce');
444
  $buf = '<textarea style="width:100%; height:400px; resize:none;" onclick="select();">' . $mail_text . '</textarea>';
 
 
445
  return $buf;
446
  }
447
  ?>
functions/database-function.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /*
3
- Copyright 2013 I.T.RO.® (email : support.itro@live.com)
4
- This file is part of ITRO Popup Plugin.
5
  */
 
 
6
  global $wpdb;
7
  define ('OPTION_TABLE_NAME', $wpdb->prefix . 'itro_plugin_option');
8
  define ('FIELD_TABLE_NAME', $wpdb->prefix . 'itro_plugin_field');
@@ -51,12 +52,27 @@ function itro_update_db()
51
  $wpdb->query("RENAME TABLE wp_itro_plugin_option TO ". $wpdb->prefix ."itro_plugin_option");
52
  $wpdb->query("RENAME TABLE wp_itro_plugin_field TO ". $wpdb->prefix ."itro_plugin_field");
53
  }
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
 
56
  /* ------------------ PLUGIN OPTION DB MANAGEMENT -------------- */
57
  function itro_update_option($opt_name,$opt_val)
58
  {
59
  global $wpdb;
 
 
 
60
  $option_table_name = OPTION_TABLE_NAME;
61
  $data_to_send = array('option_val'=> $opt_val);
62
  $where_line = array('option_name' => $opt_name);
@@ -81,8 +97,11 @@ function itro_get_option($opt_name)
81
  {
82
  $opt_val = $pippo->option_val;
83
  }
84
- if(isset($opt_val)) {return ($opt_val);}
85
- else {return (NULL);}
 
 
 
86
  }
87
 
88
  /* ------------------ CUSTOM FIELD CONTENT DB MANAGEMENT -------------- */
@@ -113,7 +132,11 @@ function itro_get_field($field_name)
113
  {
114
  $field_value = $pippo->field_value;
115
  }
116
- if(isset($field_value)) {return ($field_value);}
117
- else {return (NULL);}
 
 
 
 
118
  }
119
  ?>
1
  <?php
2
  /*
3
+ This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
 
4
  */
5
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
+
7
  global $wpdb;
8
  define ('OPTION_TABLE_NAME', $wpdb->prefix . 'itro_plugin_option');
9
  define ('FIELD_TABLE_NAME', $wpdb->prefix . 'itro_plugin_field');
52
  $wpdb->query("RENAME TABLE wp_itro_plugin_option TO ". $wpdb->prefix ."itro_plugin_option");
53
  $wpdb->query("RENAME TABLE wp_itro_plugin_field TO ". $wpdb->prefix ."itro_plugin_field");
54
  }
55
+
56
+ if( get_option('itro_prev_ver') <= 4.7 )
57
+ {
58
+ /* delete the obsolete and useless preview post */
59
+ if(itro_get_option('preview_id') != NULL){
60
+ wp_delete_post(itro_get_option('preview_id'), true);
61
+ }
62
+ }
63
+ if( get_option('itro_prev_ver') <= 4.91 )
64
+ {
65
+ itro_update_option('countdown_text', 'This popup will close in:');
66
+ }
67
  }
68
 
69
  /* ------------------ PLUGIN OPTION DB MANAGEMENT -------------- */
70
  function itro_update_option($opt_name,$opt_val)
71
  {
72
  global $wpdb;
73
+
74
+ $opt_val = ipp_validate_data($opt_name, $opt_val);
75
+
76
  $option_table_name = OPTION_TABLE_NAME;
77
  $data_to_send = array('option_val'=> $opt_val);
78
  $where_line = array('option_name' => $opt_name);
97
  {
98
  $opt_val = $pippo->option_val;
99
  }
100
+ if(isset($opt_val)){
101
+ return ipp_validate_data($opt_name, $opt_val);
102
+ }else{
103
+ return (NULL);
104
+ }
105
  }
106
 
107
  /* ------------------ CUSTOM FIELD CONTENT DB MANAGEMENT -------------- */
132
  {
133
  $field_value = $pippo->field_value;
134
  }
135
+
136
+ if(isset($field_value)){
137
+ return ipp_validate_data($field_name, $field_value);
138
+ }else{
139
+ return (NULL);
140
+ }
141
  }
142
  ?>
functions/js-function.php CHANGED
@@ -1,19 +1,24 @@
1
  <?php
2
  /*
3
- Copyright 2013 I.T.RO.® (email : support.itro@live.com)
4
- This file is part of ITRO Popup Plugin.
5
  */
 
6
 
7
  /* ------------ LOAD SCRIPTS FOR POPUP VISUALIZATION */
8
  function itro_popup_js()
9
- { ?>
 
 
 
 
 
 
 
10
  <script type="text/javascript">
11
  /* init var */
12
  itro_cookie_expiration = <?php echo itro_get_option('cookie_time_exp'); ?>;
13
- itro_is_preview = <?php if ( itro_get_option('preview_id') == get_the_id() ){echo 'true';}else{ echo 'false'; } ?>;
14
-
15
- /* pass true if is the preview page. used for cookie control via js due W3 total cache or similar */
16
- itro_is_preview = <?php if( itro_get_option('preview_id') == get_the_id() ){ echo 'true'; }else{ echo 'false'; } ?>;
17
  <?php
18
  if (itro_get_option('age_restriction') == NULL) /* OFF age validation */
19
  {
@@ -26,7 +31,7 @@ function itro_popup_js()
26
  var key = event.keyCode;
27
  if(key==27)
28
  {
29
- jQuery("#itro_popup").fadeOut(function() {itro_opaco.style.visibility='Hidden';});
30
  }
31
  }; <?php
32
  }
@@ -79,7 +84,7 @@ function itro_popup_js()
79
  if( itro_get_option('auto_margin_check') != NULL )
80
  {?>
81
  var browserWidth = 0, browserHeight = 0;
82
- setInterval(function(){marginRefresh()},100); /* refresh every 0.1 second the popup top margin (needed for browser window resizeing) */
83
  <?php
84
  }?>
85
  </script>
1
  <?php
2
  /*
3
+ This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
 
4
  */
5
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
 
7
  /* ------------ LOAD SCRIPTS FOR POPUP VISUALIZATION */
8
  function itro_popup_js()
9
+ {
10
+ /* check if it is the preview visualization */
11
+ if(!empty($_GET['itro_preview']) && $_GET['itro_preview']=='yes' && is_user_logged_in() ){
12
+ $is_preview = 'true';
13
+ }else {
14
+ $is_preview = 'false';
15
+ }
16
+ ?>
17
  <script type="text/javascript">
18
  /* init var */
19
  itro_cookie_expiration = <?php echo itro_get_option('cookie_time_exp'); ?>;
20
+ itro_is_preview = <?php echo $is_preview; ?>;/* pass true if is the preview page. used for cookie control via js due W3 total cache or similar */
21
+ jQuery('#ipp_mobile_close_txt').css({color: itro_invert_color(itro_rgb2hex(jQuery('#itro_popup').css('border-bottom-color'))) });
 
 
22
  <?php
23
  if (itro_get_option('age_restriction') == NULL) /* OFF age validation */
24
  {
31
  var key = event.keyCode;
32
  if(key==27)
33
  {
34
+ jQuery("#itro_popup").fadeOut(function() {jQuery("#itro_opaco").fadeOut();});
35
  }
36
  }; <?php
37
  }
84
  if( itro_get_option('auto_margin_check') != NULL )
85
  {?>
86
  var browserWidth = 0, browserHeight = 0;
87
+ setInterval(function(){itro_margin_refresh()},500); /* refresh every 0.1 second the popup top margin (needed for browser window resizeing) */
88
  <?php
89
  }?>
90
  </script>
i18n-config.json CHANGED
@@ -6,6 +6,7 @@
6
  "forms":{
7
  "optionForm":{
8
  "fields":{
 
9
  "enter_button_text":{"name":"enter_button_text"},
10
  "leave_button_text":{"name":"leave_button_text"},
11
  "enter_button_url":{"name":"enter_button_url"},
6
  "forms":{
7
  "optionForm":{
8
  "fields":{
9
+ "countdown_text":{"name":"countdown_text"},
10
  "enter_button_text":{"name":"enter_button_text"},
11
  "leave_button_text":{"name":"leave_button_text"},
12
  "enter_button_url":{"name":"enter_button_url"},
mc-main.php CHANGED
@@ -1,20 +1,22 @@
1
  <?php
2
  /*
3
- Copyright 2016 I.T.RO.® (email : support@itroteam.com)
4
- This file is part of ITRO Popup Plugin.
5
-
6
  Plugin Name: ITRO Popup Plugin
7
- Plugin URI: http://www.wordpress-popup-plugin.com
8
  Description: EN - Show a perfecly centered customizable popup and a popup-system for age-restricted site and allow to insert own HTML code. IT - Visualizza un popup perfettamente centrato e personalizzabile con possibile blocco per i siti con restrizioni di eta' e permette di inserire il proprio codice HTML.
9
  Author: ITRO Team
10
  E-mail: support@itroteam.com
11
  Text Domain: itro-popup
12
- Version: 4.7.2
13
  Author URI: http://www.itroteam.com
14
  */
15
 
 
 
16
  global $ITRO_VER;
17
- $ITRO_VER = 4.72;
 
 
 
18
 
19
  define('itroPath', plugins_url() . '/itro-popup/');
20
  define('itroImages', plugins_url() . '/itro-popup/images/');
@@ -69,4 +71,4 @@ add_action( 'wp_enqueue_scripts' , 'itro_load_script' );
69
  add_action('admin_print_scripts', 'itro_admin_scripts');
70
  add_action('admin_print_styles', 'itro_load_admin_styles');
71
  add_action('admin_menu', 'itro_plugin_menu');
72
- ?>
1
  <?php
2
  /*
 
 
 
3
  Plugin Name: ITRO Popup Plugin
4
+ Plugin URI: http://www.itroteam.com
5
  Description: EN - Show a perfecly centered customizable popup and a popup-system for age-restricted site and allow to insert own HTML code. IT - Visualizza un popup perfettamente centrato e personalizzabile con possibile blocco per i siti con restrizioni di eta' e permette di inserire il proprio codice HTML.
6
  Author: ITRO Team
7
  E-mail: support@itroteam.com
8
  Text Domain: itro-popup
9
+ Version: 4.9.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 = 4.92;
17
+
18
+ global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
19
+ $popup_fired = false;
20
 
21
  define('itroPath', plugins_url() . '/itro-popup/');
22
  define('itroImages', plugins_url() . '/itro-popup/images/');
71
  add_action('admin_print_scripts', 'itro_admin_scripts');
72
  add_action('admin_print_styles', 'itro_load_admin_styles');
73
  add_action('admin_menu', 'itro_plugin_menu');
74
+ ?>
readme.txt CHANGED
@@ -1,21 +1,27 @@
1
  === ITRO Popup Plugin ===
2
  Contributors: ITRO
3
- Donate link: http://www.itroteam.com/donate/
4
- Tags: popup, popup message, popup box, popup ads, popup advertising, jquery popup, popup jquery, automatic popup, age restriction, popup block, popup violence, age validation popup, adult, adult content, content warning, content warning popup, fancy box, fancy popup, custom popup, advertising popup, pop-up, lightbox, lightbox popup
5
  Requires at least: 3.0.1
6
- Tested up to: 4.4.2
7
- Stable tag: 4.7.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- ITRO Popup display a popup to your WP site:
12
- ★ Age restriction for adult-content site
13
- ★ Multilanguage popup with qTransalte-X
14
- ★ Very easy to use
15
 
16
  == Description ==
17
 
18
- ITRO Popup Plugin - The BEST WP Popup Plugin
 
 
 
 
 
 
 
 
 
19
 
20
  ★ Pretty fade-in and fade-out animation.
21
  ★ Need to remove plugin and save data? It is possible!
@@ -35,28 +41,25 @@ ITRO Popup Plugin - The BEST WP Popup Plugin
35
  Thanks to [Viterbo Marketing](https://www.viterbomarketing.com) for website and marketing consulting.
36
 
37
  WANT MORE FEATURES? Try ITRO Wordpress Marketing for free!
38
- [TRY IT FOR FREE!](http://www.itroteam.com/download-free-trial-of-itro-wordpress-marketing/)
39
-
40
- ITRO Popup is a very lightweight Plugin for Wordpress which allow users to add a fully-customizable, multilanguage pop-up thanks to qTranslate-X.
41
- It has a very user-friendly interface, which allow Wordpress users to easily modify all settings needed for a popup, without coding.
42
- With "Age restricted site" option, the popup block the navigation (for age validation) until the user declare that is above the local country legal age.
43
- It is useful for adult content Wordpress site (tobacco & alcohol selling, violence, bad language, etc...). The leave and the enter button
44
- are separately customizable. Is embedded the Wordpress editor to simplify input whatever you want in your popup.
45
- Popup can be rendered unlockable with the option "Unlockable popup" so it will close only with countdown.
46
- This plugin is basic-user oriented, no code knowledge is required.
47
- Simply the best Wordpress popup plugin!
48
 
49
  TRANSLATED IN FOLLOWING LANGUAGES:
 
50
  - Italian
 
51
  - English
 
52
  - French (thanks to Patrice CHASSAING)
 
53
  - Serbo-Croatian (thanks to Andrijana Nikolic www.webhostinggeeks.com)
 
54
  - Nederlands (thanks to Descamps Gino)
55
 
56
- FOR TUTORIAL AND FAQ VISIT THE OFFICIAL SITE [CLICK HERE!](http://www.itroteam.com/itro-wordpress-popup-plugin-guide/)
57
- DONATE NOW! [DONATE NOW](http://www.itroteam.com/donate/)
58
 
59
- For any problem, please contact us at our site: [CONTACT US](http://www.itroteam.com/contact-us/)
 
 
 
60
 
61
  Want a more powerful marketing tools?
62
  Try ITRO Wordpress Marketing PRO with a 14 days free trial.
@@ -65,39 +68,65 @@ Try ITRO Wordpress Marketing PRO with a 14 days free trial.
65
  ★ ON-CLICK POPUP
66
  ★ RESPONSIVE POPUP
67
  ★ SHORTCODES (on click popup, automatic popup, contact forms...)
68
- ★ MAILCHIMP INTEGRATION with autoresponder different for each contact form
69
  ★ LINK CLICKS COUNTER (or DOWNLOAD COUNTER)
70
- ★ CONTACT POPUPS
71
  ★ SUPPORT REQUEST MANAGEMENT SYSTEM
72
  ★ SMTP AUTH AUTORESPONDER
73
  ★ POPUP ANIMATIONS
74
  ★ SOCIAL POPUPS
75
  ★ VIDEO EMBEDDING (Youtube and Vimeo)
76
 
77
- [TRY IT FOR FREE!](http://www.itroteam.com/download-free-trial-of-itro-wordpress-marketing/)
78
 
79
  == Installation ==
80
 
81
- FOR TUTORIAL AND FAQ VISIT THE OFFICIAL SITE [CLICK HERE!](http://www.itroteam.com/itro-wordpress-popup-plugin-guide/)
82
 
83
- DONATE NOW! - HELP US TO DEVELOP FOR YOU! [DONATE NOW](http://www.itroteam.com/donate/)
84
 
85
  1. Unzip `itro-plugin.zip` to the `/wp-content/plugins/` directory or select it by "Add new" in the 'Plugins' menu in WordPress
86
  2. Activate the plugin through the 'Plugins' menu in WordPress
87
  3. Go to "Settings->ITRO Popup" in the admin menu
88
- 4. Enjoy
89
 
90
  == Frequently Asked Questions ==
91
 
92
- FOR TUTORIAL AND FAQ VISIT THE OFFICIAL SITE [CLICK HERE!](http://www.itroteam.com/itro-wordpress-popup-plugin-guide/)
93
 
94
- DONATE NOW! - HELP US TO KEEP IT FREE! [DONATE NOW](http://www.itroteam.com/donate/)
95
 
96
  == Screenshots ==
97
 
98
- VIEW LIVE DEMOS ON OUR OFFICIAL SITE - [CLICK HERE!](http://www.itroteam.com/wordpress-popup-samples-and-demos/)
99
 
100
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  = 4.7.2 =
102
  FIXED: Popup closing by clicking outside with age restriction.
103
 
@@ -301,20 +330,36 @@ bug fixed: color table now works in admin pannel.
301
  First released version.
302
 
303
  == Upgrade Notice ==
304
- = 4.7.2 =
305
- FIXED: Popup closing by clicking outside with age restriction.
306
 
307
- = 4.7.1 =
308
- FIXED: shortcodes not working in the popup contents
 
 
309
 
310
- = 4.7 =
311
- ADDED: Multilingual compatibility with qtranslate X.
312
- ADDED: Url for the enter button of age validation.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
 
314
  == Notes ==
315
- FOR TUTORIAL AND FAQ VISIT THE OFFICIAL SITE [CLICK HERE!](http://www.itroteam.com/itro-wordpress-popup-plugin-guide/)
316
 
317
- DONATE NOW! - HELP US TO KEEP IT FREE! [DONATE NOW](http://www.itroteam.com/donate/)
318
 
319
  We accept all kind of suggestion.
320
  Thanks to Jan Odvarko for jscolor: http://jscolor.com/
1
  === ITRO Popup Plugin ===
2
  Contributors: ITRO
3
+ Donate link: http://www.itroteam.com/
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.5
7
+ Stable tag: 4.9.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ ITRO Popup display a popup to your WP site: age restriction popup for adult-content site; multilanguage popup with qTransalte-X; very easy to use
 
 
 
12
 
13
  == Description ==
14
 
15
+ ITRO Popup Plugin - The BEST WordpPress Popup Plugin
16
+
17
+ ITRO Popup is a very lightweight Plugin for Wordpress which allow users to add a fully-customizable, multilanguage pop-up thanks to qTranslate-X.
18
+ It has a very user-friendly interface, which allow Wordpress users to easily modify all settings needed for a popup, without coding.
19
+ With "Age restricted site" option, the popup block the navigation (for age validation) until the user declare that is above the local country legal age.
20
+ It is useful for adult content Wordpress site (tobacco & alcohol selling, violence, bad language, etc...). The leave and the enter button
21
+ are separately customizable. Is embedded the Wordpress editor to simplify input whatever you want in your popup.
22
+ Popup can be rendered unlockable with the option "Unlockable popup" so it will close only with countdown.
23
+ This plugin is basic-user oriented, no code knowledge is required.
24
+ Simply the best Wordpress popup plugin!
25
 
26
  ★ Pretty fade-in and fade-out animation.
27
  ★ Need to remove plugin and save data? It is possible!
41
  Thanks to [Viterbo Marketing](https://www.viterbomarketing.com) for website and marketing consulting.
42
 
43
  WANT MORE FEATURES? Try ITRO Wordpress Marketing for free!
44
+ [TRY IT FOR FREE!](http://www.itroteam.com/)
 
 
 
 
 
 
 
 
 
45
 
46
  TRANSLATED IN FOLLOWING LANGUAGES:
47
+
48
  - Italian
49
+
50
  - English
51
+
52
  - French (thanks to Patrice CHASSAING)
53
+
54
  - Serbo-Croatian (thanks to Andrijana Nikolic www.webhostinggeeks.com)
55
+
56
  - Nederlands (thanks to Descamps Gino)
57
 
 
 
58
 
59
+ FOR TUTORIAL AND FAQ VISIT THE OFFICIAL SITE [CLICK HERE!](http://www.itroteam.com/)
60
+ DONATE NOW! [DONATE NOW](http://www.itroteam.com/)
61
+
62
+ For any problem, please contact us at our site: [CONTACT US](http://www.itroteam.com/)
63
 
64
  Want a more powerful marketing tools?
65
  Try ITRO Wordpress Marketing PRO with a 14 days free trial.
68
  ★ ON-CLICK POPUP
69
  ★ RESPONSIVE POPUP
70
  ★ SHORTCODES (on click popup, automatic popup, contact forms...)
71
+ ★ MAILCHIMP INTEGRATION with autoresponder and auto-sync
72
  ★ LINK CLICKS COUNTER (or DOWNLOAD COUNTER)
73
+ ★ CONTACT POPUPS with visual contact form builder
74
  ★ SUPPORT REQUEST MANAGEMENT SYSTEM
75
  ★ SMTP AUTH AUTORESPONDER
76
  ★ POPUP ANIMATIONS
77
  ★ SOCIAL POPUPS
78
  ★ VIDEO EMBEDDING (Youtube and Vimeo)
79
 
80
+ [TRY IT FOR FREE!](http://www.itroteam.com/)
81
 
82
  == Installation ==
83
 
84
+ FOR TUTORIAL AND FAQ VISIT THE OFFICIAL SITE [CLICK HERE!](http://www.itroteam.com/)
85
 
86
+ DONATE NOW! - HELP US TO DEVELOP FOR YOU! [DONATE NOW](http://www.itroteam.com/)
87
 
88
  1. Unzip `itro-plugin.zip` to the `/wp-content/plugins/` directory or select it by "Add new" in the 'Plugins' menu in WordPress
89
  2. Activate the plugin through the 'Plugins' menu in WordPress
90
  3. Go to "Settings->ITRO Popup" in the admin menu
91
+ 4. Enjoy it
92
 
93
  == Frequently Asked Questions ==
94
 
95
+ FOR TUTORIAL AND FAQ VISIT THE OFFICIAL SITE [CLICK HERE!](http://www.itroteam.com/)
96
 
97
+ DONATE NOW! - HELP US TO KEEP IT FREE! [DONATE NOW](http://www.itroteam.com/)
98
 
99
  == Screenshots ==
100
 
101
+ VIEW LIVE DEMOS ON OUR OFFICIAL SITE - [CLICK HERE!](http://www.itroteam.com/)
102
 
103
  == Changelog ==
104
+ = 4.9.2 =
105
+ FIXED: no data validation/sanitization
106
+
107
+ = 4.9.1 =
108
+ ADDED: customizable text for the countdown
109
+ FIXED: overlayng behaviour with iframes in the popup content
110
+ FIXED: undefined variable error
111
+
112
+ = 4.9 =
113
+ ADDED: shortcode for visualization.
114
+ ADDED: mobile close tag text automatic font color.
115
+ FIXED: mobile close tab not working.
116
+ FIXED: popup delay default value set to 0.
117
+ IMPROVED: automatic vertical align.
118
+
119
+ = 4.8.1 =
120
+ FIXED: Popup cookie affect the preview mode.
121
+ IMPROVED: Easy closing the popup can be disabled. Nor ESC or clicking outside will close the popup.
122
+
123
+ = 4.8 =
124
+ ADDED: Fully responsive design.
125
+ ADDED: Absolute position only for mobile devices.
126
+
127
+ = 4.7.3 =
128
+ IMPROVED: Useless preview page deleted. Preview via GET request.
129
+
130
  = 4.7.2 =
131
  FIXED: Popup closing by clicking outside with age restriction.
132
 
330
  First released version.
331
 
332
  == Upgrade Notice ==
333
+ = 4.9.2 =
334
+ FIXED: no data validation/sanitization
335
 
336
+ = 4.9.1 =
337
+ ADDED: customizable text for the countdown
338
+ FIXED: overlayng behaviour with iframes in the popup content
339
+ FIXED: undefined variable error
340
 
341
+ = 4.9 =
342
+ ADDED: shortcode for visualization.
343
+ ADDED: mobile close tag text automatic font color.
344
+ FIXED: mobile close tab not working.
345
+ FIXED: popup delay default value set to 0.
346
+ IMPROVED: automatic vertical align.
347
+
348
+ = 4.8.1 =
349
+ FIXED: Popup cookie affect the preview mode.
350
+ IMPROVED: Easy closing the popup can be disabled. Nor ESC or clicking outside will close the popup.
351
+
352
+ = 4.8 =
353
+ ADDED: Fully responsive design.
354
+ ADDED: Absolute position only for mobile devices.
355
+
356
+ = 4.7.3 =
357
+ IMPROVED: Useless preview page deleted. Preview via GET request.
358
 
359
  == Notes ==
360
+ FOR TUTORIAL AND FAQ VISIT THE OFFICIAL SITE [CLICK HERE!](http://www.itroteam.com/)
361
 
362
+ DONATE NOW! - HELP US TO KEEP IT FREE! [DONATE NOW](http://www.itroteam.com/)
363
 
364
  We accept all kind of suggestion.
365
  Thanks to Jan Odvarko for jscolor: http://jscolor.com/
scripts/itro-admin-scripts.js CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  /* -------------- SCRIPTS FOR ADMIN PANNEL */
2
 
3
  function itro_pos(e)
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)
scripts/itro-scripts.js CHANGED
@@ -1,17 +1,25 @@
 
 
 
 
1
  /* init variables */
2
  var itro_is_preview;
3
  var itro_cookie_expiration;
4
  var itro_age_restriction;
5
 
6
- /* manage fade in animation */
 
 
 
 
 
 
7
  function itro_enter_anim()
8
- {
9
  if( document.cookie.indexOf("popup_cookie") == -1 || itro_is_preview === true )
10
  {
11
- itro_popup.style.visibility = '';
12
- itro_opaco.style.visibility = '';
13
- itro_popup.style.display = 'none';
14
- itro_opaco.style.display = 'none';
15
  jQuery("#itro_opaco").fadeIn(function()
16
  {
17
  jQuery("#itro_popup").fadeIn();
@@ -24,9 +32,19 @@ function itro_enter_anim()
24
 
25
  }
26
 
27
- /* function for automatic top margin refresh, to center the popup vertically */
28
- function marginRefresh()
29
- {
 
 
 
 
 
 
 
 
 
 
30
  if( typeof( window.innerWidth ) == 'number' )
31
  {
32
  /* Non-IE */
@@ -43,8 +61,61 @@ function marginRefresh()
43
  browserWidth = document.body.clientWidth;
44
  browserHeight = document.body.clientHeight;
45
  }
46
- popupHeight = document.getElementById('itro_popup').offsetHeight ; /* get the actual px size of popup div */
47
- document.getElementById('itro_popup').style.top = (browserHeight - popupHeight)/2 + "px"; /* update the top margin of popup */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
  /* function for countdown to show popup when the delay is set */
@@ -58,7 +129,13 @@ function popup_delay()
58
  }
59
  }
60
 
61
- /* countdown for automatic closing */
 
 
 
 
 
 
62
  function popTimer()
63
  {
64
  if (popTime>0)
1
+ /*
2
+ This file is part of ITRO Popup Plugin. (email : support@itroteam.com)
3
+ */
4
+
5
  /* init variables */
6
  var itro_is_preview;
7
  var itro_cookie_expiration;
8
  var itro_age_restriction;
9
 
10
+ /**
11
+ * Manage popup appearing
12
+ *
13
+ *
14
+ * @since 1.0
15
+ *
16
+ */
17
  function itro_enter_anim()
18
+ {
19
  if( document.cookie.indexOf("popup_cookie") == -1 || itro_is_preview === true )
20
  {
21
+ itro_margin_refresh(50); //align the popup before fadein
22
+
 
 
23
  jQuery("#itro_opaco").fadeIn(function()
24
  {
25
  jQuery("#itro_popup").fadeIn();
32
 
33
  }
34
 
35
+
36
+ /**
37
+ * Center the popup vertically
38
+ *
39
+ * @param int speed: the milesec speed fo the alignment animation
40
+ *
41
+ * @since 1.0
42
+ *
43
+ */
44
+ function itro_margin_refresh(speed){
45
+ if(typeof(speed) == undefined){speed = 200;}
46
+
47
+ //if( jQuery('#itro_popup').css('position') )
48
  if( typeof( window.innerWidth ) == 'number' )
49
  {
50
  /* Non-IE */
61
  browserWidth = document.body.clientWidth;
62
  browserHeight = document.body.clientHeight;
63
  }
64
+ popupHeight = document.getElementById('itro_popup').offsetHeight ; //get the px size of popup div
65
+ parentOffset = jQuery('#itro_popup').position().top;
66
+ docOffset = jQuery('#itro_popup').offset().top;
67
+
68
+ desTopWindowMargin = Math.round((browserHeight - popupHeight)/2); //desired top margin of popup (window related)
69
+ desTopWindowMargin = desTopWindowMargin < 0 ? 0 : desTopWindowMargin; //avoid that negative top position will hide the popup
70
+ popupTopMargin = desTopWindowMargin - docOffset + parentOffset;
71
+
72
+ if(jQuery('#itro_popup').css('position') == 'absolute'){
73
+ //set a tollerance to avoid flickering
74
+ if(Math.abs(popupTopMargin - parentOffset) > 2){
75
+ jQuery('#itro_popup').animate({top: popupTopMargin}, speed);
76
+ }
77
+ }else{
78
+ if(Math.abs(popupTopMargin - parentOffset) > 2){
79
+ jQuery('#itro_popup').animate({top: desTopWindowMargin}, speed);
80
+ }
81
+ }
82
+
83
+ }
84
+
85
+ /**
86
+ * Invert an hex color with the # char
87
+ *
88
+ * @param string hexTripletColor: the hex string
89
+ *
90
+ * @since 4.9
91
+ *
92
+ */
93
+ function itro_invert_color(hexTripletColor) {
94
+ var color = hexTripletColor;
95
+ color = color.substring(1); // remove #
96
+ color = parseInt(color, 16); // convert to integer
97
+ color = 0xFFFFFF ^ color; // invert three bytes
98
+ color = color.toString(16); // convert to hex
99
+ color = "#" + color; // prepend #
100
+ return color;
101
+ }
102
+
103
+ /**
104
+ * Convert an rgb string like rgb(255, 255, 255) to an hex code
105
+ *
106
+ * @param string rgbString: the rgb string
107
+ *
108
+ * @since 4.9
109
+ *
110
+ */
111
+ function itro_rgb2hex(rgbString){
112
+ var parts = rgbString.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
113
+ delete (parts[0]);
114
+ for (var i = 1; i <= 3; ++i) {
115
+ parts[i] = parseInt(parts[i]).toString(16);
116
+ if (parts[i].length == 1) parts[i] = '0' + parts[i];
117
+ }
118
+ return '#'+parts.join('').toUpperCase();
119
  }
120
 
121
  /* function for countdown to show popup when the delay is set */
129
  }
130
  }
131
 
132
+
133
+ /**
134
+ * Countdown for automatic closing
135
+ *
136
+ * @since 1.0
137
+ *
138
+ */
139
  function popTimer()
140
  {
141
  if (popTime>0)
templates/itro-popup-template.php CHANGED
@@ -1,14 +1,20 @@
1
- <?php
 
 
 
 
 
 
2
  function itro_popup_template()
3
  { ?>
4
- <div id="itro_popup" style="visibility:hidden; display: none;">
5
  <?php
6
  if( itro_get_option('age_restriction') == NULL ) /* age restriction off */
7
  {
8
  if( itro_get_option('popup_time') != 0 )
9
  {
10
  echo '<div id="popup_countdown" align="center">';
11
- _e('This popup will be closed in: ','itro-plugin');
12
  echo '<b id="timer"></b></div>';
13
  }
14
 
@@ -38,9 +44,14 @@ function itro_popup_template()
38
  </p><?php
39
  }
40
  ?>
 
 
 
 
41
  </div>
 
42
  </div>
43
- <div id="itro_opaco" style="visibility:hidden" <?php if ( itro_get_option('age_restriction') != 'yes' ){ ?> onclick="jQuery('#itro_popup').fadeOut(function(){itro_opaco.style.visibility='hidden';})" <?php } ?> ></div>
44
  <?php
45
  }
46
  ?>
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
7
+
8
  function itro_popup_template()
9
  { ?>
10
+ <div id="itro_popup" style="display: none">
11
  <?php
12
  if( itro_get_option('age_restriction') == NULL ) /* age restriction off */
13
  {
14
  if( itro_get_option('popup_time') != 0 )
15
  {
16
  echo '<div id="popup_countdown" align="center">';
17
+ _e(itro_get_option('countdown_text'));
18
  echo '<b id="timer"></b></div>';
19
  }
20
 
44
  </p><?php
45
  }
46
  ?>
47
+ </div>
48
+ <?php if ( itro_get_option('age_restriction') != 'yes'){ ?>
49
+ <div id="ipp_mobile_close_tab">
50
+ <span id="ipp_mobile_close_txt" onclick="jQuery('#itro_popup').fadeOut(function(){itro_opaco.style.visibility='hidden';})">CLOSE</span>
51
  </div>
52
+ <?php }?>
53
  </div>
54
+ <div id="itro_opaco" style="display: none" <?php if ( itro_get_option('age_restriction') != 'yes' && itro_get_option('popup_unlockable') != 'yes' ){ ?> onclick="jQuery('#itro_popup').fadeOut(function(){itro_opaco.style.visibility='hidden';})" <?php } ?> ></div>
55
  <?php
56
  }
57
  ?>
uninstall.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  //uninstall not called from WordPress exit
3
  if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {exit ();}
4
  else
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
  //uninstall not called from WordPress exit
5
  if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {exit ();}
6
  else