Popup Builder – Responsive WordPress Pop up - Version 2.2.5

Version Description

Current Version of Popup Builder is 2.2.4

Download this release

Release Info

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

Code changes from version 2.2.4 to 2.2.5

classes/SGPopup.php CHANGED
@@ -219,7 +219,9 @@ abstract class SGPopup {
219
  }
220
 
221
  public function improveContent($content) {
222
- if(SG_POPUP_PRO) {
 
 
223
  require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php");
224
  return SgPopupPro::sgPopupExtraSanitize($content);
225
  }
@@ -252,29 +254,38 @@ abstract class SGPopup {
252
  return $id;
253
  }
254
 
255
- public static function showPopupForCounrty($contryIsoName, $popupId) {
256
- $obj = SGPopup::findById($popupId);
257
- if(!$obj) {
258
- return true;
259
- }
260
- $isInArray = true;
261
- $options = json_decode($obj->getOptions(), true);
262
-
263
- $countryStatus = $options['countryStatus'];
264
- $countryIso = $options['countryIso'];
265
- $allowCountries = $options['allowCountries'];
266
- $countryIsoArray = explode(',', $countryIso);
267
- if($countryStatus) {
268
- if($allowCountries == 'allow') {
269
- $isInArray = in_array($contryIsoName, $countryIsoArray);
270
- }
271
- if($allowCountries == 'disallow') {
272
- $isInArray = !in_array($contryIsoName, $countryIsoArray);
273
- }
274
- }
275
 
276
- return $isInArray;
277
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
 
279
  public static function addPopupForAllPages($id = '', $selectedData = '') {
280
  global $wpdb;
@@ -283,7 +294,7 @@ abstract class SGPopup {
283
  $insertPreapre = array();
284
 
285
  //Remove page if it is in use for another popup
286
- self::deleteAllPagesPopup($selectedData);
287
 
288
  $insertQuery = "INSERT INTO ". $wpdb->prefix ."sg_popup_in_pages(popupId, pageId) VALUES ";
289
 
@@ -291,7 +302,6 @@ abstract class SGPopup {
291
  $insertPreapre[] .= $wpdb->prepare( "(%d,%d)", $id, $value );
292
  }
293
  $insertQuery .= implode( ",\n", $insertPreapre );
294
-
295
  $res = $wpdb->query($insertQuery);
296
  }
297
 
@@ -321,9 +331,9 @@ abstract class SGPopup {
321
  global $wpdb;
322
 
323
  $st = $wpdb->prepare("SELECT * FROM ". $wpdb->prefix ."sg_popup_in_pages WHERE pageId = %d", $pageId);
324
- $arr = $wpdb->get_row($st, ARRAY_A);
325
  if(!$arr) return false;
326
- return $arr['popupId'];
327
  }
328
 
329
  }
219
  }
220
 
221
  public function improveContent($content) {
222
+ $hasSameShortcode = strpos($content,'id="'.$this->getId().'"');
223
+
224
+ if(POPUP_BUILDER_PKG !== POPUP_BUILDER_PKG_FREE && !$hasSameShortcode) {
225
  require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php");
226
  return SgPopupPro::sgPopupExtraSanitize($content);
227
  }
254
  return $id;
255
  }
256
 
257
+ public static function showPopupForCounrty($popupId) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
 
259
+ $obj = SGPopup::findById($popupId);
260
+
261
+ if(!$obj) {
262
+ return true;
263
+ }
264
+
265
+ $isInArray = true;
266
+ $options = json_decode($obj->getOptions(), true);
267
+
268
+ $countryStatus = $options['countryStatus'];
269
+ $countryIso = $options['countryIso'];
270
+ $allowCountries = $options['allowCountries'];
271
+ $countryIsoArray = explode(',', $countryIso);
272
+
273
+ if($countryStatus) {
274
+
275
+ $ip = SGFunctions::getUserIpAdress();
276
+
277
+ $counrty = SGFunctions::getCountryName($ip);
278
+
279
+ if($allowCountries == 'allow') {
280
+ $isInArray = in_array($counrty, $countryIsoArray);
281
+ }
282
+
283
+ if($allowCountries == 'disallow') {
284
+ $isInArray = !in_array($counrty, $countryIsoArray);
285
+ }
286
+ }
287
+ return $isInArray;
288
+ }
289
 
290
  public static function addPopupForAllPages($id = '', $selectedData = '') {
291
  global $wpdb;
294
  $insertPreapre = array();
295
 
296
  //Remove page if it is in use for another popup
297
+ //self::deleteAllPagesPopup($selectedData);
298
 
299
  $insertQuery = "INSERT INTO ". $wpdb->prefix ."sg_popup_in_pages(popupId, pageId) VALUES ";
300
 
302
  $insertPreapre[] .= $wpdb->prepare( "(%d,%d)", $id, $value );
303
  }
304
  $insertQuery .= implode( ",\n", $insertPreapre );
 
305
  $res = $wpdb->query($insertQuery);
306
  }
307
 
331
  global $wpdb;
332
 
333
  $st = $wpdb->prepare("SELECT * FROM ". $wpdb->prefix ."sg_popup_in_pages WHERE pageId = %d", $pageId);
334
+ $arr = $wpdb->get_results($st, ARRAY_A);
335
  if(!$arr) return false;
336
+ return $arr;
337
  }
338
 
339
  }
config-pkg.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ define('POPUP_BUILDER_PKG', POPUP_BUILDER_PKG_FREE);
config.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ define("SG_APP_POPUP_PATH", dirname(__FILE__));
4
+ define('SG_APP_POPUP_URL', plugins_url('', __FILE__));
5
+ define('SG_APP_POPUP_ADMIN_URL', admin_url());
6
+ define('SG_APP_POPUP_FILE', plugin_basename(__FILE__));
7
+ define('SG_APP_POPUP_FILES', SG_APP_POPUP_PATH . '/files');
8
+ define('SG_APP_POPUP_CLASSES', SG_APP_POPUP_PATH . '/classes');
9
+ define('SG_APP_POPUP_JS', SG_APP_POPUP_PATH . '/javascript');
10
+ define('SG_APP_POPUP_TABLE_LIMIT', 15);
11
+ define('SG_POPUP_VERSION', 2.25);
12
+ define('SG_POPUP_PRO_URL', 'http://sygnoos.com/wordpress-popup/');
13
+ define('SG_IP_TO_COUNTRY_SERVICE_TIMEOUT', 2);
14
+ define('SG_IP_TO_COUNTRY_SERVICE_URL', 'http://sygnoos.in/ip2data/?ip=');
15
+ define('SG_IP_TO_COUNTRY_SERVICE_TOKEN', 'd=b32e509a0c6da4147e7903f4bc0b60aa');
16
+ define("SG_SHOW_POPUP_REVIEW", get_option("SG_COLOSE_REVIEW_BLOCK"));
17
+ define("SG_POSTS_PER_PAGE", 1000);
18
+ define("SG_POST_TYPE_PAGE", "allPages");
19
+ define("SG_POST_TYPE_POST", "allPosts");
20
+
21
+ define('POPUP_BUILDER_PKG_FREE', 1);
22
+ define('POPUP_BUILDER_PKG_SILVER', 2);
23
+ define('POPUP_BUILDER_PKG_GOLD', 3);
24
+ define('POPUP_BUILDER_PKG_PLATINUM', 4);
25
+
26
+ $POPUP_TITLES = array(
27
+ 'image' => 'Image',
28
+ 'html' => 'HTML',
29
+ 'fblike' => 'Facebook',
30
+ 'iframe' => 'Iframe',
31
+ 'video' => 'Video',
32
+ 'shortcode' => 'Shortcode',
33
+ 'ageRestriction' => 'Age Restriction',
34
+ 'countdown' => 'Countdown',
35
+ 'social' => 'Social',
36
+ 'exitIntent' => 'Exit Intent',
37
+ 'subscription' => 'Subscription',
38
+ 'contactForm' => 'Contact Form'
39
+ );
40
+
41
+ require_once(dirname(__FILE__).'/config-pkg.php');
files/main_section/fblike.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class="sg-wp-editor-container">
2
  <?php
3
- if(!SG_POPUP_PRO) {
4
  echo SGFunctions::noticeForShortcode();
5
  }
6
 
1
  <div class="sg-wp-editor-container">
2
  <?php
3
+ if(POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE) {
4
  echo SGFunctions::noticeForShortcode();
5
  }
6
 
files/main_section/html.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class="sg-wp-editor-container">
2
  <?php
3
- if(!SG_POPUP_PRO) {
4
  echo SGFunctions::noticeForShortcode();
5
  }
6
 
1
  <div class="sg-wp-editor-container">
2
  <?php
3
+ if(POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE) {
4
  echo SGFunctions::noticeForShortcode();
5
  }
6
 
files/sg_admin_post.php CHANGED
@@ -52,7 +52,32 @@ function sgPopupClone() {
52
  $title .= "(clone)";
53
  $obj->setId("");
54
  $obj->setTitle($title);
 
 
 
55
  $obj->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=PopupBuilder");
57
  }
58
 
52
  $title .= "(clone)";
53
  $obj->setId("");
54
  $obj->setTitle($title);
55
+
56
+ $options = $obj->getOptions();
57
+ $options = json_decode($options, true);
58
  $obj->save();
59
+
60
+ $cloneId = $obj->getId();
61
+ /* For save popupIn pages table */
62
+ if($options['allPagesStatus']) {
63
+ if(!empty($options['showAllPages']) && $options['showAllPages'] != 'all') {
64
+ update_option("SG_ALL_PAGES", false);
65
+ SGPopup::addPopupForAllPages($cloneId, $options['allSelectedPages']);
66
+ }
67
+ else {
68
+ update_option("SG_ALL_PAGES", $cloneId);
69
+ }
70
+ }
71
+ if($options['allPostsStatus']) {
72
+ if(!empty($options['showAllPosts']) && $options['showAllPosts'] != "all") {
73
+ update_option("SG_ALL_POSTS", false);
74
+ SGPopup::addPopupForAllPages($cloneId, $options['allSelectedPosts']);
75
+ }
76
+ else {
77
+ update_option("SG_ALL_POSTS", $cloneId);
78
+ }
79
+ }
80
+
81
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=PopupBuilder");
82
  }
83
 
files/sg_functions.php CHANGED
@@ -14,20 +14,20 @@ class SGFunctions
14
  public static function addReview()
15
  {
16
  return '<div class="updated updated notice is-dismissible reviewPanel">
17
- <div class="reviewPanelContent">
18
- <span class="reviewPanelSpan">
19
- Dear user, we always do our best to help you and your opinion is very important for us!
20
- </span></br>
21
- <span class="reviewPanelSpan">
22
- So if you liked our <b>Popup Builder Plugin</b> and if our support was helpful for you, we\'ll be thankful if you go ahead and leave a review.
23
- </span>
24
- <span class="reviewPanelSpan">
25
- Please <a class="reviewPanelHref" href="https://wordpress.org/support/view/plugin-reviews/popup-builder?filter=5" target=\"_blank\">rate it 5 stars.</a>
26
- </span>
27
- </div>
28
- <span class="reviewPanelClose">Dont show again</span>
29
- <button type="button" class="notice-dismiss closeButton"></button>
30
- </div>';
31
  }
32
 
33
  public static function noticeForShortcode() {
@@ -78,19 +78,49 @@ class SGFunctions
78
  return $ipaddress;
79
  }
80
 
81
- public static function allowPageCountry($popupId) {
82
- $ip = SGFunctions::getUserIpAdress();
83
- $details = wp_remote_get('https://www.sygnoos.com/ip2data/?ip='.$ip);
84
- if(!is_array($details)) {
85
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  }
87
- $dataIp = json_decode($details['body'], true);
88
- if(!is_array($dataIp)) {
89
- return true;
90
  }
91
- $counrty = @$dataIp['country'];
92
- $returnData = SGPopup::showPopupForCounrty($counrty, $popupId);
93
- return $returnData;
94
  }
95
 
96
  public static function countrisSelect() {
@@ -347,4 +377,4 @@ class SGFunctions
347
  <option value="ZW">Zimbabwe</option>
348
  </select>';
349
  }
350
- }
14
  public static function addReview()
15
  {
16
  return '<div class="updated updated notice is-dismissible reviewPanel">
17
+ <div class="reviewPanelContent">
18
+ <span class="reviewPanelSpan">
19
+ Dear user, we always do our best to help you and your opinion is very important for us!
20
+ </span></br>
21
+ <span class="reviewPanelSpan">
22
+ So if you liked our <b>Popup Builder Plugin</b> and if our support was helpful for you, we\'ll be thankful if you go ahead and leave a review.
23
+ </span>
24
+ <span class="reviewPanelSpan">
25
+ Please <a class="reviewPanelHref" href="https://wordpress.org/support/view/plugin-reviews/popup-builder?filter=5" target=\"_blank\">rate it 5 stars.</a>
26
+ </span>
27
+ </div>
28
+ <span class="reviewPanelClose">Dont show again</span>
29
+ <button type="button" class="notice-dismiss closeButton"></button>
30
+ </div>';
31
  }
32
 
33
  public static function noticeForShortcode() {
78
  return $ipaddress;
79
  }
80
 
