Popup Builder – Responsive WordPress Pop up - Version 2.6.4.1

Version Description

Current Version of Popup Builder is 2.6.4.1

Download this release

Release Info

Developer Sygnoos
Plugin Icon 128x128 Popup Builder – Responsive WordPress Pop up
Version 2.6.4.1
Comparing to
See all releases

Code changes from version 2.6.4 to 2.6.4.1

classes/PopupInstaller.php CHANGED
@@ -81,6 +81,8 @@ class PopupInstaller {
81
 
82
  self::createTables();
83
 
 
 
84
  /*get_current_blog_id() == 1 When plugin activated inside the child of multisite instance*/
85
  if(is_multisite() && get_current_blog_id() == 1) {
86
  global $wp_version;
@@ -107,6 +109,26 @@ class PopupInstaller {
107
  }
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  public static function uninstallTables($blogId = '') {
111
 
112
  global $wpdb;
@@ -156,6 +178,8 @@ class PopupInstaller {
156
 
157
  public static function uninstall() {
158
 
 
 
159
  $obj = new self();
160
  self::uninstallTables();
161
  $obj->deleteSgPopupOptions();
@@ -183,4 +207,14 @@ class PopupInstaller {
183
  }
184
  }
185
  }
 
 
 
 
 
 
 
 
 
 
186
  }
81
 
82
  self::createTables();
83
 
84
+ self::setupInstallationsDateConfig();
85
+
86
  /*get_current_blog_id() == 1 When plugin activated inside the child of multisite instance*/
87
  if(is_multisite() && get_current_blog_id() == 1) {
88
  global $wp_version;
109
  }
110
  }
111
 
112
+ public static function setupInstallationsDateConfig()
113
+ {
114
+ $usageDays = get_option('SGPBUsageDays');
115
+ if(!$usageDays) {
116
+ update_option('SGPBUsageDays', 0);
117
+
118
+ $timeDate = new DateTime('now');
119
+ $installTime = strtotime($timeDate->format('Y-m-d H:i:s'));
120
+ update_option('SGPBInstallDate', $installTime);
121
+ $timeDate->modify('+'.SG_REVIEW_POPUP_PERIOD.' day');
122
+
123
+ $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
124
+ update_option('SGPBOpenNextTime', $timeNow);
125
+ }
126
+ $maxPopupCount = get_option('SGPBMaxOpenCount');
127
+ if(!$maxPopupCount) {
128
+ update_option('SGPBMaxOpenCount', SG_POPUP_SHOW_COUNT);
129
+ }
130
+ }
131
+
132
  public static function uninstallTables($blogId = '') {
133
 
134
  global $wpdb;
178
 
179
  public static function uninstall() {
180
 
181
+ self::removeCustomOptions();
182
+
183
  $obj = new self();
184
  self::uninstallTables();
185
  $obj->deleteSgPopupOptions();
207
  }
208
  }
209
  }
210
+
211
+ public static function removeCustomOptions()
212
+ {
213
+ delete_option('SGPBUsageDays');
214
+ delete_option('SGPBOpenNextTime');
215
+ delete_option('SGPBMaxOpenCount');
216
+ delete_option('SGPBCloseReviewPopup');
217
+ delete_option('SgpbCounter');
218
+ delete_option('SGPBInstallDate');
219
+ }
220
  }
classes/sgDataTable/SGPopupTable.php CHANGED
@@ -17,6 +17,7 @@ class SGPB_PopupsView extends SGPB_Table
17
  ));
18
  $this->setDisplayColumns(array(
19
  'id' => 'ID',
 
20
  'onOff' => 'Enabled (show popup)',
21
  'title' => 'Title',
22
  'type' => 'Type',
@@ -32,11 +33,27 @@ class SGPB_PopupsView extends SGPB_Table
32
  ));
33
  }
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  public function customizeRow(&$row)
36
  {
37
  $id = $row[0];
 
38
  $ajaxNonce = wp_create_nonce("sgPopupBuilderDeactivateNonce");
39
  $isActivePopup = SgPopupGetData::isActivePopup($id);
 
40
  $switchButton = '<label class="sg-switch">
41
  <input class="sg-switch-checkbox" data-switch-id="'.$id.'" data-checkbox-ajaxNonce="'.$ajaxNonce.'" type="checkbox" '.$isActivePopup.'>
42
  <div class="sg-slider sg-round"></div>
@@ -47,7 +64,8 @@ class SGPB_PopupsView extends SGPB_Table
47
  $ajaxNonce = wp_create_nonce("sgPopupBuilderDeleteNonce");
48
  $row[4] = '<a href="'.@$editUrl.'">'.__('Edit', 'sgpt').'</a>&nbsp;&nbsp;<a href="#" data-sg-popup-id="'.$id.'" data-ajaxNonce="'.$ajaxNonce.'" class="sg-js-delete-link">'.__('Delete', 'sgpt').'</a>
49
  <a href="'.admin_url().'admin-post.php?action=popup_clone&id='.$id.'" data-sg-popup-id="'.$id.'" class="sg-js-popup-clone">Clone</a>';
50
- array_splice( $row, 1, 0, $switchButton);
 
51
  }
52
 
53
  public function customizeQuery(&$query)
17
  ));
18
  $this->setDisplayColumns(array(
19
  'id' => 'ID',
20
+ 'count' => 'Count',
21
  'onOff' => 'Enabled (show popup)',
22
  'title' => 'Title',
23
  'type' => 'Type',
33
  ));
34
  }
35
 
36
+ public function getCurrentCounter($popupId) {
37
+
38
+ $popupsCounterData = get_option('SgpbCounter');
39
+ if($popupsCounterData === false) {
40
+ $popupsCounterData = array();
41
+ }
42
+
43
+ if(empty($popupsCounterData[$popupId])) {
44
+ $popupsCounterData[$popupId] = 0;
45
+ }
46
+
47
+ return $popupsCounterData[$popupId];
48
+ }
49
+
50
  public function customizeRow(&$row)
51
  {
52
  $id = $row[0];
53
+ $currentCounter = $this->getCurrentCounter($id);
54
  $ajaxNonce = wp_create_nonce("sgPopupBuilderDeactivateNonce");
55
  $isActivePopup = SgPopupGetData::isActivePopup($id);
56
+
57
  $switchButton = '<label class="sg-switch">
58
  <input class="sg-switch-checkbox" data-switch-id="'.$id.'" data-checkbox-ajaxNonce="'.$ajaxNonce.'" type="checkbox" '.$isActivePopup.'>
59
  <div class="sg-slider sg-round"></div>
64
  $ajaxNonce = wp_create_nonce("sgPopupBuilderDeleteNonce");
65
  $row[4] = '<a href="'.@$editUrl.'">'.__('Edit', 'sgpt').'</a>&nbsp;&nbsp;<a href="#" data-sg-popup-id="'.$id.'" data-ajaxNonce="'.$ajaxNonce.'" class="sg-js-delete-link">'.__('Delete', 'sgpt').'</a>
66
  <a href="'.admin_url().'admin-post.php?action=popup_clone&id='.$id.'" data-sg-popup-id="'.$id.'" class="sg-js-popup-clone">Clone</a>';
67
+ array_splice( $row, 1, 0, $currentCounter);
68
+ array_splice( $row, 2, 0, $switchButton);
69
  }
70
 
71
  public function customizeQuery(&$query)
config.php CHANGED
@@ -15,7 +15,7 @@ if(!class_exists('SgPopupBuilderConfig')) {
15
  exit();
16
  }
17
 
