Popup Builder – Responsive WordPress Pop up - Version 2.4.9

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.4.9
Comparing to
See all releases

Code changes from version 2.4.8 to 2.4.9

classes/PopupInstaller.php CHANGED
@@ -1,46 +1,46 @@
1
  <?php
2
  class PopupInstaller
3
  {
4
- public static $maintablename = "sg_popup";
5
 
6
- public static function createTables($blogsId)
7
  {
8
  global $wpdb;
9
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
10
- $sgPopupBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_popup (
11
  `id` int(11) NOT NULL AUTO_INCREMENT,
12
  `type` varchar(255) NOT NULL,
13
  `title` varchar(255) NOT NULL,
14
  `options` LONGTEXT NOT NULL,
15
  PRIMARY KEY (id)
16
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
17
- $sgPopupSettingsBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_popup_settings (
18
  `id` int(11) NOT NULL AUTO_INCREMENT,
19
  `options` LONGTEXT NOT NULL,
20
  PRIMARY KEY (id)
21
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
22
  $optionsDefault = SgPopupGetData::getDefaultValues();
23
- $sgPopupInsertSettingsSql = $wpdb->prepare("INSERT IGNORE ". $wpdb->prefix.$blogsId."sg_popup_settings (id, options) VALUES(%d,%s) ", 1, json_encode($optionsDefault['settingsParamas']));
24
 
25
- $sgPopupImageBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_image_popup (
26
  `id` int(11) NOT NULL,
27
  `url` varchar(255) NOT NULL
28
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
29
- $sgPopupHtmlBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_html_popup (
30
  `id` int(11) NOT NULL,
31
  `content` text NOT NULL
32
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
33
- $sgPopupFblikeBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_fblike_popup (
34
  `id` int(11) NOT NULL,
35
  `content` text NOT NULL,
36
  `options` text NOT NULL
37
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
38
- $sgPopupShortcodeBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_shortCode_popup (
39
  `id` int(12) NOT NULL,
40
  `url` text NOT NULL
41
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
42
 
43
- $sgPopupAddon = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_popup_addons (
44
  `id` int(11) NOT NULL AUTO_INCREMENT,
45
  `name` varchar(255) NOT NULL UNIQUE,
46
  `paths` TEXT NOT NULL,
@@ -49,7 +49,7 @@ class PopupInstaller
49
  PRIMARY KEY (id)
50
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
51
 
52
- $extensionDataTable = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_popup_addons_connection (
53
  `id` int(11) NOT NULL AUTO_INCREMENT,
54
  `popupId` int(11) NOT NULL,
55
  `extensionKey` TEXT NOT NULL,
@@ -69,50 +69,69 @@ class PopupInstaller
69
  $wpdb->query($sgPopupAddon);
70
  $wpdb->query($extensionDataTable);
71
 
72
- $alterQuery = "ALTER TABLE ".$wpdb->prefix.$blogsId."sg_popup_addons ADD isEvent TINYINT UNSIGNED NOT NULL";
73
- $wpdb->query($alterQuery);
 
 
 
74
  }
75
 
76
  public static function install()
77
  {
78
  $obj = new self();
79
- $obj->createTables("");
 
 
 
 
 
 
 
 
 
 
 
80
 
81
- if(is_multisite()) {
82
- $sites = wp_get_sites();
83
  foreach($sites as $site) {
84
- $blogsId = $site['blog_id']."_";
85
- global $wpdb;
86
- $obj->createTables($blogsId);
 
 
 
 
 
 
 
87
  }
88
  }
89
  }
90
 
91
- public static function uninstallTables($blogsId)
92
  {
93
  global $wpdb;
94
- $delete = "DELETE FROM ".$wpdb->prefix.$blogsId."postmeta WHERE meta_key = 'sg_promotional_popup' ";
95
  $wpdb->query($delete);
96
 
97
- $popupTable = $wpdb->prefix.$blogsId."sg_popup";
98
  $popupSql = "DROP TABLE ". $popupTable;
99
 
100
- $popupImageTable = $wpdb->prefix.$blogsId."sg_image_popup";
101
  $popupImageSql = "DROP TABLE ". $popupImageTable;
102
 
103
- $popupHtmlTable = $wpdb->prefix.$blogsId."sg_html_popup";
104
  $popupHtmlSql = "DROP TABLE ". $popupHtmlTable;
105
 
106
- $popupFblikeTable = $wpdb->prefix.$blogsId."sg_fblike_popup";
107
  $popupFblikeSql = "DROP TABLE ". $popupFblikeTable;
108
 
109
- $popupShortcodeTable = $wpdb->prefix.$blogsId."sg_shortCode_popup";
110
  $popupShortcodeSql = "DROP TABLE ". $popupShortcodeTable;
111
 
112
- $popupAddonDrop = $wpdb->prefix.$blogsId."sg_popup_addons";
113
  $popupAddonSql = "DROP TABLE ". $popupAddonDrop;
114
 
115
- $popupSettingsDrop = $wpdb->prefix.$blogsId."sg_popup_settings";
116
  $popupSettingsSql = "DROP TABLE ". $popupSettingsDrop;
117
 
118
  $wpdb->query($popupSql);
@@ -124,26 +143,39 @@ class PopupInstaller
124
  $wpdb->query($popupSettingsSql);
125
  }
126
 
127
- public static function deleteSgPopupOptions($blogsId)
128
  {
129
  global $wpdb;
130
- $deleteSG = "DELETE FROM ".$wpdb->prefix.$blogsId."options WHERE option_name LIKE '%SG_POPUP%'";
131
  $wpdb->query($deleteSG);
132
  }
133
 
134
  public static function uninstall() {
135
- global $wpdb;
136
  $obj = new self();
137
- $obj->uninstallTables("");
138
- $obj->deleteSgPopupOptions("");
139
 
140
  if(is_multisite()) {
141
- $stites = wp_get_sites();
142
- foreach($stites as $site) {
143
- $blogsId = $site['blog_id']."_";
144
- global $wpdb;
145
- $obj->uninstallTables($blogsId);
146
- $obj->deleteSgPopupOptions($blogsId);
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
  }
149
  }
1
  <?php
2
  class PopupInstaller
3
  {
4
+ public static $mainTableName = "sg_popup";
5
 
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,
12
  `type` varchar(255) NOT NULL,
13
  `title` varchar(255) NOT NULL,
14
  `options` LONGTEXT NOT NULL,
15
  PRIMARY KEY (id)
16
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
17
+ $sgPopupSettingsBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_popup_settings (
18
  `id` int(11) NOT NULL AUTO_INCREMENT,
19
  `options` LONGTEXT NOT NULL,
20
  PRIMARY KEY (id)
21
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
22
  $optionsDefault = SgPopupGetData::getDefaultValues();
23
+ $sgPopupInsertSettingsSql = $wpdb->prepare("INSERT IGNORE ". $wpdb->prefix.$blogId."sg_popup_settings (id, options) VALUES(%d,%s) ", 1, json_encode($optionsDefault['settingsParamas']));
24
 
25
+ $sgPopupImageBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_image_popup (
26
  `id` int(11) NOT NULL,
27
  `url` varchar(255) NOT NULL
28
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
29
+ $sgPopupHtmlBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_html_popup (
30
  `id` int(11) NOT NULL,
31
  `content` text NOT NULL
32
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
33
+ $sgPopupFblikeBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_fblike_popup (
34
  `id` int(11) NOT NULL,
35
  `content` text NOT NULL,
36
  `options` text NOT NULL
37
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
38
+ $sgPopupShortcodeBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_shortCode_popup (
39
  `id` int(12) NOT NULL,
40
  `url` text NOT NULL
41
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
42
 
43
+ $sgPopupAddon = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogId."sg_popup_addons (
44
  `id` int(11) NOT NULL AUTO_INCREMENT,
45
  `name` varchar(255) NOT NULL UNIQUE,
46
  `paths` 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,
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()
80
  {
81
  $obj = new self();
82
+ $obj->createTables();
83
+
84
+ /*get_current_blog_id() == 1 When plugin activated inside the child of multisite instance*/
85
+ if(is_multisite() && get_current_blog_id() == 1) {
86
+ global $wp_version;
87
+
88
+ if($wp_version > '4.6.0') {
89
+ $sites = get_sites();
90
+ }
91
+ else {
92
+ $sites = wp_get_sites();
93
+ }
94
 
 
 
95
  foreach($sites as $site) {
96
+
97
+ if($wp_version > '4.6.0') {
98
+ $blogId = $site->blog_id."_";
99
+ }
100
+ else {
101
+ $blogId = $site['blog_id']."_";
102
+ }
103
+ if($blogId != 1) {
104
+ $obj->createTables($blogId);
105
+ }
106
  }
107
  }
108
  }
109
 
110
+ public static function uninstallTables($blogId = '')
111
  {
112
  global $wpdb;
113
+ $delete = "DELETE FROM ".$wpdb->prefix.$blogId."postmeta WHERE meta_key = 'sg_promotional_popup' ";
114
  $wpdb->query($delete);
115
 
116
+ $popupTable = $wpdb->prefix.$blogId."sg_popup";
117
  $popupSql = "DROP TABLE ". $popupTable;
118
 
119
+ $popupImageTable = $wpdb->prefix.$blogId."sg_image_popup";
120
  $popupImageSql = "DROP TABLE ". $popupImageTable;
121
 
122
+ $popupHtmlTable = $wpdb->prefix.$blogId."sg_html_popup";
123
  $popupHtmlSql = "DROP TABLE ". $popupHtmlTable;
124
 
125
+ $popupFblikeTable = $wpdb->prefix.$blogId."sg_fblike_popup";
126
  $popupFblikeSql = "DROP TABLE ". $popupFblikeTable;
127
 
128
+ $popupShortcodeTable = $wpdb->prefix.$blogId."sg_shortCode_popup";
129
  $popupShortcodeSql = "DROP TABLE ". $popupShortcodeTable;
130
 
131
+ $popupAddonDrop = $wpdb->prefix.$blogId."sg_popup_addons";
132
  $popupAddonSql = "DROP TABLE ". $popupAddonDrop;
133
 
134
+ $popupSettingsDrop = $wpdb->prefix.$blogId."sg_popup_settings";
135
  $popupSettingsSql = "DROP TABLE ". $popupSettingsDrop;
136
 
137
  $wpdb->query($popupSql);
143
  $wpdb->query($popupSettingsSql);
144
  }
145
 
146
+ public static function deleteSgPopupOptions($blogId = '')
147
  {
148
  global $wpdb;
149
+ $deleteSG = "DELETE FROM ".$wpdb->prefix.$blogId."options WHERE option_name LIKE '%SG_POPUP%'";
150
  $wpdb->query($deleteSG);
151
  }
152
 
153
  public static function uninstall() {
154
+
155
  $obj = new self();
156
+ $obj->uninstallTables();
157
+ $obj->deleteSgPopupOptions();
158
 
159
  if(is_multisite()) {
160
+ global $wp_version;
161
+ if($wp_version > '4.6.0') {
162
+ $sites = get_sites();
163
+ }
164
+ else {
165
+ $sites = wp_get_sites();
166
+ }
167
+
168
+ foreach($sites as $site) {
169
+
170
+ if($wp_version > '4.6.0') {
171
+ $blogId = $site->blog_id."_";
172
+ }
173
+ else {
174
+ $blogId = $site['blog_id']."_";
175
+ }
176
+
177
+ $obj->uninstallTables($blogId);
178
+ $obj->deleteSgPopupOptions($blogId);
179
  }
180
  }
181
  }
classes/SGPBExtension.php CHANGED
@@ -8,11 +8,12 @@ abstract class SGPBExtension {
8
  private $popupId;
9
  private $extensionContent;
10
  private $extensionOptions;
 
11
 
12
  /**
13
  * Php magic call method using for setter and getter
14
  *
15
- * @since 2.4.7
16
  *
17
  * @param $name setter or getter name
18
  * @param array $args setter params
@@ -36,7 +37,7 @@ abstract class SGPBExtension {
36
  /**
37
  * Create Extension tables
38
  *
39
- * @since 2.4.7
40
  *
41
  * @param int $blogsId
42
  *
@@ -81,7 +82,7 @@ abstract class SGPBExtension {
81
  /**
82
  * Popup extensions Saved option
83
  *
84
- * @since 2.4.7
85
  *
86
  * @param int $popupId
87
  * @param string $extensionKey
@@ -93,7 +94,7 @@ abstract class SGPBExtension {
93
 
94
  global $wpdb;
95
 
96
- $prepareSql = $wpdb->prepare("SELECT options FROM ".$wpdb->prefix.static::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." WHERE popupId = %d AND extensionKey = %s", $popupId, $extensionKey);
97
  $savedData = $wpdb->get_results($prepareSql, OBJECT);
98
 
99
  /*When does not have saved data*/
@@ -119,7 +120,7 @@ abstract class SGPBExtension {
119
 
120
  global $wpdb;
121
 
122
- $prepareSql = $wpdb->prepare("SELECT COUNT(*) as count FROM ".$wpdb->prefix.static::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." WHERE popupId = %d AND extensionKey=%s", $popupId, $extensionKey);
123
  $arr = $wpdb->get_row($prepareSql, ARRAY_A);
124
 
125
  return $arr['count'];
@@ -133,8 +134,8 @@ abstract class SGPBExtension {
133
  if(!isset($extensionOptions)) {
134
  $extensionOptions = '';
135
  }
136
- $extensionOptions = json_encode($extensionOptions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
137
- $extensionConnectionTable = static::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME;
138
  $extensionKey = static::SGPB_EXTENSION_KEY;
139
  $extensionType = static::SGPB_EXTENSION_TYPE;
140
  $saveMode = $this->isExistOptionData($popupId, $extensionKey);
@@ -176,7 +177,7 @@ abstract class SGPBExtension {
176
  global $wpdb;
177
 
178
  $popupId = $this->getPopupId();
179
- $extensionConnectionTable = static::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME;
180
  $extensionKey = static::SGPB_EXTENSION_KEY;
181
 
182
  $deleteCondition = array('popupId' => $popupId, 'extensionKey' => $extensionKey);
@@ -188,7 +189,7 @@ abstract class SGPBExtension {
188
 
189
  global $wpdb;
190
 
191
- $extensionConnectionTable = static::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME;
192
  $deleteCondition = array('popupId' => $popupId);
193
  $wpdb->delete($wpdb->prefix.$extensionConnectionTable, $deleteCondition, array('%d'));
194
  }
@@ -198,7 +199,7 @@ abstract class SGPBExtension {
198
  global $wpdb;
199
  $extensionData = array();
200
 
201
- $prepareSql = $wpdb->prepare("SELECT extensionKey, options FROM ".$wpdb->prefix.static::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." WHERE popupId = %d AND extensionType=%s", $popupId, $type);
202
  $extensionOptions = $wpdb->get_results($prepareSql, ARRAY_A);
203
 
204
  if(empty($extensionOptions)) {
@@ -216,7 +217,7 @@ abstract class SGPBExtension {
216
 
217
  global $wpdb;
218
 
219
- $prepareSql = $wpdb->prepare("SELECT extensionKey, paths FROM ".$wpdb->prefix."sg_popup_addons LEFT JOIN ".$wpdb->prefix.static::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME ." ON extensionKey = name and popupId = %d", $popupId);
220
  $extensionOptions = $wpdb->get_results($prepareSql, ARRAY_A);
221
 
222
  return $extensionOptions;
@@ -226,7 +227,7 @@ abstract class SGPBExtension {
226
 
227
  global $wpdb;
228
 
229
- $prepareSql = $wpdb->prepare("SELECT count(id) as count FROM ".$wpdb->prefix.static::SGPB_ADDON_TABLE_NAME ." WHERE isEvent = 1 AND name in (SELECT extensionKey FROM ".$wpdb->prefix.static::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." where popupId = %d)", $popupId);
230
  $countEvents = $wpdb->get_row($prepareSql, ARRAY_A);
231
  $count = $countEvents['count'];
232
 
8
  private $popupId;
9
  private $extensionContent;
10
  private $extensionOptions;
11
+ private $postData;
12
 
13
  /**
14
  * Php magic call method using for setter and getter
15
  *
16
+ * @since 1.0.0
17
  *
18
  * @param $name setter or getter name
19
  * @param array $args setter params
37
  /**
38
  * Create Extension tables
39
  *
40
+ * @since 2.4.6
41
  *
42
  * @param int $blogsId
43
  *
82
  /**
83
  * Popup extensions Saved option
84
  *
85
+ * @since 2.4.6
86
  *
87
  * @param int $popupId
88
  * @param string $extensionKey
94
 
95
  global $wpdb;
96
 
97
+ $prepareSql = $wpdb->prepare("SELECT options FROM ".$wpdb->prefix.SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." WHERE popupId = %d AND extensionKey = %s", $popupId, $extensionKey);
98
  $savedData = $wpdb->get_results($prepareSql, OBJECT);
99
 
100
  /*When does not have saved data*/
120
 
121
  global $wpdb;
122
 
123
+ $prepareSql = $wpdb->prepare("SELECT COUNT(*) as count FROM ".$wpdb->prefix.SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." WHERE popupId = %d AND extensionKey=%s", $popupId, $extensionKey);
124
  $arr = $wpdb->get_row($prepareSql, ARRAY_A);
125
 
126
  return $arr['count'];
134
  if(!isset($extensionOptions)) {
135
  $extensionOptions = '';
136
  }
137
+ $extensionOptions = @json_encode($extensionOptions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
138
+ $extensionConnectionTable = SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME;
139
  $extensionKey = static::SGPB_EXTENSION_KEY;
140
  $extensionType = static::SGPB_EXTENSION_TYPE;
141
  $saveMode = $this->isExistOptionData($popupId, $extensionKey);
177
  global $wpdb;
178
 
179
  $popupId = $this->getPopupId();
180
+ $extensionConnectionTable = SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME;
181
  $extensionKey = static::SGPB_EXTENSION_KEY;
182
 
183
  $deleteCondition = array('popupId' => $popupId, 'extensionKey' => $extensionKey);
189
 
190
  global $wpdb;
191
 
192
+ $extensionConnectionTable = SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME;
193
  $deleteCondition = array('popupId' => $popupId);
194
  $wpdb->delete($wpdb->prefix.$extensionConnectionTable, $deleteCondition, array('%d'));
195
  }
199
  global $wpdb;
200
  $extensionData = array();
201
 
202
+ $prepareSql = $wpdb->prepare("SELECT extensionKey, options FROM ".$wpdb->prefix.SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." WHERE popupId = %d AND extensionType=%s", $popupId, $type);
203
  $extensionOptions = $wpdb->get_results($prepareSql, ARRAY_A);
204
 
205
  if(empty($extensionOptions)) {
217
 
218
  global $wpdb;
219
 
220
+ $prepareSql = $wpdb->prepare("SELECT extensionKey, paths FROM ".$wpdb->prefix."sg_popup_addons LEFT JOIN ".$wpdb->prefix.SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME ." ON extensionKey = name and popupId = %d", $popupId);
221
  $extensionOptions = $wpdb->get_results($prepareSql, ARRAY_A);
222
 
223
  return $extensionOptions;
227
 
228
  global $wpdb;
229
 
230
+ $prepareSql = $wpdb->prepare("SELECT count(id) as count FROM ".$wpdb->prefix.static::SGPB_ADDON_TABLE_NAME ." WHERE isEvent = 1 AND name in (SELECT extensionKey FROM ".$wpdb->prefix.SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." where popupId = %d)", $popupId);
231
  $countEvents = $wpdb->get_row($prepareSql, ARRAY_A);
232
  $count = $countEvents['count'];
233
 
classes/SGPBExtensionManager.php CHANGED
@@ -77,6 +77,9 @@ class SGPBExtensionManager {
77
 
78
  $this->setExtensionKey($extensionKey);
79
  $extensionClass = $this->getExtensionClassName();
 
 
 
80
  require_once($optionData['app-path'].'/classes/'.$extensionClass.'.php');
81
  $extensionObj = new $extensionClass();
82
  $content = $extensionObj->includeOption($popupType);
@@ -96,11 +99,9 @@ class SGPBExtensionManager {
96
 
97
  $this->setExtensionKey($extensionKey);
98
  $extensionClass = $this->getExtensionClassName();
99
-
100
  if(!file_exists($extensionData['app-path'] . '/classes/' . $extensionClass . '.php')) {
101
  continue;
102
  }
103
-
104
  require_once($extensionData['app-path'].'/classes/'.$extensionClass.'.php');
105
  $extensionObj = new $extensionClass();
106
  $extensionObj->setPostData($postData);
@@ -118,6 +119,9 @@ class SGPBExtensionManager {
118
 
119
  $this->setExtensionKey($extensionKey);
120
  $extensionClass = $this->getExtensionClassName();
 
 
 
121
  require_once($optionData['app-path'].'/classes/'.$extensionClass.'.php');
122
  $extensionObj = new $extensionClass();
123
  $defaults = $extensionObj->getDefaultValues();
@@ -182,7 +186,9 @@ class SGPBExtensionManager {
182
  $extensionClass = $this->getExtensionClassName();
183
 
184
  if(!class_exists($extensionClass)) {
185
-
 
 
186
  require_once($paths['app-path'].'/classes/'.$extensionClass.'.php');
187
  }
188
  $extensionObj = new $extensionClass();
77
 
78
  $this->setExtensionKey($extensionKey);
79
  $extensionClass = $this->getExtensionClassName();
80
+ if(!file_exists($optionData['app-path'].'/classes/'.$extensionClass.'.php')) {
81
+ continue;
82
+ }
83
  require_once($optionData['app-path'].'/classes/'.$extensionClass.'.php');
84
  $extensionObj = new $extensionClass();
85
  $content = $extensionObj->includeOption($popupType);
99
 
100
  $this->setExtensionKey($extensionKey);
101
  $extensionClass = $this->getExtensionClassName();
 
102
  if(!file_exists($extensionData['app-path'] . '/classes/' . $extensionClass . '.php')) {
103
  continue;
104
  }
 
105
  require_once($extensionData['app-path'].'/classes/'.$extensionClass.'.php');
106
  $extensionObj = new $extensionClass();
107
  $extensionObj->setPostData($postData);
119
 
120
  $this->setExtensionKey($extensionKey);
121
  $extensionClass = $this->getExtensionClassName();
122
+ if(!file_exists($optionData['app-path'].'/classes/'.$extensionClass.'.php')) {
123
+ continue;
124
+ }
125
  require_once($optionData['app-path'].'/classes/'.$extensionClass.'.php');
126
  $extensionObj = new $extensionClass();
127
  $defaults = $extensionObj->getDefaultValues();
186
  $extensionClass = $this->getExtensionClassName();
187
 
188
  if(!class_exists($extensionClass)) {
189
+ if(!file_exists($paths['app-path'].'/classes/'.$extensionClass.'.php')) {
190
+ continue;
191
+ }
192
  require_once($paths['app-path'].'/classes/'.$extensionClass.'.php');
193
  }
194
  $extensionObj = new $extensionClass();
classes/SGPopup.php CHANGED
@@ -13,7 +13,6 @@ abstract class SGPopup {
13
  protected $initialHeight;
14
  protected $options;
15
  public static $registeredScripts = false;
16
- public static $currentPopups = array();
17
 
18
  public function setType($type){
19
  $this->type = $type;
@@ -254,15 +253,23 @@ abstract class SGPopup {
254
 
255
  public function render() {
256
  /* When have popup with same id in the same page */
257
- if(!in_array($this->getId(), SGPopup::$currentPopups)) {
 
 
 
 
 
 
258
  $parentOption = array('id'=>$this->getId(),'title'=>$this->getTitle(),'type'=>$this->getType(),'effect'=>$this->getEffect(),'width',$this->getWidth(),'height'=>$this->getHeight(),'delay'=>$this->getDelay(),'duration'=>$this->getEffectDuration(),'initialWidth',$this->getInitialWidth(),'initialHeight'=>$this->getInitialHeight());
259
- $getexrArray = $this->getExtraRenderOptions();
260
- $getExtensionsArray = SGPBExtension::getExtensionsOptions($this->getId());
 
 
261
 
262
- array_push(SGPopup::$currentPopups,$this->getId());
263
  $options = json_decode($this->getOptions(),true);
264
  if(empty($options)) $options = array();
265
- $sgPopupVars = 'SG_POPUP_DATA['.$this->getId().'] ='.json_encode(array_merge($parentOption, $options, $getexrArray, $getExtensionsArray)).';';
 
266
 
267
  return $sgPopupVars;
268
  }
13
  protected $initialHeight;
14
  protected $options;
15
  public static $registeredScripts = false;
 
16
 
17
  public function setType($type){
18
  $this->type = $type;
253
 
254
  public function render() {
255
  /* When have popup with same id in the same page */
256
+ $registryInstance = SgRegistry::getInstance();
257
+ $currentPopups = $registryInstance->getCurrentPopupsId();
258
+
259
+ if(!in_array($this->getId(), $currentPopups)) {
260
+ $popupId = $this->getId();
261
+ $hasPopupEvent = SGPBExtension::hasPopupEvent($popupId);
262
+ $eventOptions = array('customEvent' => $hasPopupEvent);
263
  $parentOption = array('id'=>$this->getId(),'title'=>$this->getTitle(),'type'=>$this->getType(),'effect'=>$this->getEffect(),'width',$this->getWidth(),'height'=>$this->getHeight(),'delay'=>$this->getDelay(),'duration'=>$this->getEffectDuration(),'initialWidth',$this->getInitialWidth(),'initialHeight'=>$this->getInitialHeight());
264
+ $extraOptionsArray = $this->getExtraRenderOptions();
265
+ $extensionsDataArray = SGPBExtension::getExtensionsOptions($this->getId());
266
+
267
+ $registryInstance->setCurrentPopupId($this->getId());
268
 
 
269
  $options = json_decode($this->getOptions(),true);
270
  if(empty($options)) $options = array();
271
+ $popupOptions = array_merge($parentOption, $options, $extraOptionsArray, $extensionsDataArray, $eventOptions);
272
+ $sgPopupVars = 'SG_POPUP_DATA['.$this->getId().'] ='.@json_encode($popupOptions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE).';';
273
 
274
  return $sgPopupVars;
275
  }
classes/SgRegistry.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Singleton class
4
+ *
5
+ * @since 2.4.9
6
+ *
7
+ */
8
+ class SgRegistry {
9
+
10
+ private static $instance = null;
11
+ private $currentPopupsId = array();
12
+
13
+ protected function __construct() {
14
+
15
+ }
16
+
17
+ protected function __clone() {
18
+
19
+ }
20
+
21
+ public static function getInstance() {
22
+
23
+ if (!isset(self::$instance)) {
24
+ self::$instance = new SgRegistry();
25
+ }
26
+ return self::$instance;
27
+ }
28
+
29
+ public function setCurrentPopupId($popupId) {
30
+
31
+ array_push($this->currentPopupsId, $popupId);
32
+ }
33
+
34
+ public function getCurrentPopupsId() {
35
+
36
+ return $this->currentPopupsId;
37
+ }
38
+ }
config.php CHANGED
@@ -12,7 +12,7 @@ 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.48);
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/');
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/');
files/sg_admin_post.php CHANGED
@@ -81,7 +81,7 @@ function sgPopupDataExport() {
81
  "SG_MULTIPLE_POPUP"
82
  );
83
 
84
- $mainTable = PopupInstaller::$maintablename;
85
 
86
  $popupDataSql = "SELECT * FROM ".$wpdb->prefix.$mainTable;
87
  $getAllPopupData = $wpdb->get_results($popupDataSql, ARRAY_A);
81
  "SG_MULTIPLE_POPUP"
82
  );
83
 
84
+ $mainTable = PopupInstaller::$mainTableName;
85
 
86
  $popupDataSql = "SELECT * FROM ".$wpdb->prefix.$mainTable;
87
  $getAllPopupData = $wpdb->get_results($popupDataSql, ARRAY_A);
files/sg_functions.php CHANGED
@@ -59,6 +59,25 @@ class SGFunctions
59
  return wp_kses($sgPopupData, $allowedHtmltags);
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  public static function popupTablesDeleteSatus() {
63
 
64
  global $wpdb;
@@ -146,7 +165,7 @@ class SGFunctions
146
  else if($selectedValue == $value) {
147
  $selected = 'selected';
148
  }
149
- else if(is_array($value) && is_array($selectedValue, $value)) {
150
  $selected = 'selected';
151
  }
152
 
59
  return wp_kses($sgPopupData, $allowedHtmltags);
60
  }
61
 
62
+ public static function getPopupsDataList() {
63
+
64
+ $orderBy = 'id DESC';
65
+ $popupsData = SGPopup::findAll($orderBy);
66
+ $dataList = array();
67
+
68
+ foreach ($popupsData as $popupData) {
69
+
70
+ $title = $popupData->getTitle();
71
+ $type = $popupData->getType();
72
+ $id = $popupData->getId();
73
+
74
+ $dataList[$id] = $title.' - '.$type;
75
+ }
76
+
77
+ return $dataList;
78
+
79
+ }
80
+
81
  public static function popupTablesDeleteSatus() {
82
 
83
  global $wpdb;
165
  else if($selectedValue == $value) {
166
  $selected = 'selected';
167
  }
168
+ else if(is_array($value) && in_array($selectedValue, $value)) {
169
  $selected = 'selected';
170
  }
171
 
files/sg_popup_ajax.php CHANGED
@@ -108,12 +108,13 @@ function sgImportPopups()
108
  foreach ($contents['exportArray'] as $content) {
109
  //Main popup table data
110
  $popupData = $content['mainPopupData'];
 
111
  $popupType = $popupData['type'];
112
  $popupTitle = $popupData['title'];
113
  $popupOptions = $popupData['options'];
114
 
115
  //Insert popup
116
- $sql = $wpdb->prepare("INSERT INTO ".$wpdb->prefix.PopupInstaller::$maintablename."(type, title, options) VALUES (%s, %s, %s)", $popupType, $popupTitle, $popupOptions);
117
  $res = $wpdb->query($sql);
118
  //Get last insert popup id
119
  $lastInsertId = $wpdb->insert_id;
108
  foreach ($contents['exportArray'] as $content) {
109
  //Main popup table data
110
  $popupData = $content['mainPopupData'];
111
+ $popupId = $popupData['id'];
112
  $popupType = $popupData['type'];
113
  $popupTitle = $popupData['title'];
114
  $popupOptions = $popupData['options'];
115
 
116
  //Insert popup
117
+ $sql = $wpdb->prepare("INSERT INTO ".$wpdb->prefix.PopupInstaller::$maintablename."(id, type, title, options) VALUES (%d, %s, %s, %s)", $popupId, $popupType, $popupTitle, $popupOptions);
118
  $res = $wpdb->query($sql);
119
  //Get last insert popup id
120
  $lastInsertId = $wpdb->insert_id;
files/sg_popup_create_new.php CHANGED
@@ -206,13 +206,13 @@ if (isset($_GET['id'])) {
206
  $sgSubscriptionEmail = @$subscriptionOptions['subscription-email'];
207
  $sgSubsFirstName = @$subscriptionOptions['subs-first-name'];
208
  $sgSubsLastName = @$subscriptionOptions['subs-last-name'];
209
- $sgSubsButtonBgcolor = @$subscriptionOptions['subs-button-bgcolor'];
210
  $sgSubsBtnWidth = @$subscriptionOptions['subs-btn-width'];
211
  $sgSubsBtnHeight = @$subscriptionOptions['subs-btn-height'];
212
  $sgSubsTextHeight = @$subscriptionOptions['subs-text-height'];
213
  $sgSubsBtnTitle = @$subscriptionOptions['subs-btn-title'];
214
- $sgSubsTextInputBgcolor = @$subscriptionOptions['subs-text-input-bgcolor'];
215
- $sgSubsTextBordercolor = @$subscriptionOptions['subs-text-bordercolor'];
216
  $sgSubsTextWidth = @$subscriptionOptions['subs-text-width'];
217
  $sgSubsButtonColor = @$subscriptionOptions['subs-button-color'];
218
  $sgSubsInputsColor = @$subscriptionOptions['subs-inputs-color'];
@@ -221,7 +221,9 @@ if (isset($_GET['id'])) {
221
  $sgSuccessMessage = @$subscriptionOptions['subs-success-message'];
222
  $sgSubsBtnProgressTitle = @$subscriptionOptions['subs-btn-progress-title'];
223
  $sgSubsTextBorderWidth = @$subscriptionOptions['subs-text-border-width'];
224
- $sgSubsDontShowAfterSubmitting = @$subscriptionOptions['subs-dont-show-after-submitting'];
 
 
225
  $contactFormOptions = json_decode(@$params, true);
226
  $sgContactNameLabel = @$contactFormOptions['contact-name'];
227
  $sgContactNameStatus = @$contactFormOptions['contact-name-status'];
@@ -346,22 +348,24 @@ $popupProDefaultValues = array(
346
  'subscription-email' => 'Email *',
347
  'subs-first-name' => 'First name',
348
  'subs-last-name' => 'Last name',
349
- 'subs-button-bgcolor' => '#239744',
350
  'subs-button-color' => '#FFFFFF',
351
- 'subs-text-input-bgcolor' => '#FFFFFF',
352
  'subs-inputs-color' => '#000000',
353
  'subs-placeholder-color' => '#CCCCCC',
354
- 'subs-text-bordercolor' => '#CCCCCC',
355
  'subs-btn-title' => 'Subscribe',
356
  'subs-text-height' => '30px',
357
  'subs-btn-height' => '30px',
358
  'subs-text-width' => '200px',
359
  'subs-btn-width' => '200px',
360
- 'subs-dont-show-after-submitting' => false,
361
  'subs-text-border-width' => '2px',
362
  'subs-success-message' =>'You have successfully subscribed to the newsletter',
363
  'subs-validation-message' => 'This field is required.',
364
  'subs-btn-progress-title' => 'Please wait...',
 
 
 
365
  'contact-name' => 'Name *',
366
  'contact-name-required' => true,
367
  'contact-name-status' => true,
@@ -446,7 +450,7 @@ $subsLastNameStatus = sgBoolToChecked($popupProDefaultValues['subs-last-name-sta
446
  $subscriptionEmail = $popupProDefaultValues['subscription-email'];
447
  $subsFirstName = $popupProDefaultValues['subs-first-name'];
448
  $subsLastName = $popupProDefaultValues['subs-last-name'];
449
- $subsButtonBgcolor = $popupProDefaultValues['subs-button-bgcolor'];
450
  $subsButtonColor = $popupProDefaultValues['subs-button-color'];
451
  $subsInputsColor = $popupProDefaultValues['subs-inputs-color'];
452
  $subsBtnTitle = $popupProDefaultValues['subs-btn-title'];
@@ -457,11 +461,13 @@ $subsSuccessMessage = $popupProDefaultValues['subs-success-message'];
457
  $subsValidationMessage = $popupProDefaultValues['subs-validation-message'];
458
  $subsTextWidth = $popupProDefaultValues['subs-text-width'];
459
  $subsBtnWidth = $popupProDefaultValues['subs-btn-width'];
460
- $subsDontShowAfterSubmitting = $popupProDefaultValues['subs-dont-show-after-submitting'];
461
  $subsBtnProgressTitle = $popupProDefaultValues['subs-btn-progress-title'];
462
  $subsTextBorderWidth = $popupProDefaultValues['subs-text-border-width'];
463
- $subsTextBordercolor = $popupProDefaultValues['subs-text-bordercolor'];
464
- $subsTextInputBgcolor = $popupProDefaultValues['subs-text-input-bgcolor'];
 
 
 
465
  $contactName = $popupProDefaultValues['contact-name'];
466
  $contactEmail = $popupProDefaultValues['contact-email'];
467
  $contactMessage = $popupProDefaultValues['contact-message'];
@@ -544,7 +550,6 @@ $sgCountdownPosition = @sgSetChecked($sgCountdownPosition, $countdownPosition);
544
  $sgVideoAutoplay = @sgSetChecked($sgVideoAutoplay, $videoAutoplay);
545
  $sgSubsLastNameStatus = @sgSetChecked($sgSubsLastNameStatus, $subsLastNameStatus);
546
  $sgSubsFirstNameStatus = @sgSetChecked($sgSubsFirstNameStatus, $subsFirstNameStatus);
547
- $sgSubsDontShowAfterSubmitting = @sgSetChecked($sgSubsDontShowAfterSubmitting, $subsDontShowAfterSubmitting);
548
  $sgCountryStatus = @sgSetChecked($sgCountryStatus, $countryStatus);
549
  /* Contact popup otions */
550
  $sgContactNameStatus = @sgSetChecked($sgContactNameStatus, $contactNameStatus);
@@ -605,9 +610,9 @@ $sgExitIntentTpype = @sgGetValue($sgExitIntentTpype, $exitIntentType);
605
  $sgExitIntntExpire = @sgGetValue($sgExitIntntExpire, $exitIntentExpireTime);
606
  $sgSubsTextWidth = @sgGetValue($sgSubsTextWidth, $subsTextWidth);
607
  $sgSubsBtnWidth = @sgGetValue($sgSubsBtnWidth, $subsBtnWidth);
608
- $sgSubsTextInputBgcolor = @sgGetValue($sgSubsTextInputBgcolor, $subsTextInputBgcolor);
609
- $sgSubsButtonBgcolor = @sgGetValue($sgSubsButtonBgcolor, $subsButtonBgcolor);
610
- $sgSubsTextBordercolor = @sgGetValue($sgSubsTextBordercolor, $subsTextBordercolor);
611
  $sgSubscriptionEmail = @sgGetValue($sgSubscriptionEmail, $subscriptionEmail);
612
  $sgSubsFirstName = @sgGetValue($sgSubsFirstName, $subsFirstName);
613
  $sgSubsLastName = @sgGetValue($sgSubsLastName, $subsLastName);
@@ -621,6 +626,9 @@ $sgSuccessMessage = @sgGetValue($sgSuccessMessage, $subsSuccessMessage);
621
  $sgSubsValidateMessage = @sgGetValue($sgSubsValidateMessage, $subsValidationMessage);
622
  $sgSubsBtnProgressTitle = @sgGetValue($sgSubsBtnProgressTitle, $subsBtnProgressTitle);
623
  $sgSubsTextBorderWidth = @sgGetValue($sgSubsTextBorderWidth, $subsTextBorderWidth);
 
 
 
624
  $sgContactNameLabel = @sgGetValue($sgContactNameLabel, $contactName);
625
  $sgContactSubjectLabel = @sgGetValue($sgContactSubjectLabel, $contactSubject);
626
  $sgContactEmailLabel = @sgGetValue($sgContactEmailLabel, $contactEmail);
@@ -630,15 +638,15 @@ $sgContactSuccessMessage = @sgGetValue($sgContactSuccessMessage, $contactSuccess
630
  $sgContactInputsWidth = @sgGetValue($sgContactInputsWidth, $subsTextWidth);
631
  $sgContactInputsHeight = @sgGetValue($sgContactInputsHeight, $subsTextHeight);
632
  $sgContactInputsBorderWidth = @sgGetValue($sgContactInputsBorderWidth, $subsTextBorderWidth);
633
- $sgContactTextInputBgcolor = @sgGetValue($sgContactTextInputBgcolor, $subsTextInputBgcolor);
634
- $sgContactTextBordercolor = @sgGetValue($sgContactTextBordercolor, $subsTextBordercolor);
635
  $sgContactInputsColor = @sgGetValue($sgContactInputsColor, $subsInputsColor);
636
  $sgContactPlaceholderColor = @sgGetValue($sgContactPlaceholderColor, $subsPlaceholderColor);
637
  $sgContactBtnWidth = @sgGetValue($sgContactBtnWidth, $subsBtnWidth);
638
  $sgContactBtnHeight = @sgGetValue($sgContactBtnHeight, $subsBtnHeight);
639
  $sgContactBtnTitle = @sgGetValue($sgContactBtnTitle, $contactBtnTitle);
640
  $sgContactBtnProgressTitle = @sgGetValue($sgContactBtnProgressTitle, $subsBtnProgressTitle);
641
- $sgContactButtonBgcolor = @sgGetValue($sgContactButtonBgcolor, $subsButtonBgcolor);
642
  $sgContactButtonColor = @sgGetValue($sgContactButtonColor, $subsButtonColor);
643
  $sgContactAreaWidth = @sgGetValue($sgContactAreaWidth, $subsTextWidth);
644
  $sgContactAreaHeight = @sgGetValue($sgContactAreaHeight, '');
@@ -784,6 +792,43 @@ $postsRadio = array(
784
  )
785
  );
786
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
787
  $customPostsRadio = array(
788
  array(
789
  "title" => "Show on all custom posts:",
206
  $sgSubscriptionEmail = @$subscriptionOptions['subscription-email'];
207
  $sgSubsFirstName = @$subscriptionOptions['subs-first-name'];
208
  $sgSubsLastName = @$subscriptionOptions['subs-last-name'];
209
+ $sgSubsButtonBgColor = @$subscriptionOptions['subs-button-bgColor'];
210
  $sgSubsBtnWidth = @$subscriptionOptions['subs-btn-width'];
211
  $sgSubsBtnHeight = @$subscriptionOptions['subs-btn-height'];
212
  $sgSubsTextHeight = @$subscriptionOptions['subs-text-height'];
213
  $sgSubsBtnTitle = @$subscriptionOptions['subs-btn-title'];
214
+ $sgSubsTextInputBgColor = @$subscriptionOptions['subs-text-input-bgColor'];
215
+ $sgSubsTextBorderColor = @$subscriptionOptions['subs-text-borderColor'];
216
  $sgSubsTextWidth = @$subscriptionOptions['subs-text-width'];
217
  $sgSubsButtonColor = @$subscriptionOptions['subs-button-color'];
218
  $sgSubsInputsColor = @$subscriptionOptions['subs-inputs-color'];
221
  $sgSuccessMessage = @$subscriptionOptions['subs-success-message'];
222
  $sgSubsBtnProgressTitle = @$subscriptionOptions['subs-btn-progress-title'];
223
  $sgSubsTextBorderWidth = @$subscriptionOptions['subs-text-border-width'];
224
+ $sgSubsSuccessBehavior = @$subscriptionOptions['subs-success-behavior'];
225
+ $sgSubsSuccessRedirectUrl = @$subscriptionOptions['subs-success-redirect-url'];
226
+ $sgSubsSuccessPopupsList = @$subscriptionOptions['subs-success-popups-list'];
227
  $contactFormOptions = json_decode(@$params, true);
228
  $sgContactNameLabel = @$contactFormOptions['contact-name'];
229
  $sgContactNameStatus = @$contactFormOptions['contact-name-status'];
348
  'subscription-email' => 'Email *',
349
  'subs-first-name' => 'First name',
350
  'subs-last-name' => 'Last name',
351
+ 'subs-button-bgColor' => '#239744',
352
  'subs-button-color' => '#FFFFFF',
353
+ 'subs-text-input-bgColor' => '#FFFFFF',
354
  'subs-inputs-color' => '#000000',
355
  'subs-placeholder-color' => '#CCCCCC',
356
+ 'subs-text-borderColor' => '#CCCCCC',
357
  'subs-btn-title' => 'Subscribe',
358
  'subs-text-height' => '30px',
359
  'subs-btn-height' => '30px',
360
  'subs-text-width' => '200px',
361
  'subs-btn-width' => '200px',
 
362
  'subs-text-border-width' => '2px',
363
  'subs-success-message' =>'You have successfully subscribed to the newsletter',
364
  'subs-validation-message' => 'This field is required.',
365
  'subs-btn-progress-title' => 'Please wait...',
366
+ 'subs-success-behavior' => 'showMessage',
367
+ 'subs-success-redirect-url' => '',
368
+ 'subs-success-popups-list' => '',
369
  'contact-name' => 'Name *',
370
  'contact-name-required' => true,
371
  'contact-name-status' => true,
450
  $subscriptionEmail = $popupProDefaultValues['subscription-email'];
451
  $subsFirstName = $popupProDefaultValues['subs-first-name'];
452
  $subsLastName = $popupProDefaultValues['subs-last-name'];
453
+ $subsButtonBgColor = $popupProDefaultValues['subs-button-bgColor'];
454
  $subsButtonColor = $popupProDefaultValues['subs-button-color'];
455
  $subsInputsColor = $popupProDefaultValues['subs-inputs-color'];
456
  $subsBtnTitle = $popupProDefaultValues['subs-btn-title'];
461
  $subsValidationMessage = $popupProDefaultValues['subs-validation-message'];
462
  $subsTextWidth = $popupProDefaultValues['subs-text-width'];
463
  $subsBtnWidth = $popupProDefaultValues['subs-btn-width'];
 
464
  $subsBtnProgressTitle = $popupProDefaultValues['subs-btn-progress-title'];
465
  $subsTextBorderWidth = $popupProDefaultValues['subs-text-border-width'];
466
+ $subsTextBorderColor = $popupProDefaultValues['subs-text-borderColor'];
467
+ $subsTextInputBgColor = $popupProDefaultValues['subs-text-input-bgColor'];
468
+ $subsSuccessBehavior = $popupProDefaultValues['subs-success-behavior'];
469
+ $subsSuccessPopupsList = $popupProDefaultValues['subs-success-popups-list'];
470
+ $subsSuccessRedirectUrl = $popupProDefaultValues['subs-success-redirect-url'];
471
  $contactName = $popupProDefaultValues['contact-name'];
472
  $contactEmail = $popupProDefaultValues['contact-email'];
473
  $contactMessage = $popupProDefaultValues['contact-message'];
550
  $sgVideoAutoplay = @sgSetChecked($sgVideoAutoplay, $videoAutoplay);
551
  $sgSubsLastNameStatus = @sgSetChecked($sgSubsLastNameStatus, $subsLastNameStatus);
552
  $sgSubsFirstNameStatus = @sgSetChecked($sgSubsFirstNameStatus, $subsFirstNameStatus);
 
553
  $sgCountryStatus = @sgSetChecked($sgCountryStatus, $countryStatus);
554
  /* Contact popup otions */
555
  $sgContactNameStatus = @sgSetChecked($sgContactNameStatus, $contactNameStatus);
610
  $sgExitIntntExpire = @sgGetValue($sgExitIntntExpire, $exitIntentExpireTime);
611
  $sgSubsTextWidth = @sgGetValue($sgSubsTextWidth, $subsTextWidth);
612
  $sgSubsBtnWidth = @sgGetValue($sgSubsBtnWidth, $subsBtnWidth);
613
+ $sgSubsTextInputBgColor = @sgGetValue($sgSubsTextInputBgColor, $subsTextInputBgColor);
614
+ $sgSubsButtonBgColor = @sgGetValue($sgSubsButtonBgColor, $subsButtonBgColor);
615
+ $sgSubsTextBorderColor = @sgGetValue($sgSubsTextBorderColor, $subsTextBorderColor);
616
  $sgSubscriptionEmail = @sgGetValue($sgSubscriptionEmail, $subscriptionEmail);
617
  $sgSubsFirstName = @sgGetValue($sgSubsFirstName, $subsFirstName);
618
  $sgSubsLastName = @sgGetValue($sgSubsLastName, $subsLastName);
626
  $sgSubsValidateMessage = @sgGetValue($sgSubsValidateMessage, $subsValidationMessage);
627
  $sgSubsBtnProgressTitle = @sgGetValue($sgSubsBtnProgressTitle, $subsBtnProgressTitle);
628
  $sgSubsTextBorderWidth = @sgGetValue($sgSubsTextBorderWidth, $subsTextBorderWidth);
629
+ $sgSubsSuccessBehavior = @sgGetValue($sgSubsSuccessBehavior, $subsSuccessBehavior);
630
+ $sgSubsSuccessRedirectUrl = @sgGetValue($sgSubsSuccessRedirectUrl, $subsSuccessRedirectUrl);
631
+ $sgSubsSuccessPopupsList = @sgGetValue($sgSubsSuccessPopupsList, $subsSuccessPopupsList);
632
  $sgContactNameLabel = @sgGetValue($sgContactNameLabel, $contactName);
633
  $sgContactSubjectLabel = @sgGetValue($sgContactSubjectLabel, $contactSubject);
634
  $sgContactEmailLabel = @sgGetValue($sgContactEmailLabel, $contactEmail);
638
  $sgContactInputsWidth = @sgGetValue($sgContactInputsWidth, $subsTextWidth);
639
  $sgContactInputsHeight = @sgGetValue($sgContactInputsHeight, $subsTextHeight);
640
  $sgContactInputsBorderWidth = @sgGetValue($sgContactInputsBorderWidth, $subsTextBorderWidth);
641
+ $sgContactTextInputBgcolor = @sgGetValue($sgContactTextInputBgcolor, $subsTextInputBgColor);
642
+ $sgContactTextBordercolor = @sgGetValue($sgContactTextBordercolor, $subsTextBorderColor);
643
  $sgContactInputsColor = @sgGetValue($sgContactInputsColor, $subsInputsColor);
644
  $sgContactPlaceholderColor = @sgGetValue($sgContactPlaceholderColor, $subsPlaceholderColor);
645
  $sgContactBtnWidth = @sgGetValue($sgContactBtnWidth, $subsBtnWidth);
646
  $sgContactBtnHeight = @sgGetValue($sgContactBtnHeight, $subsBtnHeight);
647
  $sgContactBtnTitle = @sgGetValue($sgContactBtnTitle, $contactBtnTitle);
648
  $sgContactBtnProgressTitle = @sgGetValue($sgContactBtnProgressTitle, $subsBtnProgressTitle);
649
+ $sgContactButtonBgcolor = @sgGetValue($sgContactButtonBgcolor, $subsButtonBgColor);
650
  $sgContactButtonColor = @sgGetValue($sgContactButtonColor, $subsButtonColor);
651
  $sgContactAreaWidth = @sgGetValue($sgContactAreaWidth, $subsTextWidth);
652
  $sgContactAreaHeight = @sgGetValue($sgContactAreaHeight, '');
792
  )
793
  );
794
 
795
+ $subsSuccessBehavior = array(
796
+ array(
797
+ "title" => "Show success message:",
798
+ "value" => "showMessage",
799
+ "info" => "",
800
+ "data-attributes" => array(
801
+ "class" => "js-subs-success-message"
802
+ )
803
+
804
+ ),
805
+ array(
806
+ "title" => "Redirect to url:",
807
+ "value" => "redirectToUrl",
808
+ "info" => "",
809
+ "data-attributes" => array(
810
+ "class" => "js-subs-success-redirect"
811
+ )
812
+
813
+ ),
814
+ array(
815
+ "title" => "Open popup",
816
+ "value" => "openPopup",
817
+ "info" => "",
818
+ "data-attributes" => array(
819
+ "class" => "js-subs-success-redirect"
820
+ )
821
+ ),
822
+ array(
823
+ "title" => "Hide popup",
824
+ "value" => "hidePopup",
825
+ "info" => "",
826
+ "data-attributes" => array(
827
+ "class" => ""
828
+ )
829
+ )
830
+ );
831
+
832
  $customPostsRadio = array(
833
  array(
834
  "title" => "Show on all custom posts:",
files/sg_popup_save.php CHANGED
@@ -120,11 +120,11 @@ function sgPopupSave()
120
  'subs-first-name' => sgSanitize('subs-first-name'),
121
  'subs-last-name' => sgSanitize('subs-last-name'),
122
  'subs-text-width' => sgSanitize('subs-text-width'),
123
- 'subs-button-bgcolor' => sgSanitize('subs-button-bgcolor'),
124
  'subs-btn-width' => sgSanitize('subs-btn-width'),
125
  'subs-btn-title' => sgSanitize('subs-btn-title'),
126
- 'subs-text-input-bgcolor' => sgSanitize('subs-text-input-bgcolor'),
127
- 'subs-text-bordercolor' => sgSanitize('subs-text-bordercolor'),
128
  'subs-button-color' => sgSanitize('subs-button-color'),
129
  'subs-inputs-color' => sgSanitize('subs-inputs-color'),
130
  'subs-btn-height' => sgSanitize('subs-btn-height'),
@@ -134,7 +134,9 @@ function sgPopupSave()
134
  'subs-success-message' => sgSanitize('subs-success-message'),
135
  'subs-btn-progress-title' => sgSanitize('subs-btn-progress-title'),
136
  'subs-text-border-width' => sgSanitize('subs-text-border-width'),
137
- 'subs-dont-show-after-submitting' => sgSanitize('subs-dont-show-after-submitting')
 
 
138
  );
139
 
140
  $contactFormOptions = array(
120
  'subs-first-name' => sgSanitize('subs-first-name'),
121
  'subs-last-name' => sgSanitize('subs-last-name'),
122
  'subs-text-width' => sgSanitize('subs-text-width'),
123
+ 'subs-button-bgColor' => sgSanitize('subs-button-bgColor'),
124
  'subs-btn-width' => sgSanitize('subs-btn-width'),
125
  'subs-btn-title' => sgSanitize('subs-btn-title'),
126
+ 'subs-text-input-bgColor' => sgSanitize('subs-text-input-bgColor'),
127
+ 'subs-text-borderColor' => sgSanitize('subs-text-borderColor'),
128
  'subs-button-color' => sgSanitize('subs-button-color'),
129
  'subs-inputs-color' => sgSanitize('subs-inputs-color'),
130
  'subs-btn-height' => sgSanitize('subs-btn-height'),
134
  'subs-success-message' => sgSanitize('subs-success-message'),
135
  'subs-btn-progress-title' => sgSanitize('subs-btn-progress-title'),
136
  'subs-text-border-width' => sgSanitize('subs-text-border-width'),
137
+ 'subs-success-behavior' => sgSanitize('subs-success-behavior'),
138
+ 'subs-success-redirect-url' => sgSanitize('subs-success-redirect-url'),
139
+ 'subs-success-popups-list' => sgSanitize('subs-success-popups-list')
140
  );
141
 
142
  $contactFormOptions = array(
helpers/SgPopupGetData.php CHANGED
@@ -113,10 +113,38 @@ class SgPopupGetData {
113
  }
114
 
115
  public static function getCurrentUserRole() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  global $current_user, $wpdb;
117
- $role = $wpdb->prefix . 'capabilities';
118
- $current_user->role = array_keys($current_user->$role);
119
- $role = $current_user->role[0];
 
 
 
 
120
  return "sgpb_".$role;
121
  }
122
 
113
  }
114
 
115
  public static function getCurrentUserRole() {
116
+
117
+ $role = 'administrator';
118
+
119
+ if(is_multisite()) {
120
+
121
+ $getUsersObj = get_users(
122
+ array(
123
+ 'blog_id' => get_current_blog_id()
124
+ )
125
+ );
126
+ if(is_array($getUsersObj)) {
127
+ foreach ($getUsersObj as $key => $userData) {
128
+ if($userData->ID == get_current_user_id()) {
129
+ $roles = $userData->roles;
130
+ if(is_array($roles) && !empty($roles)) {
131
+ $role = $roles[0];
132
+ }
133
+ }
134
+ }
135
+ }
136
+
137
+ return "sgpb_".$role;
138
+ }
139
+
140
  global $current_user, $wpdb;
141
+ $userRoleKey = $wpdb->prefix . 'capabilities';
142
+ $usersRoles = array_keys($current_user->$userRoleKey);
143
+
144
+ if(is_array($usersRoles) && !empty($usersRoles)) {
145
+ $role = $usersRoles[0];
146
+ }
147
+
148
  return "sgpb_".$role;
149
  }
150
 
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.titleNotEmpty(); /* Check title is Empty */
20
  this.showThemePicture(); /* Show themes pictures */
21
  this.showEffects(); /* Show effect type */
22
  this.pageAcordion(); /* For page acordion divs */
23
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
24
  this.showInfo(); /* Show description options */
25
  this.opasictyRange(); /* Opcity range */
26
  this.subOptionContents();
27
  this.addCountries();
28
  this.showCloseTextFieldForTheme();
29
  this.popupReview();
30
  this.colorPicekr(); /* Color picker */
31
  this.switchPopupActive();
32
  });
33
  jQuery('.sg-info-close').on('click', function() {
34
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
35
  });
36
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
37
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
38
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
39
  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
+ jQuery(document).ready(function($){
19
  this.titleNotEmpty(); /* Check title is Empty */
20
  this.showThemePicture(); /* Show themes pictures */
21
  this.showEffects(); /* Show effect type */
22
  this.pageAcordion(); /* For page acordion divs */
23
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
24
  this.showInfo(); /* Show description options */
25
  this.opasictyRange(); /* Opcity range */
26
  this.subOptionContents();
27
  this.addCountries();
28
  this.showCloseTextFieldForTheme();
29
  this.popupReview();
30
  this.colorPicekr(); /* Color picker */
31
  this.switchPopupActive();
32
  });
33
  jQuery('.sg-info-close').on('click', function() {
34
  jQuery( ".sg-info-panel-wrapper" ).hide(300);
35
  });
36
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"showMessage", jQuery('.js-subs-success-message-content'));
37
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"redirectToUrl", jQuery('.js-subs-success-redirect-content'));
38
  this.radioButtonAcordion(jQuery("[name='subs-success-behavior']"),jQuery("[name='subs-success-behavior']:checked"),"openPopup", jQuery('.js-subs-success-popups-list-content'));
39
  checkedElement.after(toggleContnet.css({'display':'inline-block'}));
javascript/sg_popup_frontend.js CHANGED
@@ -33,7 +33,7 @@ SGPopup.prototype.popupOpenById = function(popupId) {
33
  else {
34
  sgPoupFrontendObj.showPopup(popupId,true);
35
  }
36
- }
37
 
38
  SGPopup.getCookie = function(cname) {
39
  var name = cname + "=";
@@ -48,7 +48,7 @@ SGPopup.getCookie = function(cname) {
48
  }
49
  }
50
  return "";
51
- }
52
 
53
  SGPopup.setCookie = function(cname, cvalue, exdays) {
54
 
@@ -60,7 +60,7 @@ SGPopup.setCookie = function(cname, cvalue, 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;
@@ -96,7 +96,7 @@ SGPopup.prototype.init = function() {
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();
@@ -105,10 +105,17 @@ SGPopup.prototype.init = function() {
105
  var sgPopupId = that.findPopupIdFromClassNames(className, "sg-iframe-popup-");
106
 
107
  /*This update for dynamic open iframe url for same popup*/
108
- SG_POPUP_DATA[sgPopupId]['iframe'] = currentLink.attr("href");
 
 
 
 
 
 
 
109
 
110
  that.showPopup(sgPopupId,false);
111
- })
112
  });
113
 
114
  jQuery("[class*='sg-confirm-popup-']").each(function() {
@@ -137,7 +144,7 @@ SGPopup.prototype.init = function() {
137
  that.showPopup(sgPopupId,false);
138
  })
139
  });
140
- }
141
 
142
  SGPopup.prototype.popupOpenByCookie = function() {
143
 
@@ -147,7 +154,7 @@ SGPopup.prototype.popupOpenByCookie = function() {
147
  if(typeof popupId == 'number') {
148
  this.showPopup(popupId,false);
149
  }
150
- }
151
 
152
  SGPopup.prototype.findPopupIdFromClassNames = function(className, classKey) {
153
 
@@ -157,7 +164,7 @@ SGPopup.prototype.findPopupIdFromClassNames = function(className, classKey) {
157
  var popupId = classIdString.match(/^\d+/);
158
 
159
  return popupId;
160
- }
161
 
162
  SGPopup.prototype.sgCustomizeThemes = function(popupId) {
163
 
@@ -171,7 +178,7 @@ SGPopup.prototype.sgCustomizeThemes = function(popupId) {
171
  jQuery("#sgcboxLoadedContent").css({'border-radius': borderRadiues+"%"})
172
  jQuery("#sgcboxContent").css({'border-radius': borderRadiues+"%"})
173
  }
174
- }
175
 
176
  SGPopup.prototype.onCompleate = function() {
177
 
@@ -181,7 +188,7 @@ SGPopup.prototype.onCompleate = function() {
181
  jQuery('#sgcboxLoadedContent').isolatedScroll();
182
  });
183
  this.isolatedScroll();
184
- }
185
 
186
  SGPopup.prototype.isolatedScroll = function() {
187
 
@@ -197,7 +204,7 @@ SGPopup.prototype.isolatedScroll = function() {
197
  });
198
  return this;
199
  };
200
- }
201
 
202
  SGPopup.prototype.sgPopupScalingDimensions = function() {
203
  var popupWrapper = jQuery("#sgcboxWrapper").outerWidth();
@@ -208,7 +215,7 @@ SGPopup.prototype.sgPopupScalingDimensions = function() {
208
  jQuery("#sgcboxWrapper").css({
209
  "transform-origin" : "0 0 !important",
210
  'transform': "scale("+scaleDegree+", 1)"
211
- })
212
  popupWrapper = 0;
213
  }
214
  else {
@@ -217,7 +224,7 @@ SGPopup.prototype.sgPopupScalingDimensions = function() {
217
  'transform': "scale(1, 1)"
218
  })
219
  }
220
- }
221
 
222
  SGPopup.prototype.sgPopupScaling = function() {
223
  var that = this;
@@ -227,12 +234,12 @@ SGPopup.prototype.sgPopupScaling = function() {
227
  jQuery(window).resize(function() {
228
  setTimeout(function(){ that.sgPopupScalingDimensions(); }, 1000);
229
  });
230
- }
231
 
232
  SGPopup.prototype.varToBool = function(optionName) {
233
  returnValue = (optionName) ? true : false;
234
  return returnValue;
235
- }
236
 
237
  SGPopup.prototype.canOpenPopup = function(id, openOnce, isOnLoad) {
238
  if (!isOnLoad) {
@@ -250,7 +257,7 @@ SGPopup.prototype.canOpenPopup = function(id, openOnce, isOnLoad) {
250
  }
251
 
252
  return true;
253
- }
254
 
255
  SGPopup.prototype.setFixedPosition = function(sgPositionLeft, sgPositionTop, sgPositionBottom, sgPositionRight, sgFixedPositionTop, sgFixedPositionLeft) {
256
  this.positionLeft = sgPositionLeft;
@@ -259,17 +266,17 @@ SGPopup.prototype.setFixedPosition = function(sgPositionLeft, sgPositionTop, sgP
259
  this.positionRight = sgPositionRight;
260
  this.initialPositionTop = sgFixedPositionTop;
261
  this.initialPositionLeft = sgFixedPositionLeft;
262
- }
263
 
264
  SGPopup.prototype.percentToPx = function(percentDimention, screenDimension) {
265
  var dimension = parseInt(percentDimention)*screenDimension/100;
266
  return dimension;
267
- }
268
 
269
  SGPopup.prototype.getPositionPercent = function(needPercent, screenDimension, dimension) {
270
  var sgPosition = (((this.percentToPx(needPercent,screenDimension)-dimension/2)/screenDimension)*100)+"%";
271
  return sgPosition;
272
- }
273
 
274
  SGPopup.prototype.showPopup = function(id, isOnLoad) {
275
  var that = this;
@@ -309,7 +316,7 @@ SGPopup.prototype.showPopup = function(id, isOnLoad) {
309
  that.sgShowColorboxWithOptions();
310
  });
311
  setTimeout(function(){img.src = popupColorboxUrl;},0);
312
- }
313
 
314
  SGPopup.prototype.sgShowColorboxWithOptions = function() {
315
  var that = this;
@@ -577,7 +584,7 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
577
  'popupId': that.popupData['id'],
578
  'openCounter': openCounter,
579
  'openLimit': that.numberLimit
580
- }
581
  jQuery.cookie("sgPopupDetails"+that.popupData['id'],JSON.stringify(sgCookieData), { expires: onceExpiresTime});
582
  }
583
 
@@ -616,7 +623,7 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
616
  });
617
 
618
  },this.popupData['delay']*1000);
619
- }
620
 
621
  jQuery(document).ready(function($) {
622
  var popupObj = new SGPopup();
33
  else {
34
  sgPoupFrontendObj.showPopup(popupId,true);
35
  }
36
+ };
37
 
38
  SGPopup.getCookie = function(cname) {
39
  var name = cname + "=";
48
  }
49
  }
50
  return "";
51
+ };
52
 
53
  SGPopup.setCookie = function(cname, cvalue, exdays) {
54
 
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;
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();
105
  var sgPopupId = that.findPopupIdFromClassNames(className, "sg-iframe-popup-");
106
 
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() {
144
  that.showPopup(sgPopupId,false);
145
  })
146
  });
147
+ };
148
 
149
  SGPopup.prototype.popupOpenByCookie = function() {
150
 
154
  if(typeof popupId == 'number') {
155
  this.showPopup(popupId,false);
156
  }
157
+ };
158
 
159
  SGPopup.prototype.findPopupIdFromClassNames = function(className, classKey) {
160
 
164
  var popupId = classIdString.match(/^\d+/);
165
 
166
  return popupId;
167
+ };
168
 
169
  SGPopup.prototype.sgCustomizeThemes = function(popupId) {
170
 
178
  jQuery("#sgcboxLoadedContent").css({'border-radius': borderRadiues+"%"})
179
  jQuery("#sgcboxContent").css({'border-radius': borderRadiues+"%"})
180
  }
181
+ };
182
 
183
  SGPopup.prototype.onCompleate = function() {
184
 
188
  jQuery('#sgcboxLoadedContent').isolatedScroll();
189
  });
190
  this.isolatedScroll();
191
+ };
192
 
193
  SGPopup.prototype.isolatedScroll = function() {
194
 
204
  });
205
  return this;
206
  };
207
+ };
208
 
209
  SGPopup.prototype.sgPopupScalingDimensions = function() {
210
  var popupWrapper = jQuery("#sgcboxWrapper").outerWidth();
215
  jQuery("#sgcboxWrapper").css({
216
  "transform-origin" : "0 0 !important",
217
  'transform': "scale("+scaleDegree+", 1)"
218
+ });
219
  popupWrapper = 0;
220
  }
221
  else {
224
  'transform': "scale(1, 1)"
225
  })
226
  }
227
+ };
228
 
229
  SGPopup.prototype.sgPopupScaling = function() {
230
  var that = this;
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) {
257
  }
258
 
259
  return true;
260
+ };
261
 
262
  SGPopup.prototype.setFixedPosition = function(sgPositionLeft, sgPositionTop, sgPositionBottom, sgPositionRight, sgFixedPositionTop, sgFixedPositionLeft) {
263
  this.positionLeft = sgPositionLeft;
266
  this.positionRight = sgPositionRight;
267
  this.initialPositionTop = sgFixedPositionTop;
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;
316
  that.sgShowColorboxWithOptions();
317
  });
318
  setTimeout(function(){img.src = popupColorboxUrl;},0);
319
+ };
320
 
321
  SGPopup.prototype.sgShowColorboxWithOptions = function() {
322
  var that = this;
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
 
623
  });
624
 
625
  },this.popupData['delay']*1000);
626
+ };
627
 
628
  jQuery(document).ready(function($) {
629
  var popupObj = new SGPopup();
javascript/sg_popup_init.js CHANGED
@@ -20,7 +20,7 @@ SgPopupInit.prototype.cloneToHtmlPopup = function() {
20
  });
21
 
22
  this.shortcodeInPopupContent();
23
- }
24
 
25
  SgPopupInit.prototype.reopenPopupAfterSubmission = function() {
26
 
@@ -34,7 +34,7 @@ SgPopupInit.prototype.reopenPopupAfterSubmission = function() {
34
  SGPopup.setCookie('sgSubmitReloadingForm', currentPopupId);
35
  });
36
  }
37
- }
38
 
39
  SgPopupInit.prototype.popupResizing = function(currentPopupId) {
40
 
@@ -46,7 +46,7 @@ SgPopupInit.prototype.popupResizing = function(currentPopupId) {
46
  if(maxWidth == '' && maxHeight == '') {
47
  jQuery.sgcolorbox.resize({'width': width, 'height': height});
48
  }
49
- }
50
 
51
  SgPopupInit.prototype.shortcodeInPopupContent = function() {
52
 
@@ -69,7 +69,7 @@ SgPopupInit.prototype.shortcodeInPopupContent = function() {
69
  sgPopupID = '';
70
  });
71
  });
72
- }
73
 
74
  SgPopupInit.prototype.overallInit = function() {
75
  jQuery('.sg-popup-close').bind('click', function() {
@@ -80,7 +80,7 @@ SgPopupInit.prototype.overallInit = function() {
80
  if(jQuery('#sg-facebook-like').length && typeof FB !== 'undefined') {
81
  FB.XFBML.parse();
82
  }
83
- }
84
 
85
  SgPopupInit.prototype.initByPopupType = function() {
86
  var data = this.popupData;
@@ -113,4 +113,4 @@ SgPopupInit.prototype.initByPopupType = function() {
113
  }
114
 
115
  return popupObj;
116
- }
20
  });
21
 
22
  this.shortcodeInPopupContent();
23
+ };
24
 
25
  SgPopupInit.prototype.reopenPopupAfterSubmission = function() {
26
 
34
  SGPopup.setCookie('sgSubmitReloadingForm', currentPopupId);
35
  });
36
  }
37
+ };
38
 
39
  SgPopupInit.prototype.popupResizing = function(currentPopupId) {
40
 
46
  if(maxWidth == '' && maxHeight == '') {
47
  jQuery.sgcolorbox.resize({'width': width, 'height': height});
48
  }
49
+ };
50
 
51
  SgPopupInit.prototype.shortcodeInPopupContent = function() {
52
 
69
  sgPopupID = '';
70
  });
71
  });
