Popups, Welcome Bar, Optins and Lead Generation Plugin – Icegram - Version 1.8

Version Description

Target campaigns to any page with wildcard URL support in "Where" conditions and CTA Click based retargeting.

Download this release

Release Info

Developer niravmehta
Plugin Icon 128x128 Popups, Welcome Bar, Optins and Lead Generation Plugin – Icegram
Version 1.8
Comparing to
See all releases

Code changes from version 1.7.1 to 1.8

assets/css/admin.css CHANGED
@@ -130,9 +130,28 @@ th.message_header {
130
  content: "\f348";
131
  }
132
 
 
 
 
 
 
133
  .campaign_shortcode {
134
  display: block;
135
  margin-left: 30%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
 
138
  label[for=device_mobile] {
@@ -635,4 +654,39 @@ CSS for landing page and Help and Support
635
  .campaign_target_rules_panel .messages_list_table p.inline{
636
  display: block;
637
  margin: 1em 0;
638
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  content: "\f348";
131
  }
132
 
133
+ .shortcode_description.light{
134
+ content: "\f348";
135
+ color: #777;
136
+ }
137
+
138
  .campaign_shortcode {
139
  display: block;
140
  margin-left: 30%;
141
+ color:#777;
142
+ }
143
+
144
+ .campaign_shortcode.light {
145
+ float: right;
146
+ width: 34%;
147
+ margin-left: 0px !important;
148
+ border: 1px dashed #cccccc;
149
+ padding: 5px;
150
+ }
151
+
152
+ .campaign_shortcode.light code{
153
+ color: #777;
154
+
155
  }
156
 
157
  label[for=device_mobile] {
654
  .campaign_target_rules_panel .messages_list_table p.inline{
655
  display: block;
656
  margin: 1em 0;
657
+ }
658
+
659
+ .campaign_target_rules_panel .form-field .delete-url:before{
660
+ font-family: dashicons;
661
+ content: "\f182";
662
+ cursor: pointer;
663
+ }
664
+ .campaign_target_rules_panel .form-field .url_input_field{
665
+ width:65% !important;
666
+ }
667
+
668
+
669
+ .campaign_target_rules_panel #valid-field{
670
+ margin-left: 92%;
671
+ }
672
+
673
+ .campaign_target_rules_panel #valid-field.error{
674
+ font-family: dashicons;
675
+ font-size: 1.5em;
676
+ color: #ff0000;
677
+ vertical-align: middle;
678
+ display: inline-block;
679
+ -webkit-font-smoothing: antialiased;
680
+ cursor: help;
681
+ }
682
+
683
+ .campaign_target_rules_panel #valid-field.error:after{
684
+ content: "\f223";
685
+ }
686
+
687
+ .campaign_target_rules_panel #add-url-icon:after{
688
+ font-family: dashicons;
689
+ content: "\f132";
690
+ vertical-align: middle;
691
+ }
692
+
assets/js/admin.js CHANGED
@@ -1,5 +1,6 @@
1
  jQuery(function() {
2
-
 
3
  function display_message_themes(this_data) {
4
  var message_type = jQuery(this_data).find('.message_type option:selected').val();
5
  var message_theme = jQuery(this_data).find('.message_row.'+message_type).find('.message_theme').val();
@@ -287,16 +288,29 @@ jQuery(function() {
287
  jQuery('.message-setting-fields').trigger('change');
288
  jQuery(".tips, .help_tip").tipTip({'attribute' : 'data-tip'});
289
  QTags._buttonsInit();
290
- //quicktags({id : 'edit'+response.id});
291
- // tinyMCE.init({
292
- // skin : 'edit'+response.id
293
- // });
294
- //tinymce.init(tinyMCEPreInit.mceInit['edit'+response.id]);
295
-
296
  }
297
  });
298
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
 
 
 
 
 
300
  function hide_empty_campaign_message() {
301
  if( jQuery('.message-row').length == 0 ) {
302
  jQuery('.empty_campaign').show();
@@ -366,6 +380,9 @@ jQuery(function() {
366
  jQuery('#exclude_page_id_chosen').find('input').trigger('click');
367
  }
368
  });
 
 
 
369
 
370
  jQuery('.date-picker').datepicker({
371
  dateFormat: 'yy-mm-dd',
@@ -376,4 +393,16 @@ jQuery(function() {
376
  changeYear: true,
377
  showButtonPanel: true
378
  });
 
 
 
 
 
 
 
 
 
 
 
 
379
  });
1
  jQuery(function() {
2
+ var src = window.location.href;
3
+ var home_url = src.slice(0,src.indexOf('wp-admin'));
4
  function display_message_themes(this_data) {
5
  var message_type = jQuery(this_data).find('.message_type option:selected').val();
6
  var message_theme = jQuery(this_data).find('.message_row.'+message_type).find('.message_theme').val();
288
  jQuery('.message-setting-fields').trigger('change');
289
  jQuery(".tips, .help_tip").tipTip({'attribute' : 'data-tip'});
290
  QTags._buttonsInit();
 
 
 
 
 
 
291
  }
292
  });
293
  });
294
+ //add local url
295
+ jQuery('#add_local_url_row').live('click', function(e) {
296
+ e.preventDefault();
297
+ var row = add_url_row();
298
+ if(jQuery('.local_url').find('.url_input_field').length){
299
+ jQuery(row).insertAfter(jQuery('.local_url').find('.url_input_field').last().parent('span'));
300
+ }else{
301
+ jQuery(row).insertBefore(jQuery('.local_url').find('#add_local_url_row_label'));
302
+
303
+ }
304
+
305
+ });
306
+ jQuery('.delete-url').live('click', function(e) {
307
+ jQuery(this).parent().remove();
308
+ });
309
 
310
+ function add_url_row(){
311
+ var row = '<span><label class="options_header"><span id="valid-field"> </span></label> <input type="text" class="url_input_field" data-option="local_url" name="campaign_target_rules[local_urls][]" value="'+home_url+'*"/><span class="delete-url"></span></span>';
312
+ return row;
313
+ }
314
  function hide_empty_campaign_message() {
315
  if( jQuery('.message-row').length == 0 ) {
316
  jQuery('.empty_campaign').show();
380
  jQuery('#exclude_page_id_chosen').find('input').trigger('click');
381
  }
382
  });
