Popup Builder – Responsive WordPress Pop up - Version 2.5.0

Version Description

Current Version of Popup Builder is 2.4.8

Download this release

Release Info

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

Code changes from version 2.4.9 to 2.5.0

classes/PopupInstaller.php CHANGED
@@ -6,6 +6,7 @@ class PopupInstaller
6
  public static function createTables($blogId = '')
7
  {
8
  global $wpdb;
 
9
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
10
  $sgPopupBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_popup (
11
  `id` int(11) NOT NULL AUTO_INCREMENT,
@@ -46,10 +47,11 @@ class PopupInstaller
46
  `paths` TEXT NOT NULL,
47
  `type` varchar(255) NOT NULL,
48
  `options` TEXT NOT NULL,
 
49
  PRIMARY KEY (id)
50
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
51
 
52
- $extensionDataTable = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_popup_addons_connection (
53
  `id` int(11) NOT NULL AUTO_INCREMENT,
54
  `popupId` int(11) NOT NULL,
55
  `extensionKey` TEXT NOT NULL,
@@ -67,13 +69,14 @@ class PopupInstaller
67
  $wpdb->query($sgPopupFblikeBase);
68
  $wpdb->query($sgPopupShortcodeBase);
69
  $wpdb->query($sgPopupAddon);
70
- $wpdb->query($extensionDataTable);
71
-
72
  $columnInfo = $wpdb->query("SHOW COLUMNS FROM ".$wpdb->prefix.$blogId.SGPBExtension::SGPB_ADDON_TABLE_NAME." LIKE 'isEvent'");
73
  if(!$columnInfo) {
74
  $alterQuery = "ALTER TABLE ".$wpdb->prefix.$blogId.SGPBExtension::SGPB_ADDON_TABLE_NAME." ADD isEvent TINYINT UNSIGNED NOT NULL";
75
  $wpdb->query($alterQuery);
76
  }
 
77
  }
78
 
79
  public static function install()
@@ -134,6 +137,9 @@ class PopupInstaller
134
  $popupSettingsDrop = $wpdb->prefix.$blogId."sg_popup_settings";
135
  $popupSettingsSql = "DROP TABLE ". $popupSettingsDrop;
136
 
 
 
 
137
  $wpdb->query($popupSql);
138
  $wpdb->query($popupImageSql);
139
  $wpdb->query($popupHtmlSql);
@@ -141,6 +147,7 @@ class PopupInstaller
141
  $wpdb->query($popupShortcodeSql);
142
  $wpdb->query($popupAddonSql);
143
  $wpdb->query($popupSettingsSql);
 
144
  }
145
 
146
  public static function deleteSgPopupOptions($blogId = '')
6
  public static function createTables($blogId = '')
7
  {
8
  global $wpdb;
9
+
10
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
11
  $sgPopupBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_popup (
12
  `id` int(11) NOT NULL AUTO_INCREMENT,
47
  `paths` TEXT NOT NULL,
48
  `type` varchar(255) NOT NULL,
49
  `options` TEXT NOT NULL,
50
+ `isEvent` TINYINT UNSIGNED NOT NULL,
51
  PRIMARY KEY (id)
52
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
53
 
54
+ $addonsConnectionTable = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_popup_addons_connection (
55
  `id` int(11) NOT NULL AUTO_INCREMENT,
56
  `popupId` int(11) NOT NULL,
57
  `extensionKey` TEXT NOT NULL,
69
  $wpdb->query($sgPopupFblikeBase);
70
  $wpdb->query($sgPopupShortcodeBase);
71
  $wpdb->query($sgPopupAddon);
72
+ $wpdb->query($addonsConnectionTable);
73
+
74
  $columnInfo = $wpdb->query("SHOW COLUMNS FROM ".$wpdb->prefix.$blogId.SGPBExtension::SGPB_ADDON_TABLE_NAME." LIKE 'isEvent'");
75
  if(!$columnInfo) {
76
  $alterQuery = "ALTER TABLE ".$wpdb->prefix.$blogId.SGPBExtension::SGPB_ADDON_TABLE_NAME." ADD isEvent TINYINT UNSIGNED NOT NULL";
77
  $wpdb->query($alterQuery);
78
  }
79
+
80
  }
81
 
82
  public static function install()
137
  $popupSettingsDrop = $wpdb->prefix.$blogId."sg_popup_settings";
138
  $popupSettingsSql = "DROP TABLE ". $popupSettingsDrop;
139
 
140
+ $addonsConnectionTableName = $wpdb->prefix.$blogId."sg_popup_addons_connection";
141
+ $deleteAddonsConnectionTable = "DROP TABLE ". $addonsConnectionTableName;
142
+
143
  $wpdb->query($popupSql);
144
  $wpdb->query($popupImageSql);
145
  $wpdb->query($popupHtmlSql);
147
  $wpdb->query($popupShortcodeSql);
148
  $wpdb->query($popupAddonSql);
149
  $wpdb->query($popupSettingsSql);
150
+ $wpdb->query($deleteAddonsConnectionTable);
151
  }
152
 
153
  public static function deleteSgPopupOptions($blogId = '')
classes/SGFblikePopup.php CHANGED
@@ -72,22 +72,6 @@ class SGFblikePopup extends SGPopup
72
  $this->setFblikeOptions($arr['options']);
73
  }
74
 
75
- /**
76
- * Add popup data to footer
77
- *
78
- * @since 2.4.3
79
- *
80
- * @param string $currentPopupContent popup html content
81
- *
82
- * @return void
83
- *
84
- */
85
-
86
- public function addPopupContentToFooter($currentPopupContent) {
87
-
88
- echo $currentPopupContent;
89
- }
90
-
91
  protected function getExtraRenderOptions()
92
  {
93
  $options = json_decode($this->getFblikeOptions(), true);
@@ -123,8 +107,8 @@ class SGFblikePopup extends SGPopup
123
  /*Add this part of code right into the page to escape conflicts with shortcodes init functionlity*/
124
  $currentPopupContent = "<div id=\"sg-popup-content-".$this->getId()."\" style=\"display: none;\">&nbsp;<div id=\"sgpb-all-content-".$this->getId()."\">".$content."</div></div>";
125
 
126
- add_action('wp_footer', array($this, 'addPopupContentToFooter'), 100, 1);
127
- do_action("wp_footer", $currentPopupContent);
128
  $content = ' ';
129
  }
130
  else {
72
  $this->setFblikeOptions($arr['options']);
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  protected function getExtraRenderOptions()
76
  {
77
  $options = json_decode($this->getFblikeOptions(), true);
107
  /*Add this part of code right into the page to escape conflicts with shortcodes init functionlity*/
108
  $currentPopupContent = "<div id=\"sg-popup-content-".$this->getId()."\" style=\"display: none;\">&nbsp;<div id=\"sgpb-all-content-".$this->getId()."\">".$content."</div></div>";
109
 
110
+ $this->sgAddPopupContentToFooter($currentPopupContent);
111
+
112
  $content = ' ';
113
  }
114
  else {
classes/SGHtmlPopup.php CHANGED
@@ -47,22 +47,6 @@ class SGHtmlPopup extends SGPopup {
47
  $this->setContent($arr['content']);
48
  }
49
 
50
- /**
51
- * Add popup data to footer
52
- *
53
- * @since 2.4.3
54
- *
55
- * @param string $currentPopupContent popup html content
56
- *
57
- * @return void
58
- *
59
- */
60
-
61
- public function addPopupContentToFooter($currentPopupContent) {
62
-
63
- echo $currentPopupContent;
64
- }
65
-
66
  protected function getExtraRenderOptions() {
67
  $content = trim($this->getContent());
68
  $hasShortcode = $this->hasPopupContentShortcode($content);
@@ -72,9 +56,8 @@ class SGHtmlPopup extends SGPopup {
72
  $content = $this->improveContent($content);
73
  /*Add this part of code right into the page to escape conflicts with shortcodes init functionlity*/
74
  $currentPopupContent = "<div id=\"sg-popup-content-".$this->getId()."\" style=\"display: none;\">&nbsp;<div id=\"sgpb-all-content-".$this->getId()."\">".$content."</div></div>";
75
-
76
- add_action('wp_footer', array($this, 'addPopupContentToFooter'), 100, 1);
77
- do_action("wp_footer", $currentPopupContent);
78
 
79
  $content = ' ';
80
  }
47
  $this->setContent($arr['content']);
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  protected function getExtraRenderOptions() {
51
  $content = trim($this->getContent());
52
  $hasShortcode = $this->hasPopupContentShortcode($content);
56
  $content = $this->improveContent($content);
57
  /*Add this part of code right into the page to escape conflicts with shortcodes init functionlity*/
58
  $currentPopupContent = "<div id=\"sg-popup-content-".$this->getId()."\" style=\"display: none;\">&nbsp;<div id=\"sgpb-all-content-".$this->getId()."\">".$content."</div></div>";
59
+
60
+ $this->sgAddPopupContentToFooter($currentPopupContent);
 
61
 
62
  $content = ' ';
63
  }
classes/SGPBExtensionManager.php CHANGED
@@ -160,6 +160,10 @@ class SGPBExtensionManager {
160
  if (isset($savedOptions[$optionKey])) {
161
  $elementValue = $savedOptions[$optionKey];
162
  }
 
 
 
 
163
  else {
164
  $elementValue = $defaultOptions[$optionKey];
165
  }
160
  if (isset($savedOptions[$optionKey])) {
161
  $elementValue = $savedOptions[$optionKey];
162
  }
163
+ else if(!empty($savedOptions) && $isBool) {
164
+ /*for checkbox elements when they does not exist in the saved data*/
165
+ $elementValue = '';
166
+ }
167
  else {
168
  $elementValue = $defaultOptions[$optionKey];
169
  }
classes/SGPopup.php CHANGED
@@ -223,7 +223,7 @@ abstract class SGPopup {
223
  }
224
 
225
  public function improveContent($content) {
226
- $hasSameShortcode = strpos($content,'id="'.$this->getId().'"');
227
 
228
  if(POPUP_BUILDER_PKG !== POPUP_BUILDER_PKG_FREE && !$hasSameShortcode) {
229
  require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php");
@@ -400,6 +400,24 @@ abstract class SGPopup {
400
  return $arr;
401
  }
402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  }
404
 
405
  function sgSafeStr ($param) {
223
  }
224
 
225
  public function improveContent($content) {
226
+ $hasSameShortcode = strpos($content,'sg_popup id="'.$this->getId().'"');
227
 
228
  if(POPUP_BUILDER_PKG !== POPUP_BUILDER_PKG_FREE && !$hasSameShortcode) {
229
  require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php");
400
  return $arr;
401
  }
402
 
403
+ /**
404
+ * Add popup data to footer
405
+ *
406
+ * @since 2.5.0
407
+ *
408
+ * @param string $content popup html content
409
+ *
410
+ * @return void
411
+ *
412
+ */
413
+
414
+ public function sgAddPopupContentToFooter($content) {
415
+
416
+ add_action('wp_footer', function() use ($content){
417
+ echo $content;
418
+ }, 1);
419
+ }
420
+
421
  }
422
 
423
  function sgSafeStr ($param) {
classes/SGShortcodePopup.php CHANGED
@@ -44,30 +44,12 @@ class SGShortcodePopup extends SGPopup {
44
  $this->setShortcode($arr['url']);
45
  }
46
 
47
- /**
48
- * Add popup data to footer
49
- *
50
- * @since 2.4.3
51
- *
52
- * @param string $currentPopupContent popup html content
53
- *
54
- * @return void
55
- *
56
- */
57
-
58
- public function addPopupContentToFooter($currentPopupContent) {
59
-
60
- echo $currentPopupContent;
61
- }
62
-
63
  protected function getExtraRenderOptions() {
64
  $content = do_shortcode($this->getShortcode());
65
  /*Add this part of code right into the page to escape conflicts with shortcodes init functionlity*/
66
  $currentPopupContent = "<div id=\"sg-popup-content-".$this->getId()."\" style=\"display: none;\">&nbsp;<div id=\"sgpb-all-content-".$this->getId()."\">".$content."</div></div>";
67
-
68
- /*Append to body for shortcode break to new line*/
69
- add_action('wp_footer', array($this, 'addPopupContentToFooter'), 100, 1);
70
- do_action("wp_footer", $currentPopupContent);
71
 
72
  return array('shortcode'=> ' ');
73
  }
44
  $this->setShortcode($arr['url']);
45
  }
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  protected function getExtraRenderOptions() {
48
  $content = do_shortcode($this->getShortcode());
49
  /*Add this part of code right into the page to escape conflicts with shortcodes init functionlity*/
50
  $currentPopupContent = "<div id=\"sg-popup-content-".$this->getId()."\" style=\"display: none;\">&nbsp;<div id=\"sgpb-all-content-".$this->getId()."\">".$content."</div></div>";
51
+
52
+ $this->sgAddPopupContentToFooter($currentPopupContent);
 
 
53
 
54
  return array('shortcode'=> ' ');
55
  }
config.php CHANGED
@@ -1,63 +1,90 @@
1
  <?php
2
- if (!defined( 'ABSPATH' )) {
3
- exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- define("SG_APP_POPUP_PATH", dirname(__FILE__));
7
- define('SG_APP_POPUP_URL', plugins_url('', __FILE__));
8
- define('SG_APP_POPUP_ADMIN_URL', admin_url());
9
- define('SG_APP_POPUP_FILE', plugin_basename(__FILE__));
10
- define('SG_APP_POPUP_FILES', SG_APP_POPUP_PATH . '/files');
11
- define('SG_APP_POPUP_CLASSES', SG_APP_POPUP_PATH . '/classes');
12
- define('SG_APP_POPUP_JS', SG_APP_POPUP_PATH . '/javascript');
13
- define('SG_APP_POPUP_HELPERS', SG_APP_POPUP_PATH . '/helpers/');
14
- define('SG_APP_POPUP_TABLE_LIMIT', 15);
15
- define('SG_POPUP_VERSION', 2.49);
16
- define('SG_POPUP_PRO_URL', 'http://popup-builder.com/');
17
- define('SG_POPUP_EXTENSION_URL', 'http://popup-builder.com/extensions');
18
- define('SG_MAILCHIMP_EXTENSION_URL', 'http://popup-builder.com/downloads/mailchimp/');
19
- define('SG_ANALYTICS_EXTENSION_URL', 'http://popup-builder.com/downloads/analytics/');
20
- define('SG_AWEBER_EXTENSION_URL', 'http://popup-builder.com/downloads/aweber/');
21
- define('SG_EXITINTENT_EXTENSION_URL', 'http://popup-builder.com/downloads/exit-intent/');
22
- define('SG_ADBLOCK_EXTENSION_URL', 'http://popup-builder.com/downloads/adblock/');
23
- define('SG_IP_TO_COUNTRY_SERVICE_TIMEOUT', 2);
24
- define("SG_SHOW_POPUP_REVIEW", get_option("SG_COLOSE_REVIEW_BLOCK"));
25
- define("SG_POSTS_PER_PAGE", 1000);
26
- /*Example 1 minute*/
27
- define("SG_FILTER_REPEAT_INTERVAL", 1);
28
- define("SG_POST_TYPE_PAGE", "allPages");
29
- define("SG_POST_TYPE_POST", "allPosts");
30
-
31
- define('POPUP_BUILDER_PKG_FREE', 1);
32
- define('POPUP_BUILDER_PKG_SILVER', 2);
33
- define('POPUP_BUILDER_PKG_GOLD', 3);
34
- define('POPUP_BUILDER_PKG_PLATINUM', 4);
35
-
36
- global $POPUP_TITLES;
37
- global $POPUP_ADDONS;
38
-
39
- $POPUP_TITLES = array(
40
- 'image' => 'Image',
41
- 'html' => 'HTML',
42
- 'fblike' => 'Facebook',
43
- 'iframe' => 'Iframe',
44
- 'video' => 'Video',
45
- 'shortcode' => 'Shortcode',
46
- 'ageRestriction' => 'Age Restriction',
47
- 'countdown' => 'Countdown',
48
- 'social' => 'Social',
49
- 'exitIntent' => 'Exit Intent',
50
- 'subscription' => 'Subscription',
51
- 'contactForm' => 'Contact Form',
52
- );
53
-
54
- $POPUP_ADDONS = array(
55
- 'aweber',
56
- 'mailchimp',
57
- 'analytics',
58
- 'exitIntent',
59
- 'adBlock'
60
- );
61
-
62
-
63
- require_once(dirname(__FILE__).'/config-pkg.php');
1
  <?php
2
+ class SgPopupBuilderConfig {
3
+
4
+ public function __construct() {
5
+ $this->init();
6
+ }
7
+
8
+ private function init() {
9
+
10
+ if (!defined( 'ABSPATH' )) {
11
+ exit();
12
+ }
13
+
14
+ define("SG_APP_POPUP_PATH", dirname(__FILE__));
15
+ define('SG_APP_POPUP_URL', plugins_url('', __FILE__));
16
+ define('SG_APP_POPUP_ADMIN_URL', admin_url());
17
+ define('SG_APP_POPUP_FILE', plugin_basename(__FILE__));
18
+ define('SG_APP_POPUP_FILES', SG_APP_POPUP_PATH . '/files');
19
+ define('SG_APP_POPUP_CLASSES', SG_APP_POPUP_PATH . '/classes');
20
+ define('SG_APP_POPUP_JS', SG_APP_POPUP_PATH . '/javascript');
21
+ define('SG_APP_POPUP_HELPERS', SG_APP_POPUP_PATH . '/helpers/');
22
+ define('SG_APP_POPUP_TABLE_LIMIT', 15);
23
+ define('SG_POPUP_VERSION', 2.50);
24
+ define('SG_POPUP_PRO_VERSION', 3.20);
25
+ define('SG_POPUP_PRO_URL', 'http://popup-builder.com/');
26
+ define('SG_POPUP_EXTENSION_URL', 'http://popup-builder.com/extensions');
27
+ define('SG_MAILCHIMP_EXTENSION_URL', 'http://popup-builder.com/downloads/mailchimp/');
28
+ define('SG_ANALYTICS_EXTENSION_URL', 'http://popup-builder.com/downloads/analytics/');
29
+ define('SG_AWEBER_EXTENSION_URL', 'http://popup-builder.com/downloads/aweber/');
30
+ define('SG_EXITINTENT_EXTENSION_URL', 'http://popup-builder.com/downloads/exit-intent/');
31
+ define('SG_ADBLOCK_EXTENSION_URL', 'http://popup-builder.com/downloads/adblock/');
32
+ define('SG_IP_TO_COUNTRY_SERVICE_TIMEOUT', 2);
33
+ define("SG_SHOW_POPUP_REVIEW", get_option("SG_COLOSE_REVIEW_BLOCK"));
34
+ define("SG_POSTS_PER_PAGE", 1000);
35
+ define("SG_POPUP_MINIMUM_PHP_VERSION", '5.3.3');
36
+ /*Example 1 minute*/
37
+ define("SG_FILTER_REPEAT_INTERVAL", 1);
38
+ define("SG_POST_TYPE_PAGE", "allPages");
39
+ define("SG_POST_TYPE_POST", "allPosts");
40
+
41
+ define('POPUP_BUILDER_PKG_FREE', 1);
42
+ define('POPUP_BUILDER_PKG_SILVER', 2);
43
+ define('POPUP_BUILDER_PKG_GOLD', 3);
44
+ define('POPUP_BUILDER_PKG_PLATINUM', 4);
45
+
46
+ global $POPUP_TITLES;
47
+ global $POPUP_ADDONS;
48
+
49
+ $POPUP_TITLES = array(
50
+ 'image' => 'Image',
51
+ 'html' => 'HTML',
52
+ 'fblike' => 'Facebook',
53
+ 'iframe' => 'Iframe',
54
+ 'video' => 'Video',
55
+ 'shortcode' => 'Shortcode',
56
+ 'ageRestriction' => 'Age Restriction',
57
+ 'countdown' => 'Countdown',
58
+ 'social' => 'Social',
59
+ 'exitIntent' => 'Exit Intent',
60
+ 'subscription' => 'Subscription',
61
+ 'contactForm' => 'Contact Form',
62
+ );
63
+
64
+ $POPUP_ADDONS = array(
65
+ 'aweber',
66
+ 'mailchimp',
67
+ 'analytics',
68
+ 'exitIntent',
69
+ 'adBlock'
70
+ );
71
+
72
+
73
+ require_once(dirname(__FILE__).'/config-pkg.php');
74
+
75
+ }
76
+
77
+ public static function popupJsDataInit() {
78
+
79
+ $popupBuilderVersion = SG_POPUP_VERSION;
80
+ if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
81
+ $popupBuilderVersion = SG_POPUP_PRO_VERSION;
82
+ }
83
+
84
+ $dataString = "<script type='text/javascript'>SG_POPUPS_QUEUE = [];SG_POPUP_DATA = [];SG_APP_POPUP_URL = '".SG_APP_POPUP_URL."';SG_POPUP_VERSION='".$popupBuilderVersion."_".POPUP_BUILDER_PKG.";'</script>";
85
+
86
+ return $dataString;
87
+ }
88
  }
89
 
90
+ $popupConf = new SgPopupBuilderConfig();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
files/options_section/pro.php CHANGED
@@ -23,7 +23,7 @@
23
  <div class="js-all-pages-content acordion-main-div-content">
24
  <?php echo createRadiobuttons($pagesRadio, SG_POST_TYPE_PAGE, true, esc_html($sgAllPages), "liquid-width"); ?>
25
  <div class="js-pages-selectbox-content acordion-main-div-content">
26
- <span class="liquid-width sg-pages-title">Pages</span>
27
  <select class="js-all-pages js-multiselect" multiple data-slectbox="all-selected-page" data-sorce="<?php echo SG_POST_TYPE_PAGE; ?>" size="10" class="popup-builder-multiselect">
28
 
29
  </select>
@@ -36,7 +36,7 @@
36
  <div class="js-all-posts-content acordion-main-div-content">
37
  <?php echo createRadiobuttons($postsRadio, SG_POST_TYPE_POST, true, esc_html($sgAllPosts), "liquid-width"); ?>
38
  <div class="js-posts-selectbox-content acordion-main-div-content">
39
- <span class="liquid-width sg-pages-title">Posts</span>
40
  <select class="js-all-posts js-multiselect" multiple data-slectbox="all-selected-posts" data-sorce="<?php echo SG_POST_TYPE_POST; ?>" size="10" class="popup-builder-multiselect">
41
 
42
  </select>
@@ -44,17 +44,17 @@
44
  <input type="hidden" class="js-sg-selected-posts" name="all-selected-posts" value="<?php echo $sgAllSelectedPosts; ?>">
45
  </div>
46
  <div class="js-all-categories-content acordion-main-div-content">
47
- <span class="liquid-width sg-pages-title">All categories</span>
48
  <?php
49
  $categories = SgPopupGetData::getPostsAllCategories();
50
  echo SGFunctions::createSelectBox($categories, @$sgPostsAllCategories, array("name"=>"posts-all-categories[]","multiple"=>"multiple","size"=>10,"class"=>"popup-builder-multiselect")); ?>
51
  </div>
52
  </div>
53
 
54
- <span class="liquid-width">Show on selected custom posts:</span><input class="input-width-static js-on-all-custom-posts" type="checkbox" name="allCustomPostsStatus" <?php echo @$sgAllCustomPostsStatus;?>>
55
  <span class="dashicons dashicons-info same-image-style"></span><span class="infoForMobile samefontStyle">Select post where popup should be shown.</span><br>
56
  <div class="js-all-custom-posts-content acordion-main-div-content">
57
- <span class="liquid-width sg-pages-title">Custom Posts</span>
58
  <?php
59
  $allCustomPosts = SgPopupGetData::getAllCustomPosts();
60
  echo SGFunctions::createSelectBox($allCustomPosts, @$sgAllCustomPostsType, array("name"=>"all-custom-posts[]","multiple"=>"multiple","size"=>10,"class"=>"popup-builder-multiselect"))."<br>";
@@ -72,15 +72,15 @@
72
  <span class="liquid-width">Show while scrolling:</span><input id="js-scrolling-event-inp" class="input-width-static js-checkbox-acordion" type="checkbox" name="onScrolling" <?php echo @$sgOnScrolling;?> >
73
  <span id="scrollingEvent" class="dashicons dashicons-info same-image-style"></span><span class="infoScrollingEvent samefontStyle">Show the popup whenever the user scrolls the page.</span><br>
74
  <div class="js-scrolling-content acordion-main-div-content">
75
- <span class="liquid-width">Show popup after scrolling</span><input class="before-scroling-percent improveOptionsstyle" type="text" name="beforeScrolingPrsent" value="<?php echo esc_attr(@$beforeScrolingPrsent); ?>">
76
  <span class="span-percent">%</span>
77
  </div>
78
  <?php endif; ?>
79
  <span class="liquid-width">Show after inactivity</span><input id="js-inactivity-event-inp" class="input-width-static js-checkbox-acordion" type="checkbox" name="inActivityStatus" <?php echo $sgInActivityStatus;?> >
80
  <span id="scrollingEvent" class="dashicons dashicons-info same-image-style"></span><span class="infoScrollingEvent samefontStyle">Show the popup whenever the user scrolls the page.</span><br>
81
  <div class="js-inactivity-content acordion-main-div-content">
82
- <span class="liquid-width">Show popup after</span><input class="improveOptionsstyle before-scroling-percent" type="number" name="inactivity-timout" value="<?php echo esc_attr(@$sgInactivityTimout); ?>">
83
- <span class="span-percent">Sec</span>
84
  </div>
85
 
86
 
@@ -93,8 +93,8 @@
93
  <span class="liquid-width">Show popup in date range:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popup-timer-status" <?php echo $sgPopupTimerStatus;?>>
94
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show popup for selected date range. If current date is in selected date range then popup will appear.</span><br>
95
  <div class="acordion-main-div-content">
96
- <span class="liquid-width">Start date</span><input class="popup-start-timer" type="text" name="popup-start-timer" value="<?php echo esc_attr(@$sgPopupStartTimer)?>"><br>
97
- <span class="liquid-width">End date</span><input class="popup-finish-timer" type="text" name="popup-finish-timer" value="<?php echo esc_attr(@$sgPopupFinishTimer)?>"><br>
98
  </div>
99
  <span class="liquid-width">Schedule:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popup-schedule-status" <?php echo $sgPopupScheduleStatus;?>>
100
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show popup for selected date range. If current date is in selected date range then popup will appear.</span><br>
@@ -114,11 +114,11 @@
114
  <span class="liquid-width">Show popup this often:</span><input class="input-width-static js-checkbox-acordion" id="js-popup-only-once" type="checkbox" name="repeatPopup" <?php echo $sgRepeatPopup;?>>
115
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show the popup to a user only once.</span><br>
116
  <div class="acordion-main-div-content js-popup-only-once-content">
117
- <span class="liquid-width">Show popup less than </span><input class="before-scroling-percent" type="number" min="1" name="popup-appear-number-limit" value="<?php echo esc_attr(@$sgPopupAppearNumberLimit); ?>">
118
  <span class="span-percent">for same user</span><br>
119
- <span class="liquid-width">Expire time</span><input class="before-scroling-percent improveOptionsstyle" type="number" min="1" name="onceExpiresTime" value="<?php echo esc_attr(@$sgOnceExpiresTime); ?>">
120
- <span class="span-percent">Days</span><br>
121
- <span class="liquid-width">Page level cookie saving</span>
122
  <input type="checkbox" name="save-cookie-page-level" <?php echo $sgPopupCookiePageLevel; ?>>
123
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">If this option is checked popup's cookie will be saved for a current page.By default cookie is set for all site.</span>
124
  </div>
@@ -127,7 +127,7 @@
127
  <span class="liquid-width">Show popup by user status:</span><input class="js-checkbox-acordion js-user-seperator" type="checkbox" name="sg-user-status" <?php echo $sgUserSeperate; ?>>
128
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show Popup if the user is logged in to your site or vice versa.</span><br>
129
  <div class="acordion-main-div-content js-user-seperator-content">
130
- <span class="liquid-width">User is</span><?php echo SGFunctions::sgCreateRadioElements($usersGroup, @$sgLogedUser);?>
131
  </div>
132
 
133
  <span class="liquid-width">Disable popup closing:</span><input class="input-width-static" type="checkbox" name="disablePopup" <?php echo $sgDisablePopup;?>>
@@ -139,7 +139,7 @@
139
  <span class="liquid-width">Auto close popup:</span><input id="js-auto-close" class="input-width-static js-checkbox-acordion" type="checkbox" name="autoClosePopup" <?php echo $sgAutoClosePopup;?>>
140
  <span class="dashicons dashicons-info same-image-style"></span><span class="infoAutoClose samefontStyle">Close popup automatically.</span><br>
141
  <div class="js-auto-close-content acordion-main-div-content">
142
- <span class="liquid-width" >After</span><input class="popupTimer improveOptionsstyle" type="text" name="popupClosingTimer" value="<?php echo esc_attr(@$sgPopupClosingTimer);?>"><span class="scroll-percent">seconds</span>
143
  </div>
144
  <?php if(POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_PLATINUM): ?>
145
  <span class="liquid-width">Filter popup for selected countries:</span><input id="js-countris" class="input-width-static js-checkbox-acordion" type="checkbox" name="countryStatus" <?php echo @$sgCountryStatus;?>>
23
  <div class="js-all-pages-content acordion-main-div-content">
24
  <?php echo createRadiobuttons($pagesRadio, SG_POST_TYPE_PAGE, true, esc_html($sgAllPages), "liquid-width"); ?>
25
  <div class="js-pages-selectbox-content acordion-main-div-content">
26
+ <span class="liquid-width sg-pages-title">pages</span>
27
  <select class="js-all-pages js-multiselect" multiple data-slectbox="all-selected-page" data-sorce="<?php echo SG_POST_TYPE_PAGE; ?>" size="10" class="popup-builder-multiselect">
28
 
29
  </select>
36
  <div class="js-all-posts-content acordion-main-div-content">
37
  <?php echo createRadiobuttons($postsRadio, SG_POST_TYPE_POST, true, esc_html($sgAllPosts), "liquid-width"); ?>
38
  <div class="js-posts-selectbox-content acordion-main-div-content">
39
+ <span class="liquid-width sg-pages-title">posts</span>
40
  <select class="js-all-posts js-multiselect" multiple data-slectbox="all-selected-posts" data-sorce="<?php echo SG_POST_TYPE_POST; ?>" size="10" class="popup-builder-multiselect">
41
 
42
  </select>
44
  <input type="hidden" class="js-sg-selected-posts" name="all-selected-posts" value="<?php echo $sgAllSelectedPosts; ?>">
45
  </div>
46
  <div class="js-all-categories-content acordion-main-div-content">
47
+ <span class="liquid-width sg-pages-title">all categories</span>
48
  <?php
49
  $categories = SgPopupGetData::getPostsAllCategories();
50
  echo SGFunctions::createSelectBox($categories, @$sgPostsAllCategories, array("name"=>"posts-all-categories[]","multiple"=>"multiple","size"=>10,"class"=>"popup-builder-multiselect")); ?>
51
  </div>
52
  </div>
53
 
54
+ <span class="liquid-width">Show on selected Custom posts:</span><input class="input-width-static js-on-all-custom-posts" type="checkbox" name="allCustomPostsStatus" <?php echo @$sgAllCustomPostsStatus;?>>
55
  <span class="dashicons dashicons-info same-image-style"></span><span class="infoForMobile samefontStyle">Select post where popup should be shown.</span><br>
56
  <div class="js-all-custom-posts-content acordion-main-div-content">
57
+ <span class="liquid-width sg-pages-title">custom Posts</span>
58
  <?php
59
  $allCustomPosts = SgPopupGetData::getAllCustomPosts();
60
  echo SGFunctions::createSelectBox($allCustomPosts, @$sgAllCustomPostsType, array("name"=>"all-custom-posts[]","multiple"=>"multiple","size"=>10,"class"=>"popup-builder-multiselect"))."<br>";
72
  <span class="liquid-width">Show while scrolling:</span><input id="js-scrolling-event-inp" class="input-width-static js-checkbox-acordion" type="checkbox" name="onScrolling" <?php echo @$sgOnScrolling;?> >
73
  <span id="scrollingEvent" class="dashicons dashicons-info same-image-style"></span><span class="infoScrollingEvent samefontStyle">Show the popup whenever the user scrolls the page.</span><br>
74
  <div class="js-scrolling-content acordion-main-div-content">
75
+ <span class="liquid-width">show popup after scrolling</span><input class="before-scroling-percent improveOptionsstyle" type="text" name="beforeScrolingPrsent" value="<?php echo esc_attr(@$beforeScrolingPrsent); ?>">
76
  <span class="span-percent">%</span>
77
  </div>
78
  <?php endif; ?>
79
  <span class="liquid-width">Show after inactivity</span><input id="js-inactivity-event-inp" class="input-width-static js-checkbox-acordion" type="checkbox" name="inActivityStatus" <?php echo $sgInActivityStatus;?> >
80
  <span id="scrollingEvent" class="dashicons dashicons-info same-image-style"></span><span class="infoScrollingEvent samefontStyle">Show the popup whenever the user scrolls the page.</span><br>
81
  <div class="js-inactivity-content acordion-main-div-content">
82
+ <span class="liquid-width">show popup after</span><input class="improveOptionsstyle before-scroling-percent" type="number" name="inactivity-timout" value="<?php echo esc_attr(@$sgInactivityTimout); ?>">
83
+ <span class="span-percent">sec</span>
84
  </div>
85
 
86
 
93
  <span class="liquid-width">Show popup in date range:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popup-timer-status" <?php echo $sgPopupTimerStatus;?>>
94
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show popup for selected date range. If current date is in selected date range then popup will appear.</span><br>
95
  <div class="acordion-main-div-content">
96
+ <span class="liquid-width">start date</span><input class="popup-start-timer" type="text" name="popup-start-timer" value="<?php echo esc_attr(@$sgPopupStartTimer)?>"><br>
97
+ <span class="liquid-width">end date</span><input class="popup-finish-timer" type="text" name="popup-finish-timer" value="<?php echo esc_attr(@$sgPopupFinishTimer)?>"><br>
98
  </div>
99
  <span class="liquid-width">Schedule:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popup-schedule-status" <?php echo $sgPopupScheduleStatus;?>>
100
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show popup for selected date range. If current date is in selected date range then popup will appear.</span><br>
114
  <span class="liquid-width">Show popup this often:</span><input class="input-width-static js-checkbox-acordion" id="js-popup-only-once" type="checkbox" name="repeatPopup" <?php echo $sgRepeatPopup;?>>
115
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show the popup to a user only once.</span><br>
116
  <div class="acordion-main-div-content js-popup-only-once-content">
117
+ <span class="liquid-width">show popup less than </span><input class="before-scroling-percent" type="number" min="1" name="popup-appear-number-limit" value="<?php echo esc_attr(@$sgPopupAppearNumberLimit); ?>">
118
  <span class="span-percent">for same user</span><br>
119
+ <span class="liquid-width">expire time</span><input class="before-scroling-percent improveOptionsstyle" type="number" min="1" name="onceExpiresTime" value="<?php echo esc_attr(@$sgOnceExpiresTime); ?>">
120
+ <span class="span-percent">days</span><br>
121
+ <span class="liquid-width">page level cookie saving</span>
122
  <input type="checkbox" name="save-cookie-page-level" <?php echo $sgPopupCookiePageLevel; ?>>
123
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">If this option is checked popup's cookie will be saved for a current page.By default cookie is set for all site.</span>
124
  </div>
127
  <span class="liquid-width">Show popup by user status:</span><input class="js-checkbox-acordion js-user-seperator" type="checkbox" name="sg-user-status" <?php echo $sgUserSeperate; ?>>
128
  <span class="dashicons dashicons-info repeatPopup same-image-style"></span><span class="infoSelectRepeat samefontStyle">Show Popup if the user is logged in to your site or vice versa.</span><br>
129
  <div class="acordion-main-div-content js-user-seperator-content">
130
+ <span class="liquid-width">user is</span><?php echo SGFunctions::sgCreateRadioElements($usersGroup, @$sgLogedUser);?>
131
  </div>
132
 
133
  <span class="liquid-width">Disable popup closing:</span><input class="input-width-static" type="checkbox" name="disablePopup" <?php echo $sgDisablePopup;?>>
139
  <span class="liquid-width">Auto close popup:</span><input id="js-auto-close" class="input-width-static js-checkbox-acordion" type="checkbox" name="autoClosePopup" <?php echo $sgAutoClosePopup;?>>
140
  <span class="dashicons dashicons-info same-image-style"></span><span class="infoAutoClose samefontStyle">Close popup automatically.</span><br>
141
  <div class="js-auto-close-content acordion-main-div-content">
142
+ <span class="liquid-width" >after</span><input class="popupTimer improveOptionsstyle" type="text" name="popupClosingTimer" value="<?php echo esc_attr(@$sgPopupClosingTimer);?>"><span class="scroll-percent">seconds</span>
143
  </div>
144
  <?php if(POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_PLATINUM): ?>
145
  <span class="liquid-width">Filter popup for selected countries:</span><input id="js-countris" class="input-width-static js-checkbox-acordion" type="checkbox" name="countryStatus" <?php echo @$sgCountryStatus;?>>
files/sg_admin_post.php CHANGED
@@ -2,14 +2,14 @@
2
  function sgGetCsvFile() {
3
  global $wpdb;
4
  $content = '';
5
- $sql = "SHOW COLUMNS FROM ". $wpdb->prefix ."sg_subscribers";
6
- $rows = $wpdb->get_results($sql, ARRAY_A);
7
  foreach ($rows as $value) {
8
- $content .= $value['Field'].",";
 
9
  }
10
  $content .= "\n";
11
 
12
- $sql = "Select * from ". $wpdb->prefix ."sg_subscribers";
13
  $subscribers = $wpdb->get_results($sql, ARRAY_A);
14
 
15
  foreach($subscribers as $values) {
2
  function sgGetCsvFile() {
3
  global $wpdb;
4
  $content = '';
5
+ $rows = array('id', 'firstName', 'lastName', 'email', 'subscriptionType');
 
6
  foreach ($rows as $value) {
7
+
8
+ $content .= $value.",";
9
  }
10
  $content .= "\n";
11
 
12
+ $sql = "SELECT id, firstName, lastName, email, subscriptionType FROM ". $wpdb->prefix ."sg_subscribers";
13
  $subscribers = $wpdb->get_results($sql, ARRAY_A);
14
 
15
  foreach($subscribers as $values) {
files/sg_functions.php CHANGED
@@ -59,7 +59,7 @@ class SGFunctions
59
  return wp_kses($sgPopupData, $allowedHtmltags);
60
  }
61
 
62
- public static function getPopupsDataList() {
63
 
64
  $orderBy = 'id DESC';
65
  $popupsData = SGPopup::findAll($orderBy);
@@ -70,7 +70,14 @@ class SGFunctions
70
  $title = $popupData->getTitle();
71
  $type = $popupData->getType();
72
  $id = $popupData->getId();
73
-
 
 
 
 
 
 
 
74
  $dataList[$id] = $title.' - '.$type;
75
  }
76
 
59
  return wp_kses($sgPopupData, $allowedHtmltags);
60
  }
61
 
62
+ public static function getPopupsDataList($restrictParams = array()) {
63
 
64
  $orderBy = 'id DESC';
65
  $popupsData = SGPopup::findAll($orderBy);
70
  $title = $popupData->getTitle();
71
  $type = $popupData->getType();
72
  $id = $popupData->getId();
73
+ if(is_array($restrictParams)) {
74
+ if(isset($restrictParams['type']) && $type == $restrictParams['type']) {
75
+ continue;
76
+ }
77
+ if(isset($restrictParams['id']) && $id == $restrictParams['id']) {
78
+ continue;
79
+ }
80
+ }
81
  $dataList[$id] = $title.' - '.$type;
82
  }
83
 
files/sg_more_plugins.php CHANGED
@@ -12,8 +12,23 @@
12
  <div class="column-compatibility"><span class="compatibility-compatible"><strong>Compatible</strong> with your version of WordPress</span></div>
13
  </div>
14
  </div>
15
- </div>
16
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <div class="plugin-card">
18
  <div class="plugin-card-top" onclick="window.open('https://wordpress.org/plugins/social-media-builder/')">
19
  <a href="https://wordpress.org/plugins/social-media-builder/" class="plugin-icon" target="_blank"><div class="plugin-icon" id="plugin-icon-social-media-builder"></div></a>
12
  <div class="column-compatibility"><span class="compatibility-compatible"><strong>Compatible</strong> with your version of WordPress</span></div>
13
  </div>
14
  </div>
15
+ </div>
16
+ <div class="plugin-card">
17
+ <div class="plugin-card-top" onclick="window.open('https://wordpress.org/plugins/breadcrumbs-builder/')">
18
+ <a href="#" class="plugin-icon"><style type="text/css">#plugin-icon-breadcrumbs-builder { width:128px; height:128px; background-image: url("//ps.w.org/breadcrumbs-builder/assets/icon-128x128.jpg?rev=1581944"); background-size:128px 128px; }</style><div class="plugin-icon" id="plugin-icon-breadcrumbs-builder" style="float:left; margin: 3px 6px 6px 0px;"></div></a>
19
+ <div class="name column-name">
20
+ <h4><a href="#">Breadcrumbs</a></h4>
21
+ </div>
22
+ <div class="desc column-description">
23
+ <p>Breadcrumb Builder will allow you to add Breadcrumbs navigation section to your site and your visitors will know current path.</p>
24
+ </div>
25
+ <div class="sg-row sg-compatible">
26
+ <div class="sg-col-8">
27
+ <div class="column-compatibility"><span class="compatibility-compatible"><strong>Compatible</strong> with your version of WordPress</span></div>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
  <div class="plugin-card">
33
  <div class="plugin-card-top" onclick="window.open('https://wordpress.org/plugins/social-media-builder/')">
34
  <a href="https://wordpress.org/plugins/social-media-builder/" class="plugin-icon" target="_blank"><div class="plugin-icon" id="plugin-icon-social-media-builder"></div></a>
files/sg_popup_actions.php CHANGED
@@ -55,7 +55,6 @@ function sgnewslatter_repeat_function($args) {
55
  if($id == 0) {
56
  /*Clear schedule hook*/
57
  $headers = 'MIME-Version: 1.0'."\r\n";
58
- $headers .= 'From: '.$adminEmail.''."\r\n";
59
  $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
60
  $successTotal = get_option("SG_NEWSLETTER_".$subscriptionType);
61
  if(!$successTotal) {
@@ -64,8 +63,8 @@ function sgnewslatter_repeat_function($args) {
64
  $faildTotal = $totalSubscribers - $successTotal;
65
 
66
  $emailMessageCustom = 'Your mail list '.$subscriptionType.' delivered successfully!
67
- '.$successTotal.' of the '.$totalSubscribers.' emails succeeded, '.$faildTotal.' failed
68
- For more details, please download log files inside the plugin.
69
 
70
  This email was generated via Popup Builder plugin.';
71
 
@@ -98,12 +97,11 @@ function sgnewslatter_repeat_function($args) {
98
 
99
  /*Mail Headers*/
100
  $headers = 'MIME-Version: 1.0'."\r\n";
101
- $headers .= 'From: '.$adminEmail.''."\r\n";
102
  $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
103
 
104
  $mailStatus = wp_mail($data['email'], $mailSubject, $emailMessageCustom, $headers);
105
  if(!$mailStatus) {
106
- $errorLogSql = $wpdb->prepare("INSERT INTO ". $wpdb->prefix ."sg_subscription_error_log(popupType,email,date) VALUES (%s,%s,%s)",$subscriptionType,$data['email'],Date('Y-m-d H:i'));
107
  $wpdb->query($errorLogSql);
108
  }
109
  /*Sending status*/
55
  if($id == 0) {
56
  /*Clear schedule hook*/
57
  $headers = 'MIME-Version: 1.0'."\r\n";
 
58
  $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
59
  $successTotal = get_option("SG_NEWSLETTER_".$subscriptionType);
60
  if(!$successTotal) {
63
  $faildTotal = $totalSubscribers - $successTotal;
64
 
65
  $emailMessageCustom = 'Your mail list '.$subscriptionType.' delivered successfully!
66
+ '.$successTotal.' of the '.$totalSubscribers.' emails succeeded, '.$faildTotal.' failed.
67
+ For more details, please download log file inside the plugin.
68
 
69
  This email was generated via Popup Builder plugin.';
70
 
97
 
98
  /*Mail Headers*/
99
  $headers = 'MIME-Version: 1.0'."\r\n";
 
100
  $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
101
 
102
  $mailStatus = wp_mail($data['email'], $mailSubject, $emailMessageCustom, $headers);
103
  if(!$mailStatus) {
104
+ $errorLogSql = $wpdb->prepare('INSERT INTO '. $wpdb->prefix .'sg_subscription_error_log(`popupType`, `email`, `date`) VALUES (%s, %s, %s)', $subscriptionType, $data['email'], date('Y-m-d H:i'));
105
  $wpdb->query($errorLogSql);
106
  }
107
  /*Sending status*/
files/sg_popup_create_new.php CHANGED
@@ -103,6 +103,7 @@ if (isset($_GET['id'])) {
103
  $sgClickRedirectToUrl = @$jsonData['click-redirect-to-url'];
104
  $sgRedirectToNewTab = @$jsonData['redirect-to-new-tab'];
105
  $sgOpacity = @$jsonData['opacity'];
 
106
  $sgPopupFixed = @$jsonData['popupFixed'];
107
  $sgFixedPostion = @$jsonData['fixedPostion'];
108
  $sgOnScrolling = @$jsonData['onScrolling'];
@@ -119,6 +120,8 @@ if (isset($_GET['id'])) {
119
  $sgInitialHeight = @$jsonData['initialHeight'];
120
  $sgWidth = @$jsonData['width'];
121
  $sgHeight = @$jsonData['height'];
 
 
122
  $sgMaxWidth = @$jsonData['maxWidth'];
123
  $sgMaxHeight = @$jsonData['maxHeight'];
124
  $sgForMobile = @$jsonData['forMobile'];
@@ -255,6 +258,11 @@ if (isset($_GET['id'])) {
255
  $sgContactValidateEmail = @$contactFormOptions['contact-validate-email'];
256
  $sgContactResiveEmail = @$contactFormOptions['contact-receive-email'];
257
  $sgContactFailMessage = @$contactFormOptions['contact-fail-message'];
 
 
 
 
 
258
  }
259
 
260
  $dataPopupId = @$id;
@@ -267,11 +275,14 @@ $sgPopup = array(
267
  'escKey'=> true,
268
  'closeButton' => true,
269
  'scrolling'=> true,
270
- 'scaling'=>false,
271
- 'opacity'=>0.8,
 
272
  'reposition' => true,
273
  'width' => '640px',
274
  'height' => '480px',
 
 
275
  'initialWidth' => '300',
276
  'initialHeight' => '100',
277
  'maxWidth' => false,
@@ -288,6 +299,7 @@ $sgPopup = array(
288
  'delay' => 0,
289
  'theme-close-text' => 'Close',
290
  'content-click-behavior' => 'close',
 
291
  );
292
 
293
  $popupProDefaultValues = array(
@@ -338,7 +350,7 @@ $popupProDefaultValues = array(
338
  'countdown-position' => true,
339
  'countdown-autoclose' => true,
340
  'time-zone' => 'Etc/GMT',
341
- 'due-date' => date('M d y H:i', strtotime(' +1 day')),
342
  'popup-start-timer' => date('M d y H:i'),
343
  'schedule-start-time' => date("H:i"),
344
  'exit-intent-type' => "soft",
@@ -379,7 +391,12 @@ $popupProDefaultValues = array(
379
  'contact-btn-title' => 'Contact',
380
  'contact-validate-email' => 'Please enter a valid email.',
381
  'contact-receive-email' => get_option('admin_email'),
382
- 'contact-fail-message' => 'Unable to send.'
 
 
 
 
 
383
  );
384
 
385
  $escKey = sgBoolToChecked($sgPopup['escKey']);
@@ -391,6 +408,7 @@ $overlayClose = sgBoolToChecked($sgPopup['overlayClose']);
391
  $reopenAfterSubmission = sgBoolToChecked($sgPopup['reopenAfterSubmission']);
392
  $contentClick = sgBoolToChecked($sgPopup['contentClick']);
393
  $contentClickBehavior = $sgPopup['content-click-behavior'];
 
394
 
395
  $closeType = sgBoolToChecked($popupProDefaultValues['closeType']);
396
  $onScrolling = sgBoolToChecked($popupProDefaultValues['onScrolling']);
@@ -479,7 +497,12 @@ $contactResiveEmail = $popupProDefaultValues['contact-receive-email'];
479
  $contactFailMessage = $popupProDefaultValues['contact-fail-message'];
480
  $overlayCustomClasss = $popupProDefaultValues['overlay-custom-classs'];
481
  $contentCustomClasss = $popupProDefaultValues['content-custom-classs'];
 
 
 
482
  $redirectToNewTab = $popupProDefaultValues['redirect-to-new-tab'];
 
 
483
 
484
  function sgBoolToChecked($var)
485
  {
@@ -494,7 +517,10 @@ function sgRemoveOption($option)
494
 
495
  $width = $sgPopup['width'];
496
  $height = $sgPopup['height'];
 
 
497
  $opacityValue = $sgPopup['opacity'];
 
498
  $top = $sgPopup['top'];
499
  $right = $sgPopup['right'];
500
  $bottom = $sgPopup['bottom'];
@@ -558,6 +584,7 @@ $sgContactSubjectStatus = @sgSetChecked($sgContactSubjectStatus, $contactSubject
558
  $sgContactSubjectRequired = @sgSetChecked($sgContactSubjectRequired, $contactSubjectRequired);
559
  $sgShowFormToTop = @sgSetChecked($sgShowFormToTop, $showFormToTop);
560
  $sgRedirectToNewTab = @sgSetChecked($sgRedirectToNewTab, $redirectToNewTab);
 
561
 
562
  function sgSetChecked($optionsParam,$defaultOption)
563
  {
@@ -574,9 +601,13 @@ function sgSetChecked($optionsParam,$defaultOption)
574
  }
575
  }
576
 
 
577
  $sgOpacity = @sgGetValue($sgOpacity, $opacityValue);
 
578
  $sgWidth = @sgGetValue($sgWidth, $width);
579
  $sgHeight = @sgGetValue($sgHeight, $height);
 
 
580
  $sgInitialWidth = @sgGetValue($sgInitialWidth, $initialWidth);
581
  $sgInitialHeight = @sgGetValue($sgInitialHeight, $initialHeight);
582
  $sgMaxWidth = @sgGetValue($sgMaxWidth, $maxWidth);
@@ -655,6 +686,10 @@ $sgContactResiveEmail = @sgGetValue($sgContactResiveEmail, $contactResiveEmail);
655
  $sgContactFailMessage = @sgGetValue($sgContactFailMessage, $contactFailMessage);
656
  $sgOverlayCustomClasss = @sgGetValue($sgOverlayCustomClasss, $overlayCustomClasss);
657
  $sgContentCustomClasss = @sgGetValue($sgContentCustomClasss, $contentCustomClasss);
 
 
 
 
658
  $sgAllSelectedPages = @sgGetValue($sgAllSelectedPages, array());
659
  $sgAllSelectedPosts = @sgGetValue($sgAllSelectedPosts, array());
660
  $sgAllSelectedCustomPosts = @sgGetValue($sgAllSelectedCustomPosts, array());
@@ -687,13 +722,13 @@ $countriesRadio = array(
687
  array(
688
  'name'=>'allowCountries',
689
  'value'=>'allow',
690
- 'additionalHtml'=>'<span class="countries-radio-text allow-countries">Allow</span>',
691
  'newline' => false
692
  ),
693
  array(
694
  'name'=>'allowCountries',
695
  'value'=>'disallow',
696
- 'additionalHtml'=>'<span class="countries-radio-text">Disallow</span>',
697
  'newline' => true
698
  )
699
  );
@@ -734,12 +769,12 @@ function sgCreateRadioElements($radioElements,$checkedValue)
734
 
735
  $contentClickOptions = array(
736
  array(
737
- "title" => "Close Popup:",
738
  "value" => "close",
739
  "info" => ""
740
  ),
741
  array(
742
- "title" => "Redirect:",
743
  "value" => "redirect",
744
  "info" => ""
745
  )
@@ -747,12 +782,12 @@ $contentClickOptions = array(
747
 
748
  $pagesRadio = array(
749
  array(
750
- "title" => "Show on all pages:",
751
  "value" => "all",
752
  "info" => ""
753
  ),
754
  array(
755
- "title" => "Show on selected pages:",
756
  "value" => "selected",
757
  "info" => "",
758
  "data-attributes" => array(
@@ -766,12 +801,12 @@ $pagesRadio = array(
766
 
767
  $postsRadio = array(
768
  array(
769
- "title" => "Show on all posts:",
770
  "value" => "all",
771
  "info" => ""
772
  ),
773
  array(
774
- "title" => "Show on selected post:",
775
  "value" => "selected",
776
  "info" => "",
777
  "data-attributes" => array(
@@ -783,7 +818,7 @@ $postsRadio = array(
783
 
784
  ),
785
  array(
786
- "title" => "Show on selected categories",
787
  "value" => "allCategories",
788
  "info" => "",
789
  "data-attributes" => array(
@@ -792,6 +827,27 @@ $postsRadio = array(
792
  )
793
  );
794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
795
  $subsSuccessBehavior = array(
796
  array(
797
  "title" => "Show success message:",
@@ -831,12 +887,12 @@ $subsSuccessBehavior = array(
831
 
832
  $customPostsRadio = array(
833
  array(
834
- "title" => "Show on all custom posts:",
835
  "value" => "all",
836
  "info" => ""
837
  ),
838
  array(
839
- "title" => "Show on selected custom post:",
840
  "value" => "selected",
841
  "info" => "",
842
  "data-attributes" => array(
@@ -931,6 +987,19 @@ $sgTheme = array(
931
  'plain' => 'plain'
932
  );
933
 
 
 
 
 
 
 
 
 
 
 
 
 
 
934
  $sgThemeSize = array(
935
  '8' => '8',
936
  '10' => '10',
@@ -988,6 +1057,7 @@ $sgWeekDaysArray = array(
988
 
989
  if (POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) {
990
  require_once(SG_APP_POPUP_FILES ."/sg_params_arrays.php");
 
991
  }
992
 
993
  function sgCreateSelect($options,$name,$selecteOption)
@@ -1152,18 +1222,25 @@ if (isset($_GET["titleError"])): ?>
1152
  <div class="handlediv dimentionsTitle" title="Click to toggle"><br></div>
1153
  <h3 class="hndle ui-sortable-handle dimentionsTitle" style="cursor: pointer"><span>Dimensions</span></h3>
1154
  <div class="dimensionsContent">
1155
- <span class="liquid-width">Width:</span>
1156
- <input class="input-width-static" type="text" name="width" value="<?php echo esc_attr($sgWidth); ?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1157
- <span class="liquid-width">Height:</span>
1158
- <input class="input-width-static" type="text" name="height" value="<?php echo esc_attr($sgHeight);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1159
- <span class="liquid-width">Max width:</span>
1160
- <input class="input-width-static" type="text" name="maxWidth" value="<?php echo esc_attr($sgMaxWidth);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1161
- <span class="liquid-width">Max height:</span>
1162
- <input class="input-width-static" type="text" name="maxHeight" value="<?php echo esc_attr(@$sgMaxHeight);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1163
- <span class="liquid-width">Initial width:</span>
1164
- <input class="input-width-static" type="text" name="initialWidth" value="<?php echo esc_attr($sgInitialWidth);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1165
- <span class="liquid-width">Initial height:</span>
1166
- <input class="input-width-static" type="text" name="initialHeight" value="<?php echo esc_attr($sgInitialHeight);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
 
 
 
 
 
 
 
1167
  </div>
1168
  </div>
1169
 
@@ -1186,7 +1263,7 @@ if (isset($_GET["titleError"])): ?>
1186
  <span class="dashicons dashicons-info CloseImg sameImageStyle"></span><span class="infoCloseButton samefontStyle">The popup will contain 'close' button.</span><br>
1187
 
1188
  <span class="liquid-width">Enable content scrolling:</span><input class="input-width-static" type="checkbox" name="scrolling" <?php echo $sgScrolling;?> />
1189
- <span class="dashicons dashicons-info scrollingImg sameImageStyle"></span><span class="infoScrolling samefontStyle">If the containt is larger then the specified dimentions, then the content will be scrollable.</span><br>
1190
 
1191
  <span class="liquid-width">Enable reposition:</span><input class="input-width-static" type="checkbox" name="reposition" <?php echo $sgReposition;?> />
1192
  <span class="dashicons dashicons-info repositionImg sameImageStyle"></span><span class="infoReposition samefontStyle">The popup will be resized/repositioned automatically when window is being resized.</span><br>
@@ -1200,14 +1277,22 @@ if (isset($_GET["titleError"])): ?>
1200
  <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;?> />
1201
  <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>
1202
 
 
 
 
 
 
 
 
 
1203
  <span class="liquid-width">Reopen after form submission:</span><input class="input-width-static" type="checkbox" name="reopenAfterSubmission" <?php echo $sgReopenAfterSubmission;?> />
1204
  <span class="dashicons dashicons-info overlayImg sameImageStyle"></span><span class="infoReopenSubmiting samefontStyle">If checked, the popup will reopen after form submission.</span><br>
1205
 
1206
  <div class="sg-hide sg-full-width js-content-click-wrraper">
1207
  <?php echo createRadiobuttons($contentClickOptions, "content-click-behavior", true, esc_html($sgContentClickBehavior), "liquid-width"); ?>
1208
  <div class="sg-hide js-readio-buttons-acordion-content sg-full-width">
1209
- <span class="liquid-width">Url:</span><input class="input-width-static" type="text" name='click-redirect-to-url' value="<?php echo esc_attr(@$sgClickRedirectToUrl); ?>">
1210
- <span class="liquid-width">Redirect to new tab:</span><input type="checkbox" name="redirect-to-new-tab" <?php echo $sgRedirectToNewTab; ?> >
1211
  </div>
1212
  </div>
1213
 
@@ -1215,9 +1300,16 @@ if (isset($_GET["titleError"])): ?>
1215
 
1216
  <span class="liquid-width">Change background color:</span><div id="color-picker"><input class="sgOverlayColor" id="sgOverlayColor" type="text" name="sg-content-background-color" value="<?php echo esc_attr(@$sgContentBackgroundColor); ?>" /></div><br>
1217
 
1218
- <span class="liquid-width" id="createDescribeOpacitcy">Background overlay opacity:</span><div class="slider-wrapper">
 
 
 
 
 
 
 
1219
  <input type="text" class="js-decimal" value="<?php echo esc_attr($sgOpacity);?>" rel="<?php echo esc_attr($sgOpacity);?>" name="opacity"/>
1220
- <div id="js-display-decimal" class="display-box"></div>
1221
  </div><br>
1222
 
1223
  <span class="liquid-width">Overlay custom class:</span><input class="input-width-static" type="text" name="sgOverlayCustomClasss" value="<?php echo esc_attr(@$sgOverlayCustomClasss);?>">
@@ -1226,7 +1318,7 @@ if (isset($_GET["titleError"])): ?>
1226
  <span class="liquid-width">Content custom class:</span><input class="input-width-static" type="text" name="sgContentCustomClasss" value="<?php echo esc_attr(@$sgContentCustomClasss);?>">
1227
  <br>
1228
 
1229
- <span class="liquid-width" id="createDescribeFixed">Popup location:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popupFixed" <?php echo $sgPopupFixed;?> />
1230
  <div class="js-popop-fixeds">
1231
  <span class="fix-wrapper-style" >&nbsp;</span>
1232
  <div class="fixed-wrapper">
103
  $sgClickRedirectToUrl = @$jsonData['click-redirect-to-url'];
104
  $sgRedirectToNewTab = @$jsonData['redirect-to-new-tab'];
105
  $sgOpacity = @$jsonData['opacity'];
106
+ $sgPopupBackgroundOpacity = @$jsonData['popup-background-opacity'];
107
  $sgPopupFixed = @$jsonData['popupFixed'];
108
  $sgFixedPostion = @$jsonData['fixedPostion'];
109
  $sgOnScrolling = @$jsonData['onScrolling'];
120
  $sgInitialHeight = @$jsonData['initialHeight'];
121
  $sgWidth = @$jsonData['width'];
122
  $sgHeight = @$jsonData['height'];
123
+ $sgPopupDimensionMode = @$jsonData['popup-dimension-mode'];
124
+ $sgPopupResponsiveDimensionMeasure = @$jsonData['popup-responsive-dimension-measure'];
125
  $sgMaxWidth = @$jsonData['maxWidth'];
126
  $sgMaxHeight = @$jsonData['maxHeight'];
127
  $sgForMobile = @$jsonData['forMobile'];
258
  $sgContactValidateEmail = @$contactFormOptions['contact-validate-email'];
259
  $sgContactResiveEmail = @$contactFormOptions['contact-receive-email'];
260
  $sgContactFailMessage = @$contactFormOptions['contact-fail-message'];
261
+ $sgContactSuccessBehavior = @$contactFormOptions['contact-success-behavior'];
262
+ $sgContactSuccessRedirectUrl = @$contactFormOptions['contact-success-redirect-url'];
263
+ $sgContactSuccessPopupsList = @$contactFormOptions['contact-success-popups-list'];
264
+ $sgDontShowContentToContactedUser = @$contactFormOptions['dont-show-content-to-contacted-user'];
265
+ $sgContactSuccessFrequencyDays = @$contactFormOptions['contact-success-frequency-days'];
266
  }
267
 
268
  $dataPopupId = @$id;
275
  'escKey'=> true,
276
  'closeButton' => true,
277
  'scrolling'=> true,
278
+ 'scaling'=> false,
279
+ 'opacity'=> 0.8,
280
+ 'popup-background-opacity'=> 1,
281
  'reposition' => true,
282
  'width' => '640px',
283
  'height' => '480px',
284
+ 'popup-dimension-mode' => 'customMode',
285
+ 'popup-responsive-dimension-measure' => 60,
286
  'initialWidth' => '300',
287
  'initialHeight' => '100',
288
  'maxWidth' => false,
299
  'delay' => 0,
300
  'theme-close-text' => 'Close',
301
  'content-click-behavior' => 'close',
302
+ 'sgTheme3BorderRadius' => 0
303
  );
304
 
305
  $popupProDefaultValues = array(
350
  'countdown-position' => true,
351
  'countdown-autoclose' => true,
352
  'time-zone' => 'Etc/GMT',
353
+ 'due-date' => date('Y-m-d H:i', strtotime(' +1 day')),
354
  'popup-start-timer' => date('M d y H:i'),
355
  'schedule-start-time' => date("H:i"),
356
  'exit-intent-type' => "soft",
391
  'contact-btn-title' => 'Contact',
392
  'contact-validate-email' => 'Please enter a valid email.',
393
  'contact-receive-email' => get_option('admin_email'),
394
+ 'contact-fail-message' => 'Unable to send.',
395
+ 'contact-success-behavior' => 'showMessage',
396
+ 'contact-success-redirect-url' => '',
397
+ 'contact-success-popups-list' => 0,
398
+ 'dont-show-content-to-contacted-user' => '',
399
+ 'contact-success-frequency-days' => 365
400
  );
401
 
402
  $escKey = sgBoolToChecked($sgPopup['escKey']);
408
  $reopenAfterSubmission = sgBoolToChecked($sgPopup['reopenAfterSubmission']);
409
  $contentClick = sgBoolToChecked($sgPopup['contentClick']);
410
  $contentClickBehavior = $sgPopup['content-click-behavior'];
411
+ $theme3BorderRadius = $sgPopup['sgTheme3BorderRadius'];
412
 
413
  $closeType = sgBoolToChecked($popupProDefaultValues['closeType']);
414
  $onScrolling = sgBoolToChecked($popupProDefaultValues['onScrolling']);
497
  $contactFailMessage = $popupProDefaultValues['contact-fail-message'];
498
  $overlayCustomClasss = $popupProDefaultValues['overlay-custom-classs'];
499
  $contentCustomClasss = $popupProDefaultValues['content-custom-classs'];
500
+ $contactSuccessBehavior = $popupProDefaultValues['contact-success-behavior'];
501
+ $contactSuccessRedirectUrl = $popupProDefaultValues['contact-success-redirect-url'];
502
+ $contactSuccessPopupsList = $popupProDefaultValues['contact-success-popups-list'];
503
  $redirectToNewTab = $popupProDefaultValues['redirect-to-new-tab'];
504
+ $dontShowContentToContactedUser = sgBoolToChecked($popupProDefaultValues['dont-show-content-to-contacted-user']);
505
+ $contactSuccessFrequencyDays = $popupProDefaultValues['contact-success-frequency-days'];
506
 
507
  function sgBoolToChecked($var)
508
  {
517
 
518
  $width = $sgPopup['width'];
519
  $height = $sgPopup['height'];
520
+ $popupDimensionMode = $sgPopup['popup-dimension-mode'];
521
+ $popupResponsiveDimensionMeasure = $sgPopup['popup-responsive-dimension-measure'];
522
  $opacityValue = $sgPopup['opacity'];
523
+ $popupBackgroundOpacity = $sgPopup['popup-background-opacity'];
524
  $top = $sgPopup['top'];
525
  $right = $sgPopup['right'];
526
  $bottom = $sgPopup['bottom'];
584
  $sgContactSubjectRequired = @sgSetChecked($sgContactSubjectRequired, $contactSubjectRequired);
585
  $sgShowFormToTop = @sgSetChecked($sgShowFormToTop, $showFormToTop);
586
  $sgRedirectToNewTab = @sgSetChecked($sgRedirectToNewTab, $redirectToNewTab);
587
+ $sgDontShowContentToContactedUser = @sgSetChecked($sgDontShowContentToContactedUser, $dontShowContentToContactedUser);
588
 
589
  function sgSetChecked($optionsParam,$defaultOption)
590
  {
601
  }
602
  }
603
 
604
+ $sgTheme3BorderRadius = @sgGetValue($sgTheme3BorderRadius, $theme3BorderRadius);
605
  $sgOpacity = @sgGetValue($sgOpacity, $opacityValue);
606
+ $sgPopupBackgroundOpacity = @sgGetValue($sgPopupBackgroundOpacity, $popupBackgroundOpacity);
607
  $sgWidth = @sgGetValue($sgWidth, $width);
608
  $sgHeight = @sgGetValue($sgHeight, $height);
609
+ $sgPopupDimensionMode = @sgGetValue($sgPopupDimensionMode, $popupDimensionMode);
610
+ $sgPopupResponsiveDimensionMeasure = @sgGetValue($sgPopupResponsiveDimensionMeasure, $popupResponsiveDimensionMeasure);
611
  $sgInitialWidth = @sgGetValue($sgInitialWidth, $initialWidth);
612
  $sgInitialHeight = @sgGetValue($sgInitialHeight, $initialHeight);
613
  $sgMaxWidth = @sgGetValue($sgMaxWidth, $maxWidth);
686
  $sgContactFailMessage = @sgGetValue($sgContactFailMessage, $contactFailMessage);
687
  $sgOverlayCustomClasss = @sgGetValue($sgOverlayCustomClasss, $overlayCustomClasss);
688
  $sgContentCustomClasss = @sgGetValue($sgContentCustomClasss, $contentCustomClasss);
689
+ $sgContactSuccessBehavior = @sgGetValue($sgContactSuccessBehavior, $contactSuccessBehavior);
690
+ $sgContactSuccessRedirectUrl = @sgGetValue($sgContactSuccessRedirectUrl, $contactSuccessRedirectUrl);
691
+ $sgContactSuccessPopupsList = @sgGetValue($sgContactSuccessPopupsList, $contactSuccessPopupsList);
692
+ $sgContactSuccessFrequencyDays = @sgGetValue($sgContactSuccessFrequencyDays, $contactSuccessFrequencyDays);
693
  $sgAllSelectedPages = @sgGetValue($sgAllSelectedPages, array());
694
  $sgAllSelectedPosts = @sgGetValue($sgAllSelectedPosts, array());
695
  $sgAllSelectedCustomPosts = @sgGetValue($sgAllSelectedCustomPosts, array());
722
  array(
723
  'name'=>'allowCountries',
724
  'value'=>'allow',
725
+ 'additionalHtml'=>'<span class="countries-radio-text allow-countries">allow</span>',
726
  'newline' => false
727
  ),
728
  array(
729
  'name'=>'allowCountries',
730
  'value'=>'disallow',
731
+ 'additionalHtml'=>'<span class="countries-radio-text">disallow</span>',
732
  'newline' => true
733
  )
734
  );
769
 
770
  $contentClickOptions = array(
771
  array(
772
+ "title" => "close Popup:",
773
  "value" => "close",
774
  "info" => ""
775
  ),
776
  array(
777
+ "title" => "redirect:",
778
  "value" => "redirect",
779
  "info" => ""
780
  )
782
 
783
  $pagesRadio = array(
784
  array(
785
+ "title" => "show on all pages:",
786
  "value" => "all",
787
  "info" => ""
788
  ),
789
  array(
790
+ "title" => "show on selected pages:",
791
  "value" => "selected",
792
  "info" => "",
793
  "data-attributes" => array(
801
 
802
  $postsRadio = array(
803
  array(
804
+ "title" => "show on all posts:",
805
  "value" => "all",
806
  "info" => ""
807
  ),
808
  array(
809
+ "title" => "show on selected post:",
810
  "value" => "selected",
811
  "info" => "",
812
  "data-attributes" => array(
818
 
819
  ),
820
  array(
821
+ "title" => "show on selected categories",
822
  "value" => "allCategories",
823
  "info" => "",
824
  "data-attributes" => array(
827
  )
828
  );
829
 
830
+ $responsiveMode = array(
831
+ array(
832
+ "title" => "Responsive mode:",
833
+ "value" => "responsiveMode",
834
+ "info" => "",
835
+ "data-attributes" => array(
836
+ "class" => "js-responsive-mode"
837
+ )
838
+
839
+ ),
840
+ array(
841
+ "title" => "Custom mode:",
842
+ "value" => "customMode",
843
+ "info" => "",
844
+ "data-attributes" => array(
845
+ "class" => "js-custom-mode"
846
+ )
847
+
848
+ )
849
+ );
850
+
851
  $subsSuccessBehavior = array(
852
  array(
853
  "title" => "Show success message:",
887
 
888
  $customPostsRadio = array(
889
  array(
890
+ "title" => "show on all custom posts:",
891
  "value" => "all",
892
  "info" => ""
893
  ),
894
  array(
895
+ "title" => "show on selected custom post:",
896
  "value" => "selected",
897
  "info" => "",
898
  "data-attributes" => array(
987
  'plain' => 'plain'
988
  );
989
 
990
+ $sgResponsiveMeasure = array(
991
+ '10' => '10%',
992
+ '20' => '20%',
993
+ '30' => '30%',
994
+ '40' => '40%',
995
+ '50' => '50%',
996
+ '60' => '60%',
997
+ '70' => '70%',
998
+ '80' => '80%',
999
+ '90' => '90%',
1000
+ '100' => '100%'
1001
+ );
1002
+
1003
  $sgThemeSize = array(
1004
  '8' => '8',
1005
  '10' => '10',
1057
 
1058
  if (POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) {
1059
  require_once(SG_APP_POPUP_FILES ."/sg_params_arrays.php");
1060
+ $popupDefaultData = SgParamsArray::defaultDataArray();
1061
  }
1062
 
1063
  function sgCreateSelect($options,$name,$selecteOption)
1222
  <div class="handlediv dimentionsTitle" title="Click to toggle"><br></div>
1223
  <h3 class="hndle ui-sortable-handle dimentionsTitle" style="cursor: pointer"><span>Dimensions</span></h3>
1224
  <div class="dimensionsContent">
1225
+ <?php createRadiobuttons($responsiveMode, 'popup-dimension-mode', true, esc_html($sgPopupDimensionMode), "liquid-width");?>
1226
+ <div class="js-accordion-responsiveMode js-radio-accordion sg-accordion-content">
1227
+ <span class="liquid-width">size</span>
1228
+ <?php echo sgCreateSelect($sgResponsiveMeasure,'popup-responsive-dimension-measure',esc_html(@$sgPopupResponsiveDimensionMeasure));?>
1229
+ </div>
1230
+ <div class="js-accordion-customMode js-radio-accordion sg-accordion-content">
1231
+ <span class="liquid-width">Width:</span>
1232
+ <input class="input-width-static" type="text" name="width" value="<?php echo esc_attr($sgWidth); ?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1233
+ <span class="liquid-width">Height:</span>
1234
+ <input class="input-width-static" type="text" name="height" value="<?php echo esc_attr($sgHeight);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1235
+ <span class="liquid-width">Initial width:</span>
1236
+ <input class="input-width-static" type="text" name="initialWidth" value="<?php echo esc_attr($sgInitialWidth);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1237
+ <span class="liquid-width">Initial height:</span>
1238
+ <input class="input-width-static" type="text" name="initialHeight" value="<?php echo esc_attr($sgInitialHeight);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1239
+ </div>
1240
+ <span class="liquid-width">Max width:</span>
1241
+ <input class="input-width-static" type="text" name="maxWidth" value="<?php echo esc_attr($sgMaxWidth);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1242
+ <span class="liquid-width">Max height:</span>
1243
+ <input class="input-width-static" type="text" name="maxHeight" value="<?php echo esc_attr(@$sgMaxHeight);?>" pattern = "\d+(([px]+|\%)|)" title="It must be number + px or %" /><img class='errorInfo' src="<?php echo plugins_url('img/info-error.png', dirname(__FILE__).'../') ?>"><span class="validateError">It must be a number + px or %</span><br>
1244
  </div>
1245
  </div>
1246
 
1263
  <span class="dashicons dashicons-info CloseImg sameImageStyle"></span><span class="infoCloseButton samefontStyle">The popup will contain 'close' button.</span><br>
1264
 
1265
  <span class="liquid-width">Enable content scrolling:</span><input class="input-width-static" type="checkbox" name="scrolling" <?php echo $sgScrolling;?> />
1266
+ <span class="dashicons dashicons-info scrollingImg sameImageStyle"></span><span class="infoScrolling samefontStyle">If the content is larger than the specified dimensions, then the content will be scrollable.</span><br>
1267
 
1268
  <span class="liquid-width">Enable reposition:</span><input class="input-width-static" type="checkbox" name="reposition" <?php echo $sgReposition;?> />
1269
  <span class="dashicons dashicons-info repositionImg sameImageStyle"></span><span class="infoReposition samefontStyle">The popup will be resized/repositioned automatically when window is being resized.</span><br>
1277
  <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;?> />
1278
  <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>
1279
 
1280
+ <div class="sg-hide sg-full-width js-content-click-wrraper">
1281
+ <?php echo createRadiobuttons($contentClickOptions, "content-click-behavior", true, esc_html($sgContentClickBehavior), "liquid-width"); ?>
1282
+ <div class="sg-hide js-readio-buttons-acordion-content sg-full-width">
1283
+ <span class="liquid-width">Url:</span><input class="input-width-static" type="text" name='click-redirect-to-url' value="<?php echo esc_attr(@$sgClickRedirectToUrl); ?>">
1284
+ <span class="liquid-width">Redirect to new tab:</span><input type="checkbox" name="redirect-to-new-tab" <?php echo $sgRedirectToNewTab; ?> >
1285
+ </div>
1286
+ </div>
1287
+
1288
  <span class="liquid-width">Reopen after form submission:</span><input class="input-width-static" type="checkbox" name="reopenAfterSubmission" <?php echo $sgReopenAfterSubmission;?> />
1289
  <span class="dashicons dashicons-info overlayImg sameImageStyle"></span><span class="infoReopenSubmiting samefontStyle">If checked, the popup will reopen after form submission.</span><br>
1290
 
1291
  <div class="sg-hide sg-full-width js-content-click-wrraper">
1292
  <?php echo createRadiobuttons($contentClickOptions, "content-click-behavior", true, esc_html($sgContentClickBehavior), "liquid-width"); ?>
1293
  <div class="sg-hide js-readio-buttons-acordion-content sg-full-width">
1294
+ <span class="liquid-width">URL:</span><input class="input-width-static" type="text" name='click-redirect-to-url' value="<?php echo esc_attr(@$sgClickRedirectToUrl); ?>">
1295
+ <span class="liquid-width">redirect to new tab:</span><input type="checkbox" name="redirect-to-new-tab" <?php echo $sgRedirectToNewTab; ?> >
1296
  </div>
1297
  </div>
1298
 
1300
 
1301
  <span class="liquid-width">Change background color:</span><div id="color-picker"><input class="sgOverlayColor" id="sgOverlayColor" type="text" name="sg-content-background-color" value="<?php echo esc_attr(@$sgContentBackgroundColor); ?>" /></div><br>
1302
 
1303
+ <span class="liquid-width">Background opacity:</span>
1304
+ <div class="slider-wrapper">
1305
+ <input type="text" class="js-popup-content-opacity" value="<?php echo esc_attr($sgPopupBackgroundOpacity);?>" rel="<?php echo esc_attr($sgPopupBackgroundOpacity);?>" name="popup-background-opacity">
1306
+ <div id="js-popup-content-opacity" data-init="false" class="display-box"></div>
1307
+ </div><br>
1308
+
1309
+ <span class="liquid-width" id="createDescribeOpacitcy">Background overlay opacity:</span>
1310
+ <div class="slider-wrapper">
1311
  <input type="text" class="js-decimal" value="<?php echo esc_attr($sgOpacity);?>" rel="<?php echo esc_attr($sgOpacity);?>" name="opacity"/>
1312
+ <div id="js-decimal" data-init="false" class="display-box"></div>
1313
  </div><br>
1314
 
1315
  <span class="liquid-width">Overlay custom class:</span><input class="input-width-static" type="text" name="sgOverlayCustomClasss" value="<?php echo esc_attr(@$sgOverlayCustomClasss);?>">
1318
  <span class="liquid-width">Content custom class:</span><input class="input-width-static" type="text" name="sgContentCustomClasss" value="<?php echo esc_attr(@$sgContentCustomClasss);?>">
1319
  <br>
1320
 
1321
+ <span class="liquid-width" id="createDescribeFixed">Popup location:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popupFixed" <?php echo $sgPopupFixed;?> />
1322
  <div class="js-popop-fixeds">
1323
  <span class="fix-wrapper-style" >&nbsp;</span>
1324
  <div class="fixed-wrapper">
files/sg_popup_media_button.php CHANGED
@@ -85,7 +85,7 @@ function sgPopupMediaButtonThickboxs()
85
  /* For plugin editor selected text */
86
  else if(typeof(tinyMCE.editors[0]) != "undefined") {
87
  var pluginEditorId = tinyMCE.editors[0]['id'];
88
- selectionText = (tinyMCE['editors'][pluginEditorId].selection.getContent()) ? tinyMCE['editors'][pluginEditorId].selection.getContent() : '';
89
  }
90
  if(appearEvent == 'onload') {
91
  selectionText = '';
85
  /* For plugin editor selected text */
86
  else if(typeof(tinyMCE.editors[0]) != "undefined") {
87
  var pluginEditorId = tinyMCE.editors[0]['id'];
88
+ selectionText = (tinyMCE['editors'][pluginEditorId].selection.getContent()) ? tinyMCE['editors'][pluginEditorId].selection.getContent() : '';
89
  }
90
  if(appearEvent == 'onload') {
91
  selectionText = '';
files/sg_popup_save.php CHANGED
@@ -169,7 +169,12 @@ function sgPopupSave()
169
  'contact-validate-email' => sgSanitize('contact-validate-email'),
170
  'contact-receive-email' => sgSanitize('contact-receive-email'),
171
  'contact-fail-message' => sgSanitize('contact-fail-message'),
172
- 'show-form-to-top' => sgSanitize('show-form-to-top')
 
 
 
 
 
173
  );
174
 
175
  $fblikeOptions = array(
@@ -480,7 +485,11 @@ function updatePopupOptions($id, $postTypes, $isInsert) {
480
  function getCurrentPopupIdFromOptions($id) {
481
 
482
  $allPosts = get_option("SG_ALL_POSTS");
483
-
 
 
 
 
484
  foreach ($allPosts as $key => $post) {
485
  if($post['id'] == $id) {
486
  return $key;
169
  'contact-validate-email' => sgSanitize('contact-validate-email'),
170
  'contact-receive-email' => sgSanitize('contact-receive-email'),
171
  'contact-fail-message' => sgSanitize('contact-fail-message'),
172
+ 'show-form-to-top' => sgSanitize('show-form-to-top'),
173
+ 'contact-success-behavior' => sgSanitize('contact-success-behavior'),
174
+ 'contact-success-redirect-url' => sgSanitize('contact-success-redirect-url'),
175
+ 'contact-success-popups-list' => sgSanitize('contact-success-popups-list'),
176
+ 'dont-show-content-to-contacted-user' => sgSanitize('dont-show-content-to-contacted-user'),
177
+ 'contact-success-frequency-days' => sgSanitize('contact-success-frequency-days'),
178
  );
179
 
180
  $fblikeOptions = array(
485
  function getCurrentPopupIdFromOptions($id) {
486
 
487
  $allPosts = get_option("SG_ALL_POSTS");
488
+
489
+ if(!is_array($allPosts)) {
490
+ return false;
491
+ }
492
+
493
  foreach ($allPosts as $key => $post) {
494
  if($post['id'] == $id) {
495
  return $key;
helpers/Helper_functions.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class HelperFunctions {
3
+
4
+ private function isFreePluginActive() {
5
+
6
+ $sgpbActivePlugins = get_option('active_plugins');
7
+
8
+ if(is_array($sgpbActivePlugins)) {
9
+ $hasFreeVersion = in_array('popup-builder/popup-builder.php', $sgpbActivePlugins);
10
+ $mainFileName = basename(__FILE__, ".php");
11
+
12
+ if($hasFreeVersion && $mainFileName == 'popup-builderPro') {
13
+ wp_die("Please, deactivate the FREE version of our plugin before upgrading to PRO");
14
+ }
15
+ }
16
+ }
17
+
18
+ private function checkPhpVersion() {
19
+
20
+ if (version_compare(PHP_VERSION, SG_POPUP_MINIMUM_PHP_VERSION, '<')) {
21
+ wp_die('Popup Builder plugin requires PHP version >= '.SG_POPUP_MINIMUM_PHP_VERSION.' version required. You server using PHP version = '.PHP_VERSION);
22
+ }
23
+ }
24
+
25
+ public static function checkRequirements() {
26
+
27
+ $helperObj = new self();
28
+ $helperObj->isFreePluginActive();
29
+ $helperObj->checkPhpVersion();
30
+ }
31
+ }
helpers/Integrate_external_settings.php CHANGED
@@ -109,10 +109,13 @@ Class IntegrateExternalSettings {
109
  'click-redirect-to-url' => sgSanitize('click-redirect-to-url'),
110
  'redirect-to-new-tab' => sgSanitize('redirect-to-new-tab'),
111
  'opacity' => sgSanitize('opacity'),
 
112
  'sgOverlayColor' => sgSanitize('sgOverlayColor'),
113
  'sg-content-background-color' => sgSanitize('sg-content-background-color'),
114
  'popupFixed' => sgSanitize('popupFixed'),
115
  'fixedPostion' => sgSanitize('fixedPostion'),
 
 
116
  'maxWidth' => sgSanitize('maxWidth'),
117
  'maxHeight' => sgSanitize('maxHeight'),
118
  'initialWidth' => sgSanitize('initialWidth'),
@@ -158,8 +161,8 @@ Class IntegrateExternalSettings {
158
  'disablePopup' => sgSanitize('disablePopup'),
159
  'disablePopupOverlay' => sgSanitize('disablePopupOverlay'),
160
  'popupClosingTimer' => sgSanitize('popupClosingTimer'),
161
- 'yesButtonLabel' => sgSanitize('yesButtonLabel'),
162
- 'noButtonLabel' => sgSanitize('noButtonLabel'),
163
  'restrictionUrl' => sgSanitize('restrictionUrl'),
164
  'yesButtonBackgroundColor' => sgSanitize('yesButtonBackgroundColor'),
165
  'noButtonBackgroundColor' => sgSanitize('noButtonBackgroundColor'),
109
  'click-redirect-to-url' => sgSanitize('click-redirect-to-url'),
110
  'redirect-to-new-tab' => sgSanitize('redirect-to-new-tab'),
111
  'opacity' => sgSanitize('opacity'),
112
+ 'popup-background-opacity' => sgSanitize('popup-background-opacity'),
113
  'sgOverlayColor' => sgSanitize('sgOverlayColor'),
114
  'sg-content-background-color' => sgSanitize('sg-content-background-color'),
115
  'popupFixed' => sgSanitize('popupFixed'),
116
  'fixedPostion' => sgSanitize('fixedPostion'),
117
+ 'popup-dimension-mode' => sgSanitize('popup-dimension-mode'),
118
+ 'popup-responsive-dimension-measure' => sgSanitize('popup-responsive-dimension-measure'),
119
  'maxWidth' => sgSanitize('maxWidth'),
120
  'maxHeight' => sgSanitize('maxHeight'),
121
  'initialWidth' => sgSanitize('initialWidth'),
161
  'disablePopup' => sgSanitize('disablePopup'),
162
  'disablePopupOverlay' => sgSanitize('disablePopupOverlay'),
163
  'popupClosingTimer' => sgSanitize('popupClosingTimer'),
164
+ 'yesButtonLabel' => sgSanitize('yesButtonLabel', true),
165
+ 'noButtonLabel' => sgSanitize('noButtonLabel', true),
166
  'restrictionUrl' => sgSanitize('restrictionUrl'),
167
  'yesButtonBackgroundColor' => sgSanitize('yesButtonBackgroundColor'),
168
  'noButtonBackgroundColor' => sgSanitize('noButtonBackgroundColor'),
img/ExitIntent.png ADDED
Binary file
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.addCountries();
11
  this.showCloseTextFieldForTheme();
12
  this.popupReview();
13
  this.colorPicekr(); /* Color picker */
14
  this.switchPopupActive();
15
  });
16
  jQuery('.sg-info-close').on('click', function() {
17
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
18
  });
19
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
20
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
21
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
22
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
 
23
  this.titleNotEmpty(); /* Check title is Empty */
24
  this.showThemePicture(); /* Show themes pictures */
25
  this.showEffects(); /* Show effect type */
26
  this.pageAcordion(); /* For page acordion divs */
27
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
28
  this.showInfo(); /* Show description options */
29
  this.opacityRange();
30
  this.subOptionContents();
31
  this.addCountries();
32
  this.showCloseTextFieldForTheme();
33
  this.popupReview();
34
  this.colorPicekr(); /* Color picker */
35
  this.switchPopupActive();
36
  this.initAccordions();
37
  });
38
  jQuery('.sg-info-close').on('click', function() {
39
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
40
  });
41
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
42
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
43
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
44
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
 
1
  this.titleNotEmpty(); /* Check title is Empty */
2
  this.showThemePicture(); /* Show themes pictures */
3
  this.showEffects(); /* Show effect type */
4
  this.pageAcordion(); /* For page 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.addCountries();
10
  this.showCloseTextFieldForTheme();
11
  this.popupReview();
12
  this.colorPicekr(); /* Color picker */
13
  this.switchPopupActive();
14
  });
15
  jQuery('.sg-info-close').on('click', function() {
16
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
17
  });
18
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
19
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
20
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
21
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
22
+ function beckend() {
23
  this.titleNotEmpty(); /* Check title is Empty */
24
  this.showThemePicture(); /* Show themes pictures */
25
  this.showEffects(); /* Show effect type */
26
  this.pageAcordion(); /* For page acordion divs */
27
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
28
  this.showInfo(); /* Show description options */
29
  this.opacityRange();
30
  this.subOptionContents();
31
  this.addCountries();
32
  this.showCloseTextFieldForTheme();
33
  this.popupReview();
34
  this.colorPicekr(); /* Color picker */
35
  this.switchPopupActive();
36
  this.initAccordions();
37
  });
38
  jQuery('.sg-info-close').on('click', function() {
39
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
40
  });
41
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
42
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
43
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
44
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
javascript/sg_popup_frontend.js CHANGED
@@ -14,91 +14,153 @@ function SGPopup() {
14
  this.popupContentClick = false;
15
  this.popupCloseButton = true;
16
  this.sgTrapFocus = true;
 
 
 
17
  }
18
 
19
- SGPopup.prototype.popupOpenById = function(popupId) {
20
- sgOnScrolling = (SG_POPUP_DATA [popupId]['onScrolling']) ? SG_POPUP_DATA [popupId]['onScrolling']: '';
21
- sgInActivity = (SG_POPUP_DATA [popupId]['inActivityStatus']) ? SG_POPUP_DATA [popupId]['inActivityStatus']: ''; ;
22
- beforeScrolingPrsent = (SG_POPUP_DATA [popupId]['onScrolling']) ? SG_POPUP_DATA [popupId]['beforeScrolingPrsent']: '';
23
- autoClosePopup = (SG_POPUP_DATA [popupId]['autoClosePopup']) ? SG_POPUP_DATA [popupId]['autoClosePopup']: '';
24
- popupClosingTimer = (SG_POPUP_DATA [popupId]['popupClosingTimer']) ? SG_POPUP_DATA [popupId]['popupClosingTimer']: '';
 
 
 
25
  sgPoupFrontendObj = new SGPopup();
26
-
27
- if(sgOnScrolling) {
28
  sgPoupFrontendObj.onScrolling(popupId);
29
  }
30
- else if(sgInActivity) {
31
  sgPoupFrontendObj.showPopupAfterInactivity(popupId);
32
  }
33
  else {
34
- sgPoupFrontendObj.showPopup(popupId,true);
35
  }
36
  };
37
 
38
- SGPopup.getCookie = function(cname) {
39
- var name = cname + "=";
40
- var ca = document.cookie.split(';');
41
- for(var i = 0; i <ca.length; i++) {
42
- var c = ca[i];
43
- while (c.charAt(0)==' ') {
44
- c = c.substring(1);
45
- }
46
- if (c.indexOf(name) == 0) {
47
- return c.substring(name.length,c.length);
48
- }
49
- }
50
- return "";
51
  };
52
 
53
- SGPopup.setCookie = function(cname, cvalue, exdays) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
- var exdate = new Date();
56
- if(!exdays || isNaN(exdays)) {
57
- exdays = 365*50;
58
- }
59
- exdate.setDate(exdate.getDate() + exdays);
60
 
61
- var value = cvalue + ((exdays == null) ? ";" : "; expires=" + exdate.toUTCString());
62
- document.cookie = cname + "=" + value;
63
  };
64
 
65
- SGPopup.prototype.init = function() {
 
66
  var that = this;
67
 
68
  this.onCompleate();
69
  this.popupOpenByCookie();
 
 
 
 
 
 
 
 
 
 
70
 
71
- jQuery(".sg-show-popup").each(function() {
72
  var popupEvent = jQuery(this).attr("data-popup-event");
73
- if(typeof popupEvent == 'undefined') {
74
  popupEvent = 'click';
75
  }
76
  /* For counting execute and did it one time for popup open */
77
  sgEventExecuteCount = 0;
78
- jQuery(this).bind(popupEvent, function() {
79
  ++sgEventExecuteCount;
80
- if(sgEventExecuteCount > 1) {
81
  return;
82
- }
83
  var sgPopupID = jQuery(this).attr("data-sgpopupid");
84
- that.showPopup(sgPopupID,false);
85
  });
86
  });
 
87
 
88
- /* When user set popup by class name */
89
- jQuery("[class*='sg-popup-id-']").each(function() {
90
- jQuery(this).bind("click", function() {
 
 
 
 
 
91
  var className = jQuery(this).attr("class");
92
- var sgPopupId = that.findPopupIdFromClassNames(className, "sg-popup-id-");
93
 
94
- that.showPopup(sgPopupId,false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  })
96
  });
 
 
 
97
 
 
98
  /* When user set popup by class name */
99
- jQuery("[class*='sg-iframe-popup-']").each(function() {
100
  var currentLink = jQuery(this);
101
- jQuery(this).bind("click", function(e) {
102
  e.preventDefault();
103
  var className = jQuery(this).attr("class");
104
 
@@ -107,58 +169,82 @@ SGPopup.prototype.init = function() {
107
  /*This update for dynamic open iframe url for same popup*/
108
  var linkUrl = currentLink.attr("href");
109
 
110
- if(typeof linkUrl == 'undefined') {
111
  var childLinkTag = currentLink.find('a');
112
  linkUrl = childLinkTag.attr("href");
113
  }
114
 
115
  SG_POPUP_DATA[sgPopupId]['iframe'] = linkUrl;
116
 
117
- that.showPopup(sgPopupId,false);
118
  });
119
  });
 
120
 
121
- jQuery("[class*='sg-confirm-popup-']").each(function() {
122
- jQuery(this).bind("click", function(e) {
123
- e.preventDefault();
124
- var currentLink = jQuery(this);
 
 
125
  var className = jQuery(this).attr("class");
 
126
 
127
- var sgPopupId = that.findPopupIdFromClassNames(className, "sg-confirm-popup-");
 
 
 
128
 
129
- jQuery('#sgcolorbox').bind("sgPopupClose", function() {
130
- var target = currentLink.attr("target");
131
-
132
- if(typeof target == 'undefined') {
133
- target = "self";
134
- }
135
- var href = currentLink.attr("href");
136
-
137
- if(target == "_blank") {
138
- window.open(href);
139
- }
140
- else {
141
- window.location.href = href;
142
- }
143
- });
144
- that.showPopup(sgPopupId,false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  })
146
  });
147
  };
148
 
149
- SGPopup.prototype.popupOpenByCookie = function() {
150
 
151
  var popupId = SGPopup.getCookie("sgSubmitReloadingForm");
152
  popupId = parseInt(popupId);
153
 
154
- if(typeof popupId == 'number') {
155
- this.showPopup(popupId,false);
156
  }
157
  };
158
 
159
- SGPopup.prototype.findPopupIdFromClassNames = function(className, classKey) {
160
-
161
- var classSplitArray = className.split(classKey);
162
  var classIdString = classSplitArray['1'];
163
  /*Get first all number from string*/
164
  var popupId = classIdString.match(/^\d+/);
@@ -166,33 +252,39 @@ SGPopup.prototype.findPopupIdFromClassNames = function(className, classKey) {
166
  return popupId;
167
  };
168
 
169
- SGPopup.prototype.sgCustomizeThemes = function(popupId) {
170
 
171
  var popupData = SG_POPUP_DATA[popupId];
172
  var borderRadiues = popupData['sg3ThemeBorderRadiues'];
 
 
173
 
174
- if(popupData['theme'] == "colorbox3.css") {
175
  var borderColor = popupData['sgTheme3BorderColor'];
176
  var borderRadiues = popupData['sgTheme3BorderRadius'];
177
  jQuery("#sgcboxLoadedContent").css({'border-color': borderColor})
178
- jQuery("#sgcboxLoadedContent").css({'border-radius': borderRadiues+"%"})
179
- jQuery("#sgcboxContent").css({'border-radius': borderRadiues+"%"})
180
  }
 
 
 
 
181
  };
182
 
183
- SGPopup.prototype.onCompleate = function() {
 
 
184
 
185
- jQuery("#sgcolorbox").bind("sgColorboxOnCompleate", function() {
186
-
187
  /* Scroll only inside popup */
188
  jQuery('#sgcboxLoadedContent').isolatedScroll();
189
  });
190
  this.isolatedScroll();
191
  };
192
 
193
- SGPopup.prototype.isolatedScroll = function() {
194
 
195
- jQuery.fn.isolatedScroll = function() {
196
  this.bind('mousewheel DOMMouseScroll', function (e) {
197
  var delta = e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta) || -e.detail,
198
  bottomOverflow = this.scrollTop + jQuery(this).outerHeight() - this.scrollHeight >= 0,
@@ -206,60 +298,75 @@ SGPopup.prototype.isolatedScroll = function() {
206
  };
207
  };
208
 
209
- SGPopup.prototype.sgPopupScalingDimensions = function() {
210
  var popupWrapper = jQuery("#sgcboxWrapper").outerWidth();
211
  var screenWidth = jQuery(window).width();
212
  /*popupWrapper != 9999 for resizing case when colorbox is calculated popup dimensions*/
213
- if(popupWrapper > screenWidth && popupWrapper != 9999) {
214
- var scaleDegree = screenWidth/popupWrapper;
215
  jQuery("#sgcboxWrapper").css({
216
- "transform-origin" : "0 0 !important",
217
- 'transform': "scale("+scaleDegree+", 1)"
218
  });
219
  popupWrapper = 0;
220
  }
221
  else {
222
  jQuery("#sgcboxWrapper").css({
223
- "transform-origin" : "0 0 !important",
224
  'transform': "scale(1, 1)"
225
  })
226
  }
227
  };
228
 
229
- SGPopup.prototype.sgPopupScaling = function() {
230
  var that = this;
231
- jQuery("#sgcolorbox").bind("sgColorboxOnCompleate", function() {
232
  that.sgPopupScalingDimensions();
233
  });
234
- jQuery(window).resize(function() {
235
- setTimeout(function(){ that.sgPopupScalingDimensions(); }, 1000);
 
 
236
  });
237
  };
238
 
239
- SGPopup.prototype.varToBool = function(optionName) {
240
  returnValue = (optionName) ? true : false;
241
  return returnValue;
242
  };
243
 
244
- SGPopup.prototype.canOpenPopup = function(id, openOnce, isOnLoad) {
 
245
  if (!isOnLoad) {
246
  return true;
247
  }
248
- /*If user already subscribed don't show popup for that user*/
249
- if(typeof jQuery.cookie != 'undefined') {
250
-
251
- if(jQuery.cookie("subscription"+id)) {
252
- return false;
 
 
 
 
 
 
 
253
  }
254
  }
255
- if(openOnce && typeof jQuery.cookie('sgPopupDetails'+id) != 'undefined') {
 
 
 
 
 
256
  return this.canOpenOnce(id);
257
  }
258
 
259
  return true;
260
  };
261
 
262
- SGPopup.prototype.setFixedPosition = function(sgPositionLeft, sgPositionTop, sgPositionBottom, sgPositionRight, sgFixedPositionTop, sgFixedPositionLeft) {
263
  this.positionLeft = sgPositionLeft;
264
  this.positionTop = sgPositionTop;
265
  this.positionBottom = sgPositionBottom;
@@ -268,33 +375,34 @@ SGPopup.prototype.setFixedPosition = function(sgPositionLeft, sgPositionTop, sgP
268
  this.initialPositionLeft = sgFixedPositionLeft;
269
  };
270
 
271
- SGPopup.prototype.percentToPx = function(percentDimention, screenDimension) {
272
- var dimension = parseInt(percentDimention)*screenDimension/100;
273
  return dimension;
274
  };
275
 
276
- SGPopup.prototype.getPositionPercent = function(needPercent, screenDimension, dimension) {
277
- var sgPosition = (((this.percentToPx(needPercent,screenDimension)-dimension/2)/screenDimension)*100)+"%";
278
  return sgPosition;
279
  };
280
 
281
- SGPopup.prototype.showPopup = function(id, isOnLoad) {
282
  var that = this;
283
 
284
  /*When id does not exist*/
285
- if(!id) {
286
  return;
287
  }
288
 
289
  this.popupData = SG_POPUP_DATA[id];
290
- if(typeof this.popupData == "undefined") {
291
  return;
292
  }
 
293
  this.isOnLoad = isOnLoad;
294
  this.openOnce = this.varToBool(this.popupData['repeatPopup']);
295
  this.numberLimit = this.popupData['popup-appear-number-limit'];
296
 
297
- if(typeof that.removeCookie !== 'undefined') {
298
  that.removeCookie(this.openOnce);
299
  }
300
 
@@ -302,25 +410,119 @@ SGPopup.prototype.showPopup = function(id, isOnLoad) {
302
  return;
303
  }
304
 
305
- popupColorboxUrl = SG_APP_POPUP_URL+'/style/sgcolorbox/'+this.popupData['theme'];
306
  jQuery('[id=sg_colorbox_theme-css]').remove();
307
  head = document.getElementsByTagName('head')[0];
308
- link = document.createElement('link')
309
  link.type = "text/css";
310
  link.id = "sg_colorbox_theme-css";
311
- link.rel = "stylesheet"
312
  link.href = popupColorboxUrl;
313
  document.getElementsByTagName('head')[0].appendChild(link);
314
  var img = document.createElement('img');
315
- sgAddEvent(img, "error", function() {
316
  that.sgShowColorboxWithOptions();
317
  });
318
- setTimeout(function(){img.src = popupColorboxUrl;},0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  };
320
 
321
- SGPopup.prototype.sgShowColorboxWithOptions = function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  var that = this;
323
- setTimeout(function() {
324
 
325
  sgPopupFixed = that.varToBool(that.popupData['popupFixed']);
326
  that.popupOverlayClose = that.varToBool(that.popupData['overlayClose']);
@@ -338,8 +540,8 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
338
  var popupAutoClosePopup = that.varToBool(that.popupData['autoClosePopup']);
339
  var saveCookiePageLevel = that.varToBool(that.popupData['save-cookie-page-level']);
340
  popupClosingTimer = that.popupData['popupClosingTimer'];
341
-
342
- if(popupScaling) {
343
  that.sgPopupScaling();
344
  }
345
  if (popupCantClose) {
@@ -353,6 +555,8 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
353
  var popupVideo = that.popupData['video'];
354
  var popupOverlayColor = that.popupData['sgOverlayColor'];
355
  var contentBackgroundColor = that.popupData['sg-content-background-color'];
 
 
356
  var popupWidth = that.popupData['width'];
357
  var popupHeight = that.popupData['height'];
358
  var popupOpacity = that.popupData['opacity'];
@@ -372,11 +576,11 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
372
  var contentCustomClass = that.popupData['sgContentCustomClasss'];
373
  var popupTheme = that.popupData['theme'];
374
  var themeStringLength = popupTheme.length;
375
- var customClassName = popupTheme.substring(0, themeStringLength-4);
376
  var closeButtonText = that.popupData['theme-close-text'];
377
 
378
  popupHtml = (popupHtml) ? popupHtml : false;
379
- var popupIframe = (popupIframeUrl) ? true: false;
380
  popupVideo = (popupVideo) ? popupVideo : false;
381
  popupImage = (popupImage) ? popupImage : false;
382
  var popupPhoto = (popupImage) ? true : false;
@@ -385,12 +589,16 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
385
  popupHtml = popupShortCode;
386
  }
387
 
388
- if(popupHtml != ' ') {
389
  popupHtml = popupHtml;
390
  }
391
-
392
- if(popupHtml && popupWidth == '' && popupHeight == '' && popupMaxWidth =='' && popupMaxHeight == '') {
393
-
 
 
 
 
394
  jQuery(popupHtml).find('img:first').attr('onload', 'jQuery.sgcolorbox.resize();');
395
  }
396
  if (popupIframeUrl) {
@@ -426,35 +634,35 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
426
  popupPositionTop = that.getPositionPercent("50%", sgScreenHeight, sgPopupHeightPx);
427
  popupPositionLeft = that.getPositionPercent("50%", sgScreenWidth, sgPopupWidthPx);
428
 
429
- if(popupPosition == 1) { // Left Top
430
- that.setFixedPosition('0%','3%', false, false, 0, 0);
431
  }
432
- else if(popupPosition == 2) { // Left Top
433
- that.setFixedPosition(popupPositionLeft,'3%', false, false, 0, 50);
434
  }
435
- else if(popupPosition == 3) { //Right Top
436
- that.setFixedPosition(false,'3%', false, '0%', 0, 90);
437
  }
438
- else if(popupPosition == 4) { // Left Center
439
  that.setFixedPosition('0%', popupPositionTop, false, false, popupPositionTop, 0);
440
  }
441
- else if(popupPosition == 5) { // center Center
442
  sgPopupFixed = true;
443
  that.setFixedPosition(false, false, false, false, 50, 50);
444
  }
445
- else if(popupPosition == 6) { // Right Center
446
- that.setFixedPosition('0%', popupPositionTop, false,'0%', 50, 90);
447
  }
448
- else if(popupPosition == 7) { // Left Bottom
449
  that.setFixedPosition('0%', false, '0%', false, 90, 0);
450
  }
451
- else if(popupPosition == 8) { // Center Bottom
452
  that.setFixedPosition(popupPositionLeft, false, '0%', false, 90, 50);
453
  }
454
- else if(popupPosition == 9) { // Right Bottom
455
  that.setFixedPosition(false, false, '0%', '0%', 90, 90);
456
  }
457
- if(!sgPopupFixed) {
458
  that.setFixedPosition(false, false, false, false, 50, 50);
459
  }
460
 
@@ -464,18 +672,18 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
464
  }
465
 
466
  if (popupAutoClosePopup) {
467
- setTimeout(that.autoClosePopup, popupClosingTimer*1000);
468
  }
469
 
470
- if(disablePopupOverlay) {
471
  that.sgTrapFocus = false;
472
  that.disablePopupOverlay();
473
  }
474
 
475
- if(onlyMobile) {
476
  openOnlyMobile = false;
477
  openOnlyMobile = that.forMobile();
478
- if(openOnlyMobile == false) {
479
  return;
480
  }
481
  }
@@ -491,49 +699,52 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
491
  close: closeButtonText,
492
  overlayCutsomClassName: overlayCustomClass,
493
  contentCustomClassName: contentCustomClass,
494
- onOpen:function() {
495
  jQuery('#sgcolorbox').removeAttr('style');
496
  jQuery('#sgcolorbox').removeAttr('left');
497
- jQuery('#sgcolorbox').css('top',''+that.initialPositionTop+'%');
498
- jQuery('#sgcolorbox').css('left',''+that.initialPositionLeft+'%');
499
- jQuery('#sgcolorbox').css('animation-duration', popupEffectDuration+"s");
500
- jQuery('#sgcolorbox').css('-webkit-animation-duration', popupEffectDuration+"s");
501
- jQuery("#sgcolorbox").addClass('sg-animated '+popupEffect+'');
502
  jQuery("#sgcboxOverlay").addClass("sgcboxOverlayBg");
503
  jQuery("#sgcboxOverlay").removeAttr('style');
504
 
505
  if (popupOverlayColor) {
506
- jQuery("#sgcboxOverlay").css({'background' : 'none', 'background-color' : popupOverlayColor});
507
  }
508
 
509
  jQuery('#sgcolorbox').trigger("sgColorboxOnOpen", []);
510
  that.sgCustomizeThemes(that.popupData['id']);
511
-
512
  },
513
- onLoad: function(){
514
  },
515
- onComplete: function(){
516
- if(contentBackgroundColor) {
517
- jQuery("#sgcboxLoadedContent").css({'background-color' : contentBackgroundColor})
518
  }
519
- jQuery("#sgcboxLoadedContent").addClass("sg-current-popup-"+that.popupData['id'])
520
  jQuery('#sgcolorbox').trigger("sgColorboxOnCompleate", [pushToBottom]);
521
- if(popupWidth == '' && popupHeight == '') {
522
  jQuery.sgcolorbox.resize();
523
  }
524
-
525
  var sgpopupInit = new SgPopupInit(that.popupData);
526
  sgpopupInit.overallInit();
527
  /* For specific popup Like Countdown AgeRestcion popups */
528
  sgpopupInit.initByPopupType();
529
  that.sgCustomizeThemes(that.popupData['id']);
530
-
 
 
 
531
  },
532
- onCleanup: function() {
533
  jQuery('#sgcolorbox').trigger("sgPopupCleanup", []);
534
  },
535
- onClosed: function() {
536
- jQuery("#sgcboxLoadedContent").removeClass("sg-current-popup-"+that.popupData['id'])
537
  jQuery('#sgcolorbox').trigger("sgPopupClose", []);
538
  },
539
  trapFocus: that.sgTrapFocus,
@@ -558,74 +769,81 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
558
  initialHeight: popupInitialHeight
559
  };
560
 
 
 
 
 
561
  jQuery.sgcolorbox(SG_POPUP_SETTINGS);
562
 
563
-
564
- if(countryStatus == true && typeof SgUserData != "undefined") {
565
- jQuery.cookie("SG_POPUP_USER_COUNTRY_NAME", SgUserData.countryIsoName, { expires: 365});
566
  }
567
  /* Cookie can't be set here as it's set in Age Restriction popup when the user clicks "yes" */
568
- if (that.popupData['id'] && that.isOnLoad==true && that.openOnce != '' && that.popupData['type'] != "ageRestriction") {
569
  sgCookieData = '';
570
- if(!saveCookiePageLevel) {
571
- jQuery.cookie.defaults = {path:'/'};
572
  }
573
-
574
- var currentCookie = jQuery.cookie('sgPopupDetails'+that.popupData['id']);
575
-
576
- if(typeof currentCookie == 'undefined') {
577
  openCounter = 1;
578
  }
579
  else {
580
- var currentCookie = JSON.parse(jQuery.cookie('sgPopupDetails'+that.popupData['id']));
581
- openCounter = currentCookie.openCounter+=1;
582
  }
583
  sgCookieData = {
584
  'popupId': that.popupData['id'],
585
  'openCounter': openCounter,
586
  'openLimit': that.numberLimit
587
  };
588
- jQuery.cookie("sgPopupDetails"+that.popupData['id'],JSON.stringify(sgCookieData), { expires: onceExpiresTime});
589
  }
590
 
591
  if (that.popupContentClick) {
592
- jQuery("#sgcolorbox").bind("sgColorboxOnCompleate", function() {
593
  /* If has url for redirect */
594
- if((contentClickBehavior !== 'close' || clickRedirectToUrl !== '') && typeof contentClickBehavior !== 'undefined') {
595
  jQuery('#sgcolorbox').css({
596
  "cursor": 'pointer'
597
  });
598
  }
599
 
600
- jQuery(".sg-current-popup-"+that.popupData['id']).bind('click',function() {
601
- if(contentClickBehavior == 'close' || clickRedirectToUrl == '' || typeof contentClickBehavior == 'undefined') {
602
  jQuery.sgcolorbox.close();
603
  }
604
  else {
605
- if(!redirectToNewTab) {
606
  window.location = clickRedirectToUrl;
607
  }
608
  else {
609
  window.open(clickRedirectToUrl);
610
  }
611
  }
612
-
613
  });
614
  });
615
  }
616
 
617
- jQuery('#sgcolorbox').bind('sgPopupClose', function(e) {
618
  /* reset event execute count for popup open */
619
  sgEventExecuteCount = 0;
620
- jQuery('#sgcolorbox').removeClass(customClassName); /* Remove custom class for another popup */
 
 
621
  jQuery('#sgcboxOverlay').removeClass(customClassName);
622
- jQuery('#sgcolorbox').removeClass(popupEffect); /* Remove animated effect for another popup */
 
623
  });
624
 
625
- },this.popupData['delay']*1000);
626
  };
627
 
628
- jQuery(document).ready(function($) {
629
  var popupObj = new SGPopup();
630
  popupObj.init();
631
  });
14
  this.popupContentClick = false;
15
  this.popupCloseButton = true;
16
  this.sgTrapFocus = true;
17
+ this.popupType = '';
18
+ this.popupClassEvents = ['hover'];
19
+ this.eventExecuteCountByClass = 0;
20
  }
21
 
22
+ /*Popup thems default paddings where key is theme number value padding*/
23
+ SGPopup.sgColorBoxDeafults = {1 : 70, 2: 34, 3: 30, 4 : 70, 5 : 62, 6: 70};
24
+
25
+ SGPopup.prototype.popupOpenById = function (popupId) {
26
+ sgOnScrolling = (SG_POPUP_DATA [popupId]['onScrolling']) ? SG_POPUP_DATA [popupId]['onScrolling'] : '';
27
+ sgInActivity = (SG_POPUP_DATA [popupId]['inActivityStatus']) ? SG_POPUP_DATA [popupId]['inActivityStatus'] : '';
28
+ beforeScrolingPrsent = (SG_POPUP_DATA [popupId]['onScrolling']) ? SG_POPUP_DATA [popupId]['beforeScrolingPrsent'] : '';
29
+ autoClosePopup = (SG_POPUP_DATA [popupId]['autoClosePopup']) ? SG_POPUP_DATA [popupId]['autoClosePopup'] : '';
30
+ popupClosingTimer = (SG_POPUP_DATA [popupId]['popupClosingTimer']) ? SG_POPUP_DATA [popupId]['popupClosingTimer'] : '';
31
  sgPoupFrontendObj = new SGPopup();
32
+
33
+ if (sgOnScrolling) {
34
  sgPoupFrontendObj.onScrolling(popupId);
35
  }
36
+ else if (sgInActivity) {
37
  sgPoupFrontendObj.showPopupAfterInactivity(popupId);
38
  }
39
  else {
40
+ sgPoupFrontendObj.showPopup(popupId, true);
41
  }
42
  };
43
 
44
+ SGPopup.getCookie = function (cName) {
45
+ var name = cName + "=";
46
+ var ca = document.cookie.split(';');
47
+ for (var i = 0; i < ca.length; i++) {
48
+ var c = ca[i];
49
+ while (c.charAt(0) == ' ') {
50
+ c = c.substring(1);
51
+ }
52
+ if (c.indexOf(name) == 0) {
53
+ return c.substring(name.length, c.length);
54
+ }
55
+ }
56
+ return "";
57
  };
58
 
59
+ SGPopup.deleteCookie = function (name) {
60
+ document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
61
+ };
62
+
63
+ SGPopup.setCookie = function (cName, cValue, exDays, cPageLevel) {
64
+
65
+ var expirationDate = new Date();
66
+ var cookiePageLevel = '';
67
+ var cookieExpirationData = 1;
68
+ if (!exDays || isNaN(exDays)) {
69
+ exDays = 365 * 50;
70
+ }
71
+ if (typeof cPageLevel == 'undefined') {
72
+ cPageLevel = false;
73
+ }
74
+ expirationDate.setDate(expirationDate.getDate() + exDays);
75
+ cookieExpirationData = expirationDate.toUTCString();
76
+ var expires = 'expires='+cookieExpirationData;
77
+
78
+ if (exDays == -1) {
79
+ expires = '';
80
+ }
81
 
82
+ if (cPageLevel) {
83
+ cookiePageLevel = 'path=/;';
84
+ }
 
 
85
 
86
+ var value = cValue + ((exDays == null) ? ";" : "; " + expires + ";" + cookiePageLevel);
87
+ document.cookie = cName + "=" + value;
88
  };
89
 
90
+ SGPopup.prototype.init = function () {
91
+
92
  var that = this;
93
 
94
  this.onCompleate();
95
  this.popupOpenByCookie();
96
+ this.attacheShortCodeEvent();
97
+ this.attacheClickEvent();
98
+ this.attacheIframeEvent();
99
+ this.attacheConfirmEvent();
100
+ this.popupClassEventsTrigger();
101
+ };
102
+
103
+ SGPopup.prototype.attacheShortCodeEvent = function () {
104
+
105
+ var that = this;
106
 
107
+ jQuery(".sg-show-popup").each(function () {
108
  var popupEvent = jQuery(this).attr("data-popup-event");
109
+ if (typeof popupEvent == 'undefined') {
110
  popupEvent = 'click';
111
  }
112
  /* For counting execute and did it one time for popup open */
113
  sgEventExecuteCount = 0;
114
+ jQuery(this).bind(popupEvent, function () {
115
  ++sgEventExecuteCount;
116
+ if (sgEventExecuteCount > 1) {
117
  return;
118
+ }
119
  var sgPopupID = jQuery(this).attr("data-sgpopupid");
120
+ that.showPopup(sgPopupID, false);
121
  });
122
  });
123
+ };
124
 
125
+ SGPopup.prototype.attacheConfirmEvent = function () {
126
+
127
+ var that = this;
128
+
129
+ jQuery("[class*='sg-confirm-popup-']").each(function () {
130
+ jQuery(this).bind("click", function (e) {
131
+ e.preventDefault();
132
+ var currentLink = jQuery(this);
133
  var className = jQuery(this).attr("class");
 
134
 
135
+ var sgPopupId = that.findPopupIdFromClassNames(className, "sg-confirm-popup-");
136
+
137
+ jQuery('#sgcolorbox').bind("sgPopupClose", function () {
138
+ var target = currentLink.attr("target");
139
+
140
+ if (typeof target == 'undefined') {
141
+ target = "self";
142
+ }
143
+ var href = currentLink.attr("href");
144
+
145
+ if (target == "_blank") {
146
+ window.open(href);
147
+ }
148
+ else {
149
+ window.location.href = href;
150
+ }
151
+ });
152
+ that.showPopup(sgPopupId, false);
153
  })
154
  });
155
+ };
156
+
157
+ SGPopup.prototype.attacheIframeEvent = function () {
158
 
159
+ var that = this;
160
  /* When user set popup by class name */
161
+ jQuery("[class*='sg-iframe-popup-']").each(function () {
162
  var currentLink = jQuery(this);
163
+ jQuery(this).bind("click", function (e) {
164
  e.preventDefault();
165
  var className = jQuery(this).attr("class");
166
 
169
  /*This update for dynamic open iframe url for same popup*/
170
  var linkUrl = currentLink.attr("href");
171
 
172
+ if (typeof linkUrl == 'undefined') {
173
  var childLinkTag = currentLink.find('a');
174
  linkUrl = childLinkTag.attr("href");
175
  }
176
 
177
  SG_POPUP_DATA[sgPopupId]['iframe'] = linkUrl;
178
 
179
+ that.showPopup(sgPopupId, false);
180
  });
181
  });
182
+ };
183
 
184
+ SGPopup.prototype.attacheClickEvent = function () {
185
+
186
+ var that = this;
187
+ /* When user set popup by class name */
188
+ jQuery("[class*='sg-popup-id-']").each(function () {
189
+ jQuery(this).bind("click", function () {
190
  var className = jQuery(this).attr("class");
191
+ var sgPopupId = that.findPopupIdFromClassNames(className, "sg-popup-id-");
192
 
193
+ that.showPopup(sgPopupId, false);
194
+ })
195
+ });
196
+ };
197
 
198
+ SGPopup.prototype.popupClassEventsTrigger = function () {
199
+
200
+ var popupEvents = this.popupClassEvents;
201
+ var that = this;
202
+
203
+ if(popupEvents.length > 0) {
204
+
205
+ for (var i in popupEvents) {
206
+ var eventName = popupEvents[i];
207
+
208
+ that.attacheCustomEvent(eventName);
209
+ }
210
+ }
211
+ };
212
+
213
+ SGPopup.prototype.attacheCustomEvent = function (eventName) {
214
+
215
+ if(typeof eventName == 'undefined' || eventName == '' ) {
216
+ return;
217
+ }
218
+ var that = this;
219
+
220
+ jQuery("[class*='sg-popup-"+eventName+"-']").each(function () {
221
+ var eventCount = that.eventExecuteCountByClass;
222
+ jQuery(this).bind(eventName, function () {
223
+ eventCount = ++that.eventExecuteCountByClass;
224
+ if (eventCount > 1) {
225
+ return;
226
+ }
227
+ var className = jQuery(this).attr("class");
228
+ var sgPopupId = that.findPopupIdFromClassNames(className, 'sg-popup-'+eventName+'-');
229
+
230
+ that.showPopup(sgPopupId, false);
231
  })
232
  });
233
  };
234
 
235
+ SGPopup.prototype.popupOpenByCookie = function () {
236
 
237
  var popupId = SGPopup.getCookie("sgSubmitReloadingForm");
238
  popupId = parseInt(popupId);
239
 
240
+ if (typeof popupId == 'number') {
241
+ this.showPopup(popupId, false);
242
  }
243
  };
244
 
245
+ SGPopup.prototype.findPopupIdFromClassNames = function (className, classKey) {
246
+
247
+ var classSplitArray = className.split(classKey);
248
  var classIdString = classSplitArray['1'];
249
  /*Get first all number from string*/
250
  var popupId = classIdString.match(/^\d+/);
252
  return popupId;
253
  };
254
 
255
+ SGPopup.prototype.sgCustomizeThemes = function (popupId) {
256
 
257
  var popupData = SG_POPUP_DATA[popupId];
258
  var borderRadiues = popupData['sg3ThemeBorderRadiues'];
259
+ var popupContentOpacity = popupData['popup-background-opacity'];
260
+ var changedColor = jQuery('#sgcboxContent').css('background-color').replace(')', ', '+popupContentOpacity+')').replace('rgb', 'rgba');
261
 
262
+ if (popupData['theme'] == "colorbox3.css") {
263
  var borderColor = popupData['sgTheme3BorderColor'];
264
  var borderRadiues = popupData['sgTheme3BorderRadius'];
265
  jQuery("#sgcboxLoadedContent").css({'border-color': borderColor})
266
+ jQuery("#sgcboxLoadedContent").css({'border-radius': borderRadiues + "%"})
267
+ jQuery("#sgcboxContent").css({'border-radius': borderRadiues + "%"})
268
  }
269
+
270
+ jQuery('#sgcboxContent').css({'background-color': changedColor})
271
+ jQuery('#sgcboxLoadedContent').css({'background-color': changedColor})
272
+
273
  };
274
 
275
+ SGPopup.prototype.onCompleate = function () {
276
+
277
+ jQuery("#sgcolorbox").bind("sgColorboxOnCompleate", function () {
278
 
 
 
279
  /* Scroll only inside popup */
280
  jQuery('#sgcboxLoadedContent').isolatedScroll();
281
  });
282
  this.isolatedScroll();
283
  };
284
 
285
+ SGPopup.prototype.isolatedScroll = function () {
286
 
287
+ jQuery.fn.isolatedScroll = function () {
288
  this.bind('mousewheel DOMMouseScroll', function (e) {
289
  var delta = e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta) || -e.detail,
290
  bottomOverflow = this.scrollTop + jQuery(this).outerHeight() - this.scrollHeight >= 0,
298
  };
299
  };
300
 
301
+ SGPopup.prototype.sgPopupScalingDimensions = function () {
302
  var popupWrapper = jQuery("#sgcboxWrapper").outerWidth();
303
  var screenWidth = jQuery(window).width();
304
  /*popupWrapper != 9999 for resizing case when colorbox is calculated popup dimensions*/
305
+ if (popupWrapper > screenWidth && popupWrapper != 9999) {
306
+ var scaleDegree = screenWidth / popupWrapper;
307
  jQuery("#sgcboxWrapper").css({
308
+ "transform-origin": "0 0 !important",
309
+ 'transform': "scale(" + scaleDegree + ", 1)"
310
  });
311
  popupWrapper = 0;
312
  }
313
  else {
314
  jQuery("#sgcboxWrapper").css({
315
+ "transform-origin": "0 0 !important",
316
  'transform': "scale(1, 1)"
317
  })
318
  }
319
  };
320
 
321
+ SGPopup.prototype.sgPopupScaling = function () {
322
  var that = this;
323
+ jQuery("#sgcolorbox").bind("sgColorboxOnCompleate", function () {
324
  that.sgPopupScalingDimensions();
325
  });
326
+ jQuery(window).resize(function () {
327
+ setTimeout(function () {
328
+ that.sgPopupScalingDimensions();
329
+ }, 1000);
330
  });
331
  };
332
 
333
+ SGPopup.prototype.varToBool = function (optionName) {
334
  returnValue = (optionName) ? true : false;
335
  return returnValue;
336
  };
337
 
338
+ SGPopup.prototype.canOpenPopup = function (id, openOnce, isOnLoad) {
339
+
340
  if (!isOnLoad) {
341
  return true;
342
  }
343
+
344
+ var currentCookies = SGPopup.getCookie('sgPopupCookieList');
345
+ if (currentCookies) {
346
+ currentCookies = JSON.parse(currentCookies);
347
+
348
+ for (var cookieIndex in currentCookies) {
349
+ var cookieName = currentCookies[cookieIndex];
350
+ var cookieData = SGPopup.getCookie(cookieName + id);
351
+
352
+ if (cookieData) {
353
+ return false;
354
+ }
355
  }
356
  }
357
+
358
+ var popupCookie = SGPopup.getCookie('sgPopupDetails' + id);
359
+ var popupType = this.popupType;
360
+
361
+ /*for popup this often case */
362
+ if (openOnce && popupCookie != '') {
363
  return this.canOpenOnce(id);
364
  }
365
 
366
  return true;
367
  };
368
 
369
+ SGPopup.prototype.setFixedPosition = function (sgPositionLeft, sgPositionTop, sgPositionBottom, sgPositionRight, sgFixedPositionTop, sgFixedPositionLeft) {
370
  this.positionLeft = sgPositionLeft;
371
  this.positionTop = sgPositionTop;
372
  this.positionBottom = sgPositionBottom;
375
  this.initialPositionLeft = sgFixedPositionLeft;
376
  };
377
 
378
+ SGPopup.prototype.percentToPx = function (percentDimention, screenDimension) {
379
+ var dimension = parseInt(percentDimention) * screenDimension / 100;
380
  return dimension;
381
  };
382
 
383
+ SGPopup.prototype.getPositionPercent = function (needPercent, screenDimension, dimension) {
384
+ var sgPosition = (((this.percentToPx(needPercent, screenDimension) - dimension / 2) / screenDimension) * 100) + "%";
385
  return sgPosition;
386
  };
387
 
388
+ SGPopup.prototype.showPopup = function (id, isOnLoad) {
389
  var that = this;
390
 
391
  /*When id does not exist*/
392
+ if (!id) {
393
  return;
394
  }
395
 
396
  this.popupData = SG_POPUP_DATA[id];
397
+ if (typeof this.popupData == "undefined") {
398
  return;
399
  }
400
+ this.popupType = this.popupData['type'];
401
  this.isOnLoad = isOnLoad;
402
  this.openOnce = this.varToBool(this.popupData['repeatPopup']);
403
  this.numberLimit = this.popupData['popup-appear-number-limit'];
404
 
405
+ if (typeof that.removeCookie !== 'undefined') {
406
  that.removeCookie(this.openOnce);
407
  }
408
 
410
  return;
411
  }
412
 
413
+ popupColorboxUrl = SG_APP_POPUP_URL + '/style/sgcolorbox/' + this.popupData['theme'];
414
  jQuery('[id=sg_colorbox_theme-css]').remove();
415
  head = document.getElementsByTagName('head')[0];
416
+ link = document.createElement('link');
417
  link.type = "text/css";
418
  link.id = "sg_colorbox_theme-css";
419
+ link.rel = "stylesheet";
420
  link.href = popupColorboxUrl;
421
  document.getElementsByTagName('head')[0].appendChild(link);
422
  var img = document.createElement('img');
423
+ sgAddEvent(img, "error", function () {
424
  that.sgShowColorboxWithOptions();
425
  });
426
+ setTimeout(function () {
427
+ img.src = popupColorboxUrl;
428
+ }, 0);
429
+ };
430
+
431
+ SGPopup.setToPopupsCookiesList = function (cookieName) {
432
+ var currentCookies = SGPopup.getCookie('sgPopupCookieList');
433
+ if (!currentCookies) {
434
+ currentCookies = [];
435
+ }
436
+ else {
437
+ currentCookies = JSON.parse(currentCookies);
438
+ }
439
+
440
+ if (jQuery.inArray(cookieName, currentCookies) == -1) {
441
+ cookieName = currentCookies.push(cookieName);
442
+ }
443
+
444
+ SGPopup.deleteCookie('sgPopupCookieList');
445
+ var currentCookies = JSON.stringify(currentCookies);
446
+ SGPopup.setCookie('sgPopupCookieList', currentCookies, 365, true);
447
  };
448
 
449
+ SGPopup.prototype.popupThemeDefaultMeasure = function () {
450
+
451
+ var themeName = this.popupData['theme'];
452
+ var defaults = SGPopup.sgColorBoxDeafults;
453
+ /*return theme id*/
454
+ var themeId = themeName.replace( /(^.+\D)(\d+)(\D.+$)/i,'$2');
455
+
456
+ return defaults[themeId];
457
+ };
458
+
459
+ SGPopup.prototype.resizeDimension = function () {
460
+
461
+ var resizeTimer;
462
+ var themeDefault = this.popupThemeDefaultMeasure();
463
+ var responsiveMeasure = this.popupData['popup-responsive-dimension-measure'];
464
+
465
+ function resizeColorBox() {
466
+ if (resizeTimer) clearTimeout(resizeTimer);
467
+ resizeTimer = setTimeout(function() {
468
+ if (jQuery('#sgcboxOverlay').is(':visible')) {
469
+ var width = jQuery(window).width();
470
+ var contentHeight = jQuery('#sgcboxLoadedContent')[0].scrollHeight+themeDefault;
471
+
472
+ var contentWidth = jQuery.sgcolorbox.settings.width;
473
+
474
+ /*For tablet case*/
475
+ if( width >= 768 && width <= 959 ) {
476
+ contentWidth = '82%';
477
+ }
478
+ else if( width >= 480 && width <= 767 ) {
479
+ /*For >= iphone 5s*/
480
+ contentWidth = '88%';
481
+ }
482
+ else if( width <= 479 ) {
483
+ /*For small devices*/
484
+ contentWidth = '94%';
485
+ }
486
+ else {
487
+ contentWidth = responsiveMeasure+'%s';
488
+ }
489
+ jQuery.sgcolorbox.settings.width = contentWidth;
490
+
491
+ jQuery.sgcolorbox.resize({
492
+ 'width': contentWidth,
493
+ 'height': contentHeight
494
+ });
495
+ }
496
+ }, 350)
497
+ }
498
+
499
+ jQuery(window).resize(resizeColorBox);
500
+ window.addEventListener("orientationchange", resizeColorBox, false);
501
+ };
502
+
503
+ SGPopup.prototype.calculateContentDimensions = function () {
504
+
505
+ var resizeObj = {};
506
+ resizeObj['width'] = jQuery("#sgcboxLoadedContent").width();
507
+ var themeDefault = this.popupThemeDefaultMeasure();
508
+
509
+ var constHeight = parseInt(SGPopup.sgColorBoxDeafultPadding);
510
+
511
+ var scrollHeight = jQuery("#sgcboxLoadedContent")[0].scrollHeight;
512
+ var contentHeight = jQuery("#sgcboxLoadedContent").height();
513
+ var heightDiff = scrollHeight - contentHeight;
514
+ if(heightDiff != 0) {
515
+ var height = (contentHeight + heightDiff)+themeDefault;
516
+ resizeObj['height'] = height;
517
+ }
518
+
519
+ jQuery.sgcolorbox.resize(resizeObj);
520
+
521
+ };
522
+
523
+ SGPopup.prototype.sgShowColorboxWithOptions = function () {
524
  var that = this;
525
+ setTimeout(function () {
526
 
527
  sgPopupFixed = that.varToBool(that.popupData['popupFixed']);
528
  that.popupOverlayClose = that.varToBool(that.popupData['overlayClose']);
540
  var popupAutoClosePopup = that.varToBool(that.popupData['autoClosePopup']);
541
  var saveCookiePageLevel = that.varToBool(that.popupData['save-cookie-page-level']);
542
  popupClosingTimer = that.popupData['popupClosingTimer'];
543
+
544
+ if (popupScaling) {
545
  that.sgPopupScaling();
546
  }
547
  if (popupCantClose) {
555
  var popupVideo = that.popupData['video'];
556
  var popupOverlayColor = that.popupData['sgOverlayColor'];
557
  var contentBackgroundColor = that.popupData['sg-content-background-color'];
558
+ var popupDimensionMode = that.popupData['popup-dimension-mode'];
559
+ var popupResponsiveDimensionMeasure = that.popupData['popup-responsive-dimension-measure'];
560
  var popupWidth = that.popupData['width'];
561
  var popupHeight = that.popupData['height'];
562
  var popupOpacity = that.popupData['opacity'];
576
  var contentCustomClass = that.popupData['sgContentCustomClasss'];
577
  var popupTheme = that.popupData['theme'];
578
  var themeStringLength = popupTheme.length;
579
+ var customClassName = popupTheme.substring(0, themeStringLength - 4);
580
  var closeButtonText = that.popupData['theme-close-text'];
581
 
582
  popupHtml = (popupHtml) ? popupHtml : false;
583
+ var popupIframe = (popupIframeUrl) ? true : false;
584
  popupVideo = (popupVideo) ? popupVideo : false;
585
  popupImage = (popupImage) ? popupImage : false;
586
  var popupPhoto = (popupImage) ? true : false;
589
  popupHtml = popupShortCode;
590
  }
591
 
592
+ if (popupHtml != ' ') {
593
  popupHtml = popupHtml;
594
  }
595
+
596
+ if(popupDimensionMode == 'responsiveMode') {
597
+ popupWidth = parseInt(popupResponsiveDimensionMeasure)+'%';
598
+ popupHeight = '';
599
+ }
600
+ if (popupHtml && popupWidth == '' && popupHeight == '' && popupMaxWidth == '' && popupMaxHeight == '') {
601
+
602
  jQuery(popupHtml).find('img:first').attr('onload', 'jQuery.sgcolorbox.resize();');
603
  }
604
  if (popupIframeUrl) {
634
  popupPositionTop = that.getPositionPercent("50%", sgScreenHeight, sgPopupHeightPx);
635
  popupPositionLeft = that.getPositionPercent("50%", sgScreenWidth, sgPopupWidthPx);
636
 
637
+ if (popupPosition == 1) { // Left Top
638
+ that.setFixedPosition('0%', '3%', false, false, 0, 0);
639
  }
640
+ else if (popupPosition == 2) { // Left Top
641
+ that.setFixedPosition(popupPositionLeft, '3%', false, false, 0, 50);
642
  }
643
+ else if (popupPosition == 3) { //Right Top
644
+ that.setFixedPosition(false, '3%', false, '0%', 0, 90);
645
  }
646
+ else if (popupPosition == 4) { // Left Center
647
  that.setFixedPosition('0%', popupPositionTop, false, false, popupPositionTop, 0);
648
  }
649
+ else if (popupPosition == 5) { // center Center
650
  sgPopupFixed = true;
651
  that.setFixedPosition(false, false, false, false, 50, 50);
652
  }
653
+ else if (popupPosition == 6) { // Right Center
654
+ that.setFixedPosition('0%', popupPositionTop, false, '0%', 50, 90);
655
  }
656
+ else if (popupPosition == 7) { // Left Bottom
657
  that.setFixedPosition('0%', false, '0%', false, 90, 0);
658
  }
659
+ else if (popupPosition == 8) { // Center Bottom
660
  that.setFixedPosition(popupPositionLeft, false, '0%', false, 90, 50);
661
  }
662
+ else if (popupPosition == 9) { // Right Bottom
663
  that.setFixedPosition(false, false, '0%', '0%', 90, 90);
664
  }
665
+ if (!sgPopupFixed) {
666
  that.setFixedPosition(false, false, false, false, 50, 50);
667
  }
668
 
672
  }
673
 
674
  if (popupAutoClosePopup) {
675
+ setTimeout(that.autoClosePopup, popupClosingTimer * 1000);
676
  }
677
 
678
+ if (disablePopupOverlay) {
679
  that.sgTrapFocus = false;
680
  that.disablePopupOverlay();
681
  }
682
 
683
+ if (onlyMobile) {
684
  openOnlyMobile = false;
685
  openOnlyMobile = that.forMobile();
686
+ if (openOnlyMobile == false) {
687
  return;
688
  }
689
  }
699
  close: closeButtonText,
700
  overlayCutsomClassName: overlayCustomClass,
701
  contentCustomClassName: contentCustomClass,
702
+ onOpen: function () {
703
  jQuery('#sgcolorbox').removeAttr('style');
704
  jQuery('#sgcolorbox').removeAttr('left');
705
+ jQuery('#sgcolorbox').css('top', '' + that.initialPositionTop + '%');
706
+ jQuery('#sgcolorbox').css('left', '' + that.initialPositionLeft + '%');
707
+ jQuery('#sgcolorbox').css('animation-duration', popupEffectDuration + "s");
708
+ jQuery('#sgcolorbox').css('-webkit-animation-duration', popupEffectDuration + "s");
709
+ jQuery("#sgcolorbox").addClass('sg-animated ' + popupEffect + '');
710
  jQuery("#sgcboxOverlay").addClass("sgcboxOverlayBg");
711
  jQuery("#sgcboxOverlay").removeAttr('style');
712
 
713
  if (popupOverlayColor) {
714
+ jQuery("#sgcboxOverlay").css({'background': 'none', 'background-color': popupOverlayColor});
715
  }
716
 
717
  jQuery('#sgcolorbox').trigger("sgColorboxOnOpen", []);
718
  that.sgCustomizeThemes(that.popupData['id']);
719
+
720
  },
721
+ onLoad: function () {
722
  },
723
+ onComplete: function () {
724
+ if (contentBackgroundColor) {
725
+ jQuery("#sgcboxLoadedContent").css({'background-color': contentBackgroundColor})
726
  }
727
+ jQuery("#sgcboxLoadedContent").addClass("sg-current-popup-" + that.popupData['id'])
728
  jQuery('#sgcolorbox').trigger("sgColorboxOnCompleate", [pushToBottom]);
729
+ if (popupWidth == '' && popupHeight == '') {
730
  jQuery.sgcolorbox.resize();
731
  }
732
+
733
  var sgpopupInit = new SgPopupInit(that.popupData);
734
  sgpopupInit.overallInit();
735
  /* For specific popup Like Countdown AgeRestcion popups */
736
  sgpopupInit.initByPopupType();
737
  that.sgCustomizeThemes(that.popupData['id']);
738
+ if(popupDimensionMode == 'responsiveMode') {
739
+ that.calculateContentDimensions();
740
+ that.resizeDimension();
741
+ }
742
  },
743
+ onCleanup: function () {
744
  jQuery('#sgcolorbox').trigger("sgPopupCleanup", []);
745
  },
746
+ onClosed: function () {
747
+ jQuery("#sgcboxLoadedContent").removeClass("sg-current-popup-" + that.popupData['id'])
748
  jQuery('#sgcolorbox').trigger("sgPopupClose", []);
749
  },
750
  trapFocus: that.sgTrapFocus,
769
  initialHeight: popupInitialHeight
770
  };
771
 
772
+ if(popupDimensionMode == 'responsiveMode') {
773
+ /*colorbox open speed*/
774
+ SG_POPUP_SETTINGS.speed = 10;
775
+ }
776
  jQuery.sgcolorbox(SG_POPUP_SETTINGS);
777
 
778
+
779
+ if (countryStatus == true && typeof SgUserData != "undefined") {
780
+ jQuery.cookie("SG_POPUP_USER_COUNTRY_NAME", SgUserData.countryIsoName, {expires: 365});
781
  }
782
  /* Cookie can't be set here as it's set in Age Restriction popup when the user clicks "yes" */
783
+ if (that.popupData['id'] && that.isOnLoad == true && that.openOnce != '' && that.popupData['type'] != "ageRestriction") {
784
  sgCookieData = '';
785
+ if (!saveCookiePageLevel) {
786
+ jQuery.cookie.defaults = {path: '/'};
787
  }
788
+
789
+ var currentCookie = jQuery.cookie('sgPopupDetails' + that.popupData['id']);
790
+
791
+ if (typeof currentCookie == 'undefined') {
792
  openCounter = 1;
793
  }
794
  else {
795
+ var currentCookie = JSON.parse(jQuery.cookie('sgPopupDetails' + that.popupData['id']));
796
+ openCounter = currentCookie.openCounter += 1;
797
  }
798
  sgCookieData = {
799
  'popupId': that.popupData['id'],
800
  'openCounter': openCounter,
801
  'openLimit': that.numberLimit
802
  };
803
+ jQuery.cookie("sgPopupDetails" + that.popupData['id'], JSON.stringify(sgCookieData), {expires: onceExpiresTime});
804
  }
805
 
806
  if (that.popupContentClick) {
807
+ jQuery("#sgcolorbox").bind("sgColorboxOnCompleate", function () {
808
  /* If has url for redirect */
809
+ if ((contentClickBehavior !== 'close' || clickRedirectToUrl !== '') && typeof contentClickBehavior !== 'undefined') {
810
  jQuery('#sgcolorbox').css({
811
  "cursor": 'pointer'
812
  });
813
  }
814
 
815
+ jQuery(".sg-current-popup-" + that.popupData['id']).bind('click', function () {
816
+ if (contentClickBehavior == 'close' || clickRedirectToUrl == '' || typeof contentClickBehavior == 'undefined') {
817
  jQuery.sgcolorbox.close();
818
  }
819
  else {
820
+ if (!redirectToNewTab) {
821
  window.location = clickRedirectToUrl;
822
  }
823
  else {
824
  window.open(clickRedirectToUrl);
825
  }
826
  }
827
+
828
  });
829
  });
830
  }
831
 
832
+ jQuery('#sgcolorbox').bind('sgPopupClose', function (e) {
833
  /* reset event execute count for popup open */
834
  sgEventExecuteCount = 0;
835
+ that.eventExecuteCountByClass = 0;
836
+ jQuery('#sgcolorbox').removeClass(customClassName);
837
+ /* Remove custom class for another popup */
838
  jQuery('#sgcboxOverlay').removeClass(customClassName);
839
+ jQuery('#sgcolorbox').removeClass(popupEffect);
840
+ /* Remove animated effect for another popup */
841
  });
842
 
843
+ }, this.popupData['delay'] * 1000);
844
  };
845
 
846
+ jQuery(document).ready(function ($) {
847
  var popupObj = new SGPopup();
848
  popupObj.init();
849
  });
javascript/sg_popup_init.js CHANGED
@@ -42,6 +42,13 @@ SgPopupInit.prototype.popupResizing = function(currentPopupId) {
42
  var height = this.popupData['height'];
43
  var maxWidth = this.popupData['maxWidth'];
44
  var maxHeight = this.popupData['maxHeight'];
 
 
 
 
 
 
 
45
 
46
  if(maxWidth == '' && maxHeight == '') {
47
  jQuery.sgcolorbox.resize({'width': width, 'height': height});
42
  var height = this.popupData['height'];
43
  var maxWidth = this.popupData['maxWidth'];
44
  var maxHeight = this.popupData['maxHeight'];
45
+ var popupDimensionMode = this.popupData['popup-dimension-mode'];
46
+ var popupResponsiveDimensionMeasure = this.popupData['popup-responsive-dimension-measure'];
47
+
48
+ if(popupDimensionMode == 'responsiveMode') {
49
+ width = parseInt(popupResponsiveDimensionMeasure)+'%';
50
+ height = '';
51
+ }
52
 
53
  if(maxWidth == '' && maxHeight == '') {
54
  jQuery.sgcolorbox.resize({'width': width, 'height': height});
javascript/sg_popup_javascript.php CHANGED
@@ -63,7 +63,6 @@ function sg_popup_admin_scripts($hook) {
63
 
64
  function SgFrontendScripts() {
65
  wp_enqueue_script('sg_popup_core', plugins_url('/sg_popup_core.js', __FILE__), '1.0.0', true);
66
- 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>";
67
  }
68
 
69
  add_action('admin_enqueue_scripts', 'sg_set_admin_url');
63
 
64
  function SgFrontendScripts() {
65
  wp_enqueue_script('sg_popup_core', plugins_url('/sg_popup_core.js', __FILE__), '1.0.0', true);
 
66
  }
67
 
68
  add_action('admin_enqueue_scripts', 'sg_set_admin_url');
popup-builder.php CHANGED
@@ -3,13 +3,16 @@
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.4.9
7
  * Author: Sygnoos
8
  * Author URI: http://www.sygnoos.com
9
  * License: GPLv2
10
  */
11
 
12
  require_once(dirname(__FILE__)."/config.php");
 
 
 
13
  require_once(SG_APP_POPUP_PATH ."/classes/SGPBExtensionManager.php");
14
  require_once(SG_APP_POPUP_CLASSES .'/SGPopupBuilderMain.php');
15
 
@@ -48,8 +51,6 @@ function sgNewBlogPopup()
48
 
49
  function sgPopupActivate()
50
  {
51
-
52
-
53
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
54
  PopupInstaller::install();
55
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
@@ -154,6 +155,10 @@ function sgShowShortCode($args, $content)
154
  if (!$obj) {
155
  return $content;
156
  }
 
 
 
 
157
  if(!empty($content)) {
158
  sgRenderPopupScript($args['id']);
159
  $attr = '';
@@ -180,18 +185,13 @@ function sgShowShortCode($args, $content)
180
  $page = get_queried_object_id();
181
  $popupsId = SgPopupPro::allowPopupInAllPages($page,'page');
182
 
183
- /* When have many popups in current page */
184
- if(count($popupsId) > 0) {
185
- /* Add shordcode popup id in the QUEUE for php side */
186
- array_push($popupsId,$args['id']);
187
- /* Add shordcode popup id at the first in the QUEUE for javascript side */
188
- echo "<script type=\"text/javascript\">SG_POPUPS_QUEUE.splice(0, 0, ".$args['id'].");</script>";
189
- update_option("SG_MULTIPLE_POPUP",$popupsId);
190
- showPopupInPage($args['id']);
191
- }
192
- else {
193
- echo showPopupInPage($args['id']);
194
- }
195
  }
196
  else {
197
  echo showPopupInPage($args['id']);
@@ -202,7 +202,7 @@ function sgShowShortCode($args, $content)
202
  ob_end_clean();
203
  return do_shortcode($shortcodeContent);
204
  }
205
- add_shortCode('sg_popup', 'sgShowShortCode');
206
 
207
  function sgRenderPopupOpen($popupId)
208
  {
@@ -280,7 +280,8 @@ function getPopupIdFromContentByClass($content) {
280
  $popupClasses = array(
281
  'sg-popup-id-',
282
  'sg-iframe-popup-',
283
- 'sg-confirm-popup-'
 
284
  );
285
 
286
  foreach ($popupClasses as $popupClassName) {
@@ -306,6 +307,17 @@ function getPopupIdInPageByClass($pageId) {
306
 
307
  if(isset($postContentObj)) {
308
  $content = $postContentObj->post_content;
 
 
 
 
 
 
 
 
 
 
 
309
  return getPopupIdFromContentByClass($content);
310
  }
311
 
@@ -349,6 +361,7 @@ function sgOnloadPopup()
349
  {
350
  $page = get_queried_object_id();
351
  $postType = get_post_type();
 
352
  $popup = "sg_promotional_popup";
353
  /* If popup is set on page load */
354
  $popupId = SGPopup::getPagePopupId($page, $popup);
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.5.0
7
  * Author: Sygnoos
8
  * Author URI: http://www.sygnoos.com
9
  * License: GPLv2
10
  */
11
 
12
  require_once(dirname(__FILE__)."/config.php");
13
+ require_once(SG_APP_POPUP_HELPERS .'/Helper_functions.php');
14
+ HelperFunctions::checkRequirements();
15
+
16
  require_once(SG_APP_POPUP_PATH ."/classes/SGPBExtensionManager.php");
17
  require_once(SG_APP_POPUP_CLASSES .'/SGPopupBuilderMain.php');
18
 
51
 
52
  function sgPopupActivate()
53
  {
 
 
54
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
55
  PopupInstaller::install();
56
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
155
  if (!$obj) {
156
  return $content;
157
  }
158
+ /*When inside popup short code content is empty*/
159
+ if(isset($args['insidepopup']) && empty($content)) {
160
+ return;
161
+ }
162
  if(!empty($content)) {
163
  sgRenderPopupScript($args['id']);
164
  $attr = '';
185
  $page = get_queried_object_id();
186
  $popupsId = SgPopupPro::allowPopupInAllPages($page,'page');
187
 
188
+ /* Add shordcode popup id in the QUEUE for php side */
189
+ array_push($popupsId,$args['id']);
190
+ /* Add shordcode popup id at the first in the QUEUE for javascript side */
191
+ echo "<script type=\"text/javascript\">SG_POPUPS_QUEUE.splice(0, 0, ".$args['id'].");</script>";
192
+ update_option("SG_MULTIPLE_POPUP",$popupsId);
193
+ showPopupInPage($args['id']);
194
+
 
 
 
 
 
195
  }
196
  else {
197
  echo showPopupInPage($args['id']);
202
  ob_end_clean();
203
  return do_shortcode($shortcodeContent);
204
  }
205
+ add_shortcode('sg_popup', 'sgShowShortCode');
206
 
207
  function sgRenderPopupOpen($popupId)
208
  {
280
  $popupClasses = array(
281
  'sg-popup-id-',
282
  'sg-iframe-popup-',
283
+ 'sg-confirm-popup-',
284
+ 'sg-popup-hover-'
285
  );
286
 
287
  foreach ($popupClasses as $popupClassName) {
307
 
308
  if(isset($postContentObj)) {
309
  $content = $postContentObj->post_content;
310
+
311
+ /*this will return template for the current page*/
312
+ $templatePath = get_page_template();
313
+
314
+ if(isset($templatePath)) {
315
+ $content .= file_get_contents($templatePath);
316
+ }
317
+
318
+ if(isset($postContentObj->post_excerpt)) {
319
+ $content .= $postContentObj->post_excerpt;
320
+ }
321
  return getPopupIdFromContentByClass($content);
322
  }
323
 
361
  {
362
  $page = get_queried_object_id();
363
  $postType = get_post_type();
364
+ echo SgPopupBuilderConfig::popupJsDataInit();
365
  $popup = "sg_promotional_popup";
366
  /* If popup is set on page load */
367
  $popupId = SGPopup::getPagePopupId($page, $popup);
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author: Sygnoos
5
  Donate link: http://popup-builder.com
6
  Tags: popup, restriction popup, exit intent popup, subscription popup
7
  Requires at least: 3.8
8
- Tested up to: 4.7.1
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -157,6 +157,16 @@ Go to the Popup Builder settings and set your desired options.
157
 
158
  == Changelog ==
159
 
 
 
 
 
 
 
 
 
 
 
160
  = Version 2.4.9 =
161
  * New extensions added.
162
  * Subscription popup improvements.
@@ -438,7 +448,7 @@ This will open a popup before a user goes to the page from the link.
438
 
439
  **How to redirect users after clicking on the popup image?**
440
 
441
- Go to the Options section of your popup and find "Dismiss on content click" option.
442
  Then Select "Redirect" option and in the URL field type the URL of the page you need your users to be redirected to.
443
 
444
  **Can I show a popup after a specific amount of time?**
5
  Donate link: http://popup-builder.com
6
  Tags: popup, restriction popup, exit intent popup, subscription popup
7
  Requires at least: 3.8
8
+ Tested up to: 4.7.2
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
157
 
158
  == Changelog ==
159
 
160
+ = Version 2.5.0 =
161
+ * Added new option for responsiveness.
162
+ * Added option to control the opacity of the popup background.
163
+ * Shortcode popup improvements.
164
+ * Added compatibility with cache plugins.
165
+ * Added CSS class sg-popup-hover-id for triggering popup by hovering via element.
166
+ * Code improvement and optimization.
167
+ * Improvement for detection of CSS classes(inside page templates, and WooCommerce products).
168
+ * Code improvement and optimization.
169
+
170
  = Version 2.4.9 =
171
  * New extensions added.
172
  * Subscription popup improvements.
448
 
449
  **How to redirect users after clicking on the popup image?**
450
 
451
+ Go to the “Options” section of your popup and find "Dismiss on content click" option.
452
  Then Select "Redirect" option and in the URL field type the URL of the page you need your users to be redirected to.
453
 
454
  **Can I show a popup after a specific amount of time?**
style/sg_popup_style.css CHANGED
@@ -11,6 +11,10 @@
11
  margin: 0;
12
  }
13
 
 
 
 
 
14
  .sg-full-width {
15
  width: 100%;
16
  }
@@ -1445,14 +1449,14 @@ input:checked + .sg-slider:before {
1445
  #plugin-icon-social-media-builder {
1446
  width:128px;
1447
  height:128px;
1448
- background-image: url(//ps.w.org/social-media-builder/assets/icon-128x128.png?rev=1315835);
1449
  background-size:128px 128px;
1450
  }
1451
 
1452
  #plugin-icon-review-builder {
1453
  width:128px;
1454
  height:128px;
1455
- background-image: url(//ps.w.org/review-builder/assets/icon-128x128.png?rev=1489430);
1456
  background-size:128px 128px;
1457
  }
1458
 
11
  margin: 0;
12
  }
13
 
14
+ .sg-small-liquid-width {
15
+ width: 20%;
16
+ }
17
+
18
  .sg-full-width {
19
  width: 100%;
20
  }
1449
  #plugin-icon-social-media-builder {
1450
  width:128px;
1451
  height:128px;
1452
+ background-image: url(//ps.w.org/social-media-builder/assets/icon-128x128.jpg?rev=1580407);
1453
  background-size:128px 128px;
1454
  }
1455
 
1456
  #plugin-icon-review-builder {
1457
  width:128px;
1458
  height:128px;
1459
+ background-image: url(//ps.w.org/review-builder/assets/icon-128x128.jpg?rev=1581909);
1460
  background-size:128px 128px;
1461
  }
1462
 
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/colorbox2.css CHANGED
@@ -1 +1 @@
1
- /*
1
+ /*
style/sgcolorbox/colorbox3.css CHANGED
@@ -1 +1 @@
1
- /*
1
+ /*
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:
style/sgcolorbox/colorbox6.css CHANGED
@@ -120,4 +120,9 @@
120
  .colorbox6 .sgcboxIE #sgcboxMiddleRight {
121
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
122
 
 
 
 
 
 
123
  }
120
  .colorbox6 .sgcboxIE #sgcboxMiddleRight {
121
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
122
 
123
+ }
124
+
125
+ #sgcboxLoadedContent img{
126
+ max-width: 100%;
127
+ height: auto;
128
  }