WordPress Landing Pages - Version 2.4.2

Version Description

  • Updating shared directory, minor code structure improvements.
Download this release

Release Info

Developer adbox
Plugin Icon 128x128 WordPress Landing Pages
Version 2.4.2
Comparing to
See all releases

Code changes from version 2.3.8 to 2.4.2

assets/css/admin-ab-testing.css CHANGED
@@ -44,21 +44,21 @@
44
  font-size: 17px;
45
  line-height: 24px;
46
  }
47
- .variation-off .bab-stat-control-pause, .variation-on .bab-stat-control-play, .variation-off .pause-sep,.variation-on .play-sep, .variation-on .is-paused{
48
  display: none;
49
  }
50
- .bab-stat-control-container {
51
 
52
  bottom: 0px;
53
  left: 0px;
54
  }
55
- .bab-stat-control-container:hover {
56
 
57
  bottom: 0px;
58
  left: 0px;
59
  display: block;
60
  }
61
- .bab-variation-row {
62
  position: relative;
63
  //margin-bottom: -27px;
64
  //-moz-transition: all .4s ease-in-out;
@@ -67,10 +67,10 @@
67
  //transition: all .4s ease-in-out;
68
  }
69
 
70
- .bab-variation-row:last-child {
71
  margin-bottom: 0px;
72
  }
73
- .bab-variation-row:hover {
74
  margin-bottom: 0px;
75
  //-moz-transition: all .4s ease-in-out;
76
  //-webkit-transition: all .4s ease-in-out;
@@ -78,20 +78,20 @@
78
  //transition: all .4s ease-in-out;
79
 
80
  }
81
- .bab-stat-control-container span {
82
  vertical-align: bottom;
83
  display: inline-block;
84
  }
85
- .bab-stat-seperator {
86
  padding-left: 3px;
87
  padding-right: 3px;
88
  font-size: 0px;
89
  }
90
- .variation-on .bab-stat-control-pause a {
91
  color: red;
92
  font-weight: bold;
93
  }
94
- .variation-off .bab-number-box {
95
  color: rgb(117, 117, 117);
96
  }
97
  .is-paused { font-size: 10px;
@@ -100,11 +100,11 @@
100
  opacity: .8;
101
  padding-left: 10px;
102
  }
103
- .variation-off .bab-stat-control-play a {
104
  color: green;
105
  font-weight: bold;
106
  }
107
- .variation-off .bab-varation-header {
108
  font-weight: normal;
109
  }
110
  .lp-tab-display
@@ -132,14 +132,14 @@
132
 
133
  /* Begin with quick stats! */
134
 
135
- .bab-stat-letter {
136
  border-radius: 3px;
137
  border-style:solid;
138
  border-width:1px;
139
  padding:2px;
140
  }
141
 
142
- .bab-stat-container-conversions, .bab-stat-container-impressions, .bab-stat-container-conversion_rate {
143
  display:inline;
144
  }
145
 
@@ -251,13 +251,13 @@
251
  .settings_list_li a:hover{
252
  color: #000
253
  }
254
- #wpbody .bab-varation-header{
255
  font-size: 14px;
256
  font-weight: normal;
257
  color: #000;
258
  padding-left: 18px !important;
259
  }
260
- .bab-stat-letter {
261
  border-radius: 0px;
262
  border-style: solid;
263
  border-width: 0px;
@@ -265,7 +265,7 @@
265
  background: none !important;
266
  font-weight: bold;
267
  }
268
- .bab-stat-control-pause a:before{
269
  background: url(../images/ab-retina-icons.png) no-repeat;
270
  width: 15px;
271
  position: absolute;
@@ -281,7 +281,7 @@
281
  margin-top: 0px;
282
  }
283
 
284
- .bab-stat-control-play a:before{
285
  background: url(../images/ab-retina-icons.png) no-repeat;
286
  width: 15px;
287
  position: absolute;
@@ -298,9 +298,9 @@
298
  .variation-off{
299
 
300
  }
301
- .bab-stat-control-play a:before{
302
  }
303
- #wpbody .bab-varation-header {
304
  line-height: 1;
305
  background-color: #ededed;
306
  border-color: #dddddd;
44
  font-size: 17px;
45
  line-height: 24px;
46
  }
47
+ .variation-off .stat-control-pause, .variation-on .stat-control-play, .variation-off .pause-sep,.variation-on .play-sep, .variation-on .is-paused{
48
  display: none;
49
  }
50
+ .stat-control-container {
51
 
52
  bottom: 0px;
53
  left: 0px;
54
  }
55
+ .stat-control-container:hover {
56
 
57
  bottom: 0px;
58
  left: 0px;
59
  display: block;
60
  }
61
+ .variation-row {
62
  position: relative;
63
  //margin-bottom: -27px;
64
  //-moz-transition: all .4s ease-in-out;
67
  //transition: all .4s ease-in-out;
68
  }
69
 
70
+ .variation-row:last-child {
71
  margin-bottom: 0px;
72
  }
73
+ .variation-row:hover {
74
  margin-bottom: 0px;
75
  //-moz-transition: all .4s ease-in-out;
76
  //-webkit-transition: all .4s ease-in-out;
78
  //transition: all .4s ease-in-out;
79
 
80
  }
81
+ .stat-control-container span {
82
  vertical-align: bottom;
83
  display: inline-block;
84
  }
85
+ .stat-seperator {
86
  padding-left: 3px;
87
  padding-right: 3px;
88
  font-size: 0px;
89
  }
90
+ .variation-on .stat-control-pause a {
91
  color: red;
92
  font-weight: bold;
93
  }
94
+ .variation-off .number-box {
95
  color: rgb(117, 117, 117);
96
  }
97
  .is-paused { font-size: 10px;
100
  opacity: .8;
101
  padding-left: 10px;
102
  }
103
+ .variation-off .stat-control-play a {
104
  color: green;
105
  font-weight: bold;
106
  }
107
+ .variation-off .varation-header {
108
  font-weight: normal;
109
  }
110
  .lp-tab-display
132
 
133
  /* Begin with quick stats! */
134
 
135
+ .stat-letter {
136
  border-radius: 3px;
137
  border-style:solid;
138
  border-width:1px;
139
  padding:2px;
140
  }
141
 
142
+ .stat-container-conversions, .stat-container-impressions, .stat-container-conversion_rate {
143
  display:inline;
144
  }
145
 
251
  .settings_list_li a:hover{
252
  color: #000
253
  }
254
+ #wpbody .varation-header{
255
  font-size: 14px;
256
  font-weight: normal;
257
  color: #000;
258
  padding-left: 18px !important;
259
  }
260
+ .stat-letter {
261
  border-radius: 0px;
262
  border-style: solid;
263
  border-width: 0px;
265
  background: none !important;
266
  font-weight: bold;
267
  }
268
+ .stat-control-pause a:before{
269
  background: url(../images/ab-retina-icons.png) no-repeat;
270
  width: 15px;
271
  position: absolute;
281
  margin-top: 0px;
282
  }
283
 
284
+ .stat-control-play a:before{
285
  background: url(../images/ab-retina-icons.png) no-repeat;
286
  width: 15px;
287
  position: absolute;
298
  .variation-off{
299
 
300
  }
301
+ .stat-control-play a:before{
302
  }
303
+ #wpbody .varation-header {
304
  line-height: 1;
305
  background-color: #ededed;
306
  border-color: #dddddd;
assets/css/admin/content-stats.css CHANGED
@@ -1,4 +1,4 @@
1
- #bab-stat-box
2
  {
3
  font-size: 12px;
4
  margin-bottom: 10px;
@@ -14,17 +14,17 @@
14
  z-index: 200;
15
  width: 100%;
16
  }
17
- #bab-stat-box:last-child {
18
  margin-bottom: 0px;
19
  }
20
- .bab-number-box
21
  {
22
  background: transparent;
23
  display: inline-block;
24
  width: 31%;
25
  padding-top: 15px
26
  }
27
- .bab-number-box span
28
  {
29
  text-align: center;
30
  padding: 20px;
@@ -35,7 +35,7 @@
35
  padding-top: 6px;
36
  }
37
 
38
- .bab-varation-header
39
  {
40
  font-size: 19px;
41
  font-weight: bold;
@@ -46,32 +46,32 @@
46
  border-top: 1px solid #CECDCA;
47
  }
48
 
49
- .bab-stat-control-container
50
  {
51
  text-align: center;
52
  padding: 5px;
53
  }
54
 
55
- .bab-variation-row
56
  {
57
  display: block;
58
  }
59
 
60
- .bab-stat-letter
61
  {
62
  background: #fff;
63
  padding-top: 0px;
64
  padding-bottom: 0px;
65
  }
66
 
67
- .bab-notes
68
  {
69
  float: right;
70
  font-size: 12px;
71
  font-weight: normal;
72
  }
73
 
74
- .bab-number-box span.bab-stat-id{
75
  line-height: 1;
76
  font-size: 9px;
77
  font-weight: normal;
@@ -81,7 +81,7 @@
81
  color: #333333
82
  }
83
 
84
- .bab-rate
85
  {
86
  font-size: 9px !important;
87
  }
1
+ #stat-box
2
  {
3
  font-size: 12px;
4
  margin-bottom: 10px;
14
  z-index: 200;
15
  width: 100%;
16
  }
17
+ #stat-box:last-child {
18
  margin-bottom: 0px;
19
  }
20
+ .number-box
21
  {
22
  background: transparent;
23
  display: inline-block;
24
  width: 31%;
25
  padding-top: 15px
26
  }
27
+ .number-box span
28
  {
29
  text-align: center;
30
  padding: 20px;
35
  padding-top: 6px;
36
  }
37
 
38
+ .varation-header
39
  {
40
  font-size: 19px;
41
  font-weight: bold;
46
  border-top: 1px solid #CECDCA;
47
  }
48
 
49
+ .stat-control-container
50
  {
51
  text-align: center;
52
  padding: 5px;
53
  }
54
 
55
+ .variation-row
56
  {
57
  display: block;
58
  }
59
 
60
+ .stat-letter
61
  {
62
  background: #fff;
63
  padding-top: 0px;
64
  padding-bottom: 0px;
65
  }
66
 
67
+ .notes
68
  {
69
  float: right;
70
  font-size: 12px;
71
  font-weight: normal;
72
  }
73
 
74
+ .number-box span.stat-id{
75
  line-height: 1;
76
  font-size: 9px;
77
  font-weight: normal;
81
  color: #333333
82
  }
83
 
84
+ .rate
85
  {
86
  font-size: 9px !important;
87
  }
assets/js/ajax.clearstats.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function ($) {
2
  jQuery('.clear_stats').on('click', function () {
3
  // define the bulk edit row
4
  var post_id = this.id.replace('lp_clear_', '');
5
  var status = 0;
6
  if (confirm('Are you sure you want to delete the ALL of stats for this landing page? (There is no undo) Alternatively you can clear stats per version.')) {
7
  jQuery.ajax({
8
  type: 'POST',
9
  url: ajaxurl,
10
  context: this,
11
  data: {
12
  action: 'lp_clear_stats_action',
13
  j_rules: status,
14
  page_id: post_id
15
  },
16
  success: function (data) {
17
  var self = this;
18
  //alert(data);
19
  // jQuery('.lp-form').unbind('submit').submit();
20
  jQuery(self).hide();
21
  jQuery(self).parent().parent().parent().parent().find(".lp-impress-num, .lp-con-num").text("0");
22
  jQuery(self).parent().parent().parent().parent().find(".cr-number").addClass("cr-empty-0").text("0%");
23
  //alert("Changes Saved! Refresh the page to see your changes");
24
  },
25
  error: function (MLHttpRequest, textStatus, errorThrown) {
26
  alert("Ajax not enabled");
27
  }
28
  });
29
  return false;
30
  }
31
  });
32
  jQuery('body').on('click', '.lp-delete-var-stats', function () {
33
  var post_id = jQuery(this).attr("rel");
34
  var variation_id = jQuery(this).attr('data-vid');
35
  var variation_letter = jQuery(this).attr('data-letter');
36
  var selector = 'li[data-postid=' + post_id + '][data-letter=' + variation_letter + ']';
37
  //console.log(selector);
38
  if (confirm('Are you sure you want to delete stats for variation ' + variation_letter + "?")) {
39
  jQuery.ajax({
40
  type: 'POST',
41
  url: ajaxurl,
42
  context: this,
43
  data: {
44
  action: 'lp_clear_stats_single',
45
  variation: variation_id,
46
  page_id: post_id
47
  },
48
  success: function (data) {
49
  var self = this;
50
  jQuery(self).text("Stats Removed!").css("color", "green").removeClass("lp-delete-var-stats").addClass('lp-clear-success');
51
  jQuery(selector).find(".lp-impress-num, .lp-con-num").text("0");
52
  jQuery(selector).find(".cr-number").addClass("cr-empty-0").text("0%");
53
  jQuery(self).parent().parent().find('.bab-stat-span-impressions, .bab-stat-span-conversions').text("0");
54
  jQuery(self).parent().parent().find('.bab-stat-span-conversion_rate').text("0%");
55
  },
56
  error: function (MLHttpRequest, textStatus, errorThrown) {
57
  alert("Ajax not enabled");
58
  }
59
  });
60
  return false;
61
  }
62
  });
 
63
  jQuery('.clear_stats').on('click', function () {
64
  // define the bulk edit row
65
  var post_id = this.id.replace('lp_clear_', '');
66
  var status = 0;
67
  if (confirm('Are you sure you want to delete the ALL of stats for this landing page? (There is no undo) Alternatively you can clear stats per version.')) {
68
  jQuery.ajax({
69
  type: 'POST',
70
  url: ajaxurl,
71
  context: this,
72
  data: {
73
  action: 'lp_clear_stats_action',
74
  j_rules: status,
75
  page_id: post_id
76
  },
77
  success: function (data) {
78
  var self = this;
79
  //alert(data);
80
  // jQuery('.lp-form').unbind('submit').submit();
81
  jQuery(self).hide();
82
  jQuery(self).parent().parent().parent().parent().find(".lp-impress-num, .lp-con-num").text("0");
83
  jQuery(self).parent().parent().parent().parent().find(".cr-number").addClass("cr-empty-0").text("0%");
84
  //alert("Changes Saved! Refresh the page to see your changes");
85
  },
86
  error: function (MLHttpRequest, textStatus, errorThrown) {
87
  alert("Ajax not enabled");
88
  }
89
  });
90
  return false;
91
  }
92
  });
93
  jQuery('body').on('click', '.lp-delete-var-stats', function () {
94
  var post_id = jQuery(this).attr("rel");
95
  var variation_id = jQuery(this).attr('data-vid');
96
  var variation_letter = jQuery(this).attr('data-letter');
97
  var selector = '#lp-variation-' + variation_letter;
98
  //console.log(selector);
99
  if (confirm('Are you sure you want to delete stats for variation ' + variation_letter + "?")) {
100
  jQuery.ajax({
101
  type: 'POST',
102
  url: ajaxurl,
103
  context: this,
104
  data: {
105
  action: 'lp_clear_stats_single',
106
  variation: variation_id,
107
  page_id: post_id
108
  },
109
  success: function (data) {
110
  var self = this;
111
  jQuery(self).text("Stats Removed!").css("color", "green").removeClass("lp-delete-var-stats").addClass('lp-clear-success');
112
  jQuery(selector).find(".stat-span-impressions, .stat-span-conversions").text("0");
113
  jQuery(selector).find(".stat-span-conversion_rate").addClass("cr-empty-0").text("0%");
114
  },
115
  error: function (MLHttpRequest, textStatus, errorThrown) {
116
  alert("Ajax not enabled");
117
  }
118
  });
119
  return false;
120
  }
121
  });
 
1
  jQuery('.clear_stats').on('click', function () {
2
  // define the bulk edit row
3
  var post_id = this.id.replace('lp_clear_', '');
4
  var status = 0;
5
  if (confirm('Are you sure you want to delete the ALL of stats for this landing page? (There is no undo) Alternatively you can clear stats per version.')) {
6
  jQuery.ajax({
7
  type: 'POST',
8
  url: ajaxurl,
9
  context: this,
10
  data: {
11
  action: 'lp_clear_stats_action',
12
  j_rules: status,
13
  page_id: post_id
14
  },
15
  success: function (data) {
16
  var self = this;
17
  //alert(data);
18
  // jQuery('.lp-form').unbind('submit').submit();
19
  jQuery(self).hide();
20
  jQuery(self).parent().parent().parent().parent().find(".lp-impress-num, .lp-con-num").text("0");
21
  jQuery(self).parent().parent().parent().parent().find(".cr-number").addClass("cr-empty-0").text("0%");
22
  //alert("Changes Saved! Refresh the page to see your changes");
23
  },
24
  error: function (MLHttpRequest, textStatus, errorThrown) {
25
  alert("Ajax not enabled");
26
  }
27
  });
28
  return false;
29
  }
30
  });
31
  jQuery('body').on('click', '.lp-delete-var-stats', function () {
32
  var post_id = jQuery(this).attr("rel");
33
  var variation_id = jQuery(this).attr('data-vid');
34
  var variation_letter = jQuery(this).attr('data-letter');
35
  var selector = 'li[data-postid=' + post_id + '][data-letter=' + variation_letter + ']';
36
  //console.log(selector);
37
  if (confirm('Are you sure you want to delete stats for variation ' + variation_letter + "?")) {
38
  jQuery.ajax({
39
  type: 'POST',
40
  url: ajaxurl,
41
  context: this,
42
  data: {
43
  action: 'lp_clear_stats_single',
44
  variation: variation_id,
45
  page_id: post_id
46
  },
47
  success: function (data) {
48
  var self = this;
49
  jQuery(self).text("Stats Removed!").css("color", "green").removeClass("lp-delete-var-stats").addClass('lp-clear-success');
50
  jQuery(selector).find(".lp-impress-num, .lp-con-num").text("0");
51
  jQuery(selector).find(".cr-number").addClass("cr-empty-0").text("0%");
52
  jQuery(self).parent().parent().find('.bab-stat-span-impressions, .bab-stat-span-conversions').text("0");
53
  jQuery(self).parent().parent().find('.bab-stat-span-conversion_rate').text("0%");
54
  },
55
  error: function (MLHttpRequest, textStatus, errorThrown) {
56
  alert("Ajax not enabled");
57
  }
58
  });
59
  return false;
60
  }
61
  });
62
+ jQuery(document).ready(function ($) {
63
  jQuery('.clear_stats').on('click', function () {
64
  // define the bulk edit row
65
  var post_id = this.id.replace('lp_clear_', '');
66
  var status = 0;
67
  if (confirm('Are you sure you want to delete the ALL of stats for this landing page? (There is no undo) Alternatively you can clear stats per version.')) {
68
  jQuery.ajax({
69
  type: 'POST',
70
  url: ajaxurl,
71
  context: this,
72
  data: {
73
  action: 'lp_clear_stats_action',
74
  j_rules: status,
75
  page_id: post_id
76
  },
77
  success: function (data) {
78
  var self = this;
79
  //alert(data);
80
  // jQuery('.lp-form').unbind('submit').submit();
81
  jQuery(self).hide();
82
  jQuery(self).parent().parent().parent().parent().find(".lp-impress-num, .lp-con-num").text("0");
83
  jQuery(self).parent().parent().parent().parent().find(".cr-number").addClass("cr-empty-0").text("0%");
84
  //alert("Changes Saved! Refresh the page to see your changes");
85
  },
86
  error: function (MLHttpRequest, textStatus, errorThrown) {
87
  alert("Ajax not enabled");
88
  }
89
  });
90
  return false;
91
  }
92
  });
93
  jQuery('body').on('click', '.lp-delete-var-stats', function () {
94
  var post_id = jQuery(this).attr("rel");
95
  var variation_id = jQuery(this).attr('data-vid');
96
  var variation_letter = jQuery(this).attr('data-letter');
97
  var selector = '#lp-variation-' + variation_letter;
98
  //console.log(selector);
99
  if (confirm('Are you sure you want to delete stats for variation ' + variation_letter + "?")) {
100
  jQuery.ajax({
101
  type: 'POST',
102
  url: ajaxurl,
103
  context: this,
104
  data: {
105
  action: 'lp_clear_stats_single',
106
  variation: variation_id,
107
  page_id: post_id
108
  },
109
  success: function (data) {
110
  var self = this;
111
  jQuery(self).text("Stats Removed!").css("color", "green").removeClass("lp-delete-var-stats").addClass('lp-clear-success');
112
  jQuery(selector).find(".stat-span-impressions, .stat-span-conversions").text("0");
113
  jQuery(selector).find(".stat-span-conversion_rate").addClass("cr-empty-0").text("0%");
114
  },
115
  error: function (MLHttpRequest, textStatus, errorThrown) {
116
  alert("Ajax not enabled");
117
  }
118
  });
119
  return false;
120
  }
121
  });
assets/tests/codeception/acceptance/StatisticsCept.php CHANGED
@@ -31,25 +31,25 @@ $I->see( 'Landing Pages');
31
  $I->wantTo('Open example landing page');
32
  $I->click( [ 'link' => 'A/B Testing Landing Page Example']);
33
  $I->wantTo('check if impressions are correct for variation a');
34
- $imp = $I->grabTextFrom('#lp-variation-A .bab-stat-span-impressions');
35
  $I->assertContains( '30' , $imp );
36
 
37
  $I->wantTo('check check impressions for variation b');
38
- $imp = $I->grabTextFrom('#lp-variation-B .bab-stat-span-impressions');
39
  $I->assertContains( '35' , $imp , '' );
40
 
41
  $I->wantTo('check conversions for variation a');
42
- $con = $I->grabTextFrom('#lp-variation-A .bab-stat-span-conversions');
43
  $I->assertContains( '10' , $con , '' );
44
 
45
  $I->wantTo('check conversions for variation b');
46
- $con = $I->grabTextFrom('#lp-variation-B .bab-stat-span-conversions');
47
  $I->assertContains( '15' , $con );
48
 
49
  $I->wantTo('check the conversion rate of variation a');
50
- $per = $I->grabTextFrom('#lp-variation-A .bab-stat-span-conversion_rate');
51
  $I->assertContains( '33' , $per );
52
 
53
  $I->wantTo('check the conversion rate of variation b');
54
- $per = $I->grabTextFrom('#lp-variation-B .bab-stat-span-conversion_rate');
55
  $I->assertContains( '42.86' , $per );
31
  $I->wantTo('Open example landing page');
32
  $I->click( [ 'link' => 'A/B Testing Landing Page Example']);
33
  $I->wantTo('check if impressions are correct for variation a');
34
+ $imp = $I->grabTextFrom('#lp-variation-A .stat-span-impressions');
35
  $I->assertContains( '30' , $imp );
36
 
37
  $I->wantTo('check check impressions for variation b');
38
+ $imp = $I->grabTextFrom('#lp-variation-B .stat-span-impressions');
39
  $I->assertContains( '35' , $imp , '' );
40
 
41
  $I->wantTo('check conversions for variation a');
42
+ $con = $I->grabTextFrom('#lp-variation-A .stat-span-conversions');
43
  $I->assertContains( '10' , $con , '' );
44
 
45
  $I->wantTo('check conversions for variation b');
46
+ $con = $I->grabTextFrom('#lp-variation-B .stat-span-conversions');
47
  $I->assertContains( '15' , $con );
48
 
49
  $I->wantTo('check the conversion rate of variation a');
50
+ $per = $I->grabTextFrom('#lp-variation-A .stat-span-conversion_rate');
51
  $I->assertContains( '33' , $per );
52
 
53
  $I->wantTo('check the conversion rate of variation b');
54
+ $per = $I->grabTextFrom('#lp-variation-B .stat-span-conversion_rate');
55
  $I->assertContains( '42.86' , $per );
classes/class.activation.php CHANGED
@@ -110,7 +110,7 @@ class Landing_Pages_Activation {
110
  /* Listen for a manual upgrade call */
111
  if (isset($_GET['plugin_action']) && $_GET['plugin_action'] == 'upgrade_routines' && $_GET['plugin'] =='landing-pages' ) {
112
  self::run_updates();
113
- wp_redirect(admin_url('edit.php?post_type=landing-page'));
114
  exit;
115
  }
116
 
110
  /* Listen for a manual upgrade call */
111
  if (isset($_GET['plugin_action']) && $_GET['plugin_action'] == 'upgrade_routines' && $_GET['plugin'] =='landing-pages' ) {
112
  self::run_updates();
113
+ wp_redirect(wp_get_referer());
114
  exit;
115
  }
116
 
classes/class.activation.upgrade-routines.php CHANGED
@@ -287,7 +287,6 @@ if ( !class_exists('Landing_Pages_Activation_Update_Routines') ) {
287
  }
288
  }
289
 
290
-
291
  }
292
 
293
  }
287
  }