18
- define("SG_APP_POPUP_PATH", dirname(__FILE__));
19
  define('SG_APP_POPUP_URL', plugins_url('', __FILE__));
20
  define('SG_APP_POPUP_ADMIN_URL', admin_url());
21
  define('SG_APP_POPUP_FILE', plugin_basename(__FILE__));
@@ -24,8 +24,8 @@ if(!class_exists('SgPopupBuilderConfig')) {
24
  define('SG_APP_POPUP_JS', SG_APP_POPUP_PATH . '/javascript');
25
  define('SG_APP_POPUP_HELPERS', SG_APP_POPUP_PATH . '/helpers/');
26
  define('SG_APP_POPUP_TABLE_LIMIT', 15);
27
- define('SG_POPUP_VERSION', 2.64);
28
- define('SG_POPUP_PRO_VERSION', 3.37);
29
  define('SG_POPUP_PRO_URL', 'https://popup-builder.com/');
30
  define('SG_POPUP_EXTENSION_URL', 'https://popup-builder.com/extensions');
31
  define('SG_MAILCHIMP_EXTENSION_URL', 'https://popup-builder.com/downloads/mailchimp/');
@@ -34,13 +34,16 @@ if(!class_exists('SgPopupBuilderConfig')) {
34
  define('SG_EXITINTENT_EXTENSION_URL', 'https://popup-builder.com/downloads/exit-intent/');
35
  define('SG_ADBLOCK_EXTENSION_URL', 'https://popup-builder.com/downloads/adblock/');
36
  define('SG_IP_TO_COUNTRY_SERVICE_TIMEOUT', 2);
37
- define("SG_SHOW_POPUP_REVIEW", get_option("SG_COLOSE_REVIEW_BLOCK"));
38
- define("SG_POSTS_PER_PAGE", 1000);
39
- define("SG_POPUP_MINIMUM_PHP_VERSION", '5.3.3');
 
 
 
40
  /*Example 1 minute*/
41
- define("SG_FILTER_REPEAT_INTERVAL", 1);
42
- define("SG_POST_TYPE_PAGE", "allPages");
43
- define("SG_POST_TYPE_POST", "allPosts");
44
 
45
  define('POPUP_BUILDER_PKG_FREE', 1);
46
  define('POPUP_BUILDER_PKG_SILVER', 2);
@@ -91,6 +94,7 @@ if(!class_exists('SgPopupBuilderConfig')) {
91
  SG_POPUP_DATA = [];
92
  SG_APP_POPUP_URL = '" . SG_APP_POPUP_URL . "';
93
  SG_POPUP_VERSION='" . $popupBuilderVersion . "_" . POPUP_BUILDER_PKG . ";';
 
94
  function sgAddEvent(element, eventName, fn) {
95
  if (element.addEventListener)
96
  element.addEventListener(eventName, fn, false);
@@ -101,6 +105,16 @@ if(!class_exists('SgPopupBuilderConfig')) {
101
 
102
  return $dataString;
103
  }
 
 
 
 
 
 
 
 
 
 
104
  }
105
 
106
  $popupConf = new SgPopupBuilderConfig();
15
  exit();
16
  }
17
 
18
+ define('SG_APP_POPUP_PATH', dirname(__FILE__));
19
  define('SG_APP_POPUP_URL', plugins_url('', __FILE__));
20
  define('SG_APP_POPUP_ADMIN_URL', admin_url());
21
  define('SG_APP_POPUP_FILE', plugin_basename(__FILE__));
24
  define('SG_APP_POPUP_JS', SG_APP_POPUP_PATH . '/javascript');
25
  define('SG_APP_POPUP_HELPERS', SG_APP_POPUP_PATH . '/helpers/');
26
  define('SG_APP_POPUP_TABLE_LIMIT', 15);
27
+ define('SG_POPUP_VERSION', 2.641);
28
+ define('SG_POPUP_PRO_VERSION', 3.371);
29
  define('SG_POPUP_PRO_URL', 'https://popup-builder.com/');
30
  define('SG_POPUP_EXTENSION_URL', 'https://popup-builder.com/extensions');
31
  define('SG_MAILCHIMP_EXTENSION_URL', 'https://popup-builder.com/downloads/mailchimp/');
34
  define('SG_EXITINTENT_EXTENSION_URL', 'https://popup-builder.com/downloads/exit-intent/');
35
  define('SG_ADBLOCK_EXTENSION_URL', 'https://popup-builder.com/downloads/adblock/');
36
  define('SG_IP_TO_COUNTRY_SERVICE_TIMEOUT', 2);
37
+ define('SG_SHOW_POPUP_REVIEW', get_option("SG_COLOSE_REVIEW_BLOCK"));
38
+ define('SG_POSTS_PER_PAGE', 1000);
39
+ define('SG_POPUP_MINIMUM_PHP_VERSION', '5.3.3');
40
+ define('SG_POPUP_SHOW_COUNT', 80);
41
+ define('SG_REVIEW_POPUP_PERIOD', 30);
42
+ define('SGPB_REVIEW_URL' , 'https://wordpress.org/support/plugin/popup-builder/reviews/?rate=5#rate-response');
43
  /*Example 1 minute*/
44
+ define('SG_FILTER_REPEAT_INTERVAL', 1);
45
+ define('SG_POST_TYPE_PAGE', 'allPages');
46
+ define('SG_POST_TYPE_POST', 'allPosts');
47
 
48
  define('POPUP_BUILDER_PKG_FREE', 1);
49
  define('POPUP_BUILDER_PKG_SILVER', 2);
94
  SG_POPUP_DATA = [];
95
  SG_APP_POPUP_URL = '" . SG_APP_POPUP_URL . "';
96
  SG_POPUP_VERSION='" . $popupBuilderVersion . "_" . POPUP_BUILDER_PKG . ";';
97
+
98
  function sgAddEvent(element, eventName, fn) {
99
  if (element.addEventListener)
100
  element.addEventListener(eventName, fn, false);
105
 
106
  return $dataString;
107
  }
108
+
109
+ public static function getFrontendScriptLocalizedData()
110
+ {
111
+ $localizedData = array(
112
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
113
+ 'ajaxNonce' => wp_create_nonce('sgPbNonce')
114
+ );
115
+
116
+ return $localizedData;
117
+ }
118
  }
119
 
120
  $popupConf = new SgPopupBuilderConfig();
files/sg_functions.php CHANGED
@@ -11,6 +11,329 @@ class SGFunctions
11
  echo $sgInfo;
12
  }
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  public static function sgPopupDataSanitize($sgPopupData)
15
  {
16
  /*Remove iframe tag and empty line*/
@@ -27,6 +350,10 @@ class SGFunctions
27
 
28
  foreach ($popupsData as $popupData) {
29
 
 
 
 
 
30
  $title = $popupData->getTitle();
31
  $type = $popupData->getType();
32
  $id = $popupData->getId();
@@ -37,7 +364,7 @@ class SGFunctions
37
  if(isset($restrictParams['id']) && $id == $restrictParams['id']) {
38
  continue;
39
  }
40
- }
41
  $dataList[$id] = $title.' - '.$type;
42
  }
43
 
@@ -58,7 +385,7 @@ class SGFunctions
58
 
59
  $options = json_decode($arr['options'], true);
60
  $deleteStatus = ($options['tables-delete-status'] == 'on' ? true: false);
61
-
62
  return $deleteStatus;
63
  }
64
 
@@ -79,12 +406,12 @@ class SGFunctions
79
  </div>
80
  <div class="sg-info-panel-col-3 sg-info-text-center">
81
  <?php if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