72
+ };
73
 
74
  SgPopupInit.prototype.overallInit = function() {
75
  jQuery('.sg-popup-close').bind('click', function() {
80
  if(jQuery('#sg-facebook-like').length && typeof FB !== 'undefined') {
81
  FB.XFBML.parse();
82
  }
83
+ };
84
 
85
  SgPopupInit.prototype.initByPopupType = function() {
86
  var data = this.popupData;
113
  }
114
 
115
  return popupObj;
116
+ };
popup-builder.php CHANGED
@@ -3,7 +3,7 @@
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.8
7
  * Author: Sygnoos
8
  * Author URI: http://www.sygnoos.com
9
  * License: GPLv2
@@ -16,6 +16,7 @@ require_once(SG_APP_POPUP_CLASSES .'/SGPopupBuilderMain.php');
16
  $mainPopupObj = new SGPopupBuilderMain();
17
  $mainPopupObj->init();
18
 
 
19
  require_once(SG_APP_POPUP_CLASSES .'/SGPopup.php');
20
  require_once(SG_APP_POPUP_CLASSES .'/SGPBExtension.php');
21
  require_once(SG_APP_POPUP_FILES .'/sg_functions.php');
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
16
  $mainPopupObj = new SGPopupBuilderMain();
17
  $mainPopupObj->init();
18
 
19
+ require_once(SG_APP_POPUP_CLASSES .'/SgRegistry.php');
20
  require_once(SG_APP_POPUP_CLASSES .'/SGPopup.php');
21
  require_once(SG_APP_POPUP_CLASSES .'/SGPBExtension.php');
22
  require_once(SG_APP_POPUP_FILES .'/sg_functions.php');
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
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -81,7 +81,9 @@ With popup builder plugin you can insert any type of content, right into your Po
81
 
82
  * Create contact form popup - contact popup will allow your clients to write you a message right from the popup.
83
 
84
- * Mailchimp popup - create eye-catching, beautiful MailChimp popups to make your users sign up to the mail list right from the popup. You can set up all the design customization according to your needs and preferences!
 
 
85
 
86
  * Show popup only when user is scrolling - sometimes you don't want to show the popup right away, it's a good idea to set this option so the popup will be shown to the visitor only when he scrolls.
87
 
@@ -155,6 +157,15 @@ Go to the Popup Builder settings and set your desired options.
155
 
156
  == Changelog ==
157
 
 
 
 
 
 
 
 
 
 
158
  = Version 2.4.8 =
159
  * Bug fixed connected to extensions manager.
160
 
@@ -425,6 +436,15 @@ Simply add the following class to it: sg-confirm-popup-#popupid.
425
  Ex. `<a href="https://sygnoos.com/" class="sg-confirm-popup-1">Popup</a>`
426
  This will open a popup before a user goes to the page from the link.
427
 
 
 
 
 
 
 
 
 
 
428
  **Want to open your links inside the popup without redirecting your users to the other site? (PRO)**
429
 
430
  You can simply create an empty iframe popup and add the following class to your link: sg-iframe-popup-#popupid number.
@@ -530,6 +550,7 @@ You can select "Use active URL" and the current page URL will be shared.
530
  The Free version of Popup Builder gives you anything you need for creating unlimited fully functional popups and insert them wherever you want. Our PRO package gives you the ability to create more specific popups, like iframe, video or shortcode popups. Also, advanced options will be available for you to disable popup closing, disable popup for mobile devices, show the popup only once, and many other features. So if you need these advanced popups and functionalities, get Popup Builder PRO <a href="http://popup-builder.com">here</a>.
531
 
532
  **How to upgrade to PRO version without losing popup's data?**
 
533
  We made it very easy for you! All you need to do is:
534
 
535
  * In your Menu sidebar, go to Popup -> "Settings" section.
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
81
 
82
  * Create contact form popup - contact popup will allow your clients to write you a message right from the popup.
83
 
84
+ * MailChimp popup - create eye-catching, beautiful MailChimp popups to make your users sign up to the mail list right from the popup. You can set up all the design customization according to your needs and preferences!
85
+
86
+ * Adblock popup - Detect Adblock extensions that block the advertisements of your site and show a message to your visitors via popup!
87
 
88
  * Show popup only when user is scrolling - sometimes you don't want to show the popup right away, it's a good idea to set this option so the popup will be shown to the visitor only when he scrolls.
89
 
157
 
158
  == Changelog ==
159
 
160
+ = Version 2.4.9 =
161
+ * New extensions added.
162
+ * Subscription popup improvements.
163
+ * Shortcode popup improvements.
164
+ * Compatibility with WP Network > 4.6.
165
+ * User role improvement for WP Network.
166
+ * JS optimization for Cache plugins.
167
+ * Code improvement and optimization.
168
+
169
  = Version 2.4.8 =
170
  * Bug fixed connected to extensions manager.
171
 
436
  Ex. `<a href="https://sygnoos.com/" class="sg-confirm-popup-1">Popup</a>`
437
  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?**
445
+
446
+ Under the Effects panel you will see 'Popup opening delay' option, all you need to do is to enter the amount of time (seconds) after which popup will be shown.
447
+
448
  **Want to open your links inside the popup without redirecting your users to the other site? (PRO)**
449
 
450
  You can simply create an empty iframe popup and add the following class to your link: sg-iframe-popup-#popupid number.
550
  The Free version of Popup Builder gives you anything you need for creating unlimited fully functional popups and insert them wherever you want. Our PRO package gives you the ability to create more specific popups, like iframe, video or shortcode popups. Also, advanced options will be available for you to disable popup closing, disable popup for mobile devices, show the popup only once, and many other features. So if you need these advanced popups and functionalities, get Popup Builder PRO <a href="http://popup-builder.com">here</a>.
551
 
552
  **How to upgrade to PRO version without losing popup's data?**
553
+
554
  We made it very easy for you! All you need to do is:
555
 
556
  * In your Menu sidebar, go to Popup -> "Settings" section.
style/sg_popup_style.css CHANGED
@@ -975,7 +975,8 @@ input[name="theme"] {
975
  display: none;
976
  }
977
 
978
- .acordion-main-div-content {
 
979
  width: 100%;
980
  display: none;
981
  }
975
  display: none;
976
  }
977
 
978
+ .acordion-main-div-content,
979
+ .sg-accordion-content {
980
  width: 100%;
981
  display: none;
982
  }