Popup Builder – Responsive WordPress Pop up - Version 2.1.9

Version Description

Download this release

Release Info

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

Code changes from version 2.1.7 to 2.1.9

classes/PopupInstaller.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  class PopupInstaller
3
  {
 
 
4
  public static function createTables($blogsId)
5
  {
6
  global $wpdb;
@@ -25,12 +27,11 @@ class PopupInstaller
25
  `content` text NOT NULL,
26
  `options` text NOT NULL
27
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
28
- $sgPopupShortcodeBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_shortCode_popup (
29
  `id` int(12) NOT NULL,
30
  `url` text NOT NULL
31
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
32
 
33
-
34
  $wpdb->query($sgPopupBase);
35
  $wpdb->query($sgPopupImageBase);
36
  $wpdb->query($sgPopupHtmlBase);
@@ -70,7 +71,7 @@ class PopupInstaller
70
 
71
  $popupFblikeTable = $wpdb->prefix.$blogsId."sg_fblike_popup";
72
  $popupFblikeSql = "DROP TABLE ". $popupFblikeTable;
73
-
74
  $popupShortcodeTable = $wpdb->prefix.$blogId."sg_shortCode_popup";
75
  $popupShortcodeSql = "DROP TABLE ". $popupShortcodeTable;
76
 
1
  <?php
2
  class PopupInstaller
3
  {
4
+ public static $maintablename = "sg_popup";
5
+
6
  public static function createTables($blogsId)
7
  {
8
  global $wpdb;
27
  `content` text NOT NULL,
28
  `options` text NOT NULL
29
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
30
+ $sgPopupShortcodeBase = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix.$blogsId."sg_shortCode_popup (
31
  `id` int(12) NOT NULL,
32
  `url` text NOT NULL
33
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
34
 
 
35
  $wpdb->query($sgPopupBase);
36
  $wpdb->query($sgPopupImageBase);
37
  $wpdb->query($sgPopupHtmlBase);
71
 
72
  $popupFblikeTable = $wpdb->prefix.$blogsId."sg_fblike_popup";
73
  $popupFblikeSql = "DROP TABLE ". $popupFblikeTable;
74
+
75
  $popupShortcodeTable = $wpdb->prefix.$blogId."sg_shortCode_popup";
76
  $popupShortcodeSql = "DROP TABLE ". $popupShortcodeTable;
77
 
classes/SGFblikePopup.php CHANGED
@@ -79,6 +79,7 @@ class SGFblikePopup extends SGPopup
79
  $layout = $options['fblike-layout'];
80
 
81
  $content = $this->getContent();
 
82
  $content .= "<div id=\"sg-facebook-like\"><script type=\"text/javascript\">
83
  (function(d, s, id) {
84
  var js, fjs = d.getElementsByTagName(s)[0];
79
  $layout = $options['fblike-layout'];
80
 
81
  $content = $this->getContent();
82
+ $content = $this->improveContent($content);
83
  $content .= "<div id=\"sg-facebook-like\"><script type=\"text/javascript\">
84
  (function(d, s, id) {
85
  var js, fjs = d.getElementsByTagName(s)[0];
classes/SGHtmlPopup.php CHANGED
@@ -49,7 +49,7 @@ class SGHtmlPopup extends SGPopup {
49
 
50
  protected function getExtraRenderOptions() {
51
  $content = $this->getContent();
52
- $content = $this->improveContent($content);
53
 
54
  return array('html' => $content);
55
  }
49
 
50
  protected function getExtraRenderOptions() {
51
  $content = $this->getContent();
52
+ $content = $this->improveContent($content);
53
 
54
  return array('html' => $content);
55
  }
classes/SGPopup.php CHANGED
@@ -240,6 +240,7 @@ abstract class SGPopup {
240
  $res = $wpdb->get_var( "SELECT COUNT(id) FROM ". $wpdb->prefix ."sg_popup" );
241
  return $res;
242
  }
 
243
  public static function getPagePopupId($page,$popup) {
244
  global $wpdb;
245
  $sql = $wpdb->prepare("SELECT meta_value FROM ". $wpdb->prefix ."postmeta WHERE post_id = %d AND meta_key = %s",$page,$popup);
@@ -251,6 +252,80 @@ abstract class SGPopup {
251
  return $id;
252
  }
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  }
255
 
256
  function sgSafeStr ($param) {
240
  $res = $wpdb->get_var( "SELECT COUNT(id) FROM ". $wpdb->prefix ."sg_popup" );
241
  return $res;
242
  }
243
+
244
  public static function getPagePopupId($page,$popup) {
245
  global $wpdb;
246
  $sql = $wpdb->prepare("SELECT meta_value FROM ". $wpdb->prefix ."postmeta WHERE post_id = %d AND meta_key = %s",$page,$popup);
252
  return $id;
253
  }
254
 
255
+ public static function showPopupForCounrty($contryIsoName, $popupId) {
256
+ $obj = SGPopup::findById($popupId);
257
+ if(!$obj) {
258
+ return true;
259
+ }
260
+ $isInArray = true;
261
+ $options = json_decode($obj->getOptions(), true);
262
+
263
+ $countryStatus = $options['countryStatus'];
264
+ $countryIso = $options['countryIso'];
265
+ $allowCountries = $options['allowCountries'];
266
+ $countryIsoArray = explode(',', $countryIso);
267
+ if($countryStatus) {
268
+ if($allowCountries == 'allow') {
269
+ $isInArray = in_array($contryIsoName, $countryIsoArray);
270
+ }
271
+ if($allowCountries == 'disallow') {
272
+ $isInArray = !in_array($contryIsoName, $countryIsoArray);
273
+ }
274
+ }
275
+
276
+ return $isInArray;
277
+ }
278
+
279
+ public static function addPopupForAllPages($id = '', $selectedData = '') {
280
+ global $wpdb;
281
+
282
+ $values = array();
283
+ $insertPreapre = array();
284
+
285
+ //Remove page if it is in use for another popup
286
+ self::deleteAllPagesPopup($selectedData);
287
+
288
+ $insertQuery = "INSERT INTO ". $wpdb->prefix ."sg_popup_in_pages(popupId, pageId) VALUES ";
289
+
290
+ foreach ($selectedData as $value) {
291
+ $insertPreapre[] .= $wpdb->prepare( "(%d,%d)", $id, $value );
292
+ }
293
+ $insertQuery .= implode( ",\n", $insertPreapre );
294
+
295
+ $res = $wpdb->query($insertQuery);
296
+ }
297
+
298
+ public static function removePopupFromPages($popupId)
299
+ {
300
+ global $wpdb;
301
+ $query = $wpdb->prepare('DELETE FROM '.$wpdb->prefix.'sg_popup_in_pages WHERE popupId = %d', $popupId);
302
+ $wpdb->query($query);
303
+ }
304
+
305
+ public static function deleteAllPagesPopup($selectedPages) {
306
+ global $wpdb;
307
+
308
+ $deletePrepare = array();
309
+ $deleteQuery = "DELETE FROM ". $wpdb->prefix ."sg_popup_in_pages WHERE pageId IN (";
310
+
311
+ foreach ($selectedPages as $value) {
312
+ $deletePrepare[] .= $wpdb->prepare("%d", $value );
313
+ }
314
+
315
+ $deleteQuery .= implode( ",\n", $deletePrepare ).")";
316
+
317
+ $deleteRes = $wpdb->query($deleteQuery);
318
+ }
319
+
320
+ public static function findInAllSelectedPages($pageId) {
321
+ global $wpdb;
322
+
323
+ $st = $wpdb->prepare("SELECT * FROM ". $wpdb->prefix ."sg_popup_in_pages WHERE pageId = %d", $pageId);
324
+ $arr = $wpdb->get_row($st, ARRAY_A);
325
+ if(!$arr) return false;
326
+ return $arr['popupId'];
327
+ }
328
+
329
  }
330
 
331
  function sgSafeStr ($param) {
classes/sgDataTable/SGPopupTable.php CHANGED
@@ -26,18 +26,19 @@ class SGPB_PopupsView extends SGPB_Table
26
  'id' => array('id', false),
27
  'title' => array('title', true),
28
  $this->setInitialSort(array(
29
- 'id' => 'DESC'
30
- ))
31
  ));
32
  }
33
 
34
  public function customizeRow(&$row)
35
  {
36
- $id = $row[0];
37
- $type = $row[2];
38
- $editUrl = admin_url()."admin.php?page=edit-popup&id=".$id."&type=".$type."";
39
- $row[3] = "<input type='text' onfocus='this.select();' readonly value='[sg_popup id=".$id."]' class='large-text code'>";
40
- $row[4] = '<a href="'.@$editUrl.'">'.__('Edit', 'sgpt').'</a>&nbsp;&nbsp;<a href="#" data-sg-popup-id="'.$id.'" class="sg-js-delete-link">'.__('Delete', 'sgpt').'</a>';
 
41
  }
42
 
43
  public function customizeQuery(&$query)
26
  'id' => array('id', false),
27
  'title' => array('title', true),
28
  $this->setInitialSort(array(
29
+ 'id' => 'DESC'
30
+ ))
31
  ));
32
  }
33
 
34
  public function customizeRow(&$row)
35
  {
36
+ $id = $row[0];
37
+ $type = $row[2];
38
+ $editUrl = admin_url()."admin.php?page=edit-popup&id=".$id."&type=".$type."";
39
+ $row[3] = "<input type='text' onfocus='this.select();' readonly value='[sg_popup id=".$id."]' class='large-text code'>";
40
+ $row[4] = '<a href="'.@$editUrl.'">'.__('Edit', 'sgpt').'</a>&nbsp;&nbsp;<a href="#" data-sg-popup-id="'.$id.'" class="sg-js-delete-link">'.__('Delete', 'sgpt').'</a>
41
+ <a href="'.admin_url().'admin-post.php?action=popup_clone&id='.$id.'" data-sg-popup-id="'.$id.'" class="sg-js-popup-clone">Clone</a>';
42
  }
43
 
44
  public function customizeQuery(&$query)
files/main_section/fblike.php CHANGED
@@ -1,6 +1,9 @@
1
  <div class="sg-wp-editor-container">
2
- <span class="shortcode-use-info">NOTE: Shortcodes don't work inside the HTML Popup. Please use <a href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=shortcode">Shortcode Popup</a> instead.</span>
3
  <?php
 
 
 
 
4
  $content = @$sgPopupDataFblike;
5
  $editorId = 'sg_popup_fblike';
6
  $settings = array(
@@ -13,4 +16,4 @@
13
  );
14
  wp_editor($content, $editorId, $settings);
15
  ?>
16
- </div>
1
  <div class="sg-wp-editor-container">
 
2
  <?php
3
+ if(!SG_POPUP_PRO) {
4
+ echo SGFunctions::noticeForShortcode();
5
+ }
6
+
7
  $content = @$sgPopupDataFblike;
8
  $editorId = 'sg_popup_fblike';
9
  $settings = array(
16
  );
17
  wp_editor($content, $editorId, $settings);
18
  ?>
19
+ </div>
files/main_section/html.php CHANGED
@@ -1,6 +1,9 @@
1
  <div class="sg-wp-editor-container">
2
- <span class="shortcode-use-info">NOTE: Shortcodes don't work inside the HTML Popup. Please use <a href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=shortcode">Shortcode Popup</a> instead.</span>
3
  <?php
 
 
 
 
4
  $content = @$sgPopupDataHtml;
5
  $editorId = 'sg_popup_html';
6
  $settings = array(
@@ -13,4 +16,4 @@
13
  );
14
  wp_editor($content, $editorId, $settings);
15
  ?>
16
- </div>
1
  <div class="sg-wp-editor-container">
 
2
  <?php
3
+ if(!SG_POPUP_PRO) {
4
+ echo SGFunctions::noticeForShortcode();
5
+ }
6
+
7
  $content = @$sgPopupDataHtml;
8
  $editorId = 'sg_popup_html';
9
  $settings = array(
16
  );
17
  wp_editor($content, $editorId, $settings);
18
  ?>
19
+ </div>
files/sg_admin_post.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function sgGetCsvFile() {
3
+ global $wpdb;
4
+ $content = '';
5
+ $sql = "SHOW COLUMNS FROM ". $wpdb->prefix ."sg_subscribers";
6
+ $rows = $wpdb->get_results($sql, ARRAY_A);
7
+ foreach ($rows as $value) {
8
+ $content .= $value['Field'].",";
9
+ }
10
+ $content .= "\n";
11
+
12
+ $sql = "Select * from ". $wpdb->prefix ."sg_subscribers";
13
+ $subscribers = $wpdb->get_results($sql, ARRAY_A);
14
+
15
+ foreach($subscribers as $values) {
16
+ foreach ($values as $value) {
17
+ $content .= $value.',';
18
+ }
19
+ $content .= "\n";
20
+ }
21
+
22
+ header("Pragma: public");
23
+ header("Expires: 0");
24
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
25
+ header("Cache-Control: private", false);
26
+ header("Content-Type: application/octet-stream");
27
+ header("Content-Disposition: attachment; filename=\"subscribersList.csv\";" );
28
+ header("Content-Transfer-Encoding: binary");
29
+ echo $content;
30
+ }
31
+
32
+ add_action('admin_post_csv_file', 'sgGetCsvFile');
33
+
34
+ function sgDeleteSubscribe() {
35
+ global $wpdb;
36
+ $id = $_GET['id'];
37
+ $wpdb->query(
38
+ $wpdb->prepare(
39
+ "DELETE FROM ". $wpdb->prefix ."sg_subscribers WHERE id = %d"
40
+ ,$id
41
+ )
42
+ );
43
+ wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=subscribers");
44
+ }
45
+
46
+ add_action('admin_post_subscribe_delete', 'sgDeleteSubscribe');
47
+
48
+ function sgPopupClone() {
49
+ $id = $_GET['id'];
50
+ $obj = SGPopup::findById($id);
51
+ $title = $obj->getTitle();
52
+ $title .= "(clone)";
53
+ $obj->setId("");
54
+ $obj->setTitle($title);
55
+ $obj->save();
56
+ wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=PopupBuilder");
57
+ }
58
+
59
+ add_action('admin_post_popup_clone', 'sgPopupClone');
60
+
61
+ function sgPopupDataExport() {
62
+ global $wpdb;
63
+
64
+ $exportArray = array();
65
+ $mainTable = PopupInstaller::$maintablename;
66
+
67
+ $popupDataSql = "SELECT * FROM ".$wpdb->prefix.$mainTable;
68
+ $getAllPopupData = $wpdb->get_results($popupDataSql, ARRAY_A);
69
+ foreach ($getAllPopupData as $popupData) {
70
+ $type = $popupData['type'];
71
+ $id = $popupData['id'];
72
+ if ($type == 'ageRestriction') {
73
+ $type = "age_restriction";
74
+ }
75
+ else if($type == 'exitIntent') {
76
+ $type = "exit_intent";
77
+ }
78
+ else if($type == 'contactForm') {
79
+ $type = "contact_form";
80
+ }
81
+ $table = "sg_".$type."_popup";
82
+ $tableName = $wpdb->prefix.$table;
83
+
84
+ $chieldPopupDataSql = "SELECT * FROM ".$tableName;
85
+ $chieldPopupData = $wpdb->get_results($chieldPopupDataSql, ARRAY_A);
86
+
87
+ $getRowsSql = "SHOW COLUMNS FROM ".$tableName;
88
+ $chiledRows = $wpdb->get_results($getRowsSql, ARRAY_A);
89
+
90
+ unset($chieldPopupData[0]['id']);
91
+ //unset($chiledRows[0]);
92
+
93
+ $exportArray[] = array(
94
+ 'mainPopupData' => $popupData,
95
+ 'childData' => $chieldPopupData,
96
+ 'chiledColums' => $chiledRows,
97
+ 'childTableName' => $table
98
+ );
99
+ }
100
+
101
+ header("Pragma: public");
102
+ header("Expires: 0");
103
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
104
+ header("Cache-Control: private", false);
105
+ header("Content-Type: application/octet-stream");
106
+ header("Content-Disposition: attachment; filename=\"sgexportdata.txt\";" );
107
+ header("Content-Transfer-Encoding: binary");
108
+ echo serialize($exportArray);
109
+ }
110
+
111
+ add_action('admin_post_popup_export', 'sgPopupDataExport');
112
+
files/sg_functions.php CHANGED
@@ -10,4 +10,323 @@ class SGFunctions
10
  $sgInfo .= "<a href=\"https://www.youtube.com/watch?v=3ZwRKPhHMzY\" target=\"_blank\">How to create a popup</a>";
11
  echo $sgInfo;
12
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
10
  $sgInfo .= "<a href=\"https://www.youtube.com/watch?v=3ZwRKPhHMzY\" target=\"_blank\">How to create a popup</a>";
11
  echo $sgInfo;
12
  }
13
+
14
+
15
+ public static function noticeForShortcode() {
16
+ $notice = '<span class="shortcode-use-info">NOTE: Shortcodes doesn\'t work inside the HTML Popup. Please use <a href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=shortcode">Shortcode Popup</a> instead.</span>';
17
+ return $notice;
18
+ }
19
+
20
+ public static function sgCreateRadioElements($radioElements, $checkedValue)
21
+ {
22
+ $content = '';
23
+ for ($i = 0; $i < count($radioElements); $i++) {
24
+ $checked = '';
25
+ $br = '';
26
+ $radioElement = @$radioElements[$i];
27
+ $name = @$radioElement['name'];
28
+ $label = @$radioElement['label'];
29
+ $value = @$radioElement['value'];
30
+ $brValue = @$radioElement['newline'];
31
+ $additionalHtml = @$radioElement['additionalHtml'];
32
+ if($checkedValue == $value) {
33
+ $checked = 'checked';
34
+ }
35
+ if($brValue) {
36
+ $br = "<br>";
37
+ }
38
+ $content .= '<input class="radio-btn-fix" type="radio" name="'.$name.'" value="'.$value.'" '.$checked.'>';
39
+ $content .= $additionalHtml.$br;
40
+ }
41
+ return $content;
42
+ }
43
+
44
+ public static function getUserIpAdress() {
45
+ $ipaddress = '';
46
+ if (getenv('HTTP_CLIENT_IP'))
47
+ $ipaddress = getenv('HTTP_CLIENT_IP');
48
+ else if(getenv('HTTP_X_FORWARDED_FOR'))
49
+ $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
50
+ else if(getenv('HTTP_X_FORWARDED'))
51
+ $ipaddress = getenv('HTTP_X_FORWARDED');
52
+ else if(getenv('HTTP_FORWARDED_FOR'))
53
+ $ipaddress = getenv('HTTP_FORWARDED_FOR');
54
+ else if(getenv('HTTP_FORWARDED'))
55
+ $ipaddress = getenv('HTTP_FORWARDED');
56
+ else if(getenv('REMOTE_ADDR'))
57
+ $ipaddress = getenv('REMOTE_ADDR');
58
+ else
59
+ $ipaddress = 'UNKNOWN';
60
+ return $ipaddress;
61
+ }
62
+
63
+ public static function allowPageCountry($popupId) {
64
+ $ip = SGFunctions::getUserIpAdress();
65
+ $details = wp_remote_get('https://www.sygnoos.com/ip2data/?ip='.$ip);
66
+ if(!is_array($details)) {
67
+ return true;
68
+ }
69
+ $dataIp = json_decode($details['body'], true);
70
+ if(!is_array($dataIp)) {
71
+ return true;
72
+ }
73
+ $counrty = @$dataIp['country'];
74
+ $returnData = SGPopup::showPopupForCounrty($counrty, $popupId);
75
+ return $returnData;
76
+ }
77
+
78
+ public static function countrisSelect() {
79
+
80
+ return '<select id="sameWidthinputs" name="countris" class="optionsCountry" data-role="tagsinput">
81
+ <option value="AF">Afghanistan</option>
82
+ <option value="AX">Åland Islands</option>
83
+ <option value="AL">Albania</option>
84
+ <option value="DZ">Algeria</option>
85
+ <option value="AS">American Samoa</option>
86
+ <option value="AD">Andorra</option>
87
+ <option value="AO">Angola</option>
88
+ <option value="AI">Anguilla</option>
89
+ <option value="AQ">Antarctica</option>
90
+ <option value="AG">Antigua and Barbuda</option>
91
+ <option value="AR">Argentina</option>
92
+ <option value="AM">Armenia</option>
93
+ <option value="AW">Aruba</option>
94
+ <option value="AU">Australia</option>
95
+ <option value="AT">Austria</option>
96
+ <option value="AZ">Azerbaijan</option>
97
+ <option value="BS">Bahamas</option>
98
+ <option value="BH">Bahrain</option>
99
+ <option value="BD">Bangladesh</option>
100
+ <option value="BB">Barbados</option>
101
+ <option value="BY">Belarus</option>
102
+ <option value="BE">Belgium</option>
103
+ <option value="BZ">Belize</option>
104
+ <option value="BJ">Benin</option>
105
+ <option value="BM">Bermuda</option>
106
+ <option value="BT">Bhutan</option>
107
+ <option value="BO">Bolivia, Plurinational State of</option>
108
+ <option value="BQ">Bonaire, Sint Eustatius and Saba</option>
109
+ <option value="BA">Bosnia and Herzegovina</option>
110
+ <option value="BW">Botswana</option>
111
+ <option value="BV">Bouvet Island</option>
112
+ <option value="BR">Brazil</option>
113
+ <option value="IO">British Indian Ocean Territory</option>
114
+ <option value="BN">Brunei Darussalam</option>
115
+ <option value="BG">Bulgaria</option>
116
+ <option value="BF">Burkina Faso</option>
117
+ <option value="BI">Burundi</option>
118
+ <option value="KH">Cambodia</option>
119
+ <option value="CM">Cameroon</option>
120
+ <option value="CA">Canada</option>
121
+ <option value="CV">Cape Verde</option>
122
+ <option value="KY">Cayman Islands</option>
123
+ <option value="CF">Central African Republic</option>
124
+ <option value="TD">Chad</option>
125
+ <option value="CL">Chile</option>
126
+ <option value="CN">China</option>
127
+ <option value="CX">Christmas Island</option>
128
+ <option value="CC">Cocos (Keeling) Islands</option>
129
+ <option value="CO">Colombia</option>
130
+ <option value="KM">Comoros</option>
131
+ <option value="CG">Congo</option>
132
+ <option value="CD">Congo, the Democratic Republic of the</option>
133
+ <option value="CK">Cook Islands</option>
134
+ <option value="CR">Costa Rica</option>
135
+ <option value="CI">Côte d\'Ivoire</option>
136
+ <option value="HR">Croatia</option>
137
+ <option value="CU">Cuba</option>
138
+ <option value="CW">Curaçao</option>
139
+ <option value="CY">Cyprus</option>
140
+ <option value="CZ">Czech Republic</option>
141
+ <option value="DK">Denmark</option>
142
+ <option value="DJ">Djibouti</option>
143
+ <option value="DM">Dominica</option>
144
+ <option value="DO">Dominican Republic</option>
145
+ <option value="EC">Ecuador</option>
146
+ <option value="EG">Egypt</option>
147
+ <option value="SV">El Salvador</option>
148
+ <option value="GQ">Equatorial Guinea</option>
149
+ <option value="ER">Eritrea</option>
150
+ <option value="EE">Estonia</option>
151
+ <option value="ET">Ethiopia</option>
152
+ <option value="FK">Falkland Islands (Malvinas)</option>
153
+ <option value="FO">Faroe Islands</option>
154
+ <option value="FJ">Fiji</option>
155
+ <option value="FI">Finland</option>
156
+ <option value="FR">France</option>
157
+ <option value="GF">French Guiana</option>
158
+ <option value="PF">French Polynesia</option>
159
+ <option value="TF">French Southern Territories</option>
160
+ <option value="GA">Gabon</option>
161
+ <option value="GM">Gambia</option>
162
+ <option value="GE">Georgia</option>
163
+ <option value="DE">Germany</option>
164
+ <option value="GH">Ghana</option>
165
+ <option value="GI">Gibraltar</option>
166
+ <option value="GR">Greece</option>
167
+ <option value="GL">Greenland</option>
168
+ <option value="GD">Grenada</option>
169
+ <option value="GP">Guadeloupe</option>
170
+ <option value="GU">Guam</option>
171
+ <option value="GT">Guatemala</option>
172
+ <option value="GG">Guernsey</option>
173
+ <option value="GN">Guinea</option>
174
+ <option value="GW">Guinea-Bissau</option>
175
+ <option value="GY">Guyana</option>
176
+ <option value="HT">Haiti</option>
177
+ <option value="HM">Heard Island and McDonald Islands</option>
178
+ <option value="VA">Holy See (Vatican City State)</option>
179
+ <option value="HN">Honduras</option>
180
+ <option value="HK">Hong Kong</option>
181
+ <option value="HU">Hungary</option>
182
+ <option value="IS">Iceland</option>
183
+ <option value="IN">India</option>
184
+ <option value="ID">Indonesia</option>
185
+ <option value="IR">Iran, Islamic Republic of</option>
186
+ <option value="IQ">Iraq</option>
187
+ <option value="IE">Ireland</option>
188
+ <option value="IM">Isle of Man</option>
189
+ <option value="IL">Israel</option>
190
+ <option value="IT">Italy</option>
191
+ <option value="JM">Jamaica</option>
192
+ <option value="JP">Japan</option>
193
+ <option value="JE">Jersey</option>
194
+ <option value="JO">Jordan</option>
195
+ <option value="KZ">Kazakhstan</option>
196
+ <option value="KE">Kenya</option>
197
+ <option value="KI">Kiribati</option>
198
+ <option value="KP">Korea, Democratic People\'s Republic of</option>
199
+ <option value="KR">Korea, Republic of</option>
200
+ <option value="KW">Kuwait</option>
201
+ <option value="KG">Kyrgyzstan</option>
202
+ <option value="LA">Lao People\'s Democratic Republic</option>
203
+ <option value="LV">Latvia</option>
204
+ <option value="LB">Lebanon</option>
205
+ <option value="LS">Lesotho</option>
206
+ <option value="LR">Liberia</option>
207
+ <option value="LY">Libya</option>
208
+ <option value="LI">Liechtenstein</option>
209
+ <option value="LT">Lithuania</option>
210
+ <option value="LU">Luxembourg</option>
211
+ <option value="MO">Macao</option>
212
+ <option value="MK">Macedonia, the former Yugoslav Republic of</option>
213
+ <option value="MG">Madagascar</option>
214
+ <option value="MW">Malawi</option>
215
+ <option value="MY">Malaysia</option>
216
+ <option value="MV">Maldives</option>
217
+ <option value="ML">Mali</option>
218
+ <option value="MT">Malta</option>
219
+ <option value="MH">Marshall Islands</option>
220
+ <option value="MQ">Martinique</option>
221
+ <option value="MR">Mauritania</option>
222
+ <option value="MU">Mauritius</option>
223
+ <option value="YT">Mayotte</option>
224
+ <option value="MX">Mexico</option>
225
+ <option value="FM">Micronesia, Federated States of</option>
226
+ <option value="MD">Moldova, Republic of</option>
227
+ <option value="MC">Monaco</option>
228
+ <option value="MN">Mongolia</option>
229
+ <option value="ME">Montenegro</option>
230
+ <option value="MS">Montserrat</option>
231
+ <option value="MA">Morocco</option>
232
+ <option value="MZ">Mozambique</option>
233
+ <option value="MM">Myanmar</option>
234
+ <option value="NA">Namibia</option>
235
+ <option value="NR">Nauru</option>
236
+ <option value="NP">Nepal</option>
237
+ <option value="NL">Netherlands</option>
238
+ <option value="NC">New Caledonia</option>
239
+ <option value="NZ">New Zealand</option>
240
+ <option value="NI">Nicaragua</option>
241
+ <option value="NE">Niger</option>
242
+ <option value="NG">Nigeria</option>
243
+ <option value="NU">Niue</option>
244
+ <option value="NF">Norfolk Island</option>
245
+ <option value="MP">Northern Mariana Islands</option>
246
+ <option value="NO">Norway</option>
247
+ <option value="OM">Oman</option>
248
+ <option value="PK">Pakistan</option>
249
+ <option value="PW">Palau</option>
250
+ <option value="PS">Palestinian Territory, Occupied</option>
251
+ <option value="PA">Panama</option>
252
+ <option value="PG">Papua New Guinea</option>
253
+ <option value="PY">Paraguay</option>
254
+ <option value="PE">Peru</option>
255
+ <option value="PH">Philippines</option>
256
+ <option value="PN">Pitcairn</option>
257
+ <option value="PL">Poland</option>
258
+ <option value="PT">Portugal</option>
259
+ <option value="PR">Puerto Rico</option>
260
+ <option value="QA">Qatar</option>
261
+ <option value="RE">Réunion</option>
262
+ <option value="RO">Romania</option>
263
+ <option value="RU">Russian Federation</option>
264
+ <option value="RW">Rwanda</option>
265
+ <option value="BL">Saint Barthélemy</option>
266
+ <option value="SH">Saint Helena, Ascension and Tristan da Cunha</option>
267
+ <option value="KN">Saint Kitts and Nevis</option>
268
+ <option value="LC">Saint Lucia</option>
269
+ <option value="MF">Saint Martin (French part)</option>
270
+ <option value="PM">Saint Pierre and Miquelon</option>
271
+ <option value="VC">Saint Vincent and the Grenadines</option>
272
+ <option value="WS">Samoa</option>
273
+ <option value="SM">San Marino</option>
274
+ <option value="ST">Sao Tome and Principe</option>
275
+ <option value="SA">Saudi Arabia</option>
276
+ <option value="SN">Senegal</option>
277
+ <option value="RS">Serbia</option>
278
+ <option value="SC">Seychelles</option>
279
+ <option value="SL">Sierra Leone</option>
280
+ <option value="SG">Singapore</option>
281
+ <option value="SX">Sint Maarten (Dutch part)</option>
282
+ <option value="SK">Slovakia</option>
283
+ <option value="SI">Slovenia</option>
284
+ <option value="SB">Solomon Islands</option>
285
+ <option value="SO">Somalia</option>
286
+ <option value="ZA">South Africa</option>
287
+ <option value="GS">South Georgia and the South Sandwich Islands</option>
288
+ <option value="SS">South Sudan</option>
289
+ <option value="ES">Spain</option>
290
+ <option value="LK">Sri Lanka</option>
291
+ <option value="SD">Sudan</option>
292
+ <option value="SR">Suriname</option>
293
+ <option value="SJ">Svalbard and Jan Mayen</option>
294
+ <option value="SZ">Swaziland</option>
295
+ <option value="SE">Sweden</option>
296
+ <option value="CH">Switzerland</option>
297
+ <option value="SY">Syrian Arab Republic</option>
298
+ <option value="TW">Taiwan, Province of China</option>
299
+ <option value="TJ">Tajikistan</option>
300
+ <option value="TZ">Tanzania, United Republic of</option>
301
+ <option value="TH">Thailand</option>
302
+ <option value="TL">Timor-Leste</option>
303
+ <option value="TG">Togo</option>
304
+ <option value="TK">Tokelau</option>
305
+ <option value="TO">Tonga</option>
306
+ <option value="TT">Trinidad and Tobago</option>
307
+ <option value="TN">Tunisia</option>
308
+ <option value="TR">Turkey</option>
309
+ <option value="TM">Turkmenistan</option>
310
+ <option value="TC">Turks and Caicos Islands</option>
311
+ <option value="TV">Tuvalu</option>
312
+ <option value="UG">Uganda</option>
313
+ <option value="UA">Ukraine</option>
314
+ <option value="AE">United Arab Emirates</option>
315
+ <option value="GB">United Kingdom</option>
316
+ <option value="US">United States</option>
317
+ <option value="UM">United States Minor Outlying Islands</option>
318
+ <option value="UY">Uruguay</option>
319
+ <option value="UZ">Uzbekistan</option>
320
+ <option value="VU">Vanuatu</option>
321
+ <option value="VE">Venezuela, Bolivarian Republic of</option>
322
+ <option value="VN">Viet Nam</option>
323
+ <option value="VG">Virgin Islands, British</option>
324
+ <option value="VI">Virgin Islands, U.S.</option>
325
+ <option value="WF">Wallis and Futuna</option>
326
+ <option value="EH">Western Sahara</option>
327
+ <option value="YE">Yemen</option>
328
+ <option value="ZM">Zambia</option>
329
+ <option value="ZW">Zimbabwe</option>
330
+ </select>';
331
+ }
332
  }
files/sg_popup_ajax.php CHANGED
@@ -31,3 +31,68 @@ function sgFrontend() {
31
 
32
  add_action('wp_ajax_nopriv_subs_send_mail', 'sgFrontend');
33
  add_action('wp_ajax_subs_send_mail', 'sgFrontend');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  add_action('wp_ajax_nopriv_subs_send_mail', 'sgFrontend');
33
  add_action('wp_ajax_subs_send_mail', 'sgFrontend');
34
+
35
+ function sgContactForm() {
36
+ global $wpdb;
37
+ parse_str($_POST['contactParams'], $params);
38
+ $adminMail = get_option('admin_email');
39
+ $name = $params['contact-name'];
40
+ $subject = $params['contact-subject'];
41
+ $userMessage = $params['content-message'];
42
+ $mail = $params['contact-email'];
43
+
44
+ $message = '';
45
+ $message .= '<b>Name</b>: '.$name."<br>";
46
+ $message .= '<b>E-mail</b>: '.$mail."<br>";
47
+ $message .= '<b>Subject</b>: '.$subject."<br>";
48
+ $message .= '<b>Message</b>: '.$userMessage."<br>";
49
+ $headers = 'MIME-Version: 1.0'."\r\n";
50
+ $headers = 'From: '.$adminMail.''."\r\n";
51
+ $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; //set UTF-8
52
+ wp_mail($adminMail, 'Popup contact form', $message, $headers);
53
+ die();
54
+ }
55
+
56
+ add_action('wp_ajax_nopriv_contact_send_mail', 'sgContactForm');
57
+ add_action('wp_ajax_contact_send_mail', 'sgContactForm');
58
+
59
+ function sgImportPopups() {
60
+ global $wpdb;
61
+ $url = $_POST['attachmentUrl'];
62
+
63
+ $contents = unserialize(file_get_contents($url));
64
+
65
+ foreach ($contents as $content) {
66
+ //Main popup table data
67
+ $popupData = $content['mainPopupData'];
68
+ $popupType = $popupData['type'];
69
+ $popupTitle = $popupData['title'];
70
+ $popupOptions = $popupData['options'];
71
+
72
+ //Insert popup
73
+ $sql = $wpdb->prepare("INSERT INTO ".$wpdb->prefix.PopupInstaller::$maintablename."(type, title, options) VALUES (%s, %s, %s)", $popupType, $popupTitle, $popupOptions);
74
+ $res = $wpdb->query($sql);
75
+ //Get last insert popup id
76
+ $lastInsertId = $wpdb->insert_id;
77
+
78
+ //Child popup data
79
+ $childPopupTableName = $content['childTableName']; // change it Tbale to Table
80
+ $childPopupData = $content['childData']; //change it child
81
+
82
+ //Foreach throw child popups
83
+ foreach ($childPopupData as $childPopup) {
84
+ //Child popup table columns
85
+ $columns = implode(array_keys($childPopup), ', ');
86
+ $values = "'".implode(array_values($childPopup), "','")."'";
87
+ $queryValues = str_repeat("'%s', ", count(array_keys($childPopup)));
88
+ $queryValues = rtrim($queryValues, ', ');
89
+ $queryStr = 'INSERT INTO '.$wpdb->prefix.$childPopupTableName.'(id, '.$columns.') VALUES ('.$lastInsertId.', '.$values.')';
90
+ $sql = $wpdb->prepare($queryStr, $values);
91
+ $resa = $wpdb->query($sql);
92
+ echo 'ChildRes: '.$resa;
93
+ }
94
+ echo 'MainRes: '.$res;
95
+ }
96
+ }
97
+
98
+ add_action('wp_ajax_import_popups', 'sgImportPopups');
files/sg_popup_create.php CHANGED
@@ -45,6 +45,10 @@
45
  <div class="popups-div sg-subscription">
46
  </div>
47
  </a>
 
 
 
 
48
  <?php endif; ?>
49
  <?php if (SG_POPUP_PRO == 0): ?>
50
  <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
@@ -81,3 +85,8 @@
81
  </a>
82
  <?php endif; ?>
83
  </div>
 
 
 
 
 
45
  <div class="popups-div sg-subscription">
46
  </div>
47
  </a>
48
+ <a class="create-popup-link" href="<?php echo SG_APP_POPUP_ADMIN_URL?>admin.php?page=edit-popup&type=contactForm">
49
+ <div class="popups-div sg-contact-form">
50
+ </div>
51
+ </a>
52
  <?php endif; ?>
53
  <?php if (SG_POPUP_PRO == 0): ?>
54
  <a class="create-popup-link" href="<?php echo SG_POPUP_PRO_URL;?>" target="_blank">
85
  </a>
86
  <?php endif; ?>
87
  </div>
88
+ <div class="clear">
89
+ <?php
90
+ SGFunctions::showInfo();
91
+ ?>
92
+ </div>
files/sg_popup_create_new.php CHANGED
@@ -7,6 +7,10 @@
7
  $popupClassName = $popupName."Popup";
8
  require_once(SG_APP_POPUP_PATH ."/classes/".$popupClassName.".php");
9
  $obj = new $popupClassName();
 
 
 
 
10
  if (isset($_GET['id'])) {
11
  $id = (int)$_GET['id'];
12
  $result = call_user_func(array($popupClassName, 'findById'), $id);
@@ -49,7 +53,7 @@
49
  $sgDueDate = $countdownOptions['sg-due-date'];
50
  @$sgGetCountdownType = $countdownOptions['sg-countdown-type'];
51
  $sgCountdownLang = $countdownOptions['counts-language'];
52
- $sgCountdownPosition = $countdownOptions['coundown-position'];
53
  @$sgSelectedTimeZone = $countdownOptions['sg-time-zone'];
54
  break;
55
  case 'social':
@@ -65,11 +69,12 @@
65
  $sgSunbscriptionContent = $result->getContent();
66
  $subscriptionOptions = $result->getSubscriptionOptions();
67
  break;
 
 
 
 
68
  }
69
 
70
- global $removeOptions;
71
- $removeOptions = $result->getRemoveOptions();
72
-
73
  $title = $result->getTitle();
74
  $jsonData = json_decode($result->getOptions(), true);
75
  $sgEscKey = @$jsonData['escKey'];
@@ -86,6 +91,7 @@
86
  $beforeScrolingPrsent = @$jsonData['beforeScrolingPrsent'];
87
  $duration = @$jsonData['duration'];
88
  $delay = @$jsonData['delay'];
 
89
  $effect =@$jsonData['effect'];
90
  $sgInitialWidth = @$jsonData['initialWidth'];
91
  $sgInitialHeight = @$jsonData['initialHeight'];
@@ -98,9 +104,21 @@
98
  $sgAllPages = @$jsonData['allPages'];
99
  $sgRepeatPopup = @$jsonData['repeatPopup'];
100
  $sgDisablePopup = @$jsonData['disablePopup'];
 
101
  $sgPopupClosingTimer = @$jsonData['popupClosingTimer'];
102
  $sgAutoClosePopup = @$jsonData['autoClosePopup'];
 
 
 
 
 
 
 
 
103
  $sgColorboxTheme = @$jsonData['theme'];
 
 
 
104
  $sgRestrictionAction = @$jsonData['restrictionAction'];
105
  $yesButtonBackgroundColor = @sgSafeStr($jsonData['yesButtonBackgroundColor']);
106
  $noButtonBackgroundColor = @sgSafeStr($jsonData['noButtonBackgroundColor']);
@@ -132,9 +150,9 @@
132
  $sgRoundButton = @sgSafeStr($sgSocialOptions['sgRoundButton']);
133
  $sgPushToBottom = @sgSafeStr($jsonData['pushToBottom']);
134
  $exitIntentOptions = json_decode(@$exitIntentOptions, true);
135
- $sgExitIntentTpype = $exitIntentOptions['exit-intent-type'];
136
- $sgExitIntntExpire = $exitIntentOptions['exit-intent-expire-time'];
137
- $sgExitIntentAlert = $exitIntentOptions['exit-intent-alert'];
138
  $sgVideoOptions = json_decode(@$sgVideoOptions, true);
139
  $sgVideoAutoplay = $sgVideoOptions['video-autoplay'];
140
  $sgFlikeOptions = json_decode(@$sgFlikeOptions, true);
@@ -161,6 +179,30 @@
161
  $sgSuccessMessage = @$subscriptionOptions['subs-success-message'];
162
  $sgSubsBtnProgressTitle = @$subscriptionOptions['subs-btn-progress-title'];
163
  $sgSubsTextBorderWidth = @$subscriptionOptions['subs-text-border-width'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
 
166
  $sgPopup = array(
@@ -184,6 +226,7 @@
184
  'left' => false,
185
  'duration' => 1,
186
  'delay' => 0,
 
187
  );
188
 
189
  $popupProDefaultValues = array(
@@ -194,6 +237,7 @@
194
  'openMobile' => false,
195
  'repetPopup' => false,
196
  'disablePopup' => false,
 
197
  'autoClosePopup' => false,
198
  'fbStatus' => true,
199
  'twitterStatus' => true,
@@ -206,6 +250,12 @@
206
  'sgShareUrl' => 'http://',
207
  'pushToBottom' => true,
208
  'allPages' => false,
 
 
 
 
 
 
209
  'countdownNumbersTextColor' => '',
210
  'countdownNumbersBgColor' => '',
211
  'countDownLang' => 'English',
@@ -232,8 +282,15 @@
232
  'subs-btn-width' => '200px',
233
  'subs-text-border-width' => '2px',
234
  'subs-success-message' =>'You have successfully subscribed to the newsletter',
235
- 'subs-validation-message' => 'Please enter a valid email',
236
- 'subs-btn-progress-title' => 'Please wait ...'
 
 
 
 
 
 
 
237
  );
238
 
239
  $escKey = sgBoolToChecked($sgPopup['escKey']);
@@ -249,6 +306,7 @@
249
  $openMobile = sgBoolToChecked($popupProDefaultValues['openMobile']);
250
  $repetPopup = sgBoolToChecked($popupProDefaultValues['repetPopup']);
251
  $disablePopup = sgBoolToChecked($popupProDefaultValues['disablePopup']);
 
252
  $autoClosePopup = sgBoolToChecked($popupProDefaultValues['autoClosePopup']);
253
  $fbStatus = sgBoolToChecked($popupProDefaultValues['fbStatus']);
254
  $twitterStatus = sgBoolToChecked($popupProDefaultValues['twitterStatus']);
@@ -261,6 +319,10 @@
261
  $shareUrl = $popupProDefaultValues['sgShareUrl'];
262
  $pushToBottom = sgBoolToChecked($popupProDefaultValues['pushToBottom']);
263
  $allPages = sgBoolToChecked($popupProDefaultValues['allPages']);
 
 
 
 
264
  $countdownNumbersTextColor = $popupProDefaultValues['countdownNumbersTextColor'];
265
  $countdownNumbersBgColor = $popupProDefaultValues['countdownNumbersBgColor'];
266
  $countdownLang = $popupProDefaultValues['countDownLang'];
@@ -289,6 +351,15 @@
289
  $subsTextBorderWidth = $popupProDefaultValues['subs-text-border-width'];
290
  $subsTextBordercolor = $popupProDefaultValues['subs-text-bordercolor'];
291
  $subsTextInputBgcolor = $popupProDefaultValues['subs-text-input-bgcolor'];
 
 
 
 
 
 
 
 
 
292
 
293
  function sgBoolToChecked($var)
294
  {
@@ -315,6 +386,7 @@
315
  $deafultFixed = $sgPopup['fixed'];
316
  $defaultDuration = $sgPopup['duration'];
317
  $defaultDelay = $sgPopup['delay'];
 
318
 
319
  $sgCloseButton = @sgSetChecked($sgCloseButton, $closeButton);
320
  $sgEscKey = @sgSetChecked($sgEscKey, $escKey);
@@ -329,6 +401,7 @@
329
  $sgOpenOnMobile = @sgSetChecked($sgOpenOnMobile, $openMobile);
330
  $sgRepeatPopup = @sgSetChecked($sgRepeatPopup, $repetPopup);
331
  $sgDisablePopup = @sgSetChecked($sgDisablePopup, $disablePopup);
 
332
  $sgAutoClosePopup = @sgSetChecked($sgAutoClosePopup, $autoClosePopup);
333
  $sgFbStatus = @sgSetChecked($sgFbStatus, $fbStatus);
334
  $sgTwitterStatus = @sgSetChecked($sgTwitterStatus, $twitterStatus);
@@ -340,12 +413,13 @@
340
  $sgSocialLabel = @sgSetChecked($sgSocialLabel, $socialLabel);
341
  $sgPopupFixed = @sgSetChecked($sgPopupFixed, $deafultFixed);
342
  $sgPushToBottom = @sgSetChecked($sgPushToBottom, $pushToBottom);
343
- @$sgAllPages = (get_option('SG_POPUP_ONLOAD_ID') && get_option('SG_POPUP_ONLOAD_ID') == $id)? true: false;
344
- $sgAllPages = @sgSetChecked($sgAllPages, $allPages);
345
  $sgCountdownPosition = @sgSetChecked($sgCountdownPosition, $countdownPosition);
346
  $sgVideoAutoplay = @sgSetChecked($sgVideoAutoplay, $videoAutoplay);
347
  $sgSubsLastNameStatus = @sgSetChecked($sgSubsLastNameStatus, $subsLastNameStatus);
348
  $sgSubsFirstNameStatus = @sgSetChecked($sgSubsFirstNameStatus, $subsFirstNameStatus);
 
349
 
350
  function sgSetChecked($optionsParam,$defaultOption)
351
  {
@@ -369,12 +443,15 @@
369
  $sgInitialHeight = @sgGetValue($sgInitialHeight, $initialHeight);
370
  $sgMaxWidth = @sgGetValue($sgMaxWidth, $maxWidth);
371
  $sgMaxHeight = @sgGetValue($sgMaxHeight, $maxHeight);
 
372
  $duration = @sgGetValue($duration, $defaultDuration);
 
373
  $delay = @sgGetValue($delay, $defaultDelay);
374
  $sgPopupDataIframe = @sgGetValue($sgPopupDataIframe, 'http://');
375
  $sgShareUrl = @sgGetValue($sgShareUrl, $shareUrl);
376
  $sgPopupDataHtml = @sgGetValue($sgPopupDataHtml, '');
377
  $sgPopupDataImage = @sgGetValue($sgPopupDataImage, '');
 
378
  $sgCountdownNumbersTextColor = @sgGetValue($sgCountdownNumbersTextColor, $countdownNumbersTextColor);
379
  $sgCountdownNumbersBgColor = @sgGetValue($sgCountdownNumbersBgColor, $countdownNumbersBgColor);
380
  $sgCountdownLang = @sgGetValue($sgCountdownLang, $countdownLang);
@@ -400,7 +477,31 @@
400
  $sgSubsValidateMessage = @sgGetValue($sgSubsValidateMessage, $subsValidationMessage);
401
  $sgSubsBtnProgressTitle = @sgGetValue($sgSubsBtnProgressTitle, $subsBtnProgressTitle);
402
  $sgSubsTextBorderWidth = @sgGetValue($sgSubsTextBorderWidth, $subsTextBorderWidth);
403
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  function sgGetValue($getedVal,$defValue)
405
  {
406
  if (!isset($getedVal)) {
@@ -425,6 +526,21 @@
425
  )
426
  );
427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  function sgCreateRadioElements($radioElements,$checkedValue)
429
  {
430
  $content = '';
@@ -598,7 +714,17 @@
598
  "43200" => "per month",
599
  "always" => "always"
600
  );
 
 
 
 
 
 
 
601
 
 
 
 
602
 
603
  function sgCreateSelect($options,$name,$selecteOption)
604
  {
@@ -699,6 +825,10 @@
699
  <div class="theme3 sg-hide"></div>
700
  <div class="theme4 sg-hide"></div>
701
  <div class="theme5 sg-hide"></div>
 
 
 
 
702
  </div>
703
  </div>
704
 
@@ -722,7 +852,7 @@
722
  <span class="liquid-width">Effect duration:</span>
723
  <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>
724
 
725
- <span class="liquid-width">Initial delay:</span>
726
  <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>
727
  </div>
728
  </div>
@@ -794,7 +924,14 @@
794
  <input type="text" class="js-decimal" value="<?php echo esc_attr($sgOpacity);?>" rel="<?php echo esc_attr($sgOpacity);?>" name="opacity"/>
795
  <div id="js-display-decimal" class="display-box"></div>
796
  </div><br>
797
- <span class="liquid-width" id="createDescribeFixed">Popup location:</span><input class="input-width-static" type="checkbox" name="popupFixed" id="js-popup-fixed" <?php echo $sgPopupFixed;?> /><br>
 
 
 
 
 
 
 
798
  <div class="js-popop-fixeds">
799
  <span class="fix-wrapper-style" >&nbsp;</span>
800
  <div class="fixed-wrapper">
@@ -817,11 +954,10 @@
817
  </div>
818
  </div>
819
  </div>
820
- <?php
821
- if (SG_POPUP_PRO) {
822
- require_once("options_section/pro.php");
823
- }
824
- ?>
825
  </div>
826
  </div>
827
  <div class="clear"></div>
7
  $popupClassName = $popupName."Popup";
8
  require_once(SG_APP_POPUP_PATH ."/classes/".$popupClassName.".php");
9
  $obj = new $popupClassName();
10
+
11
+ global $removeOptions;
12
+ $removeOptions = $obj->getRemoveOptions();
13
+
14
  if (isset($_GET['id'])) {
15
  $id = (int)$_GET['id'];
16
  $result = call_user_func(array($popupClassName, 'findById'), $id);
53
  $sgDueDate = $countdownOptions['sg-due-date'];
54
  @$sgGetCountdownType = $countdownOptions['sg-countdown-type'];
55
  $sgCountdownLang = $countdownOptions['counts-language'];
56
+ @$sgCountdownPosition = $countdownOptions['coundown-position'];
57
  @$sgSelectedTimeZone = $countdownOptions['sg-time-zone'];
58
  break;
59
  case 'social':
69
  $sgSunbscriptionContent = $result->getContent();
70
  $subscriptionOptions = $result->getSubscriptionOptions();
71
  break;
72
+ case 'contactForm':
73
+ $params = $result->getParams();
74
+ $sgContactFormContent = $result->getContent();
75
+ break;
76
  }
77
 
 
 
 
78
  $title = $result->getTitle();
79
  $jsonData = json_decode($result->getOptions(), true);
80
  $sgEscKey = @$jsonData['escKey'];
91
  $beforeScrolingPrsent = @$jsonData['beforeScrolingPrsent'];
92
  $duration = @$jsonData['duration'];
93
  $delay = @$jsonData['delay'];
94
+ $sgThemeCloseText = @$jsonData['theme-close-text'];
95
  $effect =@$jsonData['effect'];
96
  $sgInitialWidth = @$jsonData['initialWidth'];
97
  $sgInitialHeight = @$jsonData['initialHeight'];
104
  $sgAllPages = @$jsonData['allPages'];
105
  $sgRepeatPopup = @$jsonData['repeatPopup'];
106
  $sgDisablePopup = @$jsonData['disablePopup'];
107
+ $sgDisablePopupOverlay = @$jsonData['disablePopupOverlay'];
108
  $sgPopupClosingTimer = @$jsonData['popupClosingTimer'];
109
  $sgAutoClosePopup = @$jsonData['autoClosePopup'];
110
+ $sgCountryStatus = @$jsonData['countryStatus'];
111
+ $sgAllPagesStatus = @$jsonData['showAllPages'];
112
+ $allSelectedPages = @$jsonData['allSelectedPages'];
113
+ $sgAllPostStatus = @$jsonData['showAllPosts'];
114
+ $allSelectedPosts = @$jsonData['allSelectedPosts'];
115
+ $sgAllowCountries = @$jsonData['allowCountries'];
116
+ $sgCountryName = @$jsonData['countryName'];
117
+ $sgCountryIso = @$jsonData['countryIso'];
118
  $sgColorboxTheme = @$jsonData['theme'];
119
+ $sgOverlayCustomClasss = @$jsonData['sgOverlayCustomClasss'];
120
+ $sgContentCustomClasss = @$jsonData['sgContentCustomClasss'];
121
+ $sgOnceExpiresTime = @$jsonData['onceExpiresTime'];
122
  $sgRestrictionAction = @$jsonData['restrictionAction'];
123
  $yesButtonBackgroundColor = @sgSafeStr($jsonData['yesButtonBackgroundColor']);
124
  $noButtonBackgroundColor = @sgSafeStr($jsonData['noButtonBackgroundColor']);
150
  $sgRoundButton = @sgSafeStr($sgSocialOptions['sgRoundButton']);
151
  $sgPushToBottom = @sgSafeStr($jsonData['pushToBottom']);
152
  $exitIntentOptions = json_decode(@$exitIntentOptions, true);
153
+ $sgExitIntentTpype = @$exitIntentOptions['exit-intent-type'];
154
+ $sgExitIntntExpire = @$exitIntentOptions['exit-intent-expire-time'];
155
+ $sgExitIntentAlert = @$exitIntentOptions['exit-intent-alert'];
156
  $sgVideoOptions = json_decode(@$sgVideoOptions, true);
157
  $sgVideoAutoplay = $sgVideoOptions['video-autoplay'];
158
  $sgFlikeOptions = json_decode(@$sgFlikeOptions, true);
179
  $sgSuccessMessage = @$subscriptionOptions['subs-success-message'];
180
  $sgSubsBtnProgressTitle = @$subscriptionOptions['subs-btn-progress-title'];
181
  $sgSubsTextBorderWidth = @$subscriptionOptions['subs-text-border-width'];
182
+ $contactFormOptions = json_decode(@$params, true);
183
+ $sgContactNameLabel = @$contactFormOptions['contact-name'];
184
+ $sgContactSubjectLabel = @$contactFormOptions['contact-subject'];
185
+ $sgContactEmailLabel = @$contactFormOptions['contact-email'];
186
+ $sgContactMessageLabel = @$contactFormOptions['contact-message'];
187
+ $sgContactValidationMessage = @$contactFormOptions['contact-validation-message'];
188
+ $sgContactSuccessMessage = @$contactFormOptions['contact-success-message'];
189
+ $sgContactInputsWidth = @$contactFormOptions['contact-inputs-width'];
190
+ $sgContactInputsHeight = @$contactFormOptions['contact-inputs-height'];
191
+ $sgContactInputsBorderWidth = @$contactFormOptions['contact-inputs-border-width'];
192
+ $sgContactTextInputBgcolor = @$contactFormOptions['contact-text-input-bgcolor'];
193
+ $sgContactTextBordercolor = @$contactFormOptions['contact-text-bordercolor'];
194
+ $sgContactInputsColor = @$contactFormOptions['contact-inputs-color'];
195
+ $sgContactPlaceholderColor = @$contactFormOptions['contact-placeholder-color'];
196
+ $sgContactBtnWidth = @$contactFormOptions['contact-btn-width'];
197
+ $sgContactBtnHeight = @$contactFormOptions['contact-btn-height'];
198
+ $sgContactBtnTitle = @$contactFormOptions['contact-btn-title'];
199
+ $sgContactBtnProgressTitle = @$contactFormOptions['contact-btn-progress-title'];
200
+ $sgContactButtonBgcolor = @$contactFormOptions['contact-button-bgcolor'];
201
+ $sgContactButtonColor = @$contactFormOptions['contact-button-color'];
202
+ $sgContactAreaWidth = @$contactFormOptions['contact-area-width'];
203
+ $sgContactAreaHeight = @$contactFormOptions['contact-area-height'];
204
+ $sgContactResize = @$contactFormOptions['sg-contact-resize'];
205
+ $sgContactValidateEmail = @$contactFormOptions['contact-validate-email'];
206
  }
207
 
208
  $sgPopup = array(
226
  'left' => false,
227
  'duration' => 1,
228
  'delay' => 0,
229
+ 'theme-close-text' => 'Close'
230
  );
231
 
232
  $popupProDefaultValues = array(
237
  'openMobile' => false,
238
  'repetPopup' => false,
239
  'disablePopup' => false,
240
+ 'disablePopupOverlay' => false,
241
  'autoClosePopup' => false,
242
  'fbStatus' => true,
243
  'twitterStatus' => true,
250
  'sgShareUrl' => 'http://',
251
  'pushToBottom' => true,
252
  'allPages' => false,
253
+ 'allPosts' => false,
254
+ 'onceExpiresTime' => 7,
255
+ 'overlay-custom-classs' => 'sg-popup-overlay',
256
+ 'content-custom-classs' => 'sg-popup-content',
257
+ 'countryStatus' => false,
258
+ 'allowCountries' => 'allow',
259
  'countdownNumbersTextColor' => '',
260
  'countdownNumbersBgColor' => '',
261
  'countDownLang' => 'English',
282
  'subs-btn-width' => '200px',
283
  'subs-text-border-width' => '2px',
284
  'subs-success-message' =>'You have successfully subscribed to the newsletter',
285
+ 'subs-validation-message' => 'This field is required.',
286
+ 'subs-btn-progress-title' => 'Please wait ...',
287
+ 'contact-name' => 'Name *',
288
+ 'contact-email' => 'E-mail *',
289
+ 'contact-message' => 'Message *',
290
+ 'contact-subject' => 'Subject *',
291
+ 'contact-success-message' => 'Your message has been successfully sent.',
292
+ 'contact-btn-title' => 'Contact',
293
+ 'contact-validate-email' => 'Please enter a valid email.'
294
  );
295
 
296
  $escKey = sgBoolToChecked($sgPopup['escKey']);
306
  $openMobile = sgBoolToChecked($popupProDefaultValues['openMobile']);
307
  $repetPopup = sgBoolToChecked($popupProDefaultValues['repetPopup']);
308
  $disablePopup = sgBoolToChecked($popupProDefaultValues['disablePopup']);
309
+ $disablePopupOverlay = sgBoolToChecked($popupProDefaultValues['disablePopupOverlay']);
310
  $autoClosePopup = sgBoolToChecked($popupProDefaultValues['autoClosePopup']);
311
  $fbStatus = sgBoolToChecked($popupProDefaultValues['fbStatus']);
312
  $twitterStatus = sgBoolToChecked($popupProDefaultValues['twitterStatus']);
319
  $shareUrl = $popupProDefaultValues['sgShareUrl'];
320
  $pushToBottom = sgBoolToChecked($popupProDefaultValues['pushToBottom']);
321
  $allPages = sgBoolToChecked($popupProDefaultValues['allPages']);
322
+ $allPosts = sgBoolToChecked($popupProDefaultValues['allPosts']);
323
+ $onceExpiresTime = $popupProDefaultValues['onceExpiresTime'];
324
+ $countryStatus = sgBoolToChecked($popupProDefaultValues['countryStatus']);
325
+ $allowCountries = $popupProDefaultValues['allowCountries'];
326
  $countdownNumbersTextColor = $popupProDefaultValues['countdownNumbersTextColor'];
327
  $countdownNumbersBgColor = $popupProDefaultValues['countdownNumbersBgColor'];
328
  $countdownLang = $popupProDefaultValues['countDownLang'];
351
  $subsTextBorderWidth = $popupProDefaultValues['subs-text-border-width'];
352
  $subsTextBordercolor = $popupProDefaultValues['subs-text-bordercolor'];
353
  $subsTextInputBgcolor = $popupProDefaultValues['subs-text-input-bgcolor'];
354
+ $contactName = $popupProDefaultValues['contact-name'];
355
+ $contactEmail = $popupProDefaultValues['contact-email'];
356
+ $contactMessage = $popupProDefaultValues['contact-message'];
357
+ $contactSubject = $popupProDefaultValues['contact-subject'];
358
+ $contactSuccessMessage = $popupProDefaultValues['contact-success-message'];
359
+ $contactBtnTitle = $popupProDefaultValues['contact-btn-title'];
360
+ $contactValidateEmail = $popupProDefaultValues['contact-validate-email'];
361
+ $overlayCustomClasss = $popupProDefaultValues['overlay-custom-classs'];
362
+ $contentCustomClasss = $popupProDefaultValues['content-custom-classs'];
363
 
364
  function sgBoolToChecked($var)
365
  {
386
  $deafultFixed = $sgPopup['fixed'];
387
  $defaultDuration = $sgPopup['duration'];
388
  $defaultDelay = $sgPopup['delay'];
389
+ $themeCloseText = $sgPopup['theme-close-text'];
390
 
391
  $sgCloseButton = @sgSetChecked($sgCloseButton, $closeButton);
392
  $sgEscKey = @sgSetChecked($sgEscKey, $escKey);
401
  $sgOpenOnMobile = @sgSetChecked($sgOpenOnMobile, $openMobile);
402
  $sgRepeatPopup = @sgSetChecked($sgRepeatPopup, $repetPopup);
403
  $sgDisablePopup = @sgSetChecked($sgDisablePopup, $disablePopup);
404
+ $sgDisablePopupOverlay = @sgSetChecked($sgDisablePopupOverlay, $disablePopupOverlay);
405
  $sgAutoClosePopup = @sgSetChecked($sgAutoClosePopup, $autoClosePopup);
406
  $sgFbStatus = @sgSetChecked($sgFbStatus, $fbStatus);
407
  $sgTwitterStatus = @sgSetChecked($sgTwitterStatus, $twitterStatus);
413
  $sgSocialLabel = @sgSetChecked($sgSocialLabel, $socialLabel);
414
  $sgPopupFixed = @sgSetChecked($sgPopupFixed, $deafultFixed);
415
  $sgPushToBottom = @sgSetChecked($sgPushToBottom, $pushToBottom);
416
+ $sgAllPages = @sgSetChecked($sgAllPagesStatus, $allPages);
417
+ $sgAllPosts = @sgSetChecked($sgAllPostStatus, $allPosts);
418
  $sgCountdownPosition = @sgSetChecked($sgCountdownPosition, $countdownPosition);
419
  $sgVideoAutoplay = @sgSetChecked($sgVideoAutoplay, $videoAutoplay);
420
  $sgSubsLastNameStatus = @sgSetChecked($sgSubsLastNameStatus, $subsLastNameStatus);
421
  $sgSubsFirstNameStatus = @sgSetChecked($sgSubsFirstNameStatus, $subsFirstNameStatus);
422
+ $sgCountryStatus = @sgSetChecked($sgCountryStatus, $countryStatus);
423
 
424
  function sgSetChecked($optionsParam,$defaultOption)
425
  {
443
  $sgInitialHeight = @sgGetValue($sgInitialHeight, $initialHeight);
444
  $sgMaxWidth = @sgGetValue($sgMaxWidth, $maxWidth);
445
  $sgMaxHeight = @sgGetValue($sgMaxHeight, $maxHeight);
446
+ $sgThemeCloseText = @sgGetValue($sgThemeCloseText, $themeCloseText);
447
  $duration = @sgGetValue($duration, $defaultDuration);
448
+ $sgOnceExpiresTime = @sgGetValue($sgOnceExpiresTime, $onceExpiresTime);
449
  $delay = @sgGetValue($delay, $defaultDelay);
450
  $sgPopupDataIframe = @sgGetValue($sgPopupDataIframe, 'http://');
451
  $sgShareUrl = @sgGetValue($sgShareUrl, $shareUrl);
452
  $sgPopupDataHtml = @sgGetValue($sgPopupDataHtml, '');
453
  $sgPopupDataImage = @sgGetValue($sgPopupDataImage, '');
454
+ $sgAllowCountries = @sgGetValue($sgAllowCountries, $allowCountries);
455
  $sgCountdownNumbersTextColor = @sgGetValue($sgCountdownNumbersTextColor, $countdownNumbersTextColor);
456
  $sgCountdownNumbersBgColor = @sgGetValue($sgCountdownNumbersBgColor, $countdownNumbersBgColor);
457
  $sgCountdownLang = @sgGetValue($sgCountdownLang, $countdownLang);
477
  $sgSubsValidateMessage = @sgGetValue($sgSubsValidateMessage, $subsValidationMessage);
478
  $sgSubsBtnProgressTitle = @sgGetValue($sgSubsBtnProgressTitle, $subsBtnProgressTitle);
479
  $sgSubsTextBorderWidth = @sgGetValue($sgSubsTextBorderWidth, $subsTextBorderWidth);
480
+ $sgContactNameLabel = @sgGetValue($sgContactNameLabel, $contactName);
481
+ $sgContactSubjectLabel = @sgGetValue($sgContactSubjectLabel, $contactSubject);
482
+ $sgContactEmailLabel = @sgGetValue($sgContactEmailLabel, $contactEmail);
483
+ $sgContactMessageLabel = @sgGetValue($sgContactMessageLabel, $contactMessage);
484
+ $sgContactValidationMessage = @sgGetValue($sgContactValidationMessage, $subsValidationMessage);
485
+ $sgContactSuccessMessage = @sgGetValue($sgContactSuccessMessage, $contactSuccessMessage);
486
+ $sgContactInputsWidth = @sgGetValue($sgContactInputsWidth, $subsTextWidth);
487
+ $sgContactInputsHeight = @sgGetValue($sgContactInputsHeight, $subsTextHeight);
488
+ $sgContactInputsBorderWidth = @sgGetValue($sgContactInputsBorderWidth, $subsTextBorderWidth);
489
+ $sgContactTextInputBgcolor = @sgGetValue($sgContactTextInputBgcolor, $subsTextInputBgcolor);
490
+ $sgContactTextBordercolor = @sgGetValue($sgContactTextBordercolor, $subsTextBordercolor);
491
+ $sgContactInputsColor = @sgGetValue($sgContactInputsColor, $subsInputsColor);
492
+ $sgContactPlaceholderColor = @sgGetValue($sgContactPlaceholderColor, $subsPlaceholderColor);
493
+ $sgContactBtnWidth = @sgGetValue($sgContactBtnWidth, $subsBtnWidth);
494
+ $sgContactBtnHeight = @sgGetValue($sgContactBtnHeight, $subsBtnHeight);
495
+ $sgContactBtnTitle = @sgGetValue($sgContactBtnTitle, $contactBtnTitle);
496
+ $sgContactBtnProgressTitle = @sgGetValue($sgContactBtnProgressTitle, $subsBtnProgressTitle);
497
+ $sgContactButtonBgcolor = @sgGetValue($sgContactButtonBgcolor, $subsButtonBgcolor);
498
+ $sgContactButtonColor = @sgGetValue($sgContactButtonColor, $subsButtonColor);
499
+ $sgContactAreaWidth = @sgGetValue($sgContactAreaWidth, $subsTextWidth);
500
+ $sgContactAreaHeight = @sgGetValue($sgContactAreaHeight, '');
501
+ $sgContactValidateEmail = @sgGetValue($sgContactValidateEmail, $contactValidateEmail);
502
+ $sgOverlayCustomClasss = @sgGetValue($sgOverlayCustomClasss, $overlayCustomClasss);
503
+ $sgContentCustomClasss = @sgGetValue($sgContentCustomClasss, $contentCustomClasss);
504
+
505
  function sgGetValue($getedVal,$defValue)
506
  {
507
  if (!isset($getedVal)) {
526
  )
527
  );
528
 
529
+ $countriesRadio = array(
530
+ array(
531
+ 'name'=>'allowCountries',
532
+ 'value'=>'allow',
533
+ 'additionalHtml'=>'<span class="countries-radio-text allow-countries">Allow</span>',
534
+ 'newline' => false
535
+ ),
536
+ array(
537
+ 'name'=>'allowCountries',
538
+ 'value'=>'disallow',
539
+ 'additionalHtml'=>'<span class="countries-radio-text">Disallow</span>',
540
+ 'newline' => true
541
+ )
542
+ );
543
+
544
  function sgCreateRadioElements($radioElements,$checkedValue)
545
  {
546
  $content = '';
714
  "43200" => "per month",
715
  "always" => "always"
716
  );
717
+ $sgTextAreaResizeOptions = array(
718
+ 'both' => 'Both',
719
+ 'horizontal' => 'Horizontal',
720
+ 'vertical' => 'Vertical',
721
+ 'none' => 'None',
722
+ 'inherit' => 'Inherit'
723
+ );
724
 
725
+ if (SG_POPUP_PRO) {
726
+ require_once(SG_APP_POPUP_FILES ."/sg_params_arrays.php");
727
+ }
728
 
729
  function sgCreateSelect($options,$name,$selecteOption)
730
  {
825
  <div class="theme3 sg-hide"></div>
826
  <div class="theme4 sg-hide"></div>
827
  <div class="theme5 sg-hide"></div>
828
+ <div class="theme-colse-text sg-hide">
829
+ <span class="liquid-width">Close button text:</span>
830
+ <input type="text" name="theme-close-text" value="<?php echo esc_attr($sgThemeCloseText);?>">
831
+ </div>
832
  </div>
833
  </div>
834
 
852
  <span class="liquid-width">Effect duration:</span>
853
  <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>
854
 
855
+ <span class="liquid-width">Popup opening delay:</span>
856
  <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>
857
  </div>
858
  </div>
924
  <input type="text" class="js-decimal" value="<?php echo esc_attr($sgOpacity);?>" rel="<?php echo esc_attr($sgOpacity);?>" name="opacity"/>
925
  <div id="js-display-decimal" class="display-box"></div>
926
  </div><br>
927
+
928
+ <span class="liquid-width">Overlay custom class:</span><input class="input-width-static" type="text" name="sgOverlayCustomClasss" value="<?php echo esc_attr(@$sgOverlayCustomClasss);?>">
929
+ <br>
930
+
931
+ <span class="liquid-width">Content custom class:</span><input class="input-width-static" type="text" name="sgContentCustomClasss" value="<?php echo esc_attr(@$sgContentCustomClasss);?>">
932
+ <br>
933
+
934
+ <span class="liquid-width" id="createDescribeFixed">Popup location:</span><input class="input-width-static js-checkbox-acordion" type="checkbox" name="popupFixed" <?php echo $sgPopupFixed;?> />
935
  <div class="js-popop-fixeds">
936
  <span class="fix-wrapper-style" >&nbsp;</span>
937
  <div class="fixed-wrapper">
954
  </div>
955
  </div>
956
  </div>
957
+ <?php if (SG_POPUP_PRO) : require_once("options_section/pro.php"); ?>
958
+ <?php else: ?>
959
+ <div class="pro-options" onclick="window.open('http://sygnoos.com/wordpress-popup/')"></div>
960
+ <?php endif; ?>
 
961
  </div>
962
  </div>
963
  <div class="clear"></div>
files/sg_popup_main.php CHANGED
@@ -1,12 +1,22 @@
1
  <?php
2
  require_once(SG_APP_POPUP_CLASSES.'/sgDataTable/SGPopupTable.php');
 
3
  ?>
4
  <div class="wrap">
5
  <div class="headers-wrapper">
6
- <h2>Popups <a href="<?php echo admin_url();?>admin.php?page=create-popup" class="add-new-h2">Add New</a></h2>
7
  <?php if(!SG_POPUP_PRO): ?>
8
  <input type="button" class="main-update-to-pro" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL;?>')">
9
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
10
  </div>
11
  <?php
12
  $table = new SGPB_PopupsView();
1
  <?php
2
  require_once(SG_APP_POPUP_CLASSES.'/sgDataTable/SGPopupTable.php');
3
+ $allData = SGPopup::findAll();
4
  ?>
5
  <div class="wrap">
6
  <div class="headers-wrapper">
7
+ <h2 class="add-new-buttons">Popups <a href="<?php echo admin_url();?>admin.php?page=create-popup" class="add-new-h2">Add New</a></h2>
8
  <?php if(!SG_POPUP_PRO): ?>
9
  <input type="button" class="main-update-to-pro" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL;?>')">
10
  <?php endif; ?>
11
+ <?php if(SG_POPUP_PRO): ?>
12
+ <div class="export-import-buttons-wrraper">
13
+ <?php if(!empty($allData)):?>
14
+ <a href= "admin-post.php?action=popup_export" ><input type="button" value="Export" class="button"></a>
15
+ <?php endif;?>
16
+ <input id="js-upload-export-file" class="button" type="button" value="Import"><img src="<?php echo plugins_url('img/wpAjax.gif', dirname(__FILE__).'../'); ?>" alt="gif" class="sg-hide-element js-sg-import-gif">
17
+ </div>
18
+ <div class="clear"></div>
19
+ <?php endif; ?>
20
  </div>
21
  <?php
22
  $table = new SGPB_PopupsView();
files/sg_popup_media_button.php CHANGED
@@ -88,4 +88,4 @@ function sgPopupMediaButtonThickboxs()
88
  <?php endif;
89
  }
90
 
91
- add_action('admin_footer', 'sgPopupMediaButtonThickboxs');
88
  <?php endif;
89
  }
90
 
91
+ add_action('admin_footer', 'sgPopupMediaButtonThickboxs');
files/sg_popup_save.php CHANGED
@@ -7,11 +7,13 @@ function sgSanitize($optionsKey)
7
  if ($optionsKey == "sg_popup_html"||
8
  $optionsKey == "sg_ageRestriction"||
9
  $optionsKey == "sg_countdown"||
10
- $optionsKey == "iframe"||
11
  $optionsKey == "sg_social" ||
12
  $optionsKey == "sg-exit-intent" ||
13
  $optionsKey == "sg_popup_fblike" ||
14
- $optionsKey == "sg_subscription"
 
 
 
15
  ) {
16
  if(SG_POPUP_PRO) {
17
  $sgPopupData = $_POST[$optionsKey];
@@ -36,7 +38,12 @@ function sgPopupSave()
36
  $fblikeOptions = array();
37
  $subscriptionOptions = array();
38
  $options = array();
 
39
  $showAllPages = sgSanitize('allPages');
 
 
 
 
40
 
41
  $socialOptions = array(
42
  'sgSocialTheme' => sgSanitize('sgSocialTheme'),
@@ -109,6 +116,32 @@ function sgPopupSave()
109
  'subs-text-border-width' => sgSanitize('subs-text-border-width'),
110
  );
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  $fblikeOptions = array(
113
  'fblike-like-url' => sgSanitize('fblike-like-url'),
114
  'fblike-layout' => sgSanitize('fblike-layout')
@@ -141,7 +174,16 @@ function sgPopupSave()
141
  'openMobile' => sgSanitize('openMobile'), // open only for mobile
142
  'repeatPopup' => sgSanitize('repeatPopup'),
143
  'autoClosePopup' => sgSanitize('autoClosePopup'),
 
 
 
 
 
 
 
 
144
  'disablePopup' => sgSanitize('disablePopup'),
 
145
  'popupClosingTimer' => sgSanitize('popupClosingTimer'),
146
  'yesButtonLabel' => sgSanitize('yesButtonLabel'),
147
  'noButtonLabel' => sgSanitize('noButtonLabel'),
@@ -153,6 +195,10 @@ function sgPopupSave()
153
  'yesButtonRadius' => (int)sgSanitize('yesButtonRadius'),
154
  'noButtonRadius' => (int)sgSanitize('noButtonRadius'),
155
  'pushToBottom' => sgSanitize('pushToBottom'),
 
 
 
 
156
  'socialButtons' => json_encode($socialButtons),
157
  'socialOptions' => json_encode($socialOptions),
158
  'countdownOptions' => json_encode($countdownOptions),
@@ -168,6 +214,7 @@ function sgPopupSave()
168
  $image = sgSanitize('ad_image');
169
  $countdown = stripslashes(sgSanitize('sg_countdown'));
170
  $subscription = stripslashes(sgSanitize('sg_subscription'));
 
171
  $iframe = sgSanitize('iframe');
172
  $video = sgSanitize('video');
173
  $shortCode = stripslashes(sgSanitize('shortcode'));
@@ -191,19 +238,17 @@ function sgPopupSave()
191
  'countdown' => $countdown,
192
  'exitIntent' => $exitIntent,
193
  'sg_subscription' => $subscription,
 
194
  'social' => $social,
195
  'options' => $jsonDataArray,
196
- 'subscriptionOptions' => json_encode($subscriptionOptions)
 
197
  );
198
 
199
- function setPopupForAllPages($id, $allPages) {
200
- if($allPages) {
201
- update_option('SG_POPUP_ONLOAD_ID', $id);
202
- }
203
- else {
204
- delete_option('SG_POPUP_ONLOAD_ID');
205
- }
206
  }
 
207
  function setOptionPopupType($id, $type) {
208
  update_option("SG_POPUP_".strtoupper($type)."_".$id,$id);
209
  }
@@ -220,7 +265,14 @@ function sgPopupSave()
220
  global $wpdb;
221
  call_user_func(array($popupClassName, 'create'), $data);
222
  $lastId = $wpdb->get_var("SELECT LAST_INSERT_ID() FROM ". $wpdb->prefix."sg_popup");
223
- setPopupForAllPages($lastId, $showAllPages);
 
 
 
 
 
 
 
224
  setOptionPopupType($lastId, $type);
225
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=".$lastId."&type=$type&saved=1");
226
  exit();
@@ -277,8 +329,18 @@ function sgPopupSave()
277
  $popup->setContent($subscription);
278
  $popup->setSubscriptionOptions(json_encode($subscriptionOptions));
279
  break;
 
 
 
 
 
 
 
 
 
 
 
280
  }
281
- setPopupForAllPages($id, $showAllPages);
282
  setOptionPopupType($id, $type);
283
  $popup->save();
284
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=$id&type=$type&saved=1");
7
  if ($optionsKey == "sg_popup_html"||
8
  $optionsKey == "sg_ageRestriction"||
9
  $optionsKey == "sg_countdown"||
 
10
  $optionsKey == "sg_social" ||
11
  $optionsKey == "sg-exit-intent" ||
12
  $optionsKey == "sg_popup_fblike" ||
13
+ $optionsKey == "sg_subscription" ||
14
+ $optionsKey == "sg_contactForm" ||
15
+ $optionsKey == "all-selected-page" ||
16
+ $optionsKey == "all-selected-posts"
17
  ) {
18
  if(SG_POPUP_PRO) {
19
  $sgPopupData = $_POST[$optionsKey];
38
  $fblikeOptions = array();
39
  $subscriptionOptions = array();
40
  $options = array();
41
+ $contactFormOptions = array();
42
  $showAllPages = sgSanitize('allPages');
43
+ $showAllPosts = sgSanitize('allPosts');
44
+ $allSelectedPages = sgSanitize('all-selected-page');
45
+ $allSelectedPosts = sgSanitize('all-selected-posts');
46
+
47
 
48
  $socialOptions = array(
49
  'sgSocialTheme' => sgSanitize('sgSocialTheme'),
116
  'subs-text-border-width' => sgSanitize('subs-text-border-width'),
117
  );
118
 
119
+ $contactFormOptions = array(
120
+ 'contact-name' => sgSanitize('contact-name'),
121
+ 'contact-subject' => sgSanitize('contact-subject'),
122
+ 'contact-email' => sgSanitize('contact-email'),
123
+ 'contact-message' => sgSanitize('contact-message'),
124
+ 'contact-validation-message' => sgSanitize('contact-validation-message'),
125
+ 'contact-success-message' => sgSanitize('contact-success-message'),
126
+ 'contact-inputs-width' => sgSanitize('contact-inputs-width'),
127
+ 'contact-inputs-height' => sgSanitize('contact-inputs-height'),
128
+ 'contact-inputs-border-width' => sgSanitize('contact-inputs-border-width'),
129
+ 'contact-text-input-bgcolor' => sgSanitize('contact-text-input-bgcolor'),
130
+ 'contact-text-bordercolor' => sgSanitize('contact-text-bordercolor'),
131
+ 'contact-inputs-color' => sgSanitize('contact-inputs-color'),
132
+ 'contact-placeholder-color' => sgSanitize('contact-placeholder-color'),
133
+ 'contact-btn-width' => sgSanitize('contact-btn-width'),
134
+ 'contact-btn-height' => sgSanitize('contact-btn-height'),
135
+ 'contact-btn-title' => sgSanitize('contact-btn-title'),
136
+ 'contact-btn-progress-title' => sgSanitize('contact-btn-progress-title'),
137
+ 'contact-button-bgcolor' => sgSanitize('contact-button-bgcolor'),
138
+ 'contact-button-color' => sgSanitize('contact-button-color'),
139
+ 'contact-area-width' => sgSanitize('contact-area-width'),
140
+ 'contact-area-height' => sgSanitize('contact-area-height'),
141
+ 'sg-contact-resize' => sgSanitize('sg-contact-resize'),
142
+ 'contact-validate-email' => sgSanitize('contact-validate-email')
143
+ );
144
+
145
  $fblikeOptions = array(
146
  'fblike-like-url' => sgSanitize('fblike-like-url'),
147
  'fblike-layout' => sgSanitize('fblike-layout')
174
  'openMobile' => sgSanitize('openMobile'), // open only for mobile
175
  'repeatPopup' => sgSanitize('repeatPopup'),
176
  'autoClosePopup' => sgSanitize('autoClosePopup'),
177
+ 'countryStatus' => sgSanitize('countryStatus'),
178
+ 'showAllPages' => $showAllPages,
179
+ 'allSelectedPages' => $allSelectedPages,
180
+ 'showAllPosts' => $showAllPosts,
181
+ 'allSelectedPosts' => $allSelectedPosts,
182
+ 'allowCountries' => sgSanitize('allowCountries'),
183
+ 'countryName' => sgSanitize('countryName'),
184
+ 'countryIso' => sgSanitize('countryIso'),
185
  'disablePopup' => sgSanitize('disablePopup'),
186
+ 'disablePopupOverlay' => sgSanitize('disablePopupOverlay'),
187
  'popupClosingTimer' => sgSanitize('popupClosingTimer'),
188
  'yesButtonLabel' => sgSanitize('yesButtonLabel'),
189
  'noButtonLabel' => sgSanitize('noButtonLabel'),
195
  'yesButtonRadius' => (int)sgSanitize('yesButtonRadius'),
196
  'noButtonRadius' => (int)sgSanitize('noButtonRadius'),
197
  'pushToBottom' => sgSanitize('pushToBottom'),
198
+ 'onceExpiresTime' => sgSanitize('onceExpiresTime'),
199
+ 'sgOverlayCustomClasss' => sgSanitize('sgOverlayCustomClasss'),
200
+ 'sgContentCustomClasss' => sgSanitize('sgContentCustomClasss'),
201
+ 'theme-close-text' => sgSanitize('theme-close-text'),
202
  'socialButtons' => json_encode($socialButtons),
203
  'socialOptions' => json_encode($socialOptions),
204
  'countdownOptions' => json_encode($countdownOptions),
214
  $image = sgSanitize('ad_image');
215
  $countdown = stripslashes(sgSanitize('sg_countdown'));
216
  $subscription = stripslashes(sgSanitize('sg_subscription'));
217
+ $sgContactForm = stripslashes(sgSanitize('sg_contactForm'));
218
  $iframe = sgSanitize('iframe');
219
  $video = sgSanitize('video');
220
  $shortCode = stripslashes(sgSanitize('shortcode'));
238
  'countdown' => $countdown,
239
  'exitIntent' => $exitIntent,
240
  'sg_subscription' => $subscription,
241
+ 'sg_contactForm' => $sgContactForm,
242
  'social' => $social,
243
  'options' => $jsonDataArray,
244
+ 'subscriptionOptions' => json_encode($subscriptionOptions),
245
+ 'contactFormOptions' => json_encode($contactFormOptions)
246
  );
247
 
248
+ function setPopupForAllPages($id, $data) {
249
+ SGPopup::addPopupForAllPages($id, $data);
 
 
 
 
 
250
  }
251
+
252
  function setOptionPopupType($id, $type) {
253
  update_option("SG_POPUP_".strtoupper($type)."_".$id,$id);
254
  }
265
  global $wpdb;
266
  call_user_func(array($popupClassName, 'create'), $data);
267
  $lastId = $wpdb->get_var("SELECT LAST_INSERT_ID() FROM ". $wpdb->prefix."sg_popup");
268
+
269
+ SGPopup::removePopupFromPages($lastId);
270
+ if(!empty($showAllPages)) {
271
+ setPopupForAllPages($lastId, $allSelectedPages);
272
+ }
273
+ if(!empty($showAllPosts)) {
274
+ setPopupForAllPages($lastId, $allSelectedPosts);
275
+ }
276
  setOptionPopupType($lastId, $type);
277
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=".$lastId."&type=$type&saved=1");
278
  exit();
329
  $popup->setContent($subscription);
330
  $popup->setSubscriptionOptions(json_encode($subscriptionOptions));
331
  break;
332
+ case 'SGContactform':
333
+ $popup->setContent($sgContactForm);
334
+ $popup->steParams(json_encode($contactFormOptions));
335
+ break;
336
+ }
337
+ SGPopup::removePopupFromPages($id);
338
+ if($showAllPages) {
339
+ setPopupForAllPages($id, $allSelectedPages);
340
+ }
341
+ if($showAllPosts) {
342
+ setPopupForAllPages($id, $allSelectedPosts);
343
  }
 
344
  setOptionPopupType($id, $type);
345
  $popup->save();
346
  wp_redirect(SG_APP_POPUP_ADMIN_URL."admin.php?page=edit-popup&id=$id&type=$type&saved=1");
img/proOptions.png ADDED
Binary file
img/wpAjax.gif ADDED
Binary file
javascript/jquery.sgcolorbox-min.js CHANGED
@@ -1,1005 +1,1020 @@
1
  (function ($, document, window) {
2
- var
3
- defaults = {
4
- html: false,
5
- photo: false,
6
- iframe: false,
7
- inline: false,
8
- transition: "elastic",
9
- speed: 300,
10
- fadeOut: 300,
11
- width: false,
12
- initialWidth: "600",
13
- innerWidth: false,
14
- maxWidth: false,
15
- height: false,
16
- initialHeight: "450",
17
- innerHeight: false,
18
- maxHeight: false,
19
- scalePhotos: true,
20
- scrolling: true,
21
- opacity: 0.9,
22
- preloading: true,
23
- className: false,
24
- overlayClose: true,
25
- escKey: true,
26
- arrowKey: true,
27
- top: false,
28
- bottom: false,
29
- left: false,
30
- right: false,
31
- fixed: false,
32
- data: undefined,
33
- closeButton: true,
34
- fastIframe: true,
35
- open: false,
36
- reposition: true,
37
- loop: true,
38
- slideshow: false,
39
- slideshowAuto: true,
40
- slideshowSpeed: 2500,
41
- slideshowStart: "start slideshow",
42
- slideshowStop: "stop slideshow",
43
- photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
44
- customClass: 'colorbox1', /* For default themes load*/
45
- retinaImage: false,
46
- retinaUrl: false,
47
- retinaSuffix: '@2x.$1',
48
- current: "image {current} of {total}",
49
- previous: "previous",
50
- next: "next",
51
- close: "close",
52
- xhrError: "This content failed to load.",
53
- imgError: "This image failed to load.",
54
- returnFocus: true,
55
- trapFocus: true,
56
- onOpen: false,
57
- onLoad: false,
58
- onComplete: false,
59
- onCleanup: false,
60
- onClosed: false,
61
-
62
- rel: function () {
63
- return this.rel;
64
- },
65
- href: function () {
66
-
67
- return $(this).attr('href');
68
- },
69
- title: function () {
70
- return this.title;
71
- },
72
- createImg: function () {
73
- var img = new Image();
74
- var attrs = $(this).data('cbox-img-attrs');
75
-
76
- if (typeof attrs === 'object') {
77
- $.each(attrs, function (key, val) {
78
- img[key] = val;
79
- });
80
- }
81
-
82
- return img;
83
- },
84
- createIframe: function () {
85
- var iframe = document.createElement('iframe');
86
- var attrs = $(this).data('cbox-iframe-attrs');
87
-
88
- if (typeof attrs === 'object') {
89
- $.each(attrs, function (key, val) {
90
- iframe[key] = val;
91
- });
92
- }
93
-
94
- if ('frameBorder' in iframe) {
95
- iframe.frameBorder = 0;
96
- }
97
- if ('allowTransparency' in iframe) {
98
- iframe.allowTransparency = "true";
99
- }
100
- iframe.name = (new Date()).getTime();
101
- iframe.allowFullscreen = true;
102
-
103
- return iframe;
104
- }
105
- },
106
- colorbox = 'sgcolorbox',
107
- prefix = 'sgcbox',
108
- boxElement = prefix + 'Element',
109
- event_open = prefix + '_open',
110
- event_load = prefix + '_load',
111
- event_complete = prefix + '_complete',
112
- event_cleanup = prefix + '_cleanup',
113
- event_closed = prefix + '_closed',
114
- event_purge = prefix + '_purge',
115
- $overlay,
116
- $box,
117
- $wrap,
118
- $content,
119
- $topBorder,
120
- $leftBorder,
121
- $rightBorder,
122
- $bottomBorder,
123
- $related,
124
- $window,
125
- $loaded,
126
- $loadingBay,
127
- $loadingOverlay,
128
- $title,
129
- $current,
130
- $slideshow,
131
- $next,
132
- $prev,
133
- $close,
134
- $groupControls,
135
- $events = $('<a/>'),
136
- settings,
137
- interfaceHeight,
138
- interfaceWidth,
139
- loadedHeight,
140
- loadedWidth,
141
- index,
142
- photo,
143
- open,
144
- active,
145
- closing,
146
- loadingTimer,
147
- publicMethod,
148
- div = "div",
149
- requests = 0,
150
- previousCSS = {},
151
- init;
152
- function $tag(tag, id, css) {
153
- var element = document.createElement(tag);
154
-
155
- if (id) {
156
- element.id = prefix + id;
157
- }
158
-
159
- if (css) {
160
- element.style.cssText = css;
161
- }
162
-
163
- return $(element);
164
- }
165
- function winheight() {
166
- return window.innerHeight ? window.innerHeight : $(window).height();
167
- }
168
-
169
- function Settings(element, options) {
170
- if (options !== Object(options)) {
171
- options = {};
172
- }
173
-
174
- this.cache = {};
175
- this.el = element;
176
-
177
- this.value = function (key) {
178
- var dataAttr;
179
-
180
- if (this.cache[key] === undefined) {
181
- dataAttr = $(this.el).attr('data-cbox-' + key);
182
-
183
- if (dataAttr !== undefined) {
184
- this.cache[key] = dataAttr;
185
- } else if (options[key] !== undefined) {
186
- this.cache[key] = options[key];
187
- } else if (defaults[key] !== undefined) {
188
- this.cache[key] = defaults[key];
189
- }
190
- }
191
-
192
- return this.cache[key];
193
- };
194
-
195
- this.get = function (key) {
196
- var value = this.value(key);
197
- return $.isFunction(value) ? value.call(this.el, this) : value;
198
- };
199
- }
200
- function getIndex(increment) {
201
- var
202
- max = $related.length,
203
- newIndex = (index + increment) % max;
204
-
205
- return (newIndex < 0) ? max + newIndex : newIndex;
206
- }
207
- function setSize(size, dimension) {
208
- return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
209
- }
210
- function isImage(settings, url) {
211
- return settings.get('photo') || settings.get('photoRegex').test(url);
212
- }
213
-
214
- function retinaUrl(settings, url) {
215
- return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
216
- }
217
-
218
- function trapFocus(e) {
219
- if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
220
- e.stopPropagation();
221
- $box.focus();
222
- }
223
- }
224
-
225
- function setClass(str) {
226
- if (setClass.str !== str) {
227
- $box.add($overlay).removeClass(setClass.str).addClass(str);
228
- setClass.str = str;
229
- }
230
- }
231
-
232
- function getRelated(rel) {
233
- index = 0;
234
-
235
- if (rel && rel !== false && rel !== 'nofollow') {
236
- $related = $('.' + boxElement).filter(function () {
237
- var options = $.data(this, colorbox);
238
- var settings = new Settings(this, options);
239
- return (settings.get('rel') === rel);
240
- });
241
- index = $related.index(settings.el);
242
- if (index === -1) {
243
- $related = $related.add(settings.el);
244
- index = $related.length - 1;
245
- }
246
- } else {
247
- $related = $(settings.el);
248
- }
249
- }
250
-
251
- function trigger(event) {
252
-
253
- $(document).trigger(event);
254
-
255
- $events.triggerHandler(event);
256
- }
257
-
258
- var slideshow = (function () {
259
- var active,
260
- className = prefix + "Slideshow_",
261
- click = "click." + prefix,
262
- timeOut;
263
-
264
- function clear() {
265
- clearTimeout(timeOut);
266
- }
267
-
268
- function set() {
269
- if (settings.get('loop') || $related[index + 1]) {
270
- clear();
271
- timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
272
- }
273
- }
274
-
275
- function start() {
276
- $slideshow
277
- .html(settings.get('slideshowStop'))
278
- .unbind(click)
279
- .one(click, stop);
280
-
281
- $events
282
- .bind(event_complete, set)
283
- .bind(event_load, clear);
284
-
285
- $box.removeClass(className + "off").addClass(className + "on");
286
- }
287
-
288
- function stop() {
289
- clear();
290
-
291
- $events
292
- .unbind(event_complete, set)
293
- .unbind(event_load, clear);
294
-
295
- $slideshow
296
- .html(settings.get('slideshowStart'))
297
- .unbind(click)
298
- .one(click, function () {
299
- publicMethod.next();
300
- start();
301
- });
302
-
303
- $box.removeClass(className + "on").addClass(className + "off");
304
- }
305
-
306
- function reset() {
307
- active = false;
308
- $slideshow.hide();
309
- clear();
310
- $events
311
- .unbind(event_complete, set)
312
- .unbind(event_load, clear);
313
- $box.removeClass(className + "off " + className + "on");
314
- }
315
-
316
- return function () {
317
- if (active) {
318
- if (!settings.get('slideshow')) {
319
- $events.unbind(event_cleanup, reset);
320
- reset();
321
- }
322
- } else {
323
- if (settings.get('slideshow') && $related[1]) {
324
- active = true;
325
- $events.one(event_cleanup, reset);
326
- if (settings.get('slideshowAuto')) {
327
- start();
328
- } else {
329
- stop();
330
- }
331
- $slideshow.show();
332
- }
333
- }
334
- };
335
-
336
- }());
337
- function launch(element) {
338
- var options;
339
-
340
- if (!closing) {
341
-
342
- options = $(element).data(colorbox);
343
-
344
- settings = new Settings(element, options);
345
-
346
- getRelated(settings.get('rel'));
347
-
348
- if (!open) {
349
- open = active = true;
350
-
351
- setClass(settings.get('className'));
352
- $box.css({visibility: 'hidden', display: 'block', opacity: ''});
353
-
354
- $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
355
- $content.css({width: '', height: ''}).append($loaded);
356
- interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
357
- interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
358
- loadedHeight = $loaded.outerHeight(true);
359
- loadedWidth = $loaded.outerWidth(true);
360
- var initialWidth = setSize(settings.get('initialWidth'), 'x');
361
- var initialHeight = setSize(settings.get('initialHeight'), 'y');
362
- var maxWidth = settings.get('maxWidth');
363
- var maxHeight = settings.get('maxHeight');
364
-
365
- settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0);
366
- settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0);
367
-
368
- $loaded.css({width: '', height: settings.h});
369
- publicMethod.position();
370
-
371
- trigger(event_open);
372
- settings.get('onOpen');
373
-
374
- $groupControls.add($title).hide();
375
-
376
- //$box.focus();
377
-
378
- if (settings.get('trapFocus')) {
379
- if (document.addEventListener) {
380
-
381
- document.addEventListener('focus', trapFocus, true);
382
-
383
- $events.one(event_closed, function () {
384
- document.removeEventListener('focus', trapFocus, true);
385
- });
386
- }
387
- }
388
- if (settings.get('returnFocus')) {
389
- $events.one(event_closed, function () {
390
- $(settings.el).focus();
391
- });
392
- }
393
- }
394
-
395
- var opacity = parseFloat(settings.get('opacity'));
396
- $overlay.css({
397
- opacity: opacity === opacity ? opacity : '',
398
- cursor: settings.get('overlayClose') ? 'pointer' : '',
399
- visibility: 'visible'
400
- }).show();
401
-
402
- if (settings.get('closeButton')) {
403
- $close.html(settings.get('close')).appendTo($content);
404
- } else {
405
- $close.appendTo('<div/>');
406
- }
407
-
408
- load();
409
- }
410
- }
411
- function appendHTML(options) { /* options Received from publicMethod */
412
- if (!$box) {
413
- init = false;
414
- $window = $(window);
415
- $box = $tag(div).attr({
416
- id: colorbox,
417
- 'class': $.support.opacity === false ? prefix + 'IE' : '',
418
- role: 'dialog',
419
- tabindex: '-1'
420
- }).hide();
421
- $overlay = $tag(div, "Overlay").hide();
422
- $loadingOverlay = $([$tag(div, "LoadingOverlay")[0], $tag(div, "LoadingGraphic")[0]]);
423
- $wrap = $tag(div, "Wrapper");
424
- $content = $tag(div, "Content").append(
425
- $title = $tag(div, "Title"),
426
- $current = $tag(div, "Current"),
427
- $prev = $('<button type="button"/>').attr({id: prefix + 'Previous'}),
428
- $next = $('<button type="button"/>').attr({id: prefix + 'Next'}),
429
- $slideshow = $tag('button', "Slideshow"),
430
- $loadingOverlay
431
- );
432
-
433
- $close = $('<button type="button"/>').attr({id: prefix + 'Close'});
434
-
435
- $wrap.append(
436
- $tag(div).append(
437
- $tag(div, "TopLeft"),
438
- $topBorder = $tag(div, "TopCenter"),
439
- $tag(div, "TopRight")
440
- ),
441
- $tag(div, false, 'clear:left').append(
442
- $leftBorder = $tag(div, "MiddleLeft"),
443
- $content,
444
- $rightBorder = $tag(div, "MiddleRight")
445
- ),
446
- $tag(div, false, 'clear:left').append(
447
- $tag(div, "BottomLeft"),
448
- $bottomBorder = $tag(div, "BottomCenter"),
449
- $tag(div, "BottomRight")
450
- )
451
- ).find('div div').css({'float': 'left'});
452
-
453
- $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
454
-
455
- $groupControls = $next.add($prev).add($current).add($slideshow);
456
- }
457
- if (document.body && !$box.parent().length) {
458
- $(document.body).append($overlay, $box.append($wrap, $loadingBay));
459
- }
460
- /* Start to set custom class and add to html */
461
- if(typeof options === 'object') {
462
- var customClass = defaults['customClass'];
463
- if(typeof options['className'] !== 'undefined' && options['className']){
464
- customClass = options['className'];
465
- }
466
- $box.addClass(customClass);
467
- $overlay.addClass(customClass);
468
- }
469
- /* End action */
470
- }
471
- function addBindings() {
472
- function clickHandler(e) {
473
- if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
474
- e.preventDefault();
475
- launch(this);
476
- }
477
- }
478
-
479
- if ($box) {
480
- if (!init) {
481
- init = true;
482
- $next.click(function () {
483
- publicMethod.next();
484
- });
485
- $prev.click(function () {
486
- publicMethod.prev();
487
- });
488
- $close.click(function () {
489
- publicMethod.close();
490
- });
491
- $overlay.click(function () {
492
- if (settings.get('overlayClose')) {
493
- publicMethod.close();
494
- }
495
- });
496
- $(document).bind('keydown.' + prefix, function (e) {
497
- var key = e.keyCode;
498
- if (open && settings.get('escKey') && key === 27) {
499
- e.preventDefault();
500
- publicMethod.close();
501
- }
502
- if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
503
- if (key === 37) {
504
- e.preventDefault();
505
- $prev.click();
506
- } else if (key === 39) {
507
- e.preventDefault();
508
- $next.click();
509
- }
510
- }
511
- });
512
-
513
- if ($.isFunction($.fn.on)) {
514
-
515
- $(document).on('click.' + prefix, '.' + boxElement, clickHandler);
516
- } else {
517
- $('.' + boxElement).live('click.' + prefix, clickHandler);
518
- }
519
- }
520
- return true;
521
- }
522
- return false;
523
- }
524
- if ($[colorbox]) {
525
- return;
526
- }
527
- $(appendHTML);
528
- publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
529
- var settings;
530
- var $obj = this;
531
-
532
- options = options || {};
533
-
534
- if ($.isFunction($obj)) {
535
- $obj = $('<a/>');
536
- options.open = true;
537
- }
538
-
539
- if (!$obj[0]) {
540
- return $obj;
541
- }
542
-
543
- appendHTML(options); /* Send options for received custom class name*/
544
-
545
- if (addBindings()) {
546
-
547
- if (callback) {
548
- options.onComplete = callback;
549
- }
550
-
551
- $obj.each(function () {
552
- var old = $.data(this, colorbox) || {};
553
- $.data(this, colorbox, $.extend(old, options));
554
- }).addClass(boxElement);
555
-
556
- settings = new Settings($obj[0], options);
557
-
558
- if (settings.get('open')) {
559
- launch($obj[0]);
560
- }
561
- }
562
-
563
- return $obj;
564
- };
565
-
566
- publicMethod.position = function (speed, loadedCallback) {
567
- var
568
- css,
569
- top = 0,
570
- left = 0,
571
- offset = $box.offset(),
572
- scrollTop,
573
- scrollLeft;
574
-
575
- $window.unbind('resize.' + prefix);
576
- $box.css({top: -9e4, left: -9e4});
577
-
578
- scrollTop = $window.scrollTop();
579
- scrollLeft = $window.scrollLeft();
580
-
581
- if (settings.get('fixed')) {
582
- offset.top -= scrollTop;
583
- offset.left -= scrollLeft;
584
- $box.css({position: 'fixed'});
585
- } else {
586
- top = scrollTop;
587
- left = scrollLeft;
588
- $box.css({position: 'absolute'});
589
- }
590
- if (settings.get('right') !== false) {
591
- left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
592
- } else if (settings.get('left') !== false) {
593
- left += setSize(settings.get('left'), 'x');
594
- } else {
595
- left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
596
- }
597
-
598
- if (settings.get('bottom') !== false) {
599
- top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
600
- } else if (settings.get('top') !== false) {
601
- top += setSize(settings.get('top'), 'y');
602
- } else {
603
- top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
604
- }
605
-
606
- $box.css({top: offset.top, left: offset.left, visibility: 'visible'});
607
- $wrap[0].style.width = $wrap[0].style.height = "9999px";
608
-
609
- function modalDimensions() {
610
- $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width, 10) - interfaceWidth) + 'px';
611
- $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height, 10) - interfaceHeight) + 'px';
612
- }
613
-
614
- css = {
615
- width: settings.w + loadedWidth + interfaceWidth,
616
- height: settings.h + loadedHeight + interfaceHeight,
617
- top: top,
618
- left: left
619
- };
620
- if (speed) {
621
- var tempSpeed = 0;
622
- $.each(css, function (i) {
623
- if (css[i] !== previousCSS[i]) {
624
- tempSpeed = speed;
625
- return;
626
- }
627
- });
628
- speed = tempSpeed;
629
- }
630
-
631
- previousCSS = css;
632
-
633
- if (!speed) {
634
- $box.css(css);
635
- }
636
-
637
- $box.dequeue().animate(css, {
638
- duration: speed || 0,
639
- complete: function () {
640
- modalDimensions();
641
-
642
- active = false;
643
- $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
644
- $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
645
-
646
- if (settings.get('reposition')) {
647
- setTimeout(function () {
648
- $window.bind('resize.' + prefix, publicMethod.position);
649
- }, 1);
650
- }
651
-
652
- if ($.isFunction(loadedCallback)) {
653
- loadedCallback();
654
- }
655
- },
656
- step: modalDimensions
657
- });
658
- };
659
-
660
- publicMethod.resize = function (options) {
661
- var scrolltop;
662
-
663
- if (open) {
664
- options = options || {};
665
-
666
- if (options.width) {
667
- settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
668
- }
669
-
670
- if (options.innerWidth) {
671
- settings.w = setSize(options.innerWidth, 'x');
672
- }
673
-
674
- $loaded.css({width: settings.w});
675
-
676
- if (options.height) {
677
- settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
678
- }
679
-
680
- if (options.innerHeight) {
681
- settings.h = setSize(options.innerHeight, 'y');
682
- }
683
-
684
- if (!options.innerHeight && !options.height) {
685
- scrolltop = $loaded.scrollTop();
686
- $loaded.css({height: "auto"});
687
- settings.h = $loaded.height();
688
- }
689
-
690
- $loaded.css({height: settings.h});
691
-
692
- if (scrolltop) {
693
- $loaded.scrollTop(scrolltop);
694
- }
695
-
696
- publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
697
- }
698
- };
699
-
700
- publicMethod.prep = function (object) {
701
- if (!open) {
702
- return;
703
- }
704
-
705
- var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
706
-
707
- $loaded.remove();
708
-
709
- $loaded = $tag(div, 'LoadedContent').append(object);
710
-
711
- function getWidth() {
712
- settings.w = settings.w || $loaded.width();
713
- settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
714
- return settings.w;
715
- }
716
-
717
- function getHeight() {
718
- settings.h = settings.h || $loaded.height();
719
- settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
720
- return settings.h;
721
- }
722
-
723
- $loaded.hide()
724
- .appendTo($loadingBay.show())
725
- .css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
726
- .css({height: getHeight()})
727
- .prependTo($content);
728
-
729
- $loadingBay.hide();
730
-
731
- $(photo).css({'float': 'none'});
732
-
733
- setClass(settings.get('className'));
734
-
735
- callback = function () {
736
- var total = $related.length,
737
- iframe,
738
- complete;
739
-
740
- if (!open) {
741
- return;
742
- }
743
-
744
- function removeFilter() {
745
- if ($.support.opacity === false) {
746
- $box[0].style.removeAttribute('filter');
747
- }
748
- }
749
-
750
- complete = function () {
751
- clearTimeout(loadingTimer);
752
- $loadingOverlay.hide();
753
- trigger(event_complete);
754
- settings.get('onComplete');
755
- };
756
- $title.html(settings.get('title')).show();
757
- $loaded.show();
758
-
759
- if (total > 1) {
760
- if (typeof settings.get('current') === "string") {
761
- $current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
762
- }
763
-
764
- $next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
765
- $prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
766
-
767
- slideshow();
768
- if (settings.get('preloading')) {
769
- $.each([getIndex(-1), getIndex(1)], function () {
770
- var img,
771
- i = $related[this],
772
- settings = new Settings(i, $.data(i, colorbox)),
773
- src = settings.get('href');
774
-
775
- if (src && isImage(settings, src)) {
776
- src = retinaUrl(settings, src);
777
- img = document.createElement('img');
778
- img.src = src;
779
- }
780
- });
781
- }
782
- } else {
783
- $groupControls.hide();
784
- }
785
-
786
- if (settings.get('iframe')) {
787
-
788
- iframe = settings.get('createIframe');
789
-
790
- if (!settings.get('scrolling')) {
791
- iframe.scrolling = "no";
792
- }
793
-
794
- $(iframe)
795
- .attr({
796
- src: settings.get('href'),
797
- 'class': prefix + 'Iframe'
798
- })
799
- .one('load', complete)
800
- .appendTo($loaded);
801
-
802
- $events.one(event_purge, function () {
803
- iframe.src = "//about:blank";
804
- });
805
-
806
- if (settings.get('fastIframe')) {
807
- $(iframe).trigger('load');
808
- }
809
- } else {
810
- complete();
811
- }
812
-
813
- if (settings.get('transition') === 'fade') {
814
- $box.fadeTo(speed, 1, removeFilter);
815
- } else {
816
- removeFilter();
817
- }
818
- };
819
-
820
- if (settings.get('transition') === 'fade') {
821
- $box.fadeTo(speed, 0, function () {
822
- publicMethod.position(0, callback);
823
- });
824
- } else {
825
- publicMethod.position(speed, callback);
826
- }
827
- };
828
-
829
- function load() {
830
- var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
831
-
832
- active = true;
833
-
834
- photo = false;
835
-
836
- trigger(event_purge);
837
- trigger(event_load);
838
- settings.get('onLoad');
839
-
840
- settings.h = settings.get('height') ?
841
- setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
842
- settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
843
-
844
- settings.w = settings.get('width') ?
845
- setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
846
- settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
847
- settings.mw = settings.w;
848
- settings.mh = settings.h;
849
- if (settings.get('maxWidth')) {
850
- settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
851
- settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
852
- }
853
- if (settings.get('maxHeight')) {
854
- settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
855
- settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
856
- }
857
-
858
- href = settings.get('href');
859
-
860
- loadingTimer = setTimeout(function () {
861
- $loadingOverlay.show();
862
- }, 100);
863
-
864
- if (settings.get('inline')) {
865
- var $target = $(href);
866
- $inline = $('<div>').hide().insertBefore($target);
867
-
868
- $events.one(event_purge, function () {
869
- $inline.replaceWith($target);
870
- });
871
-
872
- prep($target);
873
- } else if (settings.get('iframe')) {
874
- prep(" ");
875
- } else if (settings.get('html')) {
876
- prep(settings.get('html'));
877
- } else if (isImage(settings, href)) {
878
-
879
- href = retinaUrl(settings, href);
880
-
881
- photo = settings.get('createImg');
882
-
883
- $(photo)
884
- .addClass(prefix + 'Photo')
885
- .bind('error.' + prefix, function () {
886
- prep($tag(div, 'Error').html(settings.get('imgError')));
887
- })
888
- .one('load', function () {
889
- if (request !== requests) {
890
- return;
891
- }
892
- setTimeout(function () {
893
- var percent;
894
-
895
- if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
896
- photo.height = photo.height / window.devicePixelRatio;
897
- photo.width = photo.width / window.devicePixelRatio;
898
- }
899
-
900
- if (settings.get('scalePhotos')) {
901
- setResize = function () {
902
- photo.height -= photo.height * percent;
903
- photo.width -= photo.width * percent;
904
- };
905
- if (settings.mw && photo.width > settings.mw) {
906
- percent = (photo.width - settings.mw) / photo.width;
907
- setResize();
908
- }
909
- if (settings.mh && photo.height > settings.mh) {
910
- percent = (photo.height - settings.mh) / photo.height;
911
- setResize();
912
- }
913
- }
914
-
915
- if (settings.h) {
916
- photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
917
- }
918
-
919
- if ($related[1] && (settings.get('loop') || $related[index + 1])) {
920
- photo.style.cursor = 'pointer';
921
-
922
- $(photo).bind('click.' + prefix, function () {
923
- publicMethod.next();
924
- });
925
- }
926
-
927
- photo.style.width = photo.width + 'px';
928
- photo.style.height = photo.height + 'px';
929
- prep(photo);
930
- }, 1);
931
- });
932
-
933
- photo.src = href;
934
-
935
- } else if (href) {
936
- $loadingBay.load(href, settings.get('data'), function (data, status) {
937
- if (request === requests) {
938
- prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
939
- }
940
- });
941
- }
942
- }
943
- publicMethod.next = function () {
944
- if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
945
- index = getIndex(1);
946
- launch($related[index]);
947
- }
948
- };
949
-
950
- publicMethod.prev = function () {
951
- if (!active && $related[1] && (settings.get('loop') || index)) {
952
- index = getIndex(-1);
953
- launch($related[index]);
954
- }
955
- };
956
- publicMethod.close = function () {
957
- if (open && !closing) {
958
-
959
- closing = true;
960
- open = false;
961
- trigger(event_cleanup);
962
- settings.get('onCleanup');
963
- $window.unbind('.' + prefix);
964
- $overlay.fadeTo(settings.get('fadeOut') || 0, 0);
965
-
966
- $box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
967
- $box.hide();
968
- $overlay.hide();
969
- trigger(event_purge);
970
- $loaded.remove();
971
-
972
- setTimeout(function () {
973
- closing = false;
974
- trigger(event_closed);
975
- settings.get('onClosed');
976
- }, 1);
977
- });
978
- }
979
- };
980
-
981
- publicMethod.remove = function () {
982
- if (!$box) {
983
- return;
984
- }
985
-
986
- $box.stop();
987
- $[colorbox].close();
988
- $box.stop(false, true).remove();
989
- $overlay.remove();
990
- closing = false;
991
- $box = null;
992
- $('.' + boxElement)
993
- .removeData(colorbox)
994
- .removeClass(boxElement);
995
-
996
- $(document).unbind('click.' + prefix).unbind('keydown.' + prefix);
997
- };
998
-
999
- publicMethod.element = function () {
1000
- return $(settings.el);
1001
- };
1002
-
1003
- publicMethod.settings = defaults;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1004
 