81
+ public static function getCountryName($ip)
82
+ {
83
+ if(empty($_COOKIE['SG_POPUP_USER_COUNTRY_NAME'])) {
84
+
85
+ try {
86
+
87
+ $details = wp_remote_get(SG_IP_TO_COUNTRY_SERVICE_URL.$ip."&".SG_IP_TO_COUNTRY_SERVICE_TOKEN, array( 'timeout' => SG_IP_TO_COUNTRY_SERVICE_TIMEOUT));$details = wp_remote_get(SG_IP_TO_COUNTRY_SERVICE_URL.$ip."&".SG_IP_TO_COUNTRY_SERVICE_TOKEN, array( 'timeout' => SG_IP_TO_COUNTRY_SERVICE_TIMEOUT));
88
+ $dataIp = json_decode($details['body'], true);
89
+ if(!is_array($dataIp)) {
90
+ return true;
91
+ }
92
+ $counrty = @$dataIp['country'];
93
+ }
94
+ catch ( Exception $ex ) {
95
+ return true;
96
+ }
97
+
98
+ }
99
+ else {
100
+ $counrty = $_COOKIE['SG_POPUP_USER_COUNTRY_NAME'];
101
+ }
102
+
103
+ return $counrty;
104
+ }
105
+
106
+ public static function getUserLocationData($popupId) {
107
+ $obj = SGPopup::findById($popupId);
108
+ $countryStatus = '';
109
+ $countryName = '';
110
+
111
+ if($obj) {
112
+ $options = json_decode($obj->getOptions(), true);
113
+ $countryStatus = $options['countryStatus'];
114
+ }
115
+
116
+ if(!empty($countryStatus)) {
117
+ $ip = SGFunctions::getUserIpAdress();
118
+ $countryName = SGFunctions::getCountryName($ip);
119
  }
120
+ if(!empty($countryName)) {
121
+ return $countryName;
 
122
  }
123
+ return false;
 
 
124
  }
125
 
126
  public static function countrisSelect() {
377
  <option value="ZW">Zimbabwe</option>
378
  </select>';
379
  }
380
+ }
files/sg_popup_ajax.php CHANGED
@@ -8,6 +8,7 @@ function sgPopupDelete()
8
  }
9
  require_once(SG_APP_POPUP_CLASSES.'/SGPopup.php');
10
  SGPopup::delete($id);
 
11
  }
12
 
13
  add_action('wp_ajax_delete_popup', 'sgPopupDelete');
@@ -105,3 +106,62 @@ function sgCloseReviewPanel() {
105
  update_option('SG_COLOSE_REVIEW_BLOCK', true);
106
  }
107
  add_action('wp_ajax_close_review_panel', 'sgCloseReviewPanel');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
  require_once(SG_APP_POPUP_CLASSES.'/SGPopup.php');
10
  SGPopup::delete($id);
11
+ SGPopup::removePopupFromPages($id);
12
  }
13
 
14
  add_action('wp_ajax_delete_popup', 'sgPopupDelete');
106
  update_option('SG_COLOSE_REVIEW_BLOCK', true);
107
  }
108
  add_action('wp_ajax_close_review_panel', 'sgCloseReviewPanel');
109
+
110
+ function sgLazyLoading() {
111
+
112
+ $popupId = (int)$_POST['popupId'];
113
+ $params = "";
114
+ $postType = $_POST['postType'];
115
+ $loadingNumber = (int)$_POST['loadingNumber'];
116
+
117
+ /* Whem load first time need add Home page in Wp pages */
118
+ if($loadingNumber == 0) {
119
+ $defArray = array(-1=>"Home page");
120
+ }
121
+ else {
122
+ $defArray = array();
123
+ }
124
+
125
+ if($postType == SG_POST_TYPE_PAGE) {
126
+ $pageData = SgPopupPro::getAllData($defArray, 'page', $loadingNumber);
127
+ }
128
+ if($postType == SG_POST_TYPE_POST) {
129
+ $pageData = SgPopupPro::getAllData($defArray, 'post', $loadingNumber);
130
+ }
131
+
132
+ if($loadingNumber > 0 && sizeof($pageData) == 0) {
133
+ die();
134
+ }
135
+
136
+ /* When popup is insert */
137
+ if($popupId != -1) {
138
+ $popup = SGPopup::findById($popupId);
139
+ $options = $popup->getOptions();
140
+ $options = json_decode($options, true);
141
+
142
+ if($postType == SG_POST_TYPE_PAGE) {
143
+ $allSelectedPages = $options['allSelectedPages'];
144
+ }
145
+ else if($postType == SG_POST_TYPE_POST) {
146
+ $allSelectedPages = $options['allSelectedPosts'];
147
+ }
148
+ }
149
+
150
+ foreach ($pageData as $key => $value) {
151
+ /* When have seleced pages data */
152
+ if($popupId != -1) {
153
+ $selected = "";
154
+ if(isset($allSelectedPages) && @in_array($key, $allSelectedPages)) {
155
+ $selected = "selected";
156
+ }
157
+ }
158
+ else {
159
+ $selected = "";
160
+ }
161
+
162
+ $params .= "<option value='".$key."' $selected>$value</option>";
163
+ }
164
+ echo $params;
165
+ die();
166
+ }
167
+ add_action('wp_ajax_lazy_loading', 'sgLazyLoading');
files/sg_popup_create.php CHANGED
@@ -21,7 +21,7 @@ if(!SG_SHOW_POPUP_REVIEW) {
21
  <div class="popups-div shortcode-popup">
22
  </div>
23
  </a>
24
- <?php if(SG_POPUP_PRO): ?>
25
  <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=iframe">
26
  <div class="popups-div iframe-popup">
27
  </div>
@@ -30,8 +30,34 @@ if(!SG_SHOW_POPUP_REVIEW) {
30
  <div class="popups-div video-popup">
31
  </div>
32
  </a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  <?php endif; ?>
34
- <?php if (SG_POPUP_PRO == 0): ?>
35
  <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
36
  <div class="popups-div iframe-popup-pro">
37
  </div>
21
  <div class="popups-div shortcode-popup">
22
  </div>
23
  </a>
24
+ <?php if(POPUP_BUILDER_PKG >= POPUP_BUILDER_PKG_SILVER): ?>
25
  <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=iframe">
26
  <div class="popups-div iframe-popup">
27
  </div>
30
  <div class="popups-div video-popup">
31
  </div>
32
  </a>
33
+ <?php if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_SILVER): ?>
34
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=ageRestriction">
35
+ <div class="popups-div age-restriction">
36
+ </div>
37
+ </a>
38
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=countdown">
39
+ <div class="popups-div countdown">
40
+ </div>
41
+ </a>
42
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=social">
43
+ <div class="popups-div sg-social">
44
+ </div>
45
+ </a>
46
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=exitIntent">
47
+ <div class="popups-div sg-exit-intent">
48
+ </div>
49
+ </a>
50
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=subscription">
51
+ <div class="popups-div sg-subscription">
52
+ </div>
53
+ </a>
54
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=contactForm">
55
+ <div class="popups-div sg-contact-form">
56
+ </div>
57
+ </a>
58
+ <?php endif; ?>
59
  <?php endif; ?>
60
+ <?php if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
61
  <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
62
  <div class="popups-div iframe-popup-pro">
63
  </div>
files/sg_popup_create_new.php CHANGED
@@ -85,6 +85,8 @@
85
  $sgOverlayColor = @$jsonData['sgOverlayColor'];
86
  $sgContentBackgroundColor = @$jsonData['sg-content-background-color'];
87
  $sgContentClick = @$jsonData['contentClick'];
 
 
88
  $sgOpacity = @$jsonData['opacity'];
89
  $sgPopupFixed = @$jsonData['popupFixed'];
90
  $sgFixedPostion = @$jsonData['fixedPostion'];
@@ -102,7 +104,8 @@
102
  $sgMaxHeight = @$jsonData['maxHeight'];
103
  $sgForMobile = @$jsonData['forMobile'];
104
  $sgOpenOnMobile = @$jsonData['openMobile'];
105
- $sgAllPages = @$jsonData['allPages'];
 
106
  $sgRepeatPopup = @$jsonData['repeatPopup'];
107
  $sgPopupAppearNumberLimit = @$jsonData['popup-appear-number-limit'];
108
  $sgDisablePopup = @$jsonData['disablePopup'];
@@ -110,11 +113,12 @@
110
  $sgPopupClosingTimer = @$jsonData['popupClosingTimer'];
111
  $sgAutoClosePopup = @$jsonData['autoClosePopup'];
112
  $sgCountryStatus = @$jsonData['countryStatus'];
113
- $sgAllPagesStatus = @$jsonData['showAllPages'];
114
  $allSelectedPages = @$jsonData['allSelectedPages'];
115
  $sgAllPostStatus = @$jsonData['showAllPosts'];
116
  $allSelectedPosts = @$jsonData['allSelectedPosts'];
117
  $sgAllowCountries = @$jsonData['allowCountries'];
 
 
118
  $sgLogedUser = @$jsonData['loggedin-user'];
119
  $sgUserSeperate = @$jsonData['sg-user-status'];
120
  $sgCountryName = @$jsonData['countryName'];
@@ -214,6 +218,12 @@
214
  $sgContactFailMessage = @$contactFormOptions['contact-fail-message'];
215
  }
216
 
 
 
 
 
 
 
217
  $sgPopup = array(
218
  'escKey'=> true,
219
  'closeButton' => true,
@@ -235,7 +245,8 @@
235
  'left' => false,
236
  'duration' => 1,
237
  'delay' => 0,
238
- 'theme-close-text' => 'Close'
 
239
  );
240
 
241
  $popupProDefaultValues = array(
@@ -258,8 +269,10 @@
258
  'roundButtons'=>false,
259
  'sgShareUrl' => 'http://',
260
  'pushToBottom' => true,
261
- 'allPages' => false,
262
- 'allPosts' => false,
 
 
263
  'onceExpiresTime' => 7,
264
  'popup-appear-number-limit' => 1,
265
  'overlay-custom-classs' => 'sg-popup-overlay',
@@ -315,6 +328,7 @@
315
  $reposition = sgBoolToChecked($sgPopup['reposition']);
316
  $overlayClose = sgBoolToChecked($sgPopup['overlayClose']);
317
  $contentClick = sgBoolToChecked($sgPopup['contentClick']);
 
318
 
319
  $closeType = sgBoolToChecked($popupProDefaultValues['closeType']);
320
  $onScrolling = sgBoolToChecked($popupProDefaultValues['onScrolling']);
@@ -336,8 +350,10 @@
336
  $roundButtons = sgBoolToChecked($popupProDefaultValues['roundButtons']);
337
  $shareUrl = $popupProDefaultValues['sgShareUrl'];
338
  $pushToBottom = sgBoolToChecked($popupProDefaultValues['pushToBottom']);
339
- $allPages = sgBoolToChecked($popupProDefaultValues['allPages']);
340
- $allPosts = sgBoolToChecked($popupProDefaultValues['allPosts']);
 
 
341
  $onceExpiresTime = $popupProDefaultValues['onceExpiresTime'];
342
  $popupAppearNumberLimit = $popupProDefaultValues['popup-appear-number-limit'];
343
  $countryStatus = sgBoolToChecked($popupProDefaultValues['countryStatus']);
@@ -438,8 +454,9 @@
438
  $sgSocialLabel = @sgSetChecked($sgSocialLabel, $socialLabel);
439
  $sgPopupFixed = @sgSetChecked($sgPopupFixed, $deafultFixed);
440
  $sgPushToBottom = @sgSetChecked($sgPushToBottom, $pushToBottom);
441
- $sgAllPages = @sgSetChecked($sgAllPagesStatus, $allPages);
442
- $sgAllPosts = @sgSetChecked($sgAllPostStatus, $allPosts);
 
443
  $sgCountdownPosition = @sgSetChecked($sgCountdownPosition, $countdownPosition);
444
  $sgVideoAutoplay = @sgSetChecked($sgVideoAutoplay, $videoAutoplay);
445
  $sgSubsLastNameStatus = @sgSetChecked($sgSubsLastNameStatus, $subsLastNameStatus);
@@ -473,6 +490,7 @@
473
  $sgOnceExpiresTime = @sgGetValue($sgOnceExpiresTime, $onceExpiresTime);
474
  $sgPopupAppearNumberLimit = @sgGetValue($sgPopupAppearNumberLimit, $popupAppearNumberLimit);
475
  $delay = @sgGetValue($delay, $defaultDelay);
 
476
  $sgPopupStartTimer = @sgGetValue($sgPopupStartTimer, $popupStartTimer);
477
  $sgPopupFinishTimer = @sgGetValue($sgPopupFinishTimer, '');
478
  $sgPopupDataIframe = @sgGetValue($sgPopupDataIframe, 'http://');
@@ -480,6 +498,8 @@
480
  $sgPopupDataHtml = @sgGetValue($sgPopupDataHtml, '');
481
  $sgPopupDataImage = @sgGetValue($sgPopupDataImage, '');
482
  $sgAllowCountries = @sgGetValue($sgAllowCountries, $allowCountries);
 
 
483
  $sgLogedUser = @sgGetValue($sgLogedUser, $logedUser);
484
  $sgCountdownNumbersTextColor = @sgGetValue($sgCountdownNumbersTextColor, $countdownNumbersTextColor);
485
  $sgCountdownNumbersBgColor = @sgGetValue($sgCountdownNumbersBgColor, $countdownNumbersBgColor);
@@ -606,6 +626,58 @@
606
  return $content;
607
  }
