Popup Builder – Responsive WordPress Pop up - Version 3.64

Version Description

Current Version of Popup Builder is 3.64

Download this release

Release Info

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

Code changes from version 3.63 to 3.64

PopupBuilderInit.php CHANGED
@@ -68,6 +68,7 @@ class PopupBuilderInit
68
  require_once(SG_POPUP_CLASSES_PATH.'Updates.php');
69
  require_once(SG_POPUP_CLASSES_PATH.'NotificationCenter.php');
70
  require_once(SG_POPUP_CLASSES_PATH.'Notification.php');
 
71
  }
72
 
73
  public function actions()
@@ -90,12 +91,14 @@ class PopupBuilderInit
90
  {
91
  Installer::install();
92
  Installer::registerPlugin();
 
93
  }
94
 
95
  public function deactivate()
96
  {
97
  Functions::clearAllTransients();
98
  AdminHelper::removeSelectedTypeOptions('cron');
 
99
  require_once(SG_POPUP_EXTENSION_PATH.'SgpbPopupExtensionRegister.php');
100
  $pluginName = SG_POPUP_FILE_NAME;
101
  // remove AWeber extension from registered extensions
68
  require_once(SG_POPUP_CLASSES_PATH.'Updates.php');
69
  require_once(SG_POPUP_CLASSES_PATH.'NotificationCenter.php');
70
  require_once(SG_POPUP_CLASSES_PATH.'Notification.php');
71
+ require_once(SG_POPUP_CLASSES_PATH.'Feedback.php');
72
  }
73
 
74
  public function actions()
91
  {
92
  Installer::install();
93
  Installer::registerPlugin();
94
+ AdminHelper::filterUserCapabilitiesForTheUserRoles('activate');
95
  }
96
 
97
  public function deactivate()
98
  {
99
  Functions::clearAllTransients();
100
  AdminHelper::removeSelectedTypeOptions('cron');
101
+ AdminHelper::filterUserCapabilitiesForTheUserRoles('deactivate');
102
  require_once(SG_POPUP_EXTENSION_PATH.'SgpbPopupExtensionRegister.php');
103
  $pluginName = SG_POPUP_FILE_NAME;
104
  // remove AWeber extension from registered extensions
com/classes/Actions.php CHANGED
@@ -57,6 +57,7 @@ class Actions
57
  add_action('pre_get_posts', array($this, 'preGetPosts'));
58
  add_action('template_redirect', array($this, 'redirectFromPopupPage'));
59
  add_filter('views_edit-popupbuilder', array($this, 'mainActionButtons'), 10, 1);
 
60
  new Ajax();
61
  }
62
 
@@ -1165,6 +1166,10 @@ class Actions
1165
  public function getSubscribersCsvFile()
