Popup Builder – Responsive WordPress Pop up - Version 2.4.7

Version Description

Current Version of Popup Builder is 2.4.7

Download this release

Release Info

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

Code changes from version 2.4.6 to 2.4.7

classes/PopupInstaller.php CHANGED
@@ -49,6 +49,16 @@ class PopupInstaller
49
  PRIMARY KEY (id)
50
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
51
 
 
 
 
 
 
 
 
 
 
 
52
  $wpdb->query($sgPopupBase);
53
  $wpdb->query($sgPopupSettingsBase);
54
  $wpdb->query($sgPopupInsertSettingsSql);
@@ -57,6 +67,10 @@ class PopupInstaller
57
  $wpdb->query($sgPopupFblikeBase);
58
  $wpdb->query($sgPopupShortcodeBase);
59
  $wpdb->query($sgPopupAddon);
 
 
 
 
60
  }
61
 
62
  public static function install()
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,
56
+ `content` TEXT NOT NULL,
57
+ `extensionType` varchar(255) NOT NULL,
58
+ `options` TEXT NOT NULL,
59
+ PRIMARY KEY (id)
60
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
61
+
62
  $wpdb->query($sgPopupBase);
63
  $wpdb->query($sgPopupSettingsBase);
64
  $wpdb->query($sgPopupInsertSettingsSql);
67
  $wpdb->query($sgPopupFblikeBase);
68
  $wpdb->query($sgPopupShortcodeBase);
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()
classes/SGPBExtension.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class SGPBExtension {
3
+
4
+ const SGPB_ADDON_TABLE_NAME = 'sg_popup_addons';
5
+ const SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME = 'sg_popup_addons_connection';
6
+
7
+ private $params = array();
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
19
+ *
20
+ * @return void
21
+ *
22
+ */
23
+ public function __call($name, $args) {
24
+
25
+ $methodPrefix = substr($name, 0, 3);
26
+ $methodProperty = lcfirst(substr($name,3));
27
+
28
+ if ($methodPrefix=='get') {
29
+ return $this->$methodProperty;
30
+ }
31
+ else if ($methodPrefix=='set') {
32
+ $this->$methodProperty = $args[0];
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Create Extension tables
38
+ *
39
+ * @since 2.4.7
40
+ *
41
+ * @param int $blogsId
42
+ *
43
+ * @return void
44
+ *
45
+ */
46
+ public static function createExtensionTables($blogsId) {
47
+
48
+ global $wpdb;
49
+
50
+ $sgPopupAddon = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId.SGPBExtension::SGPB_ADDON_TABLE_NAME." (
51
+ `id` int(11) NOT NULL AUTO_INCREMENT,
52
+ `name` varchar(255) NOT NULL UNIQUE,
53
+ `paths` TEXT NOT NULL,
54
+ `type` varchar(255) NOT NULL,
55
+ `options` TEXT NOT NULL,
56
+ `isEvent` TINYINT UNSIGNED NOT NULL,
57
+ PRIMARY KEY (id)
58
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
59
+
60
+ $extensionDataTable = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId.SGPBExtension::SGPB_ADDON_POPUP_CONNECTION_TABLE_NAME." (
61
+ `id` int(11) NOT NULL AUTO_INCREMENT,
62
+ `popupId` int(11) NOT NULL,
63
+ `extensionKey` TEXT NOT NULL,
64
+ `content` TEXT NOT NULL,
65
+ `extensionType` varchar(255) NOT NULL,
66
+ `options` TEXT NOT NULL,
67
+ PRIMARY KEY (id)
68
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
69
+
70
+ $columInfo = $wpdb->query("SHOW COLUMNS FROM ".$wpdb->prefix.$blogsId.SGPBExtension::SGPB_ADDON_TABLE_NAME." LIKE 'isEvent'");
71
+
72
+ if(!$columInfo) {
73
+ $alterQuery = "ALTER TABLE ".$wpdb->prefix.$blogsId.SGPBExtension::SGPB_ADDON_TABLE_NAME." ADD isEvent TINYINT UNSIGNED NOT NULL";
74
+ $wpdb->query($alterQuery);
75
+ }
76
+
77
+ $wpdb->query($sgPopupAddon);
78
+ $wpdb->query($extensionDataTable);
79
+ }
80
+
81
+ /**
82
+ * Popup extensions Saved option
83
+ *
84
+ * @since 2.4.7
85
+ *
86
+ * @param int $popupId
87
+ * @param string $extensionKey
88
+ *
89
+ * @return bool if does not exists data and Object when have saved data
90
+ *
91
+ */
92
+ public static function getSavedOptions($popupId, $extensionKey) {
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*/
100
+ if(empty($savedData)) {
101
+ return false;
102
+ }
103
+
104
+ return $savedData;
105
+ }
106
+
107
+ /**
108
+ * Exists extension options
109
+ *
110
+ * @since 2.4.6
111
+ *
112
+ * @param int $popupId
113
+ * @param string $extensionKey
114
+ *
115
+ * @return bool if doens not exists data and Object when have saved data
116
+ *
117
+ */
118
+ private function isExistOptionData($popupId, $extensionKey) {
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'];
126
+ }
127
+
128
+ public function save() {
129
+
130
+ $popupId = $this->getPopupId();
131
+ $popupContent = $this->getExtensionContent();
132
+ $extensionOptions = $this->getExtensionOptions();
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);
141
+
142
+ global $wpdb;
143
+
144
+ if($saveMode == 0) {
145
+ $data = array(
146
+ 'popupId'=> $popupId,
147
+ 'extensionKey'=> $extensionKey,
148
+ 'content'=> $popupContent,
149
+ 'extensionType'=> $extensionType,
150
+ 'options'=> $extensionOptions,
151
+ );
152
+ $formats = array('%d', '%s', '%s', '%s', '%s');
153
+ $wpdb->insert($wpdb->prefix.$extensionConnectionTable, $data, $formats);
154
+
155
+ }
156
+ else {
157
+ $data = array(
158
+ 'content'=> $popupContent,
159
+ 'options'=> $extensionOptions,
160
+ );
161
+ $formats = array('%s', '%s');
162
+ $whereFormat = array('%d', '%s');
163
+ $where = array(
164
+ 'popupId'=> $popupId,
165
+ 'extensionKey'=> $extensionKey,
166
+ );
167
+
168
+ $wpdb->update($wpdb->prefix.$extensionConnectionTable, $data, $where, $formats, $whereFormat);
169
+ }
170
+
171
+ return $data;
172
+ }
173
+
174
+ public function deleteOption() {
175
+
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);
183
+
184
+ $wpdb->delete($wpdb->prefix.$extensionConnectionTable, $deleteCondition, array('%d', '%s'));
185
+ }
186
+
187
+ public static function deletePopupFromConnectionById($popupId) {
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
+ }
195
+
196
+ public static function getExtensionsOptions($popupId, $type = 'option') {
197
+
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)) {
205
+ return $extensionData;
206
+ }
207
+
208
+ foreach($extensionOptions as $extension) {
209
+ $extensionData[$extension['extensionKey']] = json_decode($extension['options'], true);
210
+ }
211
+
212
+ return $extensionData;
213
+ }
214
+
215
+ public static function getPopupSavedExtensionsKeys($popupId) {
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;
223
+ }
224
+
225
+ public static function hasPopupEvent($popupId) {
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
+
233
+ return $count;
234
+ }
235
+
236
+ }
classes/SGPBExtensionManager.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SGPBExtensionManager {
3
+
4
+ private $managerParams = array();
5
+ private $extensionKey;
6
+ private $postData;
7
+ private $savedOptions;
8
+ private $optionsDefaultValues;
9
+
10
+ public function __call($name, $args) {
11
+
12
+ $methodPrefix = substr($name, 0, 3);
13
+ $methodProperty = lcfirst(substr($name,3));
14
+
15
+ if ($methodPrefix=='get') {
16
+ return $this->$methodProperty;
17
+ }
18
+ else if ($methodPrefix=='set') {
19
+ $this->$methodProperty = $args[0];
20
+ }
21
+ }
22
+
23
+ public function save() {
24
+
25
+ $this->extensionsSave();
26
+ }
27
+
28
+ public function sgBoolToChecked($var) {
29
+ return ($var?'checked':'');
30
+ }
31
+
32
+ public function getExtensionsData($type = '') {
33
+
34
+ global $wpdb;
35
+ $paths = array();
36
+ $where = '';
37
+
38
+ if($type != '') {
39
+ $where = ' WHERE type="'.$type.'"';
40
+ }
41
+
42
+ $prepareSql = "SELECT * FROM ". $wpdb->prefix .SGPBExtension::SGPB_ADDON_TABLE_NAME.$where;
43
+ $results = $wpdb->get_results($prepareSql, ARRAY_A);
44
+
45
+ if(empty($results)) {
46
+ return $paths;
47
+ }
48
+
49
+ foreach ($results as $key => $value) {
50
+
51
+ $extensionPaths = json_decode($value['paths'], true);
52
+
53
+ if(!$extensionPaths) {
54
+ $extensionPaths = array();
55
+ }
56
+
57
+ $paths[$value['name']] = $extensionPaths;
58
+ }
59
+
60
+ return $paths;
61
+ }
62
+
63
+ public function getExtensionClassName() {
64
+
65
+ $extensionKey = $this->getExtensionKey();
66
+ $extensionClass = "SGPB".ucfirst($extensionKey)."Extension";
67
+
68
+ return $extensionClass;
69
+ }
70
+
71
+ public function optionsInclude($popupType) {
72
+
73
+ $options = $this->getExtensionsData('option');
74
+ $extensionOptions = '';
75
+
76
+ foreach($options as $extensionKey => $optionData) {
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);
83
+ $extensionOptions .= $content;
84
+
85
+ }
86
+
87
+ return $extensionOptions;
88
+ }
89
+
90
+ public function extensionsSave() {
91
+
92
+ $extensionsData = $this->getExtensionsData();
93
+ $postData = $this->getPostData();
94
+
95
+ foreach($extensionsData as $extensionKey => $extensionData) {
96
+
97
+ $this->setExtensionKey($extensionKey);
98
+ $extensionClass = $this->getExtensionClassName();
99
+
100
+ require_once($extensionData['app-path'].'/classes/'.$extensionClass.'.php');
101
+ $extensionObj = new $extensionClass();
102
+ $extensionObj->setPostData($postData);
103
+ $extensionObj->save();
104
+
105
+ }
106
+ }
107
+
108
+ public function setupOptionsDefaultValues() {
109
+
110
+ $options = $this->getExtensionsData('option');
111
+ $allOptions = array();
112
+
113
+ foreach($options as $extensionKey => $optionData) {
114
+
115
+ $this->setExtensionKey($extensionKey);
116
+ $extensionClass = $this->getExtensionClassName();
117
+ require_once($optionData['app-path'].'/classes/'.$extensionClass.'.php');
118
+ $extensionObj = new $extensionClass();
119
+ $defaults = $extensionObj->getDefaultValues();
120
+ $allOptions = array_merge($allOptions, $defaults);
121
+
122
+ }
123
+
124
+ $this->setOptionsDefaultValues($allOptions);
125
+ }
126
+
127
+ public function setExtensionData($popupId, $extensionKey) {
128
+
129
+ $savedOptionsData = array();
130
+ if(isset($popupId)) {
131
+ $savedOptions = SGPBExtension::getSavedOptions($popupId, $extensionKey);
132
+
133
+ if($savedOptions) {
134
+ foreach($savedOptions as $key => $optionData) {
135
+
136
+ $options = json_decode($optionData->options, true);
137
+ $savedOptionsData = $options;
138
+ }
139
+ }
140
+ }
141
+
142
+ $this->setupOptionsDefaultValues();
143
+ $this->setSavedOptions($savedOptionsData);
144
+ }
145
+
146
+ public function getOptionValue($optionKey, $isBool = false) {
147
+
148
+ $savedOptions = $this->getSavedOptions();
149
+
150
+ $defaultOptions = $this->getOptionsDefaultValues();
151
+
152
+ if (isset($savedOptions[$optionKey])) {
153
+ $elementValue = $savedOptions[$optionKey];
154
+ }
155
+ else {
156
+ $elementValue = $defaultOptions[$optionKey];
157
+ }
158
+
159
+ if($isBool) {
160
+ $elementValue = $this->sgBoolToChecked($elementValue);
161
+ }
162
+
163
+ return $elementValue;
164
+ }
165
+
166
+ public function includeExtensionScripts($popupId) {
167
+
168
+ $extensionKeys = SGPBExtension::getPopupSavedExtensionsKeys($popupId);
169
+
170
+ foreach($extensionKeys as $extensionOptios) {
171
+
172
+ $paths = json_decode($extensionOptios['paths'], true);
173
+ $extensionKey = $extensionOptios['extensionKey'];
174
+ if(!isset($extensionKey)) {
175
+ continue;
176
+ }
177
+ $this->setExtensionKey($extensionKey);
178
+ $extensionClass = $this->getExtensionClassName();
179
+
180
+ if(!class_exists($extensionClass)) {
181
+
182
+ require_once($paths['app-path'].'/classes/'.$extensionClass.'.php');
183
+ }
184
+ $extensionObj = new $extensionClass();
185
+ $extensionObj->includeScripts($popupId);
186
+
187
+ }
188
+ }
189
+
190
+ public function deletePopupFromConnection($popupId) {
191
+
192
+ SGPBExtension::deletePopupFromConnectionById($popupId);
193
+ }
194
+
195
+ }
classes/SGPopup.php CHANGED
@@ -257,10 +257,12 @@ abstract class SGPopup {
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
  array_push(SGPopup::$currentPopups,$this->getId());
261
  $options = json_decode($this->getOptions(),true);
262
  if(empty($options)) $options = array();
263
- $sgPopupVars = 'SG_POPUP_DATA['.$this->getId().'] ='.json_encode(array_merge($parentOption, $options, $getexrArray)).';';
264
 
265
  return $sgPopupVars;
266
  }
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
  }
config.php CHANGED
@@ -12,12 +12,14 @@ 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.46);
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_IP_TO_COUNTRY_SERVICE_TIMEOUT', 2);
22
  define("SG_SHOW_POPUP_REVIEW", get_option("SG_COLOSE_REVIEW_BLOCK"));
23
  define("SG_POSTS_PER_PAGE", 1000);
@@ -52,7 +54,9 @@ $POPUP_TITLES = array(
52
  $POPUP_ADDONS = array(
53
  'aweber',
54
  'mailchimp',
55
- 'analytics'
 
 
56
  );
57
 
58
 
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.47);
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);
54
  $POPUP_ADDONS = array(
55
  'aweber',
56
  'mailchimp',
57
+ 'analytics',
58
+ 'exitIntent',
59
+ 'adBlock'
60
  );
61
 
62
 
files/options_section/pro.php CHANGED
@@ -6,6 +6,7 @@
6
  $sgAllSelectedPages = @implode(',', $sgAllSelectedPages);
7
  $sgAllSelectedPosts = @implode(',', $sgAllSelectedPosts);
8
  $sgAllSelectedCustomPosts = @implode(',', $sgAllSelectedCustomPosts);
 
9
  ?>
10
  <div id="pro-options">
11
  <div id="post-body" class="metabox-holder columns-2">
@@ -74,6 +75,7 @@
74
  <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); ?>">
75
  <span class="span-percent">%</span>
76
  </div>
 
77
  <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;?> >
78
  <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>
79
  <div class="js-inactivity-content acordion-main-div-content">
@@ -81,7 +83,7 @@
81
  <span class="span-percent">Sec</span>
82
  </div>
83
 
84
- <?php endif; ?>
85
  <span class="liquid-width">Hide on mobile devices:</span><input class="input-width-static" type="checkbox" name="forMobile" <?php echo @$sgForMobile;?>>
86
  <span class="dashicons dashicons-info same-image-style"></span><span class="infoForMobile samefontStyle">Don't show the popup for mobile.</span><br>
87
 
@@ -118,7 +120,7 @@
118
  <span class="span-percent">Days</span><br>
119
  <span class="liquid-width">Page level cookie saving</span>
120
  <input type="checkbox" name="save-cookie-page-level" <?php echo $sgPopupCookiePageLevel; ?>>
121
- <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 set for all site.</span>
122
  </div>
123
  <?php endif;?>
124
 
6
  $sgAllSelectedPages = @implode(',', $sgAllSelectedPages);
7
  $sgAllSelectedPosts = @implode(',', $sgAllSelectedPosts);
8
  $sgAllSelectedCustomPosts = @implode(',', $sgAllSelectedCustomPosts);
9
+
10
  ?>
11
  <div id="pro-options">
12
  <div id="post-body" class="metabox-holder columns-2">
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">
83
  <span class="span-percent">Sec</span>
84
  </div>
85
 
86
+
87
  <span class="liquid-width">Hide on mobile devices:</span><input class="input-width-static" type="checkbox" name="forMobile" <?php echo @$sgForMobile;?>>
88
  <span class="dashicons dashicons-info same-image-style"></span><span class="infoForMobile samefontStyle">Don't show the popup for mobile.</span><br>
89
 
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>
125
  <?php endif;?>
126
 
files/sg_functions.php CHANGED
@@ -205,20 +205,15 @@ class SGFunctions
205
  public static function getCountryName($ip)
206
  {
207
  if(empty($_COOKIE['SG_POPUP_USER_COUNTRY_NAME'])) {
 
 
 
 
208
 
209
- try {
210
-
211
- $details = wp_remote_get(SG_IP_TO_COUNTRY_SERVICE_URL.$ip."&".SG_IP_TO_COUNTRY_SERVICE_TOKEN, array( 'timeout' => SG_IP_TO_COUNTRY_SERVICE_TIMEOUT));$details = wp_remote_get(SG_IP_TO_COUNTRY_SERVICE_URL.$ip."&".SG_IP_TO_COUNTRY_SERVICE_TOKEN, array( 'timeout' => SG_IP_TO_COUNTRY_SERVICE_TIMEOUT));
212
- $dataIp = json_decode($details['body'], true);
213
- if(!is_array($dataIp)) {
214
- return true;
215
- }
216
- $counrty = @$dataIp['country'];
217
- }
218
- catch ( Exception $ex ) {
219
  return true;
220
  }
221
-
222
  }
223
  else {
224
  $counrty = $_COOKIE['SG_POPUP_USER_COUNTRY_NAME'];
205
  public static function getCountryName($ip)
206
  {
207
  if(empty($_COOKIE['SG_POPUP_USER_COUNTRY_NAME'])) {
208
+ require_once(SG_APP_POPUP_FILES."/lib/SxGeo/SxGeo.php");
209
+
210
+ $SxGeo = new SxGeo(SG_APP_POPUP_FILES."/lib/SxGeo/SxGeo.dat");
211
+ $counrty = $SxGeo->getCountry($ip);
212
 
213
+ /*When Ip addres does not correct*/
214
+ if($counrty == '') {
 
 
 
 
 
 
 
 
215
  return true;
216
  }
 
217
  }
218
  else {
219
  $counrty = $_COOKIE['SG_POPUP_USER_COUNTRY_NAME'];
files/sg_popup_actions.php CHANGED
@@ -1,4 +1,25 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  function sgPopupPluginLoaded() {
3
 
4
  $versionPopup = get_option('SG_POPUP_VERSION');
@@ -23,7 +44,7 @@ function sgnewslatter_repeat_function($args) {
23
  $successMails = 0;
24
  $allData = array();
25
  $adminEmail = get_option('admin_email');
26
-
27
  $sql = $wpdb->prepare("select id from ".$wpdb->prefix."sg_subscribers where status=0 and subscriptionType = %s limit 1",$subscriptionType);
28
  $result = $wpdb->get_row($sql, ARRAY_A);
29
  $id = (int)$result['id'];
@@ -37,6 +58,9 @@ function sgnewslatter_repeat_function($args) {
37
  $headers .= 'From: '.$adminEmail.''."\r\n";
38
  $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
39
  $successTotal = get_option("SG_NEWSLETTER_".$subscriptionType);
 
 
 
40
  $faildTotal = $totalSubscribers - $successTotal;
41
 
42
  $emailMessageCustom = 'Your mail list '.$subscriptionType.' delivered successfully!
@@ -56,7 +80,7 @@ function sgnewslatter_repeat_function($args) {
56
  }
57
 
58
  foreach ($allData as $data) {
59
-
60
  $patternFirstName = '/\[First name]/';
61
  $patternLastName = '/\[Last name]/';
62
  $patternBlogName = '/\[Blog name]/';
@@ -70,7 +94,8 @@ function sgnewslatter_repeat_function($args) {
70
  $emailMessageCustom = preg_replace($patternLastName, $replacementLastName, $emailMessageCustom);
71
  $emailMessageCustom = preg_replace($patternBlogName, $replacementBlogName, $emailMessageCustom);
72
  $emailMessageCustom = preg_replace($patternUserName, $replacementUserName, $emailMessageCustom);
73
-
 
74
  /*Mail Headers*/
75
  $headers = 'MIME-Version: 1.0'."\r\n";
76
  $headers .= 'From: '.$adminEmail.''."\r\n";
@@ -89,7 +114,7 @@ function sgnewslatter_repeat_function($args) {
89
  else {
90
  update_option("SG_NEWSLETTER_".$subscriptionType, ++$successCount);
91
  }
92
-
93
  }
94
  /*Update all mails status which has been sent*/
95
  $updateStatusQuery = $wpdb->prepare("UPDATE ". $wpdb->prefix ."sg_subscribers SET status=1 where id>=$id and subscriptionType = %s limit $sendingLimit",$subscriptionType);
1
  <?php
2
+ class sgPopupActions {
3
+
4
+ public function __construct() {
5
+
6
+ $this->actions();
7
+ }
8
+
9
+ private function actions() {
10
+
11
+ add_action('sgPopupDelete', array($this, 'sgPopupDeleteAction'));
12
+ }
13
+
14
+ public function sgPopupDeleteAction($args) {
15
+
16
+ $extensionManagerObj = new SGPBExtensionManager();
17
+ $extensionManagerObj->deletePopupFromConnection($args['popupId']);
18
+ }
19
+ }
20
+
21
+ $actionsObj = new sgPopupActions();
22
+
23
  function sgPopupPluginLoaded() {
24
 
25
  $versionPopup = get_option('SG_POPUP_VERSION');
44
  $successMails = 0;
45
  $allData = array();
46
  $adminEmail = get_option('admin_email');
47
+
48
  $sql = $wpdb->prepare("select id from ".$wpdb->prefix."sg_subscribers where status=0 and subscriptionType = %s limit 1",$subscriptionType);
49
  $result = $wpdb->get_row($sql, ARRAY_A);
50
  $id = (int)$result['id'];
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) {
62
+ $successTotal = 0;
63
+ }
64
  $faildTotal = $totalSubscribers - $successTotal;
65
 
66
  $emailMessageCustom = 'Your mail list '.$subscriptionType.' delivered successfully!
80
  }
81
 
82
  foreach ($allData as $data) {
83
+
84
  $patternFirstName = '/\[First name]/';
85
  $patternLastName = '/\[Last name]/';
86
  $patternBlogName = '/\[Blog name]/';
94
  $emailMessageCustom = preg_replace($patternLastName, $replacementLastName, $emailMessageCustom);
95
  $emailMessageCustom = preg_replace($patternBlogName, $replacementBlogName, $emailMessageCustom);
96
  $emailMessageCustom = preg_replace($patternUserName, $replacementUserName, $emailMessageCustom);
97
+ $emailMessageCustom = stripslashes($emailMessageCustom);
98
+
99
  /*Mail Headers*/
100
  $headers = 'MIME-Version: 1.0'."\r\n";
101
  $headers .= 'From: '.$adminEmail.''."\r\n";
114
  else {
115
  update_option("SG_NEWSLETTER_".$subscriptionType, ++$successCount);
116
  }
117
+
118
  }
119
  /*Update all mails status which has been sent*/
120
  $updateStatusQuery = $wpdb->prepare("UPDATE ". $wpdb->prefix ."sg_subscribers SET status=1 where id>=$id and subscriptionType = %s limit $sendingLimit",$subscriptionType);
files/sg_popup_create.php CHANGED
@@ -7,127 +7,119 @@ if(!SG_SHOW_POPUP_REVIEW) {
7
  $externalPlugins = IntegrateExternalSettings::getAllExternalPlugins();
8
  $doesntHaveAnyActiveExtensions = IntegrateExternalSettings::doesntHaveAnyActiveExtensions();
9
  ?>
10
- <h2>Add New Popup</h2>
11
- <div class="popups-wrapper">
12
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=image">
13
- <div class="popups-div image-popup">
14
- </div>
15
- </a>
16
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=html">
17
- <div class="popups-div html-popup">
18
- </div>
19
- </a>
20
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=fblike">
21
- <div class="popups-div fblike-popup">
22
- </div>
23
- </a>
24
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=shortcode">
25
- <div class="popups-div shortcode-popup">
26
- </div>
27
- </a>
28
- <?php if(POPUP_BUILDER_PKG >= POPUP_BUILDER_PKG_SILVER): ?>
29
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=iframe">
30
- <div class="popups-div iframe-popup">
31
- </div>
32
- </a>
33
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=video">
34
- <div class="popups-div video-popup">
35
- </div>
36
- </a>
37
- <?php if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_SILVER): ?>
38
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=ageRestriction">
39
- <div class="popups-div age-restriction">
40
- </div>
41
- </a>
42
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=countdown">
43
- <div class="popups-div countdown">
44
- </div>
45
- </a>
46
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=social">
47
- <div class="popups-div sg-social">
48
- </div>
49
- </a>
50
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=exitIntent">
51
- <div class="popups-div sg-exit-intent">
52
- </div>
53
- </a>
54
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=subscription">
55
- <div class="popups-div sg-subscription">
56
- </div>
57
- </a>
58
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=contactForm">
59
- <div class="popups-div sg-contact-form">
60
- </div>
61
- </a>
62
- <?php endif; ?>
63
- <?php endif; ?>
64
- <?php
65
  if(!empty($externalPlugins)) {
66
  foreach ($externalPlugins as $externalPlugin) { ?>
67
- <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=<?php echo $externalPlugin['name']?>">
68
- <div class="popups-div <?php echo $externalPlugin['name'].'-image';?>">
69
- </div>
70
- </a>
71
  <?php }
72
  }
73
- ?>
74
- <?php if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
75
- <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
76
- <div class="popups-div iframe-popup-pro">
77
- </div>
78
- </a>
79
- <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
80
- <div class="popups-div video-popup-pro">
81
- </div>
82
- </a>
83
- <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
84
- <div class="popups-div age-restriction-pro">
85
- </div>
86
- </a>
87
- <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
88
- <div class="popups-div countdown-pro">
89
- </div>
90
- </a>
91
- <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
92
- <div class="popups-div social-pro">
93
- </div>
94
- </a>
95
- <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
96
- <div class="popups-div exit-intent-pro">
97
- </div>
98
- </a>
99
- <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
100
- <div class="popups-div subscription-pro">
101
- </div>
102
- </a>
103
- <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
104
- <div class="popups-div contact-pro">
105
- </div>
106
- </a>
107
-
108
- <?php endif; ?>
109
-
110
- </div>
111
 
112
  <?php
113
 
114
  if ($doesntHaveAnyActiveExtensions) : ?>
115
- <div class="add-new-extensions-wrapper">
116
  <span class="add-new-extensions">
117
  Extensions
118
  </span>
119
- </div>
120
- <?php
121
- global $POPUP_ADDONS;
122
- foreach ($POPUP_ADDONS as $addonName) {
123
- $isExtension = IntegrateExternalSettings::isExtensionExists($addonName);
124
- if(!$isExtension) :
125
  $defineString = 'SG_'.strtoupper($addonName).'_EXTENSION_URL';
126
- $urlDefine = constant($defineString);?>
127
  <a class="create-popup-link" href="<?php echo $urlDefine;?>" target="_blank">
128
  <div class="popups-div" <?php echo "id='".$addonName."-pro'";?>>
129
  </div>
130
  </a>
131
- <?php endif;
132
- } ?>
133
  <?php endif; ?>
7
  $externalPlugins = IntegrateExternalSettings::getAllExternalPlugins();
8
  $doesntHaveAnyActiveExtensions = IntegrateExternalSettings::doesntHaveAnyActiveExtensions();
9
  ?>
10
+ <h2>Add New Popup</h2>
11
+ <div class="popups-wrapper">
12
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=image">
13
+ <div class="popups-div image-popup">
14
+ </div>
15
+ </a>
16
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=html">
17
+ <div class="popups-div html-popup">
18
+ </div>
19
+ </a>
20
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=fblike">
21
+ <div class="popups-div fblike-popup">
22
+ </div>
23
+ </a>
24
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=shortcode">
25
+ <div class="popups-div shortcode-popup">
26
+ </div>
27
+ </a>
28
+ <?php if(POPUP_BUILDER_PKG >= POPUP_BUILDER_PKG_SILVER): ?>
29
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=iframe">
30
+ <div class="popups-div iframe-popup">
31
+ </div>
32
+ </a>
33
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=video">
34
+ <div class="popups-div video-popup">
35
+ </div>
36
+ </a>
37
+ <?php if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_SILVER): ?>
38
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=ageRestriction">
39
+ <div class="popups-div age-restriction">
40
+ </div>
41
+ </a>
42
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=countdown">
43
+ <div class="popups-div countdown">
44
+ </div>
45
+ </a>
46
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=social">
47
+ <div class="popups-div sg-social">
48
+ </div>
49
+ </a>
50
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=subscription">
51
+ <div class="popups-div sg-subscription">
52
+ </div>
53
+ </a>
54
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=contactForm">
55
+ <div class="popups-div sg-contact-form">
56
+ </div>
57
+ </a>
58
+ <?php endif; ?>
59
+ <?php endif; ?>
60
+ <?php
 
 
 
 
61
  if(!empty($externalPlugins)) {
62
  foreach ($externalPlugins as $externalPlugin) { ?>
63
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=<?php echo $externalPlugin['name']?>">
64
+ <div class="popups-div <?php echo $externalPlugin['name'].'-image';?>">
65
+ </div>
66
+ </a>
67
  <?php }
68
  }
69
+ ?>
70
+ <?php if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
71
+ <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
72
+ <div class="popups-div iframe-popup-pro">
73
+ </div>
74
+ </a>
75
+ <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
76
+ <div class="popups-div video-popup-pro">
77
+ </div>
78
+ </a>
79
+ <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
80
+ <div class="popups-div age-restriction-pro">
81
+ </div>
82
+ </a>
83
+ <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
84
+ <div class="popups-div countdown-pro">
85
+ </div>
86
+ </a>
87
+ <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
88
+ <div class="popups-div social-pro">
89
+ </div>
90
+ </a>
91
+ <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
92
+ <div class="popups-div subscription-pro">
93
+ </div>
94
+ </a>
95
+ <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
96
+ <div class="popups-div contact-pro">
97
+ </div>
98
+ </a>
99
+
100
+ <?php endif; ?>
101
+
102
+ </div>
 
 
 
 
103
 
104
  <?php
105
 
106
  if ($doesntHaveAnyActiveExtensions) : ?>
107
+ <div class="add-new-extensions-wrapper">
108
  <span class="add-new-extensions">
109
  Extensions
110
  </span>
111
+ </div>
112
+ <?php
113
+ global $POPUP_ADDONS;
114
+ foreach ($POPUP_ADDONS as $addonName) {
115
+ $isExtension = IntegrateExternalSettings::isExtensionExists($addonName);
116
+ if(!$isExtension) :
117
  $defineString = 'SG_'.strtoupper($addonName).'_EXTENSION_URL';
118
+ $urlDefine = constant($defineString);?>
119
  <a class="create-popup-link" href="<?php echo $urlDefine;?>" target="_blank">
120
  <div class="popups-div" <?php echo "id='".$addonName."-pro'";?>>
121
  </div>
122
  </a>
123
+ <?php endif;
124
+ } ?>
125
  <?php endif; ?>
files/sg_popup_create_new.php CHANGED
@@ -1,1252 +1,1221 @@
1
  <?php
2
- $popupType = @$_GET['type'];
3
- if (!$popupType) {
4
- $popupType = 'html';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  }
6
- //Get current paths for popup, for addons it different
7
- $paths = IntegrateExternalSettings::getCurrentPopupAppPaths($popupType);
8
- //Get current form action, for addons it different
9
- $currentActionName = IntegrateExternalSettings::getCurrentPopupAdminPostActionName($popupType);
10
-
11
- $popupAppPath = $paths['app-path'];
12
- $popupFilesPath = $paths['files-path'];
13
-
14
- $popupName = "SG".ucfirst(strtolower($popupType));
15
- $popupClassName = $popupName."Popup";
16
- require_once($popupAppPath ."/classes/".$popupClassName.".php");
17
- $obj = new $popupClassName();
18
 
19
- global $removeOptions;
20
- $removeOptions = $obj->getRemoveOptions();
21
-
22
- if (isset($_GET['id'])) {
23
- $id = (int)$_GET['id'];
24
- $result = call_user_func(array($popupClassName, 'findById'), $id);
25
- if (!$result) {
26
- wp_redirect(SG_APP_POPUP_ADMIN_URL."page=edit-popup&type=".$popupType."");
27
- }
28
-
29
- switch ($popupType) {
30
- case 'iframe':
31
- $sgPopupDataIframe = $result->getUrl();
32
- break;
33
- case 'video':
34
- $sgPopupDataVideo = $result->getRealUrl();
35
- $sgVideoOptions = $result->getVideoOptions();
36
- break;
37
- case 'image':
38
- $sgPopupDataImage = $result->getUrl();
39
- break;
40
- case 'html':
41
- $sgPopupDataHtml = $result->getContent();
42
- break;
43
- case 'fblike':
44
- $sgPopupDataFblike = $result->getContent();
45
- $sgFlikeOptions = $result->getFblikeOptions();
46
- break;
47
- case 'shortcode':
48
- $sgPopupDataShortcode = $result->getShortcode();
49
- break;
50
- case 'ageRestriction':
51
- $sgPopupAgeRestriction = ($result->getContent());
52
- $sgYesButton = sgSafeStr($result->getYesButton());
53
- $sgNoButton = sgSafeStr($result->getNoButton());
54
- $sgRestrictionUrl = sgSafeStr($result->getRestrictionUrl());
55
- break;
56
- case 'countdown':
57
- $sgCoundownContent = $result->getCountdownContent();
58
- $countdownOptions = json_decode(sgSafeStr($result->getCountdownOptions()),true);
59
- $sgCountdownNumbersBgColor = $countdownOptions['countdownNumbersBgColor'];
60
- $sgCountdownNumbersTextColor = $countdownOptions['countdownNumbersTextColor'];
61
- $sgDueDate = $countdownOptions['sg-due-date'];
62
- @$sgGetCountdownType = $countdownOptions['sg-countdown-type'];
63
- $sgCountdownLang = $countdownOptions['counts-language'];
64
- @$sgCountdownPosition = $countdownOptions['coundown-position'];
65
- @$sgSelectedTimeZone = $countdownOptions['sg-time-zone'];
66
- @$sgCountdownAutoclose = $countdownOptions['countdown-autoclose'];
67
- break;
68
- case 'social':
69
- $sgSocialContent = ($result->getSocialContent());
70
- $sgSocialButtons = sgSafeStr($result->getButtons());
71
- $sgSocialOptions = sgSafeStr($result->getSocialOptions());
72
- break;
73
- case 'exitIntent':
74
- $sgExitIntentContent = $result->getContent();
75
- $exitIntentOptions = $result->getExitIntentOptions();
76
- break;
77
- case 'subscription':
78
- $sgSunbscriptionContent = $result->getContent();
79
- $subscriptionOptions = $result->getSubscriptionOptions();
80
- break;
81
- case 'contactForm':
82
- $params = $result->getParams();
83
- $sgContactFormContent = $result->getContent();
84
  break;
85
- }
86
-
87
- $title = $result->getTitle();
88
- $jsonData = json_decode($result->getOptions(), true);
89
- $sgEscKey = @$jsonData['escKey'];
90
- $sgScrolling = @$jsonData['scrolling'];
91
- $sgScaling = @$jsonData['scaling'];
92
- $sgCloseButton = @$jsonData['closeButton'];
93
- $sgReposition = @$jsonData['reposition'];
94
- $sgOverlayClose = @$jsonData['overlayClose'];
95
- $sgReopenAfterSubmission = @$jsonData['reopenAfterSubmission'];
96
- $sgOverlayColor = @$jsonData['sgOverlayColor'];
97
- $sgContentBackgroundColor = @$jsonData['sg-content-background-color'];
98
- $sgContentClick = @$jsonData['contentClick'];
99
- $sgContentClickBehavior = @$jsonData['content-click-behavior'];
100
- $sgClickRedirectToUrl = @$jsonData['click-redirect-to-url'];
101
- $sgRedirectToNewTab = @$jsonData['redirect-to-new-tab'];
102
- $sgOpacity = @$jsonData['opacity'];
103
- $sgPopupFixed = @$jsonData['popupFixed'];
104
- $sgFixedPostion = @$jsonData['fixedPostion'];
105
- $sgOnScrolling = @$jsonData['onScrolling'];
106
- $sgInActivityStatus = @$jsonData['inActivityStatus'];
107
- $sgInactivityTimout = @$jsonData['inactivity-timout'];
108
- $beforeScrolingPrsent = @$jsonData['beforeScrolingPrsent'];
109
- $duration = @$jsonData['duration'];
110
- $delay = @$jsonData['delay'];
111
- $sgTheme3BorderColor = @$jsonData['sgTheme3BorderColor'];
112
- $sgTheme3BorderRadius = @$jsonData['sgTheme3BorderRadius'];
113
- $sgThemeCloseText = @$jsonData['theme-close-text'];
114
- $effect =@$jsonData['effect'];
115
- $sgInitialWidth = @$jsonData['initialWidth'];
116
- $sgInitialHeight = @$jsonData['initialHeight'];
117
- $sgWidth = @$jsonData['width'];
118
- $sgHeight = @$jsonData['height'];
119
- $sgMaxWidth = @$jsonData['maxWidth'];
120
- $sgMaxHeight = @$jsonData['maxHeight'];
121
- $sgForMobile = @$jsonData['forMobile'];
122
- $sgOpenOnMobile = @$jsonData['openMobile'];
123
- $sgAllPagesStatus = @$jsonData['allPagesStatus'];
124
- $sgAllPostsStatus = @$jsonData['allPostsStatus'];
125
- $sgAllCustomPostsStatus = @$jsonData['allCustomPostsStatus'];
126
- $sgPostsAllCategories = @$jsonData['posts-all-categories'];
127
- $sgRepeatPopup = @$jsonData['repeatPopup'];
128
- $sgPopupAppearNumberLimit = @$jsonData['popup-appear-number-limit'];
129
- $sgPopupCookiePageLevel = @$jsonData['save-cookie-page-level'];
130
- $sgDisablePopup = @$jsonData['disablePopup'];
131
- $sgDisablePopupOverlay = @$jsonData['disablePopupOverlay'];
132
- $sgPopupClosingTimer = @$jsonData['popupClosingTimer'];
133
- $sgAutoClosePopup = @$jsonData['autoClosePopup'];
134
- $sgCountryStatus = @$jsonData['countryStatus'];
135
- $sgAllSelectedPages = @$jsonData['allSelectedPages'];
136
- $sgAllSelectedCustomPosts = @$jsonData['allSelectedCustomPosts'];
137
- $sgAllPostStatus = @$jsonData['showAllPosts'];
138
- $sgAllSelectedPosts = @$jsonData['allSelectedPosts'];
139
- $sgAllowCountries = @$jsonData['allowCountries'];
140
- $sgAllPages = @$jsonData['showAllPages'];
141
- $sgAllPosts = @$jsonData['showAllPosts'];
142
- $sgAllCustomPosts = @$jsonData['showAllCustomPosts'];
143
- $sgAllCustomPostsType = @$jsonData['all-custom-posts'];
144
- $sgLogedUser = @$jsonData['loggedin-user'];
145
- $sgUserSeperate = @$jsonData['sg-user-status'];
146
- $sgCountryName = @$jsonData['countryName'];
147
- $sgCountryIso = @$jsonData['countryIso'];
148
- $sgPopupTimerStatus = @$jsonData['popup-timer-status'];
149
- $sgPopupScheduleStatus = @$jsonData['popup-schedule-status'];
150
- $sgPopupScheduleStartWeeks = @$jsonData['schedule-start-weeks'];
151
- $sgPopupScheduleStartTime = @$jsonData['schedule-start-time'];
152
- $sgPopupScheduleEndTime = @$jsonData['schedule-end-time'];
153
- $sgPopupFinishTimer = @$jsonData['popup-finish-timer'];
154
- $sgPopupStartTimer = @$jsonData['popup-start-timer'];
155
- $sgColorboxTheme = @$jsonData['theme'];
156
- $sgOverlayCustomClasss = @$jsonData['sgOverlayCustomClasss'];
157
- $sgContentCustomClasss = @$jsonData['sgContentCustomClasss'];
158
- $sgOnceExpiresTime = @$jsonData['onceExpiresTime'];
159
- $sgRestrictionAction = @$jsonData['restrictionAction'];
160
- $yesButtonBackgroundColor = @sgSafeStr($jsonData['yesButtonBackgroundColor']);
161
- $noButtonBackgroundColor = @sgSafeStr($jsonData['noButtonBackgroundColor']);
162
- $yesButtonTextColor = @sgSafeStr($jsonData['yesButtonTextColor']);
163
- $noButtonTextColor = @sgSafeStr($jsonData['noButtonTextColor']);
164
- $yesButtonRadius = @sgSafeStr($jsonData['yesButtonRadius']);
165
- $noButtonRadius = @sgSafeStr($jsonData['noButtonRadius']);
166
- $sgSocialOptions = json_decode(@$sgSocialOptions,true);
167
- $sgShareUrl = $sgSocialOptions['sgShareUrl'];
168
- $shareUrlType = @sgSafeStr($sgSocialOptions['shareUrlType']);
169
- $fbShareLabel = @sgSafeStr($sgSocialOptions['fbShareLabel']);
170
- $lindkinLabel = @sgSafeStr($sgSocialOptions['lindkinLabel']);
171
- $googLelabel = @sgSafeStr($sgSocialOptions['googLelabel']);
172
- $twitterLabel = @sgSafeStr($sgSocialOptions['twitterLabel']);
173
- $pinterestLabel = @sgSafeStr($sgSocialOptions['pinterestLabel']);
174
- $sgMailSubject = @sgSafeStr($sgSocialOptions['sgMailSubject']);
175
- $sgMailLable = @sgSafeStr($sgSocialOptions['sgMailLable']);
176
- $sgSocialButtons = json_decode(@$sgSocialButtons,true);
177
- $sgTwitterStatus = @sgSafeStr($sgSocialButtons['sgTwitterStatus']);
178
- $sgFbStatus = @sgSafeStr($sgSocialButtons['sgFbStatus']);
179
- $sgEmailStatus = @sgSafeStr($sgSocialButtons['sgEmailStatus']);
180
- $sgLinkedinStatus = @sgSafeStr($sgSocialButtons['sgLinkedinStatus']);
181
- $sgGoogleStatus = @sgSafeStr($sgSocialButtons['sgGoogleStatus']);
182
- $sgPinterestStatus = @sgSafeStr($sgSocialButtons['sgPinterestStatus']);
183
- $sgSocialTheme = @sgSafeStr($sgSocialOptions['sgSocialTheme']);
184
- $sgSocialButtonsSize = @sgSafeStr($sgSocialOptions['sgSocialButtonsSize']);
185
- $sgSocialLabel = @sgSafeStr($sgSocialOptions['sgSocialLabel']);
186
- $sgSocialShareCount = @sgSafeStr($sgSocialOptions['sgSocialShareCount']);
187
- $sgRoundButton = @sgSafeStr($sgSocialOptions['sgRoundButton']);
188
- $sgPushToBottom = @sgSafeStr($jsonData['pushToBottom']);
189
- $exitIntentOptions = json_decode(@$exitIntentOptions, true);
190
- $sgExitIntentTpype = @$exitIntentOptions['exit-intent-type'];
191
- $sgExitIntntExpire = @$exitIntentOptions['exit-intent-expire-time'];
192
- $sgExitIntentAlert = @$exitIntentOptions['exit-intent-alert'];
193
- $sgVideoOptions = json_decode(@$sgVideoOptions, true);
194
- $sgVideoAutoplay = $sgVideoOptions['video-autoplay'];
195
- $sgFlikeOptions = json_decode(@$sgFlikeOptions, true);
196
- $sgFblikeurl = @$sgFlikeOptions['fblike-like-url'];
197
- $sgFbLikeLayout = @$sgFlikeOptions['fblike-layout'];
198
- $subscriptionOptions = json_decode(@$subscriptionOptions, true);
199
- $sgSubsFirstNameStatus = $subscriptionOptions['subs-first-name-status'];
200
- $sgSubsLastNameStatus = $subscriptionOptions['subs-last-name-status'];
201
- $sgSubscriptionEmail = @$subscriptionOptions['subscription-email'];
202
- $sgSubsFirstName = @$subscriptionOptions['subs-first-name'];
203
- $sgSubsLastName = @$subscriptionOptions['subs-last-name'];
204
- $sgSubsButtonBgcolor = @$subscriptionOptions['subs-button-bgcolor'];
205
- $sgSubsBtnWidth = @$subscriptionOptions['subs-btn-width'];
206
- $sgSubsBtnHeight = @$subscriptionOptions['subs-btn-height'];
207
- $sgSubsTextHeight = @$subscriptionOptions['subs-text-height'];
208
- $sgSubsBtnTitle = @$subscriptionOptions['subs-btn-title'];
209
- $sgSubsTextInputBgcolor = @$subscriptionOptions['subs-text-input-bgcolor'];
210
- $sgSubsTextBordercolor = @$subscriptionOptions['subs-text-bordercolor'];
211
- $sgSubsTextWidth = @$subscriptionOptions['subs-text-width'];
212
- $sgSubsButtonColor = @$subscriptionOptions['subs-button-color'];
213
- $sgSubsInputsColor = @$subscriptionOptions['subs-inputs-color'];
214
- $sgSubsPlaceholderColor = @$subscriptionOptions['subs-placeholder-color'];
215
- $sgSubsValidateMessage = @$subscriptionOptions['subs-validation-message'];
216
- $sgSuccessMessage = @$subscriptionOptions['subs-success-message'];
217
- $sgSubsBtnProgressTitle = @$subscriptionOptions['subs-btn-progress-title'];
218
- $sgSubsTextBorderWidth = @$subscriptionOptions['subs-text-border-width'];
219
- $sgSubsDontShowAfterSubmitting = @$subscriptionOptions['subs-dont-show-after-submitting'];
220
- $contactFormOptions = json_decode(@$params, true);
221
- $sgContactNameLabel = @$contactFormOptions['contact-name'];
222
- $sgContactNameStatus = @$contactFormOptions['contact-name-status'];
223
- $sgShowFormToTop = @$contactFormOptions['show-form-to-top'];
224
- $sgContactNameRequired = @$contactFormOptions['contact-name-required'];
225
- $sgContactSubjectLabel = @$contactFormOptions['contact-subject'];
226
- $sgContactSubjectStatus = @$contactFormOptions['contact-subject-status'];
227
- $sgContactSubjectRequired = @$contactFormOptions['contact-subject-required'];
228
- $sgContactEmailLabel = @$contactFormOptions['contact-email'];
229
- $sgContactMessageLabel = @$contactFormOptions['contact-message'];
230
- $sgContactValidationMessage = @$contactFormOptions['contact-validation-message'];
231
- $sgContactSuccessMessage = @$contactFormOptions['contact-success-message'];
232
- $sgContactInputsWidth = @$contactFormOptions['contact-inputs-width'];
233
- $sgContactInputsHeight = @$contactFormOptions['contact-inputs-height'];
234
- $sgContactInputsBorderWidth = @$contactFormOptions['contact-inputs-border-width'];
235
- $sgContactTextInputBgcolor = @$contactFormOptions['contact-text-input-bgcolor'];
236
- $sgContactTextBordercolor = @$contactFormOptions['contact-text-bordercolor'];
237
- $sgContactInputsColor = @$contactFormOptions['contact-inputs-color'];
238
- $sgContactPlaceholderColor = @$contactFormOptions['contact-placeholder-color'];
239
- $sgContactBtnWidth = @$contactFormOptions['contact-btn-width'];
240
- $sgContactBtnHeight = @$contactFormOptions['contact-btn-height'];
241
- $sgContactBtnTitle = @$contactFormOptions['contact-btn-title'];
242
- $sgContactBtnProgressTitle = @$contactFormOptions['contact-btn-progress-title'];
243
- $sgContactButtonBgcolor = @$contactFormOptions['contact-button-bgcolor'];
244
- $sgContactButtonColor = @$contactFormOptions['contact-button-color'];
245
- $sgContactAreaWidth = @$contactFormOptions['contact-area-width'];
246
- $sgContactAreaHeight = @$contactFormOptions['contact-area-height'];
247
- $sgContactResize = @$contactFormOptions['sg-contact-resize'];
248
- $sgContactValidateEmail = @$contactFormOptions['contact-validate-email'];
249
- $sgContactResiveEmail = @$contactFormOptions['contact-receive-email'];
250
- $sgContactFailMessage = @$contactFormOptions['contact-fail-message'];
251
- }
252
-
253
- $dataPopupId = @$id;
254
- /* For layze loading get selected data */
255
- if(!isset($id)) {
256
- $dataPopupId = "-1";
257
- }
258
-
259
- $sgPopup = array(
260
- 'escKey'=> true,
261
- 'closeButton' => true,
262
- 'scrolling'=> true,
263
- 'scaling'=>false,
264
- 'opacity'=>0.8,
265
- 'reposition' => true,
266
- 'width' => '640px',
267
- 'height' => '480px',
268
- 'initialWidth' => '300',
269
- 'initialHeight' => '100',
270
- 'maxWidth' => false,
271
- 'maxHeight' => false,
272
- 'overlayClose' => true,
273
- 'reopenAfterSubmission' => false,
274
- 'contentClick'=>false,
275
- 'fixed' => false,
276
- 'top' => false,
277
- 'right' => false,
278
- 'bottom' => false,
279
- 'left' => false,
280
- 'duration' => 1,
281
- 'delay' => 0,
282
- 'theme-close-text' => 'Close',
283
- 'content-click-behavior' => 'close',
284
- );
285
-
286
- $popupProDefaultValues = array(
287
- 'closeType' => false,
288
- 'onScrolling' => false,
289
- 'inactivity-timout' => '0',
290
- 'inActivityStatus' => false,
291
- 'video-autoplay' => false,
292
- 'forMobile' => false,
293
- 'openMobile' => false,
294
- 'repetPopup' => false,
295
- 'disablePopup' => false,
296
- 'disablePopupOverlay' => false,
297
- 'redirect-to-new-tab' => true,
298
- 'autoClosePopup' => false,
299
- 'fbStatus' => true,
300
- 'twitterStatus' => true,
301
- 'emailStatus' => true,
302
- 'linkedinStatus' => true,
303
- 'googleStatus' => true,
304
- 'pinterestStatus' => true,
305
- 'sgSocialLabel'=>true,
306
- 'roundButtons'=>false,
307
- 'sgShareUrl' => 'http://',
308
- 'pushToBottom' => true,
309
- 'allPages' => "all",
310
- 'allPosts' => "all",
311
- 'allCustomPosts' => "all",
312
- 'allPagesStatus' => false,
313
- 'allPostsStatus' => false,
314
- 'allCustomPostsStatus' => false,
315
- 'onceExpiresTime' => 7,
316
- 'popup-appear-number-limit' => 1,
317
- 'save-cookie-page-level' => false,
318
- 'overlay-custom-classs' => 'sg-popup-overlay',
319
- 'content-custom-classs' => 'sg-popup-content',
320
- 'countryStatus' => false,
321
- 'sg-user-status' => false,
322
- 'allowCountries' => 'allow',
323
- 'loggedin-user' => 'true',
324
- 'countdownNumbersTextColor' => '',
325
- 'countdownNumbersBgColor' => '',
326
- 'countDownLang' => 'English',
327
- 'popup-timer-status' => false,
328
- 'popup-schedule-status' => false,
329
- 'countdown-position' => true,
330
- 'countdown-autoclose' => true,
331
- 'time-zone' => 'Etc/GMT',
332
- 'due-date' => date('M d y H:i', strtotime(' +1 day')),
333
- 'popup-start-timer' => date('M d y H:i'),
334
- 'schedule-start-time' => date("H:i"),
335
- 'exit-intent-type' => "soft",
336
- 'exit-intent-expire-time' => '1',
337
- 'subs-first-name-status' => true,
338
- 'subs-last-name-status' => true,
339
- 'subscription-email' => 'Email *',
340
- 'subs-first-name' => 'First name',
341
- 'subs-last-name' => 'Last name',
342
- 'subs-button-bgcolor' => '#239744',
343
- 'subs-button-color' => '#FFFFFF',
344
- 'subs-text-input-bgcolor' => '#FFFFFF',
345
- 'subs-inputs-color' => '#000000',
346
- 'subs-placeholder-color' => '#CCCCCC',
347
- 'subs-text-bordercolor' => '#CCCCCC',
348
- 'subs-btn-title' => 'Subscribe',
349
- 'subs-text-height' => '30px',
350
- 'subs-btn-height' => '30px',
351
- 'subs-text-width' => '200px',
352
- 'subs-btn-width' => '200px',
353
- 'subs-dont-show-after-submitting' => false,
354
- 'subs-text-border-width' => '2px',
355
- 'subs-success-message' =>'You have successfully subscribed to the newsletter',
356
- 'subs-validation-message' => 'This field is required.',
357
- 'subs-btn-progress-title' => 'Please wait...',
358
- 'contact-name' => 'Name *',
359
- 'contact-name-required' => true,
360
- 'contact-name-status' => true,
361
- 'show-form-to-top' => false,
362
- 'contact-subject-status' => true,
363
- 'contact-subject-required' => true,
364
- 'contact-email' => 'E-mail *',
365
- 'contact-message' => 'Message *',
366
- 'contact-subject' => 'Subject *',
367
- 'contact-success-message' => 'Your message has been successfully sent.',
368
- 'contact-btn-title' => 'Contact',
369
- 'contact-validate-email' => 'Please enter a valid email.',
370
- 'contact-receive-email' => get_option('admin_email'),
371
- 'contact-fail-message' => 'Unable to send.'
372
- );
373
-
374
- $escKey = sgBoolToChecked($sgPopup['escKey']);
375
- $closeButton = sgBoolToChecked($sgPopup['closeButton']);
376
- $scrolling = sgBoolToChecked($sgPopup['scrolling']);
377
- $scaling = sgBoolToChecked($sgPopup['scaling']);
378
- $reposition = sgBoolToChecked($sgPopup['reposition']);
379
- $overlayClose = sgBoolToChecked($sgPopup['overlayClose']);
380
- $reopenAfterSubmission = sgBoolToChecked($sgPopup['reopenAfterSubmission']);
381
- $contentClick = sgBoolToChecked($sgPopup['contentClick']);
382
- $contentClickBehavior = $sgPopup['content-click-behavior'];
383
-
384
- $closeType = sgBoolToChecked($popupProDefaultValues['closeType']);
385
- $onScrolling = sgBoolToChecked($popupProDefaultValues['onScrolling']);
386
- $inActivityStatus = sgBoolToChecked($popupProDefaultValues['inActivityStatus']);
387
- $userSeperate = sgBoolToChecked($popupProDefaultValues['sg-user-status']);
388
- $forMobile = sgBoolToChecked($popupProDefaultValues['forMobile']);
389
- $openMobile = sgBoolToChecked($popupProDefaultValues['openMobile']);
390
- $popupTimerStatus = sgBoolToChecked($popupProDefaultValues['popup-timer-status']);
391
- $popupScheduleStatus = sgBoolToChecked($popupProDefaultValues['popup-schedule-status']);
392
- $repetPopup = sgBoolToChecked($popupProDefaultValues['repetPopup']);
393
- $disablePopup = sgBoolToChecked($popupProDefaultValues['disablePopup']);
394
- $disablePopupOverlay = sgBoolToChecked($popupProDefaultValues['disablePopupOverlay']);
395
- $autoClosePopup = sgBoolToChecked($popupProDefaultValues['autoClosePopup']);
396
- $fbStatus = sgBoolToChecked($popupProDefaultValues['fbStatus']);
397
- $twitterStatus = sgBoolToChecked($popupProDefaultValues['twitterStatus']);
398
- $emailStatus = sgBoolToChecked($popupProDefaultValues['emailStatus']);
399
- $linkedinStatus = sgBoolToChecked($popupProDefaultValues['linkedinStatus']);
400
- $googleStatus = sgBoolToChecked($popupProDefaultValues['googleStatus']);
401
- $pinterestStatus = sgBoolToChecked($popupProDefaultValues['pinterestStatus']);
402
- $socialLabel = sgBoolToChecked($popupProDefaultValues['sgSocialLabel']);
403
- $roundButtons = sgBoolToChecked($popupProDefaultValues['roundButtons']);
404
- $countdownAutoclose = sgBoolToChecked($popupProDefaultValues['countdown-autoclose']);
405
- $shareUrl = $popupProDefaultValues['sgShareUrl'];
406
- $pushToBottom = sgBoolToChecked($popupProDefaultValues['pushToBottom']);
407
- $allPages = $popupProDefaultValues['allPages'];
408
- $allPosts = $popupProDefaultValues['allPosts'];
409
- $allCustomPosts = $popupProDefaultValues['allCustomPosts'];
410
- $allPagesStatus = sgBoolToChecked($popupProDefaultValues['allPagesStatus']);
411
- $allPostsStatus = sgBoolToChecked($popupProDefaultValues['allPostsStatus']);
412
- $allCustomPostsStatus = sgBoolToChecked($popupProDefaultValues['allCustomPostsStatus']);
413
- $contactNameStatus = sgBoolToChecked($popupProDefaultValues['contact-name-status']);
414
- $showFormToTop = sgBoolToChecked($popupProDefaultValues['show-form-to-top']);
415
- $contactNameRequired = sgBoolToChecked($popupProDefaultValues['contact-name-required']);
416
- $contactSubjectStatus = sgBoolToChecked($popupProDefaultValues['contact-subject-status']);
417
- $contactSubjectRequired = sgBoolToChecked($popupProDefaultValues['contact-subject-required']);
418
- $saveCookiePageLevel = sgBoolToChecked($popupProDefaultValues['save-cookie-page-level']);
419
- $onceExpiresTime = $popupProDefaultValues['onceExpiresTime'];
420
- $popupAppearNumberLimit = $popupProDefaultValues['popup-appear-number-limit'];
421
- $countryStatus = sgBoolToChecked($popupProDefaultValues['countryStatus']);
422
- $allowCountries = $popupProDefaultValues['allowCountries'];
423
- $logedUser = $popupProDefaultValues['loggedin-user'];
424
- $countdownNumbersTextColor = $popupProDefaultValues['countdownNumbersTextColor'];
425
- $countdownNumbersBgColor = $popupProDefaultValues['countdownNumbersBgColor'];
426
- $countdownLang = $popupProDefaultValues['countDownLang'];
427
- $countdownPosition = $popupProDefaultValues['countdown-position'];
428
- $timeZone = $popupProDefaultValues['time-zone'];
429
- $dueDate = $popupProDefaultValues['due-date'];
430
- $popupStartTimer = $popupProDefaultValues['popup-start-timer'];
431
- $scheduleStartTime = $popupProDefaultValues['schedule-start-time'];
432
- $inactivityTimout = $popupProDefaultValues['inactivity-timout'];
433
- $exitIntentType = $popupProDefaultValues['exit-intent-type'];
434
- $exitIntentExpireTime = $popupProDefaultValues['exit-intent-expire-time'];
435
- $subsFirstNameStatus = sgBoolToChecked($popupProDefaultValues['subs-first-name-status']);
436
- $subsLastNameStatus = sgBoolToChecked($popupProDefaultValues['subs-last-name-status']);
437
- $subscriptionEmail = $popupProDefaultValues['subscription-email'];
438
- $subsFirstName = $popupProDefaultValues['subs-first-name'];
439
- $subsLastName = $popupProDefaultValues['subs-last-name'];
440
- $subsButtonBgcolor = $popupProDefaultValues['subs-button-bgcolor'];
441
- $subsButtonColor = $popupProDefaultValues['subs-button-color'];
442
- $subsInputsColor = $popupProDefaultValues['subs-inputs-color'];
443
- $subsBtnTitle = $popupProDefaultValues['subs-btn-title'];
444
- $subsPlaceholderColor = $popupProDefaultValues['subs-placeholder-color'];
445
- $subsTextHeight = $popupProDefaultValues['subs-text-height'];
446
- $subsBtnHeight = $popupProDefaultValues['subs-btn-height'];
447
- $subsSuccessMessage = $popupProDefaultValues['subs-success-message'];
448
- $subsValidationMessage = $popupProDefaultValues['subs-validation-message'];
449
- $subsTextWidth = $popupProDefaultValues['subs-text-width'];
450
- $subsBtnWidth = $popupProDefaultValues['subs-btn-width'];
451
- $subsDontShowAfterSubmitting = $popupProDefaultValues['subs-dont-show-after-submitting'];
452
- $subsBtnProgressTitle = $popupProDefaultValues['subs-btn-progress-title'];
453
- $subsTextBorderWidth = $popupProDefaultValues['subs-text-border-width'];
454
- $subsTextBordercolor = $popupProDefaultValues['subs-text-bordercolor'];
455
- $subsTextInputBgcolor = $popupProDefaultValues['subs-text-input-bgcolor'];
456
- $contactName = $popupProDefaultValues['contact-name'];
457
- $contactEmail = $popupProDefaultValues['contact-email'];
458
- $contactMessage = $popupProDefaultValues['contact-message'];
459
- $contactSubject = $popupProDefaultValues['contact-subject'];
460
- $contactSuccessMessage = $popupProDefaultValues['contact-success-message'];
461
- $contactBtnTitle = $popupProDefaultValues['contact-btn-title'];
462
- $contactValidateEmail = $popupProDefaultValues['contact-validate-email'];
463
- $contactResiveEmail = $popupProDefaultValues['contact-receive-email'];
464
- $contactFailMessage = $popupProDefaultValues['contact-fail-message'];
465
- $overlayCustomClasss = $popupProDefaultValues['overlay-custom-classs'];
466
- $contentCustomClasss = $popupProDefaultValues['content-custom-classs'];
467
- $redirectToNewTab = $popupProDefaultValues['redirect-to-new-tab'];
468
-
469
- function sgBoolToChecked($var)
470
- {
471
- return ($var?'checked':'');
472
- }
473
-
474
- function sgRemoveOption($option)
475
- {
476
- global $removeOptions;
477
- return isset($removeOptions[$option]);
478
  }
479
 
480
- $width = $sgPopup['width'];
481
- $height = $sgPopup['height'];
482
- $opacityValue = $sgPopup['opacity'];
483
- $top = $sgPopup['top'];
484
- $right = $sgPopup['right'];
485
- $bottom = $sgPopup['bottom'];
486
- $left = $sgPopup['left'];
487
- $initialWidth = $sgPopup['initialWidth'];
488
- $initialHeight = $sgPopup['initialHeight'];
489
- $maxWidth = $sgPopup['maxWidth'];
490
- $maxHeight = $sgPopup['maxHeight'];
491
- $deafultFixed = $sgPopup['fixed'];
492
- $defaultDuration = $sgPopup['duration'];
493
- $defaultDelay = $sgPopup['delay'];
494
- $themeCloseText = $sgPopup['theme-close-text'];
495
-
496
- $sgCloseButton = @sgSetChecked($sgCloseButton, $closeButton);
497
- $sgEscKey = @sgSetChecked($sgEscKey, $escKey);
498
- $sgContentClick = @sgSetChecked($sgContentClick, $contentClick);
499
- $sgOverlayClose = @sgSetChecked($sgOverlayClose, $overlayClose);
500
- $sgReopenAfterSubmission = @sgSetChecked($sgReopenAfterSubmission, $reopenAfterSubmission);
501
- $sgReposition = @sgSetChecked($sgReposition, $reposition);
502
- $sgScrolling = @sgSetChecked($sgScrolling, $scrolling);
503
- $sgScaling = @sgSetChecked($sgScaling, $scaling);
504
- $sgCountdownAutoclose = @sgSetChecked($sgCountdownAutoclose, $countdownAutoclose);
505
-
506
- $sgCloseType = @sgSetChecked($sgCloseType, $closeType);
507
- $sgOnScrolling = @sgSetChecked($sgOnScrolling, $onScrolling);
508
- $sgInActivityStatus = @sgSetChecked($sgInActivityStatus, $inActivityStatus);
509
- $sgForMobile = @sgSetChecked($sgForMobile, $forMobile);
510
- $sgOpenOnMobile = @sgSetChecked($sgOpenOnMobile, $openMobile);
511
- $sgPopupCookiePageLevel = @sgSetChecked($sgPopupCookiePageLevel, $saveCookiePageLevel);
512
- $sgUserSeperate = @sgSetChecked($sgUserSeperate, $userSeperate);
513
- $sgPopupTimerStatus = @sgSetChecked($sgPopupTimerStatus, $popupTimerStatus);
514
- $sgPopupScheduleStatus = @sgSetChecked($sgPopupScheduleStatus, $popupScheduleStatus);
515
- $sgRepeatPopup = @sgSetChecked($sgRepeatPopup, $repetPopup);
516
- $sgDisablePopup = @sgSetChecked($sgDisablePopup, $disablePopup);
517
- $sgDisablePopupOverlay = @sgSetChecked($sgDisablePopupOverlay, $disablePopupOverlay);
518
- $sgAutoClosePopup = @sgSetChecked($sgAutoClosePopup, $autoClosePopup);
519
- $sgFbStatus = @sgSetChecked($sgFbStatus, $fbStatus);
520
- $sgTwitterStatus = @sgSetChecked($sgTwitterStatus, $twitterStatus);
521
- $sgEmailStatus = @sgSetChecked($sgEmailStatus, $emailStatus);
522
- $sgLinkedinStatus = @sgSetChecked($sgLinkedinStatus, $linkedinStatus);
523
- $sgGoogleStatus = @sgSetChecked($sgGoogleStatus, $googleStatus);
524
- $sgPinterestStatus = @sgSetChecked($sgPinterestStatus, $pinterestStatus);
525
- $sgRoundButtons = @sgSetChecked($sgRoundButton, $roundButtons);
526
- $sgSocialLabel = @sgSetChecked($sgSocialLabel, $socialLabel);
527
- $sgPopupFixed = @sgSetChecked($sgPopupFixed, $deafultFixed);
528
- $sgPushToBottom = @sgSetChecked($sgPushToBottom, $pushToBottom);
529
-
530
- $sgAllPagesStatus = @sgSetChecked($sgAllPagesStatus, $allPagesStatus);
531
- $sgAllPostsStatus = @sgSetChecked($sgAllPostsStatus, $allPostsStatus);
532
- $sgAllCustomPostsStatus = @sgSetChecked($sgAllCustomPostsStatus, $allCustomPostsStatus);
533
- $sgCountdownPosition = @sgSetChecked($sgCountdownPosition, $countdownPosition);
534
- $sgVideoAutoplay = @sgSetChecked($sgVideoAutoplay, $videoAutoplay);
535
- $sgSubsLastNameStatus = @sgSetChecked($sgSubsLastNameStatus, $subsLastNameStatus);
536
- $sgSubsFirstNameStatus = @sgSetChecked($sgSubsFirstNameStatus, $subsFirstNameStatus);
537
- $sgSubsDontShowAfterSubmitting = @sgSetChecked($sgSubsDontShowAfterSubmitting, $subsDontShowAfterSubmitting);
538
- $sgCountryStatus = @sgSetChecked($sgCountryStatus, $countryStatus);
539
- /* Contact popup otions */
540
- $sgContactNameStatus = @sgSetChecked($sgContactNameStatus, $contactNameStatus);
541
- $sgContactNameRequired = @sgSetChecked($sgContactNameRequired, $contactNameRequired);
542
- $sgContactSubjectStatus = @sgSetChecked($sgContactSubjectStatus, $contactSubjectStatus);
543
- $sgContactSubjectRequired = @sgSetChecked($sgContactSubjectRequired, $contactSubjectRequired);
544
- $sgShowFormToTop = @sgSetChecked($sgShowFormToTop, $showFormToTop);
545
- $sgRedirectToNewTab = @sgSetChecked($sgRedirectToNewTab, $redirectToNewTab);
546
-
547
- function sgSetChecked($optionsParam,$defaultOption)
548
- {
549
- if (isset($optionsParam)) {
550
- if ($optionsParam == '') {
551
- return '';
552
- }
553
- else {
554
- return 'checked';
555
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  }
557
  else {
558
- return $defaultOption;
559
  }
560
  }
561
-
562
- $sgOpacity = @sgGetValue($sgOpacity, $opacityValue);
563
- $sgWidth = @sgGetValue($sgWidth, $width);
564
- $sgHeight = @sgGetValue($sgHeight, $height);
565
- $sgInitialWidth = @sgGetValue($sgInitialWidth, $initialWidth);
566
- $sgInitialHeight = @sgGetValue($sgInitialHeight, $initialHeight);
567
- $sgMaxWidth = @sgGetValue($sgMaxWidth, $maxWidth);
568
- $sgMaxHeight = @sgGetValue($sgMaxHeight, $maxHeight);
569
- $sgThemeCloseText = @sgGetValue($sgThemeCloseText, $themeCloseText);
570
- $duration = @sgGetValue($duration, $defaultDuration);
571
- $sgOnceExpiresTime = @sgGetValue($sgOnceExpiresTime, $onceExpiresTime);
572
- $sgPopupAppearNumberLimit = @sgGetValue($sgPopupAppearNumberLimit, $popupAppearNumberLimit);
573
- $delay = @sgGetValue($delay, $defaultDelay);
574
- $sgInactivityTimout = @sgGetValue($sgInactivityTimout, $inactivityTimout);
575
- $sgContentClickBehavior = @sgGetValue($sgContentClickBehavior, $contentClickBehavior);
576
- $sgPopupStartTimer = @sgGetValue($sgPopupStartTimer, $popupStartTimer);
577
- $sgPopupFinishTimer = @sgGetValue($sgPopupFinishTimer, '');
578
- $sgPopupScheduleStartTime = @sgGetValue($sgPopupScheduleStartTime, $scheduleStartTime);
579
- $sgPopupDataIframe = @sgGetValue($sgPopupDataIframe, 'http://');
580
- $sgShareUrl = @sgGetValue($sgShareUrl, $shareUrl);
581
- $sgPopupDataHtml = @sgGetValue($sgPopupDataHtml, '');
582
- $sgPopupDataImage = @sgGetValue($sgPopupDataImage, '');
583
- $sgAllowCountries = @sgGetValue($sgAllowCountries, $allowCountries);
584
- $sgAllPages = @sgGetValue($sgAllPages, $allPages);
585
- $sgAllPosts = @sgGetValue($sgAllPosts, $allPosts);
586
- $sgAllCustomPosts = @sgGetValue($sgAllCustomPosts, $allCustomPosts);
587
- $sgLogedUser = @sgGetValue($sgLogedUser, $logedUser);
588
- $sgCountdownNumbersTextColor = @sgGetValue($sgCountdownNumbersTextColor, $countdownNumbersTextColor);
589
- $sgCountdownNumbersBgColor = @sgGetValue($sgCountdownNumbersBgColor, $countdownNumbersBgColor);
590
- $sgCountdownLang = @sgGetValue($sgCountdownLang, $countdownLang);
591
- $sgSelectedTimeZone = @sgGetValue($sgSelectedTimeZone, $timeZone);
592
- $sgDueDate = @sgGetValue($sgDueDate, $dueDate);
593
- $sgExitIntentTpype = @sgGetValue($sgExitIntentTpype, $exitIntentType);
594
- $sgExitIntntExpire = @sgGetValue($sgExitIntntExpire, $exitIntentExpireTime);
595
- $sgSubsTextWidth = @sgGetValue($sgSubsTextWidth, $subsTextWidth);
596
- $sgSubsBtnWidth = @sgGetValue($sgSubsBtnWidth, $subsBtnWidth);
597
- $sgSubsTextInputBgcolor = @sgGetValue($sgSubsTextInputBgcolor, $subsTextInputBgcolor);
598
- $sgSubsButtonBgcolor = @sgGetValue($sgSubsButtonBgcolor, $subsButtonBgcolor);
599
- $sgSubsTextBordercolor = @sgGetValue($sgSubsTextBordercolor, $subsTextBordercolor);
600
- $sgSubscriptionEmail = @sgGetValue($sgSubscriptionEmail, $subscriptionEmail);
601
- $sgSubsFirstName = @sgGetValue($sgSubsFirstName, $subsFirstName);
602
- $sgSubsLastName = @sgGetValue($sgSubsLastName, $subsLastName);
603
- $sgSubsButtonColor = @sgGetValue($sgSubsButtonColor, $subsButtonColor);
604
- $sgSubsInputsColor = @sgGetValue($sgSubsInputsColor, $subsInputsColor);
605
- $sgSubsBtnTitle = @sgGetValue($sgSubsBtnTitle, $subsBtnTitle);
606
- $sgSubsPlaceholderColor = @sgGetValue($sgSubsPlaceholderColor, $subsPlaceholderColor);
607
- $sgSubsTextHeight = @sgGetValue($sgSubsTextHeight, $subsTextHeight);
608
- $sgSubsBtnHeight = @sgGetValue($sgSubsBtnHeight, $subsBtnHeight);
609
- $sgSuccessMessage = @sgGetValue($sgSuccessMessage, $subsSuccessMessage);
610
- $sgSubsValidateMessage = @sgGetValue($sgSubsValidateMessage, $subsValidationMessage);
611
- $sgSubsBtnProgressTitle = @sgGetValue($sgSubsBtnProgressTitle, $subsBtnProgressTitle);
612
- $sgSubsTextBorderWidth = @sgGetValue($sgSubsTextBorderWidth, $subsTextBorderWidth);
613
- $sgContactNameLabel = @sgGetValue($sgContactNameLabel, $contactName);
614
- $sgContactSubjectLabel = @sgGetValue($sgContactSubjectLabel, $contactSubject);
615
- $sgContactEmailLabel = @sgGetValue($sgContactEmailLabel, $contactEmail);
616
- $sgContactMessageLabel = @sgGetValue($sgContactMessageLabel, $contactMessage);
617
- $sgContactValidationMessage = @sgGetValue($sgContactValidationMessage, $subsValidationMessage);
618
- $sgContactSuccessMessage = @sgGetValue($sgContactSuccessMessage, $contactSuccessMessage);
619
- $sgContactInputsWidth = @sgGetValue($sgContactInputsWidth, $subsTextWidth);
620
- $sgContactInputsHeight = @sgGetValue($sgContactInputsHeight, $subsTextHeight);
621
- $sgContactInputsBorderWidth = @sgGetValue($sgContactInputsBorderWidth, $subsTextBorderWidth);
622
- $sgContactTextInputBgcolor = @sgGetValue($sgContactTextInputBgcolor, $subsTextInputBgcolor);
623
- $sgContactTextBordercolor = @sgGetValue($sgContactTextBordercolor, $subsTextBordercolor);
624
- $sgContactInputsColor = @sgGetValue($sgContactInputsColor, $subsInputsColor);
625
- $sgContactPlaceholderColor = @sgGetValue($sgContactPlaceholderColor, $subsPlaceholderColor);
626
- $sgContactBtnWidth = @sgGetValue($sgContactBtnWidth, $subsBtnWidth);
627
- $sgContactBtnHeight = @sgGetValue($sgContactBtnHeight, $subsBtnHeight);
628
- $sgContactBtnTitle = @sgGetValue($sgContactBtnTitle, $contactBtnTitle);
629
- $sgContactBtnProgressTitle = @sgGetValue($sgContactBtnProgressTitle, $subsBtnProgressTitle);
630
- $sgContactButtonBgcolor = @sgGetValue($sgContactButtonBgcolor, $subsButtonBgcolor);
631
- $sgContactButtonColor = @sgGetValue($sgContactButtonColor, $subsButtonColor);
632
- $sgContactAreaWidth = @sgGetValue($sgContactAreaWidth, $subsTextWidth);
633
- $sgContactAreaHeight = @sgGetValue($sgContactAreaHeight, '');
634
- $sgContactValidateEmail = @sgGetValue($sgContactValidateEmail, $contactValidateEmail);
635
- $sgContactResiveEmail = @sgGetValue($sgContactResiveEmail, $contactResiveEmail);
636
- $sgContactFailMessage = @sgGetValue($sgContactFailMessage, $contactFailMessage);
637
- $sgOverlayCustomClasss = @sgGetValue($sgOverlayCustomClasss, $overlayCustomClasss);
638
- $sgContentCustomClasss = @sgGetValue($sgContentCustomClasss, $contentCustomClasss);
639
- $sgAllSelectedPages = @sgGetValue($sgAllSelectedPages, array());
640
- $sgAllSelectedPosts = @sgGetValue($sgAllSelectedPosts, array());
641
- $sgAllSelectedCustomPosts = @sgGetValue($sgAllSelectedCustomPosts, array());
642
-
643
- function sgGetValue($getedVal,$defValue)
644
- {
645
- if (!isset($getedVal)) {
646
- return $defValue;
647
- }
648
- else {
649
- return $getedVal;
650
- }
 
651
  }
 
 
 
 
652
 
653
- $radioElements = array(
654
- array(
655
- 'name'=>'shareUrlType',
656
- 'value'=>'activeUrl',
657
- 'additionalHtml'=>''.'<span>'.'Use active URL'.'</span></span>
658
  <span class="span-width-static"></span><span class="dashicons dashicons-info scrollingImg sameImageStyle sg-active-url"></span><span class="info-active-url samefontStyle">If this option is active Share URL will be current page URL.</span>'
659
- ),
660
- array(
661
- 'name'=>'shareUrlType',
662
- 'value'=>'shareUrl',
663
- 'additionalHtml'=>''.'<span>'.'Share url'.'</span></span>'.' <input class="input-width-static sg-active-url" type="text" name="sgShareUrl" value="'.@$sgShareUrl.'">'
664
- )
665
- );
666
-
667
- $countriesRadio = array(
668
- array(
669
- 'name'=>'allowCountries',
670
- 'value'=>'allow',
671
- 'additionalHtml'=>'<span class="countries-radio-text allow-countries">Allow</span>',
672
- 'newline' => false
673
- ),
674
- array(
675
- 'name'=>'allowCountries',
676
- 'value'=>'disallow',
677
- 'additionalHtml'=>'<span class="countries-radio-text">Disallow</span>',
678
- 'newline' => true
679
- )
680
- );
681
-
682
- $usersGroup = array(
683
- array(
684
- 'name'=>'loggedin-user',
685
- 'value'=>'true',
686
- 'additionalHtml'=>'<span class="countries-radio-text allow-countries">logged in</span>',
687
- 'newline' => false
688
- ),
689
- array(
690
- 'name'=>'loggedin-user',
691
- 'value'=>'false',
692
- 'additionalHtml'=>'<span class="countries-radio-text">not logged in</span>',
693
- 'newline' => true
694
- )
695
- );
696
-
697
- function sgCreateRadioElements($radioElements,$checkedValue)
698
- {
699
- $content = '';
700
- for ($i = 0; $i < count($radioElements); $i++) {
701
- $checked = '';
702
- $radioElement = @$radioElements[$i];
703
- $name = @$radioElement['name'];
704
- $label = @$radioElement['label'];
705
- $value = @$radioElement['value'];
706
- $additionalHtml = @$radioElement['additionalHtml'];
707
- if ($checkedValue == $value) {
708
- $checked = 'checked';
709
- }
710
- $content .= '<span class="liquid-width"><input class="radio-btn-fix" type="radio" name="'.$name.'" value="'.$value.'" '.$checked.'>';
711
- $content .= $additionalHtml."<br>";
712
  }
713
- return $content;
 
714
  }
715
-
716
- $contentClickOptions = array(
717
- array(
718
- "title" => "Close Popup:",
719
- "value" => "close",
720
- "info" => ""
721
- ),
722
- array(
723
- "title" => "Redirect:",
724
- "value" => "redirect",
725
- "info" => ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
726
  )
727
- );
728
-
729
- $pagesRadio = array(
730
- array(
731
- "title" => "Show on all pages:",
732
- "value" => "all",
733
- "info" => ""
734
- ),
735
- array(
736
- "title" => "Show on selected pages:",
737
- "value" => "selected",
738
- "info" => "",
739
- "data-attributes" => array(
740
- "data-name" => SG_POST_TYPE_PAGE,
741
- "data-popupid" => $dataPopupId,
742
- "data-loading-number" => 0,
743
- "data-selectbox-role" => "js-all-pages"
744
- )
745
  )
746
- );
747
-
748
- $postsRadio = array(
749
- array(
750
- "title" => "Show on all posts:",
751
- "value" => "all",
752
- "info" => ""
753
- ),
754
- array(
755
- "title" => "Show on selected post:",
756
- "value" => "selected",
757
- "info" => "",
758
- "data-attributes" => array(
759
- "data-name" => SG_POST_TYPE_POST,
760
- "data-popupid" => $dataPopupId,
761
- "data-loading-number" => 0,
762
- "data-selectbox-role" => "js-all-posts"
763
- )
764
-
765
- ),
766
- array(
767
- "title" => "Show on selected categories",
768
- "value" => "allCategories",
769
- "info" => "",
770
- "data-attributes" => array(
771
- "class" => 'js-all-categories'
772
- )
773
  )
774
- );
775
-
776
- $customPostsRadio = array(
777
- array(
778
- "title" => "Show on all custom posts:",
779
- "value" => "all",
780
- "info" => ""
781
- ),
782
- array(
783
- "title" => "Show on selected custom post:",
784
- "value" => "selected",
785
- "info" => "",
786
- "data-attributes" => array(
787
- "data-name" => 'allCustomPosts',
788
- "data-popupid" => $dataPopupId,
789
- "data-loading-number" => 0,
790
- "data-selectbox-role" => "js-all-custom-posts"
791
- )
792
-
793
  )
794
- );
795
-
796
- $radiobuttons = array(
797
- array(
798
- "title" => "Soft mode:",
799
- "value" => "soft",
800
- "info" => "<span class=\"dashicons dashicons-info repositionImg sameImageStyle\"></span>
801
- <span class='infoReposition samefontStyle'>
802
- If the user navigate away from the site the popup will appear.
803
- </span>"
804
- ),
805
- array(
806
- "title" => "Aggressive mode:",
807
- "value" => "aggressive",
808
- "info" => "<span class=\"dashicons dashicons-info repositionImg sameImageStyle\"></span>
809
- <span class='infoReposition samefontStyle'>
810
- If the user try to navigate elsewhere he/she will be interrupted and forced to read the message and choose to leave or stay.
811
- After the alert box popup will appear.
812
- </span>"
813
- ),
814
- array(
815
- "title" => "Soft and Aggressive modes:",
816
- "value" => "softAndAgressive",
817
- "info" => "<span class=\"dashicons dashicons-info repositionImg sameImageStyle\"></span>
818
- <span class='infoReposition samefontStyle'>
819
- This will enable the both modes. Depends which action will be triggered first.
820
- </span>"
821
- ),
822
- array(
823
- "title" => "Aggressive without popup:",
824
- "value" => "agresiveWithoutPopup",
825
- "info" => "<span class='dashicons dashicons-info repositionImg sameImageStyle'></span>
826
- <span class='infoReposition samefontStyle'>
827
- Tha same as aggressive mode but without a popup.
828
- </span>"
829
- ),
830
-
831
- );
832
-
833
-
834
- function createRadiobuttons($elements, $name, $newLine, $selectedInput, $class)
835
- {
836
- $str = "";
837
-
838
- foreach ($elements as $key => $element) {
839
- $breakLine = "";
840
- $infoIcon = "";
841
- $title = "";
842
- $value = "";
843
- $infoIcon = "";
844
- $checked = "";
845
-
846
- if(isset($element["title"])) {
847
- $title = $element["title"];
848
- }
849
- if(isset($element["value"])) {
850
- $value = $element["value"];
851
- }
852
- if($newLine) {
853
- $breakLine = "<br>";
854
- }
855
- if(isset($element["info"])) {
856
- $infoIcon = $element['info'];
857
- }
858
- if($element["value"] == $selectedInput) {
859
- $checked = "checked";
860
- }
861
- $attrStr = '';
862
- if(isset($element['data-attributes'])) {
863
- foreach ($element['data-attributes'] as $key => $dataValue) {
864
- $attrStr .= $key.'="'.$dataValue.'" ';
865
- }
866
- }
867
-
868
- $str .= "<span class=".$class.">".$element['title']."</span>
869
- <input type=\"radio\" name=".$name." ".$attrStr." value=".$value." $checked>".$infoIcon.$breakLine;
870
- }
871
 
872
- echo $str;
873
- }
874
 
875
- $sgPopupEffects = array(
876
- 'No effect' => 'No Effect',
877
- 'flip' => 'flip',
878
- 'shake' => 'shake',
879
- 'wobble' => 'wobble',
880
- 'swing' => 'swing',
881
- 'flash' => 'flash',
882
- 'bounce' => 'bounce',
883
- 'bounceIn' => 'bounceIn',
884
- 'pulse' => 'pulse',
885
- 'rubberBand' => 'rubberBand',
886
- 'tada' => 'tada',
887
- 'slideInUp' => 'slideInUp',
888
- 'jello' => 'jello',
889
- 'rotateIn' => 'rotateIn',
890
- 'fadeIn' => 'fadeIn'
891
- );
892
-
893
- $sgPopupTheme = array(
894
- 'colorbox1.css',
895
- 'colorbox2.css',
896
- 'colorbox3.css',
897
- 'colorbox4.css',
898
- 'colorbox5.css',
899
- 'colorbox6.css'
900
- );
901
-
902
- $sgFbLikeButtons = array(
903
- 'standard' => 'Standard',
904
- 'box_count' => 'Box with count',
905
- 'button_count' => 'Button with count',
906
- 'button' => 'Button'
907
- );
908
-
909
- $sgTheme = array(
910
- 'flat' => 'flat',
911
- 'classic' => 'classic',
912
- 'minima' => 'minima',
913
- 'plain' => 'plain'
914
- );
915
-
916
- $sgThemeSize = array(
917
- '8' => '8',
918
- '10' => '10',
919
- '12' => '12',
920
- '14' => '14',
921
- '16' => '16',
922
- '18' => '18',
923
- '20' => '20',
924
- '24' => '24'
925
- );
926
-
927
- $sgSocialCount = array(
928
- 'true' => 'True',
929
- 'false' => 'False',
930
- 'inside' => 'Inside'
931
- );
932
-
933
- $sgCountdownType = array(
934
- 1 => 'DD:HH:MM:SS',
935
- 2 => 'DD:HH:MM'
936
- );
937
-
938
- $sgCountdownlang = array(
939
- 'English' => 'English',
940
- 'German' => 'German',
941
- 'Spanish' => 'Spanish',
942
- 'Arabic' => 'Arabic',
943
- 'Italian' => 'Italian',
944
- 'Italian' => 'Italian',
945
- 'Dutch' => 'Dutch',
946
- 'Norwegian' => 'Norwegian',
947
- 'Portuguese' => 'Portuguese',
948
- 'Russian' => 'Russian',
949
- 'Swedish' => 'Swedish',
950
- 'Chinese' => 'Chinese'
951
- );
952
-
953
- $sgExitIntentSelectOptions = array(
954
- "perSesion" => "per Session",
955
- "1" => "per minute",
956
- "10080" => "per 7 days",
957
- "43200" => "per month",
958
- "always" => "always"
959
- );
960
- $sgTextAreaResizeOptions = array(
961
- 'both' => 'Both',
962
- 'horizontal' => 'Horizontal',
963
- 'vertical' => 'Vertical',
964
- 'none' => 'None',
965
- 'inherit' => 'Inherit'
966
- );
967
-
968
- $sgWeekDaysArray = array(
969
- 'Mon' => 'Monday',
970
- 'Tue' => 'Tuesday',
971
- 'Wed' => 'Wendnesday',
972
- 'Thu' => 'Thursday',
973
- 'Fri' => 'Friday',
974
- 'Sat' => 'Saturday',
975
- 'Sun' => 'Sunday'
976
- );
977
-
978
- if (POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) {
979
- require_once(SG_APP_POPUP_FILES ."/sg_params_arrays.php");
980
- }
981
 
982
- function sgCreateSelect($options,$name,$selecteOption)
983
- {
984
- $selected ='';
985
- $str = "";
 
 
986
  $checked = "";
987
- if ($name == 'theme' || $name == 'restrictionAction') {
988
-
989
- $popup_style_name = 'popup_theme_name';
990
- $firstOption = array_shift($options);
991
- $i = 1;
992
- foreach ($options as $key) {
993
- $checked ='';
994
-
995
- if ($key == $selecteOption) {
996
- $checked = "checked";
997
- }
998
- $i++;
999
- $str .= "<input type='radio' name=\"$name\" value=\"$key\" $checked class='popup_theme_name' sgPoupNumber=".$i.">";
1000
-
1001
- }
1002
- if ($checked == ''){
1003
- $checked = "checked";
1004
- }
1005
- $str = "<input type='radio' name=\"$name\" value=\"".$firstOption."\" $checked class='popup_theme_name' sgPoupNumber='1'>".$str;
1006
- return $str;
1007
  }
1008
- else {
1009
- @$popup_style_name = ($popup_style_name) ? $popup_style_name : '';
1010
- $str .= "<select name=$name class=$popup_style_name input-width-static >";
1011
- foreach ($options as $key=>$option) {
1012
- if ($key == $selecteOption) {
1013
- $selected = "selected";
1014
- }
1015
- else {
1016
- $selected ='';
1017
- }
1018
- $str .= "<option value='".$key."' ".$selected." >$option</potion>";
 
 
 
 
 
1019
  }
1020
-
1021
- $str .="</select>" ;
1022
- return $str;
1023
-
1024
  }
1025
 
 
 
1026
  }
1027
-
1028
- if(!SG_SHOW_POPUP_REVIEW) {
1029
- echo SGFunctions::addReview();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1030
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1031
 
1032
- if (isset($_GET['saved']) && $_GET['saved']==1) {
1033
- echo '<div id="default-message" class="updated notice notice-success is-dismissible" ><p>Popup updated.</p></div>';
1034
  }
1035
- if (isset($_GET["titleError"])): ?>
1036
- <div class="error notice" id="title-error-message">
1037
- <p>Invalid Title</p>
1038
- </div>
1039
- <?php endif; ?>
1040
- <form method="POST" action="<?php echo SG_APP_POPUP_ADMIN_URL;?>admin-post.php" id="add-form">
1041
- <input type="hidden" name="action" value="<?php echo $currentActionName;?>">
1042
- <div class="crud-wrapper">
1043
- <div class="cereate-title-wrapper">
1044
- <div class="sg-title-crud">
1045
- <?php if (isset($id)): ?>
1046
- <h2>Edit popup</h2>
1047
- <?php else: ?>
1048
- <h2>Create new popup</h2>
1049
- <?php endif; ?>
1050
- </div>
1051
- <div class="button-wrapper">
1052
- <p class="submit">
1053
- <?php if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
1054
- <input class="crud-to-pro" type="button" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL;?>')"><div class="clear"></div>
 
 
 
 
 
 
 
 
 
 
1055
  <?php endif; ?>
1056
- <input type="submit" id="sg-save-button" class="button-primary" value="<?php echo 'Save Changes'; ?>">
1057
- </p>
1058
- </div>
1059
- </div>
1060
- <div class="clear"></div>
1061
- <div class="general-wrapper">
1062
- <div id="titlediv">
1063
- <div id="titlewrap">
1064
- <input id="title" class="sg-js-popup-title" type="text" name="title" size="30" value="<?php echo esc_attr(@$title)?>" spellcheck="true" autocomplete="off" required = "required" placeholder='Enter title here'>
1065
- </div>
1066
- </div>
1067
- <div id="left-main-div">
1068
- <div id="sg-general">
1069
- <div id="post-body" class="metabox-holder columns-2">
1070
- <div id="postbox-container-2" class="postbox-container">
1071
- <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1072
- <div class="postbox popupBuilder_general_postbox sgSameWidthPostBox" style="display: block;">
1073
- <div class="handlediv generalTitle" title="Click to toggle"><br></div>
1074
- <h3 class="hndle ui-sortable-handle generalTitle" style="cursor: pointer"><span>General</span></h3>
1075
- <div class="generalContent sgSameWidthPostBox">
1076
- <?php require_once($popupFilesPath."/main_section/".$popupType.".php");?>
1077
- <input type="hidden" name="type" value="<?php echo $popupType;?>">
1078
- <span class="liquid-width" id="theme-span">Popup theme:</span>
1079
- <?php echo sgCreateSelect($sgPopupTheme,'theme',esc_html(@$sgColorboxTheme));?>
1080
- <div class="theme1 sg-hide"></div>
1081
- <div class="theme2 sg-hide"></div>
1082
- <div class="theme3 sg-hide"></div>
1083
- <div class="theme4 sg-hide"></div>
1084
- <div class="theme5 sg-hide"></div>
1085
- <div class="theme6 sg-hide"></div>
1086
- <div class="sg-popup-theme-3 themes-suboptions sg-hide">
1087
- <span class="liquid-width">Border color:</span>
1088
- <div id="color-picker"><input class="sgOverlayColor" id="sgOverlayColor" type="text" name="sgTheme3BorderColor" value="<?php echo esc_attr(@$sgTheme3BorderColor); ?>" /></div>
1089
- <br><span class="liquid-width">Border radius:</span>
1090
- <input class="input-width-percent" type="number" min="0" max="50" name="sgTheme3BorderRadius" value="<?php echo esc_attr(@$sgTheme3BorderRadius); ?>">
1091
- <span class="span-percent">%</span>
1092
- </div>
1093
- <div class="sg-popup-theme-4 themes-suboptions sg-hide">
1094
- <span class="liquid-width">Close button text:</span>
1095
- <input type="text" name="theme-close-text" value="<?php echo esc_attr($sgThemeCloseText);?>">
1096
- </div>
1097
- </div>
1098
- </div>
1099
-
1100
- </div>
1101
- </div>
1102
- </div>
1103
- </div>
1104
- <div id="effect">
1105
- <div id="post-body" class="metabox-holder columns-2">
1106
- <div id="postbox-container-2" class="postbox-container">
1107
- <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1108
- <div class="postbox popupBuilder_effect_postbox sgSameWidthPostBox" style="display: block;">
1109
- <div class="handlediv effectTitle" title="Click to toggle"><br></div>
1110
- <h3 class="hndle ui-sortable-handle effectTitle" style="cursor: pointer"><span>Effects</span></h3>
1111
- <div class="effectsContent">
1112
- <span class="liquid-width">Effect type:</span>
1113
- <?php echo sgCreateSelect($sgPopupEffects,'effect',esc_html(@$effect));?>
1114
- <span class="js-preview-effect"></span>
1115
- <div class="effectWrapper"><div id="effectShow" ></div></div>
1116
-
1117
- <span class="liquid-width">Effect duration:</span>
1118
- <input class="input-width-static" type="text" name="duration" value="<?php echo esc_attr($duration); ?>" pattern = "\d+" title="It must be number" /><span class="dashicons dashicons-info contentClick infoImageDuration sameImageStyle"></span><span class="infoDuration samefontStyle">Specify how long the popup appearance animation should take (in sec).</span></br>
1119
-
1120
- <span class="liquid-width">Popup opening delay:</span>
1121
- <input class="input-width-static" type="text" name="delay" value="<?php echo esc_attr($delay);?>" pattern = "\d+" title="It must be number"/><span class="dashicons dashicons-info contentClick infoImageDelay sameImageStyle"></span><span class="infoDelay samefontStyle">Specify how long the popup appearance should be delayed after loading the page (in sec).</span></br>
1122
- </div>
1123
- </div>
1124
-
1125
- </div>
1126
- </div>
1127
- </div>
1128
- </div>
1129
- <?php require_once($popupFilesPath."/options_section/".$popupType.".php");?>
1130
- </div>
1131
- <div id="right-main-div">
1132
- <div id="right-main">
1133
- <div id="dimentions">
1134
- <div id="post-body" class="metabox-holder columns-2">
1135
- <div id="postbox-container-2" class="postbox-container">
1136
- <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1137
- <div class="postbox popupBuilder_dimention_postbox sgSameWidthPostBox" style="display: block;">
1138
- <div class="handlediv dimentionsTitle" title="Click to toggle"><br></div>
1139
- <h3 class="hndle ui-sortable-handle dimentionsTitle" style="cursor: pointer"><span>Dimensions</span></h3>
1140
- <div class="dimensionsContent">
1141
- <span class="liquid-width">Width:</span>
1142
- <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>
1143
- <span class="liquid-width">Height:</span>
1144
- <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>
1145
- <span class="liquid-width">Max width:</span>
1146
- <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>
1147
- <span class="liquid-width">Max height:</span>
1148
- <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>
1149
- <span class="liquid-width">Initial width:</span>
1150
- <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>
1151
- <span class="liquid-width">Initial height:</span>
1152
- <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>
1153
- </div>
1154
- </div>
1155
-
1156
- </div>
1157
- </div>
1158
- </div>
1159
- </div>
1160
- <div id="options">
1161
- <div id="post-body" class="metabox-holder columns-2">
1162
- <div id="postbox-container-2" class="postbox-container">
1163
- <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1164
- <div class="postbox popupBuilder_options_postbox sgSameWidthPostBox" style="display: block;">
1165
- <div class="handlediv optionsTitle" title="Click to toggle"><br></div>
1166
- <h3 class="hndle ui-sortable-handle optionsTitle" style="cursor: pointer"><span>Options</span></h3>
1167
- <div class="optionsContent">
1168
- <span class="liquid-width">Dismiss on &quot;esc&quot; key:</span><input class="input-width-static" type="checkbox" name="escKey" <?php echo $sgEscKey;?>/>
1169
- <span class="dashicons dashicons-info escKeyImg sameImageStyle"></span><span class="infoEscKey samefontStyle">The popup will be dismissed when user presses on 'esc' key.</span></br>
1170
-
1171
- <span class="liquid-width" id="createDescribeClose">Show &quot;close&quot; button:</span><input class="input-width-static" type="checkbox" name="closeButton" <?php echo $sgCloseButton;?> />
1172
- <span class="dashicons dashicons-info CloseImg sameImageStyle"></span><span class="infoCloseButton samefontStyle">The popup will contain 'close' button.</span><br>
1173
-
1174
- <span class="liquid-width">Enable content scrolling:</span><input class="input-width-static" type="checkbox" name="scrolling" <?php echo $sgScrolling;?> />
1175
- <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>
1176
-
1177
- <span class="liquid-width">Enable reposition:</span><input class="input-width-static" type="checkbox" name="reposition" <?php echo $sgReposition;?> />
1178
- <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>
1179
-
1180
- <span class="liquid-width">Enable scaling:</span><input class="input-width-static" type="checkbox" name="scaling" <?php echo $sgScaling;?> />
1181
- <span class="dashicons dashicons-info scrollingImg sameImageStyle"></span><span class="infoScaling samefontStyle">Resize popup according to screen size</span><br>
1182
-
1183
- <span class="liquid-width">Dismiss on overlay click:</span><input class="input-width-static" type="checkbox" name="overlayClose" <?php echo $sgOverlayClose;?> />
1184
- <span class="dashicons dashicons-info overlayImg sameImageStyle"></span><span class="infoOverlayClose samefontStyle">The popup will be dismissed when user clicks beyond of the popup area.</span><br>
1185
-
1186
- <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;?> />
1187
- <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>
1188
-
1189
- <span class="liquid-width">Reopen after form submission:</span><input class="input-width-static" type="checkbox" name="reopenAfterSubmission" <?php echo $sgReopenAfterSubmission;?> />
1190
- <span class="dashicons dashicons-info overlayImg sameImageStyle"></span><span class="infoReopenSubmiting samefontStyle">If checked, the popup will reopen after form submission.</span><br>
1191
-
1192
- <div class="sg-hide sg-full-width js-content-click-wrraper">
1193
- <?php echo createRadiobuttons($contentClickOptions, "content-click-behavior", true, esc_html($sgContentClickBehavior), "liquid-width"); ?>
1194
- <div class="sg-hide js-readio-buttons-acordion-content sg-full-width">
1195
- <span class="liquid-width">Url:</span><input class="input-width-static" type="text" name='click-redirect-to-url' value="<?php echo esc_attr(@$sgClickRedirectToUrl); ?>">
1196
- <span class="liquid-width">Redirect to new tab:</span><input type="checkbox" name="redirect-to-new-tab" <?php echo $sgRedirectToNewTab; ?> >
1197
- </div>
1198
- </div>
1199
-
1200
- <span class="liquid-width">Change overlay color:</span><div id="color-picker"><input class="sgOverlayColor" id="sgOverlayColor" type="text" name="sgOverlayColor" value="<?php echo esc_attr(@$sgOverlayColor); ?>" /></div><br>
1201
-
1202
- <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>
1203
-
1204
- <span class="liquid-width" id="createDescribeOpacitcy">Background overlay opacity:</span><div class="slider-wrapper">
1205
- <input type="text" class="js-decimal" value="<?php echo esc_attr($sgOpacity);?>" rel="<?php echo esc_attr($sgOpacity);?>" name="opacity"/>
1206
- <div id="js-display-decimal" class="display-box"></div>
1207
- </div><br>
1208
-
1209
- <span class="liquid-width">Overlay custom class:</span><input class="input-width-static" type="text" name="sgOverlayCustomClasss" value="<?php echo esc_attr(@$sgOverlayCustomClasss);?>">
1210
- <br>
1211
-
1212
- <span class="liquid-width">Content custom class:</span><input class="input-width-static" type="text" name="sgContentCustomClasss" value="<?php echo esc_attr(@$sgContentCustomClasss);?>">
1213
- <br>
1214
-
1215
- <span class="liquid-width" id="createDescribeFixed">Popup location:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popupFixed" <?php echo $sgPopupFixed;?> />
1216
- <div class="js-popop-fixeds">
1217
- <span class="fix-wrapper-style" >&nbsp;</span>
1218
- <div class="fixed-wrapper">
1219
- <div class="js-fixed-position-style" id="fixed-position1" data-sgvalue="1"></div>
1220
- <div class="js-fixed-position-style" id="fixed-position2"data-sgvalue="2"></div>
1221
- <div class="js-fixed-position-style" id="fixed-position3" data-sgvalue="3"></div>
1222
- <div class="js-fixed-position-style" id="fixed-position4" data-sgvalue="4"></div>
1223
- <div class="js-fixed-position-style" id="fixed-position5" data-sgvalue="5"></div>
1224
- <div class="js-fixed-position-style" id="fixed-position6" data-sgvalue="6"></div>
1225
- <div class="js-fixed-position-style" id="fixed-position7" data-sgvalue="7"></div>
1226
- <div class="js-fixed-position-style" id="fixed-position8" data-sgvalue="8"></div>
1227
- <div class="js-fixed-position-style" id="fixed-position9" data-sgvalue="9"></div>
1228
- </div>
1229
- </div>
1230
- <input type="hidden" name="fixedPostion" class="js-fixed-postion" value="<?php echo esc_attr(@$sgFixedPostion);?>">
1231
- </div>
1232
- </div>
1233
-
1234
- </div>
1235
- </div>
1236
- </div>
1237
- </div>
1238
- <?php require_once("options_section/pro.php"); ?>
1239
- </div>
1240
- </div>
1241
- <div class="clear"></div>
1242
- <?php
1243
- $isActivePopup = SgPopupGetData::isActivePopup(@$id);
1244
- if(!@$id) $isActivePopup = 'checked';
 
 
 
1245
  ?>
1246
- <input class="sg-hide-element" name="isActiveStatus" data-switch-id="'.$id.'" type="checkbox" <?php echo $isActivePopup; ?> >
1247
- <input type="hidden" class="button-primary" value="<?php echo esc_attr(@$id);?>" name="hidden_popup_number" />
1248
- </div>
1249
- </div>
1250
- </form>
1251
  <?php
1252
  SGFunctions::showInfo();
1
  <?php
2
+ $extensionManagerObj = new SGPBExtensionManager();
3
+
4
+ $popupType = @$_GET['type'];
5
+ if (!$popupType) {
6
+ $popupType = 'html';
7
+ }
8
+
9
+ //Get current paths for popup, for addons it different
10
+ $paths = IntegrateExternalSettings::getCurrentPopupAppPaths($popupType);
11
+ //Get current form action, for addons it different
12
+ $currentActionName = IntegrateExternalSettings::getCurrentPopupAdminPostActionName($popupType);
13
+
14
+ $popupAppPath = $paths['app-path'];
15
+ $popupFilesPath = $paths['files-path'];
16
+
17
+ $popupName = "SG".ucfirst(strtolower($popupType));
18
+ $popupClassName = $popupName."Popup";
19
+ require_once($popupAppPath ."/classes/".$popupClassName.".php");
20
+ $obj = new $popupClassName();
21
+
22
+ global $removeOptions;
23
+ $removeOptions = $obj->getRemoveOptions();
24
+
25
+ if (isset($_GET['id'])) {
26
+ $id = (int)$_GET['id'];
27
+ $result = call_user_func(array($popupClassName, 'findById'), $id);
28
+ if (!$result) {
29
+ wp_redirect(SG_APP_POPUP_ADMIN_URL."page=edit-popup&type=".$popupType."");
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ switch ($popupType) {
33
+ case 'iframe':
34
+ $sgPopupDataIframe = $result->getUrl();
35
+ break;
36
+ case 'video':
37
+ $sgPopupDataVideo = $result->getRealUrl();
38
+ $sgVideoOptions = $result->getVideoOptions();
39
+ break;
40
+ case 'image':
41
+ $sgPopupDataImage = $result->getUrl();
42
+ break;
43
+ case 'html':
44
+ $sgPopupDataHtml = $result->getContent();
45
+ break;
46
+ case 'fblike':
47
+ $sgPopupDataFblike = $result->getContent();
48
+ $sgFlikeOptions = $result->getFblikeOptions();
49
+ break;
50
+ case 'shortcode':
51
+ $sgPopupDataShortcode = $result->getShortcode();
52
+ break;
53
+ case 'ageRestriction':
54
+ $sgPopupAgeRestriction = ($result->getContent());
55
+ $sgYesButton = sgSafeStr($result->getYesButton());
56
+ $sgNoButton = sgSafeStr($result->getNoButton());
57
+ $sgRestrictionUrl = sgSafeStr($result->getRestrictionUrl());
58
+ break;
59
+ case 'countdown':
60
+ $sgCoundownContent = $result->getCountdownContent();
61
+ $countdownOptions = json_decode(sgSafeStr($result->getCountdownOptions()),true);
62
+ $sgCountdownNumbersBgColor = $countdownOptions['countdownNumbersBgColor'];
63
+ $sgCountdownNumbersTextColor = $countdownOptions['countdownNumbersTextColor'];
64
+ $sgDueDate = $countdownOptions['sg-due-date'];
65
+ @$sgGetCountdownType = $countdownOptions['sg-countdown-type'];
66
+ $sgCountdownLang = $countdownOptions['counts-language'];
67
+ @$sgCountdownPosition = $countdownOptions['coundown-position'];
68
+ @$sgSelectedTimeZone = $countdownOptions['sg-time-zone'];
69
+ @$sgCountdownAutoclose = $countdownOptions['countdown-autoclose'];
70
+ break;
71
+ case 'social':
72
+ $sgSocialContent = ($result->getSocialContent());
73
+ $sgSocialButtons = sgSafeStr($result->getButtons());
74
+ $sgSocialOptions = sgSafeStr($result->getSocialOptions());
75
+ break;
76
+ case 'exitIntent':
77
+ $sgExitIntentContent = $result->getContent();
78
+ $exitIntentOptions = $result->getExitIntentOptions();
79
+ break;
80
+ case 'subscription':
81
+ $sgSunbscriptionContent = $result->getContent();
82
+ $subscriptionOptions = $result->getSubscriptionOptions();
83
+ break;
84
+ case 'contactForm':
85
+ $params = $result->getParams();
86
+ $sgContactFormContent = $result->getContent();
 
 
 
 
 
 
 
 
 
 
87
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
 
90
+ $title = $result->getTitle();
91
+ $jsonData = json_decode($result->getOptions(), true);
92
+ $sgEscKey = @$jsonData['escKey'];
93
+ $sgScrolling = @$jsonData['scrolling'];
94
+ $sgScaling = @$jsonData['scaling'];
95
+ $sgCloseButton = @$jsonData['closeButton'];
96
+ $sgReposition = @$jsonData['reposition'];
97
+ $sgOverlayClose = @$jsonData['overlayClose'];
98
+ $sgReopenAfterSubmission = @$jsonData['reopenAfterSubmission'];
99
+ $sgOverlayColor = @$jsonData['sgOverlayColor'];
100
+ $sgContentBackgroundColor = @$jsonData['sg-content-background-color'];
101
+ $sgContentClick = @$jsonData['contentClick'];
102
+ $sgContentClickBehavior = @$jsonData['content-click-behavior'];
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'];
109
+ $sgInActivityStatus = @$jsonData['inActivityStatus'];
110
+ $sgInactivityTimout = @$jsonData['inactivity-timout'];
111
+ $beforeScrolingPrsent = @$jsonData['beforeScrolingPrsent'];
112
+ $duration = @$jsonData['duration'];
113
+ $delay = @$jsonData['delay'];
114
+ $sgTheme3BorderColor = @$jsonData['sgTheme3BorderColor'];
115
+ $sgTheme3BorderRadius = @$jsonData['sgTheme3BorderRadius'];
116
+ $sgThemeCloseText = @$jsonData['theme-close-text'];
117
+ $effect =@$jsonData['effect'];
118
+ $sgInitialWidth = @$jsonData['initialWidth'];
119
+ $sgInitialHeight = @$jsonData['initialHeight'];
120
+ $sgWidth = @$jsonData['width'];
121
+ $sgHeight = @$jsonData['height'];
122
+ $sgMaxWidth = @$jsonData['maxWidth'];
123
+ $sgMaxHeight = @$jsonData['maxHeight'];
124
+ $sgForMobile = @$jsonData['forMobile'];
125
+ $sgOpenOnMobile = @$jsonData['openMobile'];
126
+ $sgAllPagesStatus = @$jsonData['allPagesStatus'];
127
+ $sgAllPostsStatus = @$jsonData['allPostsStatus'];
128
+ $sgAllCustomPostsStatus = @$jsonData['allCustomPostsStatus'];
129
+ $sgPostsAllCategories = @$jsonData['posts-all-categories'];
130
+ $sgRepeatPopup = @$jsonData['repeatPopup'];
131
+ $sgPopupAppearNumberLimit = @$jsonData['popup-appear-number-limit'];
132
+ $sgPopupCookiePageLevel = @$jsonData['save-cookie-page-level'];
133
+ $sgDisablePopup = @$jsonData['disablePopup'];
134
+ $sgDisablePopupOverlay = @$jsonData['disablePopupOverlay'];
135
+ $sgPopupClosingTimer = @$jsonData['popupClosingTimer'];
136
+ $sgAutoClosePopup = @$jsonData['autoClosePopup'];
137
+ $sgCountryStatus = @$jsonData['countryStatus'];
138
+ $sgAllSelectedPages = @$jsonData['allSelectedPages'];
139
+ $sgAllSelectedCustomPosts = @$jsonData['allSelectedCustomPosts'];
140
+ $sgAllPostStatus = @$jsonData['showAllPosts'];
141
+ $sgAllSelectedPosts = @$jsonData['allSelectedPosts'];
142
+ $sgAllowCountries = @$jsonData['allowCountries'];
143
+ $sgAllPages = @$jsonData['showAllPages'];
144
+ $sgAllPosts = @$jsonData['showAllPosts'];
145
+ $sgAllCustomPosts = @$jsonData['showAllCustomPosts'];
146
+ $sgAllCustomPostsType = @$jsonData['all-custom-posts'];
147
+ $sgLogedUser = @$jsonData['loggedin-user'];
148
+ $sgUserSeperate = @$jsonData['sg-user-status'];
149
+ $sgCountryName = @$jsonData['countryName'];
150
+ $sgCountryIso = @$jsonData['countryIso'];
151
+ $sgPopupTimerStatus = @$jsonData['popup-timer-status'];
152
+ $sgPopupScheduleStatus = @$jsonData['popup-schedule-status'];
153
+ $sgPopupScheduleStartWeeks = @$jsonData['schedule-start-weeks'];
154
+ $sgPopupScheduleStartTime = @$jsonData['schedule-start-time'];
155
+ $sgPopupScheduleEndTime = @$jsonData['schedule-end-time'];
156
+ $sgPopupFinishTimer = @$jsonData['popup-finish-timer'];
157
+ $sgPopupStartTimer = @$jsonData['popup-start-timer'];
158
+ $sgColorboxTheme = @$jsonData['theme'];
159
+ $sgOverlayCustomClasss = @$jsonData['sgOverlayCustomClasss'];
160
+ $sgContentCustomClasss = @$jsonData['sgContentCustomClasss'];
161
+ $sgOnceExpiresTime = @$jsonData['onceExpiresTime'];
162
+ $sgRestrictionAction = @$jsonData['restrictionAction'];
163
+ $yesButtonBackgroundColor = @sgSafeStr($jsonData['yesButtonBackgroundColor']);
164
+ $noButtonBackgroundColor = @sgSafeStr($jsonData['noButtonBackgroundColor']);
165
+ $yesButtonTextColor = @sgSafeStr($jsonData['yesButtonTextColor']);
166
+ $noButtonTextColor = @sgSafeStr($jsonData['noButtonTextColor']);
167
+ $yesButtonRadius = @sgSafeStr($jsonData['yesButtonRadius']);
168
+ $noButtonRadius = @sgSafeStr($jsonData['noButtonRadius']);
169
+ $sgRestrictionExpirationTime = @sgSafeStr($jsonData['sgRestrictionExpirationTime']);
170
+ $sgRestrictionCookeSavingLevel = @sgSafeStr($jsonData['restrictionCookeSavingLevel']);
171
+ $sgSocialOptions = json_decode(@$sgSocialOptions,true);
172
+ $sgShareUrl = $sgSocialOptions['sgShareUrl'];
173
+ $shareUrlType = @sgSafeStr($sgSocialOptions['shareUrlType']);
174
+ $fbShareLabel = @sgSafeStr($sgSocialOptions['fbShareLabel']);
175
+ $lindkinLabel = @sgSafeStr($sgSocialOptions['lindkinLabel']);
176
+ $googLelabel = @sgSafeStr($sgSocialOptions['googLelabel']);
177
+ $twitterLabel = @sgSafeStr($sgSocialOptions['twitterLabel']);
178
+ $pinterestLabel = @sgSafeStr($sgSocialOptions['pinterestLabel']);
179
+ $sgMailSubject = @sgSafeStr($sgSocialOptions['sgMailSubject']);
180
+ $sgMailLable = @sgSafeStr($sgSocialOptions['sgMailLable']);
181
+ $sgSocialButtons = json_decode(@$sgSocialButtons,true);
182
+ $sgTwitterStatus = @sgSafeStr($sgSocialButtons['sgTwitterStatus']);
183
+ $sgFbStatus = @sgSafeStr($sgSocialButtons['sgFbStatus']);
184
+ $sgEmailStatus = @sgSafeStr($sgSocialButtons['sgEmailStatus']);
185
+ $sgLinkedinStatus = @sgSafeStr($sgSocialButtons['sgLinkedinStatus']);
186
+ $sgGoogleStatus = @sgSafeStr($sgSocialButtons['sgGoogleStatus']);
187
+ $sgPinterestStatus = @sgSafeStr($sgSocialButtons['sgPinterestStatus']);
188
+ $sgSocialTheme = @sgSafeStr($sgSocialOptions['sgSocialTheme']);
189
+ $sgSocialButtonsSize = @sgSafeStr($sgSocialOptions['sgSocialButtonsSize']);
190
+ $sgSocialLabel = @sgSafeStr($sgSocialOptions['sgSocialLabel']);
191
+ $sgSocialShareCount = @sgSafeStr($sgSocialOptions['sgSocialShareCount']);
192
+ $sgRoundButton = @sgSafeStr($sgSocialOptions['sgRoundButton']);
193
+ $sgPushToBottom = @sgSafeStr($jsonData['pushToBottom']);
194
+ $exitIntentOptions = json_decode(@$exitIntentOptions, true);
195
+ $sgExitIntentTpype = @$exitIntentOptions['exit-intent-type'];
196
+ $sgExitIntntExpire = @$exitIntentOptions['exit-intent-expire-time'];
197
+ $sgExitIntentAlert = @$exitIntentOptions['exit-intent-alert'];
198
+ $sgVideoOptions = json_decode(@$sgVideoOptions, true);
199
+ $sgVideoAutoplay = $sgVideoOptions['video-autoplay'];
200
+ $sgFlikeOptions = json_decode(@$sgFlikeOptions, true);
201
+ $sgFblikeurl = @$sgFlikeOptions['fblike-like-url'];
202
+ $sgFbLikeLayout = @$sgFlikeOptions['fblike-layout'];
203
+ $subscriptionOptions = json_decode(@$subscriptionOptions, true);
204
+ $sgSubsFirstNameStatus = $subscriptionOptions['subs-first-name-status'];
205
+ $sgSubsLastNameStatus = $subscriptionOptions['subs-last-name-status'];
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'];
219
+ $sgSubsPlaceholderColor = @$subscriptionOptions['subs-placeholder-color'];
220
+ $sgSubsValidateMessage = @$subscriptionOptions['subs-validation-message'];
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'];
228
+ $sgShowFormToTop = @$contactFormOptions['show-form-to-top'];
229
+ $sgContactNameRequired = @$contactFormOptions['contact-name-required'];
230
+ $sgContactSubjectLabel = @$contactFormOptions['contact-subject'];
231
+ $sgContactSubjectStatus = @$contactFormOptions['contact-subject-status'];
232
+ $sgContactSubjectRequired = @$contactFormOptions['contact-subject-required'];
233
+ $sgContactEmailLabel = @$contactFormOptions['contact-email'];
234
+ $sgContactMessageLabel = @$contactFormOptions['contact-message'];
235
+ $sgContactValidationMessage = @$contactFormOptions['contact-validation-message'];
236
+ $sgContactSuccessMessage = @$contactFormOptions['contact-success-message'];
237
+ $sgContactInputsWidth = @$contactFormOptions['contact-inputs-width'];
238
+ $sgContactInputsHeight = @$contactFormOptions['contact-inputs-height'];
239
+ $sgContactInputsBorderWidth = @$contactFormOptions['contact-inputs-border-width'];
240
+ $sgContactTextInputBgcolor = @$contactFormOptions['contact-text-input-bgcolor'];
241
+ $sgContactTextBordercolor = @$contactFormOptions['contact-text-bordercolor'];
242
+ $sgContactInputsColor = @$contactFormOptions['contact-inputs-color'];
243
+ $sgContactPlaceholderColor = @$contactFormOptions['contact-placeholder-color'];
244
+ $sgContactBtnWidth = @$contactFormOptions['contact-btn-width'];
245
+ $sgContactBtnHeight = @$contactFormOptions['contact-btn-height'];
246
+ $sgContactBtnTitle = @$contactFormOptions['contact-btn-title'];
247
+ $sgContactBtnProgressTitle = @$contactFormOptions['contact-btn-progress-title'];
248
+ $sgContactButtonBgcolor = @$contactFormOptions['contact-button-bgcolor'];
249
+ $sgContactButtonColor = @$contactFormOptions['contact-button-color'];
250
+ $sgContactAreaWidth = @$contactFormOptions['contact-area-width'];
251
+ $sgContactAreaHeight = @$contactFormOptions['contact-area-height'];
252
+ $sgContactResize = @$contactFormOptions['sg-contact-resize'];
253
+ $sgContactValidateEmail = @$contactFormOptions['contact-validate-email'];
254
+ $sgContactResiveEmail = @$contactFormOptions['contact-receive-email'];
255
+ $sgContactFailMessage = @$contactFormOptions['contact-fail-message'];
256
+ }
257
+
258
+ $dataPopupId = @$id;
259
+ /* For layze loading get selected data */
260
+ if(!isset($id)) {
261
+ $dataPopupId = "-1";
262
+ }
263
+
264
+ $sgPopup = array(
265
+ 'escKey'=> true,
266
+ 'closeButton' => true,
267
+ 'scrolling'=> true,
268
+ 'scaling'=>false,
269
+ 'opacity'=>0.8,
270
+ 'reposition' => true,
271
+ 'width' => '640px',
272
+ 'height' => '480px',
273
+ 'initialWidth' => '300',
274
+ 'initialHeight' => '100',
275
+ 'maxWidth' => false,
276
+ 'maxHeight' => false,
277
+ 'overlayClose' => true,
278
+ 'reopenAfterSubmission' => false,
279
+ 'contentClick'=>false,
280
+ 'fixed' => false,
281
+ 'top' => false,
282
+ 'right' => false,
283
+ 'bottom' => false,
284
+ 'left' => false,
285
+ 'duration' => 1,
286
+ 'delay' => 0,
287
+ 'theme-close-text' => 'Close',
288
+ 'content-click-behavior' => 'close',
289
+ );
290
+
291
+ $popupProDefaultValues = array(
292
+ 'closeType' => false,
293
+ 'onScrolling' => false,
294
+ 'inactivity-timout' => '0',
295
+ 'inActivityStatus' => false,
296
+ 'video-autoplay' => false,
297
+ 'forMobile' => false,
298
+ 'openMobile' => false,
299
+ 'repetPopup' => false,
300
+ 'disablePopup' => false,
301
+ 'disablePopupOverlay' => false,
302
+ 'redirect-to-new-tab' => true,
303
+ 'autoClosePopup' => false,
304
+ 'fbStatus' => true,
305
+ 'twitterStatus' => true,
306
+ 'emailStatus' => true,
307
+ 'linkedinStatus' => true,
308
+ 'googleStatus' => true,
309
+ 'pinterestStatus' => true,
310
+ 'sgSocialLabel'=>true,
311
+ 'roundButtons'=>false,
312
+ 'sgShareUrl' => 'http://',
313
+ 'pushToBottom' => true,
314
+ 'allPages' => "all",
315
+ 'allPosts' => "all",
316
+ 'allCustomPosts' => "all",
317
+ 'allPagesStatus' => false,
318
+ 'allPostsStatus' => false,
319
+ 'allCustomPostsStatus' => false,
320
+ 'onceExpiresTime' => 7,
321
+ 'popup-appear-number-limit' => 1,
322
+ 'save-cookie-page-level' => false,
323
+ 'overlay-custom-classs' => 'sg-popup-overlay',
324
+ 'content-custom-classs' => 'sg-popup-content',
325
+ 'countryStatus' => false,
326
+ 'sg-user-status' => false,
327
+ 'allowCountries' => 'allow',
328
+ 'loggedin-user' => 'true',
329
+ 'sgRestrictionExpirationTime' => 365,
330
+ 'restrictionCookeSavingLevel' => '',
331
+ 'countdownNumbersTextColor' => '',
332
+ 'countdownNumbersBgColor' => '',
333
+ 'countDownLang' => 'English',
334
+ 'popup-timer-status' => false,
335
+ 'popup-schedule-status' => false,
336
+ 'countdown-position' => true,
337
+ 'countdown-autoclose' => true,
338
+ 'time-zone' => 'Etc/GMT',
339
+ 'due-date' => date('M d y H:i', strtotime(' +1 day')),
340
+ 'popup-start-timer' => date('M d y H:i'),
341
+ 'schedule-start-time' => date("H:i"),
342
+ 'exit-intent-type' => "soft",
343
+ 'exit-intent-expire-time' => '1',
344
+ 'subs-first-name-status' => true,
345
+ 'subs-last-name-status' => true,
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,
368
+ 'show-form-to-top' => false,
369
+ 'contact-subject-status' => true,
370
+ 'contact-subject-required' => true,
371
+ 'contact-email' => 'E-mail *',
372
+ 'contact-message' => 'Message *',
373
+ 'contact-subject' => 'Subject *',
374
+ 'contact-success-message' => 'Your message has been successfully sent.',
375
+ 'contact-btn-title' => 'Contact',
376
+ 'contact-validate-email' => 'Please enter a valid email.',
377
+ 'contact-receive-email' => get_option('admin_email'),
378
+ 'contact-fail-message' => 'Unable to send.'
379
+ );
380
+
381
+ $escKey = sgBoolToChecked($sgPopup['escKey']);
382
+ $closeButton = sgBoolToChecked($sgPopup['closeButton']);
383
+ $scrolling = sgBoolToChecked($sgPopup['scrolling']);
384
+ $scaling = sgBoolToChecked($sgPopup['scaling']);
385
+ $reposition = sgBoolToChecked($sgPopup['reposition']);
386
+ $overlayClose = sgBoolToChecked($sgPopup['overlayClose']);
387
+ $reopenAfterSubmission = sgBoolToChecked($sgPopup['reopenAfterSubmission']);
388
+ $contentClick = sgBoolToChecked($sgPopup['contentClick']);
389
+ $contentClickBehavior = $sgPopup['content-click-behavior'];
390
+
391
+ $closeType = sgBoolToChecked($popupProDefaultValues['closeType']);
392
+ $onScrolling = sgBoolToChecked($popupProDefaultValues['onScrolling']);
393
+ $inActivityStatus = sgBoolToChecked($popupProDefaultValues['inActivityStatus']);
394
+ $userSeperate = sgBoolToChecked($popupProDefaultValues['sg-user-status']);
395
+ $forMobile = sgBoolToChecked($popupProDefaultValues['forMobile']);
396
+ $openMobile = sgBoolToChecked($popupProDefaultValues['openMobile']);
397
+ $popupTimerStatus = sgBoolToChecked($popupProDefaultValues['popup-timer-status']);
398
+ $popupScheduleStatus = sgBoolToChecked($popupProDefaultValues['popup-schedule-status']);
399
+ $repetPopup = sgBoolToChecked($popupProDefaultValues['repetPopup']);
400
+ $disablePopup = sgBoolToChecked($popupProDefaultValues['disablePopup']);
401
+ $disablePopupOverlay = sgBoolToChecked($popupProDefaultValues['disablePopupOverlay']);
402
+ $autoClosePopup = sgBoolToChecked($popupProDefaultValues['autoClosePopup']);
403
+ $fbStatus = sgBoolToChecked($popupProDefaultValues['fbStatus']);
404
+ $twitterStatus = sgBoolToChecked($popupProDefaultValues['twitterStatus']);
405
+ $emailStatus = sgBoolToChecked($popupProDefaultValues['emailStatus']);
406
+ $linkedinStatus = sgBoolToChecked($popupProDefaultValues['linkedinStatus']);
407
+ $googleStatus = sgBoolToChecked($popupProDefaultValues['googleStatus']);
408
+ $pinterestStatus = sgBoolToChecked($popupProDefaultValues['pinterestStatus']);
409
+ $socialLabel = sgBoolToChecked($popupProDefaultValues['sgSocialLabel']);
410
+ $roundButtons = sgBoolToChecked($popupProDefaultValues['roundButtons']);
411
+ $countdownAutoclose = sgBoolToChecked($popupProDefaultValues['countdown-autoclose']);
412
+ $shareUrl = $popupProDefaultValues['sgShareUrl'];
413
+ $pushToBottom = sgBoolToChecked($popupProDefaultValues['pushToBottom']);
414
+ $allPages = $popupProDefaultValues['allPages'];
415
+ $allPosts = $popupProDefaultValues['allPosts'];
416
+ $allCustomPosts = $popupProDefaultValues['allCustomPosts'];
417
+ $allPagesStatus = sgBoolToChecked($popupProDefaultValues['allPagesStatus']);
418
+ $allPostsStatus = sgBoolToChecked($popupProDefaultValues['allPostsStatus']);
419
+ $allCustomPostsStatus = sgBoolToChecked($popupProDefaultValues['allCustomPostsStatus']);
420
+ $contactNameStatus = sgBoolToChecked($popupProDefaultValues['contact-name-status']);
421
+ $showFormToTop = sgBoolToChecked($popupProDefaultValues['show-form-to-top']);
422
+ $contactNameRequired = sgBoolToChecked($popupProDefaultValues['contact-name-required']);
423
+ $contactSubjectStatus = sgBoolToChecked($popupProDefaultValues['contact-subject-status']);
424
+ $contactSubjectRequired = sgBoolToChecked($popupProDefaultValues['contact-subject-required']);
425
+ $saveCookiePageLevel = sgBoolToChecked($popupProDefaultValues['save-cookie-page-level']);
426
+ $onceExpiresTime = $popupProDefaultValues['onceExpiresTime'];
427
+ $popupAppearNumberLimit = $popupProDefaultValues['popup-appear-number-limit'];
428
+ $countryStatus = sgBoolToChecked($popupProDefaultValues['countryStatus']);
429
+ $allowCountries = $popupProDefaultValues['allowCountries'];
430
+ $logedUser = $popupProDefaultValues['loggedin-user'];
431
+ $restrictionExpirationTime = $popupProDefaultValues['sgRestrictionExpirationTime'];
432
+ $restrictionCookeSavingLevel = sgBoolToChecked($popupProDefaultValues['restrictionCookeSavingLevel']);
433
+ $countdownNumbersTextColor = $popupProDefaultValues['countdownNumbersTextColor'];
434
+ $countdownNumbersBgColor = $popupProDefaultValues['countdownNumbersBgColor'];
435
+ $countdownLang = $popupProDefaultValues['countDownLang'];
436
+ $countdownPosition = $popupProDefaultValues['countdown-position'];
437
+ $timeZone = $popupProDefaultValues['time-zone'];
438
+ $dueDate = $popupProDefaultValues['due-date'];
439
+ $popupStartTimer = $popupProDefaultValues['popup-start-timer'];
440
+ $scheduleStartTime = $popupProDefaultValues['schedule-start-time'];
441
+ $inactivityTimout = $popupProDefaultValues['inactivity-timout'];
442
+ $exitIntentType = $popupProDefaultValues['exit-intent-type'];
443
+ $exitIntentExpireTime = $popupProDefaultValues['exit-intent-expire-time'];
444
+ $subsFirstNameStatus = sgBoolToChecked($popupProDefaultValues['subs-first-name-status']);
445
+ $subsLastNameStatus = sgBoolToChecked($popupProDefaultValues['subs-last-name-status']);
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'];
453
+ $subsPlaceholderColor = $popupProDefaultValues['subs-placeholder-color'];
454
+ $subsTextHeight = $popupProDefaultValues['subs-text-height'];
455
+ $subsBtnHeight = $popupProDefaultValues['subs-btn-height'];
456
+ $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'];
468
+ $contactSubject = $popupProDefaultValues['contact-subject'];
469
+ $contactSuccessMessage = $popupProDefaultValues['contact-success-message'];
470
+ $contactBtnTitle = $popupProDefaultValues['contact-btn-title'];
471
+ $contactValidateEmail = $popupProDefaultValues['contact-validate-email'];
472
+ $contactResiveEmail = $popupProDefaultValues['contact-receive-email'];
473
+ $contactFailMessage = $popupProDefaultValues['contact-fail-message'];
474
+ $overlayCustomClasss = $popupProDefaultValues['overlay-custom-classs'];
475
+ $contentCustomClasss = $popupProDefaultValues['content-custom-classs'];
476
+ $redirectToNewTab = $popupProDefaultValues['redirect-to-new-tab'];
477
+
478
+ function sgBoolToChecked($var)
479
+ {
480
+ return ($var?'checked':'');
481
+ }
482
+
483
+ function sgRemoveOption($option)
484
+ {
485
+ global $removeOptions;
486
+ return isset($removeOptions[$option]);
487
+ }
488
+
489
+ $width = $sgPopup['width'];
490
+ $height = $sgPopup['height'];
491
+ $opacityValue = $sgPopup['opacity'];
492
+ $top = $sgPopup['top'];
493
+ $right = $sgPopup['right'];
494
+ $bottom = $sgPopup['bottom'];
495
+ $left = $sgPopup['left'];
496
+ $initialWidth = $sgPopup['initialWidth'];
497
+ $initialHeight = $sgPopup['initialHeight'];
498
+ $maxWidth = $sgPopup['maxWidth'];
499
+ $maxHeight = $sgPopup['maxHeight'];
500
+ $deafultFixed = $sgPopup['fixed'];
501
+ $defaultDuration = $sgPopup['duration'];
502
+ $defaultDelay = $sgPopup['delay'];
503
+ $themeCloseText = $sgPopup['theme-close-text'];
504
+
505
+ $sgCloseButton = @sgSetChecked($sgCloseButton, $closeButton);
506
+ $sgEscKey = @sgSetChecked($sgEscKey, $escKey);
507
+ $sgContentClick = @sgSetChecked($sgContentClick, $contentClick);
508
+ $sgOverlayClose = @sgSetChecked($sgOverlayClose, $overlayClose);
509
+ $sgReopenAfterSubmission = @sgSetChecked($sgReopenAfterSubmission, $reopenAfterSubmission);
510
+ $sgReposition = @sgSetChecked($sgReposition, $reposition);
511
+ $sgScrolling = @sgSetChecked($sgScrolling, $scrolling);
512
+ $sgScaling = @sgSetChecked($sgScaling, $scaling);
513
+ $sgCountdownAutoclose = @sgSetChecked($sgCountdownAutoclose, $countdownAutoclose);
514
+
515
+ $sgCloseType = @sgSetChecked($sgCloseType, $closeType);
516
+ $sgOnScrolling = @sgSetChecked($sgOnScrolling, $onScrolling);
517
+ $sgInActivityStatus = @sgSetChecked($sgInActivityStatus, $inActivityStatus);
518
+ $sgForMobile = @sgSetChecked($sgForMobile, $forMobile);
519
+ $sgOpenOnMobile = @sgSetChecked($sgOpenOnMobile, $openMobile);
520
+ $sgPopupCookiePageLevel = @sgSetChecked($sgPopupCookiePageLevel, $saveCookiePageLevel);
521
+ $sgUserSeperate = @sgSetChecked($sgUserSeperate, $userSeperate);
522
+ $sgPopupTimerStatus = @sgSetChecked($sgPopupTimerStatus, $popupTimerStatus);
523
+ $sgPopupScheduleStatus = @sgSetChecked($sgPopupScheduleStatus, $popupScheduleStatus);
524
+ $sgRepeatPopup = @sgSetChecked($sgRepeatPopup, $repetPopup);
525
+ $sgDisablePopup = @sgSetChecked($sgDisablePopup, $disablePopup);
526
+ $sgDisablePopupOverlay = @sgSetChecked($sgDisablePopupOverlay, $disablePopupOverlay);
527
+ $sgAutoClosePopup = @sgSetChecked($sgAutoClosePopup, $autoClosePopup);
528
+ $sgFbStatus = @sgSetChecked($sgFbStatus, $fbStatus);
529
+ $sgTwitterStatus = @sgSetChecked($sgTwitterStatus, $twitterStatus);
530
+ $sgEmailStatus = @sgSetChecked($sgEmailStatus, $emailStatus);
531
+ $sgLinkedinStatus = @sgSetChecked($sgLinkedinStatus, $linkedinStatus);
532
+ $sgGoogleStatus = @sgSetChecked($sgGoogleStatus, $googleStatus);
533
+ $sgPinterestStatus = @sgSetChecked($sgPinterestStatus, $pinterestStatus);
534
+ $sgRoundButtons = @sgSetChecked($sgRoundButton, $roundButtons);
535
+ $sgSocialLabel = @sgSetChecked($sgSocialLabel, $socialLabel);
536
+ $sgPopupFixed = @sgSetChecked($sgPopupFixed, $deafultFixed);
537
+ $sgPushToBottom = @sgSetChecked($sgPushToBottom, $pushToBottom);
538
+ $sgRestrictionCookeSavingLevel = @sgSetChecked($sgRestrictionCookeSavingLevel, $restrictionCookeSavingLevel);
539
+
540
+ $sgAllPagesStatus = @sgSetChecked($sgAllPagesStatus, $allPagesStatus);
541
+ $sgAllPostsStatus = @sgSetChecked($sgAllPostsStatus, $allPostsStatus);
542
+ $sgAllCustomPostsStatus = @sgSetChecked($sgAllCustomPostsStatus, $allCustomPostsStatus);
543
+ $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);
551
+ $sgContactNameRequired = @sgSetChecked($sgContactNameRequired, $contactNameRequired);
552
+ $sgContactSubjectStatus = @sgSetChecked($sgContactSubjectStatus, $contactSubjectStatus);
553
+ $sgContactSubjectRequired = @sgSetChecked($sgContactSubjectRequired, $contactSubjectRequired);
554
+ $sgShowFormToTop = @sgSetChecked($sgShowFormToTop, $showFormToTop);
555
+ $sgRedirectToNewTab = @sgSetChecked($sgRedirectToNewTab, $redirectToNewTab);
556
+
557
+ function sgSetChecked($optionsParam,$defaultOption)
558
+ {
559
+ if (isset($optionsParam)) {
560
+ if ($optionsParam == '') {
561
+ return '';
562
  }
563
  else {
564
+ return 'checked';
565
  }
566
  }
567
+ else {
568
+ return $defaultOption;
569
+ }
570
+ }
571
+
572
+ $sgOpacity = @sgGetValue($sgOpacity, $opacityValue);
573
+ $sgWidth = @sgGetValue($sgWidth, $width);
574
+ $sgHeight = @sgGetValue($sgHeight, $height);
575
+ $sgInitialWidth = @sgGetValue($sgInitialWidth, $initialWidth);
576
+ $sgInitialHeight = @sgGetValue($sgInitialHeight, $initialHeight);
577
+ $sgMaxWidth = @sgGetValue($sgMaxWidth, $maxWidth);
578
+ $sgMaxHeight = @sgGetValue($sgMaxHeight, $maxHeight);
579
+ $sgThemeCloseText = @sgGetValue($sgThemeCloseText, $themeCloseText);
580
+ $duration = @sgGetValue($duration, $defaultDuration);
581
+ $sgOnceExpiresTime = @sgGetValue($sgOnceExpiresTime, $onceExpiresTime);
582
+ $sgPopupAppearNumberLimit = @sgGetValue($sgPopupAppearNumberLimit, $popupAppearNumberLimit);
583
+ $delay = @sgGetValue($delay, $defaultDelay);
584
+ $sgInactivityTimout = @sgGetValue($sgInactivityTimout, $inactivityTimout);
585
+ $sgContentClickBehavior = @sgGetValue($sgContentClickBehavior, $contentClickBehavior);
586
+ $sgPopupStartTimer = @sgGetValue($sgPopupStartTimer, $popupStartTimer);
587
+ $sgPopupFinishTimer = @sgGetValue($sgPopupFinishTimer, '');
588
+ $sgPopupScheduleStartTime = @sgGetValue($sgPopupScheduleStartTime, $scheduleStartTime);
589
+ $sgPopupDataIframe = @sgGetValue($sgPopupDataIframe, 'http://');
590
+ $sgShareUrl = @sgGetValue($sgShareUrl, $shareUrl);
591
+ $sgPopupDataHtml = @sgGetValue($sgPopupDataHtml, '');
592
+ $sgPopupDataImage = @sgGetValue($sgPopupDataImage, '');
593
+ $sgAllowCountries = @sgGetValue($sgAllowCountries, $allowCountries);
594
+ $sgAllPages = @sgGetValue($sgAllPages, $allPages);
595
+ $sgAllPosts = @sgGetValue($sgAllPosts, $allPosts);
596
+ $sgAllCustomPosts = @sgGetValue($sgAllCustomPosts, $allCustomPosts);
597
+ $sgLogedUser = @sgGetValue($sgLogedUser, $logedUser);
598
+ $sgRestrictionExpirationTime = @sgGetValue($sgRestrictionExpirationTime, $restrictionExpirationTime);
599
+ $sgCountdownNumbersTextColor = @sgGetValue($sgCountdownNumbersTextColor, $countdownNumbersTextColor);
600
+ $sgCountdownNumbersBgColor = @sgGetValue($sgCountdownNumbersBgColor, $countdownNumbersBgColor);
601
+ $sgCountdownLang = @sgGetValue($sgCountdownLang, $countdownLang);
602
+ $sgSelectedTimeZone = @sgGetValue($sgSelectedTimeZone, $timeZone);
603
+ $sgDueDate = @sgGetValue($sgDueDate, $dueDate);
604
+ $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);
614
+ $sgSubsButtonColor = @sgGetValue($sgSubsButtonColor, $subsButtonColor);
615
+ $sgSubsInputsColor = @sgGetValue($sgSubsInputsColor, $subsInputsColor);
616
+ $sgSubsBtnTitle = @sgGetValue($sgSubsBtnTitle, $subsBtnTitle);
617
+ $sgSubsPlaceholderColor = @sgGetValue($sgSubsPlaceholderColor, $subsPlaceholderColor);
618
+ $sgSubsTextHeight = @sgGetValue($sgSubsTextHeight, $subsTextHeight);
619
+ $sgSubsBtnHeight = @sgGetValue($sgSubsBtnHeight, $subsBtnHeight);
620
+ $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);
627
+ $sgContactMessageLabel = @sgGetValue($sgContactMessageLabel, $contactMessage);
628
+ $sgContactValidationMessage = @sgGetValue($sgContactValidationMessage, $subsValidationMessage);
629
+ $sgContactSuccessMessage = @sgGetValue($sgContactSuccessMessage, $contactSuccessMessage);
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, '');
645
+ $sgContactValidateEmail = @sgGetValue($sgContactValidateEmail, $contactValidateEmail);
646
+ $sgContactResiveEmail = @sgGetValue($sgContactResiveEmail, $contactResiveEmail);
647
+ $sgContactFailMessage = @sgGetValue($sgContactFailMessage, $contactFailMessage);
648
+ $sgOverlayCustomClasss = @sgGetValue($sgOverlayCustomClasss, $overlayCustomClasss);
649
+ $sgContentCustomClasss = @sgGetValue($sgContentCustomClasss, $contentCustomClasss);
650
+ $sgAllSelectedPages = @sgGetValue($sgAllSelectedPages, array());
651
+ $sgAllSelectedPosts = @sgGetValue($sgAllSelectedPosts, array());
652
+ $sgAllSelectedCustomPosts = @sgGetValue($sgAllSelectedCustomPosts, array());
653
+
654
+ function sgGetValue($getedVal,$defValue)
655
+ {
656
+ if (!isset($getedVal)) {
657
+ return $defValue;
658
  }
659
+ else {
660
+ return $getedVal;
661
+ }
662
+ }
663
 
664
+ $radioElements = array(
665
+ array(
666
+ 'name'=>'shareUrlType',
667
+ 'value'=>'activeUrl',
668
+ 'additionalHtml'=>''.'<span>'.'Use active URL'.'</span></span>
669
  <span class="span-width-static"></span><span class="dashicons dashicons-info scrollingImg sameImageStyle sg-active-url"></span><span class="info-active-url samefontStyle">If this option is active Share URL will be current page URL.</span>'
670
+ ),
671
+ array(
672
+ 'name'=>'shareUrlType',
673
+ 'value'=>'shareUrl',
674
+ 'additionalHtml'=>''.'<span>'.'Share url'.'</span></span>'.' <input class="input-width-static sg-active-url" type="text" name="sgShareUrl" value="'.@$sgShareUrl.'">'
675
+ )
676
+ );
677
+
678
+ $countriesRadio = array(
679
+ array(
680
+ 'name'=>'allowCountries',
681
+ 'value'=>'allow',
682
+ 'additionalHtml'=>'<span class="countries-radio-text allow-countries">Allow</span>',
683
+ 'newline' => false
684
+ ),
685
+ array(
686
+ 'name'=>'allowCountries',
687
+ 'value'=>'disallow',
688
+ 'additionalHtml'=>'<span class="countries-radio-text">Disallow</span>',
689
+ 'newline' => true
690
+ )
691
+ );
692
+
693
+ $usersGroup = array(
694
+ array(
695
+ 'name'=>'loggedin-user',
696
+ 'value'=>'true',
697
+ 'additionalHtml'=>'<span class="countries-radio-text allow-countries">logged in</span>',
698
+ 'newline' => false
699
+ ),
700
+ array(
701
+ 'name'=>'loggedin-user',
702
+ 'value'=>'false',
703
+ 'additionalHtml'=>'<span class="countries-radio-text">not logged in</span>',
704
+ 'newline' => true
705
+ )
706
+ );
707
+
708
+ function sgCreateRadioElements($radioElements,$checkedValue)
709
+ {
710
+ $content = '';
711
+ for ($i = 0; $i < count($radioElements); $i++) {
712
+ $checked = '';
713
+ $radioElement = @$radioElements[$i];
714
+ $name = @$radioElement['name'];
715
+ $label = @$radioElement['label'];
716
+ $value = @$radioElement['value'];
717
+ $additionalHtml = @$radioElement['additionalHtml'];
718
+ if ($checkedValue == $value) {
719
+ $checked = 'checked';
 
 
 
720
  }
721
+ $content .= '<span class="liquid-width"><input class="radio-btn-fix" type="radio" name="'.$name.'" value="'.$value.'" '.$checked.'>';
722
+ $content .= $additionalHtml."<br>";
723
  }
724
+ return $content;
725
+ }
726
+
727
+ $contentClickOptions = array(
728
+ array(
729
+ "title" => "Close Popup:",
730
+ "value" => "close",
731
+ "info" => ""
732
+ ),
733
+ array(
734
+ "title" => "Redirect:",
735
+ "value" => "redirect",
736
+ "info" => ""
737
+ )
738
+ );
739
+
740
+ $pagesRadio = array(
741
+ array(
742
+ "title" => "Show on all pages:",
743
+ "value" => "all",
744
+ "info" => ""
745
+ ),
746
+ array(
747
+ "title" => "Show on selected pages:",
748
+ "value" => "selected",
749
+ "info" => "",
750
+ "data-attributes" => array(
751
+ "data-name" => SG_POST_TYPE_PAGE,
752
+ "data-popupid" => $dataPopupId,
753
+ "data-loading-number" => 0,
754
+ "data-selectbox-role" => "js-all-pages"
755
  )
756
+ )
757
+ );
758
+
759
+ $postsRadio = array(
760
+ array(
761
+ "title" => "Show on all posts:",
762
+ "value" => "all",
763
+ "info" => ""
764
+ ),
765
+ array(
766
+ "title" => "Show on selected post:",
767
+ "value" => "selected",
768
+ "info" => "",
769
+ "data-attributes" => array(
770
+ "data-name" => SG_POST_TYPE_POST,
771
+ "data-popupid" => $dataPopupId,
772
+ "data-loading-number" => 0,
773
+ "data-selectbox-role" => "js-all-posts"
774
  )
775
+
776
+ ),
777
+ array(
778
+ "title" => "Show on selected categories",
779
+ "value" => "allCategories",
780
+ "info" => "",
781
+ "data-attributes" => array(
782
+ "class" => 'js-all-categories'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
783
  )
784
+ )
785
+ );
786
+
787
+ $customPostsRadio = array(
788
+ array(
789
+ "title" => "Show on all custom posts:",
790
+ "value" => "all",
791
+ "info" => ""
792
+ ),
793
+ array(
794
+ "title" => "Show on selected custom post:",
795
+ "value" => "selected",
796
+ "info" => "",
797
+ "data-attributes" => array(
798
+ "data-name" => 'allCustomPosts',
799
+ "data-popupid" => $dataPopupId,
800
+ "data-loading-number" => 0,
801
+ "data-selectbox-role" => "js-all-custom-posts"
 
802
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
803
 
804
+ )
805
+ );
806
 
807
+ function createRadiobuttons($elements, $name, $newLine, $selectedInput, $class)
808
+ {
809
+ $str = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
810
 
811
+ foreach ($elements as $key => $element) {
812
+ $breakLine = "";
813
+ $infoIcon = "";
814
+ $title = "";
815
+ $value = "";
816
+ $infoIcon = "";
817
  $checked = "";
818
+
819
+ if(isset($element["title"])) {
820
+ $title = $element["title"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  }
822
+ if(isset($element["value"])) {
823
+ $value = $element["value"];
824
+ }
825
+ if($newLine) {
826
+ $breakLine = "<br>";
827
+ }
828
+ if(isset($element["info"])) {
829
+ $infoIcon = $element['info'];
830
+ }
831
+ if($element["value"] == $selectedInput) {
832
+ $checked = "checked";
833
+ }
834
+ $attrStr = '';
835
+ if(isset($element['data-attributes'])) {
836
+ foreach ($element['data-attributes'] as $key => $dataValue) {
837
+ $attrStr .= $key.'="'.$dataValue.'" ';
838
  }
 
 
 
 
839
  }
840
 
841
+ $str .= "<span class=".$class.">".$element['title']."</span>
842
+ <input type=\"radio\" name=".$name." ".$attrStr." value=".$value." $checked>".$infoIcon.$breakLine;
843
  }
844
+
845
+ echo $str;
846
+ }
847
+
848
+ $sgPopupEffects = array(
849
+ 'No effect' => 'No Effect',
850
+ 'flip' => 'flip',
851
+ 'shake' => 'shake',
852
+ 'wobble' => 'wobble',
853
+ 'swing' => 'swing',
854
+ 'flash' => 'flash',
855
+ 'bounce' => 'bounce',
856
+ 'bounceIn' => 'bounceIn',
857
+ 'pulse' => 'pulse',
858
+ 'rubberBand' => 'rubberBand',
859
+ 'tada' => 'tada',
860
+ 'slideInUp' => 'slideInUp',
861
+ 'jello' => 'jello',
862
+ 'rotateIn' => 'rotateIn',
863
+ 'fadeIn' => 'fadeIn'
864
+ );
865
+
866
+ $sgPopupTheme = array(
867
+ 'colorbox1.css',
868
+ 'colorbox2.css',
869
+ 'colorbox3.css',
870
+ 'colorbox4.css',
871
+ 'colorbox5.css',
872
+ 'colorbox6.css'
873
+ );
874
+
875
+ $sgFbLikeButtons = array(
876
+ 'standard' => 'Standard',
877
+ 'box_count' => 'Box with count',
878
+ 'button_count' => 'Button with count',
879
+ 'button' => 'Button'
880
+ );
881
+
882
+ $sgTheme = array(
883
+ 'flat' => 'flat',
884
+ 'classic' => 'classic',
885
+ 'minima' => 'minima',
886
+ 'plain' => 'plain'
887
+ );
888
+
889
+ $sgThemeSize = array(
890
+ '8' => '8',
891
+ '10' => '10',
892
+ '12' => '12',
893
+ '14' => '14',
894
+ '16' => '16',
895
+ '18' => '18',
896
+ '20' => '20',
897
+ '24' => '24'
898
+ );
899
+
900
+ $sgSocialCount = array(
901
+ 'true' => 'True',
902
+ 'false' => 'False',
903
+ 'inside' => 'Inside'
904
+ );
905
+
906
+ $sgCountdownType = array(
907
+ 1 => 'DD:HH:MM:SS',
908
+ 2 => 'DD:HH:MM'
909
+ );
910
+
911
+ $sgCountdownlang = array(
912
+ 'English' => 'English',
913
+ 'German' => 'German',
914
+ 'Spanish' => 'Spanish',
915
+ 'Arabic' => 'Arabic',
916
+ 'Italian' => 'Italian',
917
+ 'Italian' => 'Italian',
918
+ 'Dutch' => 'Dutch',
919
+ 'Norwegian' => 'Norwegian',
920
+ 'Portuguese' => 'Portuguese',
921
+ 'Russian' => 'Russian',
922
+ 'Swedish' => 'Swedish',
923
+ 'Chinese' => 'Chinese'
924
+ );
925
+
926
+ $sgTextAreaResizeOptions = array(
927
+ 'both' => 'Both',
928
+ 'horizontal' => 'Horizontal',
929
+ 'vertical' => 'Vertical',
930
+ 'none' => 'None',
931
+ 'inherit' => 'Inherit'
932
+ );
933
+
934
+ $sgWeekDaysArray = array(
935
+ 'Mon' => 'Monday',
936
+ 'Tue' => 'Tuesday',
937
+ 'Wed' => 'Wendnesday',
938
+ 'Thu' => 'Thursday',
939
+ 'Fri' => 'Friday',
940
+ 'Sat' => 'Saturday',
941
+ 'Sun' => 'Sunday'
942
+ );
943
+
944
+ if (POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) {
945
+ require_once(SG_APP_POPUP_FILES ."/sg_params_arrays.php");
946
+ }
947
+
948
+ function sgCreateSelect($options,$name,$selecteOption)
949
+ {
950
+ $selected ='';
951
+ $str = "";
952
+ $checked = "";
953
+ if ($name == 'theme' || $name == 'restrictionAction') {
954
+
955
+ $popup_style_name = 'popup_theme_name';
956
+ $firstOption = array_shift($options);
957
+ $i = 1;
958
+ foreach ($options as $key) {
959
+ $checked ='';
960
+
961
+ if ($key == $selecteOption) {
962
+ $checked = "checked";
963
+ }
964
+ $i++;
965
+ $str .= "<input type='radio' name=\"$name\" value=\"$key\" $checked class='popup_theme_name' sgPoupNumber=".$i.">";
966
+
967
+ }
968
+ if ($checked == ''){
969
+ $checked = "checked";
970
+ }
971
+ $str = "<input type='radio' name=\"$name\" value=\"".$firstOption."\" $checked class='popup_theme_name' sgPoupNumber='1'>".$str;
972
+ return $str;
973
  }
974
+ else {
975
+ @$popup_style_name = ($popup_style_name) ? $popup_style_name : '';
976
+ $str .= "<select name=$name class=$popup_style_name input-width-static >";
977
+ foreach ($options as $key=>$option) {
978
+ if ($key == $selecteOption) {
979
+ $selected = "selected";
980
+ }
981
+ else {
982
+ $selected ='';
983
+ }
984
+ $str .= "<option value='".$key."' ".$selected." >$option</potion>";
985
+ }
986
+
987
+ $str .="</select>" ;
988
+ return $str;
989
 
 
 
990
  }
991
+
992
+ }
993
+
994
+ if(!SG_SHOW_POPUP_REVIEW) {
995
+ echo SGFunctions::addReview();
996
+ }
997
+
998
+ if (isset($_GET['saved']) && $_GET['saved']==1) {
999
+ echo '<div id="default-message" class="updated notice notice-success is-dismissible" ><p>Popup updated.</p></div>';
1000
+ }
1001
+ if (isset($_GET["titleError"])): ?>
1002
+ <div class="error notice" id="title-error-message">
1003
+ <p>Invalid Title</p>
1004
+ </div>
1005
+ <?php endif; ?>
1006
+ <form method="POST" action="<?php echo SG_APP_POPUP_ADMIN_URL;?>admin-post.php" id="add-form">
1007
+ <input type="hidden" name="action" value="<?php echo $currentActionName;?>">
1008
+ <div class="crud-wrapper">
1009
+ <div class="cereate-title-wrapper">
1010
+ <div class="sg-title-crud">
1011
+ <?php if (isset($id)): ?>
1012
+ <h2>Edit popup</h2>
1013
+ <?php else: ?>
1014
+ <h2>Create new popup</h2>
1015
+ <?php endif; ?>
1016
+ </div>
1017
+ <div class="button-wrapper">
1018
+ <p class="submit">
1019
+ <?php if (POPUP_BUILDER_PKG == POPUP_BUILDER_PKG_FREE): ?>
1020
+ <input class="crud-to-pro" type="button" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL;?>')"><div class="clear"></div>
1021
  <?php endif; ?>
1022
+ <input type="submit" id="sg-save-button" class="button-primary" value="<?php echo 'Save Changes'; ?>">
1023
+ </p>
1024
+ </div>
1025
+ </div>
1026
+ <div class="clear"></div>
1027
+ <div class="general-wrapper">
1028
+ <div id="titlediv">
1029
+ <div id="titlewrap">
1030
+ <input id="title" class="sg-js-popup-title" type="text" name="title" size="30" value="<?php echo esc_attr(@$title)?>" spellcheck="true" autocomplete="off" required = "required" placeholder='Enter title here'>
1031
+ </div>
1032
+ </div>
1033
+ <div id="left-main-div">
1034
+ <div id="sg-general">
1035
+ <div id="post-body" class="metabox-holder columns-2">
1036
+ <div id="postbox-container-2" class="postbox-container">
1037
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1038
+ <div class="postbox popupBuilder_general_postbox sgSameWidthPostBox" style="display: block;">
1039
+ <div class="handlediv generalTitle" title="Click to toggle"><br></div>
1040
+ <h3 class="hndle ui-sortable-handle generalTitle" style="cursor: pointer"><span>General</span></h3>
1041
+ <div class="generalContent sgSameWidthPostBox">
1042
+ <?php require_once($popupFilesPath."/main_section/".$popupType.".php");?>
1043
+ <input type="hidden" name="type" value="<?php echo $popupType;?>">
1044
+ <span class="liquid-width" id="theme-span">Popup theme:</span>
1045
+ <?php echo sgCreateSelect($sgPopupTheme,'theme',esc_html(@$sgColorboxTheme));?>
1046
+ <div class="theme1 sg-hide"></div>
1047
+ <div class="theme2 sg-hide"></div>
1048
+ <div class="theme3 sg-hide"></div>
1049
+ <div class="theme4 sg-hide"></div>
1050
+ <div class="theme5 sg-hide"></div>
1051
+ <div class="theme6 sg-hide"></div>
1052
+ <div class="sg-popup-theme-3 themes-suboptions sg-hide">
1053
+ <span class="liquid-width">Border color:</span>
1054
+ <div id="color-picker"><input class="sgOverlayColor" id="sgOverlayColor" type="text" name="sgTheme3BorderColor" value="<?php echo esc_attr(@$sgTheme3BorderColor); ?>" /></div>
1055
+ <br><span class="liquid-width">Border radius:</span>
1056
+ <input class="input-width-percent" type="number" min="0" max="50" name="sgTheme3BorderRadius" value="<?php echo esc_attr(@$sgTheme3BorderRadius); ?>">
1057
+ <span class="span-percent">%</span>
1058
+ </div>
1059
+ <div class="sg-popup-theme-4 themes-suboptions sg-hide">
1060
+ <span class="liquid-width">Close button text:</span>
1061
+ <input type="text" name="theme-close-text" value="<?php echo esc_attr($sgThemeCloseText);?>">
1062
+ </div>
1063
+ </div>
1064
+ </div>
1065
+
1066
+ </div>
1067
+ </div>
1068
+ </div>
1069
+ </div>
1070
+ <div id="effect">
1071
+ <div id="post-body" class="metabox-holder columns-2">
1072
+ <div id="postbox-container-2" class="postbox-container">
1073
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1074
+ <div class="postbox popupBuilder_effect_postbox sgSameWidthPostBox" style="display: block;">
1075
+ <div class="handlediv effectTitle" title="Click to toggle"><br></div>
1076
+ <h3 class="hndle ui-sortable-handle effectTitle" style="cursor: pointer"><span>Effects</span></h3>
1077
+ <div class="effectsContent">
1078
+ <span class="liquid-width">Effect type:</span>
1079
+ <?php echo sgCreateSelect($sgPopupEffects,'effect',esc_html(@$effect));?>
1080
+ <span class="js-preview-effect"></span>
1081
+ <div class="effectWrapper"><div id="effectShow" ></div></div>
1082
+
1083
+ <span class="liquid-width">Effect duration:</span>
1084
+ <input class="input-width-static" type="text" name="duration" value="<?php echo esc_attr($duration); ?>" pattern = "\d+" title="It must be number" /><span class="dashicons dashicons-info contentClick infoImageDuration sameImageStyle"></span><span class="infoDuration samefontStyle">Specify how long the popup appearance animation should take (in sec).</span></br>
1085
+
1086
+ <span class="liquid-width">Popup opening delay:</span>
1087
+ <input class="input-width-static" type="text" name="delay" value="<?php echo esc_attr($delay);?>" pattern = "\d+" title="It must be number"/><span class="dashicons dashicons-info contentClick infoImageDelay sameImageStyle"></span><span class="infoDelay samefontStyle">Specify how long the popup appearance should be delayed after loading the page (in sec).</span></br>
1088
+ </div>
1089
+ </div>
1090
+
1091
+ </div>
1092
+ </div>
1093
+ </div>
1094
+ </div>
1095
+ <?php
1096
+ require_once($popupFilesPath."/options_section/".$popupType.".php");
1097
+ echo $extensionManagerObj->optionsInclude($popupType);
1098
+ ?>
1099
+ </div>
1100
+ <div id="right-main-div">
1101
+ <div id="right-main">
1102
+ <div id="dimentions">
1103
+ <div id="post-body" class="metabox-holder columns-2">
1104
+ <div id="postbox-container-2" class="postbox-container">
1105
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1106
+ <div class="postbox popupBuilder_dimention_postbox sgSameWidthPostBox" style="display: block;">
1107
+ <div class="handlediv dimentionsTitle" title="Click to toggle"><br></div>
1108
+ <h3 class="hndle ui-sortable-handle dimentionsTitle" style="cursor: pointer"><span>Dimensions</span></h3>
1109
+ <div class="dimensionsContent">
1110
+ <span class="liquid-width">Width:</span>
1111
+ <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>
1112
+ <span class="liquid-width">Height:</span>
1113
+ <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>
1114
+ <span class="liquid-width">Max width:</span>
1115
+ <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>
1116
+ <span class="liquid-width">Max height:</span>
1117
+ <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>
1118
+ <span class="liquid-width">Initial width:</span>
1119
+ <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>
1120
+ <span class="liquid-width">Initial height:</span>
1121
+ <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>
1122
+ </div>
1123
+ </div>
1124
+
1125
+ </div>
1126
+ </div>
1127
+ </div>
1128
+ </div>
1129
+ <div id="options">
1130
+ <div id="post-body" class="metabox-holder columns-2">
1131
+ <div id="postbox-container-2" class="postbox-container">
1132
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1133
+ <div class="postbox popupBuilder_options_postbox sgSameWidthPostBox" style="display: block;">
1134
+ <div class="handlediv optionsTitle" title="Click to toggle"><br></div>
1135
+ <h3 class="hndle ui-sortable-handle optionsTitle" style="cursor: pointer"><span>Options</span></h3>
1136
+ <div class="optionsContent">
1137
+ <span class="liquid-width">Dismiss on &quot;esc&quot; key:</span><input class="input-width-static" type="checkbox" name="escKey" <?php echo $sgEscKey;?>/>
1138
+ <span class="dashicons dashicons-info escKeyImg sameImageStyle"></span><span class="infoEscKey samefontStyle">The popup will be dismissed when user presses on 'esc' key.</span></br>
1139
+
1140
+ <span class="liquid-width" id="createDescribeClose">Show &quot;close&quot; button:</span><input class="input-width-static" type="checkbox" name="closeButton" <?php echo $sgCloseButton;?> />
1141
+ <span class="dashicons dashicons-info CloseImg sameImageStyle"></span><span class="infoCloseButton samefontStyle">The popup will contain 'close' button.</span><br>
1142
+
1143
+ <span class="liquid-width">Enable content scrolling:</span><input class="input-width-static" type="checkbox" name="scrolling" <?php echo $sgScrolling;?> />
1144
+ <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>
1145
+
1146
+ <span class="liquid-width">Enable reposition:</span><input class="input-width-static" type="checkbox" name="reposition" <?php echo $sgReposition;?> />
1147
+ <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>
1148
+
1149
+ <span class="liquid-width">Enable scaling:</span><input class="input-width-static" type="checkbox" name="scaling" <?php echo $sgScaling;?> />
1150
+ <span class="dashicons dashicons-info scrollingImg sameImageStyle"></span><span class="infoScaling samefontStyle">Resize popup according to screen size</span><br>
1151
+
1152
+ <span class="liquid-width">Dismiss on overlay click:</span><input class="input-width-static" type="checkbox" name="overlayClose" <?php echo $sgOverlayClose;?> />
1153
+ <span class="dashicons dashicons-info overlayImg sameImageStyle"></span><span class="infoOverlayClose samefontStyle">The popup will be dismissed when user clicks beyond of the popup area.</span><br>
1154
+
1155
+ <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;?> />
1156
+ <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>
1157
+
1158
+ <span class="liquid-width">Reopen after form submission:</span><input class="input-width-static" type="checkbox" name="reopenAfterSubmission" <?php echo $sgReopenAfterSubmission;?> />
1159
+ <span class="dashicons dashicons-info overlayImg sameImageStyle"></span><span class="infoReopenSubmiting samefontStyle">If checked, the popup will reopen after form submission.</span><br>
1160
+
1161
+ <div class="sg-hide sg-full-width js-content-click-wrraper">
1162
+ <?php echo createRadiobuttons($contentClickOptions, "content-click-behavior", true, esc_html($sgContentClickBehavior), "liquid-width"); ?>
1163
+ <div class="sg-hide js-readio-buttons-acordion-content sg-full-width">
1164
+ <span class="liquid-width">Url:</span><input class="input-width-static" type="text" name='click-redirect-to-url' value="<?php echo esc_attr(@$sgClickRedirectToUrl); ?>">
1165
+ <span class="liquid-width">Redirect to new tab:</span><input type="checkbox" name="redirect-to-new-tab" <?php echo $sgRedirectToNewTab; ?> >
1166
+ </div>
1167
+ </div>
1168
+
1169
+ <span class="liquid-width">Change overlay color:</span><div id="color-picker"><input class="sgOverlayColor" id="sgOverlayColor" type="text" name="sgOverlayColor" value="<?php echo esc_attr(@$sgOverlayColor); ?>" /></div><br>
1170
+
1171
+ <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>
1172
+
1173
+ <span class="liquid-width" id="createDescribeOpacitcy">Background overlay opacity:</span><div class="slider-wrapper">
1174
+ <input type="text" class="js-decimal" value="<?php echo esc_attr($sgOpacity);?>" rel="<?php echo esc_attr($sgOpacity);?>" name="opacity"/>
1175
+ <div id="js-display-decimal" class="display-box"></div>
1176
+ </div><br>
1177
+
1178
+ <span class="liquid-width">Overlay custom class:</span><input class="input-width-static" type="text" name="sgOverlayCustomClasss" value="<?php echo esc_attr(@$sgOverlayCustomClasss);?>">
1179
+ <br>
1180
+
1181
+ <span class="liquid-width">Content custom class:</span><input class="input-width-static" type="text" name="sgContentCustomClasss" value="<?php echo esc_attr(@$sgContentCustomClasss);?>">
1182
+ <br>
1183
+
1184
+ <span class="liquid-width" id="createDescribeFixed">Popup location:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popupFixed" <?php echo $sgPopupFixed;?> />
1185
+ <div class="js-popop-fixeds">
1186
+ <span class="fix-wrapper-style" >&nbsp;</span>
1187
+ <div class="fixed-wrapper">
1188
+ <div class="js-fixed-position-style" id="fixed-position1" data-sgvalue="1"></div>
1189
+ <div class="js-fixed-position-style" id="fixed-position2"data-sgvalue="2"></div>
1190
+ <div class="js-fixed-position-style" id="fixed-position3" data-sgvalue="3"></div>
1191
+ <div class="js-fixed-position-style" id="fixed-position4" data-sgvalue="4"></div>
1192
+ <div class="js-fixed-position-style" id="fixed-position5" data-sgvalue="5"></div>
1193
+ <div class="js-fixed-position-style" id="fixed-position6" data-sgvalue="6"></div>
1194
+ <div class="js-fixed-position-style" id="fixed-position7" data-sgvalue="7"></div>
1195
+ <div class="js-fixed-position-style" id="fixed-position8" data-sgvalue="8"></div>
1196
+ <div class="js-fixed-position-style" id="fixed-position9" data-sgvalue="9"></div>
1197
+ </div>
1198
+ </div>
1199
+ <input type="hidden" name="fixedPostion" class="js-fixed-postion" value="<?php echo esc_attr(@$sgFixedPostion);?>">
1200
+ </div>
1201
+ </div>
1202
+
1203
+ </div>
1204
+ </div>
1205
+ </div>
1206
+ </div>
1207
+ <?php require_once("options_section/pro.php"); ?>
1208
+ </div>
1209
+ </div>
1210
+ <div class="clear"></div>
1211
+ <?php
1212
+ $isActivePopup = SgPopupGetData::isActivePopup(@$id);
1213
+ if(!@$id) $isActivePopup = 'checked';
1214
  ?>
1215
+ <input class="sg-hide-element" name="isActiveStatus" data-switch-id="'.$id.'" type="checkbox" <?php echo $isActivePopup; ?> >
1216
+ <input type="hidden" class="button-primary" value="<?php echo esc_attr(@$id);?>" name="hidden_popup_number" />
1217
+ </div>
1218
+ </div>
1219
+ </form>
1220
  <?php
1221
  SGFunctions::showInfo();
files/sg_popup_save.php CHANGED
@@ -34,6 +34,9 @@ function sgSanitize($optionsKey, $isTextField = false)
34
  function sgPopupSave()
35
  {
36
  global $wpdb;
 
 
 
37
  $socialButtons = array();
38
  $socialOptions = array();
39
  $countdownOptions = array();
@@ -244,11 +247,18 @@ function sgPopupSave()
244
  $popupClassName = $popupName."Popup";
245
 
246
  require_once(SG_APP_POPUP_PATH ."/classes/".$popupClassName.".php");
 
247
  if ($id == "") {
248
  global $wpdb;
 
249
  call_user_func(array($popupClassName, 'create'), $data);
250
  $lastId = $wpdb->get_var("SELECT LAST_INSERT_ID() FROM ". $wpdb->prefix."sg_popup");
251
-
 
 
 
 
 
252
  if(POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) {
253
  SGPopup::removePopupFromPages($lastId,'page');
254
  SGPopup::removePopupFromPages($lastId,'categories');
@@ -394,6 +404,11 @@ function sgPopupSave()
394
  }
395
 
396
  setOptionPopupType($id, $type);
 
 
 
 
 
397
  $popup->save();
398
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=$id&type=$type&saved=1");
399
  exit();
34
  function sgPopupSave()
35
  {
36
  global $wpdb;
37
+ /*Removing all added slashes*/
38
+ $_POST = stripslashes_deep($_POST);
39
+ $postData = $_POST;
40
  $socialButtons = array();
41
  $socialOptions = array();
42
  $countdownOptions = array();
247
  $popupClassName = $popupName."Popup";
248
 
249
  require_once(SG_APP_POPUP_PATH ."/classes/".$popupClassName.".php");
250
+
251
  if ($id == "") {
252
  global $wpdb;
253
+
254
  call_user_func(array($popupClassName, 'create'), $data);
255
  $lastId = $wpdb->get_var("SELECT LAST_INSERT_ID() FROM ". $wpdb->prefix."sg_popup");
256
+ $postData['saveMod'] = '';
257
+ $postData['popupId'] = $lastId;
258
+ $extensionManagerObj = new SGPBExtensionManager();
259
+ $extensionManagerObj->setPostData($postData);
260
+ $extensionManagerObj->save();
261
+
262
  if(POPUP_BUILDER_PKG != POPUP_BUILDER_PKG_FREE) {
263
  SGPopup::removePopupFromPages($lastId,'page');
264
  SGPopup::removePopupFromPages($lastId,'categories');
404
  }
405
 
406
  setOptionPopupType($id, $type);
407
+ $postData['saveMod'] = '1';
408
+ $postData['popupId'] = $id;
409
+ $extensionManagerObj = new SGPBExtensionManager();
410
+ $extensionManagerObj->setPostData($postData);
411
+ $extensionManagerObj->save();
412
  $popup->save();
413
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=$id&type=$type&saved=1");
414
  exit();
img/AdblockPro.png ADDED
Binary file
javascript/sg_popup_frontend.js CHANGED
@@ -206,14 +206,14 @@ SGPopup.prototype.sgPopupScalingDimensions = function() {
206
  if(popupWrapper > screenWidth && popupWrapper != 9999) {
207
  var scaleDegree = screenWidth/popupWrapper;
208
  jQuery("#sgcboxWrapper").css({
209
- "transform-origin" : "0 0",
210
  'transform': "scale("+scaleDegree+", 1)"
211
  })
212
  popupWrapper = 0;
213
  }
214
  else {
215
  jQuery("#sgcboxWrapper").css({
216
- "transform-origin" : "0 0",
217
  'transform': "scale(1, 1)"
218
  })
219
  }
206
  if(popupWrapper > screenWidth && popupWrapper != 9999) {
207
  var scaleDegree = screenWidth/popupWrapper;
208
  jQuery("#sgcboxWrapper").css({
209
+ "transform-origin" : "0 0 !important",
210
  'transform': "scale("+scaleDegree+", 1)"
211
  })
212
  popupWrapper = 0;
213
  }
214
  else {
215
  jQuery("#sgcboxWrapper").css({
216
+ "transform-origin" : "0 0 !important",
217
  'transform': "scale(1, 1)"
218
  })
219
  }
javascript/sg_popup_init.js CHANGED
@@ -94,7 +94,7 @@ SgPopupInit.prototype.initByPopupType = function() {
94
  popupObj.init();
95
  break;
96
  case 'contactForm':
97
- popupObj = new SgContactForm();
98
  popupObj.buildStyle();
99
  break;
100
  case 'social':
94
  popupObj.init();
95
  break;
96
  case 'contactForm':
97
+ popupObj = new SgContactForm(popupId);
98
  popupObj.buildStyle();
99
  break;
100
  case 'social':
javascript/sg_popup_javascript.php CHANGED
@@ -8,7 +8,10 @@ function sg_set_admin_url($hook) {
8
 
9
  function sg_popup_admin_scripts($hook) {
10
 
11
- if ( 'popup-builder_page_edit-popup' == $hook || 'popup-builder_page_create-popup' == $hook || 'popup-builder_page_subscribers' == $hook) {
 
 
 
12
 
13
  wp_enqueue_media();
14
  wp_register_script('javascript', SG_APP_POPUP_URL . '/javascript/sg_popup_backend.js', array('jquery', 'wp-color-picker'));
@@ -60,7 +63,7 @@ function sg_popup_admin_scripts($hook) {
60
 
61
  function SgFrontendScripts() {
62
  wp_enqueue_script('sg_popup_core', plugins_url('/sg_popup_core.js', __FILE__), '1.0.0', true);
63
- 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>";
64
  }
65
 
66
  add_action('admin_enqueue_scripts', 'sg_set_admin_url');
8
 
9
  function sg_popup_admin_scripts($hook) {
10
 
11
+ if ( 'popup-builder_page_edit-popup' == $hook
12
+ || 'popup-builder_page_create-popup' == $hook
13
+ || 'popup-builder_page_subscribers' == $hook
14
+ || 'popup-builder_page_newsletter' == $hook) {
15
 
16
  wp_enqueue_media();
17
  wp_register_script('javascript', SG_APP_POPUP_URL . '/javascript/sg_popup_backend.js', array('jquery', 'wp-color-picker'));
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');
popup-builder.php CHANGED
@@ -3,19 +3,21 @@
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.6
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_CLASSES .'/SGPopupBuilderMain.php');
14
 
15
  $mainPopupObj = new SGPopupBuilderMain();
16
  $mainPopupObj->init();
17
 
18
  require_once(SG_APP_POPUP_CLASSES .'/SGPopup.php');
 
19
  require_once(SG_APP_POPUP_FILES .'/sg_functions.php');
20
  require_once(SG_APP_POPUP_HELPERS .'/Integrate_external_settings.php');
21
  require_once(SG_APP_POPUP_HELPERS .'/SgPopupGetData.php');
@@ -45,9 +47,12 @@ function sgNewBlogPopup()
45
 
46
  function sgPopupActivate()
47
  {
 
 
48
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
49
  PopupInstaller::install();
50
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
 
51
  PopupProInstaller::install();
52
  }
53
  }
@@ -103,6 +108,8 @@ function sgRenderPopupScript($id)
103
  if (SGPopup::$registeredScripts==false) {
104
  sgRegisterScripts();
105
  }
 
 
106
  wp_register_style('sg_colorbox_theme', SG_APP_POPUP_URL . "/style/sgcolorbox/colorbox1.css", array(), SG_POPUP_VERSION);
107
  wp_register_style('sg_colorbox_theme2', SG_APP_POPUP_URL . "/style/sgcolorbox/colorbox2.css", array(), SG_POPUP_VERSION);
108
  wp_register_style('sg_colorbox_theme3', SG_APP_POPUP_URL . "/style/sgcolorbox/colorbox3.css", array(), SG_POPUP_VERSION);
@@ -150,19 +157,19 @@ function sgShowShortCode($args, $content)
150
  sgRenderPopupScript($args['id']);
151
  $attr = '';
152
  $eventName = @$args['event'];
153
-
154
  if(isset($args['insidepopup'])) {
155
  $attr .= 'insidePopup="on"';
156
- }
157
- if(@$args['event'] == 'onload') {
158
- $content = '';
159
- }
160
- if(!isset($args['event'])) {
161
- $eventName = 'click';
162
- }
163
- if(isset($args["wrap"])) {
164
- echo "<".$args["wrap"]." class='sg-show-popup' data-sgpopupid=".@$args['id']." $attr data-popup-event=".$eventName.">".$content."</".$args["wrap"]." >";
165
- } else {
166
  echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=".@$args['id']." $attr data-popup-event=".$eventName.">".$content."</a>";
167
  }
168
  }
@@ -171,7 +178,7 @@ function sgShowShortCode($args, $content)
171
  if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
172
  $page = get_queried_object_id();
173
  $popupsId = SgPopupPro::allowPopupInAllPages($page,'page');
174
-
175
  /* When have many popups in current page */
176
  if(count($popupsId) > 0) {
177
  /* Add shordcode popup id in the QUEUE for php side */
@@ -179,7 +186,7 @@ function sgShowShortCode($args, $content)
179
  /* Add shordcode popup id at the first in the QUEUE for javascript side */
180
  echo "<script type=\"text/javascript\">SG_POPUPS_QUEUE.splice(0, 0, ".$args['id'].");</script>";
181
  update_option("SG_MULTIPLE_POPUP",$popupsId);
182
- sgRenderPopupScript($args['id']);
183
  }
184
  else {
185
  echo showPopupInPage($args['id']);
@@ -188,7 +195,7 @@ function sgShowShortCode($args, $content)
188
  else {
189
  echo showPopupInPage($args['id']);
190
  }
191
-
192
  }
193
  $shortcodeContent = ob_get_contents();
194
  ob_end_clean();
@@ -199,7 +206,7 @@ add_shortCode('sg_popup', 'sgShowShortCode');
199
  function sgRenderPopupOpen($popupId)
200
  {
201
  sgRenderPopupScript($popupId);
202
-
203
  echo "<script type=\"text/javascript\">
204
 
205
  sgAddEvent(window, 'load',function() {
@@ -220,7 +227,7 @@ function showPopupInPage($popupId) {
220
  if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
221
 
222
  $popupInTimeRange = SgPopupPro::popupInTimeRange($popupId);
223
-
224
  if(!$popupInTimeRange) {
225
  return false;
226
  }
@@ -233,7 +240,7 @@ function showPopupInPage($popupId) {
233
 
234
  $showUser = SgPopupPro::showUserResolution($popupId);
235
  if(!$showUser) return false;
236
-
237
  if(!SGPopup::showPopupForCounrty($popupId)) { /* Sended popupId and function return true or false */
238
  return;
239
  }
@@ -245,52 +252,51 @@ function redenderScriptMode($popupId)
245
  {
246
  /* If user delete popup */
247
  $obj = SGPopup::findById($popupId);
 
248
  if(empty($obj)) {
249
  return;
250
  }
 
251
  $multiplePopup = get_option('SG_MULTIPLE_POPUP');
252
- $exitIntentPopupId = get_option('SG_POPUP_EXITINTENT_'.$popupId);
253
-
254
- if(isset($exitIntentPopupId) && $exitIntentPopupId == $popupId) {
255
  sgRenderPopupScript($popupId);
256
- require_once(SG_APP_POPUP_CLASSES.'/SGExitintentPopup.php');
257
- $exitObj = new SGExitintentPopup();
258
- echo $exitObj->getExitIntentInitScript($popupId);
259
  return;
260
  }
261
  if($multiplePopup && @in_array($popupId, $multiplePopup)) {
262
  sgRenderPopupScript($popupId);
263
- return;
264
  }
265
-
266
 
267
  sgRenderPopupOpen($popupId);
268
  }
269
 
270
  function getPopupIdFromContentByClass($content) {
271
 
272
- $popupsID = array();
273
- $popupClasses = array(
274
- 'sg-popup-id-',
275
- 'sg-iframe-popup-',
276
- 'sg-confirm-popup-'
277
- );
278
 
279
- foreach ($popupClasses as $popupClassName) {
280
 
281
- preg_match_all("/".$popupClassName."+[0-9]+/i", $content, $matchers);
282
 
283
- foreach ($matchers['0'] as $value) {
284
- $ids = explode($popupClassName, $value);
285
- $id = @$ids[1];
286
 
287
- if(!empty($id)) {
288
- array_push($popupsID, $id);
289
- }
290
- }
291
- }
292
-
293
- return $popupsID;
294
  }
295
 
296
  function getPopupIdInPageByClass($pageId) {
@@ -301,10 +307,11 @@ function getPopupIdInPageByClass($pageId) {
301
  $content = $postContentObj->post_content;
302
  return getPopupIdFromContentByClass($content);
303
  }
304
-
305
  return 0;
306
  }
307
 
 
308
  /**
309
  * Get popup id from url
310
  *
@@ -355,11 +362,11 @@ function sgOnloadPopup()
355
  /* Retrun all popups id width selected On All Pages */
356
  $popupsId = SgPopupPro::allowPopupInAllPages($page,'page');
357
  $categories = SgPopupPro::allowPopupInAllCategories($page);
358
-
359
  $popupsId = array_merge($popupsId,$categories);
360
-
361
  $sgpbAllPosts = get_option("SG_ALL_POSTS");
362
-
363
  $popupsInAllPosts = SgPopupPro::popupsIdInAllCategories($postType);
364
  $popupsId = array_merge($popupsInAllPosts, $popupsId);
365
 
@@ -373,7 +380,7 @@ function sgOnloadPopup()
373
 
374
  showPopupInPage($queuePupupId);
375
  }
376
-
377
  $popupsId = json_encode($popupsId);
378
  }
379
  else {
@@ -410,10 +417,19 @@ function getPopupIdByClassFromMenu ($items) {
410
  return $items;
411
  }
412
 
 
 
 
 
 
 
 
 
 
413
  add_action('wp_head','sgOnloadPopup');
414
  require_once( SG_APP_POPUP_FILES . '/sg_popup_media_button.php');
415
  require_once( SG_APP_POPUP_FILES . '/sg_popup_save.php'); // saving form data
416
  require_once( SG_APP_POPUP_FILES . '/sg_popup_ajax.php');
417
  require_once( SG_APP_POPUP_FILES . '/sg_admin_post.php');
418
  require_once( SG_APP_POPUP_FILES . '/sg_popup_filetrs.php');
419
- require_once( SG_APP_POPUP_FILES . '/sg_popup_actions.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.7
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
 
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');
22
  require_once(SG_APP_POPUP_HELPERS .'/Integrate_external_settings.php');
23
  require_once(SG_APP_POPUP_HELPERS .'/SgPopupGetData.php');
47
 
48
  function sgPopupActivate()
49
  {
50
+
51
+
52
  update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
53
  PopupInstaller::install();
54
  if (POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
55
+ PopupProInstaller::addExtensionToPluginSection();
56
  PopupProInstaller::install();
57
  }
58
  }
108
  if (SGPopup::$registeredScripts==false) {
109
  sgRegisterScripts();
110
  }
111
+ $extensionManagerObj = new SGPBExtensionManager();
112
+ $extensionManagerObj->includeExtensionScripts($id);
113
  wp_register_style('sg_colorbox_theme', SG_APP_POPUP_URL . "/style/sgcolorbox/colorbox1.css", array(), SG_POPUP_VERSION);
114
  wp_register_style('sg_colorbox_theme2', SG_APP_POPUP_URL . "/style/sgcolorbox/colorbox2.css", array(), SG_POPUP_VERSION);
115
  wp_register_style('sg_colorbox_theme3', SG_APP_POPUP_URL . "/style/sgcolorbox/colorbox3.css", array(), SG_POPUP_VERSION);
157
  sgRenderPopupScript($args['id']);
158
  $attr = '';
159
  $eventName = @$args['event'];
160
+
161
  if(isset($args['insidepopup'])) {
162
  $attr .= 'insidePopup="on"';
163
+ }
164
+ if(@$args['event'] == 'onload') {
165
+ $content = '';
166
+ }
167
+ if(!isset($args['event'])) {
168
+ $eventName = 'click';
169
+ }
170
+ if(isset($args["wrap"])) {
171
+ echo "<".$args["wrap"]." class='sg-show-popup' data-sgpopupid=".@$args['id']." $attr data-popup-event=".$eventName.">".$content."</".$args["wrap"]." >";
172
+ } else {
173
  echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=".@$args['id']." $attr data-popup-event=".$eventName.">".$content."</a>";
174
  }
175
  }
178
  if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
179
  $page = get_queried_object_id();
180
  $popupsId = SgPopupPro::allowPopupInAllPages($page,'page');
181
+
182
  /* When have many popups in current page */
183
  if(count($popupsId) > 0) {
184
  /* Add shordcode popup id in the QUEUE for php side */
186
  /* Add shordcode popup id at the first in the QUEUE for javascript side */
187
  echo "<script type=\"text/javascript\">SG_POPUPS_QUEUE.splice(0, 0, ".$args['id'].");</script>";
188
  update_option("SG_MULTIPLE_POPUP",$popupsId);
189
+ showPopupInPage($args['id']);
190
  }
191
  else {
192
  echo showPopupInPage($args['id']);
195
  else {
196
  echo showPopupInPage($args['id']);
197
  }
198
+
199
  }
200
  $shortcodeContent = ob_get_contents();
201
  ob_end_clean();
206
  function sgRenderPopupOpen($popupId)
207
  {
208
  sgRenderPopupScript($popupId);
209
+
210
  echo "<script type=\"text/javascript\">
211
 
212
  sgAddEvent(window, 'load',function() {
227
  if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE) {
228
 
229
  $popupInTimeRange = SgPopupPro::popupInTimeRange($popupId);
230
+
231
  if(!$popupInTimeRange) {
232
  return false;
233
  }
240
 
241
  $showUser = SgPopupPro::showUserResolution($popupId);
242
  if(!$showUser) return false;
243
+
244
  if(!SGPopup::showPopupForCounrty($popupId)) { /* Sended popupId and function return true or false */
245
  return;
246
  }
252
  {
253
  /* If user delete popup */
254
  $obj = SGPopup::findById($popupId);
255
+
256
  if(empty($obj)) {
257
  return;
258
  }
259
+
260
  $multiplePopup = get_option('SG_MULTIPLE_POPUP');
261
+ $hasEvent = SGPBExtension::hasPopupEvent($popupId);
262
+
263
+ if($hasEvent != 0) {
264
  sgRenderPopupScript($popupId);
 
 
 
265
  return;
266
  }
267
  if($multiplePopup && @in_array($popupId, $multiplePopup)) {
268
  sgRenderPopupScript($popupId);
269
+ return;
270
  }
271
+
272
 
273
  sgRenderPopupOpen($popupId);
274
  }
275
 
276
  function getPopupIdFromContentByClass($content) {
277
 
278
+ $popupsID = array();
279
+ $popupClasses = array(
280
+ 'sg-popup-id-',
281
+ 'sg-iframe-popup-',
282
+ 'sg-confirm-popup-'
283
+ );
284
 
285
+ foreach ($popupClasses as $popupClassName) {
286
 
287
+ preg_match_all("/".$popupClassName."+[0-9]+/i", $content, $matchers);
288
 
289
+ foreach ($matchers['0'] as $value) {
290
+ $ids = explode($popupClassName, $value);
291
+ $id = @$ids[1];
292
 
293
+ if(!empty($id)) {
294
+ array_push($popupsID, $id);
295
+ }
296
+ }
297
+ }
298
+
299
+ return $popupsID;
300
  }
301
 
302
  function getPopupIdInPageByClass($pageId) {
307
  $content = $postContentObj->post_content;
308
  return getPopupIdFromContentByClass($content);
309
  }
310
+
311
  return 0;
312
  }
313
 
314
+
315
  /**
316
  * Get popup id from url
317
  *
362
  /* Retrun all popups id width selected On All Pages */
363
  $popupsId = SgPopupPro::allowPopupInAllPages($page,'page');
364
  $categories = SgPopupPro::allowPopupInAllCategories($page);
365
+
366
  $popupsId = array_merge($popupsId,$categories);
367
+
368
  $sgpbAllPosts = get_option("SG_ALL_POSTS");
369
+
370
  $popupsInAllPosts = SgPopupPro::popupsIdInAllCategories($postType);
371
  $popupsId = array_merge($popupsInAllPosts, $popupsId);
372
 
380
 
381
  showPopupInPage($queuePupupId);
382
  }
383
+
384
  $popupsId = json_encode($popupsId);
385
  }
386
  else {
417
  return $items;
418
  }
419
 
420
+ function sg_popup_plugin_loaded() {
421
+ $versionPopup = get_option('SG_POPUP_VERSION');
422
+ if(!$versionPopup || $versionPopup < SG_POPUP_VERSION ) {
423
+ update_option('SG_POPUP_VERSION', SG_POPUP_VERSION);
424
+ PopupInstaller::install();
425
+ }
426
+ }
427
+ add_action('plugins_loaded', 'sg_popup_plugin_loaded');
428
+
429
  add_action('wp_head','sgOnloadPopup');
430
  require_once( SG_APP_POPUP_FILES . '/sg_popup_media_button.php');
431
  require_once( SG_APP_POPUP_FILES . '/sg_popup_save.php'); // saving form data
432
  require_once( SG_APP_POPUP_FILES . '/sg_popup_ajax.php');
433
  require_once( SG_APP_POPUP_FILES . '/sg_admin_post.php');
434
  require_once( SG_APP_POPUP_FILES . '/sg_popup_filetrs.php');
435
+ require_once( SG_APP_POPUP_FILES . '/sg_popup_actions.php');
readme.txt CHANGED
@@ -155,6 +155,13 @@ Go to the Popup Builder settings and set your desired options.
155
 
156
  == Changelog ==
157
 
 
 
 
 
 
 
 
158
  = Version 2.4.6 =
159
  * UX modifications.
160
 
@@ -546,7 +553,7 @@ Leave us a good review :)
546
 
547
  == Upgrade Notice ==
548
 
549
- Current Version of Popup Builder is 2.4.6
550
 
551
  == Other Notes ==
552
 
155
 
156
  == Changelog ==
157
 
158
+ = Version 2.4.7 =
159
+ * Added extension logic
160
+ * Code optimization
161
+ * Bug fixes
162
+ * Exit-Intent extension (PRO)
163
+ * AdBlock extension (PRO)
164
+
165
  = Version 2.4.6 =
166
  * UX modifications.
167
 
553
 
554
  == Upgrade Notice ==
555
 
556
+ Current Version of Popup Builder is 2.4.7
557
 
558
  == Other Notes ==
559
 
style/sg_popup_style.css CHANGED
@@ -7,7 +7,7 @@
7
  display: none !important;
8
  }
9
 
10
- .sg-margin0 {
11
  margin: 0;
12
  }
13
 
@@ -129,7 +129,7 @@ h3.hndle .ui-sortable-handle .generalTitle {
129
  display: none;
130
  }
131
  .sg-hide-element {
132
- display: none !important;
133
  }
134
 
135
  div.sg-hide {
@@ -490,10 +490,6 @@ span.phpErrorStyle {
490
  background-image: url("../img/SocialButtonPro.png");
491
  }
492
 
493
- .exit-intent-pro {
494
- background-image: url("../img/ExitIntentPro.png");
495
- }
496
-
497
  .subscription-pro {
498
  background-image: url("../img/SubscriptionButtonPro.png");
499
  }
@@ -514,6 +510,14 @@ span.phpErrorStyle {
514
  background-image: url("../img/AWeberPro.png");
515
  }
516
 
 
 
 
 
 
 
 
 
517
  .pro-options {
518
  clear: both;
519
  width: 100%;
@@ -891,7 +895,7 @@ input[name="theme"] {
891
  position: absolute;
892
  width: 20px;
893
  -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
894
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
895
  }
896
 
897
  .range-min,
@@ -928,7 +932,7 @@ input[name="theme"] {
928
  top: -10px;
929
  width: 35px;
930
  -webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.15);
931
- box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.15);
932
  }
933
 
934
  #color-picker,
@@ -1356,10 +1360,10 @@ input[name="theme"] {
1356
 
1357
  /*Swich button style*/
1358
  .sg-switch {
1359
- position: relative;
1360
- display: inline-block;
1361
- width: 60px;
1362
- height: 34px;
1363
  }
1364
 
1365
  /* Hide default HTML checkbox */
@@ -1382,76 +1386,76 @@ input[name="theme"] {
1382
  }
1383
 
1384
  .sg-slider:before {
1385
- position: absolute;
1386
- content: "";
1387
- height: 26px;
1388
- width: 26px;
1389
- left: 4px;
1390
- bottom: 4px;
1391
- background-color: white;
1392
- -webkit-transition: .4s;
1393
- transition: .4s;
1394
  }
1395
 
1396
  input:checked + .sg-slider {
1397
- background-color: #2196F3;
1398
  }
1399
 
1400
  input:focus + .sg-slider {
1401
- box-shadow: 0 0 1px #2196F3;
1402
  }
1403
 
1404
  input:checked + .sg-slider:before {
1405
- -webkit-transform: translateX(26px);
1406
- -ms-transform: translateX(26px);
1407
- transform: translateX(26px);
1408
  }
1409
 
1410
  /* Rounded sliders */
1411
  .sg-slider.sg-round {
1412
- border-radius: 34px;
1413
  }
1414
 
1415
  .sg-slider.sg-round:before {
1416
- border-radius: 50%;
1417
  }
1418
  /* Rounded sliders */
1419
  .sg-slider.sg-round {
1420
- border-radius: 34px;
1421
  }
1422
 
1423
  .sg-slider.sg-round:before {
1424
- border-radius: 50%;
1425
  }
1426
 
1427
  /*more plugins section*/
1428
  .plugin-icon {
1429
- float:left;
1430
  margin: 3px 6px 6px 0px;
1431
  }
1432
 
1433
- #plugin-icon-backup {
1434
  width:128px;
1435
  height:128px;
1436
  background-image: url(//ps.w.org/backup/assets/icon-128x128.png?rev=1293306);
1437
- background-size:128px 128px;
1438
  }
1439
 
1440
- #plugin-icon-social-media-builder {
1441
  width:128px;
1442
  height:128px;
1443
  background-image: url(//ps.w.org/social-media-builder/assets/icon-128x128.png?rev=1315835);
1444
  background-size:128px 128px;
1445
  }
1446
 
1447
- #plugin-icon-review-builder {
1448
  width:128px;
1449
  height:128px;
1450
  background-image: url(//ps.w.org/review-builder/assets/icon-128x128.png?rev=1489430);
1451
  background-size:128px 128px;
1452
  }
1453
 
1454
- #plugin-icon-kicker {
1455
  width:128px;
1456
  height:128px;
1457
  background-size:128px 128px;
@@ -1529,13 +1533,13 @@ input:checked + .sg-slider:before {
1529
 
1530
  .balck-friday-line-left{
1531
  margin-right: 22px;
1532
- float: left;
1533
- margin-top: 35px;
1534
  }
1535
 
1536
  .balck-friday-line-right {
1537
- float: left;
1538
- margin: 35px 15px 0px 15px;
1539
  }
1540
 
1541
  .sg-black-friday-name {
@@ -1571,8 +1575,8 @@ input:checked + .sg-slider:before {
1571
  width: 120px;
1572
  }
1573
  .sg-black-percent {
1574
- font-size: 35px;
1575
- margin-top: 6px;
1576
  }
1577
  }
1578
  @media only screen and (min-width:800px) {
@@ -1580,7 +1584,7 @@ input:checked + .sg-slider:before {
1580
  min-width:800px;
1581
  margin-left: 10px;
1582
  margin-right: 10px;
1583
- }
1584
  .reviewPanelContent {
1585
  min-width:800px;
1586
  }
7
  display: none !important;
8
  }
9
 
10
+ .sg-margin0 {
11
  margin: 0;
12
  }
13
 
129
  display: none;
130
  }
131
  .sg-hide-element {
132
+ display: none !important;
133
  }
134
 
135
  div.sg-hide {
490
  background-image: url("../img/SocialButtonPro.png");
491
  }
492
 
 
 
 
 
493
  .subscription-pro {
494
  background-image: url("../img/SubscriptionButtonPro.png");
495
  }
510
  background-image: url("../img/AWeberPro.png");
511
  }
512
 
513
+ #exitIntent-pro {
514
+ background-image: url("../img/ExitIntentPro.png");
515
+ }
516
+
517
+ #adBlock-pro {
518
+ background-image: url("../img/AdblockPro.png");
519
+ }
520
+
521
  .pro-options {
522
  clear: both;
523
  width: 100%;
895
  position: absolute;
896
  width: 20px;
897
  -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
898
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
899
  }
900
 
901
  .range-min,
932
  top: -10px;
933
  width: 35px;
934
  -webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.15);
935
+ box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.15);
936
  }
937
 
938
  #color-picker,
1360
 
1361
  /*Swich button style*/
1362
  .sg-switch {
1363
+ position: relative;
1364
+ display: inline-block;
1365
+ width: 60px;
1366
+ height: 34px;
1367
  }
1368
 
1369
  /* Hide default HTML checkbox */
1386
  }
1387
 
1388
  .sg-slider:before {
1389
+ position: absolute;
1390
+ content: "";
1391
+ height: 26px;
1392
+ width: 26px;
1393
+ left: 4px;
1394
+ bottom: 4px;
1395
+ background-color: white;
1396
+ -webkit-transition: .4s;
1397
+ transition: .4s;
1398
  }
1399
 
1400
  input:checked + .sg-slider {
1401
+ background-color: #2196F3;
1402
  }
1403
 
1404
  input:focus + .sg-slider {
1405
+ box-shadow: 0 0 1px #2196F3;
1406
  }
1407
 
1408
  input:checked + .sg-slider:before {
1409
+ -webkit-transform: translateX(26px);
1410
+ -ms-transform: translateX(26px);
1411
+ transform: translateX(26px);
1412
  }
1413
 
1414
  /* Rounded sliders */
1415
  .sg-slider.sg-round {
1416
+ border-radius: 34px;
1417
  }
1418
 
1419
  .sg-slider.sg-round:before {
1420
+ border-radius: 50%;
1421
  }
1422
  /* Rounded sliders */
1423
  .sg-slider.sg-round {
1424
+ border-radius: 34px;
1425
  }
1426
 
1427
  .sg-slider.sg-round:before {
1428
+ border-radius: 50%;
1429
  }
1430
 
1431
  /*more plugins section*/
1432
  .plugin-icon {
1433
+ float:left;
1434
  margin: 3px 6px 6px 0px;
1435
  }
1436
 
1437
+ #plugin-icon-backup {
1438
  width:128px;
1439
  height:128px;
1440
  background-image: url(//ps.w.org/backup/assets/icon-128x128.png?rev=1293306);
1441
+ background-size:128px 128px;
1442
  }
1443
 
1444
+ #plugin-icon-social-media-builder {
1445
  width:128px;
1446
  height:128px;
1447
  background-image: url(//ps.w.org/social-media-builder/assets/icon-128x128.png?rev=1315835);
1448
  background-size:128px 128px;
1449
  }
1450
 
1451
+ #plugin-icon-review-builder {
1452
  width:128px;
1453
  height:128px;
1454
  background-image: url(//ps.w.org/review-builder/assets/icon-128x128.png?rev=1489430);
1455
  background-size:128px 128px;
1456
  }
1457
 
1458
+ #plugin-icon-kicker {
1459
  width:128px;
1460
  height:128px;
1461
  background-size:128px 128px;
1533
 
1534
  .balck-friday-line-left{
1535
  margin-right: 22px;
1536
+ float: left;
1537
+ margin-top: 35px;
1538
  }
1539
 
1540
  .balck-friday-line-right {
1541
+ float: left;
1542
+ margin: 35px 15px 0px 15px;
1543
  }
1544
 
1545
  .sg-black-friday-name {
1575
  width: 120px;
1576
  }
1577
  .sg-black-percent {
1578
+ font-size: 35px;
1579
+ margin-top: 6px;
1580
  }
1581
  }
1582
  @media only screen and (min-width:800px) {
1584
  min-width:800px;
1585
  margin-left: 10px;
1586
  margin-right: 10px;
1587
+ }
1588
  .reviewPanelContent {
1589
  min-width:800px;
1590
  }