383
+ jQuery('input#where_local_url').on('change', function() {
384
+ jQuery('.local_url').slideToggle();
385
+ });
386
 
387
  jQuery('.date-picker').datepicker({
388
  dateFormat: 'yy-mm-dd',
393
  changeYear: true,
394
  showButtonPanel: true
395
  });
396
+
397
+ jQuery('input.url_input_field').live('focusout', function() {
398
+ var url = this;
399
+ jQuery(url).parent().find('span#valid-field').removeClass('error');
400
+ if(jQuery(url).data("option") !== 'undefine' && jQuery(url).data("option") == 'local_url' && jQuery(url).val() != '*'){
401
+ var url_val = url.value;
402
+ if(url_val.indexOf(home_url) < 0){
403
+ jQuery(url).val(home_url + url_val);
404
+ return;
405
+ }
406
+ }
407
+ });
408
  });
assets/js/icegram.js CHANGED
@@ -40,6 +40,9 @@
40
  if(jQuery.cookie('icegram_messages_shown_'+v['id']) == 1){
41
  return;
42
  }
 
 
 
43
 
44
  var m = null;
45
  var classname_suffix = v['type'].split('-').join(' ').ucwords().split(' ').join('_');
@@ -345,7 +348,7 @@
345
  Icegram_Message_Type.prototype.track = function ( e, params ) {
346
  if (typeof( window.icegram.track ) === 'function' ) {
347
  params = params || {};
348
- jQuery.extend( params, {message_id: this.data.id, campaign_id: this.data.campaign_id ,expiry_time:this.data.expiry_time} );
349
  window.icegram.track( e, params);
350
  }
351
  };
40
  if(jQuery.cookie('icegram_messages_shown_'+v['id']) == 1){
41
  return;
42
  }
43
+ if(jQuery.cookie('icegram_messages_clicked_'+v['id']) == 1){
44
+ return;
45
+ }
46
 
47
  var m = null;
48
  var classname_suffix = v['type'].split('-').join(' ').ucwords().split(' ').join('_');
348
  Icegram_Message_Type.prototype.track = function ( e, params ) {
349
  if (typeof( window.icegram.track ) === 'function' ) {
350
  params = params || {};
351
+ jQuery.extend( params, {message_id: this.data.id, campaign_id: this.data.campaign_id ,expiry_time:this.data.expiry_time ,expiry_time_clicked:this.data.expiry_time_clicked} );
352
  window.icegram.track( e, params);
353
  }
354
  };