1005
  }(jQuery, document, window));
1
  (function ($, document, window) {
2
+ var
3
+ defaults = {
4
+ html: false,
5
+ photo: false,
6
+ iframe: false,
7
+ inline: false,
8
+ transition: "elastic",
9
+ speed: 300,
10
+ fadeOut: 300,
11
+ width: false,
12
+ initialWidth: "600",
13
+ innerWidth: false,
14
+ maxWidth: false,
15
+ height: false,
16
+ initialHeight: "450",
17
+ innerHeight: false,
18
+ maxHeight: false,
19
+ scalePhotos: true,
20
+ scrolling: true,
21
+ opacity: 0.9,
22
+ preloading: true,
23
+ className: false,
24
+ overlayClose: true,
25
+ escKey: true,
26
+ arrowKey: true,
27
+ top: false,
28
+ bottom: false,
29
+ left: false,
30
+ right: false,
31
+ fixed: false,
32
+ data: undefined,
33
+ closeButton: true,
34
+ fastIframe: true,
35
+ open: false,
36
+ reposition: true,
37
+ loop: true,
38
+ slideshow: false,
39
+ slideshowAuto: true,
40
+ slideshowSpeed: 2500,
41
+ slideshowStart: "start slideshow",
42
+ slideshowStop: "stop slideshow",
43
+ photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
44
+ customClass: 'colorbox1', /* For default themes load*/
45
+ retinaImage: false,
46
+ retinaUrl: false,
47
+ retinaSuffix: '@2x.$1',
48
+ current: "image {current} of {total}",
49
+ previous: "previous",
50
+ next: "next",
51
+ close: "close",
52
+ xhrError: "This content failed to load.",
53
+ imgError: "This image failed to load.",
54
+ contentCustomClassName: "sg-popup-content",
55
+ overlayCutsomClassName: "sg-popup-overlay",
56
+ returnFocus: true,
57
+ trapFocus: true,
58
+ onOpen: false,
59
+ onLoad: false,
60
+ onComplete: false,
61
+ onCleanup: false,
62
+ onClosed: false,
63
+
64
+ rel: function () {
65
+ return this.rel;
66
+ },
67
+ href: function () {
68
+
69
+ return $(this).attr('href');
70
+ },
71
+ title: function () {
72
+ return this.title;
73
+ },
74
+ createImg: function () {
75
+ var img = new Image();
76
+ var attrs = $(this).data('cbox-img-attrs');
77
+
78
+ if (typeof attrs === 'object') {
79
+ $.each(attrs, function (key, val) {
80
+ img[key] = val;
81
+ });
82
+ }
83
+
84
+ return img;
85
+ },
86
+ createIframe: function () {
87
+ var iframe = document.createElement('iframe');
88
+ var attrs = $(this).data('cbox-iframe-attrs');
89
+
90
+ if (typeof attrs === 'object') {
91
+ $.each(attrs, function (key, val) {
92
+ iframe[key] = val;
93
+ });
94
+ }
95
+
96
+ if ('frameBorder' in iframe) {
97
+ iframe.frameBorder = 0;
98
+ }
99
+ if ('allowTransparency' in iframe) {
100
+ iframe.allowTransparency = "true";
101
+ }
102
+ iframe.name = (new Date()).getTime();
103
+ iframe.allowFullscreen = true;
104
+
105
+ return iframe;
106
+ }
107
+ },
108
+ colorbox = 'sgcolorbox',
109
+ prefix = 'sgcbox',
110
+ boxElement = prefix + 'Element',
111
+ event_open = prefix + '_open',
112
+ event_load = prefix + '_load',
113
+ event_complete = prefix + '_complete',
114
+ event_cleanup = prefix + '_cleanup',
115
+ event_closed = prefix + '_closed',
116
+ event_purge = prefix + '_purge',
117
+ $overlay,
118
+ $box,
119
+ $wrap,
120
+ $content,
121
+ $topBorder,
122
+ $leftBorder,
123
+ $rightBorder,
124
+ $bottomBorder,
125
+ $related,
126
+ $window,
127
+ $loaded,
128
+ $loadingBay,
129
+ $loadingOverlay,
130
+ $title,
131
+ $current,
132
+ $slideshow,
133
+ $next,
134
+ $prev,
135
+ $close,
136
+ $groupControls,
137
+ $events = $('<a/>'),
138
+ settings,
139
+ interfaceHeight,
140
+ interfaceWidth,
141
+ loadedHeight,
142
+ loadedWidth,
143
+ index,
144
+ photo,
145
+ open,
146
+ active,
147
+ closing,
148
+ loadingTimer,
149
+ publicMethod,
150
+ div = "div",
151
+ requests = 0,
152
+ previousCSS = {},
153
+ init;
154
+ function $tag(tag, id, css) {
155
+ var element = document.createElement(tag);
156
+
157
+ if (id) {
158
+ element.id = prefix + id;
159
+ }
160
+
161
+ if (css) {
162
+ element.style.cssText = css;
163
+ }
164
+
165
+ return $(element);
166
+ }
167
+ function winheight() {
168
+ return window.innerHeight ? window.innerHeight : $(window).height();
169
+ }
170
+
171
+ function Settings(element, options) {
172
+ if (options !== Object(options)) {
173
+ options = {};
174
+ }
175
+
176
+ this.cache = {};
177
+ this.el = element;
178
+
179
+ this.value = function (key) {
180
+ var dataAttr;
181
+
182
+ if (this.cache[key] === undefined) {
183
+ dataAttr = $(this.el).attr('data-cbox-' + key);
184
+
185
+ if (dataAttr !== undefined) {
186
+ this.cache[key] = dataAttr;
187
+ } else if (options[key] !== undefined) {
188
+ this.cache[key] = options[key];
189
+ } else if (defaults[key] !== undefined) {
190
+ this.cache[key] = defaults[key];
191
+ }
192
+ }
193
+
194
+ return this.cache[key];
195
+ };
196
+
197
+ this.get = function (key) {
198
+ var value = this.value(key);
199
+ return $.isFunction(value) ? value.call(this.el, this) : value;
200
+ };
201
+ }
202
+ function getIndex(increment) {
203
+ var
204
+ max = $related.length,
205
+ newIndex = (index + increment) % max;
206
+
207
+ return (newIndex < 0) ? max + newIndex : newIndex;
208
+ }
209
+ function setSize(size, dimension) {
210
+ return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
211
+ }
212
+ function isImage(settings, url) {
213
+ return settings.get('photo') || settings.get('photoRegex').test(url);
214
+ }
215
+
216
+ function retinaUrl(settings, url) {
217
+ return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
218
+ }
219
+
220
+ function trapFocus(e) {
221
+ if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
222
+ e.stopPropagation();
223
+ $box.focus();
224
+ }
225
+ }
226
+
227
+ function setClass(str) {
228
+ if (setClass.str !== str) {
229
+ $box.add($overlay).removeClass(setClass.str).addClass(str);
230
+ setClass.str = str;
231
+ }
232
+ }
233
+
234
+ function getRelated(rel) {
235
+ index = 0;
236
+
237
+ if (rel && rel !== false && rel !== 'nofollow') {
238
+ $related = $('.' + boxElement).filter(function () {
239
+ var options = $.data(this, colorbox);
240
+ var settings = new Settings(this, options);
241
+ return (settings.get('rel') === rel);
242
+ });
243
+ index = $related.index(settings.el);
244
+ if (index === -1) {
245
+ $related = $related.add(settings.el);
246
+ index = $related.length - 1;
247
+ }
248
+ } else {
249
+ $related = $(settings.el);
250
+ }
251
+ }
252
+
253
+ function trigger(event) {
254
+
255
+ $(document).trigger(event);
256
+
257
+ $events.triggerHandler(event);
258
+ }
259
+
260
+ var slideshow = (function () {
261
+ var active,
262
+ className = prefix + "Slideshow_",
263
+ click = "click." + prefix,
264
+ timeOut;
265
+
266
+ function clear() {
267
+ clearTimeout(timeOut);
268
+ }
269
+
270
+ function set() {
271
+ if (settings.get('loop') || $related[index + 1]) {
272
+ clear();
273
+ timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
274
+ }
275
+ }
276
+
277
+ function start() {
278
+ $slideshow
279
+ .html(settings.get('slideshowStop'))
280
+ .unbind(click)
281
+ .one(click, stop);
282
+
283
+ $events
284
+ .bind(event_complete, set)
285
+ .bind(event_load, clear);
286
+
287
+ $box.removeClass(className + "off").addClass(className + "on");
288
+ }
289
+
290
+ function stop() {
291
+ clear();
292
+
293
+ $events
294
+ .unbind(event_complete, set)
295
+ .unbind(event_load, clear);
296
+
297
+ $slideshow
298
+ .html(settings.get('slideshowStart'))
299
+ .unbind(click)
300
+ .one(click, function () {
301
+ publicMethod.next();
302
+ start();
303
+ });
304
+
305
+ $box.removeClass(className + "on").addClass(className + "off");
306
+ }
307
+
308
+ function reset() {
309
+ active = false;
310
+ $slideshow.hide();
311
+ clear();
312
+ $events
313
+ .unbind(event_complete, set)
314
+ .unbind(event_load, clear);
315
+ $box.removeClass(className + "off " + className + "on");
316
+ }
317
+
318
+ return function () {
319
+ if (active) {
320
+ if (!settings.get('slideshow')) {
321
+ $events.unbind(event_cleanup, reset);
322
+ reset();
323
+ }
324
+ } else {
325
+ if (settings.get('slideshow') && $related[1]) {
326
+ active = true;
327
+ $events.one(event_cleanup, reset);
328
+ if (settings.get('slideshowAuto')) {
329
+ start();
330
+ } else {
331
+ stop();
332
+ }
333
+ $slideshow.show();
334
+ }
335
+ }
336
+ };
337
+
338
+ }());
339
+ function launch(element) {
340
+ var options;
341
+
342
+ if (!closing) {
343
+
344
+ options = $(element).data(colorbox);
345
+
346
+ settings = new Settings(element, options);
347
+
348
+ getRelated(settings.get('rel'));
349
+
350
+ if (!open) {
351
+ open = active = true;
352
+
353
+ setClass(settings.get('className'));
354
+ $box.css({visibility: 'hidden', display: 'block', opacity: ''});
355
+
356
+ $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
357
+ $content.css({width: '', height: ''}).append($loaded);
358
+ interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
359
+ interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
360
+ loadedHeight = $loaded.outerHeight(true);
361
+ loadedWidth = $loaded.outerWidth(true);
362
+ var initialWidth = setSize(settings.get('initialWidth'), 'x');
363
+ var initialHeight = setSize(settings.get('initialHeight'), 'y');
364
+ var maxWidth = settings.get('maxWidth');
365
+ var maxHeight = settings.get('maxHeight');
366
+
367
+ settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0);
368
+ settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0);
369
+
370
+ $loaded.css({width: '', height: settings.h});
371
+ publicMethod.position();
372
+
373
+ trigger(event_open);
374
+ settings.get('onOpen');
375
+
376
+ $groupControls.add($title).hide();
377
+
378
+ // $box.focus(); issue for fierfox long content click
379
+
380
+ if (settings.get('trapFocus')) {
381
+ if (document.addEventListener) {
382
+
383
+ document.addEventListener('focus', trapFocus, true);
384
+
385
+ $events.one(event_closed, function () {
386
+ document.removeEventListener('focus', trapFocus, true);
387
+ });
388
+ }
389
+ }
390
+ if (settings.get('returnFocus')) {
391
+ $events.one(event_closed, function () {
392
+ $(settings.el).focus();
393
+ });
394
+ }
395
+ }
396
+
397
+ var opacity = parseFloat(settings.get('opacity'));
398
+ $overlay.css({
399
+ opacity: opacity === opacity ? opacity : '',
400
+ cursor: settings.get('overlayClose') ? 'pointer' : '',
401
+ visibility: 'visible'
402
+ }).show();
403
+
404
+ if (settings.get('closeButton')) {
405
+ $close.html(settings.get('close')).appendTo($content);
406
+ } else {
407
+ $close.appendTo('<div/>');
408
+ }
409
+
410
+ load();
411
+ }
412
+ }
413
+ function appendHTML(options) { /* options Received from publicMethod */
414
+ if (!$box) {
415
+ init = false;
416
+ $window = $(window);
417
+ $box = $tag(div).attr({
418
+ id: colorbox,
419
+ 'class': $.support.opacity === false ? prefix + 'IE' : '',
420
+ role: 'dialog',
421
+ tabindex: '-1'
422
+ }).hide();
423
+ $overlay = $tag(div, "Overlay").hide();
424
+ $loadingOverlay = $([$tag(div, "LoadingOverlay")[0], $tag(div, "LoadingGraphic")[0]]);
425
+ $wrap = $tag(div, "Wrapper");
426
+ $content = $tag(div, "Content").append(
427
+ $title = $tag(div, "Title"),
428
+ $current = $tag(div, "Current"),
429
+ $prev = $('<button type="button"/>').attr({id: prefix + 'Previous'}),
430
+ $next = $('<button type="button"/>').attr({id: prefix + 'Next'}),
431
+ $slideshow = $tag('button', "Slideshow"),
432
+ $loadingOverlay
433
+ );
434
+
435
+ $close = $('<button type="button"/>').attr({id: prefix + 'Close'});
436
+
437
+ $wrap.append(
438
+ $tag(div).append(
439
+ $tag(div, "TopLeft"),
440
+ $topBorder = $tag(div, "TopCenter"),
441
+ $tag(div, "TopRight")
442
+ ),
443
+ $tag(div, false, 'clear:left').append(
444
+ $leftBorder = $tag(div, "MiddleLeft"),
445
+ $content,
446
+ $rightBorder = $tag(div, "MiddleRight")
447
+ ),
448
+ $tag(div, false, 'clear:left').append(
449
+ $tag(div, "BottomLeft"),
450
+ $bottomBorder = $tag(div, "BottomCenter"),
451
+ $tag(div, "BottomRight")
452
+ )
453
+ ).find('div div').css({'float': 'left'});
454
+
455
+ $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
456
+
457
+ $groupControls = $next.add($prev).add($current).add($slideshow);
458
+ }
459
+ if (document.body && !$box.parent().length) {
460
+ $(document.body).append($overlay, $box.append($wrap, $loadingBay));
461
+ }
462
+ /* Start to set custom class and add to html */
463
+ if(typeof options === 'object') {
464
+ var customClass = defaults['customClass'];
465
+ if(typeof options['className'] !== 'undefined' && options['className']){
466
+ customClass = options['className'];
467
+ }
468
+ if(typeof options['overlayCutsomClassName'] !== 'undefined' && options['overlayCutsomClassName']) {
469
+ overlayCutsomClassName = options['overlayCutsomClassName'];
470
+ }
471
+ else {
472
+ overlayCutsomClassName = defaults['overlayCutsomClassName'];
473
+ }
474
+ if(typeof options['contentCustomClassName'] !== 'undefined' && options['contentCustomClassName']) {
475
+ contentCustomClassName = options['contentCustomClassName'];
476
+ }
477
+ else {
478
+ contentCustomClassName = defaults['contentCustomClassName'];
479
+ }
480
+
481
+ $box.addClass(customClass).addClass(contentCustomClassName);
482
+ $overlay.addClass(customClass).addClass(overlayCutsomClassName);
483
+ }
484
+ /* End action */
485
+ }
486
+ function addBindings() {
487
+ function clickHandler(e) {
488
+ if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
489
+ e.preventDefault();
490
+ launch(this);
491
+ }
492
+ }
493
+
494
+ if ($box) {
495
+ if (!init) {
496
+ init = true;
497
+ $next.click(function () {
498
+ publicMethod.next();
499
+ });
500
+ $prev.click(function () {
501
+ publicMethod.prev();
502
+ });
503
+ $close.click(function () {
504
+ publicMethod.close();
505
+ });
506
+ $overlay.click(function () {
507
+ if (settings.get('overlayClose')) {
508
+ publicMethod.close();
509
+ }
510
+ });
511
+ $(document).bind('keydown.' + prefix, function (e) {
512
+ var key = e.keyCode;
513
+ if (open && settings.get('escKey') && key === 27) {
514
+ e.preventDefault();
515
+ publicMethod.close();
516
+ }
517
+ if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
518
+ if (key === 37) {
519
+ e.preventDefault();
520
+ $prev.click();
521
+ } else if (key === 39) {
522
+ e.preventDefault();
523
+ $next.click();
524
+ }
525
+ }
526
+ });
527
+
528
+ if ($.isFunction($.fn.on)) {
529
+
530
+ $(document).on('click.' + prefix, '.' + boxElement, clickHandler);
531
+ } else {
532
+ $('.' + boxElement).live('click.' + prefix, clickHandler);
533
+ }
534
+ }
535
+ return true;
536
+ }
537
+ return false;
538
+ }
539
+ if ($[colorbox]) {
540
+ return;
541
+ }
542
+ $(appendHTML);
543
+ publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
544
+ var settings;
545
+ var $obj = this;
546
+
547
+ options = options || {};
548
+
549
+ if ($.isFunction($obj)) {
550
+ $obj = $('<a/>');
551
+ options.open = true;
552
+ }
553
+
554
+ if (!$obj[0]) {
555
+ return $obj;
556
+ }
557
+
558
+ appendHTML(options); /* Send options for received custom class name*/
559
+
560
+ if (addBindings()) {
561
+
562
+ if (callback) {
563
+ options.onComplete = callback;
564
+ }
565
+
566
+ $obj.each(function () {
567
+ var old = $.data(this, colorbox) || {};
568
+ $.data(this, colorbox, $.extend(old, options));
569
+ }).addClass(boxElement);
570
+
571
+ settings = new Settings($obj[0], options);
572
+
573
+ if (settings.get('open')) {
574
+ launch($obj[0]);
575
+ }
576
+ }
577
+
578
+ return $obj;
579
+ };
580
+
581
+ publicMethod.position = function (speed, loadedCallback) {
582
+ var
583
+ css,
584
+ top = 0,
585
+ left = 0,
586
+ offset = $box.offset(),
587
+ scrollTop,
588
+ scrollLeft;
589
+
590
+ $window.unbind('resize.' + prefix);
591
+ $box.css({top: -9e4, left: -9e4});
592
+
593
+ scrollTop = $window.scrollTop();
594
+ scrollLeft = $window.scrollLeft();
595
+
596
+ if (settings.get('fixed')) {
597
+ offset.top -= scrollTop;
598
+ offset.left -= scrollLeft;
599
+ $box.css({position: 'fixed'});
600
+ } else {
601
+ top = scrollTop;
602
+ left = scrollLeft;
603
+ $box.css({position: 'absolute'});
604
+ }
605
+ if (settings.get('right') !== false) {
606
+ left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
607
+ } else if (settings.get('left') !== false) {
608
+ left += setSize(settings.get('left'), 'x');
609
+ } else {
610
+ left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
611
+ }
612
+
613
+ if (settings.get('bottom') !== false) {
614
+ top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
615
+ } else if (settings.get('top') !== false) {
616
+ top += setSize(settings.get('top'), 'y');
617
+ } else {
618
+ top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
619
+ }
620
+
621
+ $box.css({top: offset.top, left: offset.left, visibility: 'visible'});
622
+ $wrap[0].style.width = $wrap[0].style.height = "9999px";
623
+
624
+ function modalDimensions() {
625
+ $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width, 10) - interfaceWidth) + 'px';
626
+ $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height, 10) - interfaceHeight) + 'px';
627
+ }
628
+
629
+ css = {
630
+ width: settings.w + loadedWidth + interfaceWidth,
631
+ height: settings.h + loadedHeight + interfaceHeight,
632
+ top: top,
633
+ left: left
634
+ };
635
+ if (speed) {
636
+ var tempSpeed = 0;
637
+ $.each(css, function (i) {
638
+ if (css[i] !== previousCSS[i]) {
639
+ tempSpeed = speed;
640
+ return;
641
+ }
642
+ });
643
+ speed = tempSpeed;
644
+ }
645
+
646
+ previousCSS = css;
647
+
648
+ if (!speed) {
649
+ $box.css(css);
650
+ }
651
+
652
+ $box.dequeue().animate(css, {
653
+ duration: speed || 0,
654
+ complete: function () {
655
+ modalDimensions();
656
+
657
+ active = false;
658
+ $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
659
+ $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
660
+
661
+ if (settings.get('reposition')) {
662
+ setTimeout(function () {
663
+ $window.bind('resize.' + prefix, publicMethod.position);
664
+ }, 1);
665
+ }
666
+
667
+ if ($.isFunction(loadedCallback)) {
668
+ loadedCallback();
669
+ }
670
+ },
671
+ step: modalDimensions
672
+ });
673
+ };
674
+
675
+ publicMethod.resize = function (options) {
676
+ var scrolltop;
677
+
678
+ if (open) {
679
+ options = options || {};
680
+
681
+ if (options.width) {
682
+ settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
683
+ }
684
+
685
+ if (options.innerWidth) {
686
+ settings.w = setSize(options.innerWidth, 'x');
687
+ }
688
+
689
+ $loaded.css({width: settings.w});
690
+
691
+ if (options.height) {
692
+ settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
693
+ }
694
+
695
+ if (options.innerHeight) {
696
+ settings.h = setSize(options.innerHeight, 'y');
697
+ }
698
+
699
+ if (!options.innerHeight && !options.height) {
700
+ scrolltop = $loaded.scrollTop();
701
+ $loaded.css({height: "auto"});
702
+ settings.h = $loaded.height();
703
+ }
704
+
705
+ $loaded.css({height: settings.h});
706
+
707
+ if (scrolltop) {
708
+ $loaded.scrollTop(scrolltop);
709
+ }
710
+
711
+ publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
712
+ }
713
+ };
714
+
715
+ publicMethod.prep = function (object) {
716
+ if (!open) {
717
+ return;
718
+ }
719
+
720
+ var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
721
+
722
+ $loaded.remove();
723
+
724
+ $loaded = $tag(div, 'LoadedContent').append(object);
725
+
726
+ function getWidth() {
727
+ settings.w = settings.w || $loaded.width();
728
+ settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
729
+ return settings.w;
730
+ }
731
+
732
+ function getHeight() {
733
+ settings.h = settings.h || $loaded.height();
734
+ settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
735
+ return settings.h;
736
+ }
737
+
738
+ $loaded.hide()
739
+ .appendTo($loadingBay.show())
740
+ .css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
741
+ .css({height: getHeight()})
742
+ .prependTo($content);
743
+
744
+ $loadingBay.hide();
745
+
746
+ $(photo).css({'float': 'none'});
747
+
748
+ setClass(settings.get('className'));
749
+
750
+ callback = function () {
751
+ var total = $related.length,
752
+ iframe,
753
+ complete;
754
+
755
+ if (!open) {
756
+ return;
757
+ }
758
+
759
+ function removeFilter() {
760
+ if ($.support.opacity === false) {
761
+ $box[0].style.removeAttribute('filter');
762
+ }
763
+ }
764
+
765
+ complete = function () {
766
+ clearTimeout(loadingTimer);
767
+ $loadingOverlay.hide();
768
+ trigger(event_complete);
769
+ settings.get('onComplete');
770
+ };
771
+ $title.html(settings.get('title')).show();
772
+ $loaded.show();
773
+
774
+ if (total > 1) {
775
+ if (typeof settings.get('current') === "string") {
776
+ $current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
777
+ }
778
+
779
+ $next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
780
+ $prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
781
+
782
+ slideshow();
783
+ if (settings.get('preloading')) {
784
+ $.each([getIndex(-1), getIndex(1)], function () {
785
+ var img,
786
+ i = $related[this],
787
+ settings = new Settings(i, $.data(i, colorbox)),
788
+ src = settings.get('href');
789
+
790
+ if (src && isImage(settings, src)) {
791
+ src = retinaUrl(settings, src);
792
+ img = document.createElement('img');
793
+ img.src = src;
794
+ }
795
+ });
796
+ }
797
+ } else {
798
+ $groupControls.hide();
799
+ }
800
+
801
+ if (settings.get('iframe')) {
802
+
803
+ iframe = settings.get('createIframe');
804
+
805
+ if (!settings.get('scrolling')) {
806
+ iframe.scrolling = "no";
807
+ }
808
+
809
+ $(iframe)
810
+ .attr({
811
+ src: settings.get('href'),
812
+ 'class': prefix + 'Iframe'
813
+ })
814
+ .one('load', complete)
815
+ .appendTo($loaded);
816
+
817
+ $events.one(event_purge, function () {
818
+ iframe.src = "//about:blank";
819
+ });
820
+
821
+ if (settings.get('fastIframe')) {
822
+ $(iframe).trigger('load');
823
+ }
824
+ } else {
825
+ complete();
826
+ }
827
+
828
+ if (settings.get('transition') === 'fade') {
829
+ $box.fadeTo(speed, 1, removeFilter);
830
+ } else {
831
+ removeFilter();
832
+ }
833
+ };
834
+
835
+ if (settings.get('transition') === 'fade') {
836
+ $box.fadeTo(speed, 0, function () {
837
+ publicMethod.position(0, callback);
838
+ });
839
+ } else {
840
+ publicMethod.position(speed, callback);
841
+ }
842
+ };
843
+
844
+ function load() {
845
+ var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
846
+
847
+ active = true;
848
+
849
+ photo = false;
850
+
851
+ trigger(event_purge);
852
+ trigger(event_load);
853
+ settings.get('onLoad');
854
+
855
+ settings.h = settings.get('height') ?
856
+ setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
857
+ settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
858
+
859
+ settings.w = settings.get('width') ?
860
+ setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
861
+ settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
862
+ settings.mw = settings.w;
863
+ settings.mh = settings.h;
864
+ if (settings.get('maxWidth')) {
865
+ settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
866
+ settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
867
+ }
868
+ if (settings.get('maxHeight')) {
869
+ settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
870
+ settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
871
+ }
872
+
873
+ href = settings.get('href');
874
+
875
+ loadingTimer = setTimeout(function () {
876
+ $loadingOverlay.show();
877
+ }, 100);
878
+
879
+ if (settings.get('inline')) {
880
+ var $target = $(href);
881
+ $inline = $('<div>').hide().insertBefore($target);
882
+
883
+ $events.one(event_purge, function () {
884
+ $inline.replaceWith($target);
885
+ });
886
+
887
+ prep($target);
888
+ } else if (settings.get('iframe')) {
889
+ prep(" ");
890
+ } else if (settings.get('html')) {
891
+ prep(settings.get('html'));
892
+ } else if (isImage(settings, href)) {
893
+
894
+ href = retinaUrl(settings, href);
895
+
896
+ photo = settings.get('createImg');
897
+
898
+ $(photo)
899
+ .addClass(prefix + 'Photo')
900
+ .bind('error.' + prefix, function () {
901
+ prep($tag(div, 'Error').html(settings.get('imgError')));
902
+ })
903
+ .one('load', function () {
904
+ if (request !== requests) {
905
+ return;
906
+ }
907
+ setTimeout(function () {
908
+ var percent;
909
+
910
+ if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
911
+ photo.height = photo.height / window.devicePixelRatio;
912
+ photo.width = photo.width / window.devicePixelRatio;
913
+ }
914
+
915
+ if (settings.get('scalePhotos')) {
916
+ setResize = function () {
917
+ photo.height -= photo.height * percent;
918
+ photo.width -= photo.width * percent;
919
+ };
920
+ if (settings.mw && photo.width > settings.mw) {
921
+ percent = (photo.width - settings.mw) / photo.width;
922
+ setResize();
923
+ }
924
+ if (settings.mh && photo.height > settings.mh) {
925
+ percent = (photo.height - settings.mh) / photo.height;
926
+ setResize();
927
+ }
928
+ }
929
+
930
+ if (settings.h) {
931
+ photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
932
+ }
933
+
934
+ if ($related[1] && (settings.get('loop') || $related[index + 1])) {
935
+ photo.style.cursor = 'pointer';
936
+
937
+ $(photo).bind('click.' + prefix, function () {
938
+ publicMethod.next();
939
+ });
940
+ }
941
+
942
+ photo.style.width = photo.width + 'px';
943
+ photo.style.height = photo.height + 'px';
944
+ prep(photo);
945
+ }, 1);
946
+ });
947
+
948
+ photo.src = href;
949
+
950
+ } else if (href) {
951
+ $loadingBay.load(href, settings.get('data'), function (data, status) {
952
+ if (request === requests) {
953
+ prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
954
+ }
955
+ });
956
+ }
957
+ }
958
+ publicMethod.next = function () {
959
+ if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
960
+ index = getIndex(1);
961
+ launch($related[index]);
962
+ }
963
+ };
964
+
965
+ publicMethod.prev = function () {
966
+ if (!active && $related[1] && (settings.get('loop') || index)) {
967
+ index = getIndex(-1);
968
+ launch($related[index]);
969
+ }
970
+ };
971
+ publicMethod.close = function () {
972
+ if (open && !closing) {
973
+
974
+ closing = true;
975
+ open = false;
976
+ trigger(event_cleanup);
977
+ settings.get('onCleanup');
978
+ $window.unbind('.' + prefix);
979
+ $overlay.fadeTo(settings.get('fadeOut') || 0, 0);
980
+
981
+ $box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
982
+ $box.hide();
983
+ $overlay.hide();
984
+ trigger(event_purge);
985
+ $loaded.remove();
986
+
987
+ setTimeout(function () {
988
+ closing = false;
989
+ trigger(event_closed);
990
+ settings.get('onClosed');
991
+ }, 1);
992
+ });
993
+ }
994
+ };
995
+
996
+ publicMethod.remove = function () {
997
+ if (!$box) {
998
+ return;
999
+ }
1000
+
1001
+ $box.stop();
1002
+ $[colorbox].close();
1003
+ $box.stop(false, true).remove();
1004
+ $overlay.remove();
1005
+ closing = false;
1006
+ $box = null;
1007
+ $('.' + boxElement)
1008
+ .removeData(colorbox)
1009
+ .removeClass(boxElement);
1010
+
1011
+ $(document).unbind('click.' + prefix).unbind('keydown.' + prefix);
1012
+ };
1013
+
1014
+ publicMethod.element = function () {
1015
+ return $(settings.el);
1016
+ };
1017
+
1018
+ publicMethod.settings = defaults;
1019
 
1020
  }(jQuery, document, window));
javascript/sg_popup_backend.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function($){
2
  this.titleNotEmpty(); /* Check title is Empty */
3
  this.showThemePicture(); /* Show themes pictures */
4
  this.showEffects(); /* Show effect type */
5
  this.pageAcordion(); /* For page acordion divs */
6
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
7
  this.showInfo(); /* Show description options */
8
  this.opasictyRange(); /* Opcity range */
9
  this.subOptionContents();
10
  this.addCountris();
11
  this.checkedOpenDiv();
12
  }
1
+ jQuery(document).ready(function($){
2
  this.titleNotEmpty(); /* Check title is Empty */
3
  this.showThemePicture(); /* Show themes pictures */
4
  this.showEffects(); /* Show effect type */
5
  this.pageAcordion(); /* For page acordion divs */
6
  this.fixedPostionSelection(); /* Fuctionality for selected postion */
7
  this.showInfo(); /* Show description options */
8
  this.opasictyRange(); /* Opcity range */
9
  this.subOptionContents();
10
  this.addCountris();
11
  this.checkedOpenDiv();
12
  }
javascript/sg_popup_frontend.js CHANGED
@@ -12,6 +12,7 @@ function SGPopup() {
12
  this.popupOverlayClose = true;
13
  this.popupContentClick = false;
14
  this.popupCloseButton = true;
 
15
  }
16
 
17
  SGPopup.prototype.init = function() {
@@ -65,6 +66,10 @@ SGPopup.prototype.showPopup = function(id, isOnLoad) {
65
  this.isOnLoad = isOnLoad;
66
  this.openOnce = this.varToBool(this.popupData['repeatPopup']);
67
 
 
 
 
 
68
  if (!this.canOpenPopup(this.popupData['id'], this.openOnce, isOnLoad)) {
69
  return;
70
  }
@@ -99,10 +104,10 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
99
  var popupForMobile = that.varToBool(that.popupData['forMobile']);
100
  var onlyMobile = that.varToBool(that.popupData['openMobile']);
101
  var popupCantClose = that.varToBool(that.popupData['disablePopup']);
 
102
  var popupAutoClosePopup = that.varToBool(that.popupData['autoClosePopup']);
103
  popupClosingTimer = that.popupData['popupClosingTimer'];
104
 
105
-
106
  if (popupCantClose) {
107
  that.cantPopupClose();
108
  }
@@ -123,10 +128,14 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
123
  var popupEffectDuration = that.popupData['duration'];
124
  var popupEffect = that.popupData['effect'];
125
  var pushToBottom = that.popupData['pushToBottom'];
 
126
  var sgType = that.popupData['type'];
 
 
127
  var popupTheme = that.popupData['theme'];
128
  var themeStringLength = popupTheme.length;
129
  var customClassName = popupTheme.substring(0, themeStringLength-4);
 
130
 
131
  popupHtml = (popupHtml) ? popupHtml : false;
132
  var popupIframe = (popupIframeUrl) ? true: false;
@@ -137,9 +146,9 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
137
  if (popupShortCode && popupHtml == false) {
138
  popupHtml = popupShortCode;
139
  }
140
- if(popupHtml) {
141
- jQuery(popupHtml).find('img:first').attr('onload', 'jQuery.sgcolorbox.resize();');
142
- }
143
  if (popupIframeUrl) {
144
  popupImage = popupIframeUrl;
145
  }
@@ -207,10 +216,14 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
207
  }
208
 
209
  if (popupAutoClosePopup) {
210
- that.cantPopupClose();
211
  setTimeout(that.autoClosePopup, popupClosingTimer*1000);
212
  }
213
 
 
 
 
 
 
214
  if(onlyMobile) {
215
  openOnlyMobile = false;
216
  openOnlyMobile = that.forMobile();
@@ -227,6 +240,9 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
227
  width: popupWidth,
228
  height: popupHeight,
229
  className: customClassName,
 
 
 
230
  onOpen:function() {
231
  jQuery('#sgcolorbox').removeAttr('style');
232
  jQuery('#sgcolorbox').removeAttr('left');
@@ -237,9 +253,12 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
237
  jQuery("#sgcolorbox").addClass('sg-animated '+popupEffect+'');
238
  jQuery("#sgcboxOverlay").addClass("sgcboxOverlayBg");
239
  jQuery("#sgcboxOverlay").removeAttr('style');
 
240
  if (popupOverlayColor) {
241
  jQuery("#sgcboxOverlay").css({'background' : 'none', 'background-color' : popupOverlayColor});
242
  }
 
 
243
  },
244
  onLoad: function(){
245
  },
@@ -248,17 +267,24 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
248
  if(popupWidth == '' && popupHeight == '') {
249
  jQuery.sgcolorbox.resize();
250
  }
251
- jQuery('.sg-popup-close').on('click', function() {
252
  jQuery.sgcolorbox.close();
253
  });
 
254
  //Facebook reInit
255
  if(jQuery('#sg-facebook-like').length && typeof FB !== 'undefined') {
256
  FB.XFBML.parse();
257
  }
 
 
 
 
 
258
  },
259
  onClosed: function() {
260
  jQuery('#sgcolorbox').trigger("sgPopupClose", []);
261
  },
 
262
  html: popupHtml,
263
  photo: popupPhoto,
264
  iframe: popupIframe,
@@ -281,9 +307,9 @@ SGPopup.prototype.sgShowColorboxWithOptions = function() {
281
  };
282
 
283
  jQuery.sgcolorbox(SG_POPUP_SETTINGS);
284
-
285
  if (that.popupData['id'] && that.isOnLoad==true && that.openOnce != '') {
286
- jQuery.cookie("sgPopupNumbers",that.popupData['id'], { expires: 7});
 
287
  }
288
 
289
  if (that.popupContentClick) {
12
  this.popupOverlayClose = true;
13
  this.popupContentClick = false;
14
  this.popupCloseButton = true;
15
+ this.sgTrapFocus = true;
16
  }
17
 
18
  SGPopup.prototype.init = function() {
66
  this.isOnLoad = isOnLoad;
67
  this.openOnce = this.varToBool(this.popupData['repeatPopup']);
68
 
69
+ if(typeof that.removeCookie !== 'undefined') {
70
+ that.removeCookie(this.openOnce);
71
+ }
72
+
73
  if (!this.canOpenPopup(this.popupData['id'], this.openOnce, isOnLoad)) {
74
  return;
75
  }
104
  var popupForMobile = that.varToBool(that.popupData['forMobile']);
105
  var onlyMobile = that.varToBool(that.popupData['openMobile']);
106
  var popupCantClose = that.varToBool(that.popupData['disablePopup']);
107
+ var disablePopupOverlay = that.varToBool(that.popupData['disablePopupOverlay']);
108
  var popupAutoClosePopup = that.varToBool(that.popupData['autoClosePopup']);
109
  popupClosingTimer = that.popupData['popupClosingTimer'];
110
 
 
111
  if (popupCantClose) {
112
  that.cantPopupClose();
113
  }
128
  var popupEffectDuration = that.popupData['duration'];
129
  var popupEffect = that.popupData['effect'];
130
  var pushToBottom = that.popupData['pushToBottom'];
131
+ var onceExpiresTime = parseInt(that.popupData['onceExpiresTime']);
132
  var sgType = that.popupData['type'];
133
+ var overlayCustomClass = that.popupData['sgOverlayCustomClasss'];
134
+ var contentCustomClass = that.popupData['sgContentCustomClasss'];
135
  var popupTheme = that.popupData['theme'];
136
  var themeStringLength = popupTheme.length;
137
  var customClassName = popupTheme.substring(0, themeStringLength-4);
138
+ var closeButtonText = that.popupData['theme-close-text'];
139
 
140
  popupHtml = (popupHtml) ? popupHtml : false;
141
  var popupIframe = (popupIframeUrl) ? true: false;
146
  if (popupShortCode && popupHtml == false) {
147
  popupHtml = popupShortCode;
148
  }
149
+ if(popupHtml && popupWidth == '' && popupHeight == '' && popupMaxWidth =='' && popupMaxHeight == '') {
150
+ jQuery(popupHtml).find('img:first').attr('onload', 'jQuery.sgcolorbox.resize();');
151
+ }
152
  if (popupIframeUrl) {
153
  popupImage = popupIframeUrl;
154
  }
216
  }
217
 
218
  if (popupAutoClosePopup) {
 
219
  setTimeout(that.autoClosePopup, popupClosingTimer*1000);
220
  }
221
 
222
+ if(disablePopupOverlay) {
223
+ that.sgTrapFocus = false;
224
+ that.disablePopupOverlay();
225
+ }
226
+
227
  if(onlyMobile) {
228
  openOnlyMobile = false;
229
  openOnlyMobile = that.forMobile();
240
  width: popupWidth,
241
  height: popupHeight,
242
  className: customClassName,
243
+ close: closeButtonText,
244
+ overlayCutsomClassName: overlayCustomClass,
245
+ contentCustomClassName: contentCustomClass,
246
  onOpen:function() {
247
  jQuery('#sgcolorbox').removeAttr('style');
248
  jQuery('#sgcolorbox').removeAttr('left');
253
  jQuery("#sgcolorbox").addClass('sg-animated '+popupEffect+'');
254
  jQuery("#sgcboxOverlay").addClass("sgcboxOverlayBg");
255
  jQuery("#sgcboxOverlay").removeAttr('style');
256
+
257
  if (popupOverlayColor) {
258
  jQuery("#sgcboxOverlay").css({'background' : 'none', 'background-color' : popupOverlayColor});
259
  }
260
+
261
+ jQuery('#sgcolorbox').trigger("sgColorboxOnOpen", []);
262
  },
263
  onLoad: function(){
264
  },
267
  if(popupWidth == '' && popupHeight == '') {
268
  jQuery.sgcolorbox.resize();
269
  }
270
+ jQuery('.sg-popup-close').bind('click', function() {
271
  jQuery.sgcolorbox.close();
272
  });
273
+
274
  //Facebook reInit
275
  if(jQuery('#sg-facebook-like').length && typeof FB !== 'undefined') {
276
  FB.XFBML.parse();
277
  }
278
+ /* Scroll only inside popup */
279
+ jQuery('#sgcboxContent').bind( 'mousewheel', function ( e ) {
280
+ var event = e.originalEvent, d = event.wheelDelta || -event.detail; this.scrollTop += ( d < 0 ? 1 : -1 ) * 30; e.preventDefault();
281
+ }
282
+ );
283
  },
284
  onClosed: function() {
285
  jQuery('#sgcolorbox').trigger("sgPopupClose", []);
286
  },
287
+ trapFocus: that.sgTrapFocus,
288
  html: popupHtml,
289
  photo: popupPhoto,
290
  iframe: popupIframe,
307
  };
308
 
309
  jQuery.sgcolorbox(SG_POPUP_SETTINGS);
 
310
  if (that.popupData['id'] && that.isOnLoad==true && that.openOnce != '') {
311
+ jQuery.cookie.defaults = {path:'/'};
312
+ jQuery.cookie("sgPopupNumbers",that.popupData['id'], { expires: onceExpiresTime});
313
  }
314
 
315
  if (that.popupContentClick) {
javascript/sg_popup_javascript.php CHANGED
@@ -18,12 +18,27 @@ function sg_popup_admin_scripts($hook) {
18
  else if('toplevel_page_PopupBuilder' == $hook){
19
  wp_register_script('javascript', SG_APP_POPUP_URL . '/javascript/sg_popup_backend.js', array('jquery'));
20
  wp_enqueue_script('javascript');
 
 
 
 
 
21
  wp_enqueue_script('jquery');
22
  }
23
  if('popup-builder_page_edit-popup' == $hook) {
24
  wp_register_script('sg_popup_rangeslider', SG_APP_POPUP_URL . '/javascript/sg_popup_rangeslider.js', array('jquery'));
25
  wp_enqueue_script('sg_popup_rangeslider');
26
  wp_enqueue_script('jquery');
 
 
 
 
 
 
 
 
 
 
27
 
28
  wp_enqueue_script('jquery-ui-datepicker');
29
 
@@ -34,6 +49,7 @@ function sg_popup_admin_scripts($hook) {
34
 
35
  function SgFrontendScripts() {
36
  wp_enqueue_script('sg_popup_core', plugins_url('/sg_popup_core.js', __FILE__), '1.0.0', true);
 
37
  }
38
 
39
  add_action('admin_enqueue_scripts', 'sg_set_admin_url');
18
  else if('toplevel_page_PopupBuilder' == $hook){
19
  wp_register_script('javascript', SG_APP_POPUP_URL . '/javascript/sg_popup_backend.js', array('jquery'));
20
  wp_enqueue_script('javascript');
21
+ if(SG_POPUP_PRO) {
22
+ wp_register_script('sg_popup_pro', SG_APP_POPUP_URL . '/javascript/sg_popup_backend_pro.js');
23
+ wp_enqueue_script('sg_popup_pro');
24
+ wp_enqueue_media();
25
+ }
26
  wp_enqueue_script('jquery');
27
  }
28
  if('popup-builder_page_edit-popup' == $hook) {
29
  wp_register_script('sg_popup_rangeslider', SG_APP_POPUP_URL . '/javascript/sg_popup_rangeslider.js', array('jquery'));
30
  wp_enqueue_script('sg_popup_rangeslider');
31
  wp_enqueue_script('jquery');
32
+ if (SG_POPUP_PRO) {
33
+ wp_register_script('jssocials.min', SG_APP_POPUP_URL . '/javascript/jssocials.min.js');
34
+ wp_enqueue_script('jssocials.min');
35
+ wp_register_script('sg_social_backend', SG_APP_POPUP_URL . '/javascript/sg_social_backend.js',array('jquery'));
36
+ wp_enqueue_script('sg_social_backend');
37
+ wp_register_script('sg_popup_tagsinput', SG_APP_POPUP_URL . '/javascript/bootstrap-tagsinput.js', array('jquery'));
38
+ wp_enqueue_script('sg_popup_tagsinput');
39
+
40
+ }
41
+
42
 
43
  wp_enqueue_script('jquery-ui-datepicker');
44
 
49
 
50
  function SgFrontendScripts() {
51
  wp_enqueue_script('sg_popup_core', plugins_url('/sg_popup_core.js', __FILE__), '1.0.0', true);
52
+ echo "<script type='text/javascript'>SG_POPUP_DATA = [];SG_APP_POPUP_URL = '".SG_APP_POPUP_URL."';SG_POPUO_VERSION='".SG_POPUP_VERSION."_".SG_POPUP_PRO."'</script>";
53
  }
54
 
55
  add_action('admin_enqueue_scripts', 'sg_set_admin_url');
popup-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Popup Builder
4
  * Plugin URI: http://sygnoos.com
5
  * Description: The most complete popup plugin. Html, image, iframe, shortcode, video and many other popup types. Manage popup dimensions, effects, themes and more.
6
- * Version: 2.1.7
7
  * Author: Sygnoos
8
  * Author URI: http://www.sygnoos.com
9
  * License: GPLv2
@@ -18,20 +18,29 @@ define('SG_APP_POPUP_FILES', SG_APP_POPUP_PATH . '/files');
18
  define('SG_APP_POPUP_CLASSES', SG_APP_POPUP_PATH . '/classes');
19
  define('SG_APP_POPUP_JS', SG_APP_POPUP_PATH . '/javascript');
20
  define('SG_APP_POPUP_TABLE_LIMIT', 15);
21
- define('SG_POPUP_VERSION', 2.17);
22
  define('SG_POPUP_PRO', 0);
 
23
  define('SG_POPUP_PRO_URL', 'http://sygnoos.com/wordpress-popup/');
24
 
25
  $POPUP_TITLES = array(
26
  'image' => 'Image',
27
  'html' => 'HTML',
28
  'fblike' => 'Facebook',
29
- 'shortcode' => 'Shortcode'
 
 
 
 
 
 
 
 
30
  );
31
 
32
  require_once(SG_APP_POPUP_CLASSES .'/SGPopup.php');
33
  require_once(SG_APP_POPUP_FILES .'/sg_functions.php');
34
  require_once(SG_APP_POPUP_CLASSES .'/PopupInstaller.php'); //cretae tables
 
35
  if (SG_POPUP_PRO) {
36
  require_once( SG_APP_POPUP_CLASSES .'/PopupProInstaller.php'); //uninstall tables
37
  }
@@ -41,8 +50,6 @@ require_once(SG_APP_POPUP_FILES .'/sg_popup_page_selection.php' ); // include h
41
 
42
  register_activation_hook(__FILE__, 'sgPopupActivate');
43
  register_uninstall_hook(__FILE__, 'sgPopupDeactivate');
44
- //register_deactivation_hook(__FILE__, 'sgPopupDeactivate');
45
-
46
 
47
  add_action('wpmu_new_blog', 'sgNewBlogPopup', 10, 6);
48
 
@@ -118,12 +125,11 @@ function sgRegisterScripts()
118
  wp_register_script('sg_popup_support_plugins', SG_APP_POPUP_URL . '/javascript/sg_popup_support_plugins.js', array('jquery'));
119
  wp_enqueue_script('sg_popup_support_plugins');
120
  if (SG_POPUP_PRO) {
121
- wp_register_script('sg_cookie', SG_APP_POPUP_URL . '/javascript/jquery_cookie.js', array('jquery'));
122
- wp_enqueue_script('sg_cookie');
123
  wp_register_script('sgPopupPro', SG_APP_POPUP_URL . '/javascript/sg_popup_pro.js?ver=4.2.3');
124
  wp_enqueue_script('sgPopupPro');
 
 
125
  }
126
- echo "<script type='text/javascript'>SG_POPUP_DATA = [];SG_APP_POPUP_URL = '".SG_APP_POPUP_URL."';</script>";
127
  }
128
 
129
  function sgRenderPopupScript($id)
@@ -167,7 +173,7 @@ function sgShowShortCode($args, $content)
167
  echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=".$args['id'].">".$content."</a>";
168
  }
169
  else {
170
- echo sgRenderPopupOpen($args['id']);
171
  }
172
  $shortcodeContent = ob_get_contents();
173
  ob_end_clean();
@@ -198,6 +204,30 @@ function sgRenderPopupOpen($popupId)
198
  </script>";
199
  }
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  function sgOnloadPopup()
202
  {
203
  $page = get_queried_object_id();
@@ -205,41 +235,25 @@ function sgOnloadPopup()
205
  //If popup is set on page load
206
  $popupId = SGPopup::getPagePopupId($page, $popup);
207
  //If popup is set for all pages
208
- $sgOnloadPopupId = get_option('SG_POPUP_ONLOAD_ID');
209
-
210
- if($popupId) {
211
- //If popup is exit intent
212
- $exitIntentType = get_option('SG_POPUP_EXITINTENT_'.$popupId);
213
-
214
- if(isset($exitIntentType) && $exitIntentType == $popupId) {
215
- sgRenderPopupScript($popupId);
216
- require_once(SG_APP_POPUP_CLASSES.'/SGExitintentPopup.php');
217
- $exitObj = new SGExitintentPopup();
218
- echo $exitObj->getExitIntentInitScript($popupId);
219
- return;
220
- }
221
- sgRenderPopupOpen($popupId);
222
  }
223
-
224
- if($sgOnloadPopupId) {
225
- //If popup is exit intent
226
- $exitIntentType = get_option('SG_POPUP_EXITINTENT_'.$sgOnloadPopupId);
227
-
228
- if(isset($exitIntentType) && $exitIntentType == $sgOnloadPopupId) {
229
- sgRenderPopupScript($sgOnloadPopupId);
230
- require_once(SG_APP_POPUP_CLASSES.'/SGExitintentPopup.php');
231
- $exitObj = new SGExitintentPopup();
232
- echo $exitObj->getExitIntentInitScript($sgOnloadPopupId);
233
- return;
234
  }
235
- sgRenderPopupOpen($sgOnloadPopupId);
236
  }
 
237
  }
238
 
239
  add_action('wp_head','sgOnloadPopup');
240
  require_once( SG_APP_POPUP_FILES . '/sg_popup_media_button.php');
241
  require_once( SG_APP_POPUP_FILES . '/sg_popup_save.php'); // saving form data
242
  require_once( SG_APP_POPUP_FILES . '/sg_popup_ajax.php');
 
 
243
 
244
  function sgPopupPluginLoaded()
245
  {
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.1.9
7
  * Author: Sygnoos
8
  * Author URI: http://www.sygnoos.com
9
  * License: GPLv2
18
  define('SG_APP_POPUP_CLASSES', SG_APP_POPUP_PATH . '/classes');
19
  define('SG_APP_POPUP_JS', SG_APP_POPUP_PATH . '/javascript');
20
  define('SG_APP_POPUP_TABLE_LIMIT', 15);
 
21
  define('SG_POPUP_PRO', 0);
22
+ define('SG_POPUP_VERSION', 2.19);
23
  define('SG_POPUP_PRO_URL', 'http://sygnoos.com/wordpress-popup/');
24
 
25
  $POPUP_TITLES = array(
26
  'image' => 'Image',
27
  'html' => 'HTML',
28
  'fblike' => 'Facebook',
29
+ 'iframe' => 'Iframe',
30
+ 'video' => 'Video',
31
+ 'shortcode' => 'Shortcode',
32
+ 'ageRestriction' => 'Age Restriction',
33
+ 'countdown' => 'Countdown',
34
+ 'social' => 'Social',
35
+ 'exitIntent' => 'Exit Intent',
36
+ 'subscription' => 'Subscription',
37
+ 'contactForm' => 'Contact Form'
38
  );
39
 
40
  require_once(SG_APP_POPUP_CLASSES .'/SGPopup.php');
41
  require_once(SG_APP_POPUP_FILES .'/sg_functions.php');
42
  require_once(SG_APP_POPUP_CLASSES .'/PopupInstaller.php'); //cretae tables
43
+
44
  if (SG_POPUP_PRO) {
45
  require_once( SG_APP_POPUP_CLASSES .'/PopupProInstaller.php'); //uninstall tables
46
  }
50
 
51
  register_activation_hook(__FILE__, 'sgPopupActivate');
52
  register_uninstall_hook(__FILE__, 'sgPopupDeactivate');
 
 
53
 
54
  add_action('wpmu_new_blog', 'sgNewBlogPopup', 10, 6);
55
 
125
  wp_register_script('sg_popup_support_plugins', SG_APP_POPUP_URL . '/javascript/sg_popup_support_plugins.js', array('jquery'));
126
  wp_enqueue_script('sg_popup_support_plugins');
127
  if (SG_POPUP_PRO) {
 
 
128
  wp_register_script('sgPopupPro', SG_APP_POPUP_URL . '/javascript/sg_popup_pro.js?ver=4.2.3');
129
  wp_enqueue_script('sgPopupPro');
130
+ wp_register_script('sg_cookie', SG_APP_POPUP_URL . '/javascript/jquery_cookie.js', array('jquery'));
131
+ wp_enqueue_script('sg_cookie');
132
  }
 
133
  }
134
 
135
  function sgRenderPopupScript($id)
173
  echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=".$args['id'].">".$content."</a>";
174
  }
175
  else {
176
+ echo redenderScriptMode($args['id']);
177
  }
178
  $shortcodeContent = ob_get_contents();
179
  ob_end_clean();
204
  </script>";
205
  }
206
 
207
+ function showPopupInPage($popupId) {
208
+
209
+ if(!SGFunctions::allowPageCountry($popupId)) { /* Sended popupId and function return true or false */
210
+ return;
211
+ }
212
+
213
+ redenderScriptMode($popupId);
214
+ }
215
+
216
+ function redenderScriptMode($popupId)
217
+ {
218
+
219
+ $exitIntentPopupId = get_option('SG_POPUP_EXITINTENT_'.$popupId);
220
+
221
+ if(isset($exitIntentPopupId) && $exitIntentPopupId == $popupId) {
222
+ sgRenderPopupScript($popupId);
223
+ require_once(SG_APP_POPUP_CLASSES.'/SGExitintentPopup.php');
224
+ $exitObj = new SGExitintentPopup();
225
+ echo $exitObj->getExitIntentInitScript($popupId);
226
+ return;
227
+ }
228
+ sgRenderPopupOpen($popupId);
229
+ }
230
+
231
  function sgOnloadPopup()
232
  {
233
  $page = get_queried_object_id();
235
  //If popup is set on page load
236
  $popupId = SGPopup::getPagePopupId($page, $popup);
237
  //If popup is set for all pages
238
+ if($popupId != 0) {
239
+ showPopupInPage($popupId);
 
 
 
 
 
 
 
 
 
 
 
 
240
  }
241
+ else if(SG_POPUP_PRO){
242
+ require_once(SG_APP_POPUP_FILES ."/sg_popup_pro.php");
243
+ $popupId = SgPopupPro::allowPopupInAllPages($page);
244
+ if($popupId) {
245
+ showPopupInPage($popupId);
 
 
 
 
 
 
246
  }
 
247
  }
248
+ return false;
249
  }
250
 
251
  add_action('wp_head','sgOnloadPopup');
252
  require_once( SG_APP_POPUP_FILES . '/sg_popup_media_button.php');
253
  require_once( SG_APP_POPUP_FILES . '/sg_popup_save.php'); // saving form data
254
  require_once( SG_APP_POPUP_FILES . '/sg_popup_ajax.php');
255
+ require_once( SG_APP_POPUP_FILES . '/sg_admin_post.php');
256
+
257
 
258
  function sgPopupPluginLoaded()
259
  {
readme.txt CHANGED
@@ -126,6 +126,14 @@ Go to the Popup Builder settings and set your desired options.
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
 
 
 
129
  = Version 2.1.7 =
130
  * Auto adjust Popup to HTML image size.
131
 
@@ -263,7 +271,7 @@ Leave us a good review :)
263
 
264
  == Other Notes ==
265
 
266
- Current Version of Popup Builder is 2.1.5
267
 
268
  = HTML Popup =
269
 
126
 
127
  == Changelog ==
128
 
129
+ = Version 2.1.9 =
130
+ * Bug fixed
131
+
132
+ = Version 2.1.8 =
133
+ * Added close button localization for fourth popup theme
134
+ * Code cleanup
135
+ * Minor improvements
136
+
137
  = Version 2.1.7 =
138
  * Auto adjust Popup to HTML image size.
139
 
271
 
272
  == Other Notes ==
273
 
274
+ Current Version of Popup Builder is 2.1.8
275
 
276
  = HTML Popup =
277
 
style/sg_popup_style.css CHANGED
@@ -3,14 +3,18 @@
3
  margin-right: 1px;
4
  }
5
 
 
 
 
 
6
  .sg-text-align {
7
  text-align: center;
8
  }
9
 
10
  .shortcode-use-info {
11
  display: inline-block;
12
- margin-bottom: 8px;
13
- font-style: italic;
14
  }
15
 
16
  #sg-general .postbox-container,
@@ -22,6 +26,20 @@
22
  width: 100%;
23
  }
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  .headersWrapper h2 {
26
  padding-top: 0px;
27
  }
@@ -50,6 +68,10 @@ h3.hndle .ui-sortable-handle .generalTitle {
50
  cursor: pointer;
51
  }
52
 
 
 
 
 
53
  .hedlinePadding {
54
  padding: 18px 0px;
55
  }
@@ -132,6 +154,39 @@ div.sg-hide {
132
  background-color: white;
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  .input-width-static {
136
  width: 44%;
137
  min-width: 165px;
@@ -216,7 +271,8 @@ div.sg-hide {
216
  margin-right: 30px;
217
  }
218
 
219
- .sg-js-delete-link {
 
220
  margin-left: 10px;
221
  }
222
 
@@ -246,13 +302,15 @@ div.sg-hide {
246
  padding: 6px;
247
  }
248
 
249
- .js-subs-text-inputs {
 
250
  margin-bottom: 9px !important;
251
  display: block;
252
  margin: 3px auto !important;
253
  }
254
 
255
- .js-subs-submit-btn {
 
256
  border-width: 0px;
257
  }
258
 
@@ -347,6 +405,10 @@ span.phpErrorStyle {
347
  background-image: url("../img/SubscriptionButton.png");
348
  }
349
 
 
 
 
 
350
  .iframe-popup-pro {
351
  background-image: url("../img/iframePopupPro.png");
352
  }
@@ -383,6 +445,15 @@ span.phpErrorStyle {
383
  background-image: url("../img/ContactFormButtonPro.png");
384
  }
385
 
 
 
 
 
 
 
 
 
 
386
  .generalMenu {
387
  width: 98%;
388
  height: 39px;
@@ -688,7 +759,7 @@ input[name="theme"] {
688
  }
689
 
690
  .bootstrap-tagsinput .tag {
691
- background-color: #5BC0DE;
692
  padding: 0 3px 2px 3px;
693
  }
694
 
@@ -700,7 +771,8 @@ input[name="theme"] {
700
  margin-left: -1px;
701
  }
702
 
703
- .js-auto-close-content {
 
704
  width: 100%;
705
  display: none;
706
  }
@@ -823,7 +895,7 @@ input[name="theme"] {
823
  display: none;
824
  }
825
 
826
- .js-scrolling-content {
827
  width: 100%;
828
  display: none;
829
  }
3
  margin-right: 1px;
4
  }
5
 
6
+ .sg-hide-element {
7
+ display: none;
8
+ }
9
+
10
  .sg-text-align {
11
  text-align: center;
12
  }
13
 
14
  .shortcode-use-info {
15
  display: inline-block;
16
+ margin-bottom: 8px;
17
+ font-style: italic;
18
  }
19
 
20
  #sg-general .postbox-container,
26
  width: 100%;
27
  }
28
 
29
+ .export-import-buttons-wrraper {
30
+ float: right;
31
+ margin-top: 10px;
32
+ }
33
+
34
+ .add-new-buttons {
35
+ display: inline-block;
36
+ }
37
+
38
+ .js-sg-import-gif {
39
+ margin-left: 5px;
40
+ vertical-align: middle;
41
+ }
42
+
43
  .headersWrapper h2 {
44
  padding-top: 0px;
45
  }
68
  cursor: pointer;
69
  }
70
 
71
+ .sg-pages-title {
72
+ vertical-align: top;
73
+ }
74
+
75
  .hedlinePadding {
76
  padding: 18px 0px;
77
  }
154
  background-color: white;
155
  }
156
 
157
+ .addCountry {
158
+ margin-right: 5px;
159
+ background: #0073aa;
160
+ border: 1px solid #0073aa;
161
+ color: #fff;
162
+ text-decoration: none;
163
+ display: inline-block;
164
+ font-size: 13px;
165
+ line-height: 27px;
166
+ height: 28px;
167
+ margin: 0;
168
+ padding: 0 10px 28px;
169
+ cursor: pointer;
170
+ -webkit-appearance: none;
171
+ border-radius: 3px;
172
+ white-space: nowrap;
173
+ vertical-align: middle;
174
+ }
175
+
176
+ .countries-radio-text {
177
+ vertical-align: middle;
178
+ display: inline-block;
179
+ }
180
+
181
+ .allow-countries {
182
+ margin-right: 10px;
183
+ }
184
+
185
+ .optionsCountry,
186
+ .addCountry {
187
+ margin-top: 10px;
188
+ }
189
+
190
  .input-width-static {
191
  width: 44%;
192
  min-width: 165px;
271
  margin-right: 30px;
272
  }
273
 
274
+ .sg-js-delete-link,
275
+ .sg-js-popup-clone {
276
  margin-left: 10px;
277
  }
278
 
302
  padding: 6px;
303
  }
304
 
305
+ .js-subs-text-inputs,
306
+ .js-contact-text-inputs {
307
  margin-bottom: 9px !important;
308
  display: block;
309
  margin: 3px auto !important;
310
  }
311
 
312
+ .js-subs-submit-btn,
313
+ .js-contact-submit-btn {
314
  border-width: 0px;
315
  }
316
 
405
  background-image: url("../img/SubscriptionButton.png");
406
  }
407
 
408
+ .sg-contact-form {
409
+ background-image: url("../img/ContactFormButton.png");
410
+ }
411
+
412
  .iframe-popup-pro {
413
  background-image: url("../img/iframePopupPro.png");
414
  }
445
  background-image: url("../img/ContactFormButtonPro.png");
446
  }
447
 
448
+ .pro-options {
449
+ clear: both;
450
+ width: 100%;
451
+ height: 398px;
452
+ background-image: url("../img/proOptions.png");
453
+ background-repeat: no-repeat;
454
+ cursor: pointer;
455
+ }
456
+
457
  .generalMenu {
458
  width: 98%;
459
  height: 39px;
759
  }
760
 
761
  .bootstrap-tagsinput .tag {
762
+ background-color: #0073AA;
763
  padding: 0 3px 2px 3px;
764
  }
765
 
771
  margin-left: -1px;
772
  }
773
 
774
+ .js-auto-close-content,
775
+ .js-countri-content {
776
  width: 100%;
777
  display: none;
778
  }
895
  display: none;
896
  }
897
 
898
+ .acordion-main-div-content {
899
  width: 100%;
900
  display: none;
901
  }
style/sg_popup_style.php CHANGED
@@ -3,7 +3,7 @@ function sg_popup_admin_style($hook) {
3
  if ('toplevel_page_PopupBuilder' != $hook && 'popup-builder_page_create-popup' != $hook && 'popup-builder_page_edit-popup' != $hook && 'popup-builder_page_sgPopupMenu' != $hook && 'popup-builder_page_subscribers' != $hook) {
4
  return;
5
  }
6
- wp_register_style('sg_popup_style', SG_APP_POPUP_URL . '/style/sg_popup_style.css', false, SG_POPUP_VERSION);
7
  wp_enqueue_style('sg_popup_style');
8
  wp_register_style('sg_popup_animate', SG_APP_POPUP_URL . '/style/animate.css');
9
  wp_enqueue_style('sg_popup_animate');
@@ -18,6 +18,8 @@ function sg_popup_admin_style($hook) {
18
  wp_enqueue_style('sg_flipclock_css');
19
  wp_register_style('sg_jqueryUi_css', SG_APP_POPUP_URL . "/style/jquery-ui.min.css");
20
  wp_enqueue_style('sg_jqueryUi_css');
 
 
21
  }
22
  }
23
  add_action('admin_enqueue_scripts', 'sg_popup_admin_style');
3
  if ('toplevel_page_PopupBuilder' != $hook && 'popup-builder_page_create-popup' != $hook && 'popup-builder_page_edit-popup' != $hook && 'popup-builder_page_sgPopupMenu' != $hook && 'popup-builder_page_subscribers' != $hook) {
4
  return;
5
  }
6
+ wp_register_style('sg_popup_style', SG_APP_POPUP_URL . '/style/sg_popup_style.css', false, '1.0.0');
7
  wp_enqueue_style('sg_popup_style');
8
  wp_register_style('sg_popup_animate', SG_APP_POPUP_URL . '/style/animate.css');
9
  wp_enqueue_style('sg_popup_animate');
18
  wp_enqueue_style('sg_flipclock_css');
19
  wp_register_style('sg_jqueryUi_css', SG_APP_POPUP_URL . "/style/jquery-ui.min.css");
20
  wp_enqueue_style('sg_jqueryUi_css');
21
+ wp_register_style('sg_bootstrap_input', SG_APP_POPUP_URL . "/style/bootstrap-tagsinput.css");
22
+ wp_enqueue_style('sg_bootstrap_input');
23
  }
24
  }
25
  add_action('admin_enqueue_scripts', 'sg_popup_admin_style');