608
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
  $radiobuttons = array(
610
  array(
611
  "title" => "Soft mode:",
@@ -647,8 +719,8 @@
647
  function createRadiobuttons($elements, $name, $newLine, $selectedInput, $class)
648
  {
649
  $str = "";
650
-
651
- foreach ($elements as $key => $elment) {
652
  $breakLine = "";
653
  $infoIcon = "";
654
  $title = "";
@@ -656,25 +728,32 @@
656
  $infoIcon = "";
657
  $checked = "";
658
 
659
- if(isset($elment["title"])) {
660
- $title = $elment["title"];
661
  }
662
- if(isset($elment["value"])) {
663
- $value = $elment["value"];
664
  }
665
  if($newLine) {
666
  $breakLine = "<br>";
667
  }
668
- if(isset($elment["info"])) {
669
- $infoIcon = $elment['info'];
670
  }
671
- if($elment["value"] == $selectedInput) {
672
  $checked = "checked";
673
  }
674
- $str .= "<span class=".$class.">".$elment['title']."</span>
675
- <input type=\"radio\" name=".$name." value=".$value." $checked>".$infoIcon.$breakLine;
 
 
 
676
  }
677
 
 
 
 
 
678
  echo $str;
679
  }
680
 
@@ -768,7 +847,7 @@
768
  'inherit' => 'Inherit'
769
  );
770
 
771
- if (SG_POPUP_PRO) {
772
  require_once(SG_APP_POPUP_FILES ."/sg_params_arrays.php");
773
  }
774
 
@@ -841,7 +920,7 @@
841
  </div>
842
  <div class="button-wrapper">
843
  <p class="submit">
844
- <?php if (!SG_POPUP_PRO): ?>
845
  <input class="crud-to-pro" type="button" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL;?>')"><div class="clear"></div>
846
  <?php endif; ?>
847
  <input type="submit" id="sg-save-button" class="button-primary" value="<?php echo 'Save Changes'; ?>">
@@ -963,8 +1042,14 @@
963
  <span class="liquid-width">Dismiss on overlay click:</span><input class="input-width-static" type="checkbox" name="overlayClose" <?php echo $sgOverlayClose;?> />
964
  <span class="dashicons dashicons-info overlayImg sameImageStyle"></span><span class="infoOverlayClose samefontStyle">The popup will be dismissed when user clicks beyond of the popup area.</span><br>
965
 
966
- <span class="liquid-width">Dismiss on content click:</span><input class="input-width-static" type="checkbox" name="contentClick" <?php echo $sgContentClick;?> />
967
  <span class="dashicons dashicons-info contentClick sameImageStyle"></span><span class="infoContentClick samefontStyle">The popup will be dismissed when user clicks inside popup area.</span><br>
 
 
 
 
 
 
968
 
969
  <span class="liquid-width">Change overlay color:</span><div id="color-picker"><input class="sgOverlayColor" id="sgOverlayColor" type="text" name="sgOverlayColor" value="<?php echo esc_attr(@$sgOverlayColor); ?>" /></div><br>
970
 
@@ -1004,7 +1089,7 @@
1004
  </div>
1005
  </div>
1006
  </div>
1007
- <?php if (SG_POPUP_PRO) : require_once("options_section/pro.php"); ?>
1008
  <?php else: ?>
1009
  <div class="pro-options" onclick="window.open('http://sygnoos.com/wordpress-popup/')"></div>
1010
  <?php endif; ?>
85
  $sgOverlayColor = @$jsonData['sgOverlayColor'];
86
  $sgContentBackgroundColor = @$jsonData['sg-content-background-color'];
87
  $sgContentClick = @$jsonData['contentClick'];
88
+ $sgContentClickBehavior = @$jsonData['content-click-behavior'];
89
+ $sgClickRedirectToUrl = @$jsonData['click-redirect-to-url'];
90
  $sgOpacity = @$jsonData['opacity'];
91
  $sgPopupFixed = @$jsonData['popupFixed'];
92
  $sgFixedPostion = @$jsonData['fixedPostion'];
104
  $sgMaxHeight = @$jsonData['maxHeight'];
105
  $sgForMobile = @$jsonData['forMobile'];
106
  $sgOpenOnMobile = @$jsonData['openMobile'];
107
+ $sgAllPagesStatus = @$jsonData['allPagesStatus'];
108
+ $sgAllPostsStatus = @$jsonData['allPostsStatus'];
109
  $sgRepeatPopup = @$jsonData['repeatPopup'];
110
  $sgPopupAppearNumberLimit = @$jsonData['popup-appear-number-limit'];
111
  $sgDisablePopup = @$jsonData['disablePopup'];
113
  $sgPopupClosingTimer = @$jsonData['popupClosingTimer'];
114
  $sgAutoClosePopup = @$jsonData['autoClosePopup'];
115
  $sgCountryStatus = @$jsonData['countryStatus'];
 
116
  $allSelectedPages = @$jsonData['allSelectedPages'];
117
  $sgAllPostStatus = @$jsonData['showAllPosts'];
118
  $allSelectedPosts = @$jsonData['allSelectedPosts'];
119
  $sgAllowCountries = @$jsonData['allowCountries'];
120
+ $sgAllPages = @$jsonData['showAllPages'];
121
+ $sgAllPosts = @$jsonData['showAllPosts'];
122
  $sgLogedUser = @$jsonData['loggedin-user'];
123
  $sgUserSeperate = @$jsonData['sg-user-status'];
124
  $sgCountryName = @$jsonData['countryName'];
218
  $sgContactFailMessage = @$contactFormOptions['contact-fail-message'];
219
  }
220
 
221
+ $dataPopupId = @$id;
222
+ /* For layze loading get selected data */
223
+ if(!isset($id)) {
224
+ $dataPopupId = "-1";
225
+ }
226
+
227
  $sgPopup = array(
228
  'escKey'=> true,
229
  'closeButton' => true,
245
  'left' => false,
246
  'duration' => 1,
247
  'delay' => 0,
248
+ 'theme-close-text' => 'Close',
249
+ 'content-click-behavior' => 'close',
250
  );
251
 
252
  $popupProDefaultValues = array(
269
  'roundButtons'=>false,
270
  'sgShareUrl' => 'http://',
271
  'pushToBottom' => true,
272
+ 'allPages' => "all",
273
+ 'allPosts' => "all",
274
+ 'allPagesStatus' => false,
275
+ 'allPostsStatus' => false,
276
  'onceExpiresTime' => 7,
277
  'popup-appear-number-limit' => 1,
278
  'overlay-custom-classs' => 'sg-popup-overlay',
328
  $reposition = sgBoolToChecked($sgPopup['reposition']);
329
  $overlayClose = sgBoolToChecked($sgPopup['overlayClose']);
330
  $contentClick = sgBoolToChecked($sgPopup['contentClick']);
331
+ $contentClickBehavior = $sgPopup['content-click-behavior'];
332
 
333
  $closeType = sgBoolToChecked($popupProDefaultValues['closeType']);
334
  $onScrolling = sgBoolToChecked($popupProDefaultValues['onScrolling']);
350
  $roundButtons = sgBoolToChecked($popupProDefaultValues['roundButtons']);
351
  $shareUrl = $popupProDefaultValues['sgShareUrl'];
352
  $pushToBottom = sgBoolToChecked($popupProDefaultValues['pushToBottom']);
353
+ $allPages = $popupProDefaultValues['allPages'];
354
+ $allPosts = $popupProDefaultValues['allPosts'];
355
+ $allPagesStatus = sgBoolToChecked($popupProDefaultValues['allPagesStatus']);
356
+ $allPostsStatus = sgBoolToChecked($popupProDefaultValues['allPostsStatus']);
357
  $onceExpiresTime = $popupProDefaultValues['onceExpiresTime'];
358
  $popupAppearNumberLimit = $popupProDefaultValues['popup-appear-number-limit'];
359
  $countryStatus = sgBoolToChecked($popupProDefaultValues['countryStatus']);
454
  $sgSocialLabel = @sgSetChecked($sgSocialLabel, $socialLabel);
455
  $sgPopupFixed = @sgSetChecked($sgPopupFixed, $deafultFixed);
456
  $sgPushToBottom = @sgSetChecked($sgPushToBottom, $pushToBottom);
457
+
458
+ $sgAllPagesStatus = @sgSetChecked($sgAllPagesStatus, $allPagesStatus);
459
+ $sgAllPostsStatus = @sgSetChecked($sgAllPostsStatus, $allPostsStatus);
460
  $sgCountdownPosition = @sgSetChecked($sgCountdownPosition, $countdownPosition);
461
  $sgVideoAutoplay = @sgSetChecked($sgVideoAutoplay, $videoAutoplay);
462
  $sgSubsLastNameStatus = @sgSetChecked($sgSubsLastNameStatus, $subsLastNameStatus);
490
  $sgOnceExpiresTime = @sgGetValue($sgOnceExpiresTime, $onceExpiresTime);
491
  $sgPopupAppearNumberLimit = @sgGetValue($sgPopupAppearNumberLimit, $popupAppearNumberLimit);
492
  $delay = @sgGetValue($delay, $defaultDelay);
493
+ $sgContentClickBehavior = @sgGetValue($sgContentClickBehavior, $contentClickBehavior);
494
  $sgPopupStartTimer = @sgGetValue($sgPopupStartTimer, $popupStartTimer);
495
  $sgPopupFinishTimer = @sgGetValue($sgPopupFinishTimer, '');
496
  $sgPopupDataIframe = @sgGetValue($sgPopupDataIframe, 'http://');
498
  $sgPopupDataHtml = @sgGetValue($sgPopupDataHtml, '');
499
  $sgPopupDataImage = @sgGetValue($sgPopupDataImage, '');
500
  $sgAllowCountries = @sgGetValue($sgAllowCountries, $allowCountries);
501
+ $sgAllPages = @sgGetValue($sgAllPages, $allPages);
502
+ $sgAllPosts = @sgGetValue($sgAllPosts, $allPosts);
503
  $sgLogedUser = @sgGetValue($sgLogedUser, $logedUser);
504
  $sgCountdownNumbersTextColor = @sgGetValue($sgCountdownNumbersTextColor, $countdownNumbersTextColor);
505
  $sgCountdownNumbersBgColor = @sgGetValue($sgCountdownNumbersBgColor, $countdownNumbersBgColor);
626
  return $content;
627
  }
628
 
629
+ $contentClickOptions = array(
630
+ array(
631
+ "title" => "Close Popup:",
632
+ "value" => "close",
633
+ "info" => ""
634
+ ),
635
+ array(
636
+ "title" => "Redirect:",
637
+ "value" => "redirect",
638
+ "info" => ""
639
+ )
640
+ );
641
+
642
+ $pagesRadio = array(
643
+ array(
644
+ "title" => "Show on all pages:",
645
+ "value" => "all",
646
+ "info" => ""
647
+ ),
648
+ array(
649
+ "title" => "Show on selected pages:",
650
+ "value" => "selected",
651
+ "info" => "",
652
+ "data-attributes" => array(
653
+ "data-name" => SG_POST_TYPE_PAGE,
654
+ "data-popupid" => $dataPopupId,
655
+ "data-loading-number" => 0,
656
+ "data-selectbox-role" => "js-all-pages"
657
+ )
658
+ )
659
+ );
660
+
661
+ $postsRadio = array(
662
+ array(
663
+ "title" => "Show on all posts:",
664
+ "value" => "all",
665
+ "info" => ""
666
+ ),
667
+ array(
668
+ "title" => "Show on selected post:",
669
+ "value" => "selected",
670
+ "info" => "",
671
+ "data-attributes" => array(
672
+ "data-name" => SG_POST_TYPE_POST,
673
+ "data-popupid" => $dataPopupId,
674
+ "data-loading-number" => 0,
675
+ "data-selectbox-role" => "js-all-posts"
676
+ )
677
+
678
+ )
679
+ );
680
+
681
  $radiobuttons = array(
682
  array(
683
  "title" => "Soft mode:",
719
  function createRadiobuttons($elements, $name, $newLine, $selectedInput, $class)
720
  {
721
  $str = "";
722
+
723
+ foreach ($elements as $key => $element) {
724
  $breakLine = "";
725
  $infoIcon = "";
726
  $title = "";
728
  $infoIcon = "";
729
  $checked = "";
730
 
731
+ if(isset($element["title"])) {
732
+ $title = $element["title"];
733
  }
734
+ if(isset($element["value"])) {
735
+ $value = $element["value"];
736
  }
737
  if($newLine) {
738
  $breakLine = "<br>";
739
  }
740
+ if(isset($element["info"])) {
741
+ $infoIcon = $element['info'];
742
  }
743
+ if($element["value"] == $selectedInput) {
744
  $checked = "checked";
745
  }
746
+ $attrStr = '';
747
+ if(isset($element['data-attributes'])) {
748
+ foreach ($element['data-attributes'] as $key => $dataValue) {
749
+ $attrStr .= $key.'="'.$dataValue.'" ';
750
+ }
751
  }
752
 
753
+ $str .= "<span class=".$class.">".$element['title']."</span>
754
+ <input type=\"radio\" name=".$name." ".$attrStr." value=".$value." $checked>".$infoIcon.$breakLine;
755
+ }
756
+
757
  echo $str;
758
  }
759
 
847
  'inherit' => 'Inherit'
848
  );
849
 
850
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_SILVER) {
851
  require_once(SG_APP_POPUP_FILES ."/sg_params_arrays.php");
852
  }
