Version Description
Code maintenance, some js errors fixed in admin page.
Download this release
Release Info
Developer | ITRO |
Plugin | ITRO Popup Plugin |
Version | 4.4.3 |
Comparing to | |
See all releases |
Code changes from version 4.4.2 to 4.4.3
- admin/popup-admin.php +18 -17
- functions/core-function.php +18 -36
- functions/database-function.php +5 -6
- functions/js-function.php +26 -27
- mc-main.php +2 -2
- readme.txt +6 -1
- templates/itro-popup-template.php +4 -4
admin/popup-admin.php
CHANGED
@@ -7,7 +7,7 @@ This file is part of ITRO Popup Plugin.
|
|
7 |
if ( !current_user_can( 'manage_options' ) ) {
|
8 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
9 |
}
|
10 |
-
|
11 |
if( !isset($submitted_form ))
|
12 |
{
|
13 |
$opt_name=array(
|
@@ -54,22 +54,22 @@ if( !isset($submitted_form ))
|
|
54 |
|
55 |
|
56 |
|
57 |
-
|
58 |
for($i=0;$i<count($opt_name); $i++)
|
59 |
{
|
60 |
-
|
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 |
-
|
66 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
|
67 |
{
|
68 |
-
|
69 |
if(isset($_POST[$opt_name[$i]])){$opt_val[$i] = $_POST[ $opt_name[$i] ];}
|
70 |
else{$opt_val[$i] = NULL;}
|
71 |
|
72 |
-
|
73 |
itro_update_option( $opt_name[$i], $opt_val[$i] );
|
74 |
|
75 |
if( isset($_POST['select_' . $opt_name[$i]]) )
|
@@ -85,27 +85,27 @@ for($i=0;$i<count($opt_name); $i++)
|
|
85 |
}
|
86 |
}
|
87 |
|
88 |
-
|
89 |
for($i=0;$i<count($field_name); $i++)
|
90 |
{
|
91 |
-
|
92 |
|
93 |
$field_value[$i] = itro_get_field( $field_name[$i] );
|
94 |
|
95 |
-
|
96 |
-
|
97 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
|
98 |
{
|
99 |
-
|
100 |
if(isset($_POST[$field_name[$i]])) {$field_value[$i] = $_POST[ $field_name[$i] ]; }
|
101 |
else{$field_value[$i] = NULL;}
|
102 |
|
103 |
-
|
104 |
itro_update_field( $field_name[$i], $field_value[$i] );
|
105 |
}
|
106 |
}
|
107 |
|
108 |
-
|
109 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
|
110 |
{
|
111 |
if( isset($_POST['selected_page_id']) )
|
@@ -122,7 +122,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
|
|
122 |
else { itro_update_option('background_source',$_POST['background_source']); }
|
123 |
}
|
124 |
itro_admin_style();
|
125 |
-
|
126 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isset($_POST['delete_data_hidden']) && $_POST['delete_data_hidden'] == 'Y' ) {
|
127 |
?>
|
128 |
<div class="updated"><p><strong><?php _e('settings saved.', 'itro-plugin' ); ?></strong></p></div>
|
@@ -169,7 +169,8 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
|
|
169 |
</select>
|
170 |
<img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e('If in your Settings->Reading you have set \'Front page displays: Your latest posts\' and want to display the popup in the home, check this box.','itro-plugin');?>" />
|
171 |
<br>
|
172 |
-
<?php
|
|
|
173 |
itro_list_pages();
|
174 |
?>
|
175 |
</div>
|
@@ -336,7 +337,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
|
|
336 |
document.getElementById("<?php echo $opt_name[25]; ?>_slider_container").addEventListener("keydown", update, false);
|
337 |
function update()
|
338 |
{
|
339 |
-
document.getElementById("<?php echo $opt_name[26]; ?>").style.opacity = document.getElementById("<?php echo $opt_name[25]; ?>").value
|
340 |
document.addEventListener("mousemove", update, false);
|
341 |
}
|
342 |
function stop()
|
7 |
if ( !current_user_can( 'manage_options' ) ) {
|
8 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
9 |
}
|
10 |
+
/* variables for the field and option names */
|
11 |
if( !isset($submitted_form ))
|
12 |
{
|
13 |
$opt_name=array(
|
54 |
|
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 |
+
/* See if the user has posted us some information */
|
65 |
+
/* If they did, this hidden field will be set to 'Y' */
|
66 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
|
67 |
{
|
68 |
+
/* Read their posted value */
|
69 |
if(isset($_POST[$opt_name[$i]])){$opt_val[$i] = $_POST[ $opt_name[$i] ];}
|
70 |
else{$opt_val[$i] = NULL;}
|
71 |
|
72 |
+
/* Save the posted value in the database */
|
73 |
itro_update_option( $opt_name[$i], $opt_val[$i] );
|
74 |
|
75 |
if( isset($_POST['select_' . $opt_name[$i]]) )
|
85 |
}
|
86 |
}
|
87 |
|
88 |
+
/* ordered field */
|
89 |
for($i=0;$i<count($field_name); $i++)
|
90 |
{
|
91 |
+
/* Read in existing option value from database */
|
92 |
|
93 |
$field_value[$i] = itro_get_field( $field_name[$i] );
|
94 |
|
95 |
+
/* See if the user has posted us some information */
|
96 |
+
/* If they did, this hidden field will be set to 'Y' */
|
97 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' )
|
98 |
{
|
99 |
+
/* Read their posted value */
|
100 |
if(isset($_POST[$field_name[$i]])) {$field_value[$i] = $_POST[ $field_name[$i] ]; }
|
101 |
else{$field_value[$i] = NULL;}
|
102 |
|
103 |
+
/* Save the posted value in the database */
|
104 |
itro_update_field( $field_name[$i], $field_value[$i] );
|
105 |
}
|
106 |
}
|
107 |
|
108 |
+
/* unsorted option and field */
|
109 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
|
110 |
{
|
111 |
if( isset($_POST['selected_page_id']) )
|
122 |
else { itro_update_option('background_source',$_POST['background_source']); }
|
123 |
}
|
124 |
itro_admin_style();
|
125 |
+
/* Put an settings updated message on the screen */
|
126 |
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isset($_POST['delete_data_hidden']) && $_POST['delete_data_hidden'] == 'Y' ) {
|
127 |
?>
|
128 |
<div class="updated"><p><strong><?php _e('settings saved.', 'itro-plugin' ); ?></strong></p></div>
|
169 |
</select>
|
170 |
<img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e('If in your Settings->Reading you have set \'Front page displays: Your latest posts\' and want to display the popup in the home, check this box.','itro-plugin');?>" />
|
171 |
<br>
|
172 |
+
<?php
|
173 |
+
/* list of published pages */
|
174 |
itro_list_pages();
|
175 |
?>
|
176 |
</div>
|
337 |
document.getElementById("<?php echo $opt_name[25]; ?>_slider_container").addEventListener("keydown", update, false);
|
338 |
function update()
|
339 |
{
|
340 |
+
document.getElementById("<?php echo $opt_name[26]; ?>").style.opacity = document.getElementById("<?php echo $opt_name[25]; ?>").value;
|
341 |
document.addEventListener("mousemove", update, false);
|
342 |
}
|
343 |
function stop()
|
functions/core-function.php
CHANGED
@@ -3,27 +3,26 @@
|
|
3 |
Copyright 2013 I.T.RO.® (email : support.itro@live.com)
|
4 |
This file is part of ITRO Popup Plugin.
|
5 |
*/
|
6 |
-
|
7 |
function itro_send_header()
|
8 |
{
|
9 |
-
|
10 |
-
//if ( itro_get_option('ie_compability') == 'yes' )
|
11 |
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
|
12 |
}
|
13 |
|
14 |
-
|
15 |
function itro_plugin_menu() {
|
16 |
add_options_page( 'Popup Plugin Options', 'ITRO Popup', 'manage_options', 'itro-popup/admin/popup-admin.php', '' );
|
17 |
}
|
18 |
|
19 |
-
|
20 |
|
21 |
function itro_init()
|
22 |
{
|
23 |
-
|
24 |
itro_db_init();
|
25 |
|
26 |
-
|
27 |
if( get_option("itro_curr_ver") == NULL )
|
28 |
{
|
29 |
itro_update_option('popup_time',20);
|
@@ -60,7 +59,7 @@ function itro_init()
|
|
60 |
itro_update_option('sample_popup','done');
|
61 |
}
|
62 |
|
63 |
-
|
64 |
if( $GLOBALS['ITRO_VER'] != get_option('itro_curr_ver') )
|
65 |
{
|
66 |
$ver = get_option('itro_curr_ver');
|
@@ -76,7 +75,7 @@ function itro_init()
|
|
76 |
itro_update_option('version_flag', 'true');
|
77 |
}
|
78 |
|
79 |
-
|
80 |
switch(WPLANG)
|
81 |
{
|
82 |
case 'en_US':
|
@@ -90,7 +89,7 @@ function itro_init()
|
|
90 |
}
|
91 |
if ( itro_get_option('preview_id') == NULL )
|
92 |
{
|
93 |
-
|
94 |
$preview_post = array(
|
95 |
'post_title' => 'ITRO - Preview',
|
96 |
'post_name' => 'itro-preview',
|
@@ -99,19 +98,19 @@ function itro_init()
|
|
99 |
'post_author' => 1,
|
100 |
'post_type' => 'page',
|
101 |
);
|
102 |
-
|
103 |
$preview_id = wp_insert_post( $preview_post );
|
104 |
itro_update_option('preview_id',$preview_id);
|
105 |
}
|
106 |
}
|
107 |
|
108 |
-
|
109 |
function itro_display_popup()
|
110 |
{
|
111 |
-
|
112 |
-
if( function_exists('is_shop') && function_exists('woocommerce_get_page_id') )
|
113 |
{
|
114 |
-
if ( is_shop() )
|
115 |
{
|
116 |
$woo_shop = true;
|
117 |
$woo_shop_id = woocommerce_get_page_id( 'shop' );
|
@@ -123,7 +122,7 @@ function itro_display_popup()
|
|
123 |
$woo_shop_id = NULL;
|
124 |
}
|
125 |
|
126 |
-
|
127 |
$selected_page_id = json_decode(itro_get_option('selected_page_id'));
|
128 |
$id_match = NULL;
|
129 |
|
@@ -134,7 +133,7 @@ function itro_display_popup()
|
|
134 |
{
|
135 |
foreach ($selected_page_id as $single_id)
|
136 |
{
|
137 |
-
if ( $single_id == get_the_id() || ( $single_id == $woo_shop_id && $woo_shop ) )
|
138 |
{
|
139 |
$id_match++;
|
140 |
}
|
@@ -171,7 +170,7 @@ function itro_display_popup()
|
|
171 |
}
|
172 |
}
|
173 |
|
174 |
-
|
175 |
function itro_check_selected_id($id_to_check)
|
176 |
{
|
177 |
if(itro_get_option('selected_page_id') != NULL)
|
@@ -204,21 +203,4 @@ function itro_list_pages()
|
|
204 |
</select>
|
205 |
<?php
|
206 |
}
|
207 |
-
|
208 |
-
//---------------REVERSE WPAUTOP
|
209 |
-
function reverse_wpautop($s)
|
210 |
-
{
|
211 |
-
//remove any new lines already in there
|
212 |
-
$s = str_replace("\n", "", $s);
|
213 |
-
|
214 |
-
//remove all <p>
|
215 |
-
$s = str_replace("<p>", "", $s);
|
216 |
-
|
217 |
-
//replace <br /> with \n
|
218 |
-
$s = str_replace(array("<br />", "<br>", "<br/>"), "\n", $s);
|
219 |
-
|
220 |
-
//replace </p> with \n\n
|
221 |
-
$s = str_replace("</p>", "\n\n", $s);
|
222 |
-
|
223 |
-
return $s;
|
224 |
-
}?>
|
3 |
Copyright 2013 I.T.RO.® (email : support.itro@live.com)
|
4 |
This file is part of ITRO Popup Plugin.
|
5 |
*/
|
6 |
+
/* ---------------------- SEND HEADER */
|
7 |
function itro_send_header()
|
8 |
{
|
9 |
+
/* add meta tag for IE compability */
|
|
|
10 |
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
|
11 |
}
|
12 |
|
13 |
+
/* ------------------ADD MENU PAGE */
|
14 |
function itro_plugin_menu() {
|
15 |
add_options_page( 'Popup Plugin Options', 'ITRO Popup', 'manage_options', 'itro-popup/admin/popup-admin.php', '' );
|
16 |
}
|
17 |
|
18 |
+
/* -------------- INITIALIZATION */
|
19 |
|
20 |
function itro_init()
|
21 |
{
|
22 |
+
/* --------- initialize database */
|
23 |
itro_db_init();
|
24 |
|
25 |
+
/* -----load sample popup settings */
|
26 |
if( get_option("itro_curr_ver") == NULL )
|
27 |
{
|
28 |
itro_update_option('popup_time',20);
|
59 |
itro_update_option('sample_popup','done');
|
60 |
}
|
61 |
|
62 |
+
/* -------- check version */
|
63 |
if( $GLOBALS['ITRO_VER'] != get_option('itro_curr_ver') )
|
64 |
{
|
65 |
$ver = get_option('itro_curr_ver');
|
75 |
itro_update_option('version_flag', 'true');
|
76 |
}
|
77 |
|
78 |
+
/* ---------------create preview page */
|
79 |
switch(WPLANG)
|
80 |
{
|
81 |
case 'en_US':
|
89 |
}
|
90 |
if ( itro_get_option('preview_id') == NULL )
|
91 |
{
|
92 |
+
/* Create post object */
|
93 |
$preview_post = array(
|
94 |
'post_title' => 'ITRO - Preview',
|
95 |
'post_name' => 'itro-preview',
|
98 |
'post_author' => 1,
|
99 |
'post_type' => 'page',
|
100 |
);
|
101 |
+
/* Insert the post into the database */
|
102 |
$preview_id = wp_insert_post( $preview_post );
|
103 |
itro_update_option('preview_id',$preview_id);
|
104 |
}
|
105 |
}
|
106 |
|
107 |
+
/* --------------------------DISPLAY THE POPUP */
|
108 |
function itro_display_popup()
|
109 |
{
|
110 |
+
/* woocommerce shop page identification */
|
111 |
+
if( function_exists('is_shop') && function_exists('woocommerce_get_page_id') ) /* if this functions exist, woocommerce is installed! */
|
112 |
{
|
113 |
+
if ( is_shop() ) /* if the actual page is the standard woocommerce shop page */
|
114 |
{
|
115 |
$woo_shop = true;
|
116 |
$woo_shop_id = woocommerce_get_page_id( 'shop' );
|
122 |
$woo_shop_id = NULL;
|
123 |
}
|
124 |
|
125 |
+
/* this condition, control if the popup must or not by displayed in a specified page */
|
126 |
$selected_page_id = json_decode(itro_get_option('selected_page_id'));
|
127 |
$id_match = NULL;
|
128 |
|
133 |
{
|
134 |
foreach ($selected_page_id as $single_id)
|
135 |
{
|
136 |
+
if ( $single_id == get_the_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. */
|
137 |
{
|
138 |
$id_match++;
|
139 |
}
|
170 |
}
|
171 |
}
|
172 |
|
173 |
+
/* ------------------------- SELECT PAGES FUNCTIONS */
|
174 |
function itro_check_selected_id($id_to_check)
|
175 |
{
|
176 |
if(itro_get_option('selected_page_id') != NULL)
|
203 |
</select>
|
204 |
<?php
|
205 |
}
|
206 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/database-function.php
CHANGED
@@ -6,12 +6,11 @@ This file is part of ITRO Popup Plugin.
|
|
6 |
global $wpdb;
|
7 |
define ('OPTION_TABLE_NAME', 'wp_itro_plugin_option');
|
8 |
define ('FIELD_TABLE_NAME', 'wp_itro_plugin_field');
|
9 |
-
|
10 |
-
//-------Create plugin tables
|
11 |
function itro_db_init()
|
12 |
{
|
13 |
global $wpdb;
|
14 |
-
|
15 |
$option_table_name = OPTION_TABLE_NAME;
|
16 |
$sql = "CREATE TABLE IF NOT EXISTS $option_table_name
|
17 |
(
|
@@ -23,7 +22,7 @@ function itro_db_init()
|
|
23 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
24 |
dbDelta( $sql );
|
25 |
|
26 |
-
|
27 |
$field_table_name = FIELD_TABLE_NAME;
|
28 |
$sql = "CREATE TABLE IF NOT EXISTS $field_table_name
|
29 |
(
|
@@ -36,7 +35,7 @@ function itro_db_init()
|
|
36 |
dbDelta( $sql );
|
37 |
}
|
38 |
|
39 |
-
|
40 |
function itro_update_option($opt_name,$opt_val)
|
41 |
{
|
42 |
global $wpdb;
|
@@ -68,7 +67,7 @@ function itro_get_option($opt_name)
|
|
68 |
else {return (NULL);}
|
69 |
}
|
70 |
|
71 |
-
|
72 |
function itro_update_field($field_name,$field_value)
|
73 |
{
|
74 |
global $wpdb;
|
6 |
global $wpdb;
|
7 |
define ('OPTION_TABLE_NAME', 'wp_itro_plugin_option');
|
8 |
define ('FIELD_TABLE_NAME', 'wp_itro_plugin_field');
|
9 |
+
/* -------Create plugin tables */
|
|
|
10 |
function itro_db_init()
|
11 |
{
|
12 |
global $wpdb;
|
13 |
+
/* ------------------Option table */
|
14 |
$option_table_name = OPTION_TABLE_NAME;
|
15 |
$sql = "CREATE TABLE IF NOT EXISTS $option_table_name
|
16 |
(
|
22 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
23 |
dbDelta( $sql );
|
24 |
|
25 |
+
/* --------------Custom field table */
|
26 |
$field_table_name = FIELD_TABLE_NAME;
|
27 |
$sql = "CREATE TABLE IF NOT EXISTS $field_table_name
|
28 |
(
|
35 |
dbDelta( $sql );
|
36 |
}
|
37 |
|
38 |
+
/* ------------------ PLUGIN OPTION DB MANAGEMENT -------------- */
|
39 |
function itro_update_option($opt_name,$opt_val)
|
40 |
{
|
41 |
global $wpdb;
|
67 |
else {return (NULL);}
|
68 |
}
|
69 |
|
70 |
+
/* ------------------ CUSTOM FIELD CONTENT DB MANAGEMENT -------------- */
|
71 |
function itro_update_field($field_name,$field_value)
|
72 |
{
|
73 |
global $wpdb;
|
functions/js-function.php
CHANGED
@@ -4,11 +4,11 @@ Copyright 2013 I.T.RO.® (email : support.itro@live.com)
|
|
4 |
This file is part of ITRO Popup Plugin.
|
5 |
*/
|
6 |
|
7 |
-
|
8 |
function itro_popup_js()
|
9 |
{ ?>
|
10 |
<script type="text/javascript">
|
11 |
-
|
12 |
function itro_enter_anim()
|
13 |
{
|
14 |
itro_popup.style.visibility = '';
|
@@ -19,7 +19,7 @@ function itro_popup_js()
|
|
19 |
}
|
20 |
|
21 |
<?php
|
22 |
-
if (itro_get_option('age_restriction') == NULL)
|
23 |
{
|
24 |
if ( itro_get_option('preview_id') != get_the_id() )
|
25 |
{ ?>
|
@@ -39,7 +39,7 @@ function itro_popup_js()
|
|
39 |
}; <?php
|
40 |
}
|
41 |
|
42 |
-
if( itro_get_option('popup_delay') != 0 )
|
43 |
{ ?>
|
44 |
var delay = <?php echo itro_get_option('popup_delay') . '+' . '1'; ?> ;
|
45 |
interval_id_delay = setInterval(function(){popup_delay();},1000);
|
@@ -54,13 +54,13 @@ function itro_popup_js()
|
|
54 |
}
|
55 |
<?php
|
56 |
}
|
57 |
-
else
|
58 |
{?>
|
59 |
itro_enter_anim();
|
60 |
<?php
|
61 |
}
|
62 |
|
63 |
-
|
64 |
if ( itro_get_option('popup_time') != 0 )
|
65 |
{ ?>
|
66 |
var popTime=<?php
|
@@ -73,7 +73,7 @@ function itro_popup_js()
|
|
73 |
echo itro_get_option('popup_time');
|
74 |
}
|
75 |
?>;
|
76 |
-
interval_id = setInterval(function(){popTimer()},1000);
|
77 |
function popTimer()
|
78 |
{
|
79 |
if (popTime>0)
|
@@ -89,7 +89,7 @@ function itro_popup_js()
|
|
89 |
} <?php
|
90 |
}
|
91 |
}
|
92 |
-
else
|
93 |
{
|
94 |
if( itro_get_option('popup_delay') != 0 )
|
95 |
{ ?>
|
@@ -121,47 +121,46 @@ function itro_popup_js()
|
|
121 |
document.cookie=c_name + "=" + c_value + "; path=/";
|
122 |
}
|
123 |
<?php
|
124 |
-
|
125 |
if( itro_get_option('auto_margin_check') != NULL )
|
126 |
{?>
|
127 |
var browserWidth = 0, browserHeight = 0;
|
128 |
|
129 |
-
setInterval(function(){marginRefresh()},100);
|
130 |
function marginRefresh()
|
131 |
{
|
132 |
if( typeof( window.innerWidth ) == 'number' )
|
133 |
{
|
134 |
-
|
135 |
browserWidth = window.innerWidth;
|
136 |
browserHeight = window.innerHeight;
|
137 |
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
|
138 |
{
|
139 |
-
|
140 |
browserWidth = document.documentElement.clientWidth;
|
141 |
browserHeight = document.documentElement.clientHeight;
|
142 |
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
|
143 |
{
|
144 |
-
|
145 |
browserWidth = document.body.clientWidth;
|
146 |
browserHeight = document.body.clientHeight;
|
147 |
}
|
148 |
-
popupHeight = document.getElementById('itro_popup').offsetHeight ;
|
149 |
-
document.getElementById('itro_popup').style.top = (browserHeight - popupHeight)/2 + "px";
|
150 |
}<?php
|
151 |
}?>
|
152 |
</script>
|
153 |
<?php
|
154 |
}
|
155 |
|
156 |
-
|
157 |
function itro_slidebar($slider_target_id,$slider_value,$slider_min,$slider_max,$slider_step,$slider_tofixed,$multi_slider)
|
158 |
{
|
159 |
if($multi_slider != NULL)
|
160 |
{
|
161 |
-
if( itro_get_option('select_' . $slider_target_id) != $multi_slider )
|
162 |
{
|
163 |
$slider_display = 'display:none;';
|
164 |
-
//$js_input_display = 'document.getElementById("'. $slider_target_id .'").style.display = "none";' ;
|
165 |
}
|
166 |
else
|
167 |
{
|
@@ -192,7 +191,7 @@ function itro_slidebar($slider_target_id,$slider_value,$slider_min,$slider_max,$
|
|
192 |
function <?php echo $slider_target_id ?>_start_slider()
|
193 |
{
|
194 |
document.addEventListener("mousemove",<?php echo $slider_target_id ?>_move_slider);
|
195 |
-
document.addEventListener("mouseup",<?php echo $slider_target_id ?>_stop_slider)
|
196 |
if( (x_pos - document.getElementById("<?php echo $js_slider_container_id; ?>").getBoundingClientRect().left) >= 0 && (x_pos - document.getElementById("<?php echo $js_slider_container_id; ?>").getBoundingClientRect().left) <= parseInt(document.getElementById("<?php echo $js_slider_container_id; ?>").style.width))
|
197 |
{
|
198 |
document.getElementById("<?php echo $js_slider_id;?>").style.left = x_pos - document.getElementById("<?php echo $js_slider_container_id; ?>").getBoundingClientRect().left - 7 + "px";
|
@@ -232,7 +231,7 @@ function itro_slidebar($slider_target_id,$slider_value,$slider_min,$slider_max,$
|
|
232 |
{
|
233 |
$slider_target_id = $target_opt_name; ?>
|
234 |
|
235 |
-
|
236 |
function itro_disable_<?php echo $slider_target_id; ?>()
|
237 |
{
|
238 |
document.getElementById("px_<?php echo $slider_target_id; ?>").style.display = "none";
|
@@ -241,7 +240,7 @@ function itro_slidebar($slider_target_id,$slider_value,$slider_min,$slider_max,$
|
|
241 |
document.getElementById("perc_<?php echo $slider_container_id; ?>").style.display = "none";
|
242 |
}
|
243 |
|
244 |
-
|
245 |
function itro_enable_<?php echo $slider_target_id; ?>(dim_type)
|
246 |
{
|
247 |
if(dim_type == 'perc')
|
@@ -263,7 +262,7 @@ function itro_slidebar($slider_target_id,$slider_value,$slider_min,$slider_max,$
|
|
263 |
</script><?php
|
264 |
}
|
265 |
|
266 |
-
|
267 |
function itro_admin_js()
|
268 |
{ ?>
|
269 |
<script type="text/javascript">
|
@@ -300,16 +299,16 @@ function itro_admin_js()
|
|
300 |
formfield = jQuery('.upload').attr('name');
|
301 |
tb_show('', 'media-upload.php?type=image&amp;amp;TB_iframe=true');
|
302 |
|
303 |
-
|
304 |
jQuery("#TB_window").bind('tb_unload', function () {
|
305 |
window.send_to_editor = orig_send_to_editor;
|
306 |
});
|
307 |
|
308 |
-
|
309 |
window.send_to_editor = function(html) {
|
310 |
imgurl = jQuery('img',html).attr('src');
|
311 |
uploadID.val(imgurl); /*assign the value of the image src to the input*/
|
312 |
-
document.getElementById('yes_bg').checked=true
|
313 |
tb_remove();
|
314 |
};
|
315 |
return false;
|
@@ -338,13 +337,13 @@ function itro_admin_js()
|
|
338 |
</script><?php
|
339 |
}
|
340 |
|
341 |
-
|
342 |
function itro_show_hide($hide_target_id, $hide_shooter_id, $display_val, $inverted, $highlight_opt)
|
343 |
{?>
|
344 |
<script type="text/javascript">
|
345 |
|
346 |
<?php
|
347 |
-
if ($inverted == 'false')
|
348 |
{ $check_condition = 'yes'; }
|
349 |
else
|
350 |
{ $check_condition = NULL; }
|
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 |
+
/* manage fade in animation */
|
12 |
function itro_enter_anim()
|
13 |
{
|
14 |
itro_popup.style.visibility = '';
|
19 |
}
|
20 |
|
21 |
<?php
|
22 |
+
if (itro_get_option('age_restriction') == NULL) /* OFF age validation */
|
23 |
{
|
24 |
if ( itro_get_option('preview_id') != get_the_id() )
|
25 |
{ ?>
|
39 |
}; <?php
|
40 |
}
|
41 |
|
42 |
+
if( itro_get_option('popup_delay') != 0 ) /* if is set the delay */
|
43 |
{ ?>
|
44 |
var delay = <?php echo itro_get_option('popup_delay') . '+' . '1'; ?> ;
|
45 |
interval_id_delay = setInterval(function(){popup_delay();},1000);
|
54 |
}
|
55 |
<?php
|
56 |
}
|
57 |
+
else /* if popup delay is not setted */
|
58 |
{?>
|
59 |
itro_enter_anim();
|
60 |
<?php
|
61 |
}
|
62 |
|
63 |
+
/* start the timer only if popup seconds are != 0 to avoid js errors */
|
64 |
if ( itro_get_option('popup_time') != 0 )
|
65 |
{ ?>
|
66 |
var popTime=<?php
|
73 |
echo itro_get_option('popup_time');
|
74 |
}
|
75 |
?>;
|
76 |
+
interval_id = setInterval(function(){popTimer()},1000); /* the countdown */
|
77 |
function popTimer()
|
78 |
{
|
79 |
if (popTime>0)
|
89 |
} <?php
|
90 |
}
|
91 |
}
|
92 |
+
else /* if age restriction is enabled */
|
93 |
{
|
94 |
if( itro_get_option('popup_delay') != 0 )
|
95 |
{ ?>
|
121 |
document.cookie=c_name + "=" + c_value + "; path=/";
|
122 |
}
|
123 |
<?php
|
124 |
+
/* ------- AUTOMATIC TOP MARGIN */
|
125 |
if( itro_get_option('auto_margin_check') != NULL )
|
126 |
{?>
|
127 |
var browserWidth = 0, browserHeight = 0;
|
128 |
|
129 |
+
setInterval(function(){marginRefresh()},100); /* refresh every 0.1 second the popup top margin (needed for browser window resizeing) */
|
130 |
function marginRefresh()
|
131 |
{
|
132 |
if( typeof( window.innerWidth ) == 'number' )
|
133 |
{
|
134 |
+
/* Non-IE */
|
135 |
browserWidth = window.innerWidth;
|
136 |
browserHeight = window.innerHeight;
|
137 |
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
|
138 |
{
|
139 |
+
/* IE 6+ in 'standards compliant mode' */
|
140 |
browserWidth = document.documentElement.clientWidth;
|
141 |
browserHeight = document.documentElement.clientHeight;
|
142 |
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
|
143 |
{
|
144 |
+
/* IE 4 compatible */
|
145 |
browserWidth = document.body.clientWidth;
|
146 |
browserHeight = document.body.clientHeight;
|
147 |
}
|
148 |
+
popupHeight = document.getElementById('itro_popup').offsetHeight ; /* get the actual px size of popup div */
|
149 |
+
document.getElementById('itro_popup').style.top = (browserHeight - popupHeight)/2 + "px"; /* update the top margin of popup */
|
150 |
}<?php
|
151 |
}?>
|
152 |
</script>
|
153 |
<?php
|
154 |
}
|
155 |
|
156 |
+
/* ------------- LOAD SCRIPT TO SHOW SLIDEBAR */
|
157 |
function itro_slidebar($slider_target_id,$slider_value,$slider_min,$slider_max,$slider_step,$slider_tofixed,$multi_slider)
|
158 |
{
|
159 |
if($multi_slider != NULL)
|
160 |
{
|
161 |
+
if( itro_get_option('select_' . $slider_target_id) != $multi_slider ) /* esempio select_popup_width = 'px' o 'perc' */
|
162 |
{
|
163 |
$slider_display = 'display:none;';
|
|
|
164 |
}
|
165 |
else
|
166 |
{
|
191 |
function <?php echo $slider_target_id ?>_start_slider()
|
192 |
{
|
193 |
document.addEventListener("mousemove",<?php echo $slider_target_id ?>_move_slider);
|
194 |
+
document.addEventListener("mouseup",<?php echo $slider_target_id ?>_stop_slider);
|
195 |
if( (x_pos - document.getElementById("<?php echo $js_slider_container_id; ?>").getBoundingClientRect().left) >= 0 && (x_pos - document.getElementById("<?php echo $js_slider_container_id; ?>").getBoundingClientRect().left) <= parseInt(document.getElementById("<?php echo $js_slider_container_id; ?>").style.width))
|
196 |
{
|
197 |
document.getElementById("<?php echo $js_slider_id;?>").style.left = x_pos - document.getElementById("<?php echo $js_slider_container_id; ?>").getBoundingClientRect().left - 7 + "px";
|
231 |
{
|
232 |
$slider_target_id = $target_opt_name; ?>
|
233 |
|
234 |
+
/* ---function disable */
|
235 |
function itro_disable_<?php echo $slider_target_id; ?>()
|
236 |
{
|
237 |
document.getElementById("px_<?php echo $slider_target_id; ?>").style.display = "none";
|
240 |
document.getElementById("perc_<?php echo $slider_container_id; ?>").style.display = "none";
|
241 |
}
|
242 |
|
243 |
+
/* ---function enable */
|
244 |
function itro_enable_<?php echo $slider_target_id; ?>(dim_type)
|
245 |
{
|
246 |
if(dim_type == 'perc')
|
262 |
</script><?php
|
263 |
}
|
264 |
|
265 |
+
/* -------------- LOAD SCRIPTS FOR ADMIN PANNEL */
|
266 |
function itro_admin_js()
|
267 |
{ ?>
|
268 |
<script type="text/javascript">
|
299 |
formfield = jQuery('.upload').attr('name');
|
300 |
tb_show('', 'media-upload.php?type=image&amp;amp;TB_iframe=true');
|
301 |
|
302 |
+
/* restore send_to_editor() when tb closed */
|
303 |
jQuery("#TB_window").bind('tb_unload', function () {
|
304 |
window.send_to_editor = orig_send_to_editor;
|
305 |
});
|
306 |
|
307 |
+
/* temporarily redefine send_to_editor() */
|
308 |
window.send_to_editor = function(html) {
|
309 |
imgurl = jQuery('img',html).attr('src');
|
310 |
uploadID.val(imgurl); /*assign the value of the image src to the input*/
|
311 |
+
document.getElementById('yes_bg').checked=true;
|
312 |
tb_remove();
|
313 |
};
|
314 |
return false;
|
337 |
</script><?php
|
338 |
}
|
339 |
|
340 |
+
/* show and hide parts of admin pannel such as top margin and basic settings */
|
341 |
function itro_show_hide($hide_target_id, $hide_shooter_id, $display_val, $inverted, $highlight_opt)
|
342 |
{?>
|
343 |
<script type="text/javascript">
|
344 |
|
345 |
<?php
|
346 |
+
if ($inverted == 'false') /* decide if elements start hidden or visible: if inverted==true -> if $hide_shooter_id is checked -> start visible else start hidden */
|
347 |
{ $check_condition = 'yes'; }
|
348 |
else
|
349 |
{ $check_condition = NULL; }
|
mc-main.php
CHANGED
@@ -8,12 +8,12 @@ Plugin URI: http://www.itro.eu/
|
|
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: I.T.RO.(c) Sez. Informatica
|
10 |
E-mail: support.itro@live.com
|
11 |
-
Version: 4.4.
|
12 |
Author URI: http://www.itro.eu/
|
13 |
*/
|
14 |
|
15 |
global $ITRO_VER;
|
16 |
-
$ITRO_VER = 4.
|
17 |
define('itroLocalPath', __DIR__);
|
18 |
define('itroPath', plugins_url() . '/itro-popup/');
|
19 |
define('itroImages', plugins_url() . '/itro-popup/images/');
|
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: I.T.RO.(c) Sez. Informatica
|
10 |
E-mail: support.itro@live.com
|
11 |
+
Version: 4.4.3
|
12 |
Author URI: http://www.itro.eu/
|
13 |
*/
|
14 |
|
15 |
global $ITRO_VER;
|
16 |
+
$ITRO_VER = 4.43;
|
17 |
define('itroLocalPath', __DIR__);
|
18 |
define('itroPath', plugins_url() . '/itro-popup/');
|
19 |
define('itroImages', plugins_url() . '/itro-popup/images/');
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.itro.eu/index.php/donate/
|
|
4 |
Tags: popup, age restriction, block, violence, age validation, adult, adult content, content warning, wp editor, fancy box, fancy popup, custom popup, advertising popup, ads, ads popup, pop-up, lightbox, lightbox popup,
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 3.3
|
7 |
-
Stable tag: 4.4.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -75,6 +75,9 @@ DONATE NOW! - HELP US TO DEVELOP FOR YOU! [DONATE NOW](http://www.itro.eu/?page_
|
|
75 |
no screenshot avaliable
|
76 |
|
77 |
== Changelog ==
|
|
|
|
|
|
|
78 |
= 4.4.2 =
|
79 |
Bug on first installation fixed (preview page not working)
|
80 |
|
@@ -211,6 +214,8 @@ bug fixed: color table now works in admin pannel.
|
|
211 |
First released version.
|
212 |
|
213 |
== Upgrade Notice ==
|
|
|
|
|
214 |
= 4.4.2 =
|
215 |
Bug on first installation fixed (preview page not working)
|
216 |
= 4.4.1 =
|
4 |
Tags: popup, age restriction, block, violence, age validation, adult, adult content, content warning, wp editor, fancy box, fancy popup, custom popup, advertising popup, ads, ads popup, pop-up, lightbox, lightbox popup,
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 3.3
|
7 |
+
Stable tag: 4.4.3
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
75 |
no screenshot avaliable
|
76 |
|
77 |
== Changelog ==
|
78 |
+
= 4.4.3 =
|
79 |
+
Code maintenance, some js errors fixed in admin page.
|
80 |
+
|
81 |
= 4.4.2 =
|
82 |
Bug on first installation fixed (preview page not working)
|
83 |
|
214 |
First released version.
|
215 |
|
216 |
== Upgrade Notice ==
|
217 |
+
= 4.4.3 =
|
218 |
+
Code maintenance, some js errors fixed in admin page.
|
219 |
= 4.4.2 =
|
220 |
Bug on first installation fixed (preview page not working)
|
221 |
= 4.4.1 =
|
templates/itro-popup-template.php
CHANGED
@@ -3,7 +3,7 @@ function itro_popup_template()
|
|
3 |
{ ?>
|
4 |
<div id="itro_popup" style="visibility:hidden">
|
5 |
<?php
|
6 |
-
if( itro_get_option('age_restriction') == NULL )
|
7 |
{
|
8 |
if( itro_get_option('popup_time') != 0 )
|
9 |
{
|
@@ -12,7 +12,7 @@ function itro_popup_template()
|
|
12 |
echo '<b id="timer"></b></div>';
|
13 |
}
|
14 |
|
15 |
-
$selected_cross = itroPath . 'images/close-icon.png';
|
16 |
switch( itro_get_option('cross_selected') )
|
17 |
{
|
18 |
case 'white':
|
@@ -27,8 +27,8 @@ function itro_popup_template()
|
|
27 |
echo '" onclick="jQuery(\'#itro_popup\').fadeOut(function(){itro_opaco.style.visibility=\'hidden\';})">';
|
28 |
}?>
|
29 |
<div id="popup_content"><?php
|
30 |
-
$custom_field = stripslashes(itro_get_field('custom_html'));
|
31 |
-
echo str_replace("\r\n",'',$custom_field);
|
32 |
if ( itro_get_option('age_restriction') == 'yes' )
|
33 |
{?>
|
34 |
<p id="age_button_area" align="center">
|
3 |
{ ?>
|
4 |
<div id="itro_popup" style="visibility:hidden">
|
5 |
<?php
|
6 |
+
if( itro_get_option('age_restriction') == NULL ) /* age restriction off */
|
7 |
{
|
8 |
if( itro_get_option('popup_time') != 0 )
|
9 |
{
|
12 |
echo '<b id="timer"></b></div>';
|
13 |
}
|
14 |
|
15 |
+
$selected_cross = itroPath . 'images/close-icon.png'; /* default image (black cross) */
|
16 |
switch( itro_get_option('cross_selected') )
|
17 |
{
|
18 |
case 'white':
|
27 |
echo '" onclick="jQuery(\'#itro_popup\').fadeOut(function(){itro_opaco.style.visibility=\'hidden\';})">';
|
28 |
}?>
|
29 |
<div id="popup_content"><?php
|
30 |
+
$custom_field = stripslashes(itro_get_field('custom_html')); /* insert custom html code */
|
31 |
+
echo str_replace("\r\n",'',$custom_field); /* return the string whitout new line */
|
32 |
if ( itro_get_option('age_restriction') == 'yes' )
|
33 |
{?>
|
34 |
<p id="age_button_area" align="center">
|