Popup Builder – Responsive WordPress Pop up - Version 2.6.7.5

Version Description

Current Version of Popup Builder is 2.6.7

Download this release

Release Info

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

Code changes from version 2.6.7.4 to 2.6.7.5

config.php CHANGED
@@ -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.674);
28
- define('SG_POPUP_PRO_VERSION', 3.8);
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/');
@@ -52,6 +52,9 @@ if(!class_exists('SgPopupBuilderConfig')) {
52
 
53
  global $POPUP_TITLES;
54
  global $POPUP_ADDONS;
 
 
 
55
 
56
  $POPUP_TITLES = array(
57
  'image' => 'Image',
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.675);
28
+ define('SG_POPUP_PRO_VERSION', 3.38);
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/');
52
 
53
  global $POPUP_TITLES;
54
  global $POPUP_ADDONS;
55
+ global $SGPB_INSIDE_POPUPS;
56
+
57
+ $SGPB_INSIDE_POPUPS = array();
58
 
59
  $POPUP_TITLES = array(
60
  'image' => 'Image',
files/sg_functions.php CHANGED
@@ -587,7 +587,11 @@ class SGFunctions
587
 
588
  $currentUserRole = SgPopupGetData::getCurrentUserRole();
589
 
590
- if((!empty($usersSelectedRoles) && !in_array($currentUserRole, $usersSelectedRoles)) && !is_super_admin()) {
 
 
 
 
591
  return false;
592
  }
593
 
587
 
588
  $currentUserRole = SgPopupGetData::getCurrentUserRole();
589
 
590
+ if (is_super_admin()) {
591
+ return true;
592
+ }
593
+ $usersSelectedRoles = (array)$usersSelectedRoles;
594
+ if ((isset($usersSelectedRoles) && !in_array($currentUserRole, $usersSelectedRoles))) {
595
  return false;
596
  }
597
 
files/sg_popup_media_button.php CHANGED
@@ -52,7 +52,7 @@ function sgpbPopupVariable()
52
 
53
  require_once(ABSPATH .'wp-admin/includes/screen.php');
54
  $currentScreen = get_current_screen();
55
- $currentPageParams = get_object_vars($currentScreen);
56
 
57
  if ($currentPageParams['id'] != 'popup-builder_page_edit-popup') {
58
  return '';
52
 
53
  require_once(ABSPATH .'wp-admin/includes/screen.php');
54
  $currentScreen = get_current_screen();
55
+ $currentPageParams = @get_object_vars($currentScreen);
56
 
57
  if ($currentPageParams['id'] != 'popup-builder_page_edit-popup') {
58
  return '';
helpers/SgPopupGetData.php CHANGED
@@ -24,12 +24,12 @@ class SgPopupGetData {
24
  $optionType = strtolower($optionType);
25
  $optionFunctionName = 'get'.ucfirst($optionType).'Options';
26
  $options = self::$optionFunctionName();
27
-
28
 
29
  if(isset($options[$optionName])) {
30
  return $options[$optionName];
31
  }
32
-
33
  $deafaultValues = self::getDefaultValues();
34
  $deafultSettings = $deafaultValues[$optionType.'Params'];
35
 
24
  $optionType = strtolower($optionType);
25
  $optionFunctionName = 'get'.ucfirst($optionType).'Options';
26
  $options = self::$optionFunctionName();
27
+
28
 
29
  if(isset($options[$optionName])) {
30
  return $options[$optionName];
31
  }
32
+
33
  $deafaultValues = self::getDefaultValues();
34
  $deafultSettings = $deafaultValues[$optionType.'Params'];
35
 
javascript/NewYear.js DELETED
@@ -1,30 +0,0 @@
1
- function SGPBNewYear() {
2
-
3
- }
4
-
5
- SGPBNewYear.prototype.init = function() {
6
-
7
- var dontSowAgain = jQuery('.sgpb-new-year-dont-show');
8
-
9
- if (!dontSowAgain.length) {
10
- return false;
11
- }
12
-
13
- dontSowAgain.bind('click', function() {
14
- jQuery('.sg-info-panel-wrapper').remove();
15
- var nonce = jQuery(this).attr('data-ajaxnonce');
16
- var data = {
17
- nonce: nonce,
18
- action: 'sgpbNewYear'
19
- };
20
-
21
- jQuery.post(ajaxurl, data, function() {
22
-
23
- })
24
- });
25
- };
26
-
27
- jQuery(document).ready(function() {
28
- var newYearObj = new SGPBNewYear();
29
- newYearObj.init();
30
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
javascript/sg_popup_backend.js CHANGED
@@ -633,7 +633,7 @@ beckend.prototype.popupPreview = function () {
633
  },
634
  popupDta: jQuery("#add-form").serialize()
635
  };
636
- var newWindow = window.open(jQuery(this).attr('data-page-url'));
637
  jQuery.post(ajaxurl, data, function(response,d) {
638
  var popupId = parseInt(response);
639
  if(isNaN(popupId)) {
@@ -643,7 +643,7 @@ beckend.prototype.popupPreview = function () {
643
  previewButton.prop('disabled', false);
644
  previewButton.val('Preview');
645
  var pageUrl = previewButton.attr('data-page-url');
646
- var redirectUrl = that.updateQueryStringParameter(pageUrl, 'sg_popup_id', popupId);
647
  newWindow.location = redirectUrl;
648
  });
649
  })
633
  },
634
  popupDta: jQuery("#add-form").serialize()
635
  };
636
+ var newWindow = window.open('');
637
  jQuery.post(ajaxurl, data, function(response,d) {
638
  var popupId = parseInt(response);
639
  if(isNaN(popupId)) {
643
  previewButton.prop('disabled', false);
644
  previewButton.val('Preview');
645
  var pageUrl = previewButton.attr('data-page-url');
646
+ var redirectUrl = that.updateQueryStringParameter(pageUrl, 'sg_popup_preview_id', popupId);
647
  newWindow.location = redirectUrl;
648
  });
649
  })
javascript/sg_popup_frontend.js CHANGED
@@ -467,6 +467,40 @@ SGPopup.prototype.getPositionPercent = function (needPercent, screenDimension, d
467
  return sgPosition;
468
  };
469
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
  SGPopup.prototype.showPopup = function (id, isOnLoad) {
471
 
472
  var that = this;
@@ -479,6 +513,11 @@ SGPopup.prototype.showPopup = function (id, isOnLoad) {
479
  if (typeof SG_POPUP_DATA[id] == "undefined") {
480
  return;
481
  }
 
 
 
 
 
482
  this.popupData = SG_POPUP_DATA[id];
483
  this.popupType = this.popupData['type'];
484
  this.isOnLoad = isOnLoad;
@@ -1177,6 +1216,7 @@ SGPopup.prototype.sgShowColorboxWithOptions = function () {
1177
  overlayCutsomClassName: overlayCustomClass,
1178
  contentCustomClassName: contentCustomClass,
1179
  onOpen: function () {
 
1180
  if(that.sgColorboxInline) {
1181
  var contentImage = jQuery(that.sgColorboxHref).find('img').first();
1182
  if(contentImage.length) {
@@ -1234,6 +1274,7 @@ SGPopup.prototype.sgShowColorboxWithOptions = function () {
1234
  jQuery('#sgcolorbox').trigger("sgPopupCleanup", []);
1235
  },
1236
  onClosed: function () {
 
1237
  jQuery("#sgcboxLoadedContent").removeClass("sg-current-popup-" + that.popupData['id']);
1238
  jQuery('#sgcolorbox').trigger("sgPopupClose", []);
1239
  },
@@ -1259,8 +1300,9 @@ SGPopup.prototype.sgShowColorboxWithOptions = function () {
1259
  /*colorbox open speed*/
1260
  SG_POPUP_SETTINGS.speed = 10;
1261
  }
1262
- jQuery.sgcolorbox(SG_POPUP_SETTINGS);
1263
-
 
1264
 
1265
  if (countryStatus == true && typeof SgUserData != "undefined") {
1266
  jQuery.cookie("SG_POPUP_USER_COUNTRY_NAME", SgUserData.countryIsoName, {expires: 365});
467
  return sgPosition;
468
  };
469
 
470
+ SGPopup.prototype.getPreviewPopupId = function(popupId)
471
+ {
472
+ var currentUrl = window.location.href;
473
+
474
+ var classSplitArray = currentUrl.split('sg_popup_preview_id=');
475
+ var classIdString = classSplitArray['1'];
476
+
477
+ if (typeof classIdString == 'undefined') {
478
+ return false;
479
+ }
480
+ /*Get first all number from string*/
481
+ var urlId = classIdString.match(/^\d+/);
482
+
483
+ return urlId;
484
+ };
485
+
486
+ SGPopup.prototype.currentPopupId = false;
487
+
488
+ SGPopup.prototype.restrictIfThereIsPreviewPopup = function(popupId)
489
+ {
490
+ var previewPopupId = this.getPreviewPopupId();
491
+ if (previewPopupId) {
492
+ if (popupId != previewPopupId) {
493
+ return false;
494
+ }
495
+
496
+ if (this.currentPopupId) {
497
+ return false;
498
+ }
499
+ }
500
+
501
+ return true;
502
+ };
503
+
504
  SGPopup.prototype.showPopup = function (id, isOnLoad) {
505
 
506
  var that = this;
513
  if (typeof SG_POPUP_DATA[id] == "undefined") {
514
  return;
515
  }
516
+
517
+ if (!this.restrictIfThereIsPreviewPopup(id)) {
518
+ return false;
519
+ }
520
+
521
  this.popupData = SG_POPUP_DATA[id];
522
  this.popupType = this.popupData['type'];
523
  this.isOnLoad = isOnLoad;
1216
  overlayCutsomClassName: overlayCustomClass,
1217
  contentCustomClassName: contentCustomClass,
1218
  onOpen: function () {
1219
+ that.currentPopupId = popupId;
1220
  if(that.sgColorboxInline) {
1221
  var contentImage = jQuery(that.sgColorboxHref).find('img').first();
1222
  if(contentImage.length) {
1274
  jQuery('#sgcolorbox').trigger("sgPopupCleanup", []);
1275
  },
1276
  onClosed: function () {
1277
+ that.currentPopupId = false;
1278
  jQuery("#sgcboxLoadedContent").removeClass("sg-current-popup-" + that.popupData['id']);
1279
  jQuery('#sgcolorbox').trigger("sgPopupClose", []);
1280
  },
1300
  /*colorbox open speed*/
1301
  SG_POPUP_SETTINGS.speed = 10;
1302
  }
1303
+ if (!that.currentPopupId) {
1304
+ jQuery.sgcolorbox(SG_POPUP_SETTINGS);
1305
+ }
1306
 
1307
  if (countryStatus == true && typeof SgUserData != "undefined") {
1308
  jQuery.cookie("SG_POPUP_USER_COUNTRY_NAME", SgUserData.countryIsoName, {expires: 365});
popup-builder.php CHANGED
@@ -3,56 +3,48 @@
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.7.4
7
  * Author: Sygnoos
8
  * Author URI: https://sygnoos.com
9
  * License: GPLv2
10
  */
11
 
12
- require_once(dirname(__FILE__)."/config.php");
13
- require_once(SG_APP_POPUP_HELPERS .'/Helper_functions.php');
14
  HelperFunctions::checkRequirements();
15
 
16
- require_once(SG_APP_POPUP_PATH ."/classes/SGPBExtensionManager.php");
17
  require_once(SG_APP_POPUP_PATH . "/classes/SGPBExtensionsConnector.php");
18
- require_once(SG_APP_POPUP_CLASSES .'/SGPopupBuilderMain.php');
19
 
20
  $mainPopupObj = new SGPopupBuilderMain();
21
  $mainPopupObj->init();
22
 
23
- require_once(SG_APP_POPUP_CLASSES .'/SgRegistry.php');
24
- require_once(SG_APP_POPUP_CLASSES .'/SGPopup.php');
25
- require_once(SG_APP_POPUP_CLASSES .'/SGPBExtension.php');
26
- require_once(SG_APP_POPUP_FILES .'/sg_functions.php');
27
- require_once(SG_APP_POPUP_HELPERS .'/Integrate_external_settings.php');
28
- require_once(SG_APP_POPUP_HELPERS .'/SgPopupGetData.php');
29
 
30
- require_once(SG_APP_POPUP_CLASSES .'/PopupInstaller.php'); //cretae tables
31
 
32
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
33
- require_once( SG_APP_POPUP_CLASSES .'/PopupProInstaller.php'); //uninstall tables
34
- require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php"); // Pro functions
35
  }
36
- require_once(SG_APP_POPUP_PATH .'/style/sg_popup_style.php' ); //include our css file
37
- require_once(SG_APP_POPUP_JS .'/sg_popup_javascript.php' ); //include our js file
38
- require_once(SG_APP_POPUP_FILES .'/sg_popup_page_selection.php' ); // include here in page button for select popup every page
39
 
40
  register_activation_hook(__FILE__, 'sgPopupActivate');
41
-
42
  add_action('wpmu_new_blog', 'sgNewBlogPopup', 10, 6);
43
 
44
- function sgNewBlogPopup()
45
- {
46
- PopupInstaller::install();
47
- if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
48
- PopupProInstaller::install();
49
- }
50
- }
51
 
52
- function sgPopupActivate()
53
- {
54
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
55
  PopupInstaller::install();
 
56
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
57
  try {
58
  PopupProInstaller::addExtensionToPluginSection();
@@ -67,6 +59,14 @@ function sgPopupActivate()
67
  $extensionConnectionObj->activate(true);
68
  }
69
 
 
 
 
 
 
 
 
 
70
  function sgRegisterScripts()
71
  {
72
  SGPopup::$registeredScripts = true;
@@ -91,7 +91,7 @@ function sgRegisterScripts()
91
  wp_enqueue_script('sg_popup_queue');
92
  }
93
  /* For ajax case */
94
- if (defined( 'DOING_AJAX' ) && DOING_AJAX && !is_admin()) {
95
  wp_print_scripts('sg_popup_frontend');
96
  wp_print_scripts('sg_colorbox');
97
  wp_print_scripts('sg_popup_support_plugins');
@@ -105,7 +105,7 @@ function sgRegisterScripts()
105
 
106
  function sgRenderPopupScript($id)
107
  {
108
- if (SGPopup::$registeredScripts==false) {
109
  sgRegisterScripts();
110
  }
111
  $extensionManagerObj = new SGPBExtensionManager();
@@ -124,10 +124,10 @@ function sgFindPopupData($id)
124
 
125
  if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_PLATINUM) {
126
  $userCountryIso = SGFunctions::getUserLocationData($id);
127
- if(!is_bool($userCountryIso)) {
128
  echo "<script type='text/javascript'>SgUserData = {
129
- 'countryIsoName': '$userCountryIso'
130
- }</script>";
131
  }
132
  }
133
 
@@ -144,44 +144,48 @@ function sgShowShortCode($args, $content)
144
  return $content;
145
  }
146
  /*When inside popup short code content is empty*/
147
- if(isset($args['insidepopup']) && empty($content)) {
148
  return;
149
  }
150
- if(!empty($content)) {
151
- sgRenderPopupScript($args['id']);
152
  $attr = '';
153
  $eventName = @$args['event'];
154
 
155
- if(isset($args['insidepopup'])) {
156
  $attr .= 'insidePopup="on"';
 
 
 
 
 
157
  }
158
- if(@$args['event'] == 'onload') {
 
 
 
159
  $content = '';
160
  }
161
- if(!isset($args['event'])) {
162
  $eventName = 'click';
163
  }
164
- if(isset($args["wrap"])) {
165
- echo "<".$args["wrap"]." class='sg-show-popup' data-sgpopupid=".@$args['id']." $attr data-popup-event=".$eventName.">".$content."</".$args["wrap"]." >";
166
  } else {
167
- echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=".@$args['id']." $attr data-popup-event=".$eventName.">".$content."</a>";
168
  }
169
- }
170
- else {
171
  /* Free user does not have QUEUE possibility */
172
- if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
173
  $page = get_queried_object_id();
174
- $popupsId = SgPopupPro::allowPopupInAllPages($page,'page');
175
 
176
  /* Add shordcode popup id in the QUEUE for php side */
177
- array_push($popupsId,$args['id']);
178
  /* Add shordcode popup id at the first in the QUEUE for javascript side */
179
- echo "<script type=\"text/javascript\">SG_POPUPS_QUEUE.splice(0, 0, ".$args['id'].");</script>";
180
- update_option("SG_MULTIPLE_POPUP",$popupsId);
181
  showPopupInPage($args['id']);
182
-
183
- }
184
- else {
185
  echo showPopupInPage($args['id']);
186
  }
187
 
@@ -206,32 +210,33 @@ function sgRenderPopupOpen($popupId)
206
  </script>";
207
  }
208
 
209
- function showPopupInPage($popupId) {
 
210
 
211
  $isActivePopup = SgPopupGetData::isActivePopup($popupId);
212
 
213
- if(!$isActivePopup) {
214
  return false;
215
  }
216
 
217
- if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
218
 
219
  $popupInTimeRange = SgPopupPro::popupInTimeRange($popupId);
220
 
221
- if(!$popupInTimeRange) {
222
  return false;
223
  }
224
 
225
  $isInSchedule = SgPopupPro::popupInSchedule($popupId);
226
 
227
- if(!$isInSchedule) {
228
  return;
229
  }
230
 
231
  $showUser = SgPopupPro::showUserResolution($popupId);
232
- if(!$showUser) return false;
233
 
234
- if(!SGPopup::showPopupForCounrty($popupId)) { /* Sended popupId and function return true or false */
235
  return;
236
  }
237
  }
@@ -243,18 +248,18 @@ function redenderScriptMode($popupId)
243
  /* If user delete popup */
244
  $obj = SGPopup::findById($popupId);
245
 
246
- if(empty($obj)) {
247
  return;
248
  }
249
 
250
  $multiplePopup = get_option('SG_MULTIPLE_POPUP');
251
  $hasEvent = SGPBExtension::hasPopupEvent($popupId);
252
 
253
- if($hasEvent != 0) {
254
  sgRenderPopupScript($popupId);
255
  return;
256
  }
257
- if($multiplePopup && @in_array($popupId, $multiplePopup)) {
258
  sgRenderPopupScript($popupId);
259
  return;
260
  }
@@ -275,13 +280,13 @@ function getPopupIdFromContentByClass($content)
275
 
276
  foreach ($popupClasses as $popupClassName) {
277
 
278
- preg_match_all("/".$popupClassName."+[0-9]+/i", $content, $matchers);
279
 
280
  foreach ($matchers['0'] as $value) {
281
  $ids = explode($popupClassName, $value);
282
  $id = @$ids[1];
283
 
284
- if(!empty($id)) {
285
  array_push($popupsID, $id);
286
  }
287
  }
@@ -290,21 +295,22 @@ function getPopupIdFromContentByClass($content)
290
  return $popupsID;
291
  }
292
 
293
- function getPopupIdInPageByClass($pageId) {
 
294
 
295
  $postContentObj = get_post($pageId);
296
 
297
- if(isset($postContentObj)) {
298
  $content = $postContentObj->post_content;
299
 
300
  /*this will return template for the current page*/
301
  $templatePath = get_page_template();
302
 
303
- if(!empty($templatePath)) {
304
  $content .= file_get_contents($templatePath);
305
  }
306
 
307
- if(isset($postContentObj->post_excerpt)) {
308
  $content .= $postContentObj->post_excerpt;
309
  }
310
  return getPopupIdFromContentByClass($content);
@@ -323,24 +329,28 @@ function getPopupIdInPageByClass($pageId) {
323
  *
324
  */
325
 
326
- function getPopupIdFromUrl() {
 
327
 
328
  $popupId = 0;
329
- if(!isset($_SERVER['REQUEST_URI'])) {
330
  return $popupId;
331
  }
332
 
333
  $pageUrl = @$_SERVER['REQUEST_URI'];
 
334
 
335
- preg_match("/sg_popup_id=+[0-9]+/i", $pageUrl, $match);
 
336
 
337
- if(!empty($match)) {
338
- $matchingNumber = explode("=", $match[0]);
339
- if(!empty($matchingNumber[1])) {
340
- $popupId = (int)$matchingNumber[1];
341
- return $popupId;
 
 
342
  }
343
- return 0;
344
  }
345
 
346
  return 0;
@@ -359,14 +369,14 @@ function sgOnloadPopup()
359
  /* get popup id in page url */
360
  $popupIdInPageUrl = getPopupIdFromUrl();
361
 
362
- if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE){
363
  delete_option("SG_MULTIPLE_POPUP");
364
 
365
  /* Retrun all popups id width selected On All Pages */
366
- $popupsId = SgPopupPro::allowPopupInAllPages($page,'page');
367
  $categories = SgPopupPro::allowPopupInAllCategories($page);
368
 
369
- $popupsId = array_merge($popupsId,$categories);
370
 
371
  $sgpbAllPosts = get_option("SG_ALL_POSTS");
372
 
@@ -374,46 +384,44 @@ function sgOnloadPopup()
374
  $popupsId = array_merge($popupsInAllPosts, $popupsId);
375
 
376
  /* $popupsId[0] its last selected popup id */
377
- if(isset($popupsId[0])) {
378
- if(count($popupsId) > 0) {
379
- update_option("SG_MULTIPLE_POPUP",$popupsId);
380
  }
381
  foreach ($popupsId as $queuePupupId) {
382
 
383
  showPopupInPage($queuePupupId);
384
  }
385
-
386
  $popupsId = json_encode($popupsId);
387
- }
388
- else {
389
  $popupsId = json_encode(array());
390
  }
391
  $popupsId = SgPopupPro::filterForRandomIds($popupsId);
392
 
393
- echo '<script type="text/javascript">
394
- SG_POPUPS_QUEUE = '.$popupsId.'</script>';
395
  }
396
 
397
  //If popup is set for all pages
398
- if($popupId != 0) {
399
  showPopupInPage($popupId);
400
  }
401
 
402
- if(!empty($popupsIdByClass)) {
403
  foreach ($popupsIdByClass as $popupId) {
404
  sgRenderPopupScript($popupId);
405
  }
406
  }
407
- if($popupIdInPageUrl) {
408
  showPopupInPage($popupIdInPageUrl);
409
  }
410
  return false;
411
  }
412
 
413
  add_filter('wp_nav_menu_items', 'getPopupIdByClassFromMenu');
414
- function getPopupIdByClassFromMenu ($items) {
415
- $popupsID = getPopupIdFromContentByClass($items);
416
- if(!empty($popupsID)) {
 
417
  foreach ($popupsID as $popupId) {
418
  sgRenderPopupScript($popupId);
419
  }
@@ -421,13 +429,13 @@ function getPopupIdByClassFromMenu ($items) {
421
  return $items;
422
  }
423
 
424
- add_action('wp_head','sgOnloadPopup');
425
- require_once( SG_APP_POPUP_FILES . '/sg_popup_media_button.php');
426
- require_once( SG_APP_POPUP_FILES . '/sg_popup_save.php'); // saving form data
427
- require_once( SG_APP_POPUP_FILES . '/sg_popup_ajax.php');
428
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
429
  require_once(SG_APP_POPUP_FILES . '/sg_popup_ajax_pro.php');
430
  }
431
- require_once( SG_APP_POPUP_FILES . '/sg_admin_post.php');
432
- require_once( SG_APP_POPUP_FILES . '/sg_popup_filetrs.php');
433
- require_once( SG_APP_POPUP_FILES . '/sg_popup_actions.php');
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.7.5
7
  * Author: Sygnoos
8
  * Author URI: https://sygnoos.com
9
  * License: GPLv2
10
  */
11
 
12
+ require_once(dirname(__FILE__) . "/config.php");
13
+ require_once(SG_APP_POPUP_HELPERS . '/Helper_functions.php');
14
  HelperFunctions::checkRequirements();
15
 
16
+ require_once(SG_APP_POPUP_PATH . "/classes/SGPBExtensionManager.php");
17
  require_once(SG_APP_POPUP_PATH . "/classes/SGPBExtensionsConnector.php");
18
+ require_once(SG_APP_POPUP_CLASSES . '/SGPopupBuilderMain.php');
19
 
20
  $mainPopupObj = new SGPopupBuilderMain();
21
  $mainPopupObj->init();
22
 
23
+ require_once(SG_APP_POPUP_CLASSES . '/SgRegistry.php');
24
+ require_once(SG_APP_POPUP_CLASSES . '/SGPopup.php');
25
+ require_once(SG_APP_POPUP_CLASSES . '/SGPBExtension.php');
26
+ require_once(SG_APP_POPUP_FILES . '/sg_functions.php');
27
+ require_once(SG_APP_POPUP_HELPERS . '/Integrate_external_settings.php');
28
+ require_once(SG_APP_POPUP_HELPERS . '/SgPopupGetData.php');
29
 
30
+ require_once(SG_APP_POPUP_CLASSES . '/PopupInstaller.php'); //cretae tables
31
 
32
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
33
+ require_once(SG_APP_POPUP_CLASSES . '/PopupProInstaller.php'); //uninstall tables
34
+ require_once(SG_APP_POPUP_FILES . "/sg_popup_pro.php"); // Pro functions
35
  }
36
+ require_once(SG_APP_POPUP_PATH . '/style/sg_popup_style.php'); //include our css file
37
+ require_once(SG_APP_POPUP_JS . '/sg_popup_javascript.php'); //include our js file
38
+ require_once(SG_APP_POPUP_FILES . '/sg_popup_page_selection.php'); // include here in page button for select popup every page
39
 
40
  register_activation_hook(__FILE__, 'sgPopupActivate');
 
41
  add_action('wpmu_new_blog', 'sgNewBlogPopup', 10, 6);
42
 
43
+ function sgPopupActivate() {
 
 
 
 
 
 
44
 
 
 
45
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
46
  PopupInstaller::install();
47
+
48
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
49
  try {
50
  PopupProInstaller::addExtensionToPluginSection();
59
  $extensionConnectionObj->activate(true);
60
  }
61
 
62
+ function sgNewBlogPopup() {
63
+
64
+ PopupInstaller::install();
65
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
66
+ PopupProInstaller::install();
67
+ }
68
+ }
69
+
70
  function sgRegisterScripts()
71
  {
72
  SGPopup::$registeredScripts = true;
91
  wp_enqueue_script('sg_popup_queue');
92
  }
93
  /* For ajax case */
94
+ if (defined('DOING_AJAX') && DOING_AJAX && !is_admin()) {
95
  wp_print_scripts('sg_popup_frontend');
96
  wp_print_scripts('sg_colorbox');
97
  wp_print_scripts('sg_popup_support_plugins');
105
 
106
  function sgRenderPopupScript($id)
107
  {
108
+ if (SGPopup::$registeredScripts == false) {
109
  sgRegisterScripts();
110
  }
111
  $extensionManagerObj = new SGPBExtensionManager();
124
 
125
  if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_PLATINUM) {
126
  $userCountryIso = SGFunctions::getUserLocationData($id);
127
+ if (!is_bool($userCountryIso)) {
128
  echo "<script type='text/javascript'>SgUserData = {
129
+ 'countryIsoName': '$userCountryIso'
130
+ }</script>";
131
  }
132
  }
133
 
144
  return $content;
145
  }
146
  /*When inside popup short code content is empty*/
147
+ if (isset($args['insidepopup']) && empty($content)) {
148
  return;
149
  }
150
+ if (!empty($content)) {
 
151
  $attr = '';
152
  $eventName = @$args['event'];
153
 
154
+ if (isset($args['insidepopup'])) {
155
  $attr .= 'insidePopup="on"';
156
+ global $SGPB_INSIDE_POPUPS;
157
+ if (!in_array($args['id'], $SGPB_INSIDE_POPUPS)) {
158
+ $SGPB_INSIDE_POPUPS[] = $args['id'];
159
+ sgRenderPopupScript($args['id']);
160
+ }
161
  }
162
+ else {
163
+ sgRenderPopupScript($args['id']);
164
+ }
165
+ if (@$args['event'] == 'onload') {
166
  $content = '';
167
  }
168
+ if (!isset($args['event'])) {
169
  $eventName = 'click';
170
  }
171
+ if (isset($args["wrap"])) {
172
+ echo "<" . $args["wrap"] . " class='sg-show-popup' data-sgpopupid=" . @$args['id'] . " $attr data-popup-event=" . $eventName . ">" . $content . "</" . $args["wrap"] . " >";
173
  } else {
174
+ echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=" . @$args['id'] . " $attr data-popup-event=" . $eventName . ">" . $content . "</a>";
175
  }
176
+ } else {
 
177
  /* Free user does not have QUEUE possibility */
178
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
179
  $page = get_queried_object_id();
180
+ $popupsId = SgPopupPro::allowPopupInAllPages($page, 'page');
181
 
182
  /* Add shordcode popup id in the QUEUE for php side */
183
+ array_push($popupsId, $args['id']);
184
  /* Add shordcode popup id at the first in the QUEUE for javascript side */
185
+ echo "<script type=\"text/javascript\">SG_POPUPS_QUEUE.splice(0, 0, " . $args['id'] . ");</script>";
186
+ update_option("SG_MULTIPLE_POPUP", $popupsId);
187
  showPopupInPage($args['id']);
188
+ } else {
 
 
189
  echo showPopupInPage($args['id']);
190
  }
191
 
210
  </script>";
211
  }
212
 
213
+ function showPopupInPage($popupId)
214
+ {
215
 
216
  $isActivePopup = SgPopupGetData::isActivePopup($popupId);
217
 
218
+ if (!$isActivePopup) {
219
  return false;
220
  }
221
 
222
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
223
 
224
  $popupInTimeRange = SgPopupPro::popupInTimeRange($popupId);
225
 
226
+ if (!$popupInTimeRange) {
227
  return false;
228
  }
229
 
230
  $isInSchedule = SgPopupPro::popupInSchedule($popupId);
231
 
232
+ if (!$isInSchedule) {
233
  return;
234
  }
235
 
236
  $showUser = SgPopupPro::showUserResolution($popupId);
237
+ if (!$showUser) return false;
238
 
239
+ if (!SGPopup::showPopupForCounrty($popupId)) { /* Sended popupId and function return true or false */
240
  return;
241
  }
242
  }
248
  /* If user delete popup */
249
  $obj = SGPopup::findById($popupId);
250
 
251
+ if (empty($obj)) {
252
  return;
253
  }
254
 
255
  $multiplePopup = get_option('SG_MULTIPLE_POPUP');
256
  $hasEvent = SGPBExtension::hasPopupEvent($popupId);
257
 
258
+ if ($hasEvent != 0) {
259
  sgRenderPopupScript($popupId);
260
  return;
261
  }
262
+ if ($multiplePopup && @in_array($popupId, $multiplePopup)) {
263
  sgRenderPopupScript($popupId);
264
  return;
265
  }
280
 
281
  foreach ($popupClasses as $popupClassName) {
282
 
283
+ preg_match_all("/" . $popupClassName . "+[0-9]+/i", $content, $matchers);
284
 
285
  foreach ($matchers['0'] as $value) {
286
  $ids = explode($popupClassName, $value);
287
  $id = @$ids[1];
288
 
289
+ if (!empty($id)) {
290
  array_push($popupsID, $id);
291
  }
292
  }
295
  return $popupsID;
296
  }
297
 
298
+ function getPopupIdInPageByClass($pageId)
299
+ {
300
 
301
  $postContentObj = get_post($pageId);
302
 
303
+ if (isset($postContentObj)) {
304
  $content = $postContentObj->post_content;
305
 
306
  /*this will return template for the current page*/
307
  $templatePath = get_page_template();
308
 
309
+ if (!empty($templatePath)) {
310
  $content .= file_get_contents($templatePath);
311
  }
312
 
313
+ if (isset($postContentObj->post_excerpt)) {
314
  $content .= $postContentObj->post_excerpt;
315
  }
316
  return getPopupIdFromContentByClass($content);
329
  *
330
  */
331
 
332
+ function getPopupIdFromUrl()
333
+ {
334
 
335
  $popupId = 0;
336
+ if (!isset($_SERVER['REQUEST_URI'])) {
337
  return $popupId;
338
  }
339
 
340
  $pageUrl = @$_SERVER['REQUEST_URI'];
341
+ $byUrlkeys = array('sg_popup_id', 'sg_popup_preview_id');
342
 
343
+ foreach ($byUrlkeys as $urlkey) {
344
+ preg_match("/".$urlkey."=+[0-9]+/i", $pageUrl, $match);
345
 
346
+ if (!empty($match)) {
347
+ $matchingNumber = explode("=", $match[0]);
348
+ if (!empty($matchingNumber[1])) {
349
+ $popupId = (int)$matchingNumber[1];
350
+ return $popupId;
351
+ }
352
+ return 0;
353
  }
 
354
  }
355
 
356
  return 0;
369
  /* get popup id in page url */
370
  $popupIdInPageUrl = getPopupIdFromUrl();
371
 
372
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
373
  delete_option("SG_MULTIPLE_POPUP");
374
 
375
  /* Retrun all popups id width selected On All Pages */
376
+ $popupsId = SgPopupPro::allowPopupInAllPages($page, 'page');
377
  $categories = SgPopupPro::allowPopupInAllCategories($page);
378
 
379
+ $popupsId = array_merge($popupsId, $categories);
380
 
381
  $sgpbAllPosts = get_option("SG_ALL_POSTS");
382
 
384
  $popupsId = array_merge($popupsInAllPosts, $popupsId);
385
 
386
  /* $popupsId[0] its last selected popup id */
387
+ if (isset($popupsId[0])) {
388
+ if (count($popupsId) > 0) {
389
+ update_option("SG_MULTIPLE_POPUP", $popupsId);
390
  }
391
  foreach ($popupsId as $queuePupupId) {
392
 
393
  showPopupInPage($queuePupupId);
394
  }
 
395
  $popupsId = json_encode($popupsId);
396
+ } else {
 
397
  $popupsId = json_encode(array());
398
  }
399
  $popupsId = SgPopupPro::filterForRandomIds($popupsId);
400
 
401
+ echo '<script type="text/javascript">SG_POPUPS_QUEUE = '.$popupsId.';</script>';
 
402
  }
403
 
404
  //If popup is set for all pages
405
+ if ($popupId != 0) {
406
  showPopupInPage($popupId);
407
  }
408
 
409
+ if (!empty($popupsIdByClass)) {
410
  foreach ($popupsIdByClass as $popupId) {
411
  sgRenderPopupScript($popupId);
412
  }
413
  }
414
+ if ($popupIdInPageUrl) {
415
  showPopupInPage($popupIdInPageUrl);
416
  }
417
  return false;
418
  }
419
 
420
  add_filter('wp_nav_menu_items', 'getPopupIdByClassFromMenu');
421
+ function getPopupIdByClassFromMenu($items)
422
+ {
423
+ $popupsID = getPopupIdFromContentByClass($items);
424
+ if (!empty($popupsID)) {
425
  foreach ($popupsID as $popupId) {
426
  sgRenderPopupScript($popupId);
427
  }
429
  return $items;
430
  }
431
 
432
+ add_action('wp_head', 'sgOnloadPopup');
433
+ require_once(SG_APP_POPUP_FILES . '/sg_popup_media_button.php');
434
+ require_once(SG_APP_POPUP_FILES . '/sg_popup_save.php'); // saving form data
435
+ require_once(SG_APP_POPUP_FILES . '/sg_popup_ajax.php');
436
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
437
  require_once(SG_APP_POPUP_FILES . '/sg_popup_ajax_pro.php');
438
  }
439
+ require_once(SG_APP_POPUP_FILES . '/sg_admin_post.php');
440
+ require_once(SG_APP_POPUP_FILES . '/sg_popup_filetrs.php');
441
+ require_once(SG_APP_POPUP_FILES . '/sg_popup_actions.php');
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author: Popup Builder
5
  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.9.4
9
  Requires PHP: 5.3.3
10
  Stable tag: trunk
11
  License: GPLv2 or later
@@ -78,11 +78,11 @@ With Popup Builder plugin you can insert any type of content, right into your Po
78
 
79
  * Create countdown popup - your site is under construction and you are planning to open it in some amount of time, in this case countdown popup is exactly for you.
80
 
81
- * Exit popup - catch your users attention when they decide to leave your site without doing any of the things you want them to do. Exit popups can briefly interrupt them with a popup message, steering them towards a singular call to action.
82
 
83
  * Subscription popup - this type provides the easiest way to create an efficient connection between users and your website through subscription popup. With this simple popup solution, you can quickly collect subscribers in a very pleasant and elegant way. With our newsletter module you can easily send mass mailings.
84
 
85
- * Create contact form popup this type will allow your clients to write you a message right from the popup.
86
 
87
  * MailChimp popup (separate extension) - create eye-catching, beautiful MailChimp popups to make your users sign up to the mail list right from the popup. You can set up all the design customization according to your needs and preferences!
88
 
@@ -170,6 +170,11 @@ Go to the Popup Builder settings and set your desired options.
170
 
171
  == Changelog ==
172
 
 
 
 
 
 
173
  = Version 2.6.7.4 =
174
  * Video popup improvements connected to full screen option
175
  * Popup integration's path fixed
@@ -822,7 +827,7 @@ Image popup is the best way to deal with this problem; the best way to make your
822
 
823
  It is so wonderful and advantageous that more and more people take up the business of Internet content creation, as each of them tries to enrich us with marvelous tools to make use of in different spheres. Some are the authors of tooltips, column layouts, galleries, others of buttons, block quotes, social media buttons, etc.. All of the latter can be inserted into any of your content, page or post in the form of a short code which will be opened in a popup window.
824
  Besides having the ability to add a short code into the modal popup, it is also possible to manage its development with the help of different options available. First, you can apply a certain theme and/or effect to it, decide how long its appearance should be delayed after loading the page. Then, you will be able to configure the display and dismissal of the popup by choosing it to be closed automatically or by hand, be opened while scrolling or be a permanent one. Also, you are to decide where the popup will be located.
825
- As far as the popup accessibility on different devices is freely manageable too, its quite responsive and is resized accordingly.
826
 
827
 
828
  = Iframe Popup =
5
  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.9.5
9
  Requires PHP: 5.3.3
10
  Stable tag: trunk
11
  License: GPLv2 or later
78
 
79
  * Create countdown popup - your site is under construction and you are planning to open it in some amount of time, in this case countdown popup is exactly for you.
80
 
81
+ * Exit popup - catch your users’ attention when they decide to leave your site without doing any of the things you want them to do. Exit popups can briefly interrupt them with a popup message, steering them towards a singular call to action.
82
 
83
  * Subscription popup - this type provides the easiest way to create an efficient connection between users and your website through subscription popup. With this simple popup solution, you can quickly collect subscribers in a very pleasant and elegant way. With our newsletter module you can easily send mass mailings.
84
 
85
+ * Create contact form popup – this type will allow your clients to write you a message right from the popup.
86
 
87
  * MailChimp popup (separate extension) - create eye-catching, beautiful MailChimp popups to make your users sign up to the mail list right from the popup. You can set up all the design customization according to your needs and preferences!
88
 
170
 
171
  == Changelog ==
172
 
173
+ = Version 2.6.7.5 =
174
+ * Improvements connected to popup preview.
175
+ * Bug fixes connected to user roles who can use the plugin
176
+ * Code optimization.
177
+
178
  = Version 2.6.7.4 =
179
  * Video popup improvements connected to full screen option
180
  * Popup integration's path fixed
827
 
828
  It is so wonderful and advantageous that more and more people take up the business of Internet content creation, as each of them tries to enrich us with marvelous tools to make use of in different spheres. Some are the authors of tooltips, column layouts, galleries, others of buttons, block quotes, social media buttons, etc.. All of the latter can be inserted into any of your content, page or post in the form of a short code which will be opened in a popup window.
829
  Besides having the ability to add a short code into the modal popup, it is also possible to manage its development with the help of different options available. First, you can apply a certain theme and/or effect to it, decide how long its appearance should be delayed after loading the page. Then, you will be able to configure the display and dismissal of the popup by choosing it to be closed automatically or by hand, be opened while scrolling or be a permanent one. Also, you are to decide where the popup will be located.
830
+ As far as the popup accessibility on different devices is freely manageable too, it’s quite responsive and is resized accordingly.
831
 
832
 
833
  = Iframe Popup =