853
 
920
  </div>
921
  <div class="button-wrapper">
922
  <p class="submit">
923
+ <?php if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
924
  <input class="crud-to-pro" type="button" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL;?>')"><div class="clear"></div>
925
  <?php endif; ?>
926
  <input type="submit" id="sg-save-button" class="button-primary" value="<?php echo 'Save Changes'; ?>">
1042
  <span class="liquid-width">Dismiss on overlay click:</span><input class="input-width-static" type="checkbox" name="overlayClose" <?php echo $sgOverlayClose;?> />
1043
  <span class="dashicons dashicons-info overlayImg sameImageStyle"></span><span class="infoOverlayClose samefontStyle">The popup will be dismissed when user clicks beyond of the popup area.</span><br>
1044
 
1045
+ <span class="liquid-width">Dismiss on content click:</span><input class="input-width-static js-checkbox-contnet-click" type="checkbox" name="contentClick" <?php echo $sgContentClick;?> />
1046
  <span class="dashicons dashicons-info contentClick sameImageStyle"></span><span class="infoContentClick samefontStyle">The popup will be dismissed when user clicks inside popup area.</span><br>
1047
+ <div class="sg-hide sg-full-width js-content-click-wrraper">
1048
+ <?php echo createRadiobuttons($contentClickOptions, "content-click-behavior", true, esc_html($sgContentClickBehavior), "liquid-width"); ?>
1049
+ <div class="sg-hide js-readio-buttons-acordion-content sg-full-width">
1050
+ <span class="liquid-width">Url:</span><input class="input-width-static" type="text" name='click-redirect-to-url' value="<?php echo esc_attr(@$sgClickRedirectToUrl); ?>">
1051
+ </div>
1052
+ </div>
1053
 
1054
  <span class="liquid-width">Change overlay color:</span><div id="color-picker"><input class="sgOverlayColor" id="sgOverlayColor" type="text" name="sgOverlayColor" value="<?php echo esc_attr(@$sgOverlayColor); ?>" /></div><br>
1055
 
1089
  </div>
1090
  </div>
1091
  </div>
1092
+ <?php if (POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) : require_once("options_section/pro.php"); ?>
1093
  <?php else: ?>
1094
  <div class="pro-options" onclick="window.open('http://sygnoos.com/wordpress-popup/')"></div>
1095
  <?php endif; ?>
files/sg_popup_main.php CHANGED
@@ -10,10 +10,10 @@ if(!SG_SHOW_POPUP_REVIEW) {
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(!SG_POPUP_PRO): ?>
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(SG_POPUP_PRO): ?>
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>
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>
files/sg_popup_media_button.php CHANGED
@@ -14,6 +14,12 @@ function sgPopupMediaButton()
14
  'widgets.php'
15
  );
16
 
 
 
 
 
 
 
17
  $checkPage = in_array(
18
  $pagenow,
19
  $pages
@@ -25,7 +31,7 @@ function sgPopupMediaButton()
25
  wp_register_style('sg_jQuery_ui', SG_APP_POPUP_URL . "/style/jQueryDialog/jquery-ui.css");
26
  wp_enqueue_style('sg_jQuery_ui');
27
  $img = '<span class="dashicons dashicons-welcome-widgets-menus" id="sg-popup-media-button" style="padding: 3px 2px 0px 0px"></span>';
28
- $output = '<a href="javascript:void(0);" onclick="jQuery(\'#sgpb-thickbox\').dialog({ width: 450, modal: true });" class="button" title="'.$buttonTitle.'" style="padding-left: .4em;">'. $img.$buttonTitle.'</a>';
29
  }
30
  echo $output;
31
  }
@@ -35,6 +41,7 @@ add_action('media_buttons', 'sgPopupMediaButton', 11);
35
  function sgPopupMediaButtonThickboxs()
36
  {
37
  global $pagenow, $typenow;
 
38
 
39
  $pages = array(
40
  'post.php',
@@ -44,14 +51,20 @@ function sgPopupMediaButtonThickboxs()
44
  'widgets.php'
45
  );
46
 
 
 
 
 
47
  $checkPage = in_array(
48
  $pagenow,
49
  $pages
50
  );
 
51
 
52
  if ($checkPage && $typenow != 'download') : ?>
53
  <script type="text/javascript">
54
  jQuery(document).ready(function ($) {
 
55
  $('#sg-ptp-popup-insert').on('click', function () {
56
  var id = $('#sg-insert-popup-id').val();
57
  if ('' === id) {
@@ -62,7 +75,17 @@ function sgPopupMediaButtonThickboxs()
62
  if (typeof(tinyMCE.editors.content) != "undefined") {
63
  selectionText = (tinyMCE.activeEditor.selection.getContent()) ? tinyMCE.activeEditor.selection.getContent() : '';
64
  }
65
- window.send_to_editor('[sg_popup id="' + id + '"]'+selectionText+"[/sg_popup]");
 
 
 
 
 
 
 
 
 
 
66
  jQuery('#sgpb-thickbox').dialog( "close" );
67
  });
68
  });
@@ -79,8 +102,12 @@ function sgPopupMediaButtonThickboxs()
79
  $proposedTypes = array();
80
  $orderBy = 'id DESC';
81
  $allPopups = SGPopup::findAll($orderBy);
82
- foreach ($allPopups as $allPopup) : ?>
83
- <option value="<?=$allPopup->getId()?>"><?php echo $allPopup->getTitle();?><?php echo " - ".$allPopup->getType();?></option>;
 
 
 
 
84
  <?php endforeach; ?>
85
  </select>
86
  </div>
14
  'widgets.php'
15
  );
16
 
17
+
18
+ /* For show in plugins page when package is pro */
19
+ if(POPUP_BUILDER_PKG !== POPUP_BUILDER_PKG_FREE) {
20
+ array_push($pages, "admin.php");
21
+ }
22
+
23
  $checkPage = in_array(
24
  $pagenow,
25
  $pages
31
  wp_register_style('sg_jQuery_ui', SG_APP_POPUP_URL . "/style/jQueryDialog/jquery-ui.css");
32
  wp_enqueue_style('sg_jQuery_ui');
33
  $img = '<span class="dashicons dashicons-welcome-widgets-menus" id="sg-popup-media-button" style="padding: 3px 2px 0px 0px"></span>';
34
+ $output = '<a href="javascript:void(0);" onclick="jQuery(\'#sgpb-thickbox\').dialog({ width: 450, modal: true, title: \'Insert the shortcode\' });" class="button" title="'.$buttonTitle.'" style="padding-left: .4em;">'. $img.$buttonTitle.'</a>';
35
  }
36
  echo $output;
37
  }
41
  function sgPopupMediaButtonThickboxs()