82
- <a class="sg-info-upgrade-pro sg-info-blink" href="http://popup-builder.com" target="_blank">
83
- Upgrade NOW
84
- </a>
85
- <p class="sg-info-text">
86
- Want to upgrade to PRO version?<br> Just click on "Upgrade NOW".
87
- </p>
88
  <?php endif; ?>
89
  <?php if (POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE): ?>
90
  <p class="sg-social-headline">Follow us</p>
@@ -120,7 +447,7 @@ class SGFunctions
120
  <?php
121
  $reviewPanel = ob_get_contents();
122
  ob_end_clean();
123
-
124
  return $reviewPanel;
125
  }
126
 
@@ -131,9 +458,9 @@ class SGFunctions
131
 
132
  public static function createSelectBox($data, $selectedValue, $attrs) {
133
 
134
- $attrString = '';
135
  $selected = '';
136
-
137
  if(!empty($attrs) && isset($attrs)) {
138
 
139
  foreach ($attrs as $attrName => $attrValue) {
@@ -166,7 +493,7 @@ class SGFunctions
166
  $selectBox .= '</select>';
167
 
168
  return $selectBox;
169
- }
170
 
171
  public static function sgCreateRadioElements($radioElements, $checkedValue)
172
  {
@@ -218,7 +545,7 @@ class SGFunctions
218
 
219
  $SxGeo = new SxGeo(SG_APP_POPUP_FILES."/lib/SxGeo/SxGeo.dat");
220
  $counrty = $SxGeo->getCountry($ip);
221
-
222
  /*When Ip addres does not correct*/
223
  if($counrty == '') {
224
  return true;
@@ -227,7 +554,7 @@ class SGFunctions
227
  else {
228
  $counrty = $_COOKIE['SG_POPUP_USER_COUNTRY_NAME'];
229
  }
230
-
231
  return $counrty;
232
  }
233
 
@@ -253,7 +580,7 @@ class SGFunctions
253
 
254
  public static function isShowMenuForCurrentUser() {
255
  $usersSelectedRoles = SgPopupGetData::getValue('plugin_users_role', 'settings');
256
-
257
  $currentUserRole = SgPopupGetData::getCurrentUserRole();
258
 
259
  if((!empty($usersSelectedRoles) && !in_array($currentUserRole, $usersSelectedRoles)) && !is_super_admin()) {
11
  echo $sgInfo;
12
  }
13
 
14
+ public static function getMaxOpenPopupId() {
15
+
16
+ $popupsCounterData = get_option('SgpbCounter');
17
+ if(!$popupsCounterData) {
18
+ return 0;
19
+ }
20
+
21
+ $counters = array_values($popupsCounterData);
22
+ $maxCount = max($counters);
23
+ $popupId = array_search($maxCount, $popupsCounterData);
24
+
25
+ $maxPopupData = array(
26
+ 'popupId' => $popupId,
27
+ 'maxCount' => $maxCount
28
+ );
29
+
30
+ return $maxPopupData;
31
+ }
32
+
33
+ public static function getPopupMainTableCreationDate()
34
+ {
35
+ global $wpdb;
36
+
37
+ $query = $wpdb->prepare('SELECT table_name,create_time FROM information_schema.tables WHERE table_schema="%s" AND table_name="%s"', DB_NAME, $wpdb->prefix.'sg_popup');
38
+ $results = $wpdb->get_results($query, ARRAY_A);
39
+
40
+ if(empty($results)) {
41
+ return 0;
42
+ }
43
+
44
+ $createTime = $results[0]['create_time'];
45
+ $createTime = strtotime($createTime);
46
+ update_option('SGPBInstallDate', $createTime);
47
+ $diff = time()-$createTime;
48
+ $days = floor($diff/(60*60*24));
49
+
50
+ return $days;
51
+ }
52
+
53
+ public static function shouldOpenReviewPopupForDays()
54
+ {
55
+ $shouldOpen = true;
56
+ $dontShowAgain = get_option('SGPBCloseReviewPopup');
57
+ $periodNextTime = get_option('SGPBOpenNextTime');
58
+
59
+ if($dontShowAgain) {
60
+ return false;
61
+ }
62
+
63
+ /*When period next time does not exits it means the user is old*/
64
+ if(!$periodNextTime) {
65
+
66
+ $usageDays = self::getPopupMainTableCreationDate();
67
+ update_option('SGPBUsageDays', $usageDays);
68
+ /*When very old user*/
69
+ if($usageDays > SG_REVIEW_POPUP_PERIOD && !$dontShowAgain) {
70
+ return $shouldOpen;
71
+ }
72
+ $remainingDays = SG_REVIEW_POPUP_PERIOD - $usageDays;
73
+
74
+ $popupTimeZone = @SgPopupGetData::getPopupTimeZone();
75
+ $timeDate = new DateTime('now', new DateTimeZone($popupTimeZone));
76
+ $timeDate->modify('+'.$remainingDays.' day');
77
+
78
+ $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
79
+ update_option('SGPBOpenNextTime', $timeNow);
80
+
81
+ return false;
82
+ }
83
+
84
+ $currentData = new DateTime('now');
85
+ $timeNow = $currentData->format('Y-m-d H:i:s');
86
+ $timeNow = strtotime($timeNow);
87
+
88
+ if($periodNextTime > $timeNow) {
89
+ return false;
90
+ }
91
+
92
+ return $shouldOpen;
93
+ }
94
+
95
+ public static function shouldOpenForMaxOpenPopupMessage()
96
+ {
97
+ $counterMaxPopup = self::getMaxOpenPopupId();
98
+
99
+ if(empty($counterMaxPopup)) {
100
+ return false;
101
+ }
102
+ $dontShowAgain = get_option('SGPBCloseReviewPopup');
103
+ $maxCountDefine = get_option('SGPBMaxOpenCount');
104
+ if(!$maxCountDefine) {
105
+ $maxCountDefine = SG_POPUP_SHOW_COUNT;
106
+ }
107
+ return $counterMaxPopup['maxCount'] >= $maxCountDefine && !$dontShowAgain;
108
+ }
109
+
110
+ public static function getPopupUsageDays()
111
+ {
112
+ $installDate = get_option('SGPBInstallDate');
113
+
114
+ $timeDate = new DateTime('now');
115
+ $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
116
+
117
+ $diff = $timeNow-$installDate;
118
+
119
+ $days = floor($diff/(60*60*24));
120
+
121
+ return $days;
122
+ }
123
+
124
+ public static function getMaxOpenDaysMessage()
125
+ {
126
+ $getUsageDays = self::getPopupUsageDays();
127
+ $firstHeader = '<h1 class="sgpb-review-h1"><strong class="sgrb-review-strong">Wow!</strong> You’ve been using Popup Builder on your site for '.$getUsageDays.' days</h1>';
128
+ $popupContent = self::getMaxOepnPopupContent($firstHeader, 'days');
129
+
130
+ $popupContent .= self::showReviewBlockJs();
131
+
132
+ return $popupContent;
133
+ }
134
+
135
+ public static function getMaxOpenPopupsMessage()
136
+ {
137
+ $counterMaxPopup = self::getMaxOpenPopupId();
138
+ $popupTitle = '';
139
+ $maxCountDefine = get_option('SGPBMaxOpenCount');
140
+ $popupData = SGPopup::findById($counterMaxPopup['popupId']);
141
+
142
+ if(!empty($counterMaxPopup['maxCount'])) {
143
+ $maxCountDefine = $counterMaxPopup['maxCount'];
144
+ }
145
+
146
+ if(!empty($popupData)) {
147
+ $popupTitle = $popupData->getTitle();
148
+ }
149
+
150
+ $firstHeader = '<h1 class="sgpb-review-h1"><strong class="sgrb-review-strong">Wow!</strong> <b>Popup Builder</b> plugin helped you to share your message via <strong class="sgrb-review-strong">'.$popupTitle.'</strong> popup with your users for <strong class="sgrb-review-strong">'.$maxCountDefine.' times!</strong></h1>';
151
+ $popupContent = self::getMaxOepnPopupContent($firstHeader, 'count');
152
+
153
+ $popupContent .= self::showReviewBlockJs();
154
+
155
+ return $popupContent;
156
+ }
157
+
158
+ public static function showReviewBlockJs()
159
+ {
160
+ ob_start();
161
+ ?>
162
+ <script type="text/javascript">
163
+ jQuery('.sg-already-did-review').each(function () {
164
+ jQuery(this).on('click', function () {
165
+ var ajaxNonce = jQuery(this).attr('data-ajaxnonce');
166
+
167
+ var data = {
168
+ action: 'dont_show_review_popup',
169
+ ajaxNonce: ajaxNonce
170
+ };
171
+ jQuery.post(ajaxurl, data, function(response,d) {
172
+ if(typeof jQuery.sgcolorbox != 'undefined') {
173
+ jQuery.sgcolorbox.close();
174
+ }
175
+ if(jQuery('.sgpb-review-block').length) {
176
+ jQuery('.sgpb-review-block').remove();
177
+ }
178
+ });
179
+ });
180
+ });
181
+
182
+ jQuery('.sg-show-popup-period').on('click', function () {
183
+ var ajaxNonce = jQuery(this).attr('data-ajaxnonce');
184
+ var messageType = jQuery(this).attr('data-message-type');
185
+
186
+ var data = {
187
+ action: 'change_review_popup_show_period',
188
+ messageType: messageType,
189
+ ajaxNonce: ajaxNonce
190
+ };
191
+ jQuery.post(ajaxurl, data, function(response,d) {
192
+ if(typeof jQuery.sgcolorbox != 'undefined') {
193
+ jQuery.sgcolorbox.close();
194
+ }
195
+ if(jQuery('.sgpb-review-block').length) {
196
+ jQuery('.sgpb-review-block').remove();
197
+ }
198
+ });
199
+ });
200
+ </script>
201
+ <?php
202
+ $content = ob_get_clean();
203
+
204
+ return $content;
205
+ }
206
+
207
+ public static function showReviewPopup()
208
+ {
209
+ $popupContent = '';
210
+
211
+ $maxOpenPopupStatus = self::shouldOpenForMaxOpenPopupMessage();
212
+
213
+ if($maxOpenPopupStatus) {
214
+ $popupContent = self::getMaxOpenPopupsMessage();
215
+ self::addContentToFooter($popupContent);
216
+ self::openReviewPopup();
217
+ return;
218
+ }
219
+
220
+ $shouldOpenForDays = self::shouldOpenReviewPopupForDays();
221
+
222
+ if($shouldOpenForDays) {
223
+ $popupContent = self::getMaxOpenDaysMessage();
224
+ self::addContentToFooter($popupContent);
225
+ self::openReviewPopup();
226
+ return;
227
+ }
228
+ }
229
+
230
+ public static function addContentToFooter($popupContent)
231
+ {
232
+ add_action('admin_footer', function() use ($popupContent){
233
+ $popupContent = "<div style=\"display:none\"><div id=\"sg-popup-content-wrapper\">$popupContent</div></div>";
234
+ echo $popupContent;
235
+ }, 1);
236
+ }
237
+
238
+ public static function openReviewPopup()
239
+ {
240
+ wp_register_script('sg_colorbox', SG_APP_POPUP_URL . '/javascript/jquery.sgcolorbox-min.js', array('jquery'), SG_POPUP_VERSION);
241
+ wp_enqueue_script('sg_colorbox');
242
+ wp_register_style('sg_colorbox_theme', SG_APP_POPUP_URL . "/style/sgcolorbox/sgthemes.css", array(), SG_POPUP_VERSION);
243
+ wp_enqueue_style('sg_colorbox_theme');
244
+ $ajaxNonce = wp_create_nonce("sgPopupBuilderReview");
245
+
246
+ echo "<script>
247
+ jQuery(document).ready(function() {
248
+ SGPB_AJAX_NONCE = '".$ajaxNonce."';
249
+ var SG_POPUP_SETTINGS = {
250
+ inline: true,
251
+ escKey: false,
252
+ closeButton: false,
253
+ overlayClose: false,
254
+ href: '#sg-popup-content-wrapper',
255
+ onOpen: function() {
256
+ jQuery('#sgcboxOverlay').addClass('sgcboxOverlayBg');
257
+ },
258
+ onCleanup: function () {
259
+ jQuery('#sgcolorbox').trigger('sgPopupCleanup', []);
260
+ },
261
+ maxWidth: 640
262
+ };
263
+ jQuery.sgcolorbox(SG_POPUP_SETTINGS);
264
+ });
265
+ </script>";
266
+ }
267
+
268
+ public static function getMaxOepnPopupContent($firstHeader, $type) {
269
+ $ajaxNonce = wp_create_nonce("sgPopupBuilderReview");
270
+ ob_start();
271
+ ?>
272
+ <style>
273
+ .sgpb-buttons-wrapper .press{
274
+ box-sizing:border-box;
275
+ cursor:pointer;
276
+ display:inline-block;
277
+ font-size:1em;
278
+ margin:0;
279
+ padding:0.5em 0.75em;
280
+ text-decoration:none;
281
+ transition:background 0.15s linear
282
+ }
283
+ .sgpb-buttons-wrapper .press-grey {
284
+ background-color:#9E9E9E;
285
+ border:2px solid #9E9E9E;
286
+ color: #FFF;
287
+ }
288
+ .sgpb-buttons-wrapper .press-lightblue {
289
+ background-color:#03A9F4;
290
+ border:2px solid #03A9F4;
291
+ color: #FFF;
292
+ }
293
+ .sgpb-review-wrapper{
294
+ text-align: center;
295
+ padding: 20px;
296
+ }
297
+ .sgpb-review-wrapper p {
298
+ color: black;
299
+ }
300
+ .sgpb-review-h1 {
301
+ font-size: 22px;
302
+ font-weight: normal;
303
+ line-height: 1.384;
304
+ }
305
+ .sgrb-review-h2{
306
+ font-size: 20px;
307
+ font-weight: normal;
308
+ }
309
+ :root {
310
+ --main-bg-color: #1ac6ff;
311
+ }
312
+ .sgrb-review-strong{
313
+ color: var(--main-bg-color);
314
+ }
315
+ .sgrb-review-mt20{
316
+ margin-top: 20px
317
+ }
318
+ </style>
319
+ <div class="sgpb-review-wrapper">
320
+ <div class="sgpb-review-description">
321
+ <?php echo $firstHeader; ?>
322
+ <h2 class="sgrb-review-h2">This is really great for your website score.</h2>
323
+ <p class="sgrb-review-mt20">Have your input in the development of our plugin, and we’ll provide better conversions for your site!<br /> Leave your 5-star positive review and help us go further to the perfection!</p>
324
+ </div>
325
+ <div class="sgpb-buttons-wrapper">
326
+ <button class="press press-grey sgpb-button-1 sg-already-did-review" data-ajaxnonce="<?php echo esc_attr($ajaxNonce); ?>">I already did</button>
327
+ <button class="press press-lightblue sgpb-button-3 sg-already-did-review" data-ajaxnonce="<?php echo esc_attr($ajaxNonce); ?>" onclick="window.open('<?php echo SGPB_REVIEW_URL; ?>')">You worth it!</button>
328
+ <button class="press press-grey sgpb-button-2 sg-show-popup-period" data-ajaxnonce="<?php echo esc_attr($ajaxNonce); ?>" data-message-type="<?php echo $type; ?>">Maybe later</button></div>
329
+ <div> </div>
330
+ </div>
331
+ <?php
332
+ $popupContent = ob_get_clean();
333
+
334
+ return $popupContent;
335
+ }
336
+
337
  public static function sgPopupDataSanitize($sgPopupData)
338
  {
339
  /*Remove iframe tag and empty line*/
350
 
351
  foreach ($popupsData as $popupData) {
352
 
353
+ if(empty($popupData)) {
354
+ continue;
355
+ }
356
+
357
  $title = $popupData->getTitle();
358
  $type = $popupData->getType();
359
  $id = $popupData->getId();
364
  if(isset($restrictParams['id']) && $id == $restrictParams['id']) {
365
  continue;
366
  }
367
+ }
368
  $dataList[$id] = $title.' - '.$type;
369
  }
370
 
385
 
386
  $options = json_decode($arr['options'], true);
387
  $deleteStatus = ($options['tables-delete-status'] == 'on' ? true: false);
388
+
389
  return $deleteStatus;
390
  }
391
 
406
  </div>
407
  <div class="sg-info-panel-col-3 sg-info-text-center">
408
  <?php if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
409
+ <a class="sg-info-upgrade-pro sg-info-blink" href="http://popup-builder.com" target="_blank">
410
+ Upgrade NOW
411
+ </a>
412
+ <p class="sg-info-text">
413
+ Want to upgrade to PRO version?<br> Just click on "Upgrade NOW".
414
+ </p>
415
  <?php endif; ?>
416
  <?php if (POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE): ?>
417
  <p class="sg-social-headline">Follow us</p>
447
  <?php
448
  $reviewPanel = ob_get_contents();
449
  ob_end_clean();
450
+
451
  return $reviewPanel;
452
  }
453
 
458
 
459
  public static function createSelectBox($data, $selectedValue, $attrs) {
460
 
461
+ $attrString = '';
462
  $selected = '';
463
+
464
  if(!empty($attrs) && isset($attrs)) {
465
 
466
  foreach ($attrs as $attrName => $attrValue) {
493
  $selectBox .= '</select>';
494
 
495
  return $selectBox;
496
+ }
497
 
498
  public static function sgCreateRadioElements($radioElements, $checkedValue)
499
  {
545
 
546
  $SxGeo = new SxGeo(SG_APP_POPUP_FILES."/lib/SxGeo/SxGeo.dat");
547
  $counrty = $SxGeo->getCountry($ip);
548
+
549
  /*When Ip addres does not correct*/
550
  if($counrty == '') {
551
  return true;
554
  else {
555
  $counrty = $_COOKIE['SG_POPUP_USER_COUNTRY_NAME'];
556
  }
557
+
558
  return $counrty;
559
  }
560
 
580
 
581
  public static function isShowMenuForCurrentUser() {
582
  $usersSelectedRoles = SgPopupGetData::getValue('plugin_users_role', 'settings');
583
+
584
  $currentUserRole = SgPopupGetData::getCurrentUserRole();
585
 
586
  if((!empty($usersSelectedRoles) && !in_array($currentUserRole, $usersSelectedRoles)) && !is_super_admin()) {
files/sg_popup_actions.php CHANGED
@@ -9,13 +9,23 @@ class sgPopupActions {
9
  private function actions() {
10
 
11
  add_action('sgPopupDelete', array($this, 'sgPopupDeleteAction'));
 
 
 
12
  }
13
 
14
  public function sgPopupDeleteAction($args) {
15
 
16
  $extensionManagerObj = new SGPBExtensionManager();
17
- $extensionManagerObj->deletePopupFromConnection($args['popupId']);
18
- $this->deletePopupFromAllPostTypes($args['popupId']);
 
 
 
 
 
 
 
19
  }
20
 
21
  private function deletePopupFromAllPostTypes($popupId) {
@@ -29,6 +39,36 @@ class sgPopupActions {
29
  update_option("SG_ALL_POSTS", $allPosts);
30
  }
31
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
  $actionsObj = new sgPopupActions();
@@ -139,4 +179,5 @@ function sgnewslatter_repeat_function($args) {
139
  $updateStatusQuery = $wpdb->prepare("UPDATE ". $wpdb->prefix ."sg_subscribers SET status=1 where id>=$id and subscriptionType = %s limit $sendingLimit",$subscriptionType);
140
  $wpdb->query($updateStatusQuery);
141
  }
142
- add_action ('sgnewsletter_send_messages', 'sgnewslatter_repeat_function', 10, 1);
 
9
  private function actions() {
10
 
11
  add_action('sgPopupDelete', array($this, 'sgPopupDeleteAction'));
12
+ add_action('admin_notices', array($this, 'popupBuilderShowReviewNotice'));
13
+ add_action('network_admin_notices', array($this, 'popupBuilderShowReviewNotice'));
14
+ add_action('user_admin_notices', array($this, 'popupBuilderShowReviewNotice'));
15
  }
16
 
17
  public function sgPopupDeleteAction($args) {
18
 
19
  $extensionManagerObj = new SGPBExtensionManager();
20
+ $popupCount = get_option('SGPBMaxOpenCount');
21
+ $popupId = $args['popupId'];
22
+
23
+ if(isset($popupCount[$popupId])) {
24
+ unset($popupCount[$popupId]);
25
+ update_option('SGPBMaxOpenCount', $popupId);
26
+ }
27
+ $extensionManagerObj->deletePopupFromConnection($popupId);
28
+ $this->deletePopupFromAllPostTypes($popupId);
29
  }
30
 
31
  private function deletePopupFromAllPostTypes($popupId) {
39
  update_option("SG_ALL_POSTS", $allPosts);
40
  }
41
  }
42
+
43
+ public function popupBuilderShowReviewNotice()
44
+ {
45
+ $messageContent = '';
46
+ $maxOpenPopupStatus = SGFunctions::shouldOpenForMaxOpenPopupMessage();
47
+ $shouldOpenForDays = SGFunctions::shouldOpenReviewPopupForDays();
48
+
49
+ if($maxOpenPopupStatus) {
50
+ $messageContent = SGFunctions::getMaxOpenPopupsMessage();
51
+ }
52
+ else if($shouldOpenForDays) {
53
+ $messageContent = SGFunctions::getMaxOpenDaysMessage();
54
+ }
55
+
56
+ if(empty($messageContent)) {
57
+ return $messageContent;
58
+ }
59
+ ob_start();
60
+ ?>
61
+ <div id="welcome-panel" class="welcome-panel sgpb-review-block">
62
+ <div class="welcome-panel-content">
63
+ <?php echo $messageContent; ?>
64
+ </div>
65
+ </div>
66
+ <?php
67
+ $content = ob_get_clean();
68
+
69
+ echo $content;
70
+ return '';
71
+ }
72
  }
73
 
74
  $actionsObj = new sgPopupActions();
179
  $updateStatusQuery = $wpdb->prepare("UPDATE ". $wpdb->prefix ."sg_subscribers SET status=1 where id>=$id and subscriptionType = %s limit $sendingLimit",$subscriptionType);
180
  $wpdb->query($updateStatusQuery);
181
  }
182
+ add_action ('sgnewsletter_send_messages', 'sgnewslatter_repeat_function', 10, 1);
183
+
files/sg_popup_ajax.php CHANGED
@@ -51,6 +51,29 @@ function sgFrontend()
51
  add_action('wp_ajax_nopriv_subs_send_mail', 'sgFrontend');
52
  add_action('wp_ajax_subs_send_mail', 'sgFrontend');
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  function sgContactForm()
55
  {
56
  global $wpdb;
@@ -174,9 +197,52 @@ function sgCloseReviewPanel()
174
  {
175
  check_ajax_referer('sgPopupBuilderReview', 'ajaxNonce');
176
  update_option('SG_COLOSE_REVIEW_BLOCK', true);
 
177
  }
178
  add_action('wp_ajax_close_review_panel', 'sgCloseReviewPanel');
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  function addToSubscribers() {
181
 
182
  global $wpdb;
51
  add_action('wp_ajax_nopriv_subs_send_mail', 'sgFrontend');
52
  add_action('wp_ajax_subs_send_mail', 'sgFrontend');
53
 
54
+ function sgpbAddToCounter()
55
+ {
56
+ check_ajax_referer('sgPbNonce', 'ajaxNonce');
57
+ $popupParams = $_POST['params'];
58
+ $popupId = (int)$popupParams['popupId'];
59
+ $popupsCounterData = get_option('SgpbCounter');
60
+
61
+ if($popupsCounterData === false) {
62
+ $popupsCounterData = array();
63
+ }
64
+
65
+ if(empty($popupsCounterData[$popupId])) {
66
+ $popupsCounterData[$popupId] = 0;
67
+ }
68
+ $popupsCounterData[$popupId] += 1;
69
+
70
+ update_option('SgpbCounter', $popupsCounterData);
71
+ die();
72
+ }
73
+
74
+ add_action('wp_ajax_nopriv_send_to_open_counter', 'sgpbAddToCounter');
75
+ add_action('wp_ajax_send_to_open_counter', 'sgpbAddToCounter');
76
+
77
  function sgContactForm()
78
  {
79
  global $wpdb;
197
  {
198
  check_ajax_referer('sgPopupBuilderReview', 'ajaxNonce');
199
  update_option('SG_COLOSE_REVIEW_BLOCK', true);
200
+ die();
201
  }
202
  add_action('wp_ajax_close_review_panel', 'sgCloseReviewPanel');
203
 
204
+ function sgDontShowReviewPopup()
205
+ {
206
+ check_ajax_referer('sgPopupBuilderReview', 'ajaxNonce');
207
+ update_option('SGPBCloseReviewPopup', true);
208
+ die();
209
+ }
210
+ add_action('wp_ajax_dont_show_review_popup', 'sgDontShowReviewPopup');
211
+
212
+ function sgChangeReviewPopupPeriod()
213
+ {
214
+ check_ajax_referer('sgPopupBuilderReview', 'ajaxNonce');
215
+ $messageType = sanitize_text_field($_POST['messageType']);
216
+
217
+ if($messageType == 'count') {
218
+ $maxPopupCount = get_option('SGPBMaxOpenCount');
219
+ if(!$maxPopupCount) {
220
+ $maxPopupCount = SG_POPUP_SHOW_COUNT;
221
+ }
222
+ $maxPopupData = SGFunctions::getMaxOpenPopupId();
223
+ if(!empty($maxPopupData['maxCount'])) {
224
+ $maxPopupCount = $maxPopupData['maxCount'];
225
+ }
226
+
227
+ $maxPopupCount += SG_POPUP_SHOW_COUNT;
228
+ update_option('SGPBMaxOpenCount', $maxPopupCount);
229
+ die();
230
+ }
231
+
232
+ $popupTimeZone = @SgPopupGetData::getPopupTimeZone();
233
+ $timeDate = new DateTime('now', new DateTimeZone($popupTimeZone));
234
+ $timeDate->modify('+'.SG_REVIEW_POPUP_PERIOD.' day');
235
+
236
+ $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
237
+ update_option('SGPBOpenNextTime', $timeNow);
238
+ $usageDays = get_option('SGPBUsageDays');
239
+ $usageDays += SG_REVIEW_POPUP_PERIOD;
240
+ update_option('SGPBUsageDays', $usageDays);
241
+ die();
242
+ }
243
+
244
+ add_action('wp_ajax_change_review_popup_show_period', 'sgChangeReviewPopupPeriod');
245
+
246
  function addToSubscribers() {
247
 
248
  global $wpdb;
files/sg_popup_create_new.php CHANGED
@@ -1390,7 +1390,7 @@ if (isset($_GET["titleError"])): ?>
1390
 
1391
  <?php if(!sgRemoveOption('repetitivePopup')): ?>
1392
  <span class="liquid-width">Repetitive popup:</span><input class="input-width-static js-checkbox-acordion" id="js-popup-only-once" type="checkbox" name="repetitivePopup" <?php echo $sgRepetitivePopup;?>>
1393
- <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show the popup to a user only once.</span><br>
1394
  <div class="acordion-main-div-content js-popup-only-once-content">
1395
  <span class="liquid-width">show popup</span>
1396
  <input type="number" class="before-scroling-percent" name="repetitivePopupPeriod" min="10" value="<?php echo esc_attr($sgRepetitivePopupPeriod); ?>">
1390
 
1391
  <?php if(!sgRemoveOption('repetitivePopup')): ?>
1392
  <span class="liquid-width">Repetitive popup:</span><input class="input-width-static js-checkbox-acordion" id="js-popup-only-once" type="checkbox" name="repetitivePopup" <?php echo $sgRepetitivePopup;?>>
1393
+ <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">If this option enabled the same popup will be opened after each X seconds you have defined after the closing.</span><br>
1394
  <div class="acordion-main-div-content js-popup-only-once-content">
1395
  <span class="liquid-width">show popup</span>
1396
  <input type="number" class="before-scroling-percent" name="repetitivePopupPeriod" min="10" value="<?php echo esc_attr($sgRepetitivePopupPeriod); ?>">
files/sg_popup_main.php CHANGED
@@ -1,31 +1,33 @@
1
- <?php
2
- require_once(SG_APP_POPUP_CLASSES.'/sgDataTable/SGPopupTable.php');
3
- $allData = SGPopup::findAll();
4
-
5
- if(!SG_SHOW_POPUP_REVIEW) {
6
- echo SGFunctions::addReview();
7
- }
8
- $ajaxNonce = wp_create_nonce("sgPopupBuilderImportNonce");
9
- ?>
10
- <div class="wrap">
11
- <div class="headers-wrapper">
12
- <h2 class="add-new-buttons">Popups <a href="<?php echo admin_url();?>admin.php?page=create-popup" class="add-new-h2">Add New</a></h2>
13
- <?php if(POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
14
- <input type="button" class="main-update-to-pro" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL;?>')">
15
- <?php endif; ?>
16
- <?php if(POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE): ?>
17
- <div class="export-import-buttons-wrraper">
18
- <?php if(!empty($allData)):?>
19
- <a href= "admin-post.php?action=popup_export" ><input type="button" value="Export" class="button"></a>
20
- <?php endif;?>
21
- <input id="js-upload-export-file" data-ajaxNonce="<?php echo esc_attr($ajaxNonce); ?>" class="button" type="button" value="Import"><img src="<?php echo plugins_url('img/wpAjax.gif', dirname(__FILE__).'../'); ?>" alt="gif" class="sg-hide-element js-sg-import-gif">
22
- </div>
23
- <div class="clear"></div>
24
- <?php endif; ?>
25
- </div>
26
- <?php
27
- $table = new SGPB_PopupsView();
28
- echo $table;
29
- SGFunctions::showInfo();
30
- ?>
31
- </div>
 
 
1
+ <?php
2
+ require_once(SG_APP_POPUP_CLASSES.'/sgDataTable/SGPopupTable.php');
3
+ $allData = SGPopup::findAll();
4
+
5
+ if(!SG_SHOW_POPUP_REVIEW) {
6
+ echo SGFunctions::addReview();
7
+ }
8
+
9
+ echo SGFunctions::showReviewPopup();
10
+ $ajaxNonce = wp_create_nonce("sgPopupBuilderImportNonce");
11
+ ?>
12
+ <div class="wrap">
13
+ <div class="headers-wrapper">
14
+ <h2 class="add-new-buttons">Popups <a href="<?php echo admin_url();?>admin.php?page=create-popup" class="add-new-h2">Add New</a></h2>
15
+ <?php if(POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
16
+ <input type="button" class="main-update-to-pro" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL;?>')">
17
+ <?php endif; ?>
18
+ <?php if(POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE): ?>
19
+ <div class="export-import-buttons-wrraper">
20
+ <?php if(!empty($allData)):?>
21
+ <a href= "admin-post.php?action=popup_export" ><input type="button" value="Export" class="button"></a>
22
+ <?php endif;?>
23
+ <input id="js-upload-export-file" data-ajaxNonce="<?php echo esc_attr($ajaxNonce); ?>" class="button" type="button" value="Import"><img src="<?php echo plugins_url('img/wpAjax.gif', dirname(__FILE__).'../'); ?>" alt="gif" class="sg-hide-element js-sg-import-gif">
24
+ </div>
25
+ <div class="clear"></div>
26
+ <?php endif; ?>
27
+ </div>
28
+ <?php
29
+ $table = new SGPB_PopupsView();
30
+ echo $table;
31
+ SGFunctions::showInfo();
32
+ ?>
33
+ </div>
javascript/sg_popup_backend.js CHANGED
@@ -1 +1 @@
1
- function beckend() {
2
  this.titleNotEmpty(); /* Check title is Empty */
3
  this.showThemePicture(); /* Show themes pictures */
4
  this.showEffects(); /* Show effect type */
5
  this.pageAcordion(); /* For page accordion divs */
6
  this.fixedPostionSelection(); /* Functionality for selected position */
7
  this.showInfo(); /* Show description options */
8
  this.opacityRange();
9
  this.subOptionContents();
10
  this.addCountries();
11
  this.showCloseTextFieldForTheme();
12
  this.popupReview();
13
  this.colorPicekr(); /* Color picker */
14
  this.switchPopupActive();
15
  this.initAccordions();
16
  });
17
  jQuery('.sg-info-close').on('click', function() {
18
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
19
  });
20
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
21
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
22
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
23
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
 
24
  this.titleNotEmpty(); /* Check title is Empty */
25
  this.showThemePicture(); /* Show themes pictures */
26
  this.showEffects(); /* Show effect type */
27
  this.pageAcordion(); /* For page accordion divs */
28
  this.fixedPostionSelection(); /* Functionality for selected position */
29
  this.showInfo(); /* Show description options */
30
  this.opacityRange();
31
  this.subOptionContents();
32
  this.addCountries();
33
  this.showCloseTextFieldForTheme();
34
  this.popupReview();
35
  this.colorPicekr(); /* Color picker */
36
  this.switchPopupActive();
37
  this.initAccordions();
38
  });
39
  jQuery('.sg-info-close').on('click', function() {
40
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
41
  });
42
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
43
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
44
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
45
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
 
1
  this.titleNotEmpty(); /* Check title is Empty */
2
  this.showThemePicture(); /* Show themes pictures */
3
  this.showEffects(); /* Show effect type */
4
  this.pageAcordion(); /* For page accordion divs */
5
  this.fixedPostionSelection(); /* Functionality for selected position */
6
  this.showInfo(); /* Show description options */
7
  this.opacityRange();
8
  this.subOptionContents();
9
  this.addCountries();
10
  this.showCloseTextFieldForTheme();
11
  this.popupReview();
12
  this.colorPicekr(); /* Color picker */
13
  this.switchPopupActive();
14
  this.initAccordions();
15
  });
16
  jQuery('.sg-info-close').on('click', function() {
17
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
18
  });
19
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
20
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
21
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
22
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
23
+ function beckend() {
24
  this.titleNotEmpty(); /* Check title is Empty */
25
  this.showThemePicture(); /* Show themes pictures */
26
  this.showEffects(); /* Show effect type */
27
  this.pageAcordion(); /* For page accordion divs */
28
  this.fixedPostionSelection(); /* Functionality for selected position */
29
  this.showInfo(); /* Show description options */
30
  this.opacityRange();
31
  this.subOptionContents();
32
  this.addCountries();
33
  this.showCloseTextFieldForTheme();
34
  this.popupReview();
35
  this.colorPicekr(); /* Color picker */
36
  this.switchPopupActive();
37
  this.initAccordions();
38
  });
39
  jQuery('.sg-info-close').on('click', function() {
40
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
41
  });
42
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
43
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
44
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
45
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
javascript/sg_popup_frontend.js CHANGED
@@ -686,6 +686,23 @@ SGPopup.prototype.sgColorboxContentMode = function() {
686
  }
687
  };
688
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  SGPopup.prototype.colorboxEventsListener = function () {
690
 
691
  var that = this;
@@ -696,7 +713,8 @@ SGPopup.prototype.colorboxEventsListener = function () {
696
  var repetitivePopupPeriod = this.popupData['repetitivePopupPeriod'];
697
  repetitivePopupPeriod = parseInt(repetitivePopupPeriod)*1000;
698
  var repetitiveTimeout = null;
699
- if(popupOpenSound && popupOpenSoundFile) {
 
700
  var audio = new Audio(popupOpenSoundFile);
701
  }
702
  jQuery('#sgcolorbox').on("sgColorboxOnOpen", function () {
@@ -705,12 +723,27 @@ SGPopup.prototype.colorboxEventsListener = function () {
705
  }
706
  });
707
 
708
- jQuery('#sgcolorbox').on("sgColorboxOnCompleate", function () {
 
 
 
709
  clearInterval(repetitiveTimeout);
710
  if(popupOpenSound && popupOpenSoundFile) {
711
- audio.play()
 
 
 
 
 
 
 
 
 
 
 
 
712
  }
713
-
714
  });
715
 
716
  jQuery('#sgcolorbox').on("sgPopupCleanup", function () {
@@ -722,6 +755,7 @@ SGPopup.prototype.colorboxEventsListener = function () {
722
  }
723
  if(popupOpenSound && popupOpenSoundFile) {
724
  audio.pause();
 
725
  }
726
  });
727
 
@@ -933,7 +967,11 @@ SGPopup.prototype.sgShowColorboxWithOptions = function () {
933
  jQuery("#sgcboxLoadedContent").css({'background-color': contentBackgroundColor});
934
  }
935
  jQuery("#sgcboxLoadedContent").addClass("sg-current-popup-" + that.popupData['id']);
936
- jQuery('#sgcolorbox').trigger("sgColorboxOnCompleate", [pushToBottom]);
 
 
 
 
937
 
938
  var sgpopupInit = new SgPopupInit(that.popupData);
939
  sgpopupInit.overallInit();
686
  }
687
  };
688
 
689
+ SGPopup.prototype.addToCounter = function (popupId) {
690
+
691
+ var params = {};
692
+ params.popupId = popupId;
693
+
694
+ var data = {
695
+ action: 'send_to_open_counter',
696
+ ajaxNonce: SGPBParams.ajaxNonce,
697
+ params: params
698
+ };
699
+
700
+ jQuery.post(SGPBParams.ajaxUrl, data, function(response,d) {
701
+
702
+ });
703
+ };
704
+ SGPopup.soundValue = 1;
705
+
706
  SGPopup.prototype.colorboxEventsListener = function () {
707
 
708
  var that = this;
713
  var repetitivePopupPeriod = this.popupData['repetitivePopupPeriod'];
714
  repetitivePopupPeriod = parseInt(repetitivePopupPeriod)*1000;
715
  var repetitiveTimeout = null;
716
+
717
+ if(popupOpenSound && popupOpenSoundFile && typeof audio == 'undefined') {
718
  var audio = new Audio(popupOpenSoundFile);
719
  }
720
  jQuery('#sgcolorbox').on("sgColorboxOnOpen", function () {
723
  }
724
  });
725
 
726
+ jQuery('#sgcolorbox').on("sgColorboxOnCompleate", function (e, args) {
727
+ var popupId = args.popupId;
728
+ that.addToCounter(popupId);
729
+
730
  clearInterval(repetitiveTimeout);
731
  if(popupOpenSound && popupOpenSoundFile) {
732
+ /*
733
+ * SGPopup.soundValue -> 1 sound should play
734
+ * SGPopup.soundValue -> 2 sound should pause
735
+ * */
736
+ if (SGPopup.soundValue == 1) {
737
+
738
+ audio.play();
739
+ SGPopup.soundValue = 2;
740
+
741
+ } else if (SGPopup.soundValue == 2) {
742
+ audio.pause();
743
+ SGPopup.soundValue = 1;
744
+ }
745
  }
746
+ jQuery('#sgcolorbox').unbind("sgColorboxOnCompleate");
747
  });
748
 
749
  jQuery('#sgcolorbox').on("sgPopupCleanup", function () {
755
  }
756
  if(popupOpenSound && popupOpenSoundFile) {
757
  audio.pause();
758
+ SGPopup.soundValue = 1;
759
  }
760
  });
761
 
967
  jQuery("#sgcboxLoadedContent").css({'background-color': contentBackgroundColor});
968
  }
969
  jQuery("#sgcboxLoadedContent").addClass("sg-current-popup-" + that.popupData['id']);
970
+ var completeArgs = {
971
+ pushToBottom: pushToBottom,
972
+ popupId: popupId
973
+ };
974
+ jQuery('#sgcolorbox').trigger("sgColorboxOnCompleate", completeArgs);
975
 
976
  var sgpopupInit = new SgPopupInit(that.popupData);
977
  sgpopupInit.overallInit();
popup-builder.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Plugin Name: Popup Builder
4
- * Plugin URI: http://sygnoos.com
5
  * Description: The most complete popup plugin. Html, image, iframe, shortcode, video and many other popup types. Manage popup dimensions, effects, themes and more.
6
- * Version: 2.6.4
7
  * Author: Popup Builder
8
  * Author URI: http://www.sygnoos.com
9
  * License: GPLv2
@@ -69,6 +69,7 @@ function sgRegisterScripts()
69
  wp_enqueue_style('sg_animate');
70
  wp_register_script('sg_popup_frontend', SG_APP_POPUP_URL . '/javascript/sg_popup_frontend.js', array('jquery', 'sg_resize'), SG_POPUP_VERSION);
71
  wp_enqueue_script('sg_popup_frontend');
 
72
  wp_register_script('sg_resize', SG_APP_POPUP_URL . '/javascript/sg_resize.js', array('jquery'), SG_POPUP_VERSION);
73
  wp_enqueue_script('sg_resize');
74
  wp_register_script('sg_popup_init', SG_APP_POPUP_URL . '/javascript/sg_popup_init.js', array('jquery'), SG_POPUP_VERSION);
1
  <?php
2
  /**
3
  * Plugin Name: Popup Builder
4
+ * Plugin URI: https://popup-builder.com
5
  * Description: The most complete popup plugin. Html, image, iframe, shortcode, video and many other popup types. Manage popup dimensions, effects, themes and more.
6
+ * Version: 2.6.4.1
7
  * Author: Popup Builder
8
  * Author URI: http://www.sygnoos.com
9
  * License: GPLv2
69
  wp_enqueue_style('sg_animate');
70
  wp_register_script('sg_popup_frontend', SG_APP_POPUP_URL . '/javascript/sg_popup_frontend.js', array('jquery', 'sg_resize'), SG_POPUP_VERSION);
71
  wp_enqueue_script('sg_popup_frontend');
72
+ wp_localize_script('sg_popup_frontend', 'SGPBParams',SgPopupBuilderConfig::getFrontendScriptLocalizedData());
73
  wp_register_script('sg_resize', SG_APP_POPUP_URL . '/javascript/sg_resize.js', array('jquery'), SG_POPUP_VERSION);
74
  wp_enqueue_script('sg_resize');
75
  wp_register_script('sg_popup_init', SG_APP_POPUP_URL . '/javascript/sg_popup_init.js', array('jquery'), SG_POPUP_VERSION);
readme.txt CHANGED
@@ -6,6 +6,7 @@ Donate link: https://popup-builder.com
6
  Tags: popup, pop up, wordpress popup, popup maker, exit popup
7
  Requires at least: 3.8
8
  Tested up to: 4.8.1
 
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -165,6 +166,13 @@ Go to the Popup Builder settings and set your desired options.
165
 
166
  == Changelog ==
167
 
 
 
 
 
 
 
 
168
  = Version 2.6.4 =
169
  * Added new option to play sound on popup opening.
170
  * Minor fixes and improvements.
@@ -649,7 +657,7 @@ Don't forget to Save changes!)
649
 
650
  **Can I make the video play automatically in the Video popup? (PRO)**
651
 
652
- Sure! If you want your video to play automatically, we have an option specially for that case. Just select "Autoplay" and your video will play automatically.
653
 
654
  **What do I have to write in the field "Label" of the Age Restriction popup? (PRO)**
655
 
@@ -696,7 +704,7 @@ Leave us a good review :)
696
 
697
  == Upgrade Notice ==
698
 
699
- Current Version of Popup Builder is 2.6.4
700
 
701
  == Other Notes ==
702
 
6
  Tags: popup, pop up, wordpress popup, popup maker, exit popup
7
  Requires at least: 3.8
8
  Tested up to: 4.8.1
9
+ Requires PHP: 5.3.3
10
  Stable tag: trunk
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
166
 
167
  == Changelog ==
168
 
169
+ = Version 2.6.4.1 =
170
+ * Added popup counter feature.
171
+ * Added review section.
172
+ * Bug fixed connected to popup opening sound.
173
+ * PHP Notices fixed.
174
+ * Minor fixes and improvements.
175
+
176
  = Version 2.6.4 =
177
  * Added new option to play sound on popup opening.
178
  * Minor fixes and improvements.
657
 
658
  **Can I make the video play automatically in the Video popup? (PRO)**
659
 
660
+ Sure! If you want your video to play automatically, we have an option specially for that case. Just select "Autoplay" and your video will play automatically. Please be noted that autoplay option will not work on mobile devices as there are browser restrictions.
661
 
662
  **What do I have to write in the field "Label" of the Age Restriction popup? (PRO)**
663
 
704
 
705
  == Upgrade Notice ==
706
 
707
+ Current Version of Popup Builder is 2.6.4.1
708
 
709
  == Other Notes ==
710