classes/class-icegram-campaign-admin.php CHANGED
@@ -7,7 +7,7 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
7
  class Icegram_Campaign_Admin {
8
 
9
  var $default_target_rules;
10
-
11
  function __construct() {
12
 
13
  add_action( 'add_meta_boxes', array( &$this, 'add_campaigns_metaboxes' ), 0 );
@@ -18,6 +18,8 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
18
  add_action( 'wp_ajax_save_campaign_preview', array( &$this, 'save_campaign_preview' ) );
19
  add_action( 'icegram_campaign_target_rules', array( &$this, 'icegram_add_campaign_target_rules' ), 10, 2 );
20
 
 
 
21
  $this->default_target_rules = apply_filters( 'icegram_campaign_default_rules',
22
  array ( 'homepage' => 'yes',
23
  'when' => 'always',
@@ -144,6 +146,10 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
144
  <label for="where_sitewide">
145
  <input type="checkbox" name="campaign_target_rules[sitewide]" id="where_sitewide" value="yes" <?php ( !empty( $campaign_target_rules['sitewide'] ) ) ? checked( $campaign_target_rules['sitewide'], 'yes' ) : ''; ?> />
146
  <?php _e( 'Sitewide', 'icegram' ); ?>
 
 
 
 
147
  </label>
148
  </p>
149
  <p class="form-field" <?php echo ( !empty( $campaign_target_rules['sitewide'] ) && $campaign_target_rules['sitewide'] == 'yes' ) ? '' : 'style="display: none;"'; ?>>
@@ -189,11 +195,32 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
189
  ?>
190
  </p>
191
  <p class="form-field">
192
- <label class="campaign_shortcode">
193
- <span class="shortcode_description admin_field_icon"></span>
194
- <?php echo sprintf(__( 'Additionally you can insert <code>[%s]</code> wherever you want to run this campaign.', 'icegram' ), 'icegram campaigns="' .$campaign_id . '"' ); ?>
 
195
  </label>
196
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  </div>
198
  <div class="options_group" id="campaign_target_rules_when">
199
  <p class="form-field">
@@ -287,14 +314,25 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
287
  </label>
288
  </p>
289
  </div>
290
- <?php $expiry_options = array( 'current_session' => __('Current Session' ,'icegram'),
 
291
  'today' => __('Today' ,'icegram'),
292
  '+1 week' => __('One week' ,'icegram') ,
293
- '+2 week' => __('Two week' ,'icegram'),
294
  '+1 month' => __('One Month ' ,'icegram'),
295
  '+3 months' => __('Three Months ' ,'icegram') ,
296
  '+1 year' => __('One year' ,'icegram') ,
297
  '+2 years' => __('Two Years' ,'icegram'));
 
 
 
 
 
 
 
 
 
 
298
  ?>
299
  <div class="options_group" id="campaign_target_rules_retrageting">
300
  <p class="form-field">
@@ -303,7 +341,7 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
303
  <input type="checkbox" name="campaign_target_rules[retargeting]" id="retargeting" value="yes" <?php ( !empty( $campaign_target_rules['retargeting'] ) ) ? checked( $campaign_target_rules['retargeting'], 'yes' ) : ''; ?> />
304
  <?php _e( 'Once shown, do NOT show a message again for', 'icegram' ); ?>
305
  <select name="campaign_target_rules[expiry_time]">
306
- <?php foreach($expiry_options as $key => $option){
307
  ?>
308
  <option value="<?php echo $key; ?>" <?php selected( $campaign_target_rules['expiry_time'], $key ); ?>><?php echo $option; ?></option>
309
  <?php
@@ -312,6 +350,21 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
312
  </select>
313
  </label>
314
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  </div>
316
  <?php
317
  }
@@ -459,9 +512,25 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
459
  if ( empty( $_POST['icegram_campaign_meta_nonce'] ) || ! wp_verify_nonce( $_POST['icegram_campaign_meta_nonce'], 'icegram_campaign_save_data' ) ) return;
460
  if (! current_user_can( 'edit_post', $post_id )) return;
461
  if ($post->post_type != 'ig_campaign') return;
462
-
463
  $campaign_target_rules = apply_filters( 'icegram_update_campaign_rules', $_POST['campaign_target_rules'], $post_id );
464
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  if ( isset( $_POST['page_id'] ) ) {
466
  $campaign_target_rules['page_id'] = $_POST['page_id'];
467
  update_post_meta( $post_id, 'icegram_campaign_target_pages', $_POST['page_id'] );
7
  class Icegram_Campaign_Admin {
8
 
9
  var $default_target_rules;
10
+ var $site_url;
11
  function __construct() {
12
 
13
  add_action( 'add_meta_boxes', array( &$this, 'add_campaigns_metaboxes' ), 0 );
18
  add_action( 'wp_ajax_save_campaign_preview', array( &$this, 'save_campaign_preview' ) );
19
  add_action( 'icegram_campaign_target_rules', array( &$this, 'icegram_add_campaign_target_rules' ), 10, 2 );
20
 
21
+ $this->site_url = site_url().'/';
22
+
23
  $this->default_target_rules = apply_filters( 'icegram_campaign_default_rules',
24
  array ( 'homepage' => 'yes',
25
  'when' => 'always',
146
  <label for="where_sitewide">
147
  <input type="checkbox" name="campaign_target_rules[sitewide]" id="where_sitewide" value="yes" <?php ( !empty( $campaign_target_rules['sitewide'] ) ) ? checked( $campaign_target_rules['sitewide'], 'yes' ) : ''; ?> />
148
  <?php _e( 'Sitewide', 'icegram' ); ?>
149
+ <span class="campaign_shortcode light">
150
+ <span class="shortcode_description admin_field_icon light"></span>
151
+ <?php echo sprintf(__( 'Additionally you can insert <br /><code>[%s]</code> wherever you want to run this campaign.', 'icegram' ), 'icegram campaigns="' .$campaign_id . '"' ); ?>
152
+ </span>
153
  </label>
154
  </p>
155
  <p class="form-field" <?php echo ( !empty( $campaign_target_rules['sitewide'] ) && $campaign_target_rules['sitewide'] == 'yes' ) ? '' : 'style="display: none;"'; ?>>
195
  ?>
196
  </p>
197
  <p class="form-field">
198
+ <label class="options_header">&nbsp;</label>
199
+ <label for="where_local_url">
200
+ <input type="checkbox" name="campaign_target_rules[local_url]" id="where_local_url" value="yes" <?php ( !empty( $campaign_target_rules['local_url'] ) ) ? checked( $campaign_target_rules['local_url'], 'yes' ) : ''; ?> />
201
+ <?php _e( 'Specific URLs on this site', 'icegram' ); ?>
202
  </label>
203
  </p>
204
+ <p class="form-field local_url" <?php echo ( !empty( $campaign_target_rules['local_url'] ) && $campaign_target_rules['local_url'] == 'yes' ) ? '' : 'style="display: none;"'; ?>>
205
+ <?php
206
+ if(!empty($campaign_target_rules['local_urls'])){
207
+ foreach ($campaign_target_rules['local_urls'] as $url) {?>
208
+ <span><label class="options_header"><span id="valid-field"> </span></label>
209
+ <input type="text" data-option="local_url" class="url_input_field" name="campaign_target_rules[local_urls][]" value="<?php echo $this->site_url.$url ;?>"/><span class="delete-url"></span></span>
210
+ <?php
211
+ }
212
+ }else{ ?>
213
+ <span><label class="options_header"><span id="valid-field"> </span></label>
214
+ <input type="text" data-option="local_url" class="url_input_field" name="campaign_target_rules[local_urls][]" value="<?php echo $this->site_url.'*' ;?>"/><span class="delete-url"></span></span>
215
+ <?php }
216
+ ?>
217
+ <label class="options_header " id="add_local_url_row_label">&nbsp;</label><span id="add-url-icon"> </span><a class="campaign_add_url" id="add_local_url_row" href="#"><?php _e( ' Add another', 'icegram' ); ?></a>
218
+ </p>
219
+
220
+ <?php
221
+ do_action( 'icegram_after_campaign_where_rule', $campaign_id, $campaign_target_rules );
222
+ ?>
223
+
224
  </div>
225
  <div class="options_group" id="campaign_target_rules_when">
226
  <p class="form-field">
314
  </label>
315
  </p>
316
  </div>
317
+ <?php $expiry_options_for_shown = array( 'current_session' => __('Current Session' ,'icegram'),
318
+ '+50 years' => __('Never' ,'icegram'),
319
  'today' => __('Today' ,'icegram'),
320
  '+1 week' => __('One week' ,'icegram') ,
321
+ '+2 week' => __('Two weeks' ,'icegram'),
322
  '+1 month' => __('One Month ' ,'icegram'),
323
  '+3 months' => __('Three Months ' ,'icegram') ,
324
  '+1 year' => __('One year' ,'icegram') ,
325
  '+2 years' => __('Two Years' ,'icegram'));
326
+ $expiry_options_for_clicked = array( '+50 years' => __('Never' ,'icegram'),
327
+ 'current_session' => __('Current Session' ,'icegram'),
328
+ 'today' => __('Today' ,'icegram'),
329
+ '+1 week' => __('One week' ,'icegram') ,
330
+ '+2 week' => __('Two weeks' ,'icegram'),
331
+ '+1 month' => __('One Month ' ,'icegram'),
332
+ '+3 months' => __('Three Months ' ,'icegram') ,
333
+ '+1 year' => __('One year' ,'icegram') ,
334
+ '+2 years' => __('Two Years' ,'icegram'));
335
+
336
  ?>
337
  <div class="options_group" id="campaign_target_rules_retrageting">
338
  <p class="form-field">
341
  <input type="checkbox" name="campaign_target_rules[retargeting]" id="retargeting" value="yes" <?php ( !empty( $campaign_target_rules['retargeting'] ) ) ? checked( $campaign_target_rules['retargeting'], 'yes' ) : ''; ?> />
342
  <?php _e( 'Once shown, do NOT show a message again for', 'icegram' ); ?>
343
  <select name="campaign_target_rules[expiry_time]">
344
+ <?php foreach($expiry_options_for_shown as $key => $option){
345
  ?>
346
  <option value="<?php echo $key; ?>" <?php selected( $campaign_target_rules['expiry_time'], $key ); ?>><?php echo $option; ?></option>
347
  <?php
350
  </select>
351
  </label>
352
  </p>
353
+ <p class="form-field">
354
+ <label class="options_header">&nbsp;</label>
355
+ <label for="retargeting_clicked">
356
+ <input type="checkbox" name="campaign_target_rules[retargeting_clicked]" id="retargeting_clicked" value="yes" <?php ( !empty( $campaign_target_rules['retargeting_clicked'] ) ) ? checked( $campaign_target_rules['retargeting_clicked'], 'yes' ) : ''; ?> />
357
+ <?php _e( 'Once CTA is clicked, do NOT show a message again for', 'icegram' ); ?>
358
+ <select name="campaign_target_rules[expiry_time_clicked]">
359
+ <?php foreach($expiry_options_for_clicked as $key => $option){
360
+ ?>
361
+ <option value="<?php echo $key; ?>" <?php selected( $campaign_target_rules['expiry_time_clicked'], $key ); ?>><?php echo $option; ?></option>
362
+ <?php
363
+ }
364
+ ?>
365
+ </select>
366
+ </label>
367
+ </p>
368
  </div>
369
  <?php
370
  }
512
  if ( empty( $_POST['icegram_campaign_meta_nonce'] ) || ! wp_verify_nonce( $_POST['icegram_campaign_meta_nonce'], 'icegram_campaign_save_data' ) ) return;
513
  if (! current_user_can( 'edit_post', $post_id )) return;
514
  if ($post->post_type != 'ig_campaign') return;
515
+
516
  $campaign_target_rules = apply_filters( 'icegram_update_campaign_rules', $_POST['campaign_target_rules'], $post_id );
517
+
518
+ if(!empty($campaign_target_rules) && !empty($campaign_target_rules['local_urls'])){
519
+ foreach ($campaign_target_rules['local_urls'] as $key => $url) {
520
+ if( !empty( $url ) ){
521
+ if( $url == '*'){
522
+ $campaign_target_rules['local_urls'][$key] = $url;
523
+ }else{
524
+ $url = str_replace($this->site_url, '', $url);
525
+ $campaign_target_rules['local_urls'][$key] = $url;
526
+ }
527
+ } else {
528
+ unset($campaign_target_rules['local_urls'][$key]);
529
+ }
530
+ }
531
+
532
+ }
533
+
534
  if ( isset( $_POST['page_id'] ) ) {
535
  $campaign_target_rules['page_id'] = $_POST['page_id'];
536
  update_post_meta( $post_id, 'icegram_campaign_target_pages', $_POST['page_id'] );
classes/class-icegram-campaign.php CHANGED
@@ -25,7 +25,8 @@ if ( !class_exists( 'Icegram_Campaign' ) ) {
25
  'homepage' => ( !empty( $this->rules['homepage'] ) ) ? $this->rules['homepage'] : '',
26
  'other_page' => ( !empty( $this->rules['other_page'] ) && $this->rules['other_page'] == 'yes' && !empty( $this->rules['page_id'] ) ) ? $this->rules['page_id'] : '',
27
  'blog' => ( !empty( $this->rules['blog'] ) ) ? $this->rules['blog'] : '',
28
- 'sitewide' => ( !empty( $this->rules['sitewide'] ) ) ? $this->rules['sitewide'] : ''
 
29
  );
30
  $this->rules_summary['when'] = array(
31
  'when' => ( !empty( $this->rules['when'] ) ) ? $this->rules['when'] : '',
@@ -41,9 +42,11 @@ if ( !class_exists( 'Icegram_Campaign' ) ) {
41
 
42
  $this->rules_summary['retargeting'] = array( 'retargeting' => ( !empty( $this->rules['retargeting'] ) ) ? $this->rules['retargeting'] : '' ,
43
  'expiry_time' => ( !empty( $this->rules['retargeting']) ) ? $this->rules['expiry_time'] : '' );
 
 
44
 
45
  }
46
-
47
  add_filter( 'icegram_campaign_validation', array( $this, '_is_valid_user_roles' ), 10, 3 );
48
  add_filter( 'icegram_campaign_validation', array( $this, '_is_valid_device' ), 10, 3 );
49
  add_filter( 'icegram_campaign_validation', array( $this, '_is_valid_time' ), 10, 3 );
@@ -64,6 +67,7 @@ if ( !class_exists( 'Icegram_Campaign' ) ) {
64
  }
65
 
66
  function is_valid( $options = array() ) {
 
67
  if( !empty( $this->_post->ID ) ) {
68
  return apply_filters( 'icegram_campaign_validation', true, $this, $options );
69
  }
@@ -116,7 +120,7 @@ if ( !class_exists( 'Icegram_Campaign' ) ) {
116
 
117
  function _is_valid_page( $campaign_valid, $campaign, $options ) {
118
  $page_id = Icegram::get_current_page_id();
119
-
120
  if( !$campaign_valid || !empty($options['skip_page_check']) ) {
121
  return $campaign_valid;
122
  }
@@ -135,7 +139,28 @@ if ( !class_exists( 'Icegram_Campaign' ) ) {
135
  return true;
136
  }
137
  }
 
 
 
 
 
 
 
 
 
 
 
138
  return false;
139
  }
 
 
 
 
 
 
 
 
 
 
140
  }
141
  }
25
  'homepage' => ( !empty( $this->rules['homepage'] ) ) ? $this->rules['homepage'] : '',
26
  'other_page' => ( !empty( $this->rules['other_page'] ) && $this->rules['other_page'] == 'yes' && !empty( $this->rules['page_id'] ) ) ? $this->rules['page_id'] : '',
27
  'blog' => ( !empty( $this->rules['blog'] ) ) ? $this->rules['blog'] : '',
28
+ 'sitewide' => ( !empty( $this->rules['sitewide'] ) ) ? $this->rules['sitewide'] : '',
29
+ 'local_url' => ( !empty( $this->rules['local_url'] ) ) ? $this->rules['local_url'] : ''
30
  );
31
  $this->rules_summary['when'] = array(
32
  'when' => ( !empty( $this->rules['when'] ) ) ? $this->rules['when'] : '',
42
 
43
  $this->rules_summary['retargeting'] = array( 'retargeting' => ( !empty( $this->rules['retargeting'] ) ) ? $this->rules['retargeting'] : '' ,
44
  'expiry_time' => ( !empty( $this->rules['retargeting']) ) ? $this->rules['expiry_time'] : '' );
45
+ $this->rules_summary['retargeting_clicked'] = array( 'retargeting_clicked' => ( !empty( $this->rules['retargeting_clicked'] ) ) ? $this->rules['retargeting_clicked'] : '' ,
46
+ 'expiry_time_clicked' => ( !empty( $this->rules['retargeting_clicked']) ) ? $this->rules['expiry_time_clicked'] : '' );
47
 
48
  }
49
+
50
  add_filter( 'icegram_campaign_validation', array( $this, '_is_valid_user_roles' ), 10, 3 );
51
  add_filter( 'icegram_campaign_validation', array( $this, '_is_valid_device' ), 10, 3 );
52
  add_filter( 'icegram_campaign_validation', array( $this, '_is_valid_time' ), 10, 3 );
67
  }
68
 
69
  function is_valid( $options = array() ) {
70
+
71
  if( !empty( $this->_post->ID ) ) {
72
  return apply_filters( 'icegram_campaign_validation', true, $this, $options );
73
  }
120
 
121
  function _is_valid_page( $campaign_valid, $campaign, $options ) {
122
  $page_id = Icegram::get_current_page_id();
123
+ $current_page_url = Icegram::get_current_page_url();
124
  if( !$campaign_valid || !empty($options['skip_page_check']) ) {
125
  return $campaign_valid;
126
  }
139
  return true;
140
  }
141
  }
142
+ if ( (!empty( $campaign->rules_summary['where']['local_url'] ) && $campaign->rules_summary['where']['local_url'] == 'yes' )) {
143
+ $current_page_url = Icegram::get_current_page_url();
144
+ foreach ($campaign->rules['local_urls'] as $local_url_pattern) {
145
+ $result = $this->is_valid_url($local_url_pattern , $current_page_url);
146
+ if($result){
147
+ return $result;
148
+ }else{
149
+ continue;
150
+ }
151
+ }
152
+ }
153
  return false;
154
  }
155
+
156
+ static function is_valid_url($pattern ,$current_page_url){
157
+ $pattern = preg_quote($pattern,'/');
158
+ if( strpos($pattern, '*') !== false ){
159
+ $pattern = str_replace('\*', '[-a-zA-Z0-9+&@#\/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#\/%=~_|]', $pattern); //remaining to add characters like -,_ etc
160
+ }
161
+
162
+ $result = (bool) preg_match('/'.$pattern.'$/i', $current_page_url);
163
+ return $result;
164
+ }
165
  }
166
  }
icegram.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Icegram
4
  * Plugin URI: http://www.icegram.com/
5
  * Description: All in one solution to inspire, convert and engage your audiences. Action bars, Popup windows, Messengers, Toast notifications and more. Awesome themes and powerful rules.
6
- * Version: 1.7.1
7
  * Author: Icegram
8
  * Author URI: http://www.icegram.com/
9
  *
@@ -33,7 +33,7 @@ class Icegram {
33
 
34
  function __construct() {
35
 
36
- $this->version = "1.7.1";
37
  $this->shortcode_instances = array();
38
  $this->plugin_url = untrailingslashit( plugins_url( '/', __FILE__ ) );
39
  $this->plugin_path = untrailingslashit( plugin_dir_path( __FILE__ ) );
@@ -344,6 +344,21 @@ class Icegram {
344
  }
345
  }
346
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
 
348
  default:
349
  break;
@@ -536,6 +551,15 @@ class Icegram {
536
  unset( $messages[$key] );
537
  continue;
538
  }
 
 
 
 
 
 
 
 
 
539
 
540
  // Avoid showing the same message twice
541
  if (in_array($message_data['id'], $messages_to_show_ids)) {
@@ -595,8 +619,7 @@ class Icegram {
595
  wp_enqueue_script( 'icegram_js' );
596
  wp_localize_script( 'icegram_js', 'icegram_data', $icegram );
597
  }
598
-
599
-
600
  // Load JS and default CSS
601
  $types_shown = array_unique($types_shown);
602
 
@@ -811,6 +834,10 @@ class Icegram {
811
  $rule_value = $campaign->get_rule_value('retargeting');
812
  $message_data['retargeting'] = !empty( $rule_value['retargeting'] ) ? $rule_value['retargeting'] : '';
813
  $message_data['expiry_time'] = !empty( $rule_value['retargeting'] ) ? $rule_value['expiry_time'] : '';
 
 
 
 
814
  }
815
  }
816
  $valid_messages[$id] = $message_data;
@@ -837,6 +864,7 @@ class Icegram {
837
  $valid_campaigns = array();
838
  foreach ( (array) $campaign_ids as $campaign_id ) {
839
  $campaign = new Icegram_Campaign( $campaign_id );
 
840
  if ( $campaign->is_valid( array('skip_page_check' => $skip_page_check) ) ) {
841
  $valid_campaigns[$campaign_id] = $campaign;
842
  } else {
@@ -847,9 +875,9 @@ class Icegram {
847
  }
848
 
849
  function append_to_valid_campaigns_sql( $sql_params = array(), $options = array() ) {
850
-
851
  // Page check conditions
852
  $pid = Icegram::get_current_page_id();
 
853
  $sql = " AND (
854
  pm.meta_key = 'icegram_campaign_target_rules' AND (
855
  ( pm.meta_value LIKE '%%%s%%' )
@@ -859,17 +887,19 @@ class Icegram {
859
  $sql_params[] = 's:10:"other_page";s:3:"yes";';
860
  $sql_params[] = 's:7:"page_id";a:';
861
  $sql_params[] = serialize( (string) $pid );
862
-
 
 
 
863
  if (is_home() || is_front_page()) {
864
- $sql .= " OR ( pm.meta_value LIKE '%%%s%%' )
865
- ";
866
  $sql_params[] = 's:8:"homepage";s:3:"yes";';
867
  }
868
  $sql .=" ) )";
869
- $sql_params[0] .= $sql;
870
 
 
 
871
  //s:9:"logged_in";s:3:"all";
872
-
873
  return $sql_params;
874
  }
875
 
@@ -1229,6 +1259,19 @@ class Icegram {
1229
  static function get_current_page_id() {
1230
  return self::$current_page_id;
1231
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1232
 
1233
  function wpml_get_parent_id( $id ) {
1234
  global $post;
3
  * Plugin Name: Icegram
4
  * Plugin URI: http://www.icegram.com/
5
  * Description: All in one solution to inspire, convert and engage your audiences. Action bars, Popup windows, Messengers, Toast notifications and more. Awesome themes and powerful rules.
6
+ * Version: 1.8
7
  * Author: Icegram
8
  * Author URI: http://www.icegram.com/
9
  *
33
 
34
  function __construct() {
35
 
36
+ $this->version = "1.8";
37
  $this->shortcode_instances = array();
38
  $this->plugin_url = untrailingslashit( plugins_url( '/', __FILE__ ) );
39
  $this->plugin_path = untrailingslashit( plugin_dir_path( __FILE__ ) );
344
  }
345
  }
346
  break;
347
+ case 'clicked':
348
+ if (is_array($event['params']) && !empty($event['params']['message_id'])) {
349
+ $messages_clicked[] = $event['params']['message_id'];
350
+ if(!empty($event['params']['expiry_time_clicked'])){
351
+ if($event['params']['expiry_time_clicked'] =='today'){
352
+ $event['params']['expiry_time_clicked'] = strtotime('+1 day', mktime(0, 0, 0));
353
+ }else if($event['params']['expiry_time_clicked'] == 'current_session'){
354
+ $event['params']['expiry_time_clicked'] = 0;
355
+ }else{
356
+ $event['params']['expiry_time_clicked'] = strtotime($event['params']['expiry_time_clicked']);
357
+ }
358
+ setcookie('icegram_messages_clicked_'.$event['params']['message_id'],true , $event['params']['expiry_time_clicked'] , '/' );
359
+ }
360
+ }
361
+ break;
362
 
363
  default:
364
  break;
551
  unset( $messages[$key] );
552
  continue;
553
  }
554
+ if( !empty( $message_data['id'] ) &&
555
+ empty( $_GET['campaign_preview_id'] ) &&
556
+ !empty($_COOKIE['icegram_messages_clicked_'.$message_data['id']]) &&
557
+ !empty( $message_data['retargeting_clicked'] ) &&
558
+ $message_data['retargeting_clicked'] == 'yes'
559
+ ) {
560
+ unset( $messages[$key] );
561
+ continue;
562
+ }
563
 
564
  // Avoid showing the same message twice
565
  if (in_array($message_data['id'], $messages_to_show_ids)) {
619
  wp_enqueue_script( 'icegram_js' );
620
  wp_localize_script( 'icegram_js', 'icegram_data', $icegram );
621
  }
622
+
 
623
  // Load JS and default CSS
624
  $types_shown = array_unique($types_shown);
625
 
834
  $rule_value = $campaign->get_rule_value('retargeting');
835
  $message_data['retargeting'] = !empty( $rule_value['retargeting'] ) ? $rule_value['retargeting'] : '';
836
  $message_data['expiry_time'] = !empty( $rule_value['retargeting'] ) ? $rule_value['expiry_time'] : '';
837
+ $rule_value_retargeting_clicked = $campaign->get_rule_value('retargeting_clicked');
838
+ $message_data['retargeting_clicked'] = !empty( $rule_value_retargeting_clicked['retargeting_clicked'] ) ? $rule_value_retargeting_clicked['retargeting_clicked'] : '';
839
+ $message_data['expiry_time_clicked'] = !empty( $rule_value_retargeting_clicked['retargeting_clicked'] ) ? $rule_value_retargeting_clicked['expiry_time_clicked'] : '';
840
+
841
  }
842
  }
843
  $valid_messages[$id] = $message_data;
864
  $valid_campaigns = array();
865
  foreach ( (array) $campaign_ids as $campaign_id ) {
866
  $campaign = new Icegram_Campaign( $campaign_id );
867
+
868
  if ( $campaign->is_valid( array('skip_page_check' => $skip_page_check) ) ) {
869
  $valid_campaigns[$campaign_id] = $campaign;
870
  } else {
875
  }
876
 
877
  function append_to_valid_campaigns_sql( $sql_params = array(), $options = array() ) {
 
878
  // Page check conditions
879
  $pid = Icegram::get_current_page_id();
880
+
881
  $sql = " AND (
882
  pm.meta_key = 'icegram_campaign_target_rules' AND (
883
  ( pm.meta_value LIKE '%%%s%%' )
887
  $sql_params[] = 's:10:"other_page";s:3:"yes";';
888
  $sql_params[] = 's:7:"page_id";a:';
889
  $sql_params[] = serialize( (string) $pid );
890
+ //local url
891
+ $sql .= " OR ( pm.meta_value LIKE '%%%s%%' )";
892
+ $sql_params[] = 's:9:"local_url";s:3:"yes";';
893
+
894
  if (is_home() || is_front_page()) {
895
+ $sql .= " OR ( pm.meta_value LIKE '%%%s%%' )";
 
896
  $sql_params[] = 's:8:"homepage";s:3:"yes";';
897
  }
898
  $sql .=" ) )";
 
899
 
900
+ $sql_params[0] .= $sql;
901
+
902
  //s:9:"logged_in";s:3:"all";
 
903
  return $sql_params;
904
  }
905
 
1259
  static function get_current_page_id() {
1260
  return self::$current_page_id;
1261
  }
1262
+ static function get_current_page_url() {
1263
+ $pageURL = 'http';
1264
+ if( isset($_SERVER["HTTPS"]) ) {
1265
+ if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
1266
+ }
1267
+ $pageURL .= "://";
1268
+ if ($_SERVER["SERVER_PORT"] != "80") {
1269
+ $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
1270
+ } else {
1271
+ $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
1272
+ }
1273
+ return $pageURL;
1274
+ }
1275
 
1276
  function wpml_get_parent_id( $id ) {
1277
  global $post;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.icegram.com/
4
  Tags: popup, window, hellobar, optin, lead capture, marketing, form, notification, messenger, targeting, monster, ninja
5
  Requires at least: 3.9
6
  Tested up to: 4.0
7
- Stable tag: 1.7.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -145,6 +145,9 @@ Contact Us, provide as much detail of the problem as you can. We will try to sol
145
  3. Editing an Icegram campaign - add multiple messages, edit them, targeting rules, full HTML editor, themes and more
146
 
147
  == Upgrade Notice ==
 
 
 
148
  = 1.7.1 =
149
  Dismiss admin notice provision, retargeting compatibility with caches and bug fixes.
150
 
@@ -177,6 +180,11 @@ Initial Release
177
 
178
 
179
  == Changelog ==
 
 
 
 
 
180
  = 1.7.1 =
181
  * Update: Dismiss button for admin notice about bonus themes and addon
182
  * Fix: Admin settings CSS changes, for compatibility with some themes
4
  Tags: popup, window, hellobar, optin, lead capture, marketing, form, notification, messenger, targeting, monster, ninja
5
  Requires at least: 3.9
6
  Tested up to: 4.0
7
+ Stable tag: 1.8
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
145
  3. Editing an Icegram campaign - add multiple messages, edit them, targeting rules, full HTML editor, themes and more
146
 
147
  == Upgrade Notice ==
148
+ = 1.8 =
149
+ Target campaigns to any page with wildcard URL support in "Where" conditions and CTA Click based retargeting.
150
+
151
  = 1.7.1 =
152
  Dismiss admin notice provision, retargeting compatibility with caches and bug fixes.
153
 
180
 
181
 
182
  == Changelog ==
183
+ = 1.8 =
184
+ * NEW: Target campaigns to any page with wildcard URL support in "Where" conditions
185
+ * NEW: CTA Click based retargeting to hide message in a campaign after being clicked
186
+ * NEW: Message shwon retargeting can now hide message forever - after shown once
187
+
188
  = 1.7.1 =
189
  * Update: Dismiss button for admin notice about bonus themes and addon
190
  * Fix: Admin settings CSS changes, for compatibility with some themes