42
  {
43
  global $pagenow, $typenow;
44
+ $currentPageParams = get_object_vars(get_current_screen());
45
 
46
  $pages = array(
47
  'post.php',
51
  'widgets.php'
52
  );
53
 
54
+ if(POPUP_BUILDER_PKG !== POPUP_BUILDER_PKG_FREE) {
55
+ array_push($pages, "admin.php");
56
+ }
57
+
58
  $checkPage = in_array(
59
  $pagenow,
60
  $pages
61
  );
62
+
63
 
64
  if ($checkPage && $typenow != 'download') : ?>
65
  <script type="text/javascript">
66
  jQuery(document).ready(function ($) {
67
+
68
  $('#sg-ptp-popup-insert').on('click', function () {
69
  var id = $('#sg-insert-popup-id').val();
70
  if ('' === id) {
75
  if (typeof(tinyMCE.editors.content) != "undefined") {
76
  selectionText = (tinyMCE.activeEditor.selection.getContent()) ? tinyMCE.activeEditor.selection.getContent() : '';
77
  }
78
+ /* For plugin editor selected text */
79
+ else if(typeof(tinyMCE.editors[0]['id']) != "undefined") {
80
+ var pluginEditorId = tinyMCE.editors[0]['id'];
81
+ selectionText = (tinyMCE['editors'][pluginEditorId].selection.getContent()) ? tinyMCE['editors'][pluginEditorId].selection.getContent() : '';
82
+ }
83
+ <?php if( $currentPageParams['id'] == 'popup-builder_page_edit-popup'){ ?>
84
+ window.send_to_editor('[sg_popup id="' + id + '" insidePopup="on"]'+selectionText+"[/sg_popup]");
85
+ <?php }
86
+ else { ?>
87
+ window.send_to_editor('[sg_popup id="' + id + '"]'+selectionText+"[/sg_popup]");
88
+ <?php } ?>
89
  jQuery('#sgpb-thickbox').dialog( "close" );
90
  });
91
  });
102
  $proposedTypes = array();
103
  $orderBy = 'id DESC';
104
  $allPopups = SGPopup::findAll($orderBy);
105
+ foreach ($allPopups as $popup) :
106
+ if((isset($_GET['id']) && $popup->getId() == (int)@$_GET['id'] || $popup->getType() == 'exitIntent') && $currentPageParams['id'] == 'popup-builder_page_edit-popup') {
107
+ continue;
108
+ }
109
+ ?>
110
+ <option value="<?=$popup->getId()?>"><?php echo $popup->getTitle();?><?php echo " - ".$popup->getType();?></option>;
111
  <?php endforeach; ?>
112
  </select>
113
  </div>
files/sg_popup_pro.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class SgPopupPro
3
- {
4
- public static function sgPopupDataSanitize($sgPopupData) {
5
- $allowedHtmltags = wp_kses_allowed_html('post');
6
- $allowedHtmltags['input'] = array('name'=>true, 'class'=>true, 'id'=>true, 'placeholder'=>true, 'title'=>true, 'value'=>true, 'type'=>true);
7
- $allowedHtmltags['iframe'] = array('name'=>true, 'class'=>true, 'id'=>true, 'title'=>true, 'src'=>true, 'height'=>true, 'width'=>true);
8
- return wp_kses($sgPopupData, $allowedHtmltags);
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
files/sg_popup_save.php CHANGED
@@ -15,7 +15,7 @@ function sgSanitize($optionsKey)
15
  $optionsKey == "all-selected-page" ||
16
  $optionsKey == "all-selected-posts"
17
  ) {
18
- if(SG_POPUP_PRO) {
19
  $sgPopupData = $_POST[$optionsKey];
20
  require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php");
21
  return SgPopupPro::sgPopupDataSanitize($sgPopupData);
@@ -41,8 +41,17 @@ function sgPopupSave()
41
  $contactFormOptions = array();
42
  $showAllPages = sgSanitize('allPages');
43
  $showAllPosts = sgSanitize('allPosts');
44
- $allSelectedPages = explode(",", sgSanitize('all-selected-page'));
45
- $allSelectedPosts = explode(",", sgSanitize('all-selected-posts'));
 
 
 
 
 
 
 
 
 
46
 
47
  $socialOptions = array(
48
  'sgSocialTheme' => sgSanitize('sgSocialTheme'),
@@ -159,6 +168,8 @@ function sgPopupSave()
159
  'reposition' => sgSanitize('reposition'),
160
  'overlayClose' => sgSanitize('overlayClose'),
161
  'contentClick' => sgSanitize('contentClick'),
 
 
162
  'opacity' => sgSanitize('opacity'),
163
  'sgOverlayColor' => sgSanitize('sgOverlayColor'),
164
  'sg-content-background-color' => sgSanitize('sg-content-background-color'),
@@ -179,6 +190,8 @@ function sgPopupSave()
179
  'autoClosePopup' => sgSanitize('autoClosePopup'),
180
  'countryStatus' => sgSanitize('countryStatus'),
181
  'showAllPages' => $showAllPages,
 
 
182
  'allSelectedPages' => $allSelectedPages,
183
  'showAllPosts' => $showAllPosts,
184
  'allSelectedPosts' => $allSelectedPosts,
@@ -267,20 +280,37 @@ function sgPopupSave()
267
  }
268
  $popupName = "SG".ucfirst(strtolower($_POST['type']));
269
  $popupClassName = $popupName."Popup";
270
-
271
  require_once(SG_APP_POPUP_PATH ."/classes/".$popupClassName.".php");
272
  if ($id == "") {
273
  global $wpdb;
274
  call_user_func(array($popupClassName, 'create'), $data);
275
  $lastId = $wpdb->get_var("SELECT LAST_INSERT_ID() FROM ". $wpdb->prefix."sg_popup");
276
-
277
- SGPopup::removePopupFromPages($lastId);
278
- if(!empty($showAllPages)) {
279
- setPopupForAllPages($lastId, $allSelectedPages);
280
- }
281
- if(!empty($showAllPosts)) {
282
- setPopupForAllPages($lastId, $allSelectedPosts);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  }
 
284
  setOptionPopupType($lastId, $type);
285
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=".$lastId."&type=$type&saved=1");
286
  exit();
@@ -342,13 +372,35 @@ function sgPopupSave()
342
  $popup->steParams(json_encode($contactFormOptions));
343
  break;
344
  }
345
- SGPopup::removePopupFromPages($id);
346
- if($showAllPages) {
347
- setPopupForAllPages($id, $allSelectedPages);
348
- }
349
- if($showAllPosts) {
350
- setPopupForAllPages($id, $allSelectedPosts);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  }
 
352
  setOptionPopupType($id, $type);
353
  $popup->save();
354
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=$id&type=$type&saved=1");
15
  $optionsKey == "all-selected-page" ||
16
  $optionsKey == "all-selected-posts"
17
  ) {
18
+ if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
19
  $sgPopupData = $_POST[$optionsKey];
20
  require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php");
21
  return SgPopupPro::sgPopupDataSanitize($sgPopupData);
41
  $contactFormOptions = array();
42
  $showAllPages = sgSanitize('allPages');
43
  $showAllPosts = sgSanitize('allPosts');
44
+ $allSelectedPages = "";
45
+ $allSelectedPosts = "";
46
+
47
+ /* if popup check for all pages it is not needed for save all pages all posts */
48
+ if($showAllPages !== "all") {
49
+ $allSelectedPages = explode(",", sgSanitize('all-selected-page'));
50
+ }
51
+
52
+ if($showAllPosts !== "all") {
53
+ $allSelectedPosts = explode(",", sgSanitize('all-selected-posts'));
54
+ }
55
 
56
  $socialOptions = array(
57
  'sgSocialTheme' => sgSanitize('sgSocialTheme'),
168
  'reposition' => sgSanitize('reposition'),
169
  'overlayClose' => sgSanitize('overlayClose'),
170
  'contentClick' => sgSanitize('contentClick'),
171
+ 'content-click-behavior' => sgSanitize('content-click-behavior'),
172
+ 'click-redirect-to-url' => sgSanitize('click-redirect-to-url'),
173
  'opacity' => sgSanitize('opacity'),
174
  'sgOverlayColor' => sgSanitize('sgOverlayColor'),
175
  'sg-content-background-color' => sgSanitize('sg-content-background-color'),
190
  'autoClosePopup' => sgSanitize('autoClosePopup'),
191
  'countryStatus' => sgSanitize('countryStatus'),
192
  'showAllPages' => $showAllPages,
193
+ "allPagesStatus" => sgSanitize("allPagesStatus"),
194
+ "allPostsStatus" => sgSanitize("allPostsStatus"),
195
  'allSelectedPages' => $allSelectedPages,
196
  'showAllPosts' => $showAllPosts,
197
  'allSelectedPosts' => $allSelectedPosts,
280
  }
281
  $popupName = "SG".ucfirst(strtolower($_POST['type']));
282
  $popupClassName = $popupName."Popup";
283
+
284
  require_once(SG_APP_POPUP_PATH ."/classes/".$popupClassName.".php");
285
  if ($id == "") {
286
  global $wpdb;
287
  call_user_func(array($popupClassName, 'create'), $data);
288
  $lastId = $wpdb->get_var("SELECT LAST_INSERT_ID() FROM ". $wpdb->prefix."sg_popup");
289
+
290
+ if(POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) {
291
+ SGPopup::removePopupFromPages($lastId);
292
+ if($options['allPagesStatus']) {
293
+ if(!empty($showAllPages) && $showAllPages != 'all') {
294
+ update_option("SG_ALL_PAGES", false);
295
+ setPopupForAllPages($lastId, $allSelectedPages);
296
+ }
297
+ else {
298
+ update_option("SG_ALL_PAGES", $lastId);
299
+ }
300
+ }
301
+
302
+ if($options['allPostsStatus']) {
303
+ if(!empty($showAllPosts) && $showAllPosts != "all") {
304
+ update_option("SG_ALL_POSTS", false);
305
+ setPopupForAllPages($lastId, $allSelectedPosts);
306
+ }
307
+ else {
308
+ update_option("SG_ALL_POSTS", $lastId);
309
+ }
310
+ }
311
+
312
  }
313
+
314
  setOptionPopupType($lastId, $type);
315
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=".$lastId."&type=$type&saved=1");
316
  exit();
372
  $popup->steParams(json_encode($contactFormOptions));
373
  break;
374
  }
375
+ if(POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) {
376
+ SGPopup::removePopupFromPages($id);
377
+ if(!empty($options['allPagesStatus'])) {
378
+ if($showAllPages && $showAllPages != 'all') {
379
+ update_option("SG_ALL_PAGES", false);
380
+ setPopupForAllPages($id, $allSelectedPages);
381
+ }
382
+ else {
383
+ update_option("SG_ALL_PAGES", $id);
384
+ }
385
+ }
386
+ else if(get_option("SG_ALL_PAGES") == $id) {
387
+ update_option("SG_ALL_PAGES", false);
388
+ }
389
+
390
+ if(!empty($options['allPostsStatus'])) {
391
+ if(!empty($showAllPosts) && $showAllPosts != "all") {
392
+ update_option("SG_ALL_POSTS", false);
393
+ setPopupForAllPages($id, $allSelectedPosts);
394
+ }
395
+ else {
396
+ update_option("SG_ALL_POSTS", $id);
397
+ }
398
+ }
399
+ else if(get_option("SG_ALL_POSTS") == $id) {
400
+ update_option("SG_ALL_PAGES", false);
401
+ }
402
  }
403
+
404
  setOptionPopupType($id, $type);
405
  $popup->save();
406
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=$id&type=$type&saved=1");
img/proOptions.png CHANGED
Binary file
img/socialPopup.png ADDED
Binary file
javascript/sg_datapickers.js DELETED
@@ -1,54 +0,0 @@
1
- function SgPickers() {
2
-
3
- }
4
-
5
- SgPickers.prototype.init = function() {
6
- jQuery(".sg-calndar").addClass("input-width-static");
7
-
8
- jQuery('.sg-calndar').bind("click",function() {
9
- jQuery("#ui-datepicker-div").css({'z-index': 9999});
10
- });
11
- }
12
-
13
- SgPickers.prototype.changeColor = function(elemet) {
14
- var selectedName = elemet.attr("name");
15
- var elementVal = elemet.val();
16
- if(selectedName == 'countdownNumbersTextColor') {
17
- jQuery("#sg-counts-text").remove();
18
- jQuery("body").append("<style id=\"sg-counts-text\">.flip-clock-wrapper ul li a div div.inn { color: "+elementVal+"; }</style>");
19
- }
20
- if(selectedName == 'countdownNumbersBgColor') {
21
- jQuery("#sg-counts-style").remove();
22
- jQuery("body").append("<style id=\"sg-counts-style\">.flip-clock-wrapper ul li a div div.inn { background-color: "+elementVal+"; }</style>");
23
- }
24
- }
25
-
26
- SgPickers.prototype.colorPicekr = function() {
27
- var that = this;
28
- sgColorPicker = jQuery('.sgOverlayColor').wpColorPicker({
29
- change: function() {
30
- var sgColorpicker = jQuery(this);
31
- that.changeColor(sgColorpicker);
32
- }
33
- });
34
- jQuery(".wp-picker-holder").bind('click',function() {
35
- var selectedInput = jQuery(this).prev().find('.sgOverlayColor');
36
- that.changeColor(selectedInput);
37
- });
38
- }
39
-
40
- SgPickers.prototype.datepicker = function() {
41
- var that = this;
42
- sgCalendar = jQuery('.sg-calndar').datepicker({
43
- dateFormat : 'M dd yy',
44
- minDate: 0
45
- });
46
- }
47
-
48
- jQuery(document).ready(function($){
49
-
50
- pickersObj = new SgPickers();
51
- pickersObj.init();
52
- pickersObj.colorPicekr();
53
- pickersObj.datepicker();
54
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
javascript/sg_popup_backend.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function($){
2
  this.titleNotEmpty(); /* Check title is Empty */
3
  this.showThemePicture(); /* Show themes pictures */
4
  this.showEffects(); /* Show effect type */
5
  this.pageAcordion(); /* For page acordion divs */
6
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
7
  this.showInfo(); /* Show description options */
8
  this.opasictyRange(); /* Opcity range */
9
  this.subOptionContents();
10
  this.addCountris();
11
  this.showCloseTextFieldForTheme();
12
  this.popupReview();
13
  this.popupTimer();
14
  });
 
15
  this.titleNotEmpty(); /* Check title is Empty */
16
  this.showThemePicture(); /* Show themes pictures */
17
  this.showEffects(); /* Show effect type */
18
  this.pageAcordion(); /* For page acordion divs */
19
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
20
  this.showInfo(); /* Show description options */
21
  this.opasictyRange(); /* Opcity range */
22
  this.subOptionContents();
23
  this.addCountris();
24
  this.showCloseTextFieldForTheme();
25
  this.popupReview();
26
  this.popupTimer();
27
 
28
  });
 
1
  this.titleNotEmpty(); /* Check title is Empty */
2
  this.showThemePicture(); /* Show themes pictures */
3
  this.showEffects(); /* Show effect type */
4
  this.pageAcordion(); /* For page acordion divs */
5
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
6
  this.showInfo(); /* Show description options */
7
  this.opasictyRange(); /* Opcity range */
8
  this.subOptionContents();
9
  this.addCountris();
10
  this.showCloseTextFieldForTheme();
11
  this.popupReview();
12
  this.popupTimer();
13
  });
14
+ jQuery(document).ready(function($){
15
  this.titleNotEmpty(); /* Check title is Empty */
16
  this.showThemePicture(); /* Show themes pictures */
17
  this.showEffects(); /* Show effect type */
18
  this.pageAcordion(); /* For page acordion divs */
19
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
20
  this.showInfo(); /* Show description options */
21
  this.opasictyRange(); /* Opcity range */
22
  this.subOptionContents();
23
  this.addCountris();
24
  this.showCloseTextFieldForTheme();
25
  this.popupReview();
26
  this.popupTimer();
27
 
28
  });
javascript/sg_popup_frontend.js CHANGED
@@ -29,7 +29,7 @@ SGPopup.prototype.init = function() {
29
  SGPopup.prototype.onCompleate = function() {
30
 
31
  jQuery("#sgcolorbox").bind("sgColorboxOnCompleate", function() {
32
-
33
  /* Scroll only inside popup */
34
  jQuery('#sgcboxLoadedContent').isolatedScroll();
35
  });
@@ -130,6 +130,7 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
130
  var popupScrolling = that.varToBool(that.popupData['scrolling']);
131
  that.popupEscKey = that.varToBool(that.popupData['escKey']);
132
  that.popupCloseButton = that.varToBool(that.popupData['closeButton']);
 
133
  var popupForMobile = that.varToBool(that.popupData['forMobile']);
134
  var onlyMobile = that.varToBool(that.popupData['openMobile']);
135
  var popupCantClose = that.varToBool(that.popupData['disablePopup']);
@@ -157,6 +158,8 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
157
  var popupInitialHeight = that.popupData['initialHeight'];
158
  var popupEffectDuration = that.popupData['duration'];
159
  var popupEffect = that.popupData['effect'];
 
 
160
  var pushToBottom = that.popupData['pushToBottom'];
161
  var onceExpiresTime = parseInt(that.popupData['onceExpiresTime']);
162
  var sgType = that.popupData['type'];
@@ -176,8 +179,9 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
176
  if (popupShortCode && popupHtml == false) {
177
  popupHtml = popupShortCode;
178
  }
179
-
180
  if(popupHtml && popupWidth == '' && popupHeight == '' && popupMaxWidth =='' && popupMaxHeight == '') {
 
181
  jQuery(popupHtml).find('img:first').attr('onload', 'jQuery.sgcolorbox.resize();');
182
  }
183
  if (popupIframeUrl) {
@@ -288,7 +292,7 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
288
  if (popupOverlayColor) {
289
  jQuery("#sgcboxOverlay").css({'background' : 'none', 'background-color' : popupOverlayColor});
290
  }
291
-
292
  jQuery('#sgcolorbox').trigger("sgColorboxOnOpen", []);
293
  },
294
  onLoad: function(){
@@ -301,14 +305,12 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
301
  if(popupWidth == '' && popupHeight == '') {
302
  jQuery.sgcolorbox.resize();
303
  }
304
- jQuery('.sg-popup-close').bind('click', function() {
305
- jQuery.sgcolorbox.close();
306
- });
307
-
308
- //Facebook reInit
309
- if(jQuery('#sg-facebook-like').length && typeof FB !== 'undefined') {
310
- FB.XFBML.parse();
311
- }
312
  },
313
  onClosed: function() {
314
  jQuery('#sgcolorbox').trigger("sgPopupClose", []);
@@ -336,11 +338,16 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
336
  };
337
 
338
  jQuery.sgcolorbox(SG_POPUP_SETTINGS);
 
 
 
 
 
339
  if (that.popupData['id'] && that.isOnLoad==true && that.openOnce != '') {
340
  sgCookieData = '';
341
  jQuery.cookie.defaults = {path:'/'};
342
  var currentCookie = jQuery.cookie('sgPopupDetails');
343
-
344
  if(typeof currentCookie == 'undefined') {
345
  openCounter = 1;
346
  }
@@ -353,13 +360,25 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
353
  'openCounter': openCounter,
354
  'openLimit': that.numberLimit
355
  }
356
-
357
  jQuery.cookie("sgPopupDetails",JSON.stringify(sgCookieData), { expires: onceExpiresTime});
358
  }
359
 
360
  if (that.popupContentClick) {
 
 
 
 
 
 
 
361
  jQuery('#sgcolorbox').bind('click',function() {
362
- jQuery.sgcolorbox.close();
 
 
 
 
 
 
363
  });
364
  }
365
 
29
  SGPopup.prototype.onCompleate = function() {
30
 
31
  jQuery("#sgcolorbox").bind("sgColorboxOnCompleate", function() {
32
+
33
  /* Scroll only inside popup */
34
  jQuery('#sgcboxLoadedContent').isolatedScroll();
35
  });
130
  var popupScrolling = that.varToBool(that.popupData['scrolling']);
131
  that.popupEscKey = that.varToBool(that.popupData['escKey']);
132
  that.popupCloseButton = that.varToBool(that.popupData['closeButton']);
133
+ var countryStatus = that.varToBool(that.popupData['countryStatus']);
134
  var popupForMobile = that.varToBool(that.popupData['forMobile']);
135
  var onlyMobile = that.varToBool(that.popupData['openMobile']);
136
  var popupCantClose = that.varToBool(that.popupData['disablePopup']);
158
  var popupInitialHeight = that.popupData['initialHeight'];
159
  var popupEffectDuration = that.popupData['duration'];
160
  var popupEffect = that.popupData['effect'];
161
+ var contentClickBehavior = that.popupData['content-click-behavior'];
162
+ var clickRedirectToUrl = that.popupData['click-redirect-to-url'];
163
  var pushToBottom = that.popupData['pushToBottom'];
164
  var onceExpiresTime = parseInt(that.popupData['onceExpiresTime']);
165
  var sgType = that.popupData['type'];
179
  if (popupShortCode && popupHtml == false) {
180
  popupHtml = popupShortCode;
181
  }
182
+
183
  if(popupHtml && popupWidth == '' && popupHeight == '' && popupMaxWidth =='' && popupMaxHeight == '') {
184
+
185
  jQuery(popupHtml).find('img:first').attr('onload', 'jQuery.sgcolorbox.resize();');
186
  }
187
  if (popupIframeUrl) {
292
  if (popupOverlayColor) {
293
  jQuery("#sgcboxOverlay").css({'background' : 'none', 'background-color' : popupOverlayColor});
294
  }
295
+
296
  jQuery('#sgcolorbox').trigger("sgColorboxOnOpen", []);
297
  },
298
  onLoad: function(){
305
  if(popupWidth == '' && popupHeight == '') {
306
  jQuery.sgcolorbox.resize();
307
  }
308
+
309
+ var sgpopupInit = new SgPopupInit(that.popupData);
310
+ sgpopupInit.overallInit();
311
+ /* For specific popup Like Countdown AgeRestcion popups */
312
+ sgpopupInit.initByPopupType();
313
+
 
 
314
  },
315
  onClosed: function() {
316
  jQuery('#sgcolorbox').trigger("sgPopupClose", []);
338
  };
339
 
340
  jQuery.sgcolorbox(SG_POPUP_SETTINGS);
341
+
342
+
343
+ if(countryStatus == true && typeof SgUserData != "undefined") {
344
+ jQuery.cookie("SG_POPUP_USER_COUNTRY_NAME", SgUserData.countryIsoName, { expires: 365});
345
+ }
346
  if (that.popupData['id'] && that.isOnLoad==true && that.openOnce != '') {
347
  sgCookieData = '';
348
  jQuery.cookie.defaults = {path:'/'};
349
  var currentCookie = jQuery.cookie('sgPopupDetails');
350
+
351
  if(typeof currentCookie == 'undefined') {
352
  openCounter = 1;
353
  }
360
  'openCounter': openCounter,
361
  'openLimit': that.numberLimit
362
  }
 
363
  jQuery.cookie("sgPopupDetails",JSON.stringify(sgCookieData), { expires: onceExpiresTime});
364
  }
365
 
366
  if (that.popupContentClick) {
367
+
368
+ /* If has url for redirect */
369
+ if(contentClickBehavior !== 'close' || clickRedirectToUrl !== '') {
370
+ jQuery('#sgcolorbox').css({
371
+ "cursor": 'pointer'
372
+ });
373
+ }
374
  jQuery('#sgcolorbox').bind('click',function() {
375
+ if(contentClickBehavior == 'close' || clickRedirectToUrl == '') {
376
+ jQuery.sgcolorbox.close();
377
+ }
378
+ else {
379
+ window.location = clickRedirectToUrl;
380
+ }
381
+
382
  });
383
  }
384
 
javascript/sg_popup_init.js ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function SgPopupInit(popupData) {
2
+ this.popupData = popupData;
3
+ this.shortcodeInPopupContent();
4
+ }
5
+
6
+ SgPopupInit.prototype.shortcodeInPopupContent = function() {
7
+
8
+ jQuery(".sg-show-popup").bind('click',function() {
9
+ var sgPopupID = jQuery(this).attr("data-sgpopupid");
10
+ var sgInsidePopup = jQuery(this).attr("insidepopup");
11
+
12
+ if(typeof sgInsidePopup == 'undefined' || sgInsidePopup != 'on') {
13
+ return false;
14
+ }
15
+
16
+ jQuery.sgcolorbox.close();
17
+
18
+ jQuery('#sgcolorbox').bind("sgPopupClose", function() {
19
+ if(sgPopupID == '') {
20
+ return;
21
+ }
22
+ sgPoupFrontendObj = new SGPopup();
23
+ sgPoupFrontendObj.showPopup(sgPopupID,false);
24
+ sgPopupID = '';
25
+ });
26
+ });
27
+ }
28
+
29
+ SgPopupInit.prototype.overallInit = function() {
30
+ jQuery('.sg-popup-close').bind('click', function() {
31
+ jQuery.sgcolorbox.close();
32
+ });
33
+
34
+ //Facebook reInit
35
+ if(jQuery('#sg-facebook-like').length && typeof FB !== 'undefined') {
36
+ FB.XFBML.parse();
37
+ }
38
+ }
39
+
40
+ SgPopupInit.prototype.initByPopupType = function() {
41
+ var data = this.popupData;
42
+ var popupObj = {};
43
+ var popupType = data['type'];
44
+
45
+ switch(popupType) {
46
+ case 'countdown':
47
+ var popupObj = new SGCountdown();
48
+ popupObj.init();
49
+ break;
50
+ case 'contactForm':
51
+ popupObj = new SgContactForm();
52
+ popupObj.buildStyle();
53
+ break;
54
+ case 'social':
55
+ popupObj = new SgSocialFront();
56
+ popupObj.init();
57
+ break;
58
+ case 'subscription':
59
+ popupObj = new SgSubscription();
60
+ popupObj.init();
61
+ break;
62
+ case 'ageRestriction':
63
+ popupObj = new SGAgeRestriction();
64
+ popupObj.init();
65
+ break;
66
+ }
67
+
68
+ return popupObj;
69
+ }
javascript/sg_popup_javascript.php CHANGED
@@ -18,7 +18,7 @@ function sg_popup_admin_scripts($hook) {
18
  else if('toplevel_page_PopupBuilder' == $hook){
19
  wp_register_script('javascript', SG_APP_POPUP_URL . '/javascript/sg_popup_backend.js', array('jquery'));
20
  wp_enqueue_script('javascript');
21
- if(SG_POPUP_PRO) {
22
  wp_register_script('sg_popup_pro', SG_APP_POPUP_URL . '/javascript/sg_popup_backend_pro.js');
23
  wp_enqueue_script('sg_popup_pro');
24
  wp_enqueue_media();
@@ -29,21 +29,30 @@ function sg_popup_admin_scripts($hook) {
29
  wp_register_script('sg_popup_rangeslider', SG_APP_POPUP_URL . '/javascript/sg_popup_rangeslider.js', array('jquery'));
30
  wp_enqueue_script('sg_popup_rangeslider');
31
  wp_enqueue_script('jquery');
32
- if (SG_POPUP_PRO) {
 
 
 
 
 
 
 
 
 
 
 
 
33
  wp_register_script('sg_popup_pro', SG_APP_POPUP_URL . '/javascript/sg_popup_backend_pro.js');
34
  wp_enqueue_script('sg_popup_pro');
35
  }
36
-
37
- wp_enqueue_script('jquery-ui-datepicker');
38
-
39
  wp_enqueue_style( 'wp-color-picker' );
40
- wp_enqueue_script( 'sg_libs_handle', plugins_url('javascript/sg_datapickers.js',dirname(__FILE__)), array('wp-color-picker'));
41
  }
42
  }
43
 
44
  function SgFrontendScripts() {
45
  wp_enqueue_script('sg_popup_core', plugins_url('/sg_popup_core.js', __FILE__), '1.0.0', true);
46
- echo "<script type='text/javascript'>SG_POPUP_DATA = [];SG_APP_POPUP_URL = '".SG_APP_POPUP_URL."';SG_POPUO_VERSION='".SG_POPUP_VERSION."_".SG_POPUP_PRO."'</script>";
47
  }
48
 
49
  add_action('admin_enqueue_scripts', 'sg_set_admin_url');
18
  else if('toplevel_page_PopupBuilder' == $hook){
19
  wp_register_script('javascript', SG_APP_POPUP_URL . '/javascript/sg_popup_backend.js', array('jquery'));
20
  wp_enqueue_script('javascript');
21
+ if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
22
  wp_register_script('sg_popup_pro', SG_APP_POPUP_URL . '/javascript/sg_popup_backend_pro.js');
23
  wp_enqueue_script('sg_popup_pro');
24
  wp_enqueue_media();
29
  wp_register_script('sg_popup_rangeslider', SG_APP_POPUP_URL . '/javascript/sg_popup_rangeslider.js', array('jquery'));
30
  wp_enqueue_script('sg_popup_rangeslider');
31
  wp_enqueue_script('jquery');
32
+ if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_PLATINUM) {
33
+ wp_register_script('sg_popup_tagsinput', SG_APP_POPUP_URL . '/javascript/bootstrap-tagsinput.js', array('jquery'));
34
+ wp_enqueue_script('sg_popup_tagsinput');
35
+ }
36
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_SILVER) {
37
+ wp_register_script('jssocials.min', SG_APP_POPUP_URL . '/javascript/jssocials.min.js');
38
+ wp_enqueue_script('jssocials.min');
39
+ wp_register_script('sg_social_backend', SG_APP_POPUP_URL . '/javascript/sg_social_backend.js',array('jquery'));
40
+ wp_enqueue_script('sg_social_backend');
41
+ }
42
+ if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
43
+ wp_enqueue_script('jquery-ui-datepicker');
44
+ wp_enqueue_script( 'sg_libs_handle', plugins_url('javascript/sg_datapickers.js',dirname(__FILE__)), array('wp-color-picker'));
45
  wp_register_script('sg_popup_pro', SG_APP_POPUP_URL . '/javascript/sg_popup_backend_pro.js');
46
  wp_enqueue_script('sg_popup_pro');
47
  }
 
 
 
48
  wp_enqueue_style( 'wp-color-picker' );
49
+
50
  }
51
  }
52
 
53
  function SgFrontendScripts() {
54
  wp_enqueue_script('sg_popup_core', plugins_url('/sg_popup_core.js', __FILE__), '1.0.0', true);
55
+ echo "<script type='text/javascript'>SG_POPUPS_QUEUE = [];SG_POPUP_DATA = [];SG_APP_POPUP_URL = '".SG_APP_POPUP_URL."';SG_POPUP_VERSION='".SG_POPUP_VERSION."_".POPUP_BUILDER_PKG."'</script>";
56
  }
57
 
58
  add_action('admin_enqueue_scripts', 'sg_set_admin_url');
popup-builder.php CHANGED
@@ -1,49 +1,22 @@
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.2.4
7
- * Author: Sygnoos
8
- * Author URI: http://www.sygnoos.com
9
- * License: GPLv2
10
- */
11
-
12
- //create some difine Pats
13
- define("SG_APP_POPUP_PATH", dirname(__FILE__));
14
- define('SG_APP_POPUP_URL', plugins_url('', __FILE__));
15
- define('SG_APP_POPUP_ADMIN_URL', admin_url());
16
- define('SG_APP_POPUP_FILE', plugin_basename(__FILE__));
17
- define('SG_APP_POPUP_FILES', SG_APP_POPUP_PATH . '/files');
18
- define('SG_APP_POPUP_CLASSES', SG_APP_POPUP_PATH . '/classes');
19
- define('SG_APP_POPUP_JS', SG_APP_POPUP_PATH . '/javascript');
20
- define('SG_APP_POPUP_TABLE_LIMIT', 15);
21
- define('SG_POPUP_PRO', 0);
22
- define('SG_POPUP_VERSION', 2.24);
23
- define('SG_POPUP_PRO_URL', 'http://sygnoos.com/wordpress-popup/');
24
- define("SG_SHOW_POPUP_REVIEW", get_option("SG_COLOSE_REVIEW_BLOCK"));
25
-
26
- $POPUP_TITLES = array(
27
- 'image' => 'Image',
28
- 'html' => 'HTML',
29
- 'fblike' => 'Facebook',
30
- 'iframe' => 'Iframe',
31
- 'video' => 'Video',
32
- 'shortcode' => 'Shortcode',
33
- 'ageRestriction' => 'Age Restriction',
34
- 'countdown' => 'Countdown',
35
- 'social' => 'Social',
36
- 'exitIntent' => 'Exit Intent',
37
- 'subscription' => 'Subscription',
38
- 'contactForm' => 'Contact Form'
39
- );
40
 
41
  require_once(SG_APP_POPUP_CLASSES .'/SGPopup.php');
42
  require_once(SG_APP_POPUP_FILES .'/sg_functions.php');
43
 
44
  require_once(SG_APP_POPUP_CLASSES .'/PopupInstaller.php'); //cretae tables
45
 
46
- if (SG_POPUP_PRO) {
47
  require_once( SG_APP_POPUP_CLASSES .'/PopupProInstaller.php'); //uninstall tables
48
  require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php"); // Pro functions
49
  }
@@ -59,7 +32,7 @@ add_action('wpmu_new_blog', 'sgNewBlogPopup', 10, 6);
59
  function sgNewBlogPopup()
60
  {
61
  PopupInstaller::install();
62
- if (SG_POPUP_PRO) {
63
  PopupProInstaller::install();
64
  }
65
  }
@@ -68,7 +41,7 @@ function sgPopupActivate()
68
  {
69
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
70
  PopupInstaller::install();
71
- if (SG_POPUP_PRO) {
72
  PopupProInstaller::install();
73
  }
74
  }
@@ -76,7 +49,7 @@ function sgPopupActivate()
76
  function sgPopupDeactivate()
77
  {
78
  PopupInstaller::uninstall();
79
- if (SG_POPUP_PRO) {
80
  PopupProInstaller::uninstall();
81
  }
82
 
@@ -90,7 +63,7 @@ function sgAddMenu()
90
  add_submenu_page("PopupBuilder", "All Popups", "All Popups", 'manage_options', "PopupBuilder", "sgPopupMenu");
91
  add_submenu_page("PopupBuilder", "Add New", "Add New", 'manage_options', "create-popup", "sgCreatePopup");
92
  add_submenu_page("PopupBuilder", "Edit Popup", "Edit Popup", 'manage_options', "edit-popup", "sgEditPopup");
93
- if (SG_POPUP_PRO) {
94
  add_submenu_page("PopupBuilder", "Subscribers", "Subscribers", 'manage_options', "subscribers", "sgSubscribers");
95
  }
96
  }
@@ -120,18 +93,22 @@ function sgRegisterScripts()
120
  SGPopup::$registeredScripts = true;
121
  wp_register_style('sg_animate', SG_APP_POPUP_URL . '/style/animate.css');
122
  wp_enqueue_style('sg_animate');
 
 
123
  wp_register_script('sg_popup_frontend', SG_APP_POPUP_URL . '/javascript/sg_popup_frontend.js', array('jquery'));
124
  wp_enqueue_script('sg_popup_frontend');
125
  wp_enqueue_script('jquery');
126
  wp_register_script('sg_colorbox', SG_APP_POPUP_URL . '/javascript/jquery.sgcolorbox-min.js', array('jquery'), '5.0');
127
  wp_enqueue_script('sg_colorbox');
128
- if (SG_POPUP_PRO) {
 
 
129
  wp_register_script('sgPopupPro', SG_APP_POPUP_URL . '/javascript/sg_popup_pro.js?ver=4.2.3');
130
  wp_enqueue_script('sgPopupPro');
131
- wp_register_script('sg_popup_support_plugins', SG_APP_POPUP_URL . '/javascript/sg_popup_support_plugins.js', array('jquery'));
132
- wp_enqueue_script('sg_popup_support_plugins');
133
  wp_register_script('sg_cookie', SG_APP_POPUP_URL . '/javascript/jquery_cookie.js', array('jquery'));
134
  wp_enqueue_script('sg_cookie');
 
 
135
  }
136
  }
