ITRO Popup Plugin - Version 5.1

Version Description

ADDED: control for logged users for popup display

Download this release

Release Info

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

Code changes from version 5.0.3 to 5.1

Files changed (4) hide show
  1. admin/popup-admin.php +13 -5
  2. functions/core-function.php +36 -21
  3. mc-main.php +2 -2
  4. readme.txt +5 -2
admin/popup-admin.php CHANGED
@@ -60,7 +60,8 @@ if( !isset($submitted_form ))
60
  /*opt 34*/'enter_button_url',
61
  /*opt 35*/'absolute_mobile_pos',
62
  /*opt 36*/'countdown_text',
63
- /*opt 37*/'close_cross_url'
 
64
  );
65
 
66
  $submitted_form = 'mt_submit_hidden';
@@ -164,7 +165,7 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
164
  <script type="text/javascript" src="<?php echo itroPath . 'scripts/'; ?>jscolor/jscolor.js"></script>
165
 
166
  <div style="display:table; width:100%;">
167
- <h1 style="float:left;"><?php _e( 'I.T.RO. Popup Plugin - Settings', 'itro-plugin');?></h1>
168
  <h4 style="float:right; margin-right:30px;">VER: <?php echo $ITRO_VER; ?></h4>
169
  </div>
170
 
@@ -190,10 +191,17 @@ if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isse
190
  <!-- popup display location!-->
191
  <p>
192
  <h3><?php _e("DECIDE WHERE POPUP WILL BE DISPLAYED","itro-plugin")?></h3>
 
 
 
 
 
 
 
193
  <fieldset>
194
- <input type="radio" id="only_selected" name="<?php echo $opt_name[18];?>" value="some"<?php if($opt_val[18]=='some'){echo 'checked="checked"';} ?>/><?php _e("Only selected pages", 'itro-plugin' ); ?><img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e("Multiple choices with CTRL+Click or SHIFT+Arrow up or down",'itro-plugin');?>">&nbsp;&nbsp;&nbsp;
195
- <input type="radio" name="<?php echo $opt_name[18];?>" value="all" <?php if($opt_val[18]=='all' ){echo 'checked="checked"';} ?>/><?php _e("All pages", 'itro-plugin' ); ?>&nbsp;&nbsp;&nbsp;
196
- <input type="radio" name="<?php echo $opt_name[18];?>" value="none" <?php if($opt_val[18]=='none' || $opt_val[18]== NULL){echo 'checked="checked"';} ?>/><?php _e("No page", 'itro-plugin' ); ?>
197
  </fieldset>
198
  <div onClick="document.getElementById('only_selected').checked = true;">
199
  <select name="<?php echo $opt_name[19]; ?>" multiple size="1">
60
  /*opt 34*/'enter_button_url',
61
  /*opt 35*/'absolute_mobile_pos',
62
  /*opt 36*/'countdown_text',
63
+ /*opt 37*/'close_cross_url',
64
+ /*opt 38*/'users_display'
65
  );
66
 
67
  $submitted_form = 'mt_submit_hidden';
165
  <script type="text/javascript" src="<?php echo itroPath . 'scripts/'; ?>jscolor/jscolor.js"></script>
166
 
167
  <div style="display:table; width:100%;">
168
+ <h1 style="float:left;"><?php _e( 'ITRO Popup Plugin - Settings', 'itro-plugin');?></h1>
169
  <h4 style="float:right; margin-right:30px;">VER: <?php echo $ITRO_VER; ?></h4>
170
  </div>
171
 
191
  <!-- popup display location!-->
192
  <p>
193
  <h3><?php _e("DECIDE WHERE POPUP WILL BE DISPLAYED","itro-plugin")?></h3>
194
+ <h4>For the users:</h4>
195
+ <fieldset>
196
+ <input type="radio" name="<?php echo $opt_name[38];?>" id="clickable_a" value="all" <?php if($opt_val[38]=='all'){echo 'checked="checked"';} ?>/> <label for="clickable_a"> <?php _e('All users', 'itro-plugin'); ?> </label> &nbsp;&nbsp;&nbsp;
197
+ <input type="radio" name="<?php echo $opt_name[38];?>" id="clickable_b" value="not_logged" <?php if($opt_val[38]=='not_logged'){echo 'checked="checked"';} ?>/> <label for="clickable_b"> <?php _e('Not logged in users ', 'itro-plugin'); ?> </label> &nbsp;&nbsp;&nbsp;
198
+ <input type="radio" name="<?php echo $opt_name[38];?>" id="clickable_c" value="logged" <?php if($opt_val[38]=='logged' || $opt_name[38]==NULL){echo 'checked="checked"';} ?>/> <label for="clickable_c"> <?php _e('Logged in users', 'itro-plugin'); ?> </label>
199
+ </fieldset>
200
+ <h4>For the page:</h4>
201
  <fieldset>
202
+ <input type="radio" id="only_selected" name="<?php echo $opt_name[18];?>" value="some"<?php if($opt_val[18]=='some'){echo 'checked="checked"';} ?>/> <label for="only_selected"> <?php _e("Only selected pages", 'itro-plugin' ); ?> </label> <img style="vertical-align:super; cursor:help" src="<?php echo itroImages . 'question_mark.png' ; ?>" title="<?php _e("Multiple choices with CTRL+Click or SHIFT+Arrow up or down",'itro-plugin');?>">&nbsp;&nbsp;&nbsp;
203
+ <input type="radio" id="only_selected_a" name="<?php echo $opt_name[18];?>" value="all" <?php if($opt_val[18]=='all' ){echo 'checked="checked"';} ?>/> <label for="only_selected_a"> <?php _e("All pages", 'itro-plugin' ); ?> </label> &nbsp;&nbsp;&nbsp;
204
+ <input type="radio" id="only_selected_b" name="<?php echo $opt_name[18];?>" value="none" <?php if($opt_val[18]=='none' || $opt_val[18]== NULL){echo 'checked="checked"';} ?>/> <label for="only_selected_b"> <?php _e("No page", 'itro-plugin' ); ?> </label>
205
  </fieldset>
206
  <div onClick="document.getElementById('only_selected').checked = true;">
207
  <select name="<?php echo $opt_name[19]; ?>" multiple size="1">