288
  }
289
 
 
290
  }
291
 
292
  }
classes/class.admin-notices.php CHANGED
@@ -123,7 +123,7 @@ class Landing_Pages_Admin_Notices {
123
  return;
124
  }
125
 
126
- $extension_data = lp_get_extension_data();
127
  $current_template = Landing_Pages_Variations::get_current_template($post->ID);
128
 
129
  if ( !isset($extension_data[$current_template]['info']['data_type']) || $extension_data[$current_template]['info']['data_type'] != 'acf4' ) {
@@ -176,7 +176,7 @@ class Landing_Pages_Admin_Notices {
176
  return;
177
  }
178
 
179
- $extension_data = lp_get_extension_data();
180
  $current_template = Landing_Pages_Variations::get_current_template($post->ID);
181
 
182
  if ( defined('ACF_PRO') || !isset($extension_data[$current_template]['info']['data_type']) || $extension_data[$current_template]['info']['data_type'] != 'acf5' ) {
@@ -253,6 +253,11 @@ class Landing_Pages_Admin_Notices {
253
  public static function download_legacy_templates() {
254
  global $pagenow;
255
 
 
 
 
 
 
256
  $message_id = 'download-legacy-landing-page-templates';
257
 
258
  /* check if user viewed message already */
123
  return;
124
  }
125
 
126
+ $extension_data = Landing_Pages_Load_Extensions::get_extended_data();;
127
  $current_template = Landing_Pages_Variations::get_current_template($post->ID);
128
 
129
  if ( !isset($extension_data[$current_template]['info']['data_type']) || $extension_data[$current_template]['info']['data_type'] != 'acf4' ) {
176
  return;
177
  }
178
 
179
+ $extension_data = Landing_Pages_Load_Extensions::get_extended_data();;
180
  $current_template = Landing_Pages_Variations::get_current_template($post->ID);
181
 
182
  if ( defined('ACF_PRO') || !isset($extension_data[$current_template]['info']['data_type']) || $extension_data[$current_template]['info']['data_type'] != 'acf5' ) {
253
  public static function download_legacy_templates() {
254
  global $pagenow;
255
 
256
+ /* ignore for pro users */
257
+ if (class_exists('Inbound_Pro_Plugin')) {
258
+ return;
259
+ }
260
+
261
  $message_id = 'download-legacy-landing-page-templates';
262
 
263
  /* check if user viewed message already */
classes/{class.load-extensions.php → class.load-templates.php} RENAMED
@@ -16,9 +16,9 @@ class Landing_Pages_Load_Extensions {
16
  public static function load_hooks() {
17
 
18
  /*load core & uploaded templates */
19
- add_action('init',array(__CLASS__,'load_core_template_configurations') , 5 );
20
- add_action('init',array(__CLASS__,'load_uploaded_template_configurations') , 5 );
21
- add_action('init',array(__CLASS__,'load_theme_privided_template_configurations') , 5 );
22
 
23
  /* Adds core metabox settings to extension data array */
24
  add_filter('lp_extension_data', array(__CLASS__, 'add_core_setting_data'), 1, 1);
@@ -33,10 +33,6 @@ class Landing_Pages_Load_Extensions {
33
  */
34
  public static function add_core_setting_data($data) {
35
 
36
- if (!is_admin()) {
37
- return;
38
- }
39
-
40
  $data['lp']['settings'] = array(array('id' => 'selected-template', 'label' => __('Select Template', 'landing-pages'), 'description' => __("This option provides a placeholder for the selected template data.", 'landing-pages'), 'type' => 'radio', /* this is not honored. Template selection setting is handled uniquely by core. */
41
  'default' => 'default', 'options' => null /* this is not honored. Template selection setting is handled uniquely by core. */), array('id' => 'main-headline', 'label' => __('Set Main Headline', 'landing-pages'), 'description' => __("Set Main Headline", 'landing-pages'), 'type' => 'text', /* this is not honored. Main Headline Input setting is handled uniquely by core. */
42
  'default' => '', 'options' => null),);
@@ -48,9 +44,6 @@ class Landing_Pages_Load_Extensions {
48
  * Looks for occurances of 'options' in template & extension data arrays and replaces key with 'settings'
49
  */
50
  public static function add_legacy_data_support($data) {
51
- if (!is_admin()) {
52
- return;
53
- }
54
 
55
  foreach ($data as $parent_key => $subarray) {
56
  if (is_array($subarray)) {
@@ -78,10 +71,7 @@ class Landing_Pages_Load_Extensions {
78
  * @returns ARRAY contains template setting data
79
  */
80
  public static function load_core_template_configurations() {
81
-
82
- if (!is_admin()) {
83
- return;
84
- }
85
 
86
  $template_ids = self::get_core_template_ids();
87
 
@@ -94,11 +84,6 @@ class Landing_Pages_Load_Extensions {
94
  }
95
  }
96
 
97
-
98
- /* Store all template config files in global */
99
- $GLOBALS['lp_data'] = $lp_data;
100
-
101
- return $lp_data;
102
  }
103
 
104
  /**
@@ -123,9 +108,6 @@ class Landing_Pages_Load_Extensions {
123
  }
124
  }
125
 
126
-
127
- return $lp_data;
128
-
129
  }
130
 
131
  /**
@@ -144,9 +126,6 @@ class Landing_Pages_Load_Extensions {
144
  }
145
  }
146
 
147
-
148
- return $lp_data;
149
-
150
  }
151
 
152
  /**
@@ -290,9 +269,5 @@ class Landing_Pages_Load_Extensions {
290
  }
291
 
292
  /* Initialize Landing_Pages_Load_Extensions */
293
- $GLOBALS['Landing_Pages_Load_Extensions'] = new Landing_Pages_Load_Extensions;
294
 
295
- /* Get data array of template settings */
296
- function lp_get_extension_data() {
297
- return Landing_Pages_Load_Extensions::get_extended_data();
298
- }
16
  public static function load_hooks() {
17
 
18
  /*load core & uploaded templates */
19
+ add_action('admin_init',array(__CLASS__,'load_core_template_configurations') , 5 );
20
+ add_action('admin_init',array(__CLASS__,'load_uploaded_template_configurations') , 5 );
21
+ add_action('admin_init',array(__CLASS__,'load_theme_privided_template_configurations') , 5 );
22
 
23
  /* Adds core metabox settings to extension data array */
24
  add_filter('lp_extension_data', array(__CLASS__, 'add_core_setting_data'), 1, 1);
33
  */
34
  public static function add_core_setting_data($data) {
35
 
 
 
 
 
36
  $data['lp']['settings'] = array(array('id' => 'selected-template', 'label' => __('Select Template', 'landing-pages'), 'description' => __("This option provides a placeholder for the selected template data.", 'landing-pages'), 'type' => 'radio', /* this is not honored. Template selection setting is handled uniquely by core. */
37
  'default' => 'default', 'options' => null /* this is not honored. Template selection setting is handled uniquely by core. */), array('id' => 'main-headline', 'label' => __('Set Main Headline', 'landing-pages'), 'description' => __("Set Main Headline", 'landing-pages'), 'type' => 'text', /* this is not honored. Main Headline Input setting is handled uniquely by core. */
38
  'default' => '', 'options' => null),);
44
  * Looks for occurances of 'options' in template & extension data arrays and replaces key with 'settings'
45
  */
46
  public static function add_legacy_data_support($data) {
 
 
 
47
 
48
  foreach ($data as $parent_key => $subarray) {
49
  if (is_array($subarray)) {
71
  * @returns ARRAY contains template setting data
72
  */
73
  public static function load_core_template_configurations() {
74
+ global $lp_data;
 
 
 
75
 
76
  $template_ids = self::get_core_template_ids();
77
 
84
  }
85
  }
86
 
 
 
 
 
 
87
  }
88
 
89
  /**
108
  }
109
  }
110
 
 
 
 
111
  }
112
 
113
  /**
126
  }
127
  }
128
 
 
 
 
129
  }
130
 
131
  /**
269
  }
270
 
271
  /* Initialize Landing_Pages_Load_Extensions */
272
+ new Landing_Pages_Load_Extensions;
273
 
 
 
 
 
classes/class.metaboxes.php CHANGED
@@ -77,7 +77,7 @@ class Landing_Pages_Metaboxes {
77
  );
78
 
79
  /* Load Template Settings */
80
- $extension_data = lp_get_extension_data();
81
  $current_template = Landing_Pages_Variations::get_current_template($post->ID);
82
  foreach ($extension_data as $key => $data) {
83
 
@@ -264,7 +264,7 @@ class Landing_Pages_Metaboxes {
264
  wp_localize_script( 'jpicker', 'jpicker', array( 'thispath' => LANDINGPAGES_URLPATH.'assets/libraries/jpicker/images/' ));
265
  wp_enqueue_style('jpicker-css', LANDINGPAGES_URLPATH . 'assets/libraries/jpicker/css/jPicker-1.1.6.min.css');
266
 
267
- $template_data = lp_get_extension_data();
268
  $template_data_json = json_encode($template_data);
269
  $template = Landing_Pages_Variations::get_current_template( $post->ID );
270
  $params = array('selected_template'=>$template, 'templates'=>$template_data_json);
@@ -482,7 +482,7 @@ class Landing_Pages_Metaboxes {
482
  </style>
483
  <div class="inside" id="a-b-testing">
484
 
485
- <div id="bab-stat-box">
486
  <?php
487
 
488
  if (isset($_GET['new_meta_key']) && is_numeric($_GET['new_meta_key']) ) {
@@ -531,10 +531,10 @@ class Landing_Pages_Metaboxes {
531
  ?>
532
 
533
  <div id="lp-variation-<?php echo Landing_Pages_Variations::vid_to_letter( $post->ID , $key); ?>"
534
- class="bab-variation-row <?php echo $variation_status_class; ?>">
535
- <div class='bab-varation-header'>
536
- <span class='bab-variation-name'><?php _e('Variation', 'landing-pages'); ?> <span
537
- class='bab-stat-letter'><?php echo Landing_Pages_Variations::vid_to_letter( $post->ID , $key); ?></span>
538
  <?php
539
  if ($variation_status != 1) {
540
  ?>
@@ -549,28 +549,28 @@ class Landing_Pages_Metaboxes {
549
  <span class="settings_wrapper_heading">Variation Settings</span>
550
  <ul class="settings_list_li">
551
  <li class="settings_edit">
552
- <span class='bab-stat-menu-edit'>
553
  <a title="<?php _e('Edit this variation', 'landing-pages'); ?>" href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo $vid; ?>'>
554
  <?php _e('Edit', 'landing-pages'); ?>
555
  </a>
556
  </span>
557
  </li>
558
  <li class="settings_preview">
559
- <span class='bab-stat-menu-preview'>
560
  <a title="<?php _e('Preview this variation', 'landing-pages'); ?>" class='thickbox' href='<?php echo $permalink; ?>&iframe_window=on&post_id=<?php echo $post->ID; ?>&TB_iframe=true&width=1503&height=467' target='_blank'>
561
  <?php _e('Preview', 'landing-pages'); ?>
562
  </a>
563
  </span>
564
  </li>
565
  <li class="settings_clone">
566
- <span class='bab-stat-menu-clone'>
567
  <a title="<?php _e('Clone this variation', 'landing-pages'); ?>" href='?post=<?php echo $post->ID; ?>&action=edit&new-variation=1&clone=<?php echo $vid; ?>&new_meta_key=<?php echo $howmany; ?>'>
568
  <?php _e('Clone', 'landing-pages'); ?>
569
  </a>
570
  </span>
571
  </li>
572
  <li class="settings_delete">
573
- <span class='bab-stat-control-delete'>
574
  <a title="<?php _e('Delete this variation', 'landing-pages'); ?>" href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo $vid; ?>&ab-action=delete-variation'>
575
  <?php _e('Delete', 'landing-pages'); ?>
576
  </a>
@@ -588,13 +588,13 @@ class Landing_Pages_Metaboxes {
588
 
589
 
590
  <!-- PAUSE START -->
591
- <span class='bab-stat-control-pause'><a title="<?php _e('Pause this variation', 'landing-pages'); ?>"
592
  href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo $vid; ?>&ab-action=pause-variation'> </a></span>
593
  <!-- PAUSE END -->
594
 
595
  <!-- PLAY START -->
596
- <span class='bab-stat-seperator pause-sep'>|</span>
597
- <span class='bab-stat-control-play'><a
598
  title="<?php _e('Turn this variation on', 'landing-pages'); ?>"
599
  href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo $vid; ?>&ab-action=play-variation'> </a></span>
600
  <!-- PLAY END -->
@@ -602,26 +602,26 @@ href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo
602
 
603
 
604
  </div>
605
- <div class="bab-stat-row">
606
- <div class='bab-stat-stats' colspan='2'>
607
- <div class='bab-stat-container-impressions bab-number-box'>
608
- <span class="bab-stat-id"><?php _e('Views', 'landing-pages'); ?> </span>
609
- <span class='bab-stat-span-impressions'><?php echo $impressions; ?></span>
610
  </div>
611
- <div class='bab-stat-container-conversions bab-number-box'>
612
- <span class="bab-stat-id"><?php _e('Conversions', 'landing-pages'); ?></span> <span class='bab-stat-span-conversions'><?php echo $conversions; ?></span>
613
  </span>
614
  </div>
615
- <div class='bab-stat-container-conversion_rate bab-number-box'>
616
- <span class="bab-stat-id bab-rate"><?php _e('Conversion Rate', 'landing-pages'); ?></span>
617
- <span class='bab-stat-span-conversion_rate'><?php echo $conversion_rate; ?></span>
618
  </div>
619
 
620
  </div>
621
  </div>
622
- <div class="bab-stat-row">
623
 
624
- <div class='bab-stat-menu-container'>
625
 
626
  <?php do_action('lp_ab_testing_stats_menu_post'); ?>
627
 
@@ -763,7 +763,7 @@ href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo
763
 
764
  $toggle = ($screen->parent_file != 'edit.php?post_type=landing-page' || $screen->action != 'add') ? "display:none" : "";
765
 
766
- $extension_data = lp_get_extension_data();
767
  $extension_data_cats = Landing_Pages_Load_Extensions::get_template_categories();
768
 
769
  unset($extension_data['lp']);
@@ -938,7 +938,7 @@ href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo
938
  */
939
  public static function display_extended_metabox( $post , $args) {
940
 
941
- $extension_data = lp_get_extension_data();
942
 
943
  $key = $args['args']['key'];
944
 
77
  );
78
 
79
  /* Load Template Settings */
80
+ $extension_data = Landing_Pages_Load_Extensions::get_extended_data();;
81
  $current_template = Landing_Pages_Variations::get_current_template($post->ID);
82
  foreach ($extension_data as $key => $data) {
83
 
264
  wp_localize_script( 'jpicker', 'jpicker', array( 'thispath' => LANDINGPAGES_URLPATH.'assets/libraries/jpicker/images/' ));
265
  wp_enqueue_style('jpicker-css', LANDINGPAGES_URLPATH . 'assets/libraries/jpicker/css/jPicker-1.1.6.min.css');
266
 
267
+ $template_data = Landing_Pages_Load_Extensions::get_extended_data();;
268
  $template_data_json = json_encode($template_data);
269
  $template = Landing_Pages_Variations::get_current_template( $post->ID );
270
  $params = array('selected_template'=>$template, 'templates'=>$template_data_json);
482
  </style>
483
  <div class="inside" id="a-b-testing">
484
 
485
+ <div id="stat-box">
486
  <?php
487
 
488
  if (isset($_GET['new_meta_key']) && is_numeric($_GET['new_meta_key']) ) {
531
  ?>
532
 
533
  <div id="lp-variation-<?php echo Landing_Pages_Variations::vid_to_letter( $post->ID , $key); ?>"
534
+ class="variation-row <?php echo $variation_status_class; ?>">
535
+ <div class='varation-header'>
536
+ <span class='variation-name'><?php _e('Variation', 'landing-pages'); ?> <span
537
+ class='stat-letter'><?php echo Landing_Pages_Variations::vid_to_letter( $post->ID , $key); ?></span>
538
  <?php
539
  if ($variation_status != 1) {
540
  ?>
549
  <span class="settings_wrapper_heading">Variation Settings</span>
550
  <ul class="settings_list_li">
551
  <li class="settings_edit">
552
+ <span class='stat-menu-edit'>
553
  <a title="<?php _e('Edit this variation', 'landing-pages'); ?>" href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo $vid; ?>'>
554
  <?php _e('Edit', 'landing-pages'); ?>
555
  </a>
556
  </span>
557
  </li>
558
  <li class="settings_preview">
559
+ <span class='stat-menu-preview'>
560
  <a title="<?php _e('Preview this variation', 'landing-pages'); ?>" class='thickbox' href='<?php echo $permalink; ?>&iframe_window=on&post_id=<?php echo $post->ID; ?>&TB_iframe=true&width=1503&height=467' target='_blank'>
561
  <?php _e('Preview', 'landing-pages'); ?>
562
  </a>
563
  </span>
564
  </li>
565
  <li class="settings_clone">
566
+ <span class='stat-menu-clone'>
567
  <a title="<?php _e('Clone this variation', 'landing-pages'); ?>" href='?post=<?php echo $post->ID; ?>&action=edit&new-variation=1&clone=<?php echo $vid; ?>&new_meta_key=<?php echo $howmany; ?>'>
568
  <?php _e('Clone', 'landing-pages'); ?>
569
  </a>
570
  </span>
571
  </li>
572
  <li class="settings_delete">
573
+ <span class='stat-control-delete'>
574
  <a title="<?php _e('Delete this variation', 'landing-pages'); ?>" href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo $vid; ?>&ab-action=delete-variation'>
575
  <?php _e('Delete', 'landing-pages'); ?>
576
  </a>
588
 
589
 
590
  <!-- PAUSE START -->
591
+ <span class='stat-control-pause'><a title="<?php _e('Pause this variation', 'landing-pages'); ?>"
592
  href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo $vid; ?>&ab-action=pause-variation'> </a></span>
593
  <!-- PAUSE END -->
594
 
595
  <!-- PLAY START -->
596
+ <span class='stat-seperator pause-sep'>|</span>
597
+ <span class='stat-control-play'><a
598
  title="<?php _e('Turn this variation on', 'landing-pages'); ?>"
599
  href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo $vid; ?>&ab-action=play-variation'> </a></span>
600
  <!-- PLAY END -->
602
 
603
 
604
  </div>
605
+ <div class="stat-row">
606
+ <div class='stat-stats' colspan='2'>
607
+ <div class='stat-container-impressions number-box'>
608
+ <span class="stat-id"><?php _e('Views', 'landing-pages'); ?> </span>
609
+ <span class='stat-span-impressions'><?php echo $impressions; ?></span>
610
  </div>
611
+ <div class='stat-container-conversions number-box'>
612
+ <span class="stat-id"><?php _e('Conversions', 'landing-pages'); ?></span> <span class='stat-span-conversions'><?php echo $conversions; ?></span>
613
  </span>
614
  </div>
615
+ <div class='stat-container-conversion_rate number-box'>
616
+ <span class="stat-id rate"><?php _e('Conversion Rate', 'landing-pages'); ?></span>
617
+ <span class='stat-span-conversion_rate'><?php echo $conversion_rate; ?></span>
618
  </div>
619
 
620
  </div>
621
  </div>
622
+ <div class="stat-row">
623
 
624
+ <div class='stat-menu-container'>
625
 
626
  <?php do_action('lp_ab_testing_stats_menu_post'); ?>
627
 
763
 
764
  $toggle = ($screen->parent_file != 'edit.php?post_type=landing-page' || $screen->action != 'add') ? "display:none" : "";
765
 
766
+ $extension_data = Landing_Pages_Load_Extensions::get_extended_data();;
767
  $extension_data_cats = Landing_Pages_Load_Extensions::get_template_categories();
768
 
769
  unset($extension_data['lp']);
938
  */
939
  public static function display_extended_metabox( $post , $args) {
940
 
941
+ $extension_data = Landing_Pages_Load_Extensions::get_extended_data();;
942
 
943
  $key = $args['args']['key'];
944
 
classes/class.post-type.landing-page.php CHANGED
@@ -46,7 +46,7 @@ if ( !class_exists('Landing_Pages_Post_Type') ) {
46
  if (isset($_GET['dont_save'])
47
  || isset($_GET['iframe_window'])
48
  || isset($_GET['inbound-preview']) ) {
49
- add_action('wp_enqueue_scripts', array(__CLASS__, 'stop_stat_tracking'));
50
  }
51
 
52
  /* load iframed preview page when preview is clicked from AB stats box */
@@ -122,6 +122,7 @@ if ( !class_exists('Landing_Pages_Post_Type') ) {
122
  $role->add_cap( 'edit_others_landing_pages' );
123
  $role->add_cap( 'edit_published_landing_pages' );
124
  $role->add_cap( 'publish_landing_pages' );
 
125
  $role->add_cap( 'delete_others_landing_pages' );
126
  $role->add_cap( 'delete_private_landing_pages' );
127
  $role->add_cap( 'delete_published_landing_pages' );
@@ -582,7 +583,7 @@ if ( !class_exists('Landing_Pages_Post_Type') ) {
582
  */
583
  public static function stop_stat_tracking() {
584
  show_admin_bar(false);
585
- wp_enqueue_script('stop-inbound-stats-js', LANDINGPAGES_URLPATH . 'assets/js/stop_page_stats.js');
586
  wp_enqueue_style('inbound-preview-window-css', LANDINGPAGES_URLPATH . 'assets/css/iframe-preview.css');
587
  }
588
 
46
  if (isset($_GET['dont_save'])
47
  || isset($_GET['iframe_window'])
48
  || isset($_GET['inbound-preview']) ) {
49
+ add_action('wp_enqueue_scripts', array(__CLASS__, 'stop_stat_tracking') , 20);
50
  }
51
 
52
  /* load iframed preview page when preview is clicked from AB stats box */
122
  $role->add_cap( 'edit_others_landing_pages' );
123
  $role->add_cap( 'edit_published_landing_pages' );
124
  $role->add_cap( 'publish_landing_pages' );
125
+ $role->add_cap( 'delete_landing_pages' );
126
  $role->add_cap( 'delete_others_landing_pages' );
127
  $role->add_cap( 'delete_private_landing_pages' );
128
  $role->add_cap( 'delete_published_landing_pages' );
583
  */
584
  public static function stop_stat_tracking() {
585
  show_admin_bar(false);
586
+ wp_enqueue_script('stop-inbound-stats-js', LANDINGPAGES_URLPATH . 'assets/js/stop_page_stats.js' , array('inbound-analytics'));
587
  wp_enqueue_style('inbound-preview-window-css', LANDINGPAGES_URLPATH . 'assets/css/iframe-preview.css');
588
  }
589
 
classes/class.settings.php CHANGED
@@ -460,7 +460,16 @@ class Landing_Pages_Settings {
460
  Registered Post Stati: <?php echo implode(', ', get_post_stati()) . "\n\n"; ?>
461
 
462
  PHP Version: <?php echo PHP_VERSION . "\n"; ?>
463
- MySQL Version: <?php echo mysql_get_server_info($wpdb->dbh) . "\n"; ?>
 
 
 
 
 
 
 
 
 
464
  Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
465
 
466
  PHP Safe Mode: <?php echo ini_get('safe_mode') ? "Yes" : "No\n"; ?>
460
  Registered Post Stati: <?php echo implode(', ', get_post_stati()) . "\n\n"; ?>
461
 
462
  PHP Version: <?php echo PHP_VERSION . "\n"; ?>
463
+ MySQL Version: <?php
464
+ $con=mysqli_connect("localhost","my_user","my_password","my_db");
465
+
466
+ if (mysqli_connect_errno()) {
467
+ echo "Failed to connect to MySQL: " . mysqli_connect_error(). "\n";
468
+ }
469
+
470
+ echo mysqli_get_server_info($con). "\n";
471
+
472
+ ?>
473
  Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
474
 
475
  PHP Safe Mode: <?php echo ini_get('safe_mode') ? "Yes" : "No\n"; ?>
classes/class.statistics.php CHANGED
@@ -86,12 +86,12 @@ if (!class_exists('Landing_Pages_Stats')) {
86
  return $data;
87
  }
88
 
 
89
  /* increment conversions for landing pages */
90
  if( isset($data['post_type']) && $data['post_type'] === 'landing-page' ) {
91
  $conversions = Landing_Pages_Variations::get_conversions( $data['page_id'] , $data['variation'] );
92
  $conversions++;
93
  Landing_Pages_Variations::set_conversions_count( $data['page_id'] , $data['variation'] , $conversions );
94
-
95
  }
96
  /* increment conversions for non landing pages */
97
  else {
86
  return $data;
87
  }
88
 
89
+
90
  /* increment conversions for landing pages */
91
  if( isset($data['post_type']) && $data['post_type'] === 'landing-page' ) {
92
  $conversions = Landing_Pages_Variations::get_conversions( $data['page_id'] , $data['variation'] );
93
  $conversions++;
94
  Landing_Pages_Variations::set_conversions_count( $data['page_id'] , $data['variation'] , $conversions );
 
95
  }
96
  /* increment conversions for non landing pages */
97
  else {
classes/class.widgets.php CHANGED
@@ -10,14 +10,11 @@ function lp_load_widgets() {
10
 
11
  class LP_Widget_Conversion_Area extends WP_Widget {
12
 
13
- /**
14
- * Constructor. Sets up widget options.
15
- */
16
 
17
- function LP_Widget_Conversion_Area() {
18
 
19
  /* Widget settings. */
20
- $widget_ops = array('classname' => 'class_LP_Widget_Conversion_Area', 'description' => __('Use this widget on your landing page sidebar. This sidebar replaces the normal sidebar while using your default theme as a template, or other inactive themes as landing page templates.', 'landing-pages'));
21
 
22
  /* Widget control settings. */
23
  $control_ops = array('width' => 300, 'height' => 350, 'id_base' => 'id_lp_conversion_area_widget');
10
 
11
  class LP_Widget_Conversion_Area extends WP_Widget {
12
 
 
 
 
13
 
14
+ function __construct() {
15
 
16
  /* Widget settings. */
17
+ $widget_ops = array('classname' => 'class_LP_Widget_Conversion_Area', 'description' => __('Use this widget on your landing page sidebar. This sidebar replaces the normal sidebar while using your default theme as a template, or other inactive themes as landing page templates.', 'inbound-pro'));
18
 
19
  /* Widget control settings. */
20
  $control_ops = array('width' => 300, 'height' => 350, 'id_base' => 'id_lp_conversion_area_widget');
classes/class.wp-list-table.templates.php CHANGED
@@ -14,7 +14,7 @@ class Landing_Pages_Templates_List_Table extends WP_List_Table {
14
 
15
  function __construct() {
16
 
17
- $lp_data = lp_get_extension_data();
18
  $final_data = array();
19
 
20
  foreach ($lp_data as $key => $data) {
14
 
15
  function __construct() {
16
 
17
+ $lp_data = Landing_Pages_Load_Extensions::get_extended_data();;
18
  $final_data = array();
19
 
20
  foreach ($lp_data as $key => $data) {
landing-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Landing Pages
4
  Plugin URI: http://www.inboundnow.com/landing-pages/
5
  Description: Landing page template framework with variant testing and lead capturing through cooperation with Inbound Now's Leads plugin. This is the stand alone version served through WordPress.org.
6
- Version: 2.3.8
7
  Author: Inbound Now
8
  Author URI: http://www.inboundnow.com/
9
 
@@ -37,7 +37,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
37
  */
38
  private static function load_constants() {
39
 
40
- define('LANDINGPAGES_CURRENT_VERSION', '2.3.8' );
41
  define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
42
  define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
43
  define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
@@ -74,7 +74,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
74
  include_once( LANDINGPAGES_PATH . 'classes/class.welcome.php');
75
  include_once( LANDINGPAGES_PATH . 'classes/class.install.php');
76
  include_once( LANDINGPAGES_PATH . 'classes/class.landing-pages.php');
77
- include_once( LANDINGPAGES_PATH . 'classes/class.load-extensions.php');
78
  include_once( LANDINGPAGES_PATH . 'classes/class.post-type.landing-page.php');
79
  include_once( LANDINGPAGES_PATH . 'modules/module.utils.php');
80
  include_once( LANDINGPAGES_PATH . 'classes/class.sidebars.php');
@@ -99,8 +99,6 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
99
  include_once( LANDINGPAGES_PATH . 'classes/class.sidebars.php');
100
  include_once( LANDINGPAGES_PATH . 'classes/class.widgets.php');
101
  include_once( LANDINGPAGES_PATH . 'classes/class.landing-pages.php');
102
- include_once( LANDINGPAGES_PATH . 'classes/class.load-extensions.php');
103
-
104
 
105
  BREAK;
106
  endswitch;
3
  Plugin Name: Landing Pages
4
  Plugin URI: http://www.inboundnow.com/landing-pages/
5
  Description: Landing page template framework with variant testing and lead capturing through cooperation with Inbound Now's Leads plugin. This is the stand alone version served through WordPress.org.
6
+ Version: 2.4.2
7
  Author: Inbound Now
8
  Author URI: http://www.inboundnow.com/
9
 
37
  */
38
  private static function load_constants() {
39
 
40
+ define('LANDINGPAGES_CURRENT_VERSION', '2.4.2' );
41
  define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
42
  define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
43
  define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
74
  include_once( LANDINGPAGES_PATH . 'classes/class.welcome.php');
75
  include_once( LANDINGPAGES_PATH . 'classes/class.install.php');
76
  include_once( LANDINGPAGES_PATH . 'classes/class.landing-pages.php');
77
+ include_once( LANDINGPAGES_PATH . 'classes/class.load-templates.php');
78
  include_once( LANDINGPAGES_PATH . 'classes/class.post-type.landing-page.php');
79
  include_once( LANDINGPAGES_PATH . 'modules/module.utils.php');
80
  include_once( LANDINGPAGES_PATH . 'classes/class.sidebars.php');
99
  include_once( LANDINGPAGES_PATH . 'classes/class.sidebars.php');
100
  include_once( LANDINGPAGES_PATH . 'classes/class.widgets.php');
101
  include_once( LANDINGPAGES_PATH . 'classes/class.landing-pages.php');
 
 
102
 
103
  BREAK;
104
  endswitch;
readme.txt CHANGED
@@ -6,8 +6,8 @@ License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
8
  Requires at least: 3.8
9
- Tested up to: 4.6.1
10
- Stable Tag: 2.3.8
11
 
12
  Create landing pages for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own templates and more.
13
 
@@ -49,7 +49,7 @@ The plugin is also fully extendable and has a number of actions, filters, and ho
49
 
50
  [Follow Development on GitHub ](https://github.com/inboundnow/landing-pages "Follow & Contribute to core development on GitHub")
51
  |
52
- [Follow Development on Twitter ](https://twitter.com/gitlandingpages "See our latest development commits on Twitter")
53
 
54
 
55
  == Installation ==
@@ -70,6 +70,9 @@ The plugin is also fully extendable and has a number of actions, filters, and ho
70
 
71
  == Changelog ==
72
 
 
 
 
73
  = 2.3.8 =
74
  * Improving events storage and events reporting.
75
 
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
8
  Requires at least: 3.8
9
+ Tested up to: 4.7.1
10
+ Stable Tag: 2.4.2
11
 
12
  Create landing pages for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own templates and more.
13
 
49
 
50
  [Follow Development on GitHub ](https://github.com/inboundnow/landing-pages "Follow & Contribute to core development on GitHub")
51
  |
52
+ [Follow Inbound Now on Twitter ](https://twitter.com/inboundnow "Stay notified with updates.")
53
 
54
 
55
  == Installation ==
70
 
71
  == Changelog ==
72
 
73
+ = 2.4.2 =
74
+ * Updating shared directory, minor code structure improvements.
75
+
76
  = 2.3.8 =
77
  * Improving events storage and events reporting.
78
 
shared/classes/class.ajax.php CHANGED
@@ -38,12 +38,17 @@ if (!class_exists('Inbound_Ajax')) {
38
  }
39
 
40
  /**
41
- *
42
  */
43
  public static function track_lead() {
44
 
45
  global $wpdb;
46
 
 
 
 
 
 
47
  $lead_data['lead_id'] = (isset($_POST['wp_lead_id'])) ? $_POST['wp_lead_id'] : '';
48
  $lead_data['nature'] = (isset($_POST['nature'])) ? $_POST['nature'] : 'non-conversion'; /* what is nature? */
49
  $lead_data['json'] = (isset($_POST['json'])) ? addslashes($_POST['json']) : 0;
@@ -68,8 +73,7 @@ if (!class_exists('Inbound_Ajax')) {
68
  $_SESSION['inbound_page_views'] = $page_views;
69
  }
70
 
71
- /* update lead data */
72
-
73
  if ($lead_data['lead_id']) {
74
  self::update_page_view_obj($lead_data);
75
  self::set_current_lists($lead_data['lead_id']);
38
  }
39
 
40
  /**
41
+ * Listen for page view event
42
  */
43
  public static function track_lead() {
44
 
45
  global $wpdb;
46
 
47
+ /* check for known bots and ignore */
48
+ if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) {
49
+ return;
50
+ }
51
+
52
  $lead_data['lead_id'] = (isset($_POST['wp_lead_id'])) ? $_POST['wp_lead_id'] : '';
53
  $lead_data['nature'] = (isset($_POST['nature'])) ? $_POST['nature'] : 'non-conversion'; /* what is nature? */
54
  $lead_data['json'] = (isset($_POST['json'])) ? addslashes($_POST['json']) : 0;
73
  $_SESSION['inbound_page_views'] = $page_views;
74
  }
75
 
76
+ /* update lead data and set lead lists into cookies */
 
77
  if ($lead_data['lead_id']) {
78
  self::update_page_view_obj($lead_data);
79
  self::set_current_lists($lead_data['lead_id']);
shared/classes/class.confirm-double-optin.php ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!class_exists('Inbound_Confirm_Double_Optin')){
3
+
4
+ class Inbound_Confirm_Double_Optin{
5
+
6
+ /**
7
+ * Initialize class
8
+ */
9
+ function __construct(){
10
+ self::add_hooks();
11
+ }
12
+
13
+ /**
14
+ * Load Hooks and Filters
15
+ */
16
+ public static function add_hooks(){
17
+
18
+ /* Shortcode for displaying list double opt in confirmation form */
19
+ add_action( 'init' , array( __CLASS__, 'process_confrimation' ), 20 );
20
+
21
+ /* Process shortcode to produce the confirmation link,
22
+ * the name is different from the one the user uses to prevent early rendering */
23
+ add_shortcode( 'list-double-optin-link', array( __CLASS__, 'render_confirm_link' ) );
24
+
25
+ }
26
+
27
+
28
+ /**
29
+ * @param $atts
30
+ * @return string
31
+ */
32
+ public static function process_confrimation(){
33
+ global $inbound_settings;
34
+
35
+ if (!isset($_REQUEST['inbound-action']) || $_REQUEST['inbound-action'] != 'confirm' ) {
36
+ return;
37
+ }
38
+
39
+ /* get all lead lists */
40
+ $lead_lists = Inbound_Leads::get_lead_lists_as_array();
41
+
42
+ /* decode token */
43
+ $params = self::decode_confirm_token( sanitize_text_field($_GET['token']) );
44
+
45
+
46
+ if ( !isset( $params['lead_id'] ) ) {
47
+ return;
48
+ }
49
+
50
+ self::confirm_being_added_to_lists($params, $all);
51
+ }
52
+
53
+
54
+ /**
55
+ * Creates the double optin confirmation link
56
+ * The shorcode used by the user is: inbound-list-double-optin-link.
57
+ * But Inbound_List_Double_Optin::add_confirm_link_shortcode_params trims the name to: list-double-optin-link.
58
+ * Then it gets rendered.
59
+ * The reason for this is so the shorcode isn't rendered until the atts have been added to it.
60
+ */
61
+ public static function render_confirm_link( $params ) {
62
+
63
+ $params = shortcode_atts( array(
64
+ 'lead_id' => '',
65
+ 'list_ids' => '-1',
66
+ 'email_id' => '-1'
67
+ ), $params, 'list-double-optin-link');
68
+ /* check to see if lead id is set as a REQUEST */
69
+ if ( isset($params['lead_id']) ) {
70
+ $params['lead_id'] = intval($params['lead_id']);
71
+ } else if ( isset($_REQUEST['lead_id']) ) {
72
+ $params['lead_id'] = intval($_REQUEST['lead_id']);
73
+ } else if ( isset($_COOKIE['wp_lead_id']) ) {
74
+ $params['lead_id'] = intval($_COOKIE['wp_lead_id']);
75
+ }
76
+ /* Add variation id to confirm link */
77
+ $params['variation_id'] = ( isset($_REQUEST['inbvid']) ) ? intval($_REQUEST['inbvid']) : intval(0);
78
+
79
+ /* generate confirm link */
80
+ $confirm_link = self::generate_confirm_link( $params );
81
+ return $confirm_link;
82
+ }
83
+
84
+
85
+
86
+ /**
87
+ * Generates confirm url given lead id and lists
88
+ * @param ARRAY $params contains: lead_id (INT ), list_ids (MIXED), email_id (INT)
89
+ * @return STRING $confirm_url
90
+ */
91
+ public static function generate_confirm_link( $params ) {
92
+ if (!isset($params['lead_id']) || !$params['lead_id']) {
93
+ return __( '#confirm-not-available-in-online-mode' , 'inbound-pro' );
94
+ }
95
+ if (isset($_GET['lead_lists']) && !is_array($_GET['lead_lists'])){
96
+ $params['list_ids'] = explode( ',' , $_GET['lead_lists']);
97
+ } else if (isset($params['list_ids']) && !is_array($params['list_ids'])) {
98
+ $params['list_ids'] = explode( ',' , $params['list_ids']);
99
+ }
100
+ $args = array_merge( $params , $_GET );
101
+ $token = self::encode_confirm_token( $args );
102
+
103
+ if(!defined('INBOUND_PRO_CURRENT_VERSION')){
104
+ $double_optin_page_id = get_option('list-double-optin-page-id', '');
105
+ }else{
106
+ $settings = Inbound_Options_API::get_option('inbound-pro', 'settings', array());
107
+ $double_optin_page_id = $settings['leads']['list-double-optin-page-id'];
108
+ }
109
+
110
+ if ( empty($double_optin_page_id) ) {
111
+ $post = get_page_by_title( __( 'Confirm Subscription' , 'inbound-pro' ) );
112
+ $double_optin_page_id = $post->ID;
113
+ }
114
+
115
+ $base_url = get_permalink( $double_optin_page_id );
116
+
117
+ return add_query_arg( array( 'token'=>$token , 'inbound-action' => 'confirm' ) , $base_url );
118
+ }
119
+
120
+
121
+ /**
122
+ * Encodes data into a confirm token
123
+ * @param ARRAY $params contains: lead_id (INT ), list_ids (MIXED), email_id (INT)
124
+ * @return INT $token
125
+ */
126
+ public static function encode_confirm_token( $params ) {
127
+ unset($params['doing_wp_cron']);
128
+ $json = json_encode($params);
129
+ $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
130
+ $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
131
+ $encrypted_string =
132
+ base64_encode(
133
+ trim(
134
+ mcrypt_encrypt(
135
+ MCRYPT_RIJNDAEL_256, substr( SECURE_AUTH_KEY , 0 , 16 ) , $json, MCRYPT_MODE_ECB, $iv
136
+ )
137
+ )
138
+ );
139
+ $decode_test = self::decode_confirm_token($encrypted_string);
140
+ return str_replace(array('+', '/', '='), array('-', '_', '^'), $encrypted_string);
141
+ }
142
+
143
+
144
+ /**
145
+ * Decodes confirm token into an array of parameters
146
+ * @param STRING $reader_id Encoded lead id.
147
+ * @return ARRAY $confirm array of confirmation data
148
+ */
149
+ public static function decode_confirm_token( $token ) {
150
+ $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
151
+ $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
152
+ $decrypted_string =
153
+ trim(
154
+ mcrypt_decrypt(
155
+ MCRYPT_RIJNDAEL_256 , substr( SECURE_AUTH_KEY , 0 , 16 ) , base64_decode( str_replace(array('-', '_', '^'), array('+', '/', '='), $token ) ) , MCRYPT_MODE_ECB, $iv
156
+ )
157
+ );
158
+ return json_decode($decrypted_string , true);
159
+ }
160
+
161
+ /**
162
+ * Adds the lead to lists he selected when filling out the confirmation form.
163
+ * If all_lists was selected, all lists currently waiting for confirmation will be selected and the lead will be added to those.
164
+ */
165
+ public static function confirm_being_added_to_lists($params, $all = false){
166
+
167
+ /*get the double optin waiting list id*/
168
+ if(!defined('INBOUND_PRO_CURRENT_VERSION')){
169
+ $double_optin_list_id = get_option('list-double-optin-list-id', '');
170
+ }else{
171
+ $settings = Inbound_Options_API::get_option('inbound-pro', 'settings', array());
172
+ $double_optin_list_id = $settings['leads']['list-double-optin-list-id'];
173
+ }
174
+
175
+
176
+ /*get the lists waiting to be opted into*/
177
+ $stored_double_optin_lists = get_post_meta($params['lead_id'], 'double_optin_lists', true);
178
+
179
+ /*if there aren't any lists, exit*/
180
+ if(empty($stored_double_optin_lists)){
181
+ return;
182
+ }
183
+
184
+ /*if opt into all lists has been selected, set list ids to all stored list ids*/
185
+ if($all){
186
+ $params['list_ids'] = $stored_double_optin_lists;
187
+ }
188
+
189
+ /**for each supplied list, add the lead to the list.
190
+ * And remove the list id from the array of lists needing to be opted into**/
191
+ foreach($params['list_ids'] as $list_id){
192
+ Inbound_Leads::add_lead_to_list($params['lead_id'], $list_id);
193
+
194
+ if(in_array($list_id, $stored_double_optin_lists)){
195
+ $index = array_search($list_id, $stored_double_optin_lists);
196
+ unset($stored_double_optin_lists[$index]);
197
+ }
198
+ }
199
+
200
+ /**if there are still lists awaiting double optin confirmation after the "waiting" meta listing has been updated**/
201
+ if(!empty($stored_double_optin_lists)){
202
+ /*update the "waiting" meta listing with the remaining lists*/
203
+ update_post_meta($params['lead_id'], 'double_optin_lists', array_values($stored_double_optin_lists));
204
+ }else{
205
+ /**if there are no lists awaiting double optin confirmation**/
206
+ /*remove the meta listing for double optin*/
207
+ delete_post_meta($params['lead_id'], 'double_optin_lists');
208
+ /*remove this lead from the double optin list*/
209
+ wp_remove_object_terms($params['lead_id'], $double_optin_list_id, 'wplead_list_category');
210
+ /*update the lead status*/
211
+ update_post_meta( $params['lead_id'], 'wp_lead_status', 'active');
212
+ }
213
+ }
214
+ }
215
+ new Inbound_Confirm_Double_Optin;
216
+
217
+ }
shared/classes/class.database-routines.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Public methods in this class will be run at least once during plugin activation script. */
4
+ /* Updater methods fired are stored in transient to prevent repeat processing */
5
+
6
+ if ( !class_exists('Inbound_Upgrade_Routines') ) {
7
+
8
+ class Inbound_Upgrade_Routines {
9
+ static $routines;
10
+ static $past_version;
11
+ static $current_version;
12
+
13
+ /**
14
+ * Run Generic Upgrade Routines
15
+ */
16
+ public static function load() {
17
+ self::define_routines();
18
+ self::load_routines();
19
+ }
20
+
21
+ /**
22
+ *
23
+ */
24
+ public static function define_routines() {
25
+
26
+ /* alter page view table */
27
+ self::$routines['page-views-table-1'] = array(
28
+ 'id' => 'page-views-table-1',
29
+ 'scope' => 'shared',
30
+ 'introduced' => '1.0.1',
31
+ 'callback' => array( __CLASS__ , 'alter_page_views_table_1')
32
+ );
33
+
34
+ /* alter page view table */
35
+ self::$routines['events-table-1'] = array(
36
+ 'id' => 'events-table-1',
37
+ 'scope' => 'shared',
38
+ 'introduced' => '1.0.1',
39
+ 'callback' => array( __CLASS__ , 'alter_events_table_1')
40
+ );
41
+ }
42
+
43
+ /**
44
+ *
45
+ */
46
+ public static function load_routines() {
47
+
48
+ self::$routines = apply_filters( 'inbound-pro/upgrade-routines' , self::$routines);
49
+
50
+ foreach (self::$routines as $routine) {
51
+ /* set versions int static vars */
52
+ self::set_versions($routine);
53
+
54
+ /* compare versions and see last installed version is beneath the introduced version */
55
+ if ( !self::$past_version || !version_compare( (int) self::$past_version , (int) $routine['introduced'] , '<') ) {
56
+ continue;
57
+ }
58
+
59
+ /* run the routine */
60
+ call_user_func(array($routine['callback'][0] , $routine['callback'][1]) );
61
+ }
62
+
63
+ /* set shared version transient */
64
+ set_transient('inbound_shared_version' , INBOUNDNOW_SHARED_DBRV);
65
+ }
66
+
67
+
68
+ /**
69
+ * @param $routine
70
+ */
71
+ public static function set_versions( $routine ) {
72
+ switch($routine['scope']) {
73
+ case 'shared':
74
+ self::$past_version = get_transient('inbound_shared_version');
75
+ self::$current_version = INBOUNDNOW_SHARED_DBRV;
76
+ break;
77
+ case 'leads':
78
+ self::$past_version = get_transient('leads_shared_version');
79
+ self::$current_version = WPL_CURRENT_VERSION;
80
+ break;
81
+ case 'landing-pages':
82
+ self::$past_version = get_transient('lp_current_version');
83
+ self::$current_version = LANDINGPAGES_CURRENT_VERSION;
84
+ break;
85
+ case 'cta':
86
+ self::$past_version = get_transient('cta_current_version');
87
+ self::$current_version = WP_CTA_CURRENT_VERSION;
88
+ break;
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Alter pageview table from INT to VARCHARR
94
+ * @param $routines
95
+ */
96
+ public static function alter_page_views_table_1() {
97
+ global $wpdb;
98
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
99
+
100
+ $table_name = $wpdb->prefix . "inbound_page_views";
101
+
102
+ /* add ip field if does not exist */
103
+ $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$table_name}' AND column_name = 'ip'" );
104
+ if(empty($row)){
105
+ $wpdb->get_results( "ALTER TABLE {$table_name} ADD `ip` VARCHAR(45) NOT NULL" );
106
+ }
107
+
108
+ /* alter ip field to fix bad field types */
109
+ $wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `ip` VARCHAR(45)" );
110
+
111
+ }
112
+
113
+ /**
114
+ * @migration-type: alter inbound_events table
115
+ * @mirgration: adds columns list_id funnel, and source to events table
116
+ */
117
+ public static function alter_events_table_1() {
118
+
119
+ global $wpdb;
120
+
121
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
122
+ $table_name = $wpdb->prefix . "inbound_events";
123
+
124
+ /* add columns funnel and source to legacy table */
125
+ $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$table_name}' AND column_name = 'source'" );
126
+ if(empty($row)){
127
+ // do your stuff
128
+ $wpdb->get_results( "ALTER TABLE {$table_name} ADD `funnel` text NOT NULL" );
129
+ $wpdb->get_results( "ALTER TABLE {$table_name} ADD `source` text NOT NULL" );
130
+ }
131
+
132
+ /* add columns list_id inbound events table */
133
+ $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$table_name}' AND column_name = 'list_id'" );
134
+ if(empty($row)){
135
+ $wpdb->get_results( "ALTER TABLE {$table_name} ADD `list_id` varchar(255) NOT NULL" );
136
+ }
137
+ }
138
+ }
139
+
140
+ /* hook upgrade routines into activation script */
141
+ add_action('inbound_shared_activate' , array( 'Inbound_Upgrade_Routines' , 'load') );
142
+
143
+ }
shared/classes/class.events.php CHANGED
@@ -43,10 +43,6 @@ class Inbound_Events {
43
  /* Saves all all incoming POST data as meta pairs */
44
  add_action('before_delete_post', array(__CLASS__, 'delete_related_events'));
45
 
46
- /* listen for Inbound Mailer send event and record to events table
47
- * I think we can pull this infromation directly from Mandril
48
- add_action('inbound_mandrill_send_event' , array( __CLASS__ , 'store_email_send'), 10 , 2);
49
- */
50
  }
51
 
52
  /**
@@ -117,6 +113,7 @@ class Inbound_Events {
117
  `session_id` varchar(255) NOT NULL,
118
  `source` text NOT NULL,
119
  `datetime` datetime NOT NULL,
 
120
 
121
  UNIQUE KEY id (id)
122
  ) $charset_collate;";
@@ -203,25 +200,6 @@ class Inbound_Events {
203
  self::store_event($args);
204
  }
205
 
206
- /**
207
- * Stores email send event into events table
208
- * @param $args
209
- */
210
- public static function store_email_send( $message , $send_at ) {
211
-
212
- $args = array(
213
- 'event_name' => 'inbound_email_send',
214
- 'email_id' => $message['metadata']['email_id'],
215
- 'variation_id' => $message['metadata']['variation_id'],
216
- 'lead_id' => $args['urlparams']['lead_id'],
217
- 'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
218
- 'event_details' => json_encode($args['urlparams']),
219
- 'datetime' => $args['datetime'],
220
- 'form_id' => ''
221
- );
222
-
223
- self::store_event($args);
224
- }
225
 
226
  /**
227
  * Stores inbound email click event into events table
@@ -393,8 +371,7 @@ class Inbound_Events {
393
  global $wpdb;
394
 
395
  $table_name = $wpdb->prefix . "inbound_page_views";
396
- $timezone_format = 'Y-m-d G:i:s T';
397
- $wordpress_date_time = date_i18n($timezone_format);
398
 
399
  $defaults = array(
400
  'page_id' => '',
@@ -403,12 +380,17 @@ class Inbound_Events {
403
  'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
404
  'session_id' => ( isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : session_id() ),
405
  'datetime' => $wordpress_date_time,
406
- 'source' => ( isset($_COOKIE['inbound_referral_site']) ? $_COOKIE['inbound_referral_site'] : '' )
 
407
  );
408
 
409
  $args = array_merge( $defaults , $args );
410
 
411
 
 
 
 
 
412
  /* unset non db ready keys */
413
  foreach ($args as $key => $value) {
414
  if (!isset($defaults[$key])) {
@@ -416,17 +398,12 @@ class Inbound_Events {
416
  }
417
  }
418
 
419
- /* add event to event table */
420
  $wpdb->insert(
421
  $table_name,
422
  $args
423
  );
424
 
425
- /* check error messages for broken tables */
426
- if (isset($wpdb->last_error)) {
427
- self::create_page_views_table();
428
- }
429
-
430
  }
431
 
432
  public static function delete_related_events( $post_id , $vid = 'all' ) {
@@ -532,6 +509,52 @@ class Inbound_Events {
532
  return $results;
533
  }
534
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
  /**
536
  * Get form submission events given conditions
537
  *
@@ -563,7 +586,7 @@ class Inbound_Events {
563
  $query .= 'AND variation_id = "'.$params['variation_id'].'" ';
564
  }
565
 
566
- $query .= 'AND `event_name` LIKE "%form_submission" ORDER BY `datetime` DESC';
567
 
568
  $results = $wpdb->get_results( $query , ARRAY_A );
569
 
@@ -573,12 +596,20 @@ class Inbound_Events {
573
  /**
574
  * Get page view events related to lead ID
575
  */
576
- public static function get_page_views( $lead_id ){
577
  global $wpdb;
578
 
579
  $table_name = $wpdb->prefix . "inbound_page_views";
580
 
581
- $query = 'SELECT * FROM '.$table_name.' WHERE `lead_id` = "'.$lead_id.'" ORDER BY `datetime` DESC';
 
 
 
 
 
 
 
 
582
  $results = $wpdb->get_results( $query , ARRAY_A );
583
 
584
  return $results;
@@ -593,20 +624,84 @@ class Inbound_Events {
593
 
594
  $table_name = $wpdb->prefix . "inbound_page_views";
595
  $query = 'SELECT * FROM '.$table_name.' WHERE ';
 
 
596
  switch ($nature) {
597
  case 'lead_id':
598
- $query .='`lead_id` = "'.$params['lead_id'].'"';
 
 
 
599
  break;
600
  case 'page_id':
601
- $query .='`page_id` = "'.$params['page_id'].'"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
  break;
603
  }
604
 
 
 
 
605
  if (isset($params['start_date'])) {
606
- $query .= 'AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
607
- $query .= 'ORDER BY `datetime` DESC';
 
 
 
608
  }
609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  $results = $wpdb->get_results( $query , ARRAY_A );
611
 
612
  return $results;
@@ -623,6 +718,8 @@ class Inbound_Events {
623
 
624
  $query = 'SELECT count(*) FROM '.$table_name.' WHERE `lead_id` = "'.$lead_id.'"';
625
 
 
 
626
  $count = $wpdb->get_var( $query , 0, 0 );
627
 
628
  /* return null if nothing there */
@@ -665,7 +762,6 @@ class Inbound_Events {
665
 
666
  $query .='GROUP BY lead_uid';
667
 
668
-
669
  $results = $wpdb->get_results( $query , ARRAY_A );
670
 
671
  /* return null if nothing there */
@@ -674,16 +770,207 @@ class Inbound_Events {
674
  }
675
 
676
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
 
678
  /**
679
- * Get all cta click events related to lead ID
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
680
  */
681
- public static function get_events(){
682
  global $wpdb;
683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  $table_name = $wpdb->prefix . "inbound_events";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
685
 
686
- $query = 'SELECT DISTINCT(event_name) FROM '.$table_name.' ORDER BY `event_name` DESC';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
  $results = $wpdb->get_results( $query , ARRAY_A );
688
 
689
  return $results;
@@ -706,6 +993,47 @@ class Inbound_Events {
706
 
707
  }
708
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
709
  /**
710
  * Get all cta click events related to lead ID
711
  */
@@ -994,7 +1322,7 @@ class Inbound_Events {
994
  * @param datetime $start_date
995
  * @param datetime $end_date
996
  */
997
- public static function get_page_actions($page_id , $activity = 'any' , $start_date = null, $end_date = null ){
998
  global $wpdb;
999
 
1000
  $table_name = $wpdb->prefix . "inbound_events";
43
  /* Saves all all incoming POST data as meta pairs */
44
  add_action('before_delete_post', array(__CLASS__, 'delete_related_events'));
45
 
 
 
 
 
46
  }
47
 
48
  /**
113
  `session_id` varchar(255) NOT NULL,
114
  `source` text NOT NULL,
115
  `datetime` datetime NOT NULL,
116
+ `ip` varchar(45) NOT NULL,
117
 
118
  UNIQUE KEY id (id)
119
  ) $charset_collate;";
200
  self::store_event($args);
201
  }
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  /**
205
  * Stores inbound email click event into events table
371
  global $wpdb;
372
 
373
  $table_name = $wpdb->prefix . "inbound_page_views";
374
+ $wordpress_date_time = date_i18n('Y-m-d G:i:s T');
 
375
 
376
  $defaults = array(
377
  'page_id' => '',
380
  'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
381
  'session_id' => ( isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : session_id() ),
382
  'datetime' => $wordpress_date_time,
383
+ 'source' => ( isset($_COOKIE['inbound_referral_site']) ? $_COOKIE['inbound_referral_site'] : '' ),
384
+ 'ip' => LeadStorage::lookup_ip_address()
385
  );
386
 
387
  $args = array_merge( $defaults , $args );
388
 
389
 
390
+ if (!$args['page_id']) {
391
+ return;
392
+ }
393
+
394
  /* unset non db ready keys */
395
  foreach ($args as $key => $value) {
396
  if (!isset($defaults[$key])) {
398
  }
399
  }
400
 
401
+ /* add page view to inbound_page_views table */
402
  $wpdb->insert(
403
  $table_name,
404
  $args
405
  );
406
 
 
 
 
 
 
407
  }
408
 
409
  public static function delete_related_events( $post_id , $vid = 'all' ) {
509
  return $results;
510
  }
511
 
512
+ /**
513
+ * Determine information about point of event capture
514
+ * @param $event
515
+ * @return mixed
516
+ */
517
+ public static function get_event_capture_data( $event ) {
518
+ switch( $event['event_name'] ) {
519
+ case 'inbound_cta_click':
520
+ $link = admin_url('post.php?post='.$event['cta_id'].'&action=edit');
521
+ $title = get_the_title($event['cta_id']);
522
+ $capture_id = $event['cta_id'];
523
+ break;
524
+ case 'inbound_form_submission':
525
+ $link = admin_url('post.php?post='.$event['form_id'].'&action=edit');
526
+ $title = get_the_title($event['form_id']);
527
+ $capture_id = $event['form_id'];
528
+ break;
529
+ case 'cf7_form_submission':
530
+ $link = admin_url('post.php?page=wpcf7&post='.$event['form_id'].'&action=edit');
531
+ $title = get_the_title($event['form_id']);
532
+ $capture_id = $event['form_id'];
533
+ break;
534
+ case 'ninja_form_submission':
535
+ $link = admin_url('post.php?page=ninja-forms&form_id='.$event['form_id'].'&action=edit');
536
+ $title = get_the_title($event['form_id']);
537
+ $capture_id = $event['form_id'];
538
+ break;
539
+ case 'inbound_list_add':
540
+ $link = "";
541
+ $title = "";
542
+ $capture_id = "";
543
+ break;
544
+ case 'sparkpost_delivery':
545
+ $link = "";
546
+ $title = "";
547
+ $capture_id = "";
548
+ break;
549
+ }
550
+
551
+ $array['link'] = ($link) ? $link : '#';
552
+ $array['title'] = ($title) ? $title : __('n/a','inbound-pro');
553
+ $array['capture_id'] = ($capture_id) ? $capture_id : 0;
554
+
555
+ return apply_filters('inbound-events/capture-data' , $array , $event);
556
+ }
557
+
558
  /**
559
  * Get form submission events given conditions
560
  *
586
  $query .= 'AND variation_id = "'.$params['variation_id'].'" ';
587
  }
588
 
589
+ $query .= 'AND `event_name` = "inbound_form_submission" ORDER BY `datetime` DESC';
590
 
591
  $results = $wpdb->get_results( $query , ARRAY_A );
592
 
596
  /**
597
  * Get page view events related to lead ID
598
  */
599
+ public static function get_page_views( $lead_id , $lead_uid = 0 , $page_id = 0 ){
600
  global $wpdb;
601
 
602
  $table_name = $wpdb->prefix . "inbound_page_views";
603
 
604
+ $query = 'SELECT * FROM '.$table_name.' WHERE `lead_id` = "'.$lead_id.'"';
605
+
606
+ $query .=' AND `page_id` != "0"';
607
+
608
+ if ($page_id) {
609
+ $query .=' AND page_views_id` = "'.$page_id.'"';
610
+ }
611
+
612
+ $query .='ORDER BY `datetime` DESC';
613
  $results = $wpdb->get_results( $query , ARRAY_A );
614
 
615
  return $results;
624
 
625
  $table_name = $wpdb->prefix . "inbound_page_views";
626
  $query = 'SELECT * FROM '.$table_name.' WHERE ';
627
+
628
+
629
  switch ($nature) {
630
  case 'lead_id':
631
+ $query .=' `lead_id` = "'.$params['lead_id'].'" ';
632
+ break;
633
+ case 'lead_uid':
634
+ $query .=' `lead_uid` = "'.$params['lead_uid'].'" ';
635
  break;
636
  case 'page_id':
637
+ $query .=' `page_id` = "'.$params['page_id'].'" ';
638
+ break;
639
+ case 'mixed':
640
+ if (isset($params['lead_id']) && $params['lead_id'] ) {
641
+ $queries[] = ' `lead_id` = "'.$params['lead_id'].'" ';
642
+ }
643
+ if (isset($params['lead_uid']) && $params['lead_uid']) {
644
+ $queries[] = ' `lead_uid` = "'.$params['lead_uid'].'" ';
645
+ }
646
+ if (isset($params['page_id']) && $params['page_id']) {
647
+ $queries[] = ' `page_id` = "'.$params['page_id'].'" ';
648
+ }
649
+
650
+ /* combine queries into a usable string */
651
+ foreach ($queries as $i => $q) {
652
+ $query .= $q . ( isset($queries[$i+1]) ? ' AND ' : '' );
653
+ }
654
+
655
  break;
656
  }
657
 
658
+
659
+ $query .=' AND `page_id` != "0" ';
660
+
661
  if (isset($params['start_date'])) {
662
+ $query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
663
+ }
664
+
665
+ if (isset($params['group_by'])) {
666
+ $query .= ' GROUP BY `'.$params['group_by'].'` ';
667
  }
668
 
669
+ $query .= ' ORDER BY `datetime` DESC';
670
+ //print_r($query);exit;
671
+ $results = $wpdb->get_results( $query , ARRAY_A );
672
+
673
+ return $results;
674
+ }
675
+
676
+
677
+
678
+ /**
679
+ * Get page view events given conditions
680
+ *
681
+ */
682
+ public static function get_page_views_by_dates( $params ){
683
+ global $wpdb;
684
+
685
+ $params['group_by'] = (isset($params['group_by'])) ? $params['group_by'] : 'lead_uid';
686
+ $params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
687
+
688
+ $table_name = $wpdb->prefix . "inbound_page_views";
689
+
690
+ $query = 'SELECT *, count(*) as impressions, count(date(datetime)) as impressions_per_day, date(datetime) as date FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
691
+
692
+
693
+ if (isset($params['source']) && $params['source'] ) {
694
+ $query .= ' AND source = "'.$params['source'].'" ';
695
+ }
696
+
697
+ $query .=' AND `page_id` != "0" ';
698
+
699
+ if (isset($params['start_date'])) {
700
+ $query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
701
+ }
702
+
703
+ $query .= 'GROUP BY DATE(datetime)';
704
+
705
  $results = $wpdb->get_results( $query , ARRAY_A );
706
 
707
  return $results;
718
 
719
  $query = 'SELECT count(*) FROM '.$table_name.' WHERE `lead_id` = "'.$lead_id.'"';
720
 
721
+ $query .=' AND `page_id` != "0" ';
722
+
723
  $count = $wpdb->get_var( $query , 0, 0 );
724
 
725
  /* return null if nothing there */
762
 
763
  $query .='GROUP BY lead_uid';
764
 
 
765
  $results = $wpdb->get_results( $query , ARRAY_A );
766
 
767
  /* return null if nothing there */
770
  }
771
 
772
 
773
+ /**
774
+ * Get page view events given conditions
775
+ *
776
+ */
777
+ public static function get_visitors( $params ){
778
+ global $wpdb;
779
+
780
+ $params['group_by'] = (isset($params['group_by'])) ? $params['group_by'] : 'lead_uid';
781
+ $params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
782
+
783
+ $table_name = $wpdb->prefix . "inbound_page_views";
784
+ $query = 'SELECT *, count('.$params['group_by'].') as count FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
785
+
786
+ if (isset($params['source']) && $params['source'] ) {
787
+ $query .= ' AND source = "'.$params['source'].'" ';
788
+ }
789
+
790
+ if (isset($params['start_date'])) {
791
+ $query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
792
+ }
793
+
794
+ $query .= ' GROUP BY `'.$params['group_by'].'` ';
795
+
796
+ if (isset($params['order_by'])) {
797
+ $query .= ' ORDER BY '.$params['order_by'].' ';
798
+ }
799
+
800
+ if (isset($params['limit'])) {
801
+ $query .= ' LIMIT '.$params['limit'];;
802
+ }
803
+
804
+ $results = $wpdb->get_results( $query , ARRAY_A );
805
+
806
+ return $results;
807
+ }
808
 
809
  /**
810
+ * Get page view events given conditions
811
+ *
812
+ */
813
+ public static function get_visitors_by_dates( $params ){
814
+ global $wpdb;
815
+
816
+ $params['group_by'] = (isset($params['group_by'])) ? $params['group_by'] : 'lead_uid';
817
+ $params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
818
+
819
+ $table_name = $wpdb->prefix . "inbound_page_views";
820
+ $query = 'SELECT count(date(datetime)) as visits_per_day, date(datetime) as date , sum(visits) as visitors FROM ( ';
821
+
822
+ $query .= ' SELECT *, count('.$params['group_by'].') as visits FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
823
+
824
+
825
+ if (isset($params['source']) && $params['source'] ) {
826
+ $query .= ' AND source = "'.$params['source'].'" ';
827
+ }
828
+
829
+ if (isset($params['start_date'])) {
830
+ $query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
831
+ }
832
+
833
+ $query .= ' GROUP BY '.$params['group_by'].' ';
834
+
835
+
836
+ $query .= ') AS concat_date GROUP BY DATE(datetime)';
837
+
838
+ $results = $wpdb->get_results( $query , ARRAY_A );
839
+
840
+ return $results;
841
+ }
842
+
843
+ /**
844
+ * Get page view events given conditions
845
+ *
846
  */
847
+ public static function get_visitors_group_by_source( $params ){
848
  global $wpdb;
849
 
850
+ $table_name = $wpdb->prefix . "inbound_page_views";
851
+ $query = 'SELECT * , count(source) as visitors, sum(page_views) as page_views_total FROM ( ';
852
+
853
+ $query .= ' SELECT *, count(lead_uid) as page_views FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
854
+
855
+ if (isset($params['source']) && $params['source'] ) {
856
+ $query .= ' AND source = "'.$params['source'].'" ';
857
+ }
858
+
859
+ if (isset($params['start_date'])) {
860
+ $query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
861
+ }
862
+
863
+ $query .= ' GROUP BY lead_uid ';
864
+
865
+ $query .= ') AS s1 GROUP BY source';
866
+
867
+ $query .= ' ORDER BY visitors DESC, page_views DESC ';
868
+
869
+ if (isset($params['limit'])) {
870
+ $query .= ' LIMIT '.$params['limit'];;
871
+ }
872
+
873
+ $results = $wpdb->get_results( $query , ARRAY_A );
874
+
875
+ return $results;
876
+ }
877
+
878
+
879
+ /**
880
+ * Get events given parameters
881
+ *
882
+ */
883
+ public static function get_events( $params ){
884
+ global $wpdb;
885
+
886
+ $params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
887
+
888
  $table_name = $wpdb->prefix . "inbound_events";
889
+ $query = 'SELECT *';
890
+
891
+ if (isset($params['group_by']) && $params['group_by'] ) {
892
+ $query .=' , count('.$params['group_by'].') as count ';
893
+ }
894
+
895
+ $query .=' FROM '.$table_name.' WHERE 1=1 ';
896
+
897
+ if (isset($params['page_id']) && $params['page_id'] ) {
898
+ $query .= ' AND page_id = "'.$params['page_id'].'" ';
899
+ }
900
+
901
+ if (isset($params['event_name']) && $params['event_name'] ) {
902
+ $query .= ' AND event_name = "'.$params['event_name'].'" ';
903
+ }
904
+
905
+ if (isset($params['source']) && $params['source'] ) {
906
+ $query .= ' AND source = "'.$params['source'].'" ';
907
+ }
908
+
909
+ if (isset($params['lead_id']) && $params['lead_id'] ) {
910
+ $query .= ' AND lead_id = "'.$params['lead_id'].'" ';
911
+ }
912
+
913
+ if (isset($params['start_date']) && $params['start_date']) {
914
+ $query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
915
+ }
916
+
917
+ if (isset($params['group_by']) && $params['group_by']) {
918
+ $query .= ' GROUP BY `' . $params['group_by'] . '` ';
919
+ }
920
 
921
+ if (isset($params['order_by']) && $params['order_by']) {
922
+ $query .= ' ORDER BY '.$params['order_by'].' ';
923
+ }
924
+
925
+ if (isset($params['limit'])) {
926
+ $query .= ' LIMIT '.$params['limit'];;
927
+ }
928
+
929
+ $results = $wpdb->get_results( $query , ARRAY_A );
930
+
931
+ return $results;
932
+ }
933
+
934
+ /**
935
+ * Returns a label for an event given an event_name
936
+ */
937
+ public static function get_event_label( $event_name , $plural = true) {
938
+ switch($event_name) {
939
+ case 'inbound_form_submission':
940
+ return ($plural) ? __('Inbound Form Submissions' , 'inbound-pro') : __('Inbound Form Submission' , 'inbound-pro');
941
+ break;
942
+ case 'inbound_cta_click':
943
+ return ($plural) ? __('CTA Clicks' , 'inbound-pro') : __('CTA Click' , 'inbound-pro');
944
+ break;
945
+ case 'inbound_direct_messege':
946
+ return ($plural) ? __('Direct Messages' , 'inbound-pro') : __('Direct Message' , 'inbound-pro');
947
+ break;
948
+ case 'inbound_list_add':
949
+ return ($plural) ? __('Lead Added to Lists' , 'inbound-pro') : __('Lead Added to List' , 'inbound-pro');
950
+ break;
951
+ case 'sparkpost_delivery':
952
+ return ($plural) ? __('SparkPost Deliveries' , 'inbound-pro') : __('SparkPost Delivery' , 'inbound-pro');
953
+ break;
954
+ }
955
+
956
+ return apply_filters('inbound-events/event-label' , $event_name , $plural );
957
+ }
958
+
959
+ /**
960
+ * Get all possible event names
961
+ */
962
+ public static function get_event_names( $params = array() ){
963
+ global $wpdb;
964
+
965
+ $table_name = $wpdb->prefix . "inbound_events";
966
+
967
+ $query = 'SELECT DISTINCT(event_name) FROM '.$table_name;
968
+
969
+ if (isset($params['page_id']) && $params['page_id']) {
970
+ $query .= ' WHERE `page_id` = "'.$params['page_id'].'" ';
971
+ }
972
+
973
+ $query .= ' ORDER BY `event_name` DESC ';
974
  $results = $wpdb->get_results( $query , ARRAY_A );
975
 
976
  return $results;
993
 
994
  }
995
 
996
+ /**
997
+ * Get page view events given conditions
998
+ *
999
+ */
1000
+ public static function get_events_by_dates( $params ){
1001
+ global $wpdb;
1002
+
1003
+ $params['group_by'] = (isset($params['group_by'])) ? $params['group_by'] : 'event_name';
1004
+ $params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
1005
+
1006
+ $table_name = $wpdb->prefix . "inbound_events";
1007
+ $query = 'SELECT date(datetime) as date , sum(events) as events_count FROM ( ';
1008
+
1009
+ $query .= ' SELECT *, count('.$params['group_by'].') as events FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
1010
+
1011
+ if (isset($params['event_name']) && $params['event_name'] ) {
1012
+ $query .= ' AND event_name = "'.$params['event_name'].'" ';
1013
+ }
1014
+
1015
+ if (isset($params['source']) && $params['source'] ) {
1016
+ $query .= ' AND source = "'.$params['source'].'" ';
1017
+ }
1018
+
1019
+ if (isset($params['lead_id']) && $params['lead_id'] ) {
1020
+ $query .= ' AND lead_id = "'.$params['lead_id'].'" ';
1021
+ }
1022
+
1023
+ if (isset($params['start_date'])) {
1024
+ $query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
1025
+ }
1026
+
1027
+ $query .= ' GROUP BY '.$params['group_by'].' ';
1028
+
1029
+
1030
+ $query .= ') AS concat_date GROUP BY DATE(datetime)';
1031
+
1032
+ $results = $wpdb->get_results( $query , ARRAY_A );
1033
+
1034
+ return $results;
1035
+ }
1036
+
1037
  /**
1038
  * Get all cta click events related to lead ID
1039
  */
1322
  * @param datetime $start_date
1323
  * @param datetime $end_date
1324
  */
1325
+ public static function get_page_actions_count($page_id , $activity = 'any' , $start_date = null, $end_date = null ){
1326
  global $wpdb;
1327
 
1328
  $table_name = $wpdb->prefix . "inbound_events";
shared/classes/class.form.php CHANGED
@@ -551,7 +551,7 @@ if (!class_exists('Inbound_Forms')) {
551
  /* TODO remove this */
552
  ?>
553
  <script type="text/javascript">
554
- _inbound.add_action( 'form_before_submission', inbound_additional_checks, 10);
555
 
556
  function inbound_additional_checks( data ) {
557
  /* make sure event is defined */
@@ -560,14 +560,17 @@ if (!class_exists('Inbound_Forms')) {
560
  event.target = data.event;
561
  }
562
 
563
- /* added below condition for check any of checkbox checked or not by kirit dholakiya */
564
- if( jQuery('.checkbox-required')[0] && jQuery('.checkbox-required input[type=checkbox]:checked').length==0) {
565
- jQuery('.checkbox-required input[type=checkbox]:first').focus();
 
 
566
  alert("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro') ; ?> ");
567
- throw new Error('<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro') ; ?>');
 
568
  }
569
 
570
- jQuery(this).find("input").each(function(){
571
  if(!jQuery(this).prop("required")){
572
  } else if (!jQuery(this).val()) {
573
  alert("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro'); ?>");
@@ -795,6 +798,13 @@ if (!class_exists('Inbound_Forms')) {
795
  */
796
  public static function send_conversion_admin_notification($form_post_data, $form_meta_data) {
797
 
 
 
 
 
 
 
 
798
  if ($template = self::get_new_lead_email_template()) {
799
 
800
  add_filter('wp_mail_content_type', 'inbound_set_html_content_type');
@@ -909,25 +919,7 @@ if (!class_exists('Inbound_Forms')) {
909
  }
910
 
911
  /* Get Lead Email Address */
912
- $lead_email = false;
913
- foreach ($form_post_data as $key => $value) {
914
- if (preg_match('/email|e-mail/i', $key)) {
915
- $lead_email = $form_post_data[$key];
916
- }
917
- }
918
-
919
- /* Redundancy */
920
- if (!$lead_email) {
921
- if (isset($form_post_data['email'])) {
922
- $lead_email = $form_post_data['email'];
923
- } else if (isset($form_post_data['e-mail'])) {
924
- $lead_email = $form_post_data['e-mail'];
925
- } else if (isset($form_post_data['wpleads_email_address'])) {
926
- $lead_email = $form_post_data['wpleads_email_address'];
927
- } else {
928
- $lead_email = 'null map email field';
929
- }
930
- }
931
 
932
  if (!$lead_email) {
933
  return;
@@ -977,8 +969,37 @@ if (!class_exists('Inbound_Forms')) {
977
 
978
  }
979
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980
  /**
981
  * Get Email Template for New Lead Notification
 
982
  */
983
  static function get_new_lead_email_template() {
984
 
@@ -1098,7 +1119,7 @@ if (!class_exists('Inbound_Forms')) {
1098
  <w:anchorlock/>
1099
  <center style="color:#ffffff;font-family:sans-serif;font-size:13px;font-weight:bold;">' . __('View Lead', 'inbound-pro') . '</center>
1100
  </v:roundrect>
1101
- <![endif]--><a href="{{admin-url}}edit.php?post_type=wp-lead&s={{lead-email-address}}"
1102
  style="background-color:#3A9FD1;border:1px solid #7490af;border-radius:4px;color:#ffffff;display:inline-block;font-family:sans-serif;font-size:18px;font-weight:bold;line-height:40px;text-align:center;text-decoration:none;width:250px;-webkit-text-size-adjust:none;mso-hide:all;" title="' . __('View the full Lead details in WordPress', 'inbound-pro') . '">' . __('View Full Lead Details', 'inbound-pro') . '</a>
1103
  </div>
1104
  </td>
551
  /* TODO remove this */
552
  ?>
553
  <script type="text/javascript">
554
+ _inbound.add_action( 'form_before_submission', inbound_additional_checks, 9);
555
 
556
  function inbound_additional_checks( data ) {
557
  /* make sure event is defined */
560
  event.target = data.event;
561
  }
562
 
563
+ /*make sure all of this form's required checkboxes are checked*/
564
+ var checks = jQuery(event.target).find('.checkbox-required');
565
+ for(var a = 0; a < checks.length; a++){
566
+ if( checks[a] && jQuery(checks[a]).find('input[type=checkbox]:checked').length==0){
567
+ jQuery(jQuery(checks[a]).find('input')).focus();
568
  alert("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro') ; ?> ");
569
+ throw new Error("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro') ; ?>");
570
+ }
571
  }
572
 
573
+ jQuery(this).find("input").each(function(){
574
  if(!jQuery(this).prop("required")){
575
  } else if (!jQuery(this).val()) {
576
  alert("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro'); ?>");
798
  */
799
  public static function send_conversion_admin_notification($form_post_data, $form_meta_data) {
800
 
801
+ /* Get Lead Email Address */
802
+ $lead_email = self::get_email_from_post_data($form_post_data);
803
+
804
+ if (!$lead_email) {
805
+ return;
806
+ }
807
+
808
  if ($template = self::get_new_lead_email_template()) {
809
 
810
  add_filter('wp_mail_content_type', 'inbound_set_html_content_type');
919
  }
920
 
921
  /* Get Lead Email Address */
922
+ $lead_email = self::get_email_from_post_data($form_post_data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
923
 
924
  if (!$lead_email) {
925
  return;
969
 
970
  }
971
 
972
+ public static function get_email_from_post_data( $form_post_data ) {
973
+ /* Get Lead Email Address */
974
+ $lead_email = '';
975
+ foreach ($form_post_data as $key => $value) {
976
+ if (preg_match('/email|e-mail/i', $key)) {
977
+ $lead_email = $form_post_data[$key];
978
+ }
979
+ }
980
+
981
+ /* Redundancy */
982
+ if (!$lead_email) {
983
+ if (isset($form_post_data['email'])) {
984
+ $lead_email = $form_post_data['email'];
985
+ } else if (isset($form_post_data['e-mail'])) {
986
+ $lead_email = $form_post_data['e-mail'];
987
+ } else if (isset($form_post_data['wpleads_email_address'])) {
988
+ $lead_email = $form_post_data['wpleads_email_address'];
989
+ }
990
+ }
991
+
992
+ $lead_email = str_replace('%40' , '@' , $lead_email);
993
+
994
+ if ($lead_email == 'false') {
995
+ $lead_email = false;
996
+ }
997
+ return $lead_email;
998
+ }
999
+
1000
  /**
1001
  * Get Email Template for New Lead Notification
1002
+ *
1003
  */
1004
  static function get_new_lead_email_template() {
1005
 
1119
  <w:anchorlock/>
1120
  <center style="color:#ffffff;font-family:sans-serif;font-size:13px;font-weight:bold;">' . __('View Lead', 'inbound-pro') . '</center>
1121
  </v:roundrect>
1122
+ <![endif]--><a href="{{admin-url}}edit.php?post_status=all&post_type=wp-lead&s={{lead-email-address}}"
1123
  style="background-color:#3A9FD1;border:1px solid #7490af;border-radius:4px;color:#ffffff;display:inline-block;font-family:sans-serif;font-size:18px;font-weight:bold;line-height:40px;text-align:center;text-decoration:none;width:250px;-webkit-text-size-adjust:none;mso-hide:all;" title="' . __('View the full Lead details in WordPress', 'inbound-pro') . '">' . __('View Full Lead Details', 'inbound-pro') . '</a>
1124
  </div>
1125
  </td>
shared/classes/class.inbound-api.php CHANGED
@@ -891,7 +891,7 @@ if (!class_exists('Inbound_API')) {
891
  * @global OBJECT $Inbound_Leads Inbound_Leads
892
  */
893
  public static function leads_add( $params = array() ) {
894
- global $Inbound_Leads;
895
 
896
  /* Merge POST & GET & @param vars into array variable */
897
  $params = array_merge( $params, $_REQUEST );
@@ -945,7 +945,7 @@ if (!class_exists('Inbound_API')) {
945
 
946
  if (isset($params['lead_lists']) && self::validate_parameter( $params['lead_lists'], 'lead_lists', 'array' ) ) {
947
  foreach ( $params['lead_lists'] as $list_id ) {
948
- $Inbound_Leads->add_lead_to_list( $lead_id, $list_id );
949
  }
950
  }
951
 
@@ -956,7 +956,7 @@ if (!class_exists('Inbound_API')) {
956
 
957
  if (isset($params['tags']) && self::validate_parameter( $params['tags'], 'tags', 'array' ) ) {
958
  foreach ( $params['tags'] as $tag ) {
959
- $Inbound_Leads->add_tag_to_lead( $lead_id, $tag );
960
  }
961
  }
962
 
@@ -970,7 +970,7 @@ if (!class_exists('Inbound_API')) {
970
  * @global OBJECT $Inbound_Leads Inbound_Leads
971
  */
972
  public static function leads_update( $params = array() ) {
973
- global $Inbound_Leads;
974
 
975
  /* Merge POST & GET & @param vars into array variable */
976
  $params = array_merge( $params, $_REQUEST );
@@ -1026,7 +1026,7 @@ if (!class_exists('Inbound_API')) {
1026
 
1027
  /* Loop through list ids and add */
1028
  foreach ($params['add_to_lists'] as $list_id ) {
1029
- $Inbound_Leads->add_lead_to_list( $params['ID'], $list_id );
1030
  }
1031
  }
1032
 
@@ -1038,7 +1038,7 @@ if (!class_exists('Inbound_API')) {
1038
 
1039
  /* Loop through list ids and remove */
1040
  foreach ($params['remove_from_lists'] as $list_id ) {
1041
- $Inbound_Leads->remove_lead_from_list( $params['ID'], $list_id );
1042
  }
1043
  }
1044
 
@@ -1050,7 +1050,7 @@ if (!class_exists('Inbound_API')) {
1050
 
1051
  /* Loop through tags and add */
1052
  foreach ($params['add_tags'] as $tag ) {
1053
- $Inbound_Leads->add_tag_to_lead( $params['ID'], $tag );
1054
  }
1055
  }
1056
 
@@ -1062,7 +1062,7 @@ if (!class_exists('Inbound_API')) {
1062
 
1063
  /* Loop through tags and remove */
1064
  foreach ($params['remove_tags'] as $tag ) {
1065
- $Inbound_Leads->remove_tag_from_lead( $params['ID'], $tag );
1066
  }
1067
  }
1068
 
@@ -1139,9 +1139,9 @@ if (!class_exists('Inbound_API')) {
1139
  * @global OBJECT $Inbound_Leads Inbound_Leads
1140
  */
1141
  public static function lists_get() {
1142
- global $Inbound_Leads;
1143
 
1144
- return $Inbound_Leads->get_lead_lists_as_array();
 
1145
  }
1146
 
1147
  /**
@@ -1149,7 +1149,7 @@ if (!class_exists('Inbound_API')) {
1149
  * @global OBJECT $Inbound_Leads class Inbound_Leads
1150
  */
1151
  public static function lists_add( $params = array() ) {
1152
- global $Inbound_Leads;
1153
 
1154
  /* Merge POST & GET & @param vars into array variable */
1155
  $params = array_merge( $params, $_REQUEST );
@@ -1170,7 +1170,7 @@ if (!class_exists('Inbound_API')) {
1170
  $params['parent'] = '';
1171
  }
1172
 
1173
- return $Inbound_Leads->create_lead_list( $params );
1174
  }
1175
 
1176
  /**
@@ -1179,7 +1179,7 @@ if (!class_exists('Inbound_API')) {
1179
  * @return ARRAY
1180
  */
1181
  public static function lists_update( $params = array() ) {
1182
- global $Inbound_Leads;
1183
 
1184
  /* Merge POST & GET & @param vars into array variable */
1185
  $params = array_merge( $params, $_REQUEST );
@@ -1214,14 +1214,14 @@ if (!class_exists('Inbound_API')) {
1214
  $params['parent'] = 0;
1215
  }
1216
 
1217
- return $Inbound_Leads->update_lead_list( $params );
1218
  }
1219
 
1220
  /**
1221
  * Deletes a lead list
1222
  */
1223
  public static function lists_delete( $params = array() ) {
1224
- global $Inbound_Leads;
1225
 
1226
  /* Merge POST & GET & @param vars into array variable */
1227
  $params = array_merge( $params, $_REQUEST );
@@ -1235,7 +1235,7 @@ if (!class_exists('Inbound_API')) {
1235
  self::output( 401 );
1236
  }
1237
 
1238
- return $Inbound_Leads->delete_lead_list( $params['id'] );
1239
  }
1240
 
1241
  /**
@@ -1345,6 +1345,7 @@ if (!class_exists('Inbound_API')) {
1345
  return array( 'url' => $tracked_link );
1346
  }
1347
 
 
1348
  /**
1349
  * Listens for the tracked links and update lead event profile
1350
  *
@@ -1353,7 +1354,7 @@ if (!class_exists('Inbound_API')) {
1353
  * @return void
1354
  */
1355
  public static function process_tracked_link() {
1356
- global $wp_query, $wpdb, $Inbound_Leads;
1357
 
1358
  /* Check for inbound-api var. Get out if not present */
1359
  if ( ! isset( $wp_query->query_vars[ self::$tracking_endpoint ] ) && ( isset($_SERVER["REQUEST_URI"]) && !strstr($_SERVER["REQUEST_URI"], self::$tracking_endpoint.'/' ) )) {
@@ -1361,7 +1362,8 @@ if (!class_exists('Inbound_API')) {
1361
  }
1362
 
1363
  /* discover token */
1364
- $token = ( isset($wp_query->query_vars[ self::$tracking_endpoint ]) ) ? $wp_query->query_vars[ self::$tracking_endpoint ] : str_replace( '/'.self::$tracking_endpoint.'/', '', $_SERVER["REQUEST_URI"] );
 
1365
 
1366
  /* Pull record from database */
1367
  $table_name = $wpdb->prefix . "inbound_tracked_links";
@@ -1386,7 +1388,7 @@ if (!class_exists('Inbound_API')) {
1386
  /* Add lead to lists */
1387
  if (isset($args['add_lists']) && self::validate_parameter($args['add_lists'], 'add_lists', 'array')) {
1388
  foreach ($args['add_lists'] as $list_id) {
1389
- $Inbound_Leads->add_lead_to_list($args['id'], $list_id);
1390
  }
1391
  }
1392
 
@@ -1394,26 +1396,31 @@ if (!class_exists('Inbound_API')) {
1394
  if (isset($args['remove_lists']) && self::validate_parameter($args['remove_lists'], 'remove_lists', 'array')) {
1395
 
1396
  foreach ($args['remove_lists'] as $list_id) {
1397
- $Inbound_Leads->remove_lead_from_list($args['id'], $list_id);
1398
  }
1399
  }
1400
 
1401
  /* Add tag to leads */
1402
  if (isset($args['add_tags']) && self::validate_parameter($args['add_tags'], 'add_tags', 'array')) {
1403
  foreach ($args['add_tags'] as $tag) {
1404
- $Inbound_Leads->add_tag_to_lead($args['id'], $tag);
1405
  }
1406
  }
1407
 
1408
  /* Remvoe tags from leads */
1409
  if (isset($args['remove_tags']) && self::validate_parameter($args['remove_tags'], 'remove_tags', 'array')) {
1410
  foreach ($args['remove_tags'] as $tag) {
1411
- $Inbound_Leads->remove_tag_from_lead($args['id'], $tag);
1412
  }
1413
  }
1414
 
1415
  }
1416
 
 
 
 
 
 
1417
  /* Process tracked link extras */
1418
  do_action('inbound_track_link', $args);
1419
 
@@ -1423,7 +1430,7 @@ if (!class_exists('Inbound_API')) {
1423
  }
1424
  }
1425
 
1426
- $GLOBALS['Inbound_API'] = new Inbound_API();
1427
 
1428
  }
1429
 
891
  * @global OBJECT $Inbound_Leads Inbound_Leads
892
  */
893
  public static function leads_add( $params = array() ) {
894
+
895
 
896
  /* Merge POST & GET & @param vars into array variable */
897
  $params = array_merge( $params, $_REQUEST );
945
 
946
  if (isset($params['lead_lists']) && self::validate_parameter( $params['lead_lists'], 'lead_lists', 'array' ) ) {
947
  foreach ( $params['lead_lists'] as $list_id ) {
948
+ Inbound_Leads::add_lead_to_list( $lead_id, $list_id );
949
  }
950
  }
951
 
956
 
957
  if (isset($params['tags']) && self::validate_parameter( $params['tags'], 'tags', 'array' ) ) {
958
  foreach ( $params['tags'] as $tag ) {
959
+ Inbound_Leads::add_tag_to_lead( $lead_id, $tag );
960
  }
961
  }
962
 
970
  * @global OBJECT $Inbound_Leads Inbound_Leads
971
  */
972
  public static function leads_update( $params = array() ) {
973
+
974
 
975
  /* Merge POST & GET & @param vars into array variable */
976
  $params = array_merge( $params, $_REQUEST );
1026
 
1027
  /* Loop through list ids and add */
1028
  foreach ($params['add_to_lists'] as $list_id ) {
1029
+ Inbound_Leads::add_lead_to_list( $params['ID'], $list_id );
1030
  }
1031
  }
1032
 
1038
 
1039
  /* Loop through list ids and remove */
1040
  foreach ($params['remove_from_lists'] as $list_id ) {
1041
+ Inbound_Leads::remove_lead_from_list( $params['ID'], $list_id );
1042
  }
1043
  }
1044
 
1050
 
1051
  /* Loop through tags and add */
1052
  foreach ($params['add_tags'] as $tag ) {
1053
+ Inbound_Leads::add_tag_to_lead( $params['ID'], $tag );
1054
  }
1055
  }
1056
 
1062
 
1063
  /* Loop through tags and remove */
1064
  foreach ($params['remove_tags'] as $tag ) {
1065
+ Inbound_Leads::remove_tag_from_lead( $params['ID'], $tag );
1066
  }
1067
  }
1068
 
1139
  * @global OBJECT $Inbound_Leads Inbound_Leads
1140
  */
1141
  public static function lists_get() {
 
1142
 
1143
+
1144
+ return Inbound_Leads::get_lead_lists_as_array();
1145
  }
1146
 
1147
  /**
1149
  * @global OBJECT $Inbound_Leads class Inbound_Leads
1150
  */
1151
  public static function lists_add( $params = array() ) {
1152
+
1153
 
1154
  /* Merge POST & GET & @param vars into array variable */
1155
  $params = array_merge( $params, $_REQUEST );
1170
  $params['parent'] = '';
1171
  }
1172
 
1173
+ return Inbound_Leads::create_lead_list( $params );
1174
  }
1175
 
1176
  /**
1179
  * @return ARRAY
1180
  */
1181
  public static function lists_update( $params = array() ) {
1182
+
1183
 
1184
  /* Merge POST & GET & @param vars into array variable */
1185
  $params = array_merge( $params, $_REQUEST );
1214
  $params['parent'] = 0;
1215
  }
1216
 
1217
+ return Inbound_Leads::update_lead_list( $params );
1218
  }
1219
 
1220
  /**
1221
  * Deletes a lead list
1222
  */
1223
  public static function lists_delete( $params = array() ) {
1224
+
1225
 
1226
  /* Merge POST & GET & @param vars into array variable */
1227
  $params = array_merge( $params, $_REQUEST );
1235
  self::output( 401 );
1236
  }
1237
 
1238
+ return Inbound_Leads::delete_lead_list( $params['id'] );
1239
  }
1240
 
1241
  /**
1345
  return array( 'url' => $tracked_link );
1346
  }
1347
 
1348
+
1349
  /**
1350
  * Listens for the tracked links and update lead event profile
1351
  *
1354
  * @return void
1355
  */
1356
  public static function process_tracked_link() {
1357
+ global $wp_query, $wpdb;
1358
 
1359
  /* Check for inbound-api var. Get out if not present */
1360
  if ( ! isset( $wp_query->query_vars[ self::$tracking_endpoint ] ) && ( isset($_SERVER["REQUEST_URI"]) && !strstr($_SERVER["REQUEST_URI"], self::$tracking_endpoint.'/' ) )) {
1362
  }
1363
 
1364
  /* discover token */
1365
+ $parts = explode( self::$tracking_endpoint.'/', $_SERVER["REQUEST_URI"] );
1366
+ $token = ( isset($wp_query->query_vars[ self::$tracking_endpoint ]) ) ? $wp_query->query_vars[ self::$tracking_endpoint ] : $parts[1] ;
1367
 
1368
  /* Pull record from database */
1369
  $table_name = $wpdb->prefix . "inbound_tracked_links";
1388
  /* Add lead to lists */
1389
  if (isset($args['add_lists']) && self::validate_parameter($args['add_lists'], 'add_lists', 'array')) {
1390
  foreach ($args['add_lists'] as $list_id) {
1391
+ Inbound_Leads::add_lead_to_list($args['id'], $list_id);
1392
  }
1393
  }
1394
 
1396
  if (isset($args['remove_lists']) && self::validate_parameter($args['remove_lists'], 'remove_lists', 'array')) {
1397
 
1398
  foreach ($args['remove_lists'] as $list_id) {
1399
+ Inbound_Leads::remove_lead_from_list($args['id'], $list_id);
1400
  }
1401
  }
1402
 
1403
  /* Add tag to leads */
1404
  if (isset($args['add_tags']) && self::validate_parameter($args['add_tags'], 'add_tags', 'array')) {
1405
  foreach ($args['add_tags'] as $tag) {
1406
+ Inbound_Leads::add_tag_to_lead($args['id'], $tag);
1407
  }
1408
  }
1409
 
1410
  /* Remvoe tags from leads */
1411
  if (isset($args['remove_tags']) && self::validate_parameter($args['remove_tags'], 'remove_tags', 'array')) {
1412
  foreach ($args['remove_tags'] as $tag) {
1413
+ Inbound_Leads::remove_tag_from_lead($args['id'], $tag);
1414
  }
1415
  }
1416
 
1417
  }
1418
 
1419
+ /* check for known bots and ignore */
1420
+ if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) {
1421
+ return;
1422
+ }
1423
+
1424
  /* Process tracked link extras */
1425
  do_action('inbound_track_link', $args);
1426
 
1430
  }
1431
  }
1432
 
1433
+ new Inbound_API();
1434
 
1435
  }
1436
 
shared/classes/class.lead-storage.php CHANGED
@@ -128,8 +128,56 @@ if (!class_exists('LeadStorage')) {
128
 
129
  /* Add Leads to List on creation */
130
  if(!empty($lead['lead_lists']) && is_array($lead['lead_lists'])){
131
- global $Inbound_Leads;
132
- $Inbound_Leads->add_lead_to_list($lead['id'], $lead['lead_lists']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
  /* store lead list cookie */
135
  if (class_exists('Leads_Tracking')) {
@@ -168,11 +216,7 @@ if (!class_exists('LeadStorage')) {
168
  /* Store Legacy Conversion Data to LANDING PAGE/CTA DATA */
169
  if (isset($lead['page_id']) && $lead['page_id'] ) {
170
  self::store_conversion_stats($lead);
171
- }
172
 
173
- /* Store Lead Source */
174
- if ( isset($lead['source']) ) {
175
- self::store_referral_data($lead);
176
  }
177
 
178
  /* Store URL Params */
@@ -184,11 +228,6 @@ if (!class_exists('LeadStorage')) {
184
  }
185
  }
186
 
187
- /* Store Conversion Data to LANDING PAGE/CTA DATA */
188
- if (isset($lead['page_id'])) {
189
- self::store_conversion_stats($lead);
190
- }
191
-
192
  /* Store IP addresss & Store GEO Data */
193
  if ($lead['ip_address']) {
194
  update_post_meta( $lead['id'], 'wpleads_ip_address', $lead['ip_address'] );
@@ -388,48 +427,6 @@ if (!class_exists('LeadStorage')) {
388
  update_post_meta($lead['page_id'], '_inbound_conversion_data', $page_conversion_data);
389
  }
390
 
391
- /**
392
- * Stores referral data
393
- */
394
- static function store_referral_data($lead) {
395
- $referral_data = get_post_meta( $lead['id'], 'wpleads_referral_data', TRUE );
396
-
397
- /* Parse referral for additional data */
398
- include_once( INBOUNDNOW_SHARED_PATH. 'assets/includes/Snowplow/RefererParser/INBOUND_Parser.php');
399
- include_once( INBOUNDNOW_SHARED_PATH .'assets/includes/Snowplow/RefererParser/INBOUND_Referer.php');
400
- include_once(INBOUNDNOW_SHARED_PATH . 'assets/includes/Snowplow/RefererParser/INBOUND_Medium.php');
401
-
402
- /* intialized the parser class */
403
- $parser = new INBOUND_Parser();
404
- /*$array = array('http://google.com', 'http://twitter.com', 'http://tumblr.com?query=test', ''); */
405
- $referer = $parser->parse($lead['source']);
406
-
407
- if ( $referer->isKnown() ) {
408
- $ref_type = $referer->getMedium();
409
-
410
- } else {
411
- /* check if ref exists */
412
- $ref_type = ($lead['source'] === "Direct Traffic") ? 'Direct Traffic' : 'referral';
413
- }
414
-
415
- $referral_data = json_decode($referral_data,true);
416
- if (is_array($referral_data)){
417
- $r_count = count($referral_data) + 1;
418
- $referral_data[$r_count]['source'] = $lead['source'];
419
- $referral_data[$r_count]['type'] = $ref_type;
420
- $referral_data[$r_count]['datetime'] = $lead['wordpress_date_time'];
421
- } else {
422
- $referral_data[1]['source'] = $lead['source'];
423
- $referral_data[1]['type'] = $ref_type;
424
- $referral_data[1]['datetime'] = $lead['wordpress_date_time'];
425
- $referral_data[1]['original_source'] = 1;
426
- }
427
-
428
- $lead['referral_data'] = json_encode($referral_data);
429
- /*echo $lead['referral_data']; exit; */
430
- update_post_meta($lead['id'], 'wpleads_referral_data', $lead['referral_data']); /* Store referral object */
431
- update_post_meta($lead['id'], 'wpleads_referral_type', $ref_type); /* Store referral object */
432
- }
433
 
434
  /**
435
  * Loop trough lead_data array and update post meta
128
 
129
  /* Add Leads to List on creation */
130
  if(!empty($lead['lead_lists']) && is_array($lead['lead_lists'])){
131
+ $double_optin_lists = array();
132
+ $normal_lists = array();
133
+
134
+ /*differentiate between double optin lists and lists that don't require double optin*/
135
+ foreach($lead['lead_lists'] as $list_id){
136
+ $list_meta_settings = get_term_meta($list_id, 'wplead_lead_list_meta_settings', true);
137
+ if(isset($list_meta_settings['double_optin']) && $list_meta_settings['double_optin'] == '1'){
138
+ $double_optin_lists[] = $list_id;
139
+ }else{
140
+ $normal_lists[] = $list_id;
141
+ }
142
+ }
143
+
144
+ /*remove any groups that the lead is already on from the double optin groups*/
145
+ if(array_filter($double_optin_lists)){
146
+ $existing_lists = wp_get_post_terms( $lead['id'], 'wplead_list_category');
147
+ foreach($existing_lists as $existing_list){
148
+ if(in_array($existing_list->term_id, $double_optin_lists)){
149
+ $index = array_search($existing_list->term_id, $double_optin_lists);
150
+ unset($double_optin_lists[$index]);
151
+ }
152
+ }
153
+ }
154
+
155
+ if(array_filter($double_optin_lists)){
156
+ /*get the double optin waiting list id*/
157
+ if(!defined('INBOUND_PRO_CURRENT_VERSION')){
158
+ $double_optin_list_id = get_option('list-double-optin-list-id', '');
159
+ }else{
160
+ $settings = Inbound_Options_API::get_option('inbound-pro', 'settings', array());
161
+ $double_optin_list_id = $settings['leads']['list-double-optin-list-id'];
162
+ }
163
+
164
+ /*if there is a list to store the leads in*/
165
+ if($double_optin_list_id){
166
+ /*store the list ids that need confirmation*/
167
+ update_post_meta($lead['id'], 'double_optin_lists', $double_optin_lists);
168
+
169
+ /*change the lead status to waiting for double optin*/
170
+ update_post_meta( $lead['id'] , 'wp_lead_status' , 'double-optin');
171
+
172
+
173
+ /*add the lead to the double optin confirmation list*/
174
+ Inbound_Leads::add_lead_to_list($lead['id'], $double_optin_list_id);
175
+ Inbound_List_Double_Optin::send_double_optin_confirmation($lead);
176
+ }
177
+ }
178
+
179
+ /*add the lead to all lists that don't require double optin*/
180
+ Inbound_Leads::add_lead_to_list($lead['id'], $normal_lists);
181
 
182
  /* store lead list cookie */
183
  if (class_exists('Leads_Tracking')) {
216
  /* Store Legacy Conversion Data to LANDING PAGE/CTA DATA */
217
  if (isset($lead['page_id']) && $lead['page_id'] ) {
218
  self::store_conversion_stats($lead);
 
219
 
 
 
 
220
  }
221
 
222
  /* Store URL Params */
228
  }
229
  }
230
 
 
 
 
 
 
231
  /* Store IP addresss & Store GEO Data */
232
  if ($lead['ip_address']) {
233
  update_post_meta( $lead['id'], 'wpleads_ip_address', $lead['ip_address'] );
427
  update_post_meta($lead['page_id'], '_inbound_conversion_data', $page_conversion_data);
428
  }
429
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
 
431
  /**
432
  * Loop trough lead_data array and update post meta
shared/classes/class.list-double-optin.php ADDED
@@ -0,0 +1,590 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!class_exists('Inbound_List_Double_Optin')) {
4
+
5
+ class Inbound_List_Double_Optin {
6
+
7
+ function __construct() {
8
+ self::add_hooks();
9
+ }
10
+
11
+ public static function add_hooks() {
12
+
13
+ add_action('admin_enqueue_scripts' , array(__CLASS__ , 'enqueue_scripts'));
14
+
15
+ /* Modify the Edit lead list page */
16
+ add_action('wplead_list_category_edit_form_fields', array(__CLASS__, 'add_list_settings'));
17
+
18
+ /**/
19
+ add_action('add_lead_to_lead_list', array(__CLASS__, 'remove_from_double_optin_list'), 10, 2);
20
+
21
+ /* Add the setting saver and getter */
22
+ add_action('wplead_list_category_edit_form', array(__CLASS__, 'lead_list_save_settings'));
23
+
24
+ /* Save the settings to the term meta */
25
+ add_action('wp_ajax_lead_list_save_settings', array(__CLASS__, 'ajax_lead_list_save_settings'));
26
+ }
27
+
28
+
29
+ /**
30
+ *
31
+ */
32
+ public static function enqueue_scripts() {
33
+ $screen = get_current_screen();
34
+
35
+ if (!isset($screen) || $screen->id !='edit-wplead_list_category') {
36
+ return;
37
+ }
38
+
39
+ wp_enqueue_script('jquery');
40
+ wp_enqueue_script('thickbox');
41
+ wp_enqueue_style('thickbox');
42
+ wp_enqueue_script('media-upload');
43
+
44
+ }
45
+
46
+ public static function get_default_email_content($settings) {
47
+
48
+ if ($settings['logo']) {
49
+ $logo_html = '<tr style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
50
+ <td class="logo" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; vertical-align: top; text-align: center;">
51
+ <img src="'.$settings['logo'].'" width="" style="max-width:500px;padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; max-width: 100%; margin: 30px 0;">
52
+ </td>
53
+ </tr>';
54
+ } else {
55
+ $logo_html = "";
56
+ }
57
+
58
+ $html = '<!DOCTYPE html>
59
+ <html >
60
+ <head>
61
+ <meta charset="UTF-8">
62
+ <meta name="viewport" content="width=device-width" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
63
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
64
+ <title style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
65
+ ' . $settings['email_subject'] . '
66
+ </title>
67
+ </head>
68
+
69
+ <body style="margin: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; padding: 0; border-top: 2px solid #26334D; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; background-color: white; height: 100%; line-height: 1.6; width: 100%;">
70
+ <table class="body-wrap" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; width: 100%; background-color: white;">
71
+ <tr style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
72
+ <td style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; vertical-align: top;"></td>
73
+ <td width="400" class="container" style="font-size: 14px; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; padding: 0; line-height: 22px; vertical-align: top; margin: 0 auto; display: block; max-width: 400px; clear: both;">
74
+ <div class="content" style="padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; margin: 0 auto; max-width: 400px; display: block;">
75
+ <table width="100%" cellpadding="0" cellspacing="0" class="main" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
76
+ '. $logo_html .'
77
+ <tr style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
78
+ <td class="content-wrap" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; vertical-align: top;">
79
+ <table width="100%" cellpadding="0" cellspacing="0" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
80
+ <tr style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
81
+ <td class="content-block" style="font-size: 14px; margin: 0; box-sizing: border-box; line-height: 22px; vertical-align: top; color: #8F9BB3; padding: 20px 0; font-family: \'Helvetica Neue\', Helvetica, Arial, \'Lucida Grande\', sans-serif; background: #ffffff; border-radius: 3px; box-shadow: 0 0 0 1px #D8DDE2;">
82
+ <p style="margin: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; font-weight: normal; margin-bottom: 0; padding: 0 20px;">
83
+ '.$settings['message'].'</p>
84
+ </td>
85
+ </tr>
86
+ <tr style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
87
+ <td class="action" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; vertical-align: top; padding-top: 20px;">
88
+ <a href="[inbound-list-double-optin-link]" style="line-height: 22px; margin: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #ffffff; font-size: 18px; padding: 20px; display: block; font-weight: bold; background: #2980b9; border-radius: 3px; text-decoration: none; text-align: center;">'.$settings['button_text'].'</a>
89
+ </td>
90
+ </tr>
91
+ </table>
92
+ </td>
93
+ </tr>
94
+ </table>
95
+ </div>
96
+ </td>
97
+ </tr>
98
+ </table>
99
+ <div class="footer" style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; width: 100%; clear: both;">
100
+ <table width="100%" class="footer-table" style="margin: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px; padding: 40px 20px; background: white;">
101
+ <tr style="margin: 0; padding: 0; box-sizing: border-box; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; color: #8F9BB3; font-size: 14px; line-height: 22px;">
102
+ <td class="aligncenter content-block" style="margin: 0; box-sizing: border-box; line-height: 22px; vertical-align: top; padding: 20px 0; font-family: \'Helvetica Neue\', Helvetica, Arial, \'Lucida Grande\', sans-serif; color: #8F9BB3; text-align: center; font-size: 12px;">
103
+ '.html_entity_decode($settings['footer_text']).'
104
+ </td>
105
+ </tr>
106
+ </table>
107
+ </div>
108
+ </body>
109
+ </html>
110
+ ';
111
+
112
+ return $html;
113
+ }
114
+
115
+ /**
116
+ * Gets the list id of the double optin waiting list
117
+ * @return mixed
118
+ */
119
+ public static function get_double_optin_waiting_list() {
120
+ /*get the double optin waiting list id*/
121
+ if (!defined('INBOUND_PRO_CURRENT_VERSION')) {
122
+ $double_optin_list_id = get_option('list-double-optin-list-id', '');
123
+ } else {
124
+ $settings = Inbound_Options_API::get_option('inbound-pro', 'settings', array());
125
+ $double_optin_list_id = $settings['leads']['list-double-optin-list-id'];
126
+ }
127
+
128
+ return $double_optin_list_id;
129
+ }
130
+
131
+ /**
132
+ * Saves the list id of the double optin waiting list
133
+ * @return mixed
134
+ */
135
+ public static function save_double_optin_waiting_list() {
136
+ /*get the double optin waiting list id*/
137
+ if (!defined('INBOUND_PRO_CURRENT_VERSION')) {
138
+ update_option('list-double-optin-list-id', $term_id['term_id']);
139
+ } else {
140
+ $settings = Inbound_Options_API::get_option('inbound-pro', 'settings');
141
+ $settings['leads']['list-double-optin-list-id'] = $term_id['term_id'];
142
+ Inbound_Options_API::update_option('inbound-pro', 'settings', $settings);
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Saves form options to the term meta
148
+ */
149
+ public static function ajax_lead_list_save_settings(){
150
+ $data = stripslashes_deep($_POST['data']);
151
+ $cleaned = array();
152
+ foreach($data as $key => $value){
153
+ $cleaned[sanitize_text_field($key)] = sanitize_text_field($value);
154
+ }
155
+
156
+ /*get the existing stored settings*/
157
+ $meta = get_term_meta((int)$_POST['id'], 'wplead_lead_list_meta_settings', true);
158
+
159
+ /**if the settings aren't empty, add each cleaned setting to the settings**/
160
+ if(!empty($meta)){
161
+ foreach($cleaned as $setting_name => $setting_value){
162
+ $meta[$setting_name] = $setting_value;
163
+ }
164
+ }else{
165
+ /*if the settings are empty, just push the cleaned data*/
166
+ $meta = $cleaned;
167
+ }
168
+
169
+ update_term_meta((int)$_POST['id'], 'wplead_lead_list_meta_settings', $meta);
170
+
171
+ echo json_encode(__('Settings Updated!', 'inbound-pro'));
172
+
173
+ die();
174
+ }
175
+
176
+ /**
177
+ * Gets the values of all inboundnow-lead-list-option class inputs, and sends them to ajax_lead_list_save_settings for saving.
178
+ * The element attribute "name" is the key for the settings.
179
+ */
180
+ public static function lead_list_save_settings($list){
181
+ ?>
182
+ <script>
183
+ jQuery(document).ready(function(){
184
+ jQuery('input#submit').on('click', function(){
185
+ var settingData = {};
186
+ var id = "<?php echo $list->term_id; ?>";
187
+ /*get the value of all inboundnow lead list options*/
188
+ jQuery('.double-optin-setting').each(function(){
189
+ settingData[jQuery(this).attr("name")] = jQuery(this).val();
190
+ });
191
+
192
+ jQuery.ajax({
193
+ type: 'POST',
194
+ url: ajaxurl,
195
+ data: {
196
+ action: 'lead_list_save_settings',
197
+ id: id,
198
+ data: settingData,
199
+ },
200
+ success: function(response){
201
+ console.log(JSON.parse(response));
202
+ },
203
+ });
204
+
205
+ });
206
+ });
207
+ </script>
208
+ <?php
209
+ }
210
+
211
+
212
+ /**
213
+ * @param $list
214
+ */
215
+ public static function add_list_settings($list) {
216
+
217
+ /* first let's make sure this is not our list for storing unconfirmed leads */
218
+ $double_optin_list_id = self::get_double_optin_waiting_list();
219
+
220
+ if ($list->term_id == $double_optin_list_id) {
221
+ return;
222
+ }
223
+
224
+ /* get settings */
225
+ $settings = get_term_meta($list->term_id, 'wplead_lead_list_meta_settings', true);
226
+ $settings['double_optin'] = (isset($settings['double_optin'])) ? $settings['double_optin'] : 0;
227
+ $settings['double_optin_email_template'] = (isset($settings['double_optin_email_template'])) ? $settings['double_optin_email_template'] : __('Please confirm your subscription' , 'inbound-pro' );
228
+ $settings['double_optin_email_confirmation_logo'] = (isset($settings['double_optin_email_confirmation_logo'])) ? $settings['double_optin_email_confirmation_logo'] : '';
229
+ $settings['double_optin_email_confirmation_subject'] = (isset($settings['double_optin_email_confirmation_subject'])) ? $settings['double_optin_email_confirmation_subject'] : __('Please confirm your subscription' , 'inbound-pro' );
230
+ $settings['double_optin_email_confirmation_message'] = (isset($settings['double_optin_email_confirmation_message'])) ? $settings['double_optin_email_confirmation_message'] : __('To activate your subscription, please confirm your email address. If you received this by mistake, please disregard this email.' , 'inbound-pro' );
231
+ $settings['double_optin_email_confirmation_button_text'] = (isset($settings['double_optin_email_confirmation_button_text'])) ? $settings['double_optin_email_confirmation_button_text'] : __('Confirm email address' , 'inbound-pro' );
232
+ $settings['double_optin_email_confirmation_footer_text'] = (isset($settings['double_optin_email_confirmation_footer_text'])) ? $settings['double_optin_email_confirmation_footer_text'] : sprintf( __('Powered by %sInbound Now%s' , 'inbound-pro' ) , '<a href="http://www.inboundnow.com">' , '</a>' );
233
+
234
+ /* get email templates */
235
+ $emails = array();
236
+ if (defined('INBOUND_PRO_CURRENT_VERSION')) {
237
+
238
+ if(class_exists('Inbound_Mailer_Post_Type')){
239
+ $emails = Inbound_Mailer_Post_Type::get_automation_emails_as('ARRAY');
240
+ }
241
+
242
+ $emails = ($emails) ? $emails : array(__('No Automation emails detected. ', 'inbound-pro'));
243
+ }
244
+ ?>
245
+ <tr class="form-field">
246
+ <th valign="top" scope="row">
247
+ <label><?php _e('Double Opt-in' , 'inbound-pro' ); ?></label>
248
+ </th>
249
+ <td>
250
+ <select id="double_optin_toggle" class="double-optin-setting" name="double_optin" title="<?php _e('Enable list Double Opt In to send leads an email requesting consent to being added to a list.', 'inbound-pro'); ?>">
251
+ <option value="0" <?php selected($settings['double_optin'], 0); ?> ><?php _e('Off' , 'inbound-pro'); ?></option>
252
+ <option value="1" <?php selected($settings['double_optin'], 1); ?> ><?php _e('On' , 'inbound-pro'); ?></option>
253
+ </select>
254
+ </td>
255
+ </tr>
256
+ <tr class="form-field double-optin-enabled " id="double-optin-email-template">
257
+ <th valign="top" scope="row">
258
+ <label><?php _e('Select Email Template', 'inbound-pro'); ?></label>
259
+ </th>
260
+ <td>
261
+ <select name="double_optin_email_template" id="double_optin_email_template" class="double-optin-setting" >
262
+ <option value='default-email-template' <?php selected($settings['double_optin_email_template'], 'default-email-template'); ?>>
263
+ <?php _e('Use the default email templates.', 'inbound-pro'); ?>
264
+ </option>
265
+ <?php
266
+ foreach ($emails as $id => $label) {
267
+ echo '<option value="' . $id . '" '.selected($settings['double_optin_email_template'], $id) .'>' . $label . '</option>';
268
+ }
269
+ ?>
270
+ </select>
271
+ </td>
272
+ </tr>
273
+ <tr class="form-field double-optin-enabled default-email-setting" id="">
274
+ <th valign="top" scope="row">
275
+ <label> <?php _e( 'Email Subject' , 'inbound-pro' ); ?></label>
276
+ </th>
277
+ <td>
278
+ <input type="text" name="double_optin_email_confirmation_subject" size="30" id="double_optin_email_confirmation_subject" class="double-optin-setting" autocomplete="off" value="<?php echo $settings['double_optin_email_confirmation_subject']; ?>">
279
+ </td>
280
+ </tr>
281
+ <tr class="form-field double-optin-enabled default-email-setting" id="">
282
+ <th valign="top" scope="row">
283
+ <label><?php _e( 'Email Logo' , 'inbound-pro' ); ?></label>
284
+ </th>
285
+ <td>
286
+ <input type="text" id="double_optin_email_confirmation_logo" name="double_optin_email_confirmation_logo" value="<?php echo esc_url( $settings['double_optin_email_confirmation_logo'] ); ?>" class="double-optin-setting" />
287
+ <input id="double_optin_email_confirmation_logo_button" type="button" class="button" value="<?php _e( 'Upload Logo', 'inbound-pro' ); ?>" />
288
+ </td>
289
+ </tr>
290
+ <tr class="form-field double-optin-enabled default-email-setting" id="">
291
+ <th valign="top" scope="row">
292
+ <label><?php _e( 'Email Message' , 'inbound-pro' ); ?></label>
293
+ </th>
294
+ <td>
295
+ <textarea name="double_optin_email_confirmation_message" class="double-optin-setting" style="width:100%"><?php echo $settings['double_optin_email_confirmation_message']; ?></textarea>
296
+ </td>
297
+ </tr>
298
+ <tr class="form-field double-optin-enabled default-email-setting" id="">
299
+ <th valign="top" scope="row">
300
+ <label><?php _e( 'Button Text' , 'inbound-pro' ); ?></label>
301
+ </th>
302
+ <td>
303
+ <input type="text" name="double_optin_email_confirmation_button_text" size="30" class="double-optin-setting" value="<?php echo $settings['double_optin_email_confirmation_button_text']; ?>">
304
+ </td>
305
+ </tr>
306
+ <tr class="form-field double-optin-enabled default-email-setting" id="">
307
+ <th valign="top" scope="row">
308
+ <label><?php _e( 'Footer Text' , 'inbound-pro' ); ?></label>
309
+ </th>
310
+ <td>
311
+ <input type="text" name="double_optin_email_confirmation_footer_text" size="30" class="double-optin-setting" value="<?php echo htmlentities($settings['double_optin_email_confirmation_footer_text']); ?>">
312
+ </td>
313
+ </tr>
314
+ <tr class="form-field double-optin-enabled confirmation-shortcode-notice" id="">
315
+ <th valign="top" scope="row">
316
+ <label><?php _e('Note' , 'inbound-pro'); ?></label>
317
+ </th>
318
+ <td>
319
+ <p><?php _e('When creating your own confirmation template you should use the shortcode below to render your confirmation link. ' , 'inbound-pro' ); ?></p>
320
+ <pre>[inbound-list-double-optin-link]</pre>
321
+ </td>
322
+ </tr>
323
+ <style type="text/css">
324
+ #wpfooter {
325
+ position: initial;
326
+ }
327
+ .double-optin-enabled {
328
+ display:table-row;
329
+ }
330
+ </style>
331
+
332
+ <script>
333
+ jQuery(document).ready(function () {
334
+
335
+ /* listen for logo upload */
336
+ jQuery('#double_optin_email_confirmation_logo_button').click(function() {
337
+ tb_show( '' , 'media-upload.php?referer=wptuts-settings&type=image&TB_iframe=true&post_id=0', false);
338
+ return false;
339
+ });
340
+
341
+ window.send_to_editor = function(html) {
342
+ var image_url = jQuery('img',html).attr('src');
343
+ jQuery('#double_optin_email_confirmation_logo').val(image_url);
344
+ tb_remove();
345
+ }
346
+
347
+ /*if the double optin status has changed*/
348
+ jQuery('#double_optin_toggle').on('change', function () {
349
+ if (jQuery('#double_optin_toggle').val() != '1') {
350
+ jQuery('.double-optin-enabled').css({'display': 'none'});
351
+ } else {
352
+ jQuery('.double-optin-enabled').css({'display': 'table-row'});
353
+
354
+
355
+
356
+
357
+
358
+ }
359
+ });
360
+
361
+ /*if the double optin status has changed*/
362
+ jQuery('#double_optin_email_template').on('change', function () {
363
+ if (jQuery('#double_optin_email_template').val() == 'default-email-template') {
364
+ jQuery('.default-email-setting').css({'display': 'table-row'});
365
+ jQuery('.confirmation-shortcode-notice').css({'display': 'none'});
366
+ } else {
367
+ jQuery('.default-email-setting').css({'display': 'none'});
368
+ jQuery('.confirmation-shortcode-notice').css({'display': 'table-row'});
369
+ }
370
+ });
371
+
372
+ /*if the email template to send has changed*/
373
+ jQuery('#double_optin_email_template').on('change', function () {
374
+
375
+ /* show default template settings */
376
+ if (jQuery('#double_optin_email_template').val() == 'default-email-template') {
377
+ jQuery('.default-email-setting').css({'display': 'table-row'});
378
+ } else {
379
+ jQuery('.default-email-setting').css({'display': 'none'});
380
+ }
381
+ });
382
+
383
+ /*trigger a refresh of the email inputs just after the page is loaded*/
384
+ setTimeout(function () {
385
+ jQuery('#double_optin_email_template').trigger('change');
386
+ jQuery('#double_optin_toggle').trigger('change');
387
+
388
+
389
+ }, 350);
390
+
391
+ });
392
+ </script>
393
+
394
+ <?php
395
+ }
396
+
397
+ /**
398
+ * Sends A Double Optin Confirmation to Lead After Conversion
399
+ */
400
+ public static function send_double_optin_confirmation($lead) {
401
+
402
+ /*get the lists*/
403
+ $lists = get_post_meta($lead['id'], 'double_optin_lists', true);
404
+
405
+ /*exit if there aren't any lists*/
406
+ if (!isset($lists) || empty($lists)) {
407
+ return;
408
+ }
409
+
410
+ /**Loop through the double optin lists the lead has waiting for a response.
411
+ *
412
+ * If the response email is an automated one, shoot it off here.
413
+ * If it's a custom template, add it to the email_contents array to be processed further down the page**/
414
+ $email_contents = array();
415
+ foreach ($lists as $list_id) {
416
+ $list_settings = get_term_meta((int)$list_id, 'wplead_lead_list_meta_settings', true);
417
+
418
+
419
+ /* if there is a double optin email template and its not a custom one */
420
+ if (!empty($list_settings['double_optin_email_template']) && $list_settings['double_optin_email_template'] != 'default-email-template') {
421
+ $vid = Inbound_Mailer_Variations::get_next_variant_marker($list_settings['double_optin_email_template']);
422
+
423
+ $args = array(
424
+ 'email_id' => $list_settings['double_optin_email_template'],
425
+ 'vid' => $vid,
426
+ 'email_address' => $lead['email'],
427
+ 'lead_id' => $lead['id'],
428
+ 'tags' => array('inbound-forms'),
429
+ 'lead_lists' => $lists,
430
+ );
431
+
432
+ $response = Inbound_Mail_Daemon::send_solo_email($args);
433
+
434
+ } else if ($list_settings['double_optin_email_template'] == 'default-email-template' && !empty($list_settings['double_optin_email_confirmation_subject'])) {
435
+ /* if there is an email template and it's a custom one*/
436
+
437
+ /*add the email to the queue of emails to send*/
438
+ $email_contents[$list_id]['logo'] = $list_settings['double_optin_email_confirmation_logo'];
439
+ $email_contents[$list_id]['email_subject'] = $list_settings['double_optin_email_confirmation_subject'];
440
+ $email_contents[$list_id]['message'] = $list_settings['double_optin_email_confirmation_message'];
441
+ $email_contents[$list_id]['button_text'] = $list_settings['double_optin_email_confirmation_button_text'];
442
+ $email_contents[$list_id]['footer_text'] = $list_settings['double_optin_email_confirmation_footer_text'];
443
+ }
444
+ }
445
+
446
+ /*exit if there are no response emails*/
447
+ $email_contents = array_filter($email_contents);
448
+ if (!$email_contents) {
449
+ return;
450
+ }
451
+
452
+ foreach ($email_contents as $list_id => $email_content) {
453
+
454
+ $content = self::get_default_email_content($email_content);
455
+ $confirm_subject = $email_content['email_subject'];
456
+
457
+ $args = array(
458
+ 'lead_id' => $lead['id'],
459
+ 'list_ids' => $lists,
460
+ 'email_id' => $lead['email']
461
+ );
462
+
463
+ $content = self::add_confirm_link_shortcode_params($content, $args);
464
+ $content = do_shortcode($content , false);
465
+ $content = str_replace(']]>', ']]&gt;', $content);
466
+
467
+ $from_name = get_option('blogname', '');
468
+ $from_email = get_option('admin_email');
469
+
470
+ $headers = "From: " . $from_name . " <" . $from_email . ">\n";
471
+ $headers .= 'Content-type: text/html';
472
+ $headers = apply_filters('list_double_optin_lead_conversion/headers', $headers);
473
+
474
+ wp_mail($lead['email'], $confirm_subject, $content, $headers);
475
+ }
476
+
477
+ }
478
+
479
+ /**
480
+ * Adds the lead id, the ids of the lists for the lead to confirm, and the lead's email to the shortcode
481
+ * Also removes all text except the link text from the shortcode
482
+ * params: $content: HTML string; the email content, $args : array(lead_id, email_id, list_ids); args to add to the shortcode.
483
+ *
484
+ * This could be reformatted into a general shortcode search and replace function
485
+ */
486
+ public static function add_confirm_link_shortcode_params($content, $args) {
487
+ //regex for finding shortcodes, from https://core.trac.wordpress.org/browser/tags/3.6.1/wp-includes/shortcodes.php#L211
488
+ $shortcode_regex = '/\[' // Opening bracket
489
+ . '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
490
+ . "(inbound-list-double-optin-link)" // 2: Shortcode name
491
+ . '(?![\\w-])' // Not followed by word character or hyphen
492
+ . '(' // 3: Unroll the loop: Inside the opening shortcode tag
493
+ . '[^\\]\\/]*' // Not a closing bracket or forward slash
494
+ . '(?:'
495
+ . '\\/(?!\\])' // A forward slash not followed by a closing bracket
496
+ . '[^\\]\\/]*' // Not a closing bracket or forward slash
497
+ . ')*?'
498
+ . ')'
499
+ . '(?:'
500
+ . '(\\/)' // 4: Self closing tag ...
501
+ . '\\]' // ... and closing bracket
502
+ . '|'
503
+ . '\\]' // Closing bracket
504
+ . '(?:'
505
+ . '(' // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags
506
+ . '[^\\[]*+' // Not an opening bracket
507
+ . '(?:'
508
+ . '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
509
+ . '[^\\[]*+' // Not an opening bracket
510
+ . ')*+'
511
+ . ')'
512
+ . '\\[\\/\\2\\]' // Closing shortcode tag
513
+ . ')?'
514
+ . ')'
515
+ . '(\\]?)/';
516
+
517
+ preg_match_all($shortcode_regex, $content, $matches);
518
+
519
+ /**This adds the lead id, list ids, and lead email to each shortcode. //There shouldn't be more than one shortcode though...
520
+ * It also removes any atts other than the link text**/
521
+ for ($i = 0; $i < count($matches[0]); $i++) {
522
+ /*if the current shortcode is inbound-inbound-list-double-optin-link*/
523
+ if ($matches[2][$i] == 'inbound-list-double-optin-link') {
524
+ /*if no link text has been specified*/
525
+ $replacement_shortcode = '[list-double-optin-link lead_id=' . (int)$args['lead_id'] . ' list_ids=' . implode(',', $args['list_ids']) . ' email_id=' . sanitize_email($args['email_id']) . ' ]';
526
+ $content = str_replace($matches[0][$i], $replacement_shortcode, $content);
527
+ }
528
+ }
529
+
530
+ return $content;
531
+ }
532
+
533
+ /**
534
+ * Removes leads from the waiting for double optin confirmation list if they've been added to lists directly
535
+ */
536
+ public static function remove_from_double_optin_list($lead_id, $list_ids) {
537
+ $double_optin_lists = get_post_meta($lead_id, 'double_optin_lists', true);
538
+
539
+ /* exit if there's no double optin lists */
540
+ if (empty($double_optin_lists)) {
541
+ return;
542
+ }
543
+
544
+ /* exit if the lead hasn't been added to a double optin list */
545
+ if (!in_array($list_ids, $double_optin_lists)) {
546
+ return;
547
+ }
548
+
549
+ if (!is_array($list_ids)) {
550
+ $list_ids = array($list_ids);
551
+ }
552
+
553
+
554
+ foreach ($list_ids as $list_id) {
555
+ if (in_array($list_id, $double_optin_lists)) {
556
+ $index = array_search($list_id, $double_optin_lists);
557
+ unset($double_optin_lists[$index]);
558
+ }
559
+ }
560
+
561
+ /**if there are still lists awaiting double optin confirmation after list values have been removed**/
562
+ if (!empty($double_optin_lists)) {
563
+ /*update the meta listing with the remaining lists*/
564
+ update_post_meta($lead_id, 'double_optin_lists', array_values($double_optin_lists));
565
+ } else {
566
+ /**if there are no lists awaiting double optin confirmation**/
567
+
568
+ /*get the double optin waiting list id*/
569
+ if (!defined('INBOUND_PRO_CURRENT_VERSION')) {
570
+ $double_optin_list_id = get_option('list-double-optin-list-id', '');
571
+ } else {
572
+ $settings = Inbound_Options_API::get_option('inbound-pro', 'settings', array());
573
+ $double_optin_list_id = $settings['leads']['list-double-optin-list-id'];
574
+ }
575
+
576
+ /*remove the meta listing for double optin*/
577
+ delete_post_meta($lead_id, 'double_optin_lists');
578
+ /*remove this lead from the double optin list*/
579
+ wp_remove_object_terms($lead_id, (int)$double_optin_list_id, 'wplead_list_category');
580
+ /*update the lead status*/
581
+ update_post_meta($lead_id, 'wp_lead_status', 'read');
582
+ }
583
+
584
+ }
585
+
586
+
587
+ }
588
+
589
+ new Inbound_List_Double_Optin;
590
+ }
shared/classes/class.load-shared.php CHANGED
@@ -37,6 +37,7 @@ if (!class_exists('Inbound_Load_Shared')) {
37
  */
38
  public static function load_constants() {
39
  define('INBOUNDNOW_SHARED', 'loaded' );
 
40
  define('INBOUNDNOW_SHARED_PATH', self::get_shared_path() );
41
  define('INBOUNDNOW_SHARED_URLPATH', self::get_shared_urlpath() );
42
  define('INBOUNDNOW_SHARED_FILE', self::get_shared_file() );
@@ -59,6 +60,8 @@ if (!class_exists('Inbound_Load_Shared')) {
59
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.shortcodes.email-template.php');
60
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.shortcodes.cookie-values.php');
61
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.lead-fields.php');
 
 
62
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.options-api.php');
63
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.events.php');
64
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.lead-storage.php');
@@ -72,9 +75,9 @@ if (!class_exists('Inbound_Load_Shared')) {
72
 
73
  /* load admin only */
74
  if (is_admin()) {
 
75
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.licensing.php');
76
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.master-license.php');
77
- include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.branching.php');
78
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.promote.php');
79
  /* include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.feedback.php'); */
80
  require_once( INBOUNDNOW_SHARED_PATH . 'classes/class.inbound-api.api-key-generation.php');
@@ -174,14 +177,18 @@ if (!class_exists('Inbound_Load_Shared')) {
174
  * Run activation rules hosted in shared directory
175
  */
176
  public static function run_activation_rules() {
177
- if ( is_admin() && get_option( 'Inbound_Activate' ) ) {
178
 
179
- /* Delete activation trigger */
180
- delete_option( 'Inbound_Activate' );
181
-
182
- /* Run activation action hook for shared components */
183
- do_action( 'inbound_shared_activate' );
184
  }
 
 
 
 
 
 
 
 
185
  }
186
  }
187
- }
37
  */
38
  public static function load_constants() {
39
  define('INBOUNDNOW_SHARED', 'loaded' );
40
+ define('INBOUNDNOW_SHARED_DBRV', '1.0.1' );
41
  define('INBOUNDNOW_SHARED_PATH', self::get_shared_path() );
42
  define('INBOUNDNOW_SHARED_URLPATH', self::get_shared_urlpath() );
43
  define('INBOUNDNOW_SHARED_FILE', self::get_shared_file() );
60
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.shortcodes.email-template.php');
61
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.shortcodes.cookie-values.php');
62
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.lead-fields.php');
63
+ include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.list-double-optin.php');
64
+ include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.confirm-double-optin.php');
65
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.options-api.php');
66
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.events.php');
67
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.lead-storage.php');
75
 
76
  /* load admin only */
77
  if (is_admin()) {
78
+ include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.database-routines.php');
79
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.licensing.php');
80
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.master-license.php');
 
81
  include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.promote.php');
82
  /* include_once( INBOUNDNOW_SHARED_PATH . 'classes/class.feedback.php'); */
83
  require_once( INBOUNDNOW_SHARED_PATH . 'classes/class.inbound-api.api-key-generation.php');
177
  * Run activation rules hosted in shared directory
178
  */
179
  public static function run_activation_rules() {
 
180
 
181
+ if ( !is_admin() || !get_option( 'Inbound_Activate' ) ) {
182
+ return;
 
 
 
183
  }
184
+
185
+ /* Delete activation trigger */
186
+ delete_option( 'Inbound_Activate' );
187
+
188
+ /* Run activation action hook for shared components */
189
+ do_action( 'inbound_shared_activate' );
190
+
191
+
192
  }
193
  }
194
+ }
shared/classes/class.post-type.wp-lead.php CHANGED
@@ -28,6 +28,11 @@ if ( !class_exists('Inbound_Leads') ) {
28
  if (is_admin()) {
29
  add_action( 'edit_form_after_title', array(__CLASS__, 'install_leads_prompt' ) );
30
  }
 
 
 
 
 
31
  }
32
  /**
33
  * Register wp-lead post type
@@ -179,12 +184,13 @@ if ( !class_exists('Inbound_Leads') ) {
179
  }
180
 
181
  /**
182
- * Adds ID column to lead-tags WP List Table
183
  */
184
  public static function register_lead_list_columns( $cols ) {
185
  $new_columns = array(
186
  'cb' => '<input type="checkbox" />',
187
  'lead_id' => __('ID', 'inbound-pro' ),
 
188
  'name' => __('Name', 'inbound-pro' ),
189
  'description' => __('Description', 'inbound-pro' ),
190
  'slug' => __('Slug', 'inbound-pro' ),
@@ -194,17 +200,41 @@ if ( !class_exists('Inbound_Leads') ) {
194
  }
195
 
196
  /**
197
- * Helps ID column display lead list ID
198
  */
199
  public static function support_lead_list_columns( $out, $column_name, $term_id ) {
200
- if ($column_name != 'lead_id' ) {
201
- return $out;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
 
 
 
 
203
 
204
- $out .= $term_id;
205
 
206
- return $out;
207
- }
208
 
209
  /**
210
  * Make sure that all list ids are intval
@@ -481,6 +511,13 @@ if ( !class_exists('Inbound_Leads') ) {
481
  'color' => '#7A3068',
482
  'nature' => 'core'
483
  ),
 
 
 
 
 
 
 
484
  );
485
 
486
  return apply_filters('leads/statuses' , $default );
@@ -571,12 +608,115 @@ if ( !class_exists('Inbound_Leads') ) {
571
 
572
  }
573
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
574
  }
575
 
576
  /**
577
  * Register 'wp-lead' CPT
578
  */
579
- $GLOBALS['Inbound_Leads'] = new Inbound_Leads();
580
 
581
 
582
- }
28
  if (is_admin()) {
29
  add_action( 'edit_form_after_title', array(__CLASS__, 'install_leads_prompt' ) );
30
  }
31
+
32
+ /* add activation scripts for double optin support */
33
+ add_action('inbound_shared_activate' , array(__CLASS__ , 'create_double_optin_list') );
34
+ add_action('inbound_shared_activate' , array(__CLASS__ , 'create_double_optin_page') );
35
+
36
  }
37
  /**
38
  * Register wp-lead post type
184
  }
185
 
186
  /**
187
+ * Adds ID and Double Opt In columns to lead-tags WP List Table
188
  */
189
  public static function register_lead_list_columns( $cols ) {
190
  $new_columns = array(
191
  'cb' => '<input type="checkbox" />',
192
  'lead_id' => __('ID', 'inbound-pro' ),
193
+ 'double_optin' => __('Double Opt In', 'inbound-pro'),
194
  'name' => __('Name', 'inbound-pro' ),
195
  'description' => __('Description', 'inbound-pro' ),
196
  'slug' => __('Slug', 'inbound-pro' ),
200
  }
201
 
202
  /**
203
+ * Displays the list id and double option status in the lead-tags WP List Table
204
  */
205
  public static function support_lead_list_columns( $out, $column_name, $term_id ) {
206
+
207
+ switch($column_name){
208
+ case 'lead_id':
209
+ echo $term_id;
210
+ break;
211
+
212
+ case 'double_optin':
213
+ /*get the double optin waiting list id*/
214
+ if(!defined('INBOUND_PRO_CURRENT_VERSION')){
215
+ $double_optin_list_id = get_option('list-double-optin-list-id', '');
216
+ }else{
217
+ $settings = Inbound_Options_API::get_option('inbound-pro', 'settings', array());
218
+ $double_optin_list_id = $settings['leads']['list-double-optin-list-id'];
219
+ }
220
+ /*if the current term isn't the double optin list, display the double optin status*/
221
+ if($term_id != $double_optin_list_id){
222
+ $settings = get_term_meta($term_id, 'wplead_lead_list_meta_settings');
223
+ if(!empty($settings[0]['double_optin']) && $settings[0]['double_optin'] == 1){
224
+ echo '<span>' . __('on', 'inbound-pro') . '</span>';
225
+ }else{
226
+ echo '<span>' . __('off', 'inbound-pro') . '</span>';
227
+ }
228
+ }
229
+ break;
230
+
231
  }
232
+ }
233
+
234
+
235
+
236
 
 
237
 
 
 
238
 
239
  /**
240
  * Make sure that all list ids are intval
511
  'color' => '#7A3068',
512
  'nature' => 'core'
513
  ),
514
+ 'double-optin' => array(
515
+ 'priority' => 7,
516
+ 'key' => 'double-optin',
517
+ 'label' => __('Unconfirmed' , 'inbound-pro'),
518
+ 'color' => '#6495ED',
519
+ 'nature' => 'core'
520
+ ),
521
  );
522
 
523
  return apply_filters('leads/statuses' , $default );
608
 
609
  }
610
 
611
+ /**
612
+ * Creates the "Confirm Double Optin Page" if the double optin page id is empty
613
+ */
614
+ public static function create_double_optin_page(){
615
+
616
+ $title = __( 'Confirm Subscription' , 'inbound-pro' );
617
+
618
+ $double_optin_page_id = self::get_double_optin_page_id();
619
+
620
+ // If the confirm page id isn't set
621
+ if(empty($double_optin_page_id)) {
622
+
623
+ /**check by name to see if the confirm page exists, if it doesn't create it**/
624
+ if(null == get_page_by_title( $title )){
625
+ // Set the page ID so that we know the post was created successfully
626
+ $page_id = wp_insert_post(array(
627
+ 'comment_status' => 'closed',
628
+ 'ping_status' => 'closed',
629
+ 'post_title' => $title,
630
+ 'post_status' => 'publish',
631
+ 'post_type' => 'page',
632
+ 'post_content' => __('Thank you!' , 'inbound-pro')
633
+ ));
634
+ }else{
635
+ /*if the confirm page does exist, set the page id to its id*/
636
+ $page_id = get_page_by_title( $title );
637
+ }
638
+
639
+ self::save_double_optin_page_id($page_id);
640
+ }
641
+
642
+ }
643
+
644
+ /**
645
+ * Creates a maintenance list
646
+ */
647
+ public static function create_double_optin_list() {
648
+ global $inbound_settings;
649
+
650
+ /*get the double optin waiting list id*/
651
+ if (!defined('INBOUND_PRO_CURRENT_VERSION')) {
652
+ $double_optin_list_id = get_option('list-double-optin-list-id', '');
653
+ } else {
654
+ $settings = Inbound_Options_API::get_option('inbound-pro', 'settings', array());
655
+ $double_optin_list_id = $settings['leads']['list-double-optin-list-id'];
656
+ }
657
+
658
+ // If the list doesn't already exist, create it
659
+ if (false == get_term_by('id', $double_optin_list_id, 'wplead_list_category')) {
660
+
661
+ /* create/get maintenance lists */
662
+ $parent = self::create_lead_list( array(
663
+ 'name' => __( 'Maintenance' , 'inbound-pro' )
664
+ ));
665
+
666
+ /* createget spam lists */
667
+ $term = self::create_lead_list( array(
668
+ 'name' => __( 'Unconfirmed' , 'inbound-pro' ),
669
+ 'parent' =>$parent['id']
670
+ ));
671
+
672
+ /*get the double optin waiting list id*/
673
+ if (!defined('INBOUND_PRO_CURRENT_VERSION')) {
674
+ update_option('list-double-optin-list-id', $term['id']);
675
+ } else {
676
+ $inbound_settings['leads']['list-double-optin-list-id'] = $term['id'];
677
+ Inbound_Options_API::update_option('inbound-pro', 'settings', $inbound_settings);
678
+ }
679
+
680
+ }
681
+ }
682
+
683
+ /**
684
+ * Retrieves double opt in page id
685
+ * @return mixed
686
+ */
687
+ public static function get_double_optin_page_id() {
688
+ global $inbound_settings;
689
+ /*get the double optin confirm page id*/
690
+ if(!defined('INBOUND_PRO_CURRENT_VERSION')){
691
+ $double_optin_page_id = get_option('list-double-optin-page-id', '');
692
+ }else{
693
+ $double_optin_page_id = $inbound_settings['leads']['list-double-optin-page-id'];
694
+ }
695
+
696
+ return $double_optin_page_id;
697
+ }
698
+
699
+ /**
700
+ * Save Double Optin Page ID
701
+ * @param $page_id
702
+ */
703
+ public static function save_double_optin_page_id( $page_id ) {
704
+ global $inbound_settings;
705
+
706
+ if(!defined('INBOUND_PRO_CURRENT_VERSION')) {
707
+ update_option('list-double-optin-page-id', $page_id);
708
+ } else {
709
+ $inbound_settings['leads']['list-double-optin-page-id'] = $page_id;
710
+ Inbound_Options_API::update_option('inbound-pro', 'settings', $inbound_settings);
711
+ }
712
+ }
713
+
714
  }
715
 
716
  /**
717
  * Register 'wp-lead' CPT
718
  */
719
+ new Inbound_Leads();
720
 
721
 
722
+ }
shared/classes/class.shortcodes.email-template.php CHANGED
@@ -33,7 +33,7 @@ class Inbound_Email_Template_Shortcodes {
33
  $html = '';
34
 
35
  $post_params = apply_filters( 'inbound-email-post-params', $_POST);
36
- $blacklist = array('g-recaptcha-response','inbound_submitted', 'inbound_notify', 'inbound_params', 'inbound_furl', 'phone_xoxo', 'page_id');
37
 
38
  /* Parse out UTM Params */
39
  if(isset($_POST['inbound_params']) && $_POST['inbound_params'] != "") {
@@ -48,14 +48,7 @@ class Inbound_Email_Template_Shortcodes {
48
  }
49
  }
50
 
51
- if( isset($post_params[ 'email' ])){
52
- $emailVal = $post_params[ 'email' ];
53
- unset($post_params[ 'email' ]);
54
- $email_array = array('email' => $emailVal );
55
- $post_params = array_merge( $email_array, $post_params );
56
- /*print_r($post_params); exit; */
57
- }
58
-
59
 
60
  /* filter params */
61
  $post_params = apply_filters('inbound_email_response/post_params' , $post_params);
@@ -73,7 +66,7 @@ class Inbound_Email_Template_Shortcodes {
73
  if (is_array($value)) {
74
  $value = implode(', ', $value);
75
  } else if ( strlen($value) < 1 ) {
76
- $value = __( 'n/a', 'ma');
77
  }
78
 
79
 
@@ -84,7 +77,7 @@ class Inbound_Email_Template_Shortcodes {
84
  }
85
 
86
  if ($key == "inbound_form_id" ) {
87
- $value = "<a title='". __( 'View/Edit this form', 'ma' ) ."' href='" . admin_url( 'post.php?post=' . $value . '&action=edit' ). "'>".$value."</a>";
88
  }
89
 
90
  if($key == "inbound_form_lists" && $value != "") {
@@ -94,18 +87,18 @@ class Inbound_Email_Template_Shortcodes {
94
  $list_links = "";
95
  foreach ($lists as $list ) {
96
  /*$list_name = get_term_by('term_id', $list, 'wplead_list_category'); */
97
- $list_links .= "<a title='". __( 'View this list', 'ma' ) ."' href='" . admin_url( 'edit.php?page=lead_management&post_type=wp-lead&wplead_list_category%5B%5D='.$list.'&relation=AND&orderby=date&order=asc&s=&t=&submit=Search+Leads' ). "'>".$list."</a>";
98
  if($count) { $list_links .= ' - '; $count--; }
99
  }
100
  $value = $list_links;
101
  }
102
 
103
  if ($key == "wp_cta_id" ) {
104
- $value = "<a title=' ". __( 'View/Edit this CTA', 'ma' ) ."' href='" . admin_url( 'post.php?post=' . $value . '&action=edit' ). "'>".$value."</a>";
105
  }
106
 
107
  if ( $key == "inbound_current_page_url" ) {
108
- $name = __("Converted on Page", 'ma' );
109
  }
110
 
111
  $html .= '<tr style="border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#cccccc;">';
33
  $html = '';
34
 
35
  $post_params = apply_filters( 'inbound-email-post-params', $_POST);
36
+ $blacklist = array('action','event','post_type','mapped_params','raw_params','url_params','page_views','g-recaptcha-response','inbound_submitted', 'inbound_notify', 'inbound_params', 'inbound_furl', 'phone_xoxo', 'page_id');
37
 
38
  /* Parse out UTM Params */
39
  if(isset($_POST['inbound_params']) && $_POST['inbound_params'] != "") {
48
  }
49
  }
50
 
51
+ $post_params[ 'email' ] = str_replace('%40' , '@' , $post_params[ 'email' ] );
 
 
 
 
 
 
 
52
 
53
  /* filter params */
54
  $post_params = apply_filters('inbound_email_response/post_params' , $post_params);
66
  if (is_array($value)) {
67
  $value = implode(', ', $value);
68
  } else if ( strlen($value) < 1 ) {
69
+ $value = __( 'n/a', 'inbound-pro');
70
  }
71
 
72
 
77
  }
78
 
79
  if ($key == "inbound_form_id" ) {
80
+ $value = "<a title='". __( 'View/Edit this form', 'inbound-pro' ) ."' href='" . admin_url( 'post.php?post=' . $value . '&action=edit' ). "'>".$value."</a>";
81
  }
82
 
83
  if($key == "inbound_form_lists" && $value != "") {
87
  $list_links = "";
88
  foreach ($lists as $list ) {
89
  /*$list_name = get_term_by('term_id', $list, 'wplead_list_category'); */
90
+ $list_links .= "<a title='". __( 'View this list', 'inbound-pro' ) ."' href='" . admin_url( 'edit.php?page=lead_management&post_type=wp-lead&wplead_list_category%5B%5D='.$list.'&relation=AND&orderby=date&order=asc&s=&t=&submit=Search+Leads' ). "'>".$list."</a>";
91
  if($count) { $list_links .= ' - '; $count--; }
92
  }
93
  $value = $list_links;
94
  }
95
 
96
  if ($key == "wp_cta_id" ) {
97
+ $value = "<a title=' ". __( 'View/Edit this CTA', 'inbound-pro' ) ."' href='" . admin_url( 'post.php?post=' . $value . '&action=edit' ). "'>".$value."</a>";
98
  }
99
 
100
  if ( $key == "inbound_current_page_url" ) {
101
+ $name = __("Converted on Page", 'inbound-pro' );
102
  }
103
 
104
  $html .= '<tr style="border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#cccccc;">';
shared/shortcodes/inbound-shortcodes.php CHANGED
@@ -614,7 +614,7 @@ class Inbound_Shortcodes {
614
  <h3><?php _e( 'Inbound Pro Users' , 'inbound-pro' ); ?></h3>
615
  <div class='' style='padding-left:20px;'>
616
 
617
- <?php echo sprintf( __( 'To learn how to creat a follow email series please referrer to %s this document %s. ' , 'inbound-pro' ) , '<a href="http://docs.inboundnow.com/guide/creating-a-follow-up-email-using-inbound-now-as-an-autoresponder-marketing-automation/">', '</a>') ; ?>
618
  </div>
619
  <br>
620
  <?php
@@ -732,5 +732,3 @@ class Inbound_Shortcodes {
732
  /* Initialize InboundNow Shortcodes
733
  * --------------------------------------------------------- */
734
  Inbound_Shortcodes::init();
735
-
736
- ?>
614
  <h3><?php _e( 'Inbound Pro Users' , 'inbound-pro' ); ?></h3>
615
  <div class='' style='padding-left:20px;'>
616
 
617
+ <?php echo sprintf( __( 'To learn how to create a follow up email series, please refer to %s this document %s. ' , 'inbound-pro' ) , '<a href="http://docs.inboundnow.com/guide/creating-a-follow-up-email-using-inbound-now-as-an-autoresponder-marketing-automation/">', '</a>') ; ?>
618
  </div>
619
  <br>
620
  <?php
732
  /* Initialize InboundNow Shortcodes
733
  * --------------------------------------------------------- */
734
  Inbound_Shortcodes::init();
 
 
shared/shortcodes/js/shortcodes.js CHANGED
@@ -24,6 +24,12 @@ function row_add_callback() {
24
  InboundShortcodes.generateChild();
25
  jQuery('.child-clone-row').last().find('input').first().focus(); // focus on new input
26
  //InboundShortcodes.updatePreview();
 
 
 
 
 
 
27
  }
28
 
29
  var InboundShortcodes = {
@@ -92,7 +98,7 @@ var InboundShortcodes = {
92
  row_output = row_output.replace(re, val);
93
  }
94
  else {
95
- row_output = row_output.replace(re, input.val());
96
  }
97
  //console.log(newoutput);
98
  });
@@ -551,23 +557,23 @@ var InboundShortcodes = {
551
  return false;
552
  }
553
  }
554
-
555
  /*Redirect whitespace cleaning*/
556
  if(form_values.indexOf("&inbound_shortcode_redirect_2=+")){
557
- var form_values2 = form_values.substring(form_values.indexOf("&inbound_shortcode_redirect_2=") + 30, form_values.indexOf("inbound_shortcode_notify"));
558
- var saveString = form_values2;
559
- var length = form_values2.length;
560
-
561
- for(i = 0; i < length; i++){
562
- if(form_values2.charAt(0) == '+'){
563
- form_values2 = form_values2.replace('+', '');
564
- }else{
565
- break;
566
- }
567
- }
568
- form_values = form_values.replace(saveString, form_values2);
569
- }
570
-
571
  if (shortcode_name === "insert_inbound_form_shortcode" && form_name == "") {
572
  jQuery(".step-item.first").click();
573
 
24
  InboundShortcodes.generateChild();
25
  jQuery('.child-clone-row').last().find('input').first().focus(); // focus on new input
26
  //InboundShortcodes.updatePreview();
27
+
28
+ /* make sure correct hidden fields are displayed */
29
+ setTimeout(function() {
30
+ jQuery('select[data-field-name="field_type"]').trigger('change');
31
+ } , 1000);
32
+
33
  }
34
 
35
  var InboundShortcodes = {
98
  row_output = row_output.replace(re, val);
99
  }
100
  else {
101
+ row_output = row_output.replace(re, input.val().replace(/"/g, "'"));
102
  }
103
  //console.log(newoutput);
104
  });
557
  return false;
558
  }
559
  }
560
+
561
  /*Redirect whitespace cleaning*/
562
  if(form_values.indexOf("&inbound_shortcode_redirect_2=+")){
563
+ var form_values2 = form_values.substring(form_values.indexOf("&inbound_shortcode_redirect_2=") + 30, form_values.indexOf("inbound_shortcode_notify"));
564
+ var saveString = form_values2;
565
+ var length = form_values2.length;
566
+
567
+ for(i = 0; i < length; i++){
568
+ if(form_values2.charAt(0) == '+'){
569
+ form_values2 = form_values2.replace('+', '');
570
+ }else{
571
+ break;
572
+ }
573
+ }
574
+ form_values = form_values.replace(saveString, form_values2);
575
+ }
576
+
577
  if (shortcode_name === "insert_inbound_form_shortcode" && form_name == "") {
578
  jQuery(".step-item.first").click();
579
 
shared/shortcodes/shortcodes/forms.php CHANGED
@@ -665,7 +665,7 @@ if (!function_exists('inbound_forms_default_content')) {
665
  return;
666
  if( $post->post_type === 'inbound-forms' ) {
667
 
668
- $content = 'This is the email response. Do not use shortcodes or forms here. They will not work in emails. (Delete this text)';
669
 
670
  }
671
 
665
  return;
666
  if( $post->post_type === 'inbound-forms' ) {
667
 
668
+ $content = 'This is the email response. Do not use shortcodes or forms here. They will not work in this email setup component. (Delete this text)';
669
 
670
  }
671
 
templates/simple-solid-lite/config.php CHANGED
@@ -153,7 +153,7 @@ if( function_exists('register_field_group') ):
153
  'key' => 'field_55df74203fb9e',
154
  'label' => 'Top Right Area',
155
  'name' => 'simple-solid-lite-social-media-options',
156
- 'type' => 'textarea',
157
  'instructions' => 'Insert your social media shortcode/snippet here. We provide one out of the box for you but you are welcome to change it.',
158
  'required' => 0,
159
  'conditional_logic' => 0,
153
  'key' => 'field_55df74203fb9e',
154
  'label' => 'Top Right Area',
155
  'name' => 'simple-solid-lite-social-media-options',
156
+ 'type' => 'wysiwyg',
157
  'instructions' => 'Insert your social media shortcode/snippet here. We provide one out of the box for you but you are welcome to change it.',
158
  'required' => 0,
159
  'conditional_logic' => 0,