137
 
@@ -159,6 +136,16 @@ function sgFindPopupData($id)
159
  if (!empty($obj)) {
160
  $content = $obj->render();
161
  }
 
 
 
 
 
 
 
 
 
 
162
  echo "<script type='text/javascript'>";
163
  echo $content;
164
  echo "</script>";
@@ -173,7 +160,12 @@ function sgShowShortCode($args, $content)
173
  }
174
  if(!empty($content)) {
175
  sgRenderPopupScript($args['id']);
176
- echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=".$args['id'].">".$content."</a>";
 
 
 
 
 
177
  }
178
  else {
179
  echo redenderScriptMode($args['id']);
@@ -210,7 +202,7 @@ function sgRenderPopupOpen($popupId)
210
  function showPopupInPage($popupId) {
211
 
212
 
213
- if(SG_POPUP_PRO){
214
 
215
  $isActivePopup = SgPopupPro::popupInTimeRange($popupId);
216
 
@@ -221,7 +213,7 @@ function showPopupInPage($popupId) {
221
  $showUser = SgPopupPro::showUserResolution($popupId);
222
  if(!$showUser) return false;
223
 
224
- if(!SGFunctions::allowPageCountry($popupId)) { /* Sended popupId and function return true or false */
225
  return;
226
  }
227
  }
@@ -232,7 +224,12 @@ function showPopupInPage($popupId) {
232
 
233
  function redenderScriptMode($popupId)
234
  {
235
-
 
 
 
 
 
236
  $exitIntentPopupId = get_option('SG_POPUP_EXITINTENT_'.$popupId);
237
 
238
  if(isset($exitIntentPopupId) && $exitIntentPopupId == $popupId) {
@@ -242,6 +239,12 @@ function redenderScriptMode($popupId)
242
  echo $exitObj->getExitIntentInitScript($popupId);
243
  return;
244
  }
 
 
 
 
 
 
245
  sgRenderPopupOpen($popupId);
246
  }
247
 
@@ -252,16 +255,47 @@ function sgOnloadPopup()
252
  //If popup is set on page load
253
  $popupId = SGPopup::getPagePopupId($page, $popup);
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  //If popup is set for all pages
256
  if($popupId != 0) {
257
  showPopupInPage($popupId);
258
  }
259
- if(SG_POPUP_PRO){
260
- $popupId = SgPopupPro::allowPopupInAllPages($page);
261
- if($popupId) {
262
- showPopupInPage($popupId);
263
- }
264
- }
265
  return false;
266
  }
267
 
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.2.5
7
+ * Author: Sygnoos
8
+ * Author URI: http://www.sygnoos.com
9
+ * License: GPLv2
10
+ */
11
+
12
+ require_once(dirname(__FILE__)."/config.php");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  require_once(SG_APP_POPUP_CLASSES .'/SGPopup.php');
15
  require_once(SG_APP_POPUP_FILES .'/sg_functions.php');
16
 
17
  require_once(SG_APP_POPUP_CLASSES .'/PopupInstaller.php'); //cretae tables
18
 
19
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
20
  require_once( SG_APP_POPUP_CLASSES .'/PopupProInstaller.php'); //uninstall tables
21
  require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php"); // Pro functions
22
  }
32
  function sgNewBlogPopup()
33
  {
34
  PopupInstaller::install();
35
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
36
  PopupProInstaller::install();
37
  }
38
  }
41
  {
42
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
43
  PopupInstaller::install();
44
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
45
  PopupProInstaller::install();
46
  }
47
  }