functions/core-function.php CHANGED
@@ -78,7 +78,7 @@ function itro_display_popup() {
78
  if ($popup_fired === true) {
79
  return;
80
  }
81
-
82
  /* check if it is the preview visualization */
83
  if (!empty($_GET['itro_preview']) && $_GET['itro_preview'] == 'yes' && is_user_logged_in()) {
84
  $is_preview = true;
@@ -86,7 +86,22 @@ function itro_display_popup() {
86
  $is_preview = false;
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  /* woocommerce shop page identification */
 
90
  $woo_shop = NULL;
91
  $woo_shop_id = NULL;
92
  if (function_exists('is_shop') && function_exists('wc_get_page_id')) /* if this functions exist, woocommerce is installed! */ {
@@ -109,7 +124,8 @@ function itro_display_popup() {
109
  case 'some':
110
  if (isset($selected_page_id)) {
111
  foreach ($selected_page_id as $single_id) {
112
- if ($single_id == $current_page_id || ( $single_id == $woo_shop_id && $woo_shop )) /* if the selected id is the current page id popup will be displayed OR if the woo_shop_id has been selected and you are in the woocommerce standard shop page ($woo_shop == true), popup will be displayed. */ {
 
113
  $id_match++;
114
  }
115
  }
@@ -117,30 +133,24 @@ function itro_display_popup() {
117
  if ((is_front_page() && itro_get_option('blog_home') == 'yes') || (is_home() && itro_get_option('blog_home') == 'yes')) {
118
  $id_match++;
119
  }
120
- if ($id_match != NULL || $is_preview) {
121
- $popup_fired = true;
122
- itro_style();
123
- itro_popup_template();
124
- itro_popup_js();
125
  }
126
  break;
127
- case 'all':
128
- $popup_fired = true;
129
- itro_style();
130
- itro_popup_template();
131
- itro_popup_js();
132
- break;
133
  case 'none':
134
- if ($is_preview) {
135
- $popup_fired = true;
136
- itro_style();
137
- itro_popup_template();
138
- itro_popup_js();
139
  }
140
  break;
141
- }
 
142
  }
143
-
 
 
 
 
 
144
  /* ------------------------- SELECT PAGES FUNCTIONS */
145
 
146
  function itro_check_selected_id($id_to_check) {
@@ -221,7 +231,12 @@ function ipp_validate_data($data_name, $data) {
221
  $data = ($data != 'yes' ? NULL : $data );
222
  break;
223
  case 'page_selection':
224
- if (!in_array($data, array('some', 'all', 'none'))) {
 
 
 
 
 
225
  $data = 'none';
226
  }
227
  break;
78
  if ($popup_fired === true) {
79
  return;
80
  }
81
+
82
  /* check if it is the preview visualization */
83
  if (!empty($_GET['itro_preview']) && $_GET['itro_preview'] == 'yes' && is_user_logged_in()) {
84
  $is_preview = true;
86
  $is_preview = false;
87
  }
88
 
89
+ /*user display control*/
90
+ switch (itro_get_option('users_display')){
91
+ case 'logged':
92
+ if(!is_user_logged_in() && !$is_preview){
93
+ return;
94
+ }
95
+ break;
96
+ case 'not_logged':
97
+ if (is_user_logged_in() && !$is_preview) {
98
+ return;
99
+ }
100
+ break;
101
+ }
102
+
103
  /* woocommerce shop page identification */
104
+ //TODO: controllare se è ancora necessaria la verifica dell'id della pagina shop
105
  $woo_shop = NULL;
106
  $woo_shop_id = NULL;
107
  if (function_exists('is_shop') && function_exists('wc_get_page_id')) /* if this functions exist, woocommerce is installed! */ {
124
  case 'some':
125
  if (isset($selected_page_id)) {
126
  foreach ($selected_page_id as $single_id) {
127
+ /* 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. */
128
+ if ($single_id == $current_page_id || ( $single_id == $woo_shop_id && $woo_shop )) {
129
  $id_match++;
130
  }
131
  }
133
  if ((is_front_page() && itro_get_option('blog_home') == 'yes') || (is_home() && itro_get_option('blog_home') == 'yes')) {
134
  $id_match++;
135
  }
136
+ if ($id_match == NULL && !$is_preview) {
137
+ return;
 
 
 
138
  }
139
  break;
 
 
 
 
 
 
140
  case 'none':
141
+ if (!$is_preview) {
142
+ return;
 
 
 
143
  }
144
  break;
145
+ }
146
+ itro_render_popup();
147
  }
148
+ function itro_render_popup(){
149
+ itro_style();
150
+ itro_popup_template();
151
+ itro_popup_js();
152
+ }
153
+
154
  /* ------------------------- SELECT PAGES FUNCTIONS */
155
 
156
  function itro_check_selected_id($id_to_check) {
231
  $data = ($data != 'yes' ? NULL : $data );
232
  break;
233
  case 'page_selection':
234
+ if (!in_array($data, ['some', 'all', 'none'])) {
235
+ $data = 'none';
236
+ }
237
+ break;
238
+ case 'users_display':
239
+ if (!in_array($data, ['logged', 'all', 'not_logged'])) {
240
  $data = 'none';
241
  }
242
  break;
mc-main.php CHANGED
@@ -6,14 +6,14 @@ Description: EN - Show a perfecly centered customizable popup and a popup-system
6
  Author: ITRO Team
7
  E-mail: support@itroteam.com
8
  Text Domain: itro-popup
9
- Version: 5.0.3
10
  Author URI: https://www.itroteam.com
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
  global $ITRO_VER;
16
- $ITRO_VER = '5.0.3';
17
 
18
  global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
19
  $popup_fired = false;
6
  Author: ITRO Team
7
  E-mail: support@itroteam.com
8
  Text Domain: itro-popup
9
+ Version: 5.1
10
  Author URI: https://www.itroteam.com
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
  global $ITRO_VER;
16
+ $ITRO_VER = '5.1';
17
 
18
  global $popup_fired; //it check if there is a popup visualization via shortcode or via automatic visualization
19
  $popup_fired = false;
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === ITRO Popup Plugin ===
2
- Contributors: ITRO
3
  Donate link: https://www.itroteam.com/leave-a-review/
4
  Tags: multilingual popup, popup, popup message, popuup optin, popup box, popup ads, popup advertising, popup block, popup content warning, fancy box, fancy popup, advertising popup, pop-up, lightbox popup
5
  Requires at least: 3.0.1
6
  Tested up to: 5.2.2
7
- Stable tag: 5.0.3
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -131,6 +131,9 @@ LIVE DEMOS - [CLICK HERE!](https://www.itroteam.com/wordpress-popup-samples-demo
131
  BACKEND SCREENSHOT - [CLICK HERE!](https://www.itroteam.com/wordpress-popup-samples-demos/#backend)
132
 
133
  == Changelog ==
 
 
 
134
  = 5.0.3 =
135
  FIXED: woocommerce deprecated function:view support request https://wordpress.org/support/topic/woocommerce_get_page_id-deprecated-2/
136
 
1
  === ITRO Popup Plugin ===
2
+ Contributors: ITRO,martinalucaroni
3
  Donate link: https://www.itroteam.com/leave-a-review/
4
  Tags: multilingual popup, popup, popup message, popuup optin, popup box, popup ads, popup advertising, popup block, popup content warning, fancy box, fancy popup, advertising popup, pop-up, lightbox popup
5
  Requires at least: 3.0.1
6
  Tested up to: 5.2.2
7
+ Stable tag: 5.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
131
  BACKEND SCREENSHOT - [CLICK HERE!](https://www.itroteam.com/wordpress-popup-samples-demos/#backend)
132
 
133
  == Changelog ==
134
+ = 5.1 =
135
+ ADDED: control for logged users for popup display
136
+
137
  = 5.0.3 =
138
  FIXED: woocommerce deprecated function:view support request https://wordpress.org/support/topic/woocommerce_get_page_id-deprecated-2/
139