1166
  {
1167
  global $wpdb;
 
 
 
 
1168
  $query = AdminHelper::subscribersRelatedQuery();
1169
  if (isset($_GET['orderby']) && !empty($_GET['orderby'])) {
1170
  if (isset($_GET['order']) && !empty($_GET['order'])) {
@@ -1209,6 +1214,11 @@ class Actions
1209
 
1210
  public function getSystemInfoFile()
1211
  {
 
 
 
 
 
1212
  $content = AdminHelper::getSystemInfoText();
1213
 
1214
  header('Pragma: public');
@@ -1224,6 +1234,13 @@ class Actions
1224
 
1225
  public function saveSettings()
1226
  {
 
 
 
 
 
 
 
1227
  $postData = $_POST;
1228
  $deleteData = 0;
1229
 
@@ -1235,6 +1252,8 @@ class Actions
1235
  update_option('sgpb-user-roles', $userRoles);
1236
  update_option('sgpb-dont-delete-data', $deleteData);
1237
 
 
 
1238
  wp_redirect(admin_url().'edit.php?post_type='.SG_POPUP_POST_TYPE.'&page='.SG_POPUP_SETTINGS_PAGE);
1239
  }
1240
  }
57
  add_action('pre_get_posts', array($this, 'preGetPosts'));
58
  add_action('template_redirect', array($this, 'redirectFromPopupPage'));
59
  add_filter('views_edit-popupbuilder', array($this, 'mainActionButtons'), 10, 1);
60
+ new SGPBFeedback();
61
  new Ajax();
62
  }
63
 
1166
  public function getSubscribersCsvFile()
1167
  {
1168
  global $wpdb;
1169
+ $allowToAction = AdminHelper::userCanAccessTo();
1170
+ if (!$allowToAction) {
1171
+ return false;
1172
+ }
1173
  $query = AdminHelper::subscribersRelatedQuery();
1174
  if (isset($_GET['orderby']) && !empty($_GET['orderby'])) {
1175
  if (isset($_GET['order']) && !empty($_GET['order'])) {
1214
 
1215
  public function getSystemInfoFile()
1216
  {
1217
+ $allowToAction = AdminHelper::userCanAccessTo();
1218
+ if (!$allowToAction) {
1219
+ return false;
1220
+ }
1221
+
1222
  $content = AdminHelper::getSystemInfoText();
1223
 
1224
  header('Pragma: public');
1234
 
1235
  public function saveSettings()
1236
  {
1237
+ $allowToAction = AdminHelper::userCanAccessTo();
1238
+ if (!$allowToAction) {
1239
+ wp_redirect(get_home_url());
1240
+
1241
+ return false;
1242
+ }
1243
+
1244
  $postData = $_POST;
1245
  $deleteData = 0;
1246
 
1252
  update_option('sgpb-user-roles', $userRoles);
1253
  update_option('sgpb-dont-delete-data', $deleteData);
1254
 
1255
+ AdminHelper::filterUserCapabilitiesForTheUserRoles('save');
1256
+
1257
  wp_redirect(admin_url().'edit.php?post_type='.SG_POPUP_POST_TYPE.'&page='.SG_POPUP_SETTINGS_PAGE);
1258
  }
1259
  }
com/classes/Ajax.php CHANGED
@@ -63,9 +63,7 @@ class Ajax
63
  add_action('wp_ajax_sgpb_send_newsletter', array($this, 'sendNewsletter'));
64
  add_action('wp_ajax_sgpb_send_to_open_counter', array($this, 'addToCounter'));
65
  add_action('wp_ajax_sgpb_change_review_popup_show_period', array($this, 'changeReviewPopupPeriod'));
66
- add_action('wp_ajax_nopriv_sgpb_change_review_popup_show_period', array($this, 'changeReviewPopupPeriod'));
67
  add_action('wp_ajax_sgpb_dont_show_review_popup', array($this, 'dontShowReviewPopup'));
68
- add_action('wp_ajax_nopriv_sgpb_dont_show_review_popup', array($this, 'dontShowReviewPopup'));
69
  add_action('wp_ajax_nopriv_sgpb_send_to_open_counter', array($this, 'addToCounter'));
70
  add_action('wp_ajax_sgpb_close_banner', array($this, 'closeMainRateUsBanner'));
71
  add_action('wp_ajax_sgpb_close_license_notice', array($this, 'closeLicenseNoticeBanner'));
@@ -76,21 +74,24 @@ class Ajax
76
  add_action('wp_ajax_sgpb_dont_show_problem_alert', array($this, 'dontShowProblemAlert'));
77
  // autosave
78
  add_action('wp_ajax_sgpb_autosave', array($this, 'sgpbAutosave'));
79
- add_action('wp_ajax_nopriv_sgpb_autosave', array($this, 'sgpbAutosave'));
80
  }
81
 
82
  public function sgpbAutosave()
83
  {
 
 
 
 
 
 
84
  $popupId = @(int)$_POST['post_ID'];
85
  $postStatus = get_post_status($popupId);
86
  if ($postStatus == 'publish') {
87
- echo '';
88
- wp_die();
89
  }
90
 
91
  if (!isset($_POST['allPopupData'])) {
92
- echo true;
93
- wp_die();
94
  }
95
  $popupData = SGPopup::parsePopupDataFromData($_POST['allPopupData']);
96
  do_action('save_post_popupbuilder');
63
  add_action('wp_ajax_sgpb_send_newsletter', array($this, 'sendNewsletter'));
64
  add_action('wp_ajax_sgpb_send_to_open_counter', array($this, 'addToCounter'));
65
  add_action('wp_ajax_sgpb_change_review_popup_show_period', array($this, 'changeReviewPopupPeriod'));
 
66
  add_action('wp_ajax_sgpb_dont_show_review_popup', array($this, 'dontShowReviewPopup'));
 
67
  add_action('wp_ajax_nopriv_sgpb_send_to_open_counter', array($this, 'addToCounter'));
68
  add_action('wp_ajax_sgpb_close_banner', array($this, 'closeMainRateUsBanner'));
69
  add_action('wp_ajax_sgpb_close_license_notice', array($this, 'closeLicenseNoticeBanner'));
74
  add_action('wp_ajax_sgpb_dont_show_problem_alert', array($this, 'dontShowProblemAlert'));
75
  // autosave
76
  add_action('wp_ajax_sgpb_autosave', array($this, 'sgpbAutosave'));
 
77
  }
78
 
79
  public function sgpbAutosave()
80
  {
81
+ $allowToAction = AdminHelper::userCanAccessTo();
82
+ if (!$allowToAction) {
83
+ wp_die('');
84
+ }
85
+ check_ajax_referer(SG_AJAX_NONCE, 'nonce');
86
+
87
  $popupId = @(int)$_POST['post_ID'];
88
  $postStatus = get_post_status($popupId);
89
  if ($postStatus == 'publish') {
90
+ wp_die('');
 
91
  }
92
 
93
  if (!isset($_POST['allPopupData'])) {
94
+ wp_die(true);
 
95
  }
96
  $popupData = SGPopup::parsePopupDataFromData($_POST['allPopupData']);
97
  do_action('save_post_popupbuilder');
com/classes/Feedback.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace sgpb;
3
+
4
+ class SGPBFeedback
5
+ {
6
+ public function __construct()
7
+ {
8
+ add_action('current_screen', function () {
9
+ if (!$this->isPluginsScreen()) {
10
+ return;
11
+ }
12
+
13
+ add_filter('sgpbAdminJsFiles', array($this, 'adminJsFilter'), 1, 1);
14
+ add_action('admin_footer', array($this, 'renderDeactivateFeedbackDialog'));
15
+ } );
16
+ add_action('wp_ajax_sgpb_deactivate_feedback', array($this, 'sgpbDeactivateFeedback'));
17
+ }
18
+
19
+ public function adminJsFilter($jsFiles)
20
+ {
21
+ $jsFiles[] = array(
22
+ 'folderUrl' => SG_POPUP_JS_PATH,
23
+ 'filename' => 'Banner.js'
24
+ );
25
+
26
+ return $jsFiles;
27
+ }
28
+
29
+ public function sgpbDeactivateFeedback()
30
+ {
31
+ check_ajax_referer(SG_AJAX_NONCE, 'nonce');
32
+ if (!empty($_POST['formData'])) {
33
+ parse_str($_POST['formData'],$submissionData);
34
+ }
35
+ $feedbackKey = $feedbackText = 'Skipped';
36
+ if (!empty($submissionData['reasonKey'])) {
37
+ $feedbackKey = $submissionData['reasonKey'];
38
+ }
39
+
40
+ if (!empty($submissionData["reason_{$feedbackKey}"])) {
41
+ $feedbackText = $submissionData["reason_{$feedbackKey}"];
42
+ }
43
+ $headers = 'MIME-Version: 1.0'."\r\n";
44
+ $headers .= 'From: feedbackpopupbuilder@gmail.com'."\r\n";
45
+ $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; //set UTF-8
46
+
47
+ $receiver = 'feedbackpopupbuilder@gmail.com';
48
+ $customerEmailAddres = get_bloginfo('admin_email');
49
+ $title = 'Popup Builder Deactivation Feedback From Customer';
50
+ $message = 'Customer site - '.get_site_url().'<br>'."\n";
51
+ $message = 'Customer email address - '.$customerEmailAddres.'<br>'."\n";
52
+ $message .= 'Feedback key - '.$feedbackKey.'<br>'."\n";
53
+ $message .= 'Feedback text - '.$feedbackText."\n";
54
+
55
+ wp_mail($receiver, $title, $message, $headers);
56
+
57
+ wp_die(1);
58
+ }
59
+
60
+ public function renderDeactivateFeedbackDialog() {
61
+ $deactivateReasons = array(
62
+ 'no_longer_needed' => array(
63
+ 'title' => __('I no longer need the plugin', SG_POPUP_TEXT_DOMAIN),
64
+ 'input_placeholder' => ''
65
+ ),
66
+ 'found_a_better_plugin' => array(
67
+ 'title' => __('I found a better plugin', SG_POPUP_TEXT_DOMAIN),
68
+ 'input_placeholder' => __( 'Please share which plugin', SG_POPUP_TEXT_DOMAIN)
69
+ ),
70
+ 'couldnt_get_the_plugin_to_work' => array(
71
+ 'title' => __('I couldn\'t get the plugin to work', SG_POPUP_TEXT_DOMAIN),
72
+ 'input_placeholder' => '',
73
+ 'extra_help' => __('Having troubles? You can always count on us. Please try to contact us via <a href="https://popup-builder.com/">Live chat</a> or send a message to <a href="mailto:support@popup-builder.com">support@popup-builder.com</a>', SG_POPUP_TEXT_DOMAIN)
74
+ ),
75
+ 'temporary_deactivation' => array(
76
+ 'title' => __('It\'s a temporary deactivation', SG_POPUP_TEXT_DOMAIN),
77
+ 'input_placeholder' => ''
78
+ ),
79
+ 'other' => array(
80
+ 'title' => __('Other', SG_POPUP_TEXT_DOMAIN),
81
+ 'input_placeholder' => __('Please share the reason', SG_POPUP_TEXT_DOMAIN),
82
+ )
83
+ );
84
+
85
+ ?>
86
+ <div id="sgpb-feedback-popup">
87
+ <div class="sgpb-feedback-popup-wrapper">
88
+ <div class="sgpb-wrapper">
89
+ <div class="row sgpb-feedback-popup-header">
90
+ <div class="col-sm-3 sgpb-add-subscriber-header-column">
91
+ <h4>
92
+ <?php _e('Quick Feedback', SG_POPUP_TEXT_DOMAIN)?>
93
+ </h4>
94
+ </div>
95
+ <div class="col-sm-1 sgpb-add-subscriber-header-spinner-column">
96
+ <img src="<?php echo SG_POPUP_IMG_URL.'ajaxSpinner.gif'; ?>" alt="gif" class="sgpb-subscribers-add-spinner js-sg-spinner js-sgpb-add-spinner sg-hide-element js-sg-import-gif" width="20px">
97
+ </div>
98
+ <img src="<?php echo SG_POPUP_IMG_URL.'subscribers_close.png'; ?>" alt="gif" class="sgpb-add-subscriber-popup-close-btn sgpb-subscriber-data-popup-close-btn-js" width="20px">
99
+ </div>
100
+ <div class="row">
101
+ <div class="col-md-12">
102
+ <h4 class="sgpb-feedback-descritpion">
103
+ <?php _e('If you have a moment, please share why you are deactivating <b>Popup Builder</b>', SG_POPUP_TEXT_DOMAIN)?>:
104
+ </h4>
105
+ <p class="sgpb-feedback-error-message sg-hide-element"><?php _e('Please, select an option.', SG_POPUP_TEXT_DOMAIN)?></p>
106
+ </div>
107
+ </div>
108
+ <div class="row">
109
+ <div class="col-md-12">
110
+ <form id="sgpb-deactivate-feedback-dialog-form" method="post">
111
+ <?php foreach ($deactivateReasons as $reasonKey => $reason) : ?>
112
+ <div class="row sgpb-feedback-each-reason-row">
113
+ <div class="col-md-1">
114
+ <input id="sgpb-deactivate-feedback-<?php echo esc_attr($reasonKey); ?>" class="sgpb-deactivate-feedback-dialog-input" type="radio" name="reasonKey" value="<?php echo esc_attr($reasonKey); ?>" />
115
+ </div>
116
+ <div class="col-md-11">
117
+ <label for="sgpb-deactivate-feedback-<?php echo esc_attr($reasonKey); ?>" class="sgpb-deactivate-feedback-dialog-label"><?php echo esc_html($reason['title']); ?></label>
118
+ <?php if (!empty($reason['input_placeholder'])) : ?>
119
+ <input class="sgpb-feedback-text sgpb-feedback-text-input" style="display: none;" type="text" name="reason_<?php echo esc_attr( $reasonKey ); ?>" placeholder="<?php echo esc_attr($reason['input_placeholder']); ?>" />
120
+ <?php endif; ?>
121
+ <?php if (!empty($reason['extra_help'])) : ?>
122
+ <p class="sgpb-feedback-text-input" style="display: none;"><?php echo $reason['extra_help']; ?></p>
123
+ <?php endif; ?>
124
+ </div>
125
+ </div>
126
+ <?php endforeach; ?>
127
+ <div class="row sgpb-feedback-btns-wrapper">
128
+ <div class="col-md-6">
129
+ <input type="button" class="btn btn-sm btn-success sgpb-feedback-submit" name="sgpb-feedback-submit" value="<?php _e('Submit & Deactivate', SG_POPUP_TEXT_DOMAIN); ?>">
130
+ </div>
131
+ <div class="col-md-6">
132
+ <input type="button" class="btn btn-sm sgpb-feedback-submit-skip" name="sgpb-feedback-submit-skip" value="<?php _e('Skip & Deactivate', SG_POPUP_TEXT_DOMAIN); ?>">
133
+ </div>
134
+ </div>
135
+ </form>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ <?php
142
+ }
143
+
144
+ private function isPluginsScreen() {
145
+ return in_array(get_current_screen()->id, array('plugins', 'plugins-network'));
146
+ }
147
+ }
com/classes/extension/SgpbPopupExtension.php CHANGED
@@ -134,7 +134,7 @@ class SgpbPopupExtension implements SgpbIPopupExtension
134
  'handle' => 'Backend.js',
135
  'name' => 'SGPB_JS_LOCALIZATION',
136
  'data' => $translatedData
137
- );
138
 
139
  $localizeData[] = array(
140
  'handle' => 'Popup.js',
@@ -249,6 +249,7 @@ class SgpbPopupExtension implements SgpbIPopupExtension
249
 
250
  public function getFrontendScripts($page, $popupObjs)
251
  {
 
252
  $jsFiles = array();
253
  $localizeData = array();
254
  $jsFiles[] = array('folderUrl'=> '', 'filename' => 'wp-color-picker');
@@ -303,6 +304,12 @@ class SgpbPopupExtension implements SgpbIPopupExtension
303
  'data' => SG_POPUP_PUBLIC_URL
304
  );
305
 
 
 
 
 
 
 
306
  $localizeData[] = array(
307
  'handle' => 'PopupBuilder.js',
308
  'name' => 'SGPB_JS_PARAMS',
134
  'handle' => 'Backend.js',
135
  'name' => 'SGPB_JS_LOCALIZATION',
136
  'data' => $translatedData
137
+ );
138
 
139
  $localizeData[] = array(
140
  'handle' => 'Popup.js',
249
 
250
  public function getFrontendScripts($page, $popupObjs)
251
  {
252
+ $translatedData = ConfigDataHelper::getJsLocalizedData();
253
  $jsFiles = array();
254
  $localizeData = array();
255
  $jsFiles[] = array('folderUrl'=> '', 'filename' => 'wp-color-picker');
304
  'data' => SG_POPUP_PUBLIC_URL
305
  );
306
 
307
+ $localizeData[] = array(
308
+ 'handle' => 'Popup.js',
309
+ 'name' => 'SGPB_JS_LOCALIZATION',
310
+ 'data' => $translatedData
311
+ );
312
+
313
  $localizeData[] = array(
314
  'handle' => 'PopupBuilder.js',
315
  'name' => 'SGPB_JS_PARAMS',
com/classes/popups/SGPopup.php CHANGED
@@ -531,7 +531,7 @@ abstract class SGPopup
531
  }
532
 
533
  if ($buttonImageUrl != $savedImageUrl) {
534
- $buttonImageData = AdminHelper::getImageDataFromUrl($buttonImageUrl);
535
  }
536
  if ($contentBackgroundImageUrl != $savedContentBackgroundImageUrl) {
537
  $contentBackgroundImageData = AdminHelper::getImageDataFromUrl($contentBackgroundImageUrl);
531
  }
532
 
533
  if ($buttonImageUrl != $savedImageUrl) {
534
+ $buttonImageData = AdminHelper::getImageDataFromUrl($buttonImageUrl, true);
535
  }
536
  if ($contentBackgroundImageUrl != $savedContentBackgroundImageUrl) {
537
  $contentBackgroundImageData = AdminHelper::getImageDataFromUrl($contentBackgroundImageUrl);
com/config/configPackage.php CHANGED
@@ -3,6 +3,6 @@ if (!defined('ABSPATH')) {
3
  exit();
4
  }
5
 
6
- define('SG_POPUP_VERSION', '3.63');
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.64');
7
  define('SGPB_POPUP_PKG', SGPB_POPUP_PKG_FREE);
8
  define('POPUP_BUILDER_BASENAME', 'popupbuilder-platinum/popup-builder.php');
com/helpers/AdminHelper.php CHANGED
@@ -605,12 +605,18 @@ class AdminHelper
605
  return $role;
606
  }
607
 
608
- global $current_user;
609
- $userRoleName = $current_user->roles;
610
-
611
  if (!empty($userRoleName)) {
612
  $role = $userRoleName;
613
  }
 
 
 
 
 
 
 
614
 
615
  return $role;
616
  }
@@ -2055,4 +2061,69 @@ class AdminHelper
2055
 
2056
  return $browserInfoContent;
2057
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2058
  }
605
  return $role;
606
  }
607
 
608
+ global $currentUser;
609
+ $userRoleName = $currentUser->roles;
 
610
  if (!empty($userRoleName)) {
611
  $role = $userRoleName;
612
  }
613
+ else {
614
+ if (!function_exists('wp_get_current_user')) {
615
+ require_once(ABSPATH."wp-includes/pluggable.php");
616
+ }
617
+ $currentUser = wp_get_current_user();
618
+ $role = $currentUser->roles;
619
+ }
620
 
621
  return $role;
622
  }
2061
 
2062
  return $browserInfoContent;
2063
  }
2064
+
2065
+ // checking user roles capability to do actions
2066
+ public static function userCanAccessTo()
2067
+ {
2068
+ // if empty, should return administrator
2069
+ $savedUserRoles = self::getPopupPostAllowedUserRoles();
2070
+ $currentUserRole = self::getCurrentUserRole();
2071
+ if (is_array($currentUserRole) && is_array($savedUserRoles)) {
2072
+ return array_intersect($currentUserRole, $savedUserRoles);
2073
+ }
2074
+ }
2075
+
2076
+ public static function filterUserCapabilitiesForTheUserRoles($hook = 'save')
2077
+ {
2078
+ global $wp_roles;
2079
+
2080
+ $allAvailableWpRoles = $wp_roles->roles;
2081
+ $savedUserRoles = get_option('sgpb-user-roles');
2082
+ // we need to remove from all roles, either when deactivating the plugin and when there is no saved roles
2083
+ if (empty($savedUserRoles) || $hook == 'deactivate') {
2084
+ $savedUserRoles = array();
2085
+ }
2086
+ $rolesToBeRestricted = array();
2087
+ // selected user roles, which have access to the PB
2088
+ foreach ($allAvailableWpRoles as $allAvailableWpRole) {
2089
+ if (isset($allAvailableWpRole['name']) && in_array(lcfirst($allAvailableWpRole['name']), $savedUserRoles)) {
2090
+ $indexToUnset = lcfirst($allAvailableWpRole['name']);
2091
+ continue;
2092
+ }
2093
+ $rolesToBeRestricted[] = lcfirst($allAvailableWpRole['name']);
2094
+ }
2095
+
2096
+ $caps = array(
2097
+ 'read_private_sgpb_popups',
2098
+ 'edit_sgpb_popup',
2099
+ 'edit_sgpb_popups',
2100
+ 'edit_others_sgpb_popups',
2101
+ 'edit_published_sgpb_popups',
2102
+ 'publish_sgpb_popups',
2103
+ 'delete_sgpb_popups',
2104
+ 'delete_published_posts',
2105
+ 'delete_others_sgpb_popups',
2106
+ 'delete_private_sgpb_popups',
2107
+ 'delete_private_sgpb_popup',
2108
+ 'delete_published_sgpb_popups',
2109
+ 'sgpb_manage_options',
2110
+ 'manage_popup_terms',
2111
+ 'manage_popup_categories_terms'
2112
+ );
2113
+
2114
+ if ($hook == 'activate') {
2115
+ $rolesToBeRestricted = $savedUserRoles;
2116
+ }
2117
+ foreach ($rolesToBeRestricted as $roleToBeRestricted) {
2118
+ foreach ($caps as $cap) {
2119
+ // only for the activation hook we need to add our capabilities back
2120
+ if ($hook == 'activate') {
2121
+ $wp_roles->add_cap($roleToBeRestricted, $cap);
2122
+ }
2123
+ else {
2124
+ $wp_roles->remove_cap($roleToBeRestricted, $cap);
2125
+ }
2126
+ }
2127
+ }
2128
+ }
2129
  }