49
  function sgPopupDeactivate()
50
  {
51
  PopupInstaller::uninstall();
52
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
53
  PopupProInstaller::uninstall();
54
  }
55
 
63
  add_submenu_page("PopupBuilder", "All Popups", "All Popups", 'manage_options', "PopupBuilder", "sgPopupMenu");
64
  add_submenu_page("PopupBuilder", "Add New", "Add New", 'manage_options', "create-popup", "sgCreatePopup");
65
  add_submenu_page("PopupBuilder", "Edit Popup", "Edit Popup", 'manage_options', "edit-popup", "sgEditPopup");
66
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_SILVER) {
67
  add_submenu_page("PopupBuilder", "Subscribers", "Subscribers", 'manage_options', "subscribers", "sgSubscribers");
68
  }
69
  }
93
  SGPopup::$registeredScripts = true;
94
  wp_register_style('sg_animate', SG_APP_POPUP_URL . '/style/animate.css');
95
  wp_enqueue_style('sg_animate');
96
+ wp_register_script('sg_popup_init', SG_APP_POPUP_URL . '/javascript/sg_popup_init.js', array('jquery'));
97
+ wp_enqueue_script('sg_popup_init');
98
  wp_register_script('sg_popup_frontend', SG_APP_POPUP_URL . '/javascript/sg_popup_frontend.js', array('jquery'));
99
  wp_enqueue_script('sg_popup_frontend');
100
  wp_enqueue_script('jquery');
101
  wp_register_script('sg_colorbox', SG_APP_POPUP_URL . '/javascript/jquery.sgcolorbox-min.js', array('jquery'), '5.0');
102
  wp_enqueue_script('sg_colorbox');
103
+ wp_register_script('sg_popup_support_plugins', SG_APP_POPUP_URL . '/javascript/sg_popup_support_plugins.js', array('jquery'));
104
+ wp_enqueue_script('sg_popup_support_plugins');
105
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
106
  wp_register_script('sgPopupPro', SG_APP_POPUP_URL . '/javascript/sg_popup_pro.js?ver=4.2.3');
107
  wp_enqueue_script('sgPopupPro');
 
 
108
  wp_register_script('sg_cookie', SG_APP_POPUP_URL . '/javascript/jquery_cookie.js', array('jquery'));
109
  wp_enqueue_script('sg_cookie');
110
+ wp_register_script('sg_popup_queue', SG_APP_POPUP_URL . '/javascript/sg_popup_queue.js');
111
+ wp_enqueue_script('sg_popup_queue');
112
  }
113
  }
114
 
136
  if (!empty($obj)) {
137
  $content = $obj->render();
138
  }
139
+
140
+ if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_PLATINUM) {
141
+ $userCountryIso = SGFunctions::getUserLocationData($id);
142
+ if(!is_bool($userCountryIso)) {
143
+ echo "<script type='text/javascript'>SgUserData = {
144
+ 'countryIsoName': '$userCountryIso'
145
+ }</script>";
146
+ }
147
+ }
148
+
149
  echo "<script type='text/javascript'>";
150
  echo $content;
151
  echo "</script>";
160
  }
161
  if(!empty($content)) {
162
  sgRenderPopupScript($args['id']);
163
+ $attr = '';
164
+
165
+ if(isset($args['insidepopup'])) {
166
+ $attr .= 'insidePopup="on"';
167
+ }
168
+ echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=".$args['id']." $attr>".$content."</a>";
169
  }
170
  else {
171
  echo redenderScriptMode($args['id']);
202
  function showPopupInPage($popupId) {
203
 
204
 
205
+ if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
206
 
207
  $isActivePopup = SgPopupPro::popupInTimeRange($popupId);
208
 
213
  $showUser = SgPopupPro::showUserResolution($popupId);
214
  if(!$showUser) return false;
215
 
216
+ if(!SGPopup::showPopupForCounrty($popupId)) { /* Sended popupId and function return true or false */
217
  return;
218
  }
219
  }
224
 
225
  function redenderScriptMode($popupId)
226
  {
227
+ /* If user delete popup */
228
+ $obj = SGPopup::findById($popupId);
229
+ if(empty($obj)) {
230
+ return;
231
+ }
232
+ $multiplePopup = get_option('SG_MULTIPLE_POPUP');
233
  $exitIntentPopupId = get_option('SG_POPUP_EXITINTENT_'.$popupId);
234
 
235
  if(isset($exitIntentPopupId) && $exitIntentPopupId == $popupId) {
239
  echo $exitObj->getExitIntentInitScript($popupId);
240
  return;
241
  }
242
+ if($multiplePopup && @in_array($popupId, $multiplePopup)) {
243
+ sgRenderPopupScript($popupId);
244
+ return;
245
+ }
246
+
247
+
248
  sgRenderPopupOpen($popupId);
249
  }
250
 
255
  //If popup is set on page load
256
  $popupId = SGPopup::getPagePopupId($page, $popup);
257
 
258
+ if(get_option("SG_ALL_PAGES") && (is_page() || is_home() || is_front_page())) {
259
+ showPopupInPage(get_option("SG_ALL_PAGES"));
260
+ /* return because if has all pages popup it should be open only */
261
+ return;
262
+ }
263
+ if(get_option("SG_ALL_POSTS") && !(is_page() || is_home() || is_front_page())) {
264
+ showPopupInPage(get_option("SG_ALL_POSTS"));
265
+ /* return because if has all posts popup it should be open only */
266
+ return;
267
+ }
268
+
269
+ if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE){
270
+ delete_option("SG_MULTIPLE_POPUP");
271
+
272
+ /* Retrun all popups id width selected On All Pages */
273
+ $popupsId = SgPopupPro::allowPopupInAllPages($page);
274
+
275
+ /* $popupsId[0] its last selected popup id */
276
+ if(isset($popupsId[0])) {
277
+ delete_option("SG_MULTIPLE_POPUP");
278
+ if(count($popupsId) > 0) {
279
+ update_option("SG_MULTIPLE_POPUP",$popupsId);
280
+ }
281
+ foreach ($popupsId as $queuePupupId) {
282
+
283
+ showPopupInPage($queuePupupId);
284
+ }
285
+
286
+ $popupsId = json_encode($popupsId);
287
+ }
288
+ else {
289
+ $popupsId = json_encode(array());
290
+ }
291
+ echo '<script type="text/javascript">
292
+ SG_POPUPS_QUEUE = '.$popupsId.'</script>';
293
+ }
294
+
295
  //If popup is set for all pages
296
  if($popupId != 0) {
297
  showPopupInPage($popupId);
298
  }
 
 
 
 
 
 
299
  return false;
