Version Description
Current Version of Popup Builder is 3.50
Download this release
Release Info
Developer | Sygnoos |
Plugin | Popup Builder – Responsive WordPress Pop up |
Version | 3.50 |
Comparing to | |
See all releases |
Code changes from version 3.49 to 3.50
- PopupBuilderInit.php +2 -0
- com/classes/Actions.php +10 -4
- com/classes/ConditionCreator.php +2 -2
- com/classes/Filters.php +57 -1
- com/classes/Notification.php +77 -0
- com/classes/NotificationCenter.php +192 -0
- com/classes/RegisterPostType.php +5 -3
- com/classes/ScriptsLoader.php +1 -1
- com/classes/extension/SgpbPopupExtension.php +10 -0
- com/classes/popups/SGPopup.php +44 -3
- com/config/config.php +1 -1
- com/config/configPackage.php +1 -1
- com/helpers/AdminHelper.php +60 -5
- com/helpers/ConfigDataHelper.php +21 -0
- popup-builder.php +1 -1
- public/css/popupAdminStyles.css +186 -0
- public/js/Backend.js +26 -0
- public/js/NotificationCenter.js +60 -0
- public/js/Popup.js +8 -6
- public/js/PopupBuilder.js +19 -2
- public/js/PopupConfig.js +4 -2
- public/views/customEditor.php +83 -0
- readme.txt +9 -2
PopupBuilderInit.php
CHANGED
@@ -65,6 +65,8 @@ class PopupBuilderInit
|
|
65 |
require_once(SG_POPUP_CLASSES_PATH.'Actions.php');
|
66 |
require_once(SG_POPUP_LIBS_PATH.'Table.php');
|
67 |
require_once(SG_POPUP_CLASSES_PATH.'Updates.php');
|
|
|
|
|
68 |
}
|
69 |
|
70 |
public function actions()
|
65 |
require_once(SG_POPUP_CLASSES_PATH.'Actions.php');
|
66 |
require_once(SG_POPUP_LIBS_PATH.'Table.php');
|
67 |
require_once(SG_POPUP_CLASSES_PATH.'Updates.php');
|
68 |
+
require_once(SG_POPUP_CLASSES_PATH.'NotificationCenter.php');
|
69 |
+
require_once(SG_POPUP_CLASSES_PATH.'Notification.php');
|
70 |
}
|
71 |
|
72 |
public function actions()
|
com/classes/Actions.php
CHANGED
@@ -3,7 +3,6 @@ namespace sgpb;
|
|
3 |
use \WP_Query;
|
4 |
use \SgpbPopupConfig;
|
5 |
use \SgpbDataConfig;
|
6 |
-
|
7 |
class Actions
|
8 |
{
|
9 |
public $customPostTypeObj;
|
@@ -56,7 +55,6 @@ class Actions
|
|
56 |
add_action('wp_before_admin_bar_render', array($this, 'pluginActivated'), 10, 2);
|
57 |
add_action('admin_head', array($this, 'hidePageBuilderEditButtons'));
|
58 |
add_action('admin_head', array($this, 'hidePublishingActions'));
|
59 |
-
add_action('admin_notices', array($this, 'inactiveExtensionNotice'));
|
60 |
new Ajax();
|
61 |
}
|
62 |
|
@@ -262,13 +260,21 @@ class Actions
|
|
262 |
require_once(SG_POPUP_VIEWS_PATH.'mainRateUsBanner.php');
|
263 |
}
|
264 |
|
265 |
-
if (!get_option('SGPB_ASK_FOR_REVIEW_BANNER_CLOSED') && $post_type == SG_POPUP_POST_TYPE) {
|
266 |
echo AdminHelper::showReviewPopup();
|
267 |
-
}
|
268 |
}
|
269 |
|
270 |
public function pluginNotices()
|
271 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
$extensions = AdminHelper::getAllActiveExtensions();
|
273 |
$updated = get_option('sgpb_extensions_updated');
|
274 |
|
3 |
use \WP_Query;
|
4 |
use \SgpbPopupConfig;
|
5 |
use \SgpbDataConfig;
|
|
|
6 |
class Actions
|
7 |
{
|
8 |
public $customPostTypeObj;
|
55 |
add_action('wp_before_admin_bar_render', array($this, 'pluginActivated'), 10, 2);
|
56 |
add_action('admin_head', array($this, 'hidePageBuilderEditButtons'));
|
57 |
add_action('admin_head', array($this, 'hidePublishingActions'));
|
|
|
58 |
new Ajax();
|
59 |
}
|
60 |
|
260 |
require_once(SG_POPUP_VIEWS_PATH.'mainRateUsBanner.php');
|
261 |
}
|
262 |
|
263 |
+
/*if (!get_option('SGPB_ASK_FOR_REVIEW_BANNER_CLOSED') && $post_type == SG_POPUP_POST_TYPE) {
|
264 |
echo AdminHelper::showReviewPopup();
|
265 |
+
}*/
|
266 |
}
|
267 |
|
268 |
public function pluginNotices()
|
269 |
{
|
270 |
+
if (function_exists('get_current_screen')) {
|
271 |
+
$screen = get_current_screen();
|
272 |
+
$screenId = $screen->id;
|
273 |
+
if ($screenId == 'edit-popupbuilder') {
|
274 |
+
$notificationsObj = new SGPBNotificationCenter();
|
275 |
+
echo $notificationsObj->displayNotifications();
|
276 |
+
}
|
277 |
+
}
|
278 |
$extensions = AdminHelper::getAllActiveExtensions();
|
279 |
$updated = get_option('sgpb_extensions_updated');
|
280 |
|
com/classes/ConditionCreator.php
CHANGED
@@ -113,10 +113,10 @@ class ConditionCreator
|
|
113 |
?>
|
114 |
</div>
|
115 |
<?php endif; ?>
|
116 |
-
|
117 |
<?php $hiddenContent = self::getHiddenDataContent($conditionDataObj); ?>
|
118 |
<div class="sg-hide-condition-row"><div id="<?php echo $idHiddenDiv;?>"><?php echo $hiddenContent; ?></div></div>
|
119 |
-
|
120 |
<?php endforeach;?>
|
121 |
<?php echo self::createConditionOperators($conditionDataObj, $idHiddenDiv); ?>
|
122 |
</div>
|
113 |
?>
|
114 |
</div>
|
115 |
<?php endif; ?>
|
116 |
+
<?php if (($conditionName == 'hiddenOption')): ?>
|
117 |
<?php $hiddenContent = self::getHiddenDataContent($conditionDataObj); ?>
|
118 |
<div class="sg-hide-condition-row"><div id="<?php echo $idHiddenDiv;?>"><?php echo $hiddenContent; ?></div></div>
|
119 |
+
<?php endif; ?>
|
120 |
<?php endforeach;?>
|
121 |
<?php echo self::createConditionOperators($conditionDataObj, $idHiddenDiv); ?>
|
122 |
</div>
|
com/classes/Filters.php
CHANGED
@@ -45,6 +45,55 @@ class Filters
|
|
45 |
add_filter('sgpbOptionAvailable', array($this, 'filterOption'), 10, 1);
|
46 |
add_filter('export_wp_filename', array($this, 'exportFileName'), 10, 1);
|
47 |
add_filter('sgpbAdvancedOptionsDefaultValues', array($this, 'defaultAdvancedOptionsValues'), 10, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
public function excludeSitemapsYoast($exclude = false, $postType)
|
@@ -181,6 +230,13 @@ class Filters
|
|
181 |
'priority' => 'high'
|
182 |
);
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
return $metaboxes;
|
185 |
}
|
186 |
|
@@ -189,7 +245,7 @@ class Filters
|
|
189 |
foreach ($events as $eventKey => $eventData) {
|
190 |
if (isset($eventData['param'])) {
|
191 |
if ($eventData['param'] == SGPB_CSS_CLASS_ACTIONS_KEY) {
|
192 |
-
unset($events);
|
193 |
$events[] = array('param' => 'click');
|
194 |
$events[] = array('param' => 'hover');
|
195 |
$events[] = array('param' => 'confirm');
|
45 |
add_filter('sgpbOptionAvailable', array($this, 'filterOption'), 10, 1);
|
46 |
add_filter('export_wp_filename', array($this, 'exportFileName'), 10, 1);
|
47 |
add_filter('sgpbAdvancedOptionsDefaultValues', array($this, 'defaultAdvancedOptionsValues'), 10, 1);
|
48 |
+
add_filter('sgpbPopupContentLoadToPage', array($this, 'popupContentLoadToPage'), 10, 2);
|
49 |
+
add_filter('sgpbExtraNotifications', array($this, 'sgpbExtraNotifications'), 10, 1);
|
50 |
+
}
|
51 |
+
|
52 |
+
public function popupContentLoadToPage($content, $popupId)
|
53 |
+
{
|
54 |
+
$customScripts = AdminHelper::renderCustomScripts($popupId);
|
55 |
+
$content .= $customScripts;
|
56 |
+
|
57 |
+
return $content;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function sgpbExtraNotifications($notifications)
|
61 |
+
{
|
62 |
+
$inactiveExtensionNotice = array();
|
63 |
+
$dontShowLicenseBanner = get_option('sgpb-hide-license-notice-banner');
|
64 |
+
if ($dontShowLicenseBanner) {
|
65 |
+
return $notifications;
|
66 |
+
}
|
67 |
+
|
68 |
+
$inactive = AdminHelper::getOption('SGPB_INACTIVE_EXTENSIONS');
|
69 |
+
$hasInactiveExtensions = AdminHelper::hasInactiveExtensions();
|
70 |
+
|
71 |
+
if (!$inactive) {
|
72 |
+
AdminHelper::updateOption('SGPB_INACTIVE_EXTENSIONS', 1);
|
73 |
+
if ($hasInactiveExtensions) {
|
74 |
+
AdminHelper::updateOption('SGPB_INACTIVE_EXTENSIONS', 'inactive');
|
75 |
+
$inactive = 'inactive';
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
if ($hasInactiveExtensions && $inactive == 'inactive') {
|
81 |
+
$licenseSectionUrl = menu_page_url(SGPB_POPUP_LICENSE, false);
|
82 |
+
$partOfContent = '<br><br>'.__('<a href="'.$licenseSectionUrl.'">Follow the link</a> to finalize the activation.', SG_POPUP_TEXT_DOMAIN);
|
83 |
+
$message = '<b>'.__('Thank you for choosing our plugin!', SG_POPUP_TEXT_DOMAIN).'</b>';
|
84 |
+
$message .= '<br>';
|
85 |
+
$message .= '<br>';
|
86 |
+
$message .= '<b>'.__('You have activated Popup Builder extension(s). Please, don\'t forget to activate the license key(s) as well.', SG_POPUP_TEXT_DOMAIN).'</b>';
|
87 |
+
$message .= '<b>'.$partOfContent.'</b>';
|
88 |
+
|
89 |
+
$inactiveExtensionNotice['priority'] = 1;
|
90 |
+
$inactiveExtensionNotice['type'] = 1;
|
91 |
+
$inactiveExtensionNotice['message'] = $message;
|
92 |
+
|
93 |
+
$notifications[] = $inactiveExtensionNotice;
|
94 |
+
}
|
95 |
+
|
96 |
+
return $notifications;
|
97 |
}
|
98 |
|
99 |
public function excludeSitemapsYoast($exclude = false, $postType)
|
230 |
'priority' => 'high'
|
231 |
);
|
232 |
|
233 |
+
$metaboxes['customCssJs'] = array(
|
234 |
+
'key' => 'customCssJs',
|
235 |
+
'displayName' => 'Custom JS or CSS',
|
236 |
+
'filePath' => SG_POPUP_VIEWS_PATH.'customEditor.php',
|
237 |
+
'priority' => 'low'
|
238 |
+
);
|
239 |
+
|
240 |
return $metaboxes;
|
241 |
}
|
242 |
|
245 |
foreach ($events as $eventKey => $eventData) {
|
246 |
if (isset($eventData['param'])) {
|
247 |
if ($eventData['param'] == SGPB_CSS_CLASS_ACTIONS_KEY) {
|
248 |
+
unset($events[$eventKey]);
|
249 |
$events[] = array('param' => 'click');
|
250 |
$events[] = array('param' => 'hover');
|
251 |
$events[] = array('param' => 'confirm');
|
com/classes/Notification.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace sgpb;
|
3 |
+
|
4 |
+
class Notification
|
5 |
+
{
|
6 |
+
public $id;
|
7 |
+
public $type;// notification, warning etc.
|
8 |
+
public $priority;
|
9 |
+
public $message;
|
10 |
+
|
11 |
+
public function setId($id)
|
12 |
+
{
|
13 |
+
$this->id = $id;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getId()
|
17 |
+
{
|
18 |
+
return $this->id;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function setType($type)
|
22 |
+
{
|
23 |
+
$this->type = $type;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getType()
|
27 |
+
{
|
28 |
+
return $this->type;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function setPriority($priority)
|
32 |
+
{
|
33 |
+
$this->priority = $priority;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getPriority()
|
37 |
+
{
|
38 |
+
return $this->priority;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function setMessage($message)
|
42 |
+
{
|
43 |
+
$this->message = $message;
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getMessage()
|
47 |
+
{
|
48 |
+
return $this->message;
|
49 |
+
}
|
50 |
+
|
51 |
+
public function render()
|
52 |
+
{
|
53 |
+
$id = $this->getId();
|
54 |
+
$type = $this->getType();
|
55 |
+
$priority = $this->getPriority();
|
56 |
+
$message = $this->getMessage();
|
57 |
+
$btnHtml = $this->getCloseBtnById($id);
|
58 |
+
$content = '<div class="sgpb-single-notification-wrapper">
|
59 |
+
<div class="sgpb-single-notification">'.$message.'</div>
|
60 |
+
<div class="sgpb-single-notification-close-btn">
|
61 |
+
'.$btnHtml.'
|
62 |
+
</div>
|
63 |
+
</div>';
|
64 |
+
|
65 |
+
return $content;
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getCloseBtnById($id)
|
69 |
+
{
|
70 |
+
$dismissedNotification = SGPBNotificationCenter::getAllDismissedNotifications();
|
71 |
+
if (isset($dismissedNotification[$id])) {
|
72 |
+
return '<button data-id="'.$id.'" class="button dismiss sgpb-activate-notification-js"><span class="dashicons dashicons-hidden"></span></button>';
|
73 |
+
}
|
74 |
+
|
75 |
+
return '<button data-id="'.$id.'" class="button dismiss sgpb-dismiss-notification-js"><span class="dashicons dashicons-no-alt"></span></button>';
|
76 |
+
}
|
77 |
+
}
|
com/classes/NotificationCenter.php
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace sgpb;
|
3 |
+
|
4 |
+
class SGPBNotificationCenter
|
5 |
+
{
|
6 |
+
private $notificationsCount = 0;
|
7 |
+
private $requestUrl = SG_POPUP_BUILDER_URL.'notifications.json';
|
8 |
+
private $cronTimeout = 'daily';
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->addActions();
|
13 |
+
$this->activateCron();
|
14 |
+
}
|
15 |
+
|
16 |
+
public function addActions()
|
17 |
+
{
|
18 |
+
add_filter('cron_schedules', array($this, 'cronAddMinutes'), 10, 1);
|
19 |
+
add_action('sgpbGetNotifications', array($this, 'updateNotificationsArray'));
|
20 |
+
add_action('wp_ajax_sgpb_dismiss_notification', array($this, 'dismissNotification'));
|
21 |
+
add_action('admin_head', array($this, 'menuItemCounter'));
|
22 |
+
}
|
23 |
+
|
24 |
+
public function menuItemCounter()
|
25 |
+
{
|
26 |
+
$count = count(self::getAllActiveNotifications());
|
27 |
+
if (!empty($count)) {
|
28 |
+
echo "<script>
|
29 |
+
jQuery(document).ready(function() {
|
30 |
+
jQuery('.sgpb-menu-item-notification').remove();
|
31 |
+
jQuery('.dashicons-menu-icon-sgpb').next().append('<span class=\"sgpb-menu-item-notification\">".$count."</span>');
|
32 |
+
});
|
33 |
+
</script>";
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
public function setCronTimeout($cronTimeout)
|
38 |
+
{
|
39 |
+
$this->cronTimeout = $cronTimeout;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getCronTimeout()
|
43 |
+
{
|
44 |
+
return $this->cronTimeout;
|
45 |
+
}
|
46 |
+
|
47 |
+
public function setRequestUrl($requestUrl)
|
48 |
+
{
|
49 |
+
$this->requestUrl = $requestUrl;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getRequestUrl()
|
53 |
+
{
|
54 |
+
return $this->requestUrl;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function updateNotificationsArray()
|
58 |
+
{
|
59 |
+
$requestUrl = $this->getRequestUrl();
|
60 |
+
$content = AdminHelper::getFileFromURL($requestUrl);
|
61 |
+
$content = json_decode($content, true);
|
62 |
+
$content = apply_filters('sgpbExtraNotifications', $content);
|
63 |
+
$content = json_encode($content);
|
64 |
+
update_option('sgpb-all-notifications-data', $content);
|
65 |
+
update_option('sgpb-notifications-request-sent', 1);
|
66 |
+
}
|
67 |
+
|
68 |
+
public function sortNotifications($allNotifications)
|
69 |
+
{
|
70 |
+
$allNotifications = json_decode($allNotifications, true);
|
71 |
+
if (empty($allNotifications)) {
|
72 |
+
$allNotifications = array();
|
73 |
+
}
|
74 |
+
$dismissed = self::getAllDismissedNotifications();
|
75 |
+
// for the first time dismissed and active arrays should be empty
|
76 |
+
if (empty($dismissed) && empty($active)) {
|
77 |
+
$notifications = array();
|
78 |
+
foreach ($allNotifications as $notification) {
|
79 |
+
$id = $notification['id'];
|
80 |
+
$notifications[$id] = $id;
|
81 |
+
}
|
82 |
+
update_option('sgpb-all-active-notifications', json_encode($notifications));
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
public function cronAddMinutes($schedules)
|
87 |
+
{
|
88 |
+
$schedules['sgpb_notifications'] = array(
|
89 |
+
'interval' => SGPB_NOTIFICATIONS_CRON_REPEAT_INTERVAL * 60,
|
90 |
+
'display' => __('Once a day', SG_POPUP_TEXT_DOMAIN)
|
91 |
+
);
|
92 |
+
|
93 |
+
return $schedules;
|
94 |
+
}
|
95 |
+
|
96 |
+
public static function getAllActiveNotifications()
|
97 |
+
{
|
98 |
+
$activeNotifications = array();
|
99 |
+
$notifications = get_option('sgpb-all-notifications-data');
|
100 |
+
$notifications = json_decode($notifications, true);
|
101 |
+
if (empty($notifications)) {
|
102 |
+
return array();
|
103 |
+
}
|
104 |
+
asort($notifications);
|
105 |
+
$dismissedNotifications = get_option('sgpb-all-dismissed-notifications');
|
106 |
+
$dismissedNotifications = json_decode($dismissedNotifications, true);
|
107 |
+
foreach ($notifications as $notification) {
|
108 |
+
$id = $notification['id'];
|
109 |
+
if (isset($dismissedNotifications[$id])) {
|
110 |
+
continue;
|
111 |
+
}
|
112 |
+
$activeNotifications[] = $notification;
|
113 |
+
}
|
114 |
+
|
115 |
+
return $activeNotifications;
|
116 |
+
}
|
117 |
+
|
118 |
+
public static function getAllDismissedNotifications()
|
119 |
+
{
|
120 |
+
$notifications = get_option('sgpb-all-dismissed-notifications');
|
121 |
+
if (empty($notifications)) {
|
122 |
+
$notifications = '';
|
123 |
+
}
|
124 |
+
|
125 |
+
return json_decode($notifications, true);
|
126 |
+
}
|
127 |
+
|
128 |
+
public static function displayNotifications($withoutWrapper = false)
|
129 |
+
{
|
130 |
+
$content = '';
|
131 |
+
$allNotifications = self::getAllActiveNotifications();
|
132 |
+
if (empty($allNotifications)) {
|
133 |
+
return $content;
|
134 |
+
}
|
135 |
+
|
136 |
+
$count = count($allNotifications);
|
137 |
+
|
138 |
+
foreach ($allNotifications as $notification) {
|
139 |
+
$newNotification = new Notification();
|
140 |
+
$newNotification->setId($notification['id']);
|
141 |
+
$newNotification->setType($notification['type']);
|
142 |
+
$newNotification->setPriority($notification['priority']);
|
143 |
+
$newNotification->setMessage($notification['message']);
|
144 |
+
$content .= $newNotification->render();
|
145 |
+
}
|
146 |
+
$count = '(<span class="sgpb-notifications-count-span">'.$count.'</span>)';
|
147 |
+
if ($withoutWrapper) {
|
148 |
+
return $content;
|
149 |
+
}
|
150 |
+
|
151 |
+
$content = self::prepareHtml($content, $count);
|
152 |
+
|
153 |
+
return $content;
|
154 |
+
}
|
155 |
+
|
156 |
+
public static function prepareHtml($content = '', $count = 0)
|
157 |
+
{
|
158 |
+
$content = '<div class="sgpb-each-notification-wrapper-js">'.$content.'</div>';
|
159 |
+
$content = '<div class="sgpb-notification-center-wrapper">
|
160 |
+
<h3><span class="dashicons dashicons-flag"></span> Notifications '.$count.'</h3>'.$content.'
|
161 |
+
</div>';
|
162 |
+
|
163 |
+
return $content;
|
164 |
+
}
|
165 |
+
|
166 |
+
public function dismissNotification()
|
167 |
+
{
|
168 |
+
check_ajax_referer(SG_AJAX_NONCE, 'nonce');
|
169 |
+
|
170 |
+
$notificationId = sanitize_text_field($_POST['id']);
|
171 |
+
$allDismissedNotifications = self::getAllDismissedNotifications();
|
172 |
+
$allDismissedNotifications[$notificationId] = $notificationId;
|
173 |
+
$allDismissedNotifications = json_encode($allDismissedNotifications);
|
174 |
+
|
175 |
+
update_option('sgpb-all-dismissed-notifications', $allDismissedNotifications);
|
176 |
+
$result = array();
|
177 |
+
$result['content'] = self::displayNotifications(true);
|
178 |
+
$result['count'] = count(self::getAllActiveNotifications());
|
179 |
+
|
180 |
+
echo json_encode($result);
|
181 |
+
wp_die();
|
182 |
+
}
|
183 |
+
|
184 |
+
public function activateCron()
|
185 |
+
{
|
186 |
+
if (!get_option('sgpb-notifications-request-sent')) {
|
187 |
+
wp_schedule_event(time(), 'daily', 'sgpbGetNotifications');
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
new SGPBNotificationCenter();
|
com/classes/RegisterPostType.php
CHANGED
@@ -83,10 +83,12 @@ class RegisterPostType
|
|
83 |
|
84 |
public function getPostTypeLabels()
|
85 |
{
|
|
|
|
|
86 |
$labels = array(
|
87 |
'name' => _x('Popups', 'post type general name', SG_POPUP_TEXT_DOMAIN),
|
88 |
'singular_name' => _x('Popup', 'post type singular name', SG_POPUP_TEXT_DOMAIN),
|
89 |
-
'menu_name' => _x('Popup Builder', 'admin menu', SG_POPUP_TEXT_DOMAIN),
|
90 |
'name_admin_bar' => _x('Popup', 'add new on admin bar', SG_POPUP_TEXT_DOMAIN),
|
91 |
'add_new' => _x('Add New', 'Popup', SG_POPUP_TEXT_DOMAIN),
|
92 |
'add_new_item' => __('Add New Popup', SG_POPUP_TEXT_DOMAIN),
|
@@ -344,8 +346,8 @@ class RegisterPostType
|
|
344 |
|
345 |
add_submenu_page(
|
346 |
'edit.php?post_type='.SG_POPUP_POST_TYPE,
|
347 |
-
__('Subscribers', SG_POPUP_TEXT_DOMAIN),
|
348 |
-
__('Subscribers', SG_POPUP_TEXT_DOMAIN),
|
349 |
'sgpb_manage_options',
|
350 |
SG_POPUP_SUBSCRIBERS_PAGE,
|
351 |
array($this, 'subscribersPage')
|
83 |
|
84 |
public function getPostTypeLabels()
|
85 |
{
|
86 |
+
$count = SGPBNotificationCenter::getAllActiveNotifications();
|
87 |
+
$count = '';
|
88 |
$labels = array(
|
89 |
'name' => _x('Popups', 'post type general name', SG_POPUP_TEXT_DOMAIN),
|
90 |
'singular_name' => _x('Popup', 'post type singular name', SG_POPUP_TEXT_DOMAIN),
|
91 |
+
'menu_name' => _x('Popup Builder', 'admin menu', SG_POPUP_TEXT_DOMAIN).$count,
|
92 |
'name_admin_bar' => _x('Popup', 'add new on admin bar', SG_POPUP_TEXT_DOMAIN),
|
93 |
'add_new' => _x('Add New', 'Popup', SG_POPUP_TEXT_DOMAIN),
|
94 |
'add_new_item' => __('Add New Popup', SG_POPUP_TEXT_DOMAIN),
|
346 |
|
347 |
add_submenu_page(
|
348 |
'edit.php?post_type='.SG_POPUP_POST_TYPE,
|
349 |
+
__('All Subscribers', SG_POPUP_TEXT_DOMAIN),
|
350 |
+
__('All Subscribers', SG_POPUP_TEXT_DOMAIN),
|
351 |
'sgpb_manage_options',
|
352 |
SG_POPUP_SUBSCRIBERS_PAGE,
|
353 |
array($this, 'subscribersPage')
|
com/classes/ScriptsLoader.php
CHANGED
@@ -84,7 +84,7 @@ class ScriptsLoader
|
|
84 |
foreach ($popups as $popup) {
|
85 |
$popupId = $popup->getId();
|
86 |
|
87 |
-
$popupContent = apply_filters('sgpbPopupContentLoadToPage', $popup->getPopupTypeContent());
|
88 |
|
89 |
$events = $popup->getPopupAllEvents($postId, $popupId, $popup);
|
90 |
// if popup's data has already loaded into the page with the same event
|
84 |
foreach ($popups as $popup) {
|
85 |
$popupId = $popup->getId();
|
86 |
|
87 |
+
$popupContent = apply_filters('sgpbPopupContentLoadToPage', $popup->getPopupTypeContent(), $popupId);
|
88 |
|
89 |
$events = $popup->getPopupAllEvents($postId, $popupId, $popup);
|
90 |
// if popup's data has already loaded into the page with the same event
|
com/classes/extension/SgpbPopupExtension.php
CHANGED
@@ -42,6 +42,14 @@ class SgpbPopupExtension implements SgpbIPopupExtension
|
|
42 |
)
|
43 |
);
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
$allowPages = array(
|
46 |
'popupType',
|
47 |
'editpage',
|
@@ -97,6 +105,7 @@ class SgpbPopupExtension implements SgpbIPopupExtension
|
|
97 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'bootstrap.min.js');
|
98 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'sgPopupRangeSlider.js');
|
99 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'Backend.js');
|
|
|
100 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'Popup.js');
|
101 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'PopupConfig.js');
|
102 |
|
@@ -276,6 +285,7 @@ class SgpbPopupExtension implements SgpbIPopupExtension
|
|
276 |
'conditionalJsClasses' => apply_filters('sgpbConditionalJsClasses', array())
|
277 |
)
|
278 |
);
|
|
|
279 |
$localizeData[] = array(
|
280 |
'handle' => 'PopupBuilder.js',
|
281 |
'name' => 'SGPB_JS_PACKAGES',
|
42 |
)
|
43 |
);
|
44 |
|
45 |
+
$defaultData = ConfigDataHelper::defaultData();
|
46 |
+
$defaultData = $defaultData['customEditorContent']['css'];
|
47 |
+
$localizeData[] = array(
|
48 |
+
'handle' => 'Backend.js',
|
49 |
+
'name' => 'SGPB_CSS_EDITOR_DEFAULT_CONTENT',
|
50 |
+
'data' => $defaultData
|
51 |
+
);
|
52 |
+
|
53 |
$allowPages = array(
|
54 |
'popupType',
|
55 |
'editpage',
|
105 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'bootstrap.min.js');
|
106 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'sgPopupRangeSlider.js');
|
107 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'Backend.js');
|
108 |
+
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'NotificationCenter.js');
|
109 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'Popup.js');
|
110 |
$jsFiles[] = array('folderUrl'=> SG_POPUP_JS_URL, 'filename' => 'PopupConfig.js');
|
111 |
|
285 |
'conditionalJsClasses' => apply_filters('sgpbConditionalJsClasses', array())
|
286 |
)
|
287 |
);
|
288 |
+
|
289 |
$localizeData[] = array(
|
290 |
'handle' => 'PopupBuilder.js',
|
291 |
'name' => 'SGPB_JS_PACKAGES',
|
com/classes/popups/SGPopup.php
CHANGED
@@ -496,10 +496,9 @@ abstract class SGPopup
|
|
496 |
}
|
497 |
if (!empty($data['sgpb-events'])) {
|
498 |
$this->setEvents($data['sgpb-events']);
|
499 |
-
|
500 |
unset($data['sgpb-events']);
|
501 |
}
|
502 |
-
|
503 |
$this->setOptions($data);
|
504 |
|
505 |
$targets = $this->targetSave();
|
@@ -543,6 +542,48 @@ abstract class SGPopup
|
|
543 |
$this->setSanitizedData($data);
|
544 |
}
|
545 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
private function targetSave()
|
547 |
{
|
548 |
global $SGPB_DATA_CONFIG_ARRAY;
|
@@ -759,7 +800,7 @@ abstract class SGPopup
|
|
759 |
}
|
760 |
}
|
761 |
|
762 |
-
$popupSavedData
|
763 |
|
764 |
return $popupSavedData;
|
765 |
}
|
496 |
}
|
497 |
if (!empty($data['sgpb-events'])) {
|
498 |
$this->setEvents($data['sgpb-events']);
|
|
|
499 |
unset($data['sgpb-events']);
|
500 |
}
|
501 |
+
$data = $this->customScriptsSave($data);
|
502 |
$this->setOptions($data);
|
503 |
|
504 |
$targets = $this->targetSave();
|
542 |
$this->setSanitizedData($data);
|
543 |
}
|
544 |
|
545 |
+
private function customScriptsSave($data)
|
546 |
+
{
|
547 |
+
$popupId = $this->getId();
|
548 |
+
$popupContent = $this->getContent();
|
549 |
+
|
550 |
+
$defaultData = ConfigDataHelper::defaultData();
|
551 |
+
$defaultDataJs = $defaultData['customEditorContent']['js'];
|
552 |
+
$defaultDataCss = $defaultData['customEditorContent']['css'];
|
553 |
+
|
554 |
+
$finalData = array('js' => array(), 'css' => array());
|
555 |
+
$alreadySavedData = get_post_meta($popupId, 'sg_popup_scripts', true);
|
556 |
+
|
557 |
+
// get styles
|
558 |
+
$finalData['css'] = htmlspecialchars($data['sgpb-css-editor']);
|
559 |
+
unset($data['sgpb-css-editor']);
|
560 |
+
if ($finalData['css'] === $defaultDataCss[0]) {
|
561 |
+
unset($finalData['css']);
|
562 |
+
}
|
563 |
+
|
564 |
+
// get scripts
|
565 |
+
foreach ($defaultDataJs as $key => $value) {
|
566 |
+
if ($data['sgpb-'.$key] == '') {
|
567 |
+
unset($data['sgpb-'.$key]);
|
568 |
+
continue;
|
569 |
+
}
|
570 |
+
if ($key == 'ShouldOpen' || $key == 'ShouldClose') {
|
571 |
+
$finalData['js']['sgpb-'.$key] = $data['sgpb-'.$key];
|
572 |
+
continue;
|
573 |
+
}
|
574 |
+
$finalData['js']['sgpb-'.$key] = $data['sgpb-'.$key];
|
575 |
+
unset($data['sgpb-'.$key]);
|
576 |
+
}
|
577 |
+
|
578 |
+
if ($alreadySavedData == $finalData) {
|
579 |
+
return $data;
|
580 |
+
}
|
581 |
+
|
582 |
+
update_post_meta($popupId, 'sg_popup_scripts', $finalData);
|
583 |
+
|
584 |
+
return $data;
|
585 |
+
}
|
586 |
+
|
587 |
private function targetSave()
|
588 |
{
|
589 |
global $SGPB_DATA_CONFIG_ARRAY;
|
800 |
}
|
801 |
}
|
802 |
|
803 |
+
$popupSavedData = array_merge($popupSavedData, self::getPopupOptionsById($popupId, $saveMode));
|
804 |
|
805 |
return $popupSavedData;
|
806 |
}
|
com/config/config.php
CHANGED
@@ -100,6 +100,7 @@ class SgpbPopupConfig
|
|
100 |
self::addDefine('SGPB_APP_POPUP_TABLE_LIMIT', 15);
|
101 |
self::addDefine('SGPB_SUBSCRIBERS_ERROR_TABLE_NAME', 'sgpb_subscription_error_log');
|
102 |
self::addDefine('SGPB_CRON_REPEAT_INTERVAL', 1);
|
|
|
103 |
self::addDefine('SGPB_BANNER_CRON_TEXT_URL', 'https://popup-builder.com/sgpb-banner.php?banner=main');
|
104 |
self::addDefine('SGPB_METABOX_BANNER_CRON_TEXT_URL', 'https://popup-builder.com/sgpb-banner.php?banner=sidebar1');
|
105 |
self::addDefine('SGPB_FACEBOOK_APP_ID', 540547196484707);
|
@@ -124,7 +125,6 @@ class SgpbPopupConfig
|
|
124 |
self::addDefine('SG_POPUP_AUTORESPONDER_POST_TYPE', 'sgpbautoresponder');
|
125 |
self::addDefine('SGPB_INACTIVE_EXTENSIONS', 'inactivePBExtensions');
|
126 |
self::addDefine('SGPB_POPUP_LICENSE_SCREEN', SG_POPUP_POST_TYPE.'_page_'.SGPB_POPUP_LICENSE);
|
127 |
-
|
128 |
self::addDefine('SGPB_SUBSCRIPTION_ERROR_MESSAGE', __('There was an error while trying to send your request. Please try again', SG_POPUP_TEXT_DOMAIN).'.');
|
129 |
self::addDefine('SGPB_SUBSCRIPTION_VALIDATION_MESSAGE', __('This field is required', SG_POPUP_TEXT_DOMAIN).'.');
|
130 |
self::addDefine('SGPB_SUBSCRIPTION_EMAIL_MESSAGE', __('Please enter a valid email address', SG_POPUP_TEXT_DOMAIN).'.');
|
100 |
self::addDefine('SGPB_APP_POPUP_TABLE_LIMIT', 15);
|
101 |
self::addDefine('SGPB_SUBSCRIBERS_ERROR_TABLE_NAME', 'sgpb_subscription_error_log');
|
102 |
self::addDefine('SGPB_CRON_REPEAT_INTERVAL', 1);
|
103 |
+
self::addDefine('SGPB_NOTIFICATIONS_CRON_REPEAT_INTERVAL', 1);
|
104 |
self::addDefine('SGPB_BANNER_CRON_TEXT_URL', 'https://popup-builder.com/sgpb-banner.php?banner=main');
|
105 |
self::addDefine('SGPB_METABOX_BANNER_CRON_TEXT_URL', 'https://popup-builder.com/sgpb-banner.php?banner=sidebar1');
|
106 |
self::addDefine('SGPB_FACEBOOK_APP_ID', 540547196484707);
|
125 |
self::addDefine('SG_POPUP_AUTORESPONDER_POST_TYPE', 'sgpbautoresponder');
|
126 |
self::addDefine('SGPB_INACTIVE_EXTENSIONS', 'inactivePBExtensions');
|
127 |
self::addDefine('SGPB_POPUP_LICENSE_SCREEN', SG_POPUP_POST_TYPE.'_page_'.SGPB_POPUP_LICENSE);
|
|
|
128 |
self::addDefine('SGPB_SUBSCRIPTION_ERROR_MESSAGE', __('There was an error while trying to send your request. Please try again', SG_POPUP_TEXT_DOMAIN).'.');
|
129 |
self::addDefine('SGPB_SUBSCRIPTION_VALIDATION_MESSAGE', __('This field is required', SG_POPUP_TEXT_DOMAIN).'.');
|
130 |
self::addDefine('SGPB_SUBSCRIPTION_EMAIL_MESSAGE', __('Please enter a valid email address', SG_POPUP_TEXT_DOMAIN).'.');
|
com/config/configPackage.php
CHANGED
@@ -3,6 +3,6 @@ if (!defined('ABSPATH')) {
|
|
3 |
exit();
|
4 |
}
|
5 |
|
6 |
-
define('SG_POPUP_VERSION', '3.
|
7 |
define('SGPB_POPUP_PKG', SGPB_POPUP_PKG_FREE);
|
8 |
define('POPUP_BUILDER_BASENAME', 'popupbuilder-platinum/popup-builder.php');
|
3 |
exit();
|
4 |
}
|
5 |
|
6 |
+
define('SG_POPUP_VERSION', '3.50');
|
7 |
define('SGPB_POPUP_PKG', SGPB_POPUP_PKG_FREE);
|
8 |
define('POPUP_BUILDER_BASENAME', 'popupbuilder-platinum/popup-builder.php');
|
com/helpers/AdminHelper.php
CHANGED
@@ -840,20 +840,24 @@ class AdminHelper
|
|
840 |
* Get image encoded data from URL
|
841 |
*
|
842 |
* @param $imageUrl
|
843 |
-
* @param $
|
844 |
*
|
845 |
* @return string
|
846 |
*/
|
847 |
|
848 |
-
public static function getImageDataFromUrl($imageUrl, $
|
849 |
{
|
850 |
$remoteData = wp_remote_get($imageUrl);
|
|
|
851 |
if (is_wp_error($remoteData) || (isset($remoteData['response']) && $remoteData['response']['code'] == 404)) {
|
852 |
-
if ($
|
853 |
$imageUrl = SG_POPUP_IMG_URL.'NoImage.png';
|
854 |
}
|
855 |
}
|
856 |
-
if (
|
|
|
|
|
|
|
857 |
$imageData = wp_remote_retrieve_body($remoteData);
|
858 |
$imageUrl = base64_encode($imageData);
|
859 |
}
|
@@ -1773,7 +1777,7 @@ class AdminHelper
|
|
1773 |
public static function removeAllNonPrintableCharacters($title, $defaultValue)
|
1774 |
{
|
1775 |
$titleRes = $title;
|
1776 |
-
$pattern ='/[\\\^£$%&*()}{@#~?><>,|=_+¬-]/';
|
1777 |
$title = preg_replace($pattern, '', $title);
|
1778 |
$title = mb_ereg_replace($pattern, '', $title);
|
1779 |
$title = htmlspecialchars($title, ENT_IGNORE, 'UTF-8');
|
@@ -1784,4 +1788,55 @@ class AdminHelper
|
|
1784 |
|
1785 |
return $titleRes;
|
1786 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1787 |
}
|
840 |
* Get image encoded data from URL
|
841 |
*
|
842 |
* @param $imageUrl
|
843 |
+
* @param $shouldNotConvertBase64
|
844 |
*
|
845 |
* @return string
|
846 |
*/
|
847 |
|
848 |
+
public static function getImageDataFromUrl($imageUrl, $shouldNotConvertBase64 = false)
|
849 |
{
|
850 |
$remoteData = wp_remote_get($imageUrl);
|
851 |
+
$originalImageUrl = $imageUrl;
|
852 |
if (is_wp_error($remoteData) || (isset($remoteData['response']) && $remoteData['response']['code'] == 404)) {
|
853 |
+
if ($shouldNotConvertBase64) {
|
854 |
$imageUrl = SG_POPUP_IMG_URL.'NoImage.png';
|
855 |
}
|
856 |
}
|
857 |
+
if (is_wp_error($remoteData) && empty($remoteData->error_data)) {
|
858 |
+
$imageUrl = $originalImageUrl;
|
859 |
+
}
|
860 |
+
if (!$shouldNotConvertBase64) {
|
861 |
$imageData = wp_remote_retrieve_body($remoteData);
|
862 |
$imageUrl = base64_encode($imageData);
|
863 |
}
|
1777 |
public static function removeAllNonPrintableCharacters($title, $defaultValue)
|
1778 |
{
|
1779 |
$titleRes = $title;
|
1780 |
+
$pattern = '/[\\\^£$%&*()}{@#~?><>,|=_+¬-]/';
|
1781 |
$title = preg_replace($pattern, '', $title);
|
1782 |
$title = mb_ereg_replace($pattern, '', $title);
|
1783 |
$title = htmlspecialchars($title, ENT_IGNORE, 'UTF-8');
|
1788 |
|
1789 |
return $titleRes;
|
1790 |
}
|
1791 |
+
|
1792 |
+
public static function renderCustomScripts($popupId)
|
1793 |
+
{
|
1794 |
+
$finalResult = '';
|
1795 |
+
$postMeta = get_post_meta($popupId, 'sg_popup_scripts', true);
|
1796 |
+
if (empty($postMeta)) {
|
1797 |
+
return '';
|
1798 |
+
}
|
1799 |
+
$defaultData = \ConfigDataHelper::defaultData();
|
1800 |
+
|
1801 |
+
// get scripts
|
1802 |
+
$jsPostMeta = @$postMeta['js'];
|
1803 |
+
$jsDefaultData = $defaultData['customEditorContent']['js'];
|
1804 |
+
$customScripts = '<script id="sgpb-custom-script-'.$popupId.'">';
|
1805 |
+
$finalContent = '';
|
1806 |
+
if (!empty($jsPostMeta)) {
|
1807 |
+
foreach ($jsDefaultData as $key => $value) {
|
1808 |
+
$eventName = 'sgpb'.$key;
|
1809 |
+
$content = @$jsPostMeta['sgpb-'.$key];
|
1810 |
+
if (empty($content) || $key == 'ShouldOpen' || $key == 'ShouldClose') {
|
1811 |
+
continue;
|
1812 |
+
}
|
1813 |
+
$content = str_replace('popupId', $popupId, $content);
|
1814 |
+
$content = html_entity_decode($content);
|
1815 |
+
|
1816 |
+
$finalContent .= 'sgAddEvent(window, "'.$eventName.'", function(e) {';
|
1817 |
+
$finalContent .= 'if (e.detail.popupId == "'.$popupId.'") {';
|
1818 |
+
$finalContent .= $content;
|
1819 |
+
$finalContent .= '};';
|
1820 |
+
$finalContent .= '});';
|
1821 |
+
}
|
1822 |
+
}
|
1823 |
+
$customScripts .= $finalContent;
|
1824 |
+
$customScripts .= '</script>';
|
1825 |
+
|
1826 |
+
// get styles
|
1827 |
+
$cssPostMeta = @$postMeta['css'];
|
1828 |
+
$customStyles = '<style id="sgpb-custom-style-'.$popupId.'">';
|
1829 |
+
$finalContent = '';
|
1830 |
+
if (!empty($cssPostMeta)) {
|
1831 |
+
$finalContent = str_replace('popupId', $popupId, $cssPostMeta);
|
1832 |
+
$finalContent = html_entity_decode($finalContent);
|
1833 |
+
}
|
1834 |
+
$customStyles .= $finalContent;
|
1835 |
+
$customStyles .= '</style>';
|
1836 |
+
|
1837 |
+
$finalResult .= $customScripts;
|
1838 |
+
$finalResult .= $customStyles;
|
1839 |
+
|
1840 |
+
return $finalResult;
|
1841 |
+
}
|
1842 |
}
|
com/helpers/ConfigDataHelper.php
CHANGED
@@ -289,6 +289,27 @@ class ConfigDataHelper
|
|
289 |
)
|
290 |
);
|
291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
$data['htmlCustomButtonArgs'] = array(
|
293 |
'template' => array(
|
294 |
'fieldWrapperAttr' => array(
|
289 |
)
|
290 |
);
|
291 |
|
292 |
+
$data['customEditorContent'] = array(
|
293 |
+
'js' => array(
|
294 |
+
'ShouldOpen' => '<b>Opening events:</b><br><br><b>#1</b> Add the code you want to run <b>before</b> the popup opening. This will be a condition for opening the popup, that is processed and defined before the popup opening. If the return value is <b>"true"</b> then the popup will open, if the value is <b>"false"</b> the popup won\'t open.',
|
295 |
+
'WillOpen' => '<b>#2</b> Add the code you want to run <b>before</b> the popup opens. This will be the code that will work in the process of opening the popup. <b>true/false</b> conditions will not work in this phase.',
|
296 |
+
'DidOpen' => '<b>#3</b> Add the code you want to run <b>after</b> the popup opens. This code will work when the popup is already open on the page.',
|
297 |
+
'ShouldClose' => '<b>Closing events:</b><br><br><b>#1</b> Add the code that will be fired <b>before</b> the popup closes. This will be a condition for the popup closing. If the return value is <b>"true"</b> then the popup will close, if the value is <b>"false"</b> the popup won\'t close.',
|
298 |
+
'WillClose' => '<b>#2</b> Add the code you want to run <b>before</b> the popup closes. This will be the code that will work in the process of closing the popup. <b>true/false</b> conditions will not work in this phase.',
|
299 |
+
'DidClose' => '<b>#3</b> Add the code you want to run <b>after</b> the popup closes. This code will work when the popup is already closed on the page.'
|
300 |
+
),
|
301 |
+
'css' => array(
|
302 |
+
'/*popup content wrapper*/'."\n".
|
303 |
+
'.sgpb-content-popupId {'."\n\n".'}'."\n\n".
|
304 |
+
|
305 |
+
'/*overlay*/'."\n".
|
306 |
+
'.sgpb-popup-overlay-popupId {'."\n\n".'}'."\n\n".
|
307 |
+
|
308 |
+
'/*popup wrapper*/'."\n".
|
309 |
+
'.sgpb-popup-builder-content-popupId {'."\n\n".'}'."\n\n"
|
310 |
+
)
|
311 |
+
);
|
312 |
+
|
313 |
$data['htmlCustomButtonArgs'] = array(
|
314 |
'template' => array(
|
315 |
'fieldWrapperAttr' => array(
|
popup-builder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Popup Builder
|
4 |
* Plugin URI: https://popup-builder.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: 3.
|
7 |
* Author: Sygnoos
|
8 |
* Author URI: https://sygnoos.com
|
9 |
* License: GPLv2
|
3 |
* Plugin Name: Popup Builder
|
4 |
* Plugin URI: https://popup-builder.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: 3.50
|
7 |
* Author: Sygnoos
|
8 |
* Author URI: https://sygnoos.com
|
9 |
* License: GPLv2
|
public/css/popupAdminStyles.css
CHANGED
@@ -2315,3 +2315,189 @@ input:checked + .sgpb-slider:before {
|
|
2315 |
right: -3px;
|
2316 |
top: 6px;
|
2317 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2315 |
right: -3px;
|
2316 |
top: 6px;
|
2317 |
}
|
2318 |
+
|
2319 |
+
.sgpb-editor ::placeholder {
|
2320 |
+
color: #CCCCCC;
|
2321 |
+
font-style: italic;
|
2322 |
+
}
|
2323 |
+
|
2324 |
+
.reset-button {
|
2325 |
+
color: #0073aa !important;
|
2326 |
+
float: right !important;
|
2327 |
+
border: 1px solid #ccc !important;
|
2328 |
+
background-color: #f7f7f7 !important;
|
2329 |
+
padding: 4px 8px !important;
|
2330 |
+
font-size: 13px !important;
|
2331 |
+
cursor: pointer !important;
|
2332 |
+
border-radius: 2px !important;
|
2333 |
+
margin-right: 35px !important;
|
2334 |
+
margin-bottom: 5px !important;
|
2335 |
+
top: -3px !important;
|
2336 |
+
font-weight: 600 !important;
|
2337 |
+
}
|
2338 |
+
|
2339 |
+
.reset-button:hover {
|
2340 |
+
color: #f7f7f7 !important;
|
2341 |
+
background-color: #0073aa !important;
|
2342 |
+
}
|
2343 |
+
|
2344 |
+
.sgpb-editor {
|
2345 |
+
border: 1px solid #ddd;
|
2346 |
+
border-top: none;
|
2347 |
+
background-color: #f7f7f7;
|
2348 |
+
}
|
2349 |
+
|
2350 |
+
.editor-static-text {
|
2351 |
+
padding-top: 10px;
|
2352 |
+
border: none;
|
2353 |
+
}
|
2354 |
+
|
2355 |
+
.editor-static-text div {
|
2356 |
+
color: black;
|
2357 |
+
margin-left: 30px;
|
2358 |
+
margin-right: 30px;
|
2359 |
+
padding: 3px 8px;
|
2360 |
+
}
|
2361 |
+
|
2362 |
+
.editor-content {
|
2363 |
+
font-style: normal !important;
|
2364 |
+
padding: 10px;
|
2365 |
+
color: black !important;
|
2366 |
+
height: 100px;
|
2367 |
+
width: 100%;
|
2368 |
+
margin-top: 0px;
|
2369 |
+
margin-bottom: 20px !important;
|
2370 |
+
}
|
2371 |
+
|
2372 |
+
.editor-content-css {
|
2373 |
+
height: 400px;
|
2374 |
+
}
|
2375 |
+
|
2376 |
+
.sgpb-editor-options-tabs-wrapper {
|
2377 |
+
background-color: white !important;
|
2378 |
+
overflow: hidden;
|
2379 |
+
}
|
2380 |
+
|
2381 |
+
.sgpb-editor-options-tabs-wrapper input {
|
2382 |
+
color: black !important;
|
2383 |
+
border-radius: 0px !important;
|
2384 |
+
background-color: rgba(204, 204, 204, 0.4) !important;
|
2385 |
+
border: 1px solid #ddd !important;
|
2386 |
+
}
|
2387 |
+
|
2388 |
+
/* Change background color of buttons on hover */
|
2389 |
+
.sgpb-editor-options-tabs-wrapper input:hover {
|
2390 |
+
background-color: #cccccc !important;
|
2391 |
+
color: #636363 !important;
|
2392 |
+
}
|
2393 |
+
|
2394 |
+
/* Create an active/current tablink class */
|
2395 |
+
.sgpb-editor-options-tabs-wrapper .sgpb-active-tab {
|
2396 |
+
background-color: #f7f7f7 !important;
|
2397 |
+
box-shadow: none !important;
|
2398 |
+
border-bottom: 1px solid #f7f7f7 !important;
|
2399 |
+
}
|
2400 |
+
|
2401 |
+
.sgpb-editor-tab-links {
|
2402 |
+
background-color: #ffffff;
|
2403 |
+
}
|
2404 |
+
|
2405 |
+
.sgpb-editor-tab-2
|
2406 |
+
{
|
2407 |
+
border-left: none !important;
|
2408 |
+
}
|
2409 |
+
|
2410 |
+
/* notification center styles */
|
2411 |
+
.sgpb-notification-center-wrapper {
|
2412 |
+
display: inline-block;
|
2413 |
+
max-width: 1240px;
|
2414 |
+
width: 98%;
|
2415 |
+
margin: 20px 0 1px;
|
2416 |
+
/*padding: 20px 20px 0;*/
|
2417 |
+
border: 1px solid #e5e5e5;
|
2418 |
+
background-color: #fdfdfd;
|
2419 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
|
2420 |
+
}
|
2421 |
+
|
2422 |
+
.sgpb-notification-center-wrapper h3 {
|
2423 |
+
border-bottom: 1px solid #cccccc;
|
2424 |
+
padding-bottom: 15px;
|
2425 |
+
padding-left: 20px;
|
2426 |
+
}
|
2427 |
+
|
2428 |
+
.sgpb-notification-center-wrapper .dashicons-flag {
|
2429 |
+
color: #01B9FF;
|
2430 |
+
}
|
2431 |
+
|
2432 |
+
.sgpb-single-notification-wrapper {
|
2433 |
+
width:100%;
|
2434 |
+
display: inline-block;
|
2435 |
+
padding: 0 20px;
|
2436 |
+
}
|
2437 |
+
|
2438 |
+
.sgpb-each-notification-wrapper-js .sgpb-single-notification-wrapper:not(:first-child) {
|
2439 |
+
margin: 10px 0 0;
|
2440 |
+
}
|
2441 |
+
|
2442 |
+
.sgpb-single-notification-wrapper {
|
2443 |
+
margin-left: 2px !important;
|
2444 |
+
}
|
2445 |
+
|
2446 |
+
.sgpb-each-notification-wrapper-js .sgpb-single-notification-wrapper:not(:first-child) .sgpb-single-notification-close-btn {
|
2447 |
+
/*margin-top: 25px;*/
|
2448 |
+
}
|
2449 |
+
|
2450 |
+
.sgpb-single-notification {
|
2451 |
+
display: inline-block;
|
2452 |
+
width: 88%;
|
2453 |
+
min-height: 25px;
|
2454 |
+
float:left;
|
2455 |
+
line-height: 1.4;
|
2456 |
+
padding: 11px 15px;
|
2457 |
+
font-size: 14px;
|
2458 |
+
text-align: left;
|
2459 |
+
background-color: #fff;
|
2460 |
+
border-left: 4px solid #01B9FF;
|
2461 |
+
box-shadow: 0 1px 1px 0 rgba(0,0,0,.2);
|
2462 |
+
}
|
2463 |
+
|
2464 |
+
.sgpb-single-notification-close-btn {
|
2465 |
+
width: 8%;
|
2466 |
+
float:right;
|
2467 |
+
}
|
2468 |
+
|
2469 |
+
.sgpb-single-notification-wrapper .button.dismiss {
|
2470 |
+
flex: 0 0 45px;
|
2471 |
+
width: 45px;
|
2472 |
+
height: 45px;
|
2473 |
+
margin-left: 10px;
|
2474 |
+
line-height: inherit;
|
2475 |
+
padding: 0;
|
2476 |
+
outline: none;
|
2477 |
+
cursor: pointer;
|
2478 |
+
}
|
2479 |
+
|
2480 |
+
.sgpb-each-notification-wrapper-js {
|
2481 |
+
padding-bottom: 15px;
|
2482 |
+
}
|
2483 |
+
|
2484 |
+
.sgpb-disabled {
|
2485 |
+
opacity: 0.5;
|
2486 |
+
}
|
2487 |
+
|
2488 |
+
.sgpb-menu-item-notification {
|
2489 |
+
display: inline-block;
|
2490 |
+
vertical-align: top;
|
2491 |
+
box-sizing: border-box;
|
2492 |
+
margin: 1px 0 -1px 3px;
|
2493 |
+
padding: 0 5px;
|
2494 |
+
min-width: 18px;
|
2495 |
+
height: 18px;
|
2496 |
+
border-radius: 9px;
|
2497 |
+
background-color: #ca4a1f;
|
2498 |
+
color: #fff;
|
2499 |
+
font-size: 12px;
|
2500 |
+
line-height: 1.5;
|
2501 |
+
text-align: center;
|
2502 |
+
z-index: 26;
|
2503 |
+
}
|
public/js/Backend.js
CHANGED
@@ -80,6 +80,28 @@ SGPBBackend.prototype.sgInit = function()
|
|
80 |
this.popupBuilderButton();
|
81 |
};
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
SGPBBackend.prototype.popupBuilderButton = function()
|
84 |
{
|
85 |
var that = this;
|
@@ -1456,6 +1478,7 @@ SGPBBackend.prototype.backgroundImageUpload = function()
|
|
1456 |
jQuery('.sgpb-show-background-image-container').css({'background-image': 'url("' + attachment.url + '")'});
|
1457 |
jQuery('.sgpb-show-background-image-container').html('');
|
1458 |
jQuery('#js-background-upload-image').val(attachment.url);
|
|
|
1459 |
jQuery('.js-sgpb-remove-background-image').removeClass('sg-hide');
|
1460 |
});
|
1461 |
/* Open the uploader dialog */
|
@@ -1765,6 +1788,9 @@ SGPBBackend.resetCount = function(popupId)
|
|
1765 |
|
1766 |
SGPBBackend.prototype.autosave = function()
|
1767 |
{
|
|
|
|
|
|
|
1768 |
var allPopupData = jQuery('form#post').serializeArray();
|
1769 |
var data = {
|
1770 |
nonce: SGPB_JS_PARAMS.nonce,
|
80 |
this.popupBuilderButton();
|
81 |
};
|
82 |
|
83 |
+
SGPBBackend.prototype.changeTab = function(tab)
|
84 |
+
{
|
85 |
+
jQuery('#sgpb-editor-options-tab-content-wrapper-'+tab).css('display', 'none');
|
86 |
+
var i, tabContent, tabLinks;
|
87 |
+
|
88 |
+
tabContent = jQuery('.sgpb-editor-options-tab-content-wrapper');
|
89 |
+
tabContent.each(function(){
|
90 |
+
jQuery(this).css('display', 'none');
|
91 |
+
});
|
92 |
+
tabLinks = jQuery('.sgpb-editor-tab-links');
|
93 |
+
tabLinks.each(function(){
|
94 |
+
jQuery(this).removeClass('sgpb-active-tab');
|
95 |
+
});
|
96 |
+
jQuery('#sgpb-editor-options-tab-content-wrapper-'+tab).css('display', 'block');
|
97 |
+
jQuery('.sgpb-editor-tab-'+tab).addClass('sgpb-active-tab');
|
98 |
+
this.rangeSlider();
|
99 |
+
};
|
100 |
+
|
101 |
+
SGPBBackend.prototype.resetCssEditorContent = function() {
|
102 |
+
jQuery('.editor-content-css').val(SGPB_CSS_EDITOR_DEFAULT_CONTENT[0]);
|
103 |
+
}
|
104 |
+
|
105 |
SGPBBackend.prototype.popupBuilderButton = function()
|
106 |
{
|
107 |
var that = this;
|
1478 |
jQuery('.sgpb-show-background-image-container').css({'background-image': 'url("' + attachment.url + '")'});
|
1479 |
jQuery('.sgpb-show-background-image-container').html('');
|
1480 |
jQuery('#js-background-upload-image').val(attachment.url);
|
1481 |
+
jQuery('input[name="sgpb-background-image"]').attr('value', attachment.url);
|
1482 |
jQuery('.js-sgpb-remove-background-image').removeClass('sg-hide');
|
1483 |
});
|
1484 |
/* Open the uploader dialog */
|
1788 |
|
1789 |
SGPBBackend.prototype.autosave = function()
|
1790 |
{
|
1791 |
+
if (!jQuery('#titlediv').length) {
|
1792 |
+
return false;
|
1793 |
+
}
|
1794 |
var allPopupData = jQuery('form#post').serializeArray();
|
1795 |
var data = {
|
1796 |
nonce: SGPB_JS_PARAMS.nonce,
|
public/js/NotificationCenter.js
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function SGPBNotificationCenter() {
|
2 |
+
|
3 |
+
}
|
4 |
+
|
5 |
+
SGPBNotificationCenter.prototype.init = function()
|
6 |
+
{
|
7 |
+
this.dismiss();
|
8 |
+
this.reactivate();
|
9 |
+
};
|
10 |
+
|
11 |
+
SGPBNotificationCenter.prototype.dismiss = function()
|
12 |
+
{
|
13 |
+
var that = this;
|
14 |
+
jQuery('.sgpb-dismiss-notification-js').click(function() {
|
15 |
+
var id = jQuery(this).attr('data-id');
|
16 |
+
jQuery(this).addClass('disabled');
|
17 |
+
jQuery(this).parent().prev().addClass('sgpb-disabled');
|
18 |
+
|
19 |
+
var data = {
|
20 |
+
nonce: SGPB_JS_PARAMS.nonce,
|
21 |
+
action: 'sgpb_dismiss_notification',
|
22 |
+
id: id
|
23 |
+
};
|
24 |
+
|
25 |
+
jQuery.post(ajaxurl, data, function(response) {
|
26 |
+
response = JSON.parse(response);
|
27 |
+
jQuery('.sgpb-each-notification-wrapper-js').empty();
|
28 |
+
jQuery('.sgpb-each-notification-wrapper-js').html(response['content']);
|
29 |
+
jQuery('.sgpb-notifications-count-span').html(response['count']);
|
30 |
+
jQuery('.sgpb-menu-item-notification').html(response['count']);
|
31 |
+
that.init();
|
32 |
+
});
|
33 |
+
});
|
34 |
+
};
|
35 |
+
|
36 |
+
SGPBNotificationCenter.prototype.reactivate = function()
|
37 |
+
{
|
38 |
+
var that = this;
|
39 |
+
jQuery('.sgpb-activate-notification-js').click(function() {
|
40 |
+
var id = jQuery(this).attr('data-id');
|
41 |
+
jQuery(this).addClass('disabled');
|
42 |
+
|
43 |
+
var data = {
|
44 |
+
nonce: SGPB_JS_PARAMS.nonce,
|
45 |
+
action: 'sgpb_reactivate_notification',
|
46 |
+
id: id
|
47 |
+
};
|
48 |
+
|
49 |
+
jQuery.post(ajaxurl, data, function(response) {
|
50 |
+
jQuery('.sgpb-each-notification-wrapper-js').empty();
|
51 |
+
jQuery('.sgpb-each-notification-wrapper-js').html(response);
|
52 |
+
that.init();
|
53 |
+
});
|
54 |
+
});
|
55 |
+
};
|
56 |
+
|
57 |
+
jQuery(document).ready(function() {
|
58 |
+
var notificationCenter = new SGPBNotificationCenter();
|
59 |
+
notificationCenter.init();
|
60 |
+
});
|
public/js/Popup.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
function SGPopup(config)
|
2 |
-
{var integrations=config.integrations;var popupName=config.popupName;var initialConfig=config;var prefix=config.prefix||'sgpb';var isInited=false;var mainDiv=null;var contentDiv=null;var DIV=null;var opened=false;var resizeTimeout=null;var overlayDiv=null;var defaultZIndex=config.contentBox.zIndex||9999;var defaultWidth="640px";var defaultHeight=config.autoHeight;var closeButtonImage=null;var popupId=config.id;var showOnce=config.showOnce||false;var events=config.events||[];var openDelay=config.openDelay||0;var popupTheme=config.popupTheme;var popupType=config.popupType;var fitBackgroundImg=null;var openAnimation=config.openAnimation||{type:"none",speed:0};var closeAnimation=config.closeAnimation||{type:"none",speed:0};var closeBehavior=config.closeBehavior||{allowed:true,showButton:true,buttonPosition:'topLeft',buttonInside:true,autoclose:false,overlayShouldClose:true,contentShouldClose:false,escShouldClose:true};var closeButton=config.closeButton||{data:sgpbPublicUrl+'img/close.png',width:16,height:16,widthType:'px',heightType:'px',closeButtonType:'IMG',closeButtonText:'Close'};var overlay=config.overlay||{visible:true,color:"#000",opacity:0.7};var contentBox=config.contentBox||{padding:8,showBackground:true,backgroundColor:"#fff",borderStyle:"solid",borderColor:"#ccc",borderRadius:config.contentBox.borderRadius,borderRadiusType:config.contentBox.borderRadiusType,borderWidth:1,shadowColor:"#ccc",shadowSpread:0,shadowBlur:10,scrollingEnabled:true,backgroundPosition:''};var contents=config.contents||"";var inline=config.inline||false;var href=config.href||false;var position=config.position||{left:"center",top:"center"};if((typeof position.left=="undefined"||(isNaN(parseInt(position.left))&&position.left!="center"))&&(typeof position.right=="undefined"||(isNaN(parseInt(position.right))&&position.right!="center"))){position.left="center";}
|
3 |
if((typeof position.top=="undefined"||(isNaN(parseInt(position.top))&&position.top!="center"))&&(typeof position.bottom=="undefined"||(isNaN(parseInt(position.bottom))&&position.bottom!="center"))){position.top="center";}
|
4 |
var sizingRanges=config.sizingRanges||[{screenFrom:{width:-1,height:-1},screenTo:{width:-1,height:-1},width:defaultWidth,height:defaultHeight,maxWidth:-1,maxHeight:-1,minWidth:-1,minHeight:-1}];var shouldOpen=config.shouldOpen||function(){return true;};var willOpen=config.willOpen||function(){};var didOpen=config.didOpen||function(){};var shouldClose=config.shouldClose||function(){return true;};var willClose=config.willClose||function(){};var didClose=config.didClose||function(){};SGPopup.inlinePrevTarget=SGPopup.inlinePrevTarget||{};function resetInlineContent()
|
5 |
{if(inline){var htmlElement=document.getElementById(inline);if(SGPopup.inlinePrevTarget.hasPreviousElement){if(typeof SGPopup.inlinePrevTarget.parentNode!='undefined'){SGPopup.inlinePrevTarget.parentNode.insertBefore(htmlElement,SGPopup.inlinePrevTarget.node.nextSibling);}}
|
@@ -178,15 +178,15 @@ function openPopup(forced,action)
|
|
178 |
{if(opened){return;}
|
179 |
coockieValue=SGPopup.getCookie(popupId);if(coockieValue){return;}
|
180 |
if(showOnce){SGPopup.setCookie(popupId,"true",parseInt(showOnce));}
|
181 |
-
if(
|
182 |
if(!isInited){initPopup();}
|
183 |
opened=true;var self=this;window.addEventListener("resize",onWindowRsize);if(closeBehavior.contentShouldClose){mainDiv.onclick=closePopup;}
|
184 |
setTimeout(function(){if(willOpen&&typeof willOpen=="function"){willOpen();}
|
185 |
-
drawOverlay();DIV.style.display="";positionPopup();setOpenAnimation();setCloseButton(mainDiv);if(didOpen){if(typeof didOpen=="function"){didOpen();}}},openDelay);if(closeBehavior.autoclose&&closeBehavior.autoclose>0){setTimeout(closePopup,closeBehavior.autoclose*1000);}
|
186 |
if(closeBehavior.escShouldClose){document.onkeydown=function(e){e=e||window.event;if(e.keyCode==27){closePopup();}};}}
|
187 |
function closePopup(forced)
|
188 |
-
{if(
|
189 |
-
if(closeBehavior.allowed===false&&forced
|
190 |
if(willClose&&typeof willClose=="function"){willClose();}
|
191 |
window.removeEventListener("resize",onWindowRsize);var closeFunction=function()
|
192 |
{if(!DIV){return;}
|
@@ -194,7 +194,9 @@ DIV.style.display="none";removeOverlay();if(didClose&&typeof didClose=="function
|
|
194 |
if(resetInlineContent&&typeof resetInlineContent=="function"){resetInlineContent();}};if(closeAnimation.type!="none"&&closeAnimation.speed>0){setCloseAnimation();setTimeout(closeFunction,closeAnimation.speed);}
|
195 |
else{closeFunction();}}
|
196 |
var resizeBox=function()
|
197 |
-
{var sizeConfig=getSizeConfig();setMainDivStyles(sizeConfig)};this.
|
|
|
|
|
198 |
{openPopup(forced);};this.init=function()
|
199 |
{initPopup();};this.close=function(forced)
|
200 |
{closePopup(forced);};this.resize=function()
|
1 |
function SGPopup(config)
|
2 |
+
{var integrations=config.integrations;var popupName=config.popupName;var initialConfig=config;var prefix=config.prefix||'sgpb';var isInited=false;var mainDiv=null;var contentDiv=null;var DIV=null;var opened=false;var resizeTimeout=null;var overlayDiv=null;var defaultZIndex=config.contentBox.zIndex||9999;var defaultWidth="640px";var defaultHeight=config.autoHeight;var closeButtonImage=null;var popupId=config.id;var showOnce=config.showOnce||false;var events=config.events||[];var openDelay=config.openDelay||0;var popupTheme=config.popupTheme;var popupType=config.popupType;var fitBackgroundImg=null;var parentThis=this;var openAnimation=config.openAnimation||{type:"none",speed:0};var closeAnimation=config.closeAnimation||{type:"none",speed:0};var closeBehavior=config.closeBehavior||{allowed:true,showButton:true,buttonPosition:'topLeft',buttonInside:true,autoclose:false,overlayShouldClose:true,contentShouldClose:false,escShouldClose:true};var closeButton=config.closeButton||{data:sgpbPublicUrl+'img/close.png',width:16,height:16,widthType:'px',heightType:'px',closeButtonType:'IMG',closeButtonText:'Close'};var overlay=config.overlay||{visible:true,color:"#000",opacity:0.7};var contentBox=config.contentBox||{padding:8,showBackground:true,backgroundColor:"#fff",borderStyle:"solid",borderColor:"#ccc",borderRadius:config.contentBox.borderRadius,borderRadiusType:config.contentBox.borderRadiusType,borderWidth:1,shadowColor:"#ccc",shadowSpread:0,shadowBlur:10,scrollingEnabled:true,backgroundPosition:''};var contents=config.contents||"";var inline=config.inline||false;var href=config.href||false;var position=config.position||{left:"center",top:"center"};if((typeof position.left=="undefined"||(isNaN(parseInt(position.left))&&position.left!="center"))&&(typeof position.right=="undefined"||(isNaN(parseInt(position.right))&&position.right!="center"))){position.left="center";}
|
3 |
if((typeof position.top=="undefined"||(isNaN(parseInt(position.top))&&position.top!="center"))&&(typeof position.bottom=="undefined"||(isNaN(parseInt(position.bottom))&&position.bottom!="center"))){position.top="center";}
|
4 |
var sizingRanges=config.sizingRanges||[{screenFrom:{width:-1,height:-1},screenTo:{width:-1,height:-1},width:defaultWidth,height:defaultHeight,maxWidth:-1,maxHeight:-1,minWidth:-1,minHeight:-1}];var shouldOpen=config.shouldOpen||function(){return true;};var willOpen=config.willOpen||function(){};var didOpen=config.didOpen||function(){};var shouldClose=config.shouldClose||function(){return true;};var willClose=config.willClose||function(){};var didClose=config.didClose||function(){};SGPopup.inlinePrevTarget=SGPopup.inlinePrevTarget||{};function resetInlineContent()
|
5 |
{if(inline){var htmlElement=document.getElementById(inline);if(SGPopup.inlinePrevTarget.hasPreviousElement){if(typeof SGPopup.inlinePrevTarget.parentNode!='undefined'){SGPopup.inlinePrevTarget.parentNode.insertBefore(htmlElement,SGPopup.inlinePrevTarget.node.nextSibling);}}
|
178 |
{if(opened){return;}
|
179 |
coockieValue=SGPopup.getCookie(popupId);if(coockieValue){return;}
|
180 |
if(showOnce){SGPopup.setCookie(popupId,"true",parseInt(showOnce));}
|
181 |
+
if(forced!==true){if(shouldOpen&&typeof shouldOpen=="function"){if(shouldOpen()===false){return;}}}
|
182 |
if(!isInited){initPopup();}
|
183 |
opened=true;var self=this;window.addEventListener("resize",onWindowRsize);if(closeBehavior.contentShouldClose){mainDiv.onclick=closePopup;}
|
184 |
setTimeout(function(){if(willOpen&&typeof willOpen=="function"){willOpen();}
|
185 |
+
drawOverlay();DIV.style.display="";positionPopup();setOpenAnimation();setCloseButton(mainDiv);if(didOpen){var callbackArgs=parentThis.getCallbackArgs();if(typeof didOpen=="function"){didOpen(callbackArgs);}}},openDelay);if(closeBehavior.autoclose&&closeBehavior.autoclose>0){setTimeout(closePopup,closeBehavior.autoclose*1000);}
|
186 |
if(closeBehavior.escShouldClose){document.onkeydown=function(e){e=e||window.event;if(e.keyCode==27){closePopup();}};}}
|
187 |
function closePopup(forced)
|
188 |
+
{if(forced!==true){if(shouldClose&&typeof shouldClose=="function"){if(shouldClose()===false){return;}}}
|
189 |
+
if(closeBehavior.allowed===false&&forced!==true){return;}
|
190 |
if(willClose&&typeof willClose=="function"){willClose();}
|
191 |
window.removeEventListener("resize",onWindowRsize);var closeFunction=function()
|
192 |
{if(!DIV){return;}
|
194 |
if(resetInlineContent&&typeof resetInlineContent=="function"){resetInlineContent();}};if(closeAnimation.type!="none"&&closeAnimation.speed>0){setCloseAnimation();setTimeout(closeFunction,closeAnimation.speed);}
|
195 |
else{closeFunction();}}
|
196 |
var resizeBox=function()
|
197 |
+
{var sizeConfig=getSizeConfig();setMainDivStyles(sizeConfig)};this.getCallbackArgs=function()
|
198 |
+
{var args={event:this.customEvent}
|
199 |
+
return args;};this.open=function(forced)
|
200 |
{openPopup(forced);};this.init=function()
|
201 |
{initPopup();};this.close=function(forced)
|
202 |
{closePopup(forced);};this.resize=function()
|
public/js/PopupBuilder.js
CHANGED
@@ -422,8 +422,22 @@ SGPBPopup.prototype.prepareOpen = function()
|
|
422 |
var popupType = this.popupData['sgpb-type'];
|
423 |
this.setUpPopupConfig();
|
424 |
var that = this;
|
425 |
-
|
426 |
var popupConfig = this.getPopupConfig();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
this.setPopupDimensions();
|
428 |
|
429 |
if (popupData['sgpb-disable-popup-closing'] == 'on') {
|
@@ -1421,6 +1435,7 @@ SGPBPopup.prototype.closeButtonDisplay = function(popupId, display, delay)
|
|
1421 |
|
1422 |
SGPBPopup.prototype.open = function(args)
|
1423 |
{
|
|
|
1424 |
var config = this.getPopupConfig();
|
1425 |
var popupId = this.getPopupId();
|
1426 |
var eventName = this.eventName;
|
@@ -1454,6 +1469,7 @@ SGPBPopup.prototype.open = function(args)
|
|
1454 |
/* don't allow to count popup opening */
|
1455 |
this.setCountPopupOpen(false);
|
1456 |
}
|
|
|
1457 |
popup.open();
|
1458 |
this.setPopupObj(popup);
|
1459 |
|
@@ -2493,7 +2509,6 @@ SgpbEventListener.prototype.sgpbClick = function(listenerObj, eventData)
|
|
2493 |
popupIds.push(popupId);
|
2494 |
var mapId = listenerObj.filterPopupId(popupId);
|
2495 |
popupIds.push(mapId);
|
2496 |
-
|
2497 |
for(var key in popupIds) {
|
2498 |
var popupId = popupIds[key];
|
2499 |
if (!popupIds.hasOwnProperty(key)) {
|
@@ -2542,6 +2557,7 @@ SgpbEventListener.prototype.sgpbClick = function(listenerObj, eventData)
|
|
2542 |
var mapId = listenerObj.filterPopupId(popupId);
|
2543 |
popupObj = SGPBPopup.createPopupObjById(mapId);
|
2544 |
}
|
|
|
2545 |
popupObj.prepareOpen();
|
2546 |
clickCount = 1;
|
2547 |
}, delay);
|
@@ -2602,6 +2618,7 @@ SgpbEventListener.prototype.sgpbHover = function(listenerObj, eventData)
|
|
2602 |
var mapId = listenerObj.filterPopupId(popupId);
|
2603 |
popupObj = SGPBPopup.createPopupObjById(mapId);
|
2604 |
}
|
|
|
2605 |
popupObj.prepareOpen();
|
2606 |
hoverCount = 1;
|
2607 |
}, delay);
|
422 |
var popupType = this.popupData['sgpb-type'];
|
423 |
this.setUpPopupConfig();
|
424 |
var that = this;
|
|
|
425 |
var popupConfig = this.getPopupConfig();
|
426 |
+
|
427 |
+
popupConfig.customShouldOpen = function() {
|
428 |
+
var instructions = popupData['sgpb-ShouldOpen'];
|
429 |
+
var F = new Function (instructions);
|
430 |
+
|
431 |
+
return(F());
|
432 |
+
}
|
433 |
+
|
434 |
+
popupConfig.customShouldClose = function() {
|
435 |
+
var instructions = popupData['sgpb-ShouldClose'];
|
436 |
+
var F = new Function (instructions);
|
437 |
+
|
438 |
+
return(F());
|
439 |
+
}
|
440 |
+
|
441 |
this.setPopupDimensions();
|
442 |
|
443 |
if (popupData['sgpb-disable-popup-closing'] == 'on') {
|
1435 |
|
1436 |
SGPBPopup.prototype.open = function(args)
|
1437 |
{
|
1438 |
+
var customEvent = this.customEvent;
|
1439 |
var config = this.getPopupConfig();
|
1440 |
var popupId = this.getPopupId();
|
1441 |
var eventName = this.eventName;
|
1469 |
/* don't allow to count popup opening */
|
1470 |
this.setCountPopupOpen(false);
|
1471 |
}
|
1472 |
+
popup.customEvent = customEvent;
|
1473 |
popup.open();
|
1474 |
this.setPopupObj(popup);
|
1475 |
|
2509 |
popupIds.push(popupId);
|
2510 |
var mapId = listenerObj.filterPopupId(popupId);
|
2511 |
popupIds.push(mapId);
|
|
|
2512 |
for(var key in popupIds) {
|
2513 |
var popupId = popupIds[key];
|
2514 |
if (!popupIds.hasOwnProperty(key)) {
|
2557 |
var mapId = listenerObj.filterPopupId(popupId);
|
2558 |
popupObj = SGPBPopup.createPopupObjById(mapId);
|
2559 |
}
|
2560 |
+
popupObj.customEvent = 'Click';
|
2561 |
popupObj.prepareOpen();
|
2562 |
clickCount = 1;
|
2563 |
}, delay);
|
2618 |
var mapId = listenerObj.filterPopupId(popupId);
|
2619 |
popupObj = SGPBPopup.createPopupObjById(mapId);
|
2620 |
}
|
2621 |
+
popupObj.customEvent = 'Hover';
|
2622 |
popupObj.prepareOpen();
|
2623 |
hoverCount = 1;
|
2624 |
}, delay);
|
public/js/PopupConfig.js
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
function PopupConfig()
|
2 |
-
{this.prefix='sgpb';this.popupId;this.popupData;this.openDelay=0;this.currentObj={};this.allowed=true;this.showButton=true;this.buttonPosition='topRight';this.buttonInside=true;this.autoclose=false;this.overlayShouldClose=true;this.contentShouldClose=false;this.escShouldClose=true;this.closeButtonImage=sgpbPublicUrl+'img/close.png';this.popupTheme=1;this.popupType='html';this.closeButtonWidth=21;this.closeButtonHeight=21;this.closeButtonWidthType='px';this.closeButtonHeightType='px';this.closeButtonType='IMG';this.closeButtonText='Close';this.closeButtonDelay=0;this.overlayVisible=true;this.overlayColor='black';this.overlayOpacity=80;this.overlayAddClass='sgpb-popup-overlay sg-popup-overlay';this.contentPadding=8;this.zIndex=9999;this.contentShowBackground=true;this.contentBackgroundColor='#ffffff';this.contentBackgroundImage='';this.contentBackgroundMode='none';this.contentBackgroundPosition='';this.contentBorderStyle='solid';this.contentBorderRadius=0;this.contentBorderRadiusType='%';this.contentBorderColor='#f00';this.contentBorderWidth=0;this.boxBorderWidth=0;this.contentShadowColor='#ccc';this.contentShadowBlur=0;this.scrollingEnabled=false;this.shadowSpread=0;this.contentAddClass='class2';this.contents=false;this.positionRight=false;this.positionTop=false;this.positionBottom=false;this.positionLeft=false;this.width='-1';this.height='-1';this.maxWidth='-1';this.maxHeight='-1';this.minWidth='-1';this.minHeight='-1';this.srcElement='';this.openAnimationEffect='';this.openAnimationSpeed=0;this.openAnimationStatus=false;this.closeAnimationEffect='';this.closeAnimationSpeed=0;this.closeAnimationStatus=false;}
|
3 |
String.prototype.firstToLowerCase=function()
|
4 |
{return this.charAt(0).toLowerCase()+this.slice(1);};String.prototype.firstToUpperCase=function()
|
5 |
{return this.charAt(0).toUpperCase()+this.slice(1);};PopupConfig.prototype.magicCall=function(functionName,arrgname)
|
6 |
{if(functionName.indexOf('get')!=-1){var param=functionName.replace(/^get/g,"").firstToLowerCase();return this[param];}
|
7 |
else{var param=functionName.replace(/^set/g,"").firstToLowerCase();this[param]=arrgname;}};PopupConfig.prototype.addCustomEvent=function(eventName,args)
|
8 |
{var event=document.createEvent('CustomEvent');event.initCustomEvent(eventName,true,true,args);window.dispatchEvent(event);};PopupConfig.prototype.combineConfigObj=function()
|
9 |
-
{var that=this;var eventSendArgs={'popupId':that.popupId,'popupData':that.popupData,'currentObj':that.currentObj};window.sgWindowOldWidth=window.innerWidth;window.sgWindowOldHeight=window.innerHeight;var config={popupId:that.popupId,openDelay:this.openDelay,popupTheme:this.popupTheme,popupType:this.popupType,closeBehavior:{allowed:this.allowed,showButton:this.showButton,buttonPosition:this.buttonPosition,buttonInside:this.buttonInside,autoclose:this.autoclose,overlayShouldClose:this.overlayShouldClose,contentShouldClose:this.contentShouldClose,escShouldClose:this.escShouldClose,right:this.closeButtonPositionRight,top:this.closeButtonPositionTop,bottom:this.closeButtonPositionBottom,left:this.closeButtonPositionLeft},openAnimation:{type:this.openAnimationEffect,speed:this.openAnimationSpeed,status:this.openAnimationStatus},closeAnimation:{type:this.closeAnimationEffect,speed:this.closeAnimationSpeed,status:this.closeAnimationStatus},closeButton:{data:this.buttonImage,width:this.closeButtonWidth,height:this.closeButtonHeight,widthType:this.closeButtonWidthType,heightType:this.closeButtonHeightType,type:this.closeButtonType,text:this.closeButtonText},overlay:{visible:this.overlayVisible,color:this.overlayColor,opacity:this.overlayOpacity,addClass:this.overlayAddClass},contentBox:{padding:this.contentPadding,zIndex:this.zIndex,showBackground:this.contentShowBackground,backgroundColor:this.contentBackgroundColor,backgroundImage:this.contentBackgroundImage,backgroundMode:this.contentBackgroundMode,backgroundPosition:this.contentBackgroundPosition,borderStyle:this.contentBorderStyle,borderRadius:this.contentBorderRadius,borderRadiusType:this.contentBorderRadiusType,borderColor:this.contentBorderColor,borderWidth:this.contentBorderWidth,boxBorderWidth:this.boxBorderWidth,shadowColor:this.contentShadowColor,shadowBlur:this.contentShadowBlur,scrollingEnabled:this.scrollingEnabled,shadowSpread:this.shadowSpread,addClass:this.contentAddClass},contents:this.contents,inline:this.srcElement,iframe:false,position:{right:this.positionRight,top:this.positionTop,bottom:this.positionBottom,left:this.positionLeft},sizingRanges:[{screenFrom:{width:0,height:0},screenTo:{width:300,height:3000},width:'100%',height:this.height,maxWidth:this.maxWidth,maxHeight:this.maxHeight,minWidth:this.minWidth,minHeight:this.minHeight},{screenFrom:{width:300,height:0},screenTo:{width:3000,height:3000},width:this.width,height:this.height,maxWidth:this.maxWidth,maxHeight:this.maxHeight,minWidth:this.minWidth,minHeight:this.minHeight}],shouldOpen:function(){
|
|
|
|
1 |
function PopupConfig()
|
2 |
+
{this.prefix='sgpb';this.popupId;this.popupData;this.openDelay=0;this.currentObj={};this.allowed=true;this.showButton=true;this.buttonPosition='topRight';this.buttonInside=true;this.autoclose=false;this.overlayShouldClose=true;this.contentShouldClose=false;this.escShouldClose=true;this.closeButtonImage=sgpbPublicUrl+'img/close.png';this.popupTheme=1;this.popupType='html';this.closeButtonWidth=21;this.closeButtonHeight=21;this.closeButtonWidthType='px';this.closeButtonHeightType='px';this.closeButtonType='IMG';this.closeButtonText='Close';this.closeButtonDelay=0;this.overlayVisible=true;this.overlayColor='black';this.overlayOpacity=80;this.overlayAddClass='sgpb-popup-overlay sg-popup-overlay';this.contentPadding=8;this.zIndex=9999;this.contentShowBackground=true;this.contentBackgroundColor='#ffffff';this.contentBackgroundImage='';this.contentBackgroundMode='none';this.contentBackgroundPosition='';this.contentBorderStyle='solid';this.contentBorderRadius=0;this.contentBorderRadiusType='%';this.contentBorderColor='#f00';this.contentBorderWidth=0;this.boxBorderWidth=0;this.contentShadowColor='#ccc';this.contentShadowBlur=0;this.scrollingEnabled=false;this.shadowSpread=0;this.contentAddClass='class2';this.contents=false;this.positionRight=false;this.positionTop=false;this.positionBottom=false;this.positionLeft=false;this.width='-1';this.height='-1';this.maxWidth='-1';this.maxHeight='-1';this.minWidth='-1';this.minHeight='-1';this.srcElement='';this.openAnimationEffect='';this.openAnimationSpeed=0;this.openAnimationStatus=false;this.closeAnimationEffect='';this.closeAnimationSpeed=0;this.closeAnimationStatus=false;this.customShouldOpen=false;this.customShouldClose=false;}
|
3 |
String.prototype.firstToLowerCase=function()
|
4 |
{return this.charAt(0).toLowerCase()+this.slice(1);};String.prototype.firstToUpperCase=function()
|
5 |
{return this.charAt(0).toUpperCase()+this.slice(1);};PopupConfig.prototype.magicCall=function(functionName,arrgname)
|
6 |
{if(functionName.indexOf('get')!=-1){var param=functionName.replace(/^get/g,"").firstToLowerCase();return this[param];}
|
7 |
else{var param=functionName.replace(/^set/g,"").firstToLowerCase();this[param]=arrgname;}};PopupConfig.prototype.addCustomEvent=function(eventName,args)
|
8 |
{var event=document.createEvent('CustomEvent');event.initCustomEvent(eventName,true,true,args);window.dispatchEvent(event);};PopupConfig.prototype.combineConfigObj=function()
|
9 |
+
{var that=this;var eventSendArgs={'popupId':that.popupId,'popupData':that.popupData,'currentObj':that.currentObj};window.sgWindowOldWidth=window.innerWidth;window.sgWindowOldHeight=window.innerHeight;var config={popupId:that.popupId,openDelay:this.openDelay,popupTheme:this.popupTheme,popupType:this.popupType,closeBehavior:{allowed:this.allowed,showButton:this.showButton,buttonPosition:this.buttonPosition,buttonInside:this.buttonInside,autoclose:this.autoclose,overlayShouldClose:this.overlayShouldClose,contentShouldClose:this.contentShouldClose,escShouldClose:this.escShouldClose,right:this.closeButtonPositionRight,top:this.closeButtonPositionTop,bottom:this.closeButtonPositionBottom,left:this.closeButtonPositionLeft},openAnimation:{type:this.openAnimationEffect,speed:this.openAnimationSpeed,status:this.openAnimationStatus},closeAnimation:{type:this.closeAnimationEffect,speed:this.closeAnimationSpeed,status:this.closeAnimationStatus},closeButton:{data:this.buttonImage,width:this.closeButtonWidth,height:this.closeButtonHeight,widthType:this.closeButtonWidthType,heightType:this.closeButtonHeightType,type:this.closeButtonType,text:this.closeButtonText},overlay:{visible:this.overlayVisible,color:this.overlayColor,opacity:this.overlayOpacity,addClass:this.overlayAddClass},contentBox:{padding:this.contentPadding,zIndex:this.zIndex,showBackground:this.contentShowBackground,backgroundColor:this.contentBackgroundColor,backgroundImage:this.contentBackgroundImage,backgroundMode:this.contentBackgroundMode,backgroundPosition:this.contentBackgroundPosition,borderStyle:this.contentBorderStyle,borderRadius:this.contentBorderRadius,borderRadiusType:this.contentBorderRadiusType,borderColor:this.contentBorderColor,borderWidth:this.contentBorderWidth,boxBorderWidth:this.boxBorderWidth,shadowColor:this.contentShadowColor,shadowBlur:this.contentShadowBlur,scrollingEnabled:this.scrollingEnabled,shadowSpread:this.shadowSpread,addClass:this.contentAddClass},contents:this.contents,inline:this.srcElement,iframe:false,position:{right:this.positionRight,top:this.positionTop,bottom:this.positionBottom,left:this.positionLeft},sizingRanges:[{screenFrom:{width:0,height:0},screenTo:{width:300,height:3000},width:'100%',height:this.height,maxWidth:this.maxWidth,maxHeight:this.maxHeight,minWidth:this.minWidth,minHeight:this.minHeight},{screenFrom:{width:300,height:0},screenTo:{width:3000,height:3000},width:this.width,height:this.height,maxWidth:this.maxWidth,maxHeight:this.maxHeight,minWidth:this.minWidth,minHeight:this.minHeight}],shouldOpen:function(){return true;},willOpen:function(){that.addCustomEvent('sgpbWillOpen',eventSendArgs);},didOpen:function(args){var finalArgs=Object.assign(args,eventSendArgs);that.addCustomEvent('sgpbDidOpen',finalArgs);},shouldClose:function(){return true;},willClose:function(){that.addCustomEvent('sgpbWillClose',eventSendArgs);},didClose:function(){that.addCustomEvent('sgpbDidClose',eventSendArgs);}};if(this.customShouldOpen){config.shouldOpen=this.customShouldOpen;}
|
10 |
+
if(this.customShouldClose){config.shouldClose=this.customShouldClose;}
|
11 |
+
return config;};var obj=new PopupConfig();
|
public/views/customEditor.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$popupId = @$_GET['post'];
|
3 |
+
$editorModeJs = htmlentities('text/javascript');
|
4 |
+
$editorModeCss = htmlentities('text/css');
|
5 |
+
|
6 |
+
$defaultData = ConfigDataHelper::defaultData();
|
7 |
+
$jsDefaultData = $defaultData['customEditorContent']['js'];
|
8 |
+
$cssDefaultData = $defaultData['customEditorContent']['css'];
|
9 |
+
|
10 |
+
$savedData = get_post_meta($popupId , 'sg_popup_scripts', true);
|
11 |
+
$editorStaticText = array(
|
12 |
+
'If you need the popup id number in the custom code, you may use the following variable to get the ID: <code>popupId</code>'
|
13 |
+
);
|
14 |
+
?>
|
15 |
+
|
16 |
+
<p>This section is for adding custom codes (CSS or JS) for the popup, it requires some coding knowledge.</p>
|
17 |
+
<p>You may use your custom codes for extra actions connected to the popup opening (before, after, etc.) in the fields below.</p>
|
18 |
+
|
19 |
+
<div class="sgpb-wrapper">
|
20 |
+
<!-- editor buttons -->
|
21 |
+
<div class="sgpb-editor-options-tabs-wrapper">
|
22 |
+
<input class="btn sgpb-editor-tab-links sgpb-editor-tab-1 col-md-3 sgpb-active-tab" data-attr-custom-tab="js" name="sgpb-js" value="JS" readonly onclick="SGPBBackend.prototype.changeTab(1)">
|
23 |
+
<input class="btn sgpb-editor-tab-links sgpb-editor-tab-2 col-md-3" data-attr-custom-tab="js" name="sgpb-css" value="CSS" readonly onclick="SGPBBackend.prototype.changeTab(2)">
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<div class="sgpb-editor">
|
27 |
+
<!-- JS editor content -->
|
28 |
+
<div id="sgpb-editor-options-tab-content-wrapper-1" class="sgpb-editor-options-tab-content-wrapper" style="display: block;">
|
29 |
+
<div class="editor-static-text">
|
30 |
+
<?php
|
31 |
+
foreach ($editorStaticText as $text) { ?>
|
32 |
+
<div><?php echo $text; ?></div>
|
33 |
+
<?php }
|
34 |
+
?></div>
|
35 |
+
<br>
|
36 |
+
|
37 |
+
<?php foreach ($jsDefaultData as $key => $value) {?>
|
38 |
+
<div class="editor-static-text"><div><?php echo $value; ?></div></div>
|
39 |
+
<div class="editor-static-text"><div>
|
40 |
+
<textarea class="wp-editor-area editor-content"
|
41 |
+
data-attr-event="<?php echo $key; ?>"
|
42 |
+
placeholder=" #... type your code"
|
43 |
+
mode="<?php echo $editorModeJs; ?>"
|
44 |
+
name="sgpb-<?php echo $key; ?>"><?php
|
45 |
+
if (!empty($savedData['js']['sgpb-'.$key])) {
|
46 |
+
echo $savedData['js']['sgpb-'.$key];
|
47 |
+
}
|
48 |
+
?></textarea>
|
49 |
+
</div></div>
|
50 |
+
<?php } ?>
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<!-- CSS editor content -->
|
54 |
+
<div id="sgpb-editor-options-tab-content-wrapper-2" class="sgpb-editor-options-tab-content-wrapper" style="display: none;">
|
55 |
+
<div class="editor-static-text">
|
56 |
+
<?php
|
57 |
+
foreach ($editorStaticText as $text) { ?>
|
58 |
+
<div><?php echo $text; ?></div>
|
59 |
+
<?php }
|
60 |
+
?></div>
|
61 |
+
<br>
|
62 |
+
|
63 |
+
<input class="btn reset-button col-md-1" data-attr-custom-tab="reset" value="Reset" readonly onclick="SGPBBackend.prototype.resetCssEditorContent()">
|
64 |
+
<div class="editor-static-text"><div></div></div>
|
65 |
+
<div class="editor-static-text"><div>
|
66 |
+
<textarea class="wp-editor-area editor-content editor-content-css"
|
67 |
+
placeholder=" #... type your code"
|
68 |
+
mode="<?php echo $editorModeCss; ?>"
|
69 |
+
name="sgpb-css-editor"
|
70 |
+
><?php
|
71 |
+
if (!isset($savedData['css'])) {
|
72 |
+
foreach ($cssDefaultData as $value) {
|
73 |
+
echo $value;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
else {
|
77 |
+
echo $savedData['css'];
|
78 |
+
}
|
79 |
+
?></textarea>
|
80 |
+
</div></div>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
</div>
|
readme.txt
CHANGED
@@ -9,7 +9,7 @@ Tags: popup, pop up, wordpress popup, popup maker, exit popup, popup builder, wo
|
|
9 |
Requires at least: 3.8
|
10 |
Tested up to: 5.3
|
11 |
Requires PHP: 5.3.3
|
12 |
-
Stable tag: 3.
|
13 |
License: GPLv2 or later
|
14 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
15 |
|
@@ -185,6 +185,13 @@ Go to the Popup Builder settings and set your desired options.
|
|
185 |
|
186 |
== Changelog ==
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
= Version 3.49 =
|
189 |
* Added async image preloading to make Image popup loads faster.
|
190 |
* Code improvements and minor bug fixes.
|
@@ -1056,7 +1063,7 @@ Leave us a good review :)
|
|
1056 |
|
1057 |
== Upgrade Notice ==
|
1058 |
|
1059 |
-
Current Version of Popup Builder is 3.
|
1060 |
|
1061 |
== Other Notes ==
|
1062 |
|
9 |
Requires at least: 3.8
|
10 |
Tested up to: 5.3
|
11 |
Requires PHP: 5.3.3
|
12 |
+
Stable tag: 3.50
|
13 |
License: GPLv2 or later
|
14 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
15 |
|
185 |
|
186 |
== Changelog ==
|
187 |
|
188 |
+
= Version 3.50 =
|
189 |
+
* Added new feature to add custom JS and CSS codes. You can add your custom JS logic to control popup opening also you can add custom CSS to change popup styles.
|
190 |
+
* Bug fixed related to image upload.
|
191 |
+
* Big fixed related to popup opening events. Sometimes it didn't get saved.
|
192 |
+
* Code improvements. We have changed the auto save option to not call AJAX every time.
|
193 |
+
|
194 |
+
|
195 |
= Version 3.49 =
|
196 |
* Added async image preloading to make Image popup loads faster.
|
197 |
* Code improvements and minor bug fixes.
|
1063 |
|
1064 |
== Upgrade Notice ==
|
1065 |
|
1066 |
+
Current Version of Popup Builder is 3.50
|
1067 |
|
1068 |
== Other Notes ==
|
1069 |
|