com/helpers/ConfigDataHelper.php CHANGED
@@ -297,7 +297,7 @@ class ConfigDataHelper
297
  );
298
 
299
  $data['customEditorContent'] = array(
300
- 'js' => array(
301
  'helperText' => array(
302
  '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.',
303
  '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.',
@@ -308,7 +308,7 @@ class ConfigDataHelper
308
  ),
309
  'description' => array(
310
  __('If you need the popup id number in the custom code, you may use the following variable to get the ID: <code>popupId</code>', SG_POPUP_TEXT_DOMAIN)
311
- )
312
  ),
313
  'css' => array(
314
  // we need this oldDefaultValue for the backward compatibility
@@ -1204,7 +1204,8 @@ class ConfigDataHelper
1204
  'addButtonSpinner' => __('Add', SG_POPUP_TEXT_DOMAIN),
1205
  'audioSupportAlertMessage' => __('Only audio files supported (e.g.: mp3, wav, m4a, ogg)', SG_POPUP_TEXT_DOMAIN),
1206
  'publishPopupBeforeElementor' => __('Please, publish the popup before starting to use Elementor with it!', SG_POPUP_TEXT_DOMAIN),
1207
- 'publishPopupBeforeDivi' => __('Please, publish the popup before starting to use Divi Builder with it!', SG_POPUP_TEXT_DOMAIN)
 
1208
  );
1209
 
1210
  return $translatedData;
297
  );
298
 
299
  $data['customEditorContent'] = array(
300
+ 'js' => array(
301
  'helperText' => array(
302
  '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.',
303
  '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.',
308
  ),
309
  'description' => array(
310
  __('If you need the popup id number in the custom code, you may use the following variable to get the ID: <code>popupId</code>', SG_POPUP_TEXT_DOMAIN)
311
+ )
312
  ),
313
  'css' => array(
314
  // we need this oldDefaultValue for the backward compatibility
1204
  'addButtonSpinner' => __('Add', SG_POPUP_TEXT_DOMAIN),
1205
  'audioSupportAlertMessage' => __('Only audio files supported (e.g.: mp3, wav, m4a, ogg)', SG_POPUP_TEXT_DOMAIN),
1206
  'publishPopupBeforeElementor' => __('Please, publish the popup before starting to use Elementor with it!', SG_POPUP_TEXT_DOMAIN),
1207
+ 'publishPopupBeforeDivi' => __('Please, publish the popup before starting to use Divi Builder with it!', SG_POPUP_TEXT_DOMAIN),
1208
+ 'closeButtonAltText' => __('Close', SG_POPUP_TEXT_DOMAIN)
1209
  );
1210
 
1211
  return $translatedData;
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.63
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.64
7
  * Author: Sygnoos
8
  * Author URI: https://sygnoos.com
9
  * License: GPLv2
public/css/popupAdminStyles.css CHANGED
@@ -109,4 +109,7 @@ h3{border-bottom:1px solid #ccc;padding-bottom:15px;padding-left:20px}.sgpb-noti
109
  .button.dismiss{flex:0 0 45px;width:45px;height:45px;margin-left:10px;line-height:inherit;padding:0;outline:none;cursor:pointer}.sgpb-each-notification-wrapper-js{padding-bottom:15px}.sgpb-disabled{opacity:0.5}.sgpb-menu-item-notification{display:inline-block;vertical-align:top;box-sizing:border-box;margin:1px
110
  0 -1px 3px;padding:0
111
  5px;min-width:18px;height:18px;border-radius:9px;background-color:#ca4a1f;color:#fff;font-size:12px;line-height:1.5;text-align:center;z-index:26}.sgpb-support-notification-wrapper{text-align:center}.sgpb-support-notification-wrapper .btn-info{margin-right:10px}.sgpb-support-notification-wrapper h4:nth-child(2){margin-bottom:25px}.sgpb-support-notification-dont-show{font-size:12px !important;text-align:right;margin-top:10px}.sgpb-support-notification-dont-show
112
- a{font-size:12px !important}.sgpb-review-description .sgrb-review-h2{margin-top:0 !important}.sgpb-hide-notification-at-all{float:right}.sgpb-hide-notification-at-all:hover{cursor:pointer;background-color:#cccccca3}
 
 
 
109
  .button.dismiss{flex:0 0 45px;width:45px;height:45px;margin-left:10px;line-height:inherit;padding:0;outline:none;cursor:pointer}.sgpb-each-notification-wrapper-js{padding-bottom:15px}.sgpb-disabled{opacity:0.5}.sgpb-menu-item-notification{display:inline-block;vertical-align:top;box-sizing:border-box;margin:1px
110
  0 -1px 3px;padding:0
111
  5px;min-width:18px;height:18px;border-radius:9px;background-color:#ca4a1f;color:#fff;font-size:12px;line-height:1.5;text-align:center;z-index:26}.sgpb-support-notification-wrapper{text-align:center}.sgpb-support-notification-wrapper .btn-info{margin-right:10px}.sgpb-support-notification-wrapper h4:nth-child(2){margin-bottom:25px}.sgpb-support-notification-dont-show{font-size:12px !important;text-align:right;margin-top:10px}.sgpb-support-notification-dont-show
112
+ a{font-size:12px !important}.sgpb-review-description .sgrb-review-h2{margin-top:0 !important}.sgpb-hide-notification-at-all{float:right}.sgpb-hide-notification-at-all:hover{cursor:pointer;background-color:#cccccca3}#sgpb-feedback-popup{display:none;position:fixed;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,0.6);z-index:9999;opacity:0;pointer-events:none}#sgpb-feedback-popup:target{opacity:1;pointer-events:auto}.sgpb-feedback-popup-wrapper{width:35%;min-width:310px;background-color:white;padding:0
113
+ 15px 15px 15px;box-sizing:border-box;border-radius:4px;overflow:auto;position:fixed;left:50%;top:30%;margin-top:-37.5px;margin-left:-201px}.sgpb-show-feedback-popup,.sgpb-show-feedback-popup:target{opacity:1 !important;pointer-events:auto !important;display:block !important}.sgpb-deactivate-feedback-dialog-input{margin:0
114
+ !important}.sgpb-feedback-popup-wrapper .sgpb-add-subscriber-popup-close-btn{margin-top:9px}.sgpb-feedback-popup-wrapper .sgpb-feedback-popup-header{border-bottom:1px solid #ccc}.sgpb-feedback-descritpion{margin:10px
115
+ 0 15px 0 !important}.sgpb-feedback-each-reason-row{margin-bottom:10px}.sgpb-deactivate-feedback-dialog-label{margin-top:2px}.sgpb-feedback-text-input{width:100%}.sgpb-feedback-submit{background-color:#2873EB !important;border-color:#2873EB !important}.sgpb-feedback-submit:hover{background-color:#2873ebcc !important;border-color:#2873ebcc !important}.sgpb-feedback-submit-skip{float:right}.sgpb-feedback-error-message{font-size:13px;color:#f00}.sgpb-feedback-btns-wrapper{margin-top:30px}
public/css/sgbp-bootstrap.css CHANGED
@@ -1491,4 +1491,4 @@ solid #18bc9c}.sgpb-wrapper .has-success .input-group-addon{border-color:#18bc9c
1491
  .sgpb-wrapper a.list-group-item-danger.active:focus{background-color:#e43725}.sgpb-wrapper .panel-default
1492
  .close{color:#2c3e50}.sgpb-wrapper .modal
1493
  .close{color:#2c3e50}.sgpb-wrapper
1494
- .popover{color:#2c3e50}
1491
  .sgpb-wrapper a.list-group-item-danger.active:focus{background-color:#e43725}.sgpb-wrapper .panel-default
1492
  .close{color:#2c3e50}.sgpb-wrapper .modal
1493
  .close{color:#2c3e50}.sgpb-wrapper
1494
+ .popover{color:#2c3e50}
public/js/Banner.js CHANGED
@@ -1,4 +1,13 @@
1
  function SGPBBanner(){}
2
- SGPBBanner.prototype.init=function(){this.close();this.closeLicenseNotice();};SGPBBanner.prototype.close=function(){if(!jQuery('.sgpb-banner-wrapper').length){return;}
3
- jQuery('.sgpb-info-close').click(function(){jQuery('.sgpb-banner-wrapper').remove();});};SGPBBanner.prototype.closeLicenseNotice=function(){if(!jQuery('.sgpb-extensions-notices').length){return;}
 
 
 
 
 
 
 
 
 
4
  jQuery('.sgpb-dont-show-again-license-notice').click(function(){var data={action:'sgpb_close_license_notice',nonce:SGPB_JS_PARAMS.nonce,};jQuery.post(ajaxurl,data,function(response){jQuery('.sgpb-extensions-notices').remove();});});};jQuery(document).ready(function(){var banner=new SGPBBanner();banner.init();});
1
  function SGPBBanner(){}
2
+ SGPBBanner.prototype.init=function(){this.callFeedbackPopup();this.closeFeedbackPopup();this.close();this.closeLicenseNotice();};SGPBBanner.prototype.closeFeedbackPopup=function()
3
+ {if(!jQuery('#sgpb-feedback-popup').length){return;}
4
+ var hideFeedbackPopup=function(){jQuery('#sgpb-feedback-popup .js-sgpb-add-spinner').addClass('sg-hide-element');jQuery('#sgpb-feedback-popup').removeClass('sgpb-show-feedback-popup');}
5
+ jQuery('#sgpb-feedback-popup .sgpb-subscriber-data-popup-close-btn-js').bind('click',function(){hideFeedbackPopup();});document.onkeydown=function(e){e=e||window.event;if(e.keyCode==27){hideFeedbackPopup();}};}
6
+ SGPBBanner.prototype.callFeedbackPopup=function()
7
+ {if(!jQuery('#sgpb-feedback-popup').length){return;}
8
+ jQuery('.sgpb-feedback-error-message').addClass('sg-hide-element');var deactivateLink=jQuery('#the-list').find('[data-slug="popup-builder"] span.deactivate a'),dialog=jQuery('#sgpb-feedback-popup'),dialogForm=jQuery('#sgpb-deactivate-feedback-dialog-form');deactivateLink.bind('click',function(e){var deactivationLink=jQuery(this).attr('href');e.preventDefault();dialog.addClass('sgpb-show-feedback-popup');jQuery('.sgpb-deactivate-feedback-dialog-input').bind('click',function(){jQuery('.sgpb-feedback-text-input').hide();jQuery(this).parent().next().find('.sgpb-feedback-text-input').show();});jQuery('.sgpb-feedback-submit-skip').click(function(){window.location.href=deactivationLink;return;});jQuery('.sgpb-feedback-submit').click(function(){if(!jQuery('.sgpb-deactivate-feedback-dialog-input').is(':checked')){jQuery('.sgpb-feedback-error-message').removeClass('sg-hide-element');return;}
9
+ var formData=dialogForm.serialize();var ajaxData={action:'sgpb_deactivate_feedback',nonce:SGPB_JS_PARAMS.nonce,beforeSend:function(){jQuery(this).attr('disabled','disabled');jQuery('.sgpb-feedback-error-message').addClass('sg-hide-element');jQuery('.js-sgpb-add-spinner').removeClass('sg-hide-element');},formData:formData};jQuery.post(SGPB_JS_PARAMS.url,ajaxData,function(res){window.location.href=deactivationLink;})});});};SGPBBanner.prototype.close=function()
10
+ {if(!jQuery('.sgpb-banner-wrapper').length){return;}
11
+ jQuery('.sgpb-info-close').click(function(){jQuery('.sgpb-banner-wrapper').remove();});};SGPBBanner.prototype.closeLicenseNotice=function()
12
+ {if(!jQuery('.sgpb-extensions-notices').length){return;}
13
  jQuery('.sgpb-dont-show-again-license-notice').click(function(){var data={action:'sgpb_close_license_notice',nonce:SGPB_JS_PARAMS.nonce,};jQuery.post(ajaxurl,data,function(response){jQuery('.sgpb-extensions-notices').remove();});});};jQuery(document).ready(function(){var banner=new SGPBBanner();banner.init();});
public/js/Popup.js CHANGED
@@ -89,7 +89,7 @@ function removeOverlay()
89
  function setCloseButton(mainDiv)
90
  {if(!closeButton.data){return;}
91
  if(closeBehavior.showButton===false){return;}
92
- closeButtonImage.style.zIndex=defaultZIndex+20;closeButtonImage.style.position="absolute";closeButtonImage.style.float="left";closeButtonImage.style.top=closeBehavior.top;closeButtonImage.style.right=closeBehavior.right;closeButtonImage.style.bottom=closeBehavior.bottom;closeButtonImage.style.left=closeBehavior.left;if(closeButton.type=='button'){closeButtonImage.id=prefix+'-close-button';closeButtonImage.innerHTML=config.closeButton.text;}
93
  closeButtonImage.style.width=closeButton.width+closeButton.widthType;closeButtonImage.style.cursor="pointer";closeButtonImage.style.height=closeButton.height+closeButton.heightType;closeButtonImage.src=closeButton.data;closeButtonImage.style.backgroundRepeat="no-repeat";closeButtonImage.style.backgroundSize="cover";closeButtonImage.onclick=closePopup;positionCloseButton(mainDiv);}
94
  function positionCloseButton(mainDiv)
95
  {if(closeBehavior.buttonPosition=="left"){closeButtonImage.style.left=(closeButton.width/2+parseFloat(closeBehavior.leftPosition))+"px";}
89
  function setCloseButton(mainDiv)
90
  {if(!closeButton.data){return;}
91
  if(closeBehavior.showButton===false){return;}
92
+ closeButtonImage.style.zIndex=defaultZIndex+20;closeButtonImage.style.position="absolute";closeButtonImage.style.float="left";closeButtonImage.style.top=closeBehavior.top;closeButtonImage.style.right=closeBehavior.right;closeButtonImage.style.bottom=closeBehavior.bottom;closeButtonImage.style.left=closeBehavior.left;closeButtonImage.alt=SGPB_JS_LOCALIZATION.closeButtonAltText;if(closeButton.type=='button'){closeButtonImage.id=prefix+'-close-button';closeButtonImage.innerHTML=config.closeButton.text;}
93
  closeButtonImage.style.width=closeButton.width+closeButton.widthType;closeButtonImage.style.cursor="pointer";closeButtonImage.style.height=closeButton.height+closeButton.heightType;closeButtonImage.src=closeButton.data;closeButtonImage.style.backgroundRepeat="no-repeat";closeButtonImage.style.backgroundSize="cover";closeButtonImage.onclick=closePopup;positionCloseButton(mainDiv);}
94
  function positionCloseButton(mainDiv)
95
  {if(closeBehavior.buttonPosition=="left"){closeButtonImage.style.left=(closeButton.width/2+parseFloat(closeBehavior.leftPosition))+"px";}
public/js/PopupBuilder.js CHANGED
@@ -1596,10 +1596,14 @@ SGPBPopup.prototype.contentCloseBehavior = function()
1596
  var closePopupAfterCopy = SGPBPopup.varToBool(popupData['sgpb-copy-to-clipboard-close-popup']);
1597
  var clipboardAlert = SGPBPopup.varToBool(popupData['sgpb-copy-to-clipboard-alert']);
1598
 
 
 
 
 
 
1599
  sgAddEvent(window, 'sgpbDidOpen', function(e) {
1600
 
1601
  });
1602
-
1603
  sgAddEvent(window, 'sgpbWillOpen', function(e) {
1604
  if (popupId != e.detail.popupId || e.detail.popupData['sgpb-content-click'] == 'undefined') {
1605
  return false;
@@ -1616,7 +1620,6 @@ SGPBPopup.prototype.contentCloseBehavior = function()
1616
  jQuery(window).trigger('sgpbPopupContentClick', settings);
1617
 
1618
  if (contentClickBehavior == 'redirect') {
1619
-
1620
  if (redirectToNewTab) {
1621
  window.open(redirectUrl);
1622
  SGPBPopup.closePopupById(that.getPopupId());
1596
  var closePopupAfterCopy = SGPBPopup.varToBool(popupData['sgpb-copy-to-clipboard-close-popup']);
1597
  var clipboardAlert = SGPBPopup.varToBool(popupData['sgpb-copy-to-clipboard-alert']);
1598
 
1599
+ var separators = ['&amp;', '/&/g'];
1600
+ for (var i in separators) {
1601
+ redirectUrl = redirectUrl.split(separators[i]).join('&');
1602
+ }
1603
+
1604
  sgAddEvent(window, 'sgpbDidOpen', function(e) {
1605
 
1606
  });
 
1607
  sgAddEvent(window, 'sgpbWillOpen', function(e) {
1608
  if (popupId != e.detail.popupId || e.detail.popupData['sgpb-content-click'] == 'undefined') {
1609
  return false;
1620
  jQuery(window).trigger('sgpbPopupContentClick', settings);
1621
 
1622
  if (contentClickBehavior == 'redirect') {
 
1623
  if (redirectToNewTab) {
1624
  window.open(redirectUrl);
1625
  SGPBPopup.closePopupById(that.getPopupId());
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.63
13
  License: GPLv2 or later
14
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
 
@@ -185,6 +185,14 @@ Go to the Popup Builder settings and set your desired options.
185
 
186
  == Changelog ==
187
 
 
 
 
 
 
 
 
 
188
  = Version 3.63 =
189
  * Autosave fixed.
190
  * Bug fixes and improvements.
@@ -1146,7 +1154,7 @@ Leave us a good review :)
1146
 
1147
  == Upgrade Notice ==
1148
 
1149
- Current Version of Popup Builder is 3.63
1150
 
1151
  == Other Notes ==
1152
 
9
  Requires at least: 3.8
10
  Tested up to: 5.3
11
  Requires PHP: 5.3.3
12
+ Stable tag: 3.64
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.64 =
189
+ * Security fixes.
190
+ * Conflict resolved related to Duplicate Post plugin.
191
+ * Speed improvements related to popup opening when custom close button setup.
192
+ * Added ALT attribute inside the close button element.
193
+ * Bug fixed related to Content Click Redirect functionality when the URL contains Unicode characters.
194
+ * Minor improvements.
195
+
196
  = Version 3.63 =
197
  * Autosave fixed.
198
  * Bug fixes and improvements.
1154
 
1155
  == Upgrade Notice ==
1156
 
1157
+ Current Version of Popup Builder is 3.64
1158
 
1159
  == Other Notes ==
1160