300
  }
301
 
readme.txt CHANGED
@@ -1,16 +1,16 @@
1
- === Popup Builder ===
2
  Plugin Name: Popup Builder
3
  Contributors: Sygnoos
4
  Author: Sygnoos
5
  Donate link: http://sygnoos.com/wordpress-popup/
6
- Tags: popup, ads, modal, responsive popup, fancybox, lightbox, youtube, video, iframe, vimeo, contact form, html popup, social, age restriction, countdown, facebook, subscription, exit intent popup
7
  Requires at least: 3.8
8
  Tested up to: 4.5.2
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
- The most complete popup plugin. Html popup, image popup, shortcode popup and many other popup types. Manage popup dimensions,effects,themes and more.
14
 
15
  == Description ==
16
 
@@ -36,6 +36,7 @@ With popup builder plugin you can insert any type of content, right into your Po
36
  * Set popup location on the screen
37
  * Change popup content background color
38
  * Customize popup overlay color and opacity
 
39
  * Responsive popup
40
  * Network/Multisite popup
41
  * On click popup
@@ -133,11 +134,15 @@ Go to the Popup Builder settings and set your desired options.
133
 
134
  == Changelog ==
135
 
 
 
 
 
136
  = Version 2.2.4 =
137
  * Bug fixed connected to data tables.
138
 
139
  = Version 2.2.3 =
140
- * Popup Z-index set to max value .
141
 
142
  = Version 2.2.2 =
143
  * Fully tested on WordPress 4.5.
@@ -187,7 +192,7 @@ Go to the Popup Builder settings and set your desired options.
187
  = Version 2.1.0 =
188
 
189
  * Added ability to close popup from itself. Just add html class to the element.
190
- * Ex. '&lt;a href="#" class="sg-popup-close"&gt;Close Popup&lt;/a&gt;'
191
 
192
  = Version 2.0.9 =
193
 
@@ -279,39 +284,62 @@ After creating your popup, go to the desired page or post and you will see a met
279
 
280
  **Can I put a popup to show after clicking something?**
281
 
282
- Yes. There is an "Insert popup" button which will insert the popup shortcode over any element (text, image, button, etc.) you want. Just select the element, click on the button, choose a popup and you are done!
283
-
 
 
 
284
 
285
 
286
  **How to make the Popup responsive?**
287
 
288
- To make your popup responsive you should do the following:
 
 
289
 
290
  Example of responsive popup:
291
-
292
-
293
-
294
-
 
 
 
 
295
 
296
 
297
  **What URL do I have to enter in the URL field of the facebook popup?**
298
-
 
 
 
 
 
299
 
300
  **Can I make the video play automatically in the Video popup? (PRO)**
301
-
302
-
 
 
 
 
303
 
304
  **What if I don't have any specific URL to be shared in my social popup?**
305
-
 
 
306
  **Why should I buy the PRO package?**
307
 
308
  The Free version of Popup Builder gives you anything you need for creating unlimited fully functional popups and insert them wherever you want. Our PRO package gives you the ability to create more specific popups, like iframe, video or shortcode popups. Also, advanced options will be available for you to disable popup closing, disable popup for mobile devices, show the popup only once, and many other features. So if you need these advanced popups and functionalities, get Popup Builder PRO <a href="http://sygnoos.com/wordpress-popup/">here</a>.
309
 
310
  **Can I create a popup and make it invisible for some countries? (PRO)**
311
-
 
312
 
313
  **What's Live Preview in Countdown, Subscription and Contact Form popups for? (PRO)**
314
-
 
 
315
 
316
  **Something is not working. What do I do?**
317
 
@@ -323,7 +351,7 @@ Leave us a good review :)
323
 
324
  == Upgrade Notice ==
325
 
326
- Current Version of Popup Builder is 2.2.3
327
 
328
  == Other Notes ==
329
 
@@ -400,5 +428,4 @@ This popup can be built up to your preferences, as there is a range of options a
400
 
401
  More popup descriptions coming soon.
402
 
403
- Popup Builder Team.
404
-
1
+ === Popup Builder ===
2
  Plugin Name: Popup Builder
3
  Contributors: Sygnoos
4
  Author: Sygnoos
5
  Donate link: http://sygnoos.com/wordpress-popup/
6
+ Tags: popup, ads, modal, responsive popup, fancybox, lightbox, youtube, video popup, iframe popup, vimeo, contact form, html popup, social popup, age restriction, countdown, facebook, subscription popup, exit intent popup
7
  Requires at least: 3.8
8
  Tested up to: 4.5.2
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
+ Popup builder is the most complete popup plugin. Html, image, shortcode and many other popup types. Manage popup dimensions, effects, themes.
14
 
15
  == Description ==
16
 
36
  * Set popup location on the screen
37
  * Change popup content background color
38
  * Customize popup overlay color and opacity
39
+ * Redirect user to another page when he/she clicks on popup content
40
  * Responsive popup
41
  * Network/Multisite popup
42
  * On click popup
134
 
135
  == Changelog ==
136
 
137
+ = Version 2.2.5 =
138
+ * Now you can insert a link (URL) of a page to which the customers will be redirected to, when clicking on the popup.
139
+ * Code cleanup.
140
+
141
  = Version 2.2.4 =
142
  * Bug fixed connected to data tables.
143
 
144
  = Version 2.2.3 =
145
+ * Popup Z-index set to max value.
146
 
147
  = Version 2.2.2 =
148
  * Fully tested on WordPress 4.5.
192
  = Version 2.1.0 =
193
 
194
  * Added ability to close popup from itself. Just add html class to the element.
195
+ * Ex. '<a href="#" class="sg-popup-close">Close Popup</a>'
196
 
197
  = Version 2.0.9 =
198
 
284
 
285
  **Can I put a popup to show after clicking something?**
286
 
287
+ Yes. There is an "Insert popup" button which will insert the popup shortcode over any element (text, image, button, etc.) you want. Just select the element, click on the button, choose a popup and you are done!
288
+
289
+ Ex. [sg_popup id="2"]Your text, or HTML element[/sg_popup]
290
+
291
+ Ex. [sg_popup id="2"]`<img src="https://sygnoos.com/images/sygnoos_logo_grey.png">`[/sg_popup]
292
 
293
 
294
  **How to make the Popup responsive?**
295
 
296
+ To make your popup responsive you should do the following:
297
+ Set width and height in percent(%) and then set Max width and Max height in pixels (px).
298
+ When the screen is too wide, Max width option will work and it will prevent showing popup large.
299
 
300
  Example of responsive popup:
301
+
302
+ Width: 80%
303
+
304
+ Height: 90%
305
+
306
+ Max width: 640px
307
+
308
+ Max height: 480px
309
 
310
 
311
  **What URL do I have to enter in the URL field of the facebook popup?**
312
+
313
+ You should enter the URL of the site you want to share.
314
+
315
+ **How to redirect user to specific page when he/she clicks on popup?**
316
+
317
+ In our Popup Builder plugin we have updated the old version of the "Dismiss on content click" option selecting which you could "Close" the popup. Now we have added a super powerful option to it. Now you can insert a link (URL) of a page to which the customers will be redirected to, when clicking on the popup.
318
 
319
  **Can I make the video play automatically in the Video popup? (PRO)**
320
+
321
+ 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.
322
+
323
+ **What do I have to write in the field "Label" of the Age Restriction popup? (PRO)**
324
+
325
+ You can write the text which you want to see on the button. ("Yes" or "No")
326
 
327
  **What if I don't have any specific URL to be shared in my social popup?**
328
+
329
+ You can select "Use active URL" and the current page URL will be shared.
330
+
331
  **Why should I buy the PRO package?**
332
 
333
  The Free version of Popup Builder gives you anything you need for creating unlimited fully functional popups and insert them wherever you want. Our PRO package gives you the ability to create more specific popups, like iframe, video or shortcode popups. Also, advanced options will be available for you to disable popup closing, disable popup for mobile devices, show the popup only once, and many other features. So if you need these advanced popups and functionalities, get Popup Builder PRO <a href="http://sygnoos.com/wordpress-popup/">here</a>.
334
 
335
  **Can I create a popup and make it invisible for some countries? (PRO)**
336
+
337
+ Our plugin has an option for such cases. You can select "Filter popup for selected countries" option, which allows you to select the countries in which you want the popup to be shown or hidden, because there can be some popups which you make for specific countries and you may not want them to be seen in some other countries in cases of targeting groups for your marketing. (Allow/Disallow)
338
 
339
  **What's Live Preview in Countdown, Subscription and Contact Form popups for? (PRO)**
340
+
341
+ Live preview is a great option which gives you an opportunity to see all the changes you make while creating your popup without saving it after every single change.
342
+
343
 
344
  **Something is not working. What do I do?**
345
 
351
 
352
  == Upgrade Notice ==
353
 
354
+ Current Version of Popup Builder is 2.2.4
355
 
356
  == Other Notes ==
357
 
428
 
429
  More popup descriptions coming soon.
430
 
431
+ Popup Builder Team.
 
style/sg_popup_style.css CHANGED
@@ -7,6 +7,10 @@
7
  display: none;
8
  }
9
 
 
 
 
 
10
  .sg-text-align {
11
  text-align: center;
12
  }
@@ -28,7 +32,7 @@
28
 
29
  .export-import-buttons-wrraper {
30
  float: right;
31
- margin-top: 10px;
32
  }
33
 
34
  .add-new-buttons {
@@ -1113,3 +1117,4 @@ input[name="theme"] {
1113
  margin: 0px auto;
1114
  }
1115
  }
 
7
  display: none;
8
  }
9
 
10
+ .sg-full-width {
11
+ width: 100%;
12
+ }
13
+
14
  .sg-text-align {
15
  text-align: center;
16
  }
32
 
33
  .export-import-buttons-wrraper {
34
  float: right;
35
+ margin: 10px 0px;
36
  }
37
 
38
  .add-new-buttons {
1117
  margin: 0px auto;
1118
  }
1119
  }
1120
+
style/sg_popup_style.php CHANGED
@@ -7,7 +7,19 @@ function sg_popup_admin_style($hook) {
7
  wp_enqueue_style('sg_popup_style');
8
  wp_register_style('sg_popup_animate', SG_APP_POPUP_URL . '/style/animate.css');
9
  wp_enqueue_style('sg_popup_animate');
10
- if (SG_POPUP_PRO) {
 
 
 
 
 
 
 
 
 
 
 
 
11
  wp_register_style('sg_bootstrap_input', SG_APP_POPUP_URL . "/style/bootstrap-tagsinput.css");
12
  wp_enqueue_style('sg_bootstrap_input');
13
  }
7
  wp_enqueue_style('sg_popup_style');
8
  wp_register_style('sg_popup_animate', SG_APP_POPUP_URL . '/style/animate.css');
9
  wp_enqueue_style('sg_popup_animate');
10
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_SILVER) {
11
+ wp_register_style('font_awesome', SG_APP_POPUP_URL . "/style/jssocial/font-awesome.min.css");
12
+ wp_enqueue_style('font_awesome');
13
+ wp_register_style('jssocials_main_css', SG_APP_POPUP_URL . "/style/jssocial/jssocials.css");
14
+ wp_enqueue_style('jssocials_main_css');
15
+ wp_register_style('jssocials_theme_tm', SG_APP_POPUP_URL . "/style/jssocial/jssocials-theme-classic.css");
16
+ wp_enqueue_style('jssocials_theme_tm');
17
+ wp_register_style('sg_flipclock_css', SG_APP_POPUP_URL . "/style/sg_flipclock.css");
18
+ wp_enqueue_style('sg_flipclock_css');
19
+ wp_register_style('sg_jqueryUi_css', SG_APP_POPUP_URL . "/style/jquery-ui.min.css");
20
+ wp_enqueue_style('sg_jqueryUi_css');
21
+ }
22
+ if(POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_PLATINUM) {
23
  wp_register_style('sg_bootstrap_input', SG_APP_POPUP_URL . "/style/bootstrap-tagsinput.css");
24
  wp_enqueue_style('sg_bootstrap_input');
25
  }
style/sgcolorbox/colorbox1.css CHANGED
@@ -1 +1 @@
1
- /*
2
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
3
  when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
4
  See: http://jacklmoore.com/notes/ie-transparency-problems/
 
5
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
6
  when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
7
  See: http://jacklmoore.com/notes/ie-transparency-problems/
 
1
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
2
  when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
3
  See: http://jacklmoore.com/notes/ie-transparency-problems/
4
+ /*
5
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
6
  when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
7
  See: http://jacklmoore.com/notes/ie-transparency-problems/
style/sgcolorbox/colorbox4.css CHANGED
@@ -1 +1 @@
1
- /*
2
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
3
  when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
4
  See: http://jacklmoore.com/notes/ie-transparency-problems/
 
5
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
6
  when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
7
  See: http://jacklmoore.com/notes/ie-transparency-problems/
 
1
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
2
  when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
3
  See: http://jacklmoore.com/notes/ie-transparency-problems/
4
+ /*
5
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
6
  when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
7
  See: http://jacklmoore.com/notes/ie-transparency-problems/
style/sgcolorbox/colorbox5.css CHANGED
@@ -1 +1 @@
1
- /*
2
  Colorbox Core Style:
 
3
  Colorbox Core Style:
 
1
  Colorbox Core Style:
2
+ /*
3
  Colorbox Core Style: