Version Description
Current Version of Popup Builder is 3.2
Download this release
Release Info
Developer | Sygnoos |
Plugin | Popup Builder – Responsive WordPress Pop up |
Version | 3.3 |
Comparing to | |
See all releases |
Code changes from version 3.2 to 3.3
- com/classes/Actions.php +16 -38
- com/classes/Ajax.php +73 -1
- com/classes/ConditionBuilder.php +0 -1
- com/classes/Filters.php +94 -3
- com/classes/MediaButton.php +6 -0
- com/classes/PopupLoader.php +11 -12
- com/classes/extension/SgpbPopupExtension.php +1 -1
- com/classes/popups/HtmlPopup.php +1 -1
- com/classes/popups/SGPopup.php +30 -6
- com/classes/popups/SubscriptionPopup.php +11 -0
- com/config/config.php +4 -0
- com/config/configPackage.php +1 -1
- com/config/dataConfig.php +3 -3
- com/helpers/AdminHelper.php +65 -37
- com/helpers/ConfigDataHelper.php +67 -2
- languages/popupBuilder.pot +1 -1
- popup-builder.php +1 -1
- public/css/popupAdminStyles.css +41 -1
- public/js/Backend.js +187 -14
- public/js/MediaButton.js +2 -1
- public/js/PopupBuilder.js +103 -9
- public/js/Subscribers.js +151 -0
- public/js/Subscription.js +2 -1
- public/views/htmlCustomButtonElement.php +200 -0
- public/views/importConfigView.php +55 -0
- public/views/options/subscription.php +1 -1
- public/views/subscribers.php +67 -0
- readme.txt +10 -1
com/classes/Actions.php
CHANGED
@@ -20,6 +20,7 @@ class Actions
|
|
20 |
add_action('init', array($this, 'postTypeInit'), 9999);
|
21 |
add_action('admin_menu', array($this, 'addSubMenu'));
|
22 |
add_action('admin_menu', array($this, 'supportLinks'), 999);
|
|
|
23 |
add_filter('get_sample_permalink_html', array($this, 'removePostPermalink'), 1, 1);
|
24 |
add_action('manage_'.SG_POPUP_POST_TYPE.'_posts_custom_column' , array($this, 'popupsTableColumnsValues'), 10, 2);
|
25 |
add_action('media_buttons', array($this, 'popupMediaButton'));
|
@@ -42,14 +43,11 @@ class Actions
|
|
42 |
add_action('sgpb_send_newsletter', array($this, 'newsletterSendEmail'), 10, 1);
|
43 |
add_action('sgpbGetBannerContentOnce', array($this, 'getBannerContent'), 10, 1);
|
44 |
add_action('admin_post_sgpbSaveSettings', array($this, 'saveSettings'), 10, 1);
|
45 |
-
add_action('admin_init', array($this, 'disableAutosave'));
|
46 |
add_action('admin_init', array($this, 'userRolesCaps'));
|
47 |
-
add_action('admin_head', array($this, 'showPreviewButtonAfterPopupPublish'));
|
48 |
add_action('admin_notices', array($this, 'pluginNotices'));
|
49 |
add_action('admin_notices', array($this, 'promotionalBanner'), 10);
|
50 |
add_action('admin_init', array($this, 'pluginLoaded'));
|
51 |
add_action('plugins_loaded', array($this, 'loadTextDomain'));
|
52 |
-
add_filter('wp_insert_post_data', array($this, 'editPublishSettings'), 100, 1);
|
53 |
// for change admin popup list order
|
54 |
add_action('pre_get_posts', array($this, 'preGetPosts'));
|
55 |
add_action('template_redirect', array($this, 'redirectFromPopupPage'));
|
@@ -62,6 +60,18 @@ class Actions
|
|
62 |
new Ajax();
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
public function inactiveExtensionNotice()
|
66 |
{
|
67 |
$screen = '';
|
@@ -223,18 +233,6 @@ class Actions
|
|
223 |
}
|
224 |
}
|
225 |
|
226 |
-
public function editPublishSettings($post)
|
227 |
-
{
|
228 |
-
if (isset($post['post_type']) && $post['post_type'] == SG_POPUP_POST_TYPE) {
|
229 |
-
// force set status to publish
|
230 |
-
if (isset($post['post_status']) && ($post['post_status'] == 'draft' || $post['post_status'] == 'pending')) {
|
231 |
-
$post['post_status'] = 'publish';
|
232 |
-
}
|
233 |
-
}
|
234 |
-
|
235 |
-
return $post;
|
236 |
-
}
|
237 |
-
|
238 |
public function preGetPosts($query)
|
239 |
{
|
240 |
if (!is_admin() || !isset($_GET['post_type']) || $_GET['post_type'] != SG_POPUP_POST_TYPE) {
|
@@ -329,17 +327,6 @@ class Actions
|
|
329 |
}
|
330 |
}
|
331 |
|
332 |
-
public function showPreviewButtonAfterPopupPublish()
|
333 |
-
{
|
334 |
-
if (!empty($_GET['post_type']) && $_GET['post_type'] == SG_POPUP_POST_TYPE && !isset($_GET['post'])) {
|
335 |
-
echo '<style>
|
336 |
-
#post-preview,#save-post {
|
337 |
-
display:none !important;
|
338 |
-
}
|
339 |
-
</style>';
|
340 |
-
}
|
341 |
-
}
|
342 |
-
|
343 |
public function popupMediaButton()
|
344 |
{
|
345 |
if (!$this->mediaButton) {
|
@@ -432,13 +419,6 @@ class Actions
|
|
432 |
}
|
433 |
}
|
434 |
|
435 |
-
public function disableAutosave()
|
436 |
-
{
|
437 |
-
if (!empty($_GET['post_type']) && $_GET['post_type'] == SG_POPUP_POST_TYPE) {
|
438 |
-
wp_deregister_script('autosave');
|
439 |
-
}
|
440 |
-
}
|
441 |
-
|
442 |
public function popupShortcode($args, $content)
|
443 |
{
|
444 |
if (empty($args) || empty($args['id'])) {
|
@@ -802,9 +782,6 @@ class Actions
|
|
802 |
}
|
803 |
}
|
804 |
|
805 |
-
if (!$update && !$saveMode) {
|
806 |
-
return;
|
807 |
-
}
|
808 |
|
809 |
if (empty($post)) {
|
810 |
$saveMode = '';
|
@@ -1147,7 +1124,6 @@ class Actions
|
|
1147 |
public function getSubscribersCsvFile()
|
1148 |
{
|
1149 |
global $wpdb;
|
1150 |
-
|
1151 |
$query = AdminHelper::subscribersRelatedQuery();
|
1152 |
if (isset($_GET['orderby']) && !empty($_GET['orderby'])) {
|
1153 |
if (isset($_GET['order']) && !empty($_GET['order'])) {
|
@@ -1171,13 +1147,15 @@ class Actions
|
|
1171 |
foreach($subscribers as $values) {
|
1172 |
foreach ($values as $key => $value) {
|
1173 |
$content .= $value;
|
1174 |
-
if ($key != '
|
1175 |
$content .= ',';
|
1176 |
}
|
1177 |
}
|
1178 |
$content .= "\n";
|
1179 |
}
|
1180 |
|
|
|
|
|
1181 |
header('Pragma: public');
|
1182 |
header('Expires: 0');
|
1183 |
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
20 |
add_action('init', array($this, 'postTypeInit'), 9999);
|
21 |
add_action('admin_menu', array($this, 'addSubMenu'));
|
22 |
add_action('admin_menu', array($this, 'supportLinks'), 999);
|
23 |
+
add_action('admin_head', array($this, 'showPreviewButtonAfterPopupPublish'));
|
24 |
add_filter('get_sample_permalink_html', array($this, 'removePostPermalink'), 1, 1);
|
25 |
add_action('manage_'.SG_POPUP_POST_TYPE.'_posts_custom_column' , array($this, 'popupsTableColumnsValues'), 10, 2);
|
26 |
add_action('media_buttons', array($this, 'popupMediaButton'));
|
43 |
add_action('sgpb_send_newsletter', array($this, 'newsletterSendEmail'), 10, 1);
|
44 |
add_action('sgpbGetBannerContentOnce', array($this, 'getBannerContent'), 10, 1);
|
45 |
add_action('admin_post_sgpbSaveSettings', array($this, 'saveSettings'), 10, 1);
|
|
|
46 |
add_action('admin_init', array($this, 'userRolesCaps'));
|
|
|
47 |
add_action('admin_notices', array($this, 'pluginNotices'));
|
48 |
add_action('admin_notices', array($this, 'promotionalBanner'), 10);
|
49 |
add_action('admin_init', array($this, 'pluginLoaded'));
|
50 |
add_action('plugins_loaded', array($this, 'loadTextDomain'));
|
|
|
51 |
// for change admin popup list order
|
52 |
add_action('pre_get_posts', array($this, 'preGetPosts'));
|
53 |
add_action('template_redirect', array($this, 'redirectFromPopupPage'));
|
60 |
new Ajax();
|
61 |
}
|
62 |
|
63 |
+
public function showPreviewButtonAfterPopupPublish()
|
64 |
+
{
|
65 |
+
$currentPostType = AdminHelper::getCurrentPostType();
|
66 |
+
if (!empty($currentPostType) && $currentPostType == SG_POPUP_POST_TYPE) {
|
67 |
+
echo '<style>
|
68 |
+
#save-post {
|
69 |
+
display:none !important;
|
70 |
+
}
|
71 |
+
</style>';
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
public function inactiveExtensionNotice()
|
76 |
{
|
77 |
$screen = '';
|
233 |
}
|
234 |
}
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
public function preGetPosts($query)
|
237 |
{
|
238 |
if (!is_admin() || !isset($_GET['post_type']) || $_GET['post_type'] != SG_POPUP_POST_TYPE) {
|
327 |
}
|
328 |
}
|
329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
public function popupMediaButton()
|
331 |
{
|
332 |
if (!$this->mediaButton) {
|
419 |
}
|
420 |
}
|
421 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
public function popupShortcode($args, $content)
|
423 |
{
|
424 |
if (empty($args) || empty($args['id'])) {
|
782 |
}
|
783 |
}
|
784 |
|
|
|
|
|
|
|
785 |
|
786 |
if (empty($post)) {
|
787 |
$saveMode = '';
|
1124 |
public function getSubscribersCsvFile()
|
1125 |
{
|
1126 |
global $wpdb;
|
|
|
1127 |
$query = AdminHelper::subscribersRelatedQuery();
|
1128 |
if (isset($_GET['orderby']) && !empty($_GET['orderby'])) {
|
1129 |
if (isset($_GET['order']) && !empty($_GET['order'])) {
|
1147 |
foreach($subscribers as $values) {
|
1148 |
foreach ($values as $key => $value) {
|
1149 |
$content .= $value;
|
1150 |
+
if ($key != 'subscriptionTitle') {
|
1151 |
$content .= ',';
|
1152 |
}
|
1153 |
}
|
1154 |
$content .= "\n";
|
1155 |
}
|
1156 |
|
1157 |
+
$content = apply_filters('sgpbSubscribersContent', $content);
|
1158 |
+
|
1159 |
header('Pragma: public');
|
1160 |
header('Expires: 0');
|
1161 |
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
com/classes/Ajax.php
CHANGED
@@ -58,6 +58,8 @@ class Ajax
|
|
58 |
// proEndGold
|
59 |
add_action('wp_ajax_sgpb_subscribers_delete', array($this, 'deleteSubscribers'));
|
60 |
add_action('wp_ajax_sgpb_add_subscribers', array($this, 'addSubscribers'));
|
|
|
|
|
61 |
add_action('wp_ajax_sgpb_send_newsletter', array($this, 'sendNewsletter'));
|
62 |
add_action('wp_ajax_sgpb_send_to_open_counter', array($this, 'addToCounter'));
|
63 |
add_action('wp_ajax_sgpb_change_review_popup_show_period', array($this, 'changeReviewPopupPeriod'));
|
@@ -71,6 +73,23 @@ class Ajax
|
|
71 |
/*Extension notification panel*/
|
72 |
add_action('wp_ajax_sgpb_dont_show_extension_panel', array($this, 'extensionNotificationPanel'));
|
73 |
add_action('wp_ajax_sgpb_dont_show_problem_alert', array($this, 'dontShowProblemAlert'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
public function dontShowReviewPopup()
|
@@ -173,6 +192,9 @@ class Ajax
|
|
173 |
check_ajax_referer(SG_AJAX_NONCE, 'nonce');
|
174 |
|
175 |
$popupParams = $_POST['params'];
|
|
|
|
|
|
|
176 |
$popupsIdCollection = $popupParams['popupsIdCollection'];
|
177 |
|
178 |
$popupsCounterData = get_option('SgpbCounter');
|
@@ -244,6 +266,50 @@ class Ajax
|
|
244 |
wp_die();
|
245 |
}
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
public function sendNewsletter()
|
248 |
{
|
249 |
check_ajax_referer(SG_AJAX_NONCE, 'nonce');
|
@@ -311,6 +377,12 @@ class Ajax
|
|
311 |
{
|
312 |
$popupId = (int)$_POST['popupId'];
|
313 |
$obj = SGPopup::find($popupId);
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
if (!$obj) {
|
315 |
wp_die(SGPB_AJAX_STATUS_FALSE);
|
316 |
}
|
@@ -318,7 +390,7 @@ class Ajax
|
|
318 |
$options['sgpb-is-active'] = sanitize_text_field($_POST['popupStatus']);
|
319 |
|
320 |
unset($options['sgpb-conditions']);
|
321 |
-
update_post_meta($popupId, 'sg_popup_options', $options);
|
322 |
|
323 |
wp_die($popupId);
|
324 |
}
|
58 |
// proEndGold
|
59 |
add_action('wp_ajax_sgpb_subscribers_delete', array($this, 'deleteSubscribers'));
|
60 |
add_action('wp_ajax_sgpb_add_subscribers', array($this, 'addSubscribers'));
|
61 |
+
add_action('wp_ajax_sgpb_import_subscribers', array($this, 'importSubscribers'));
|
62 |
+
add_action('wp_ajax_sgpb_save_imported_subscribers', array($this, 'saveImportedSubscribers'));
|
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'));
|
73 |
/*Extension notification panel*/
|
74 |
add_action('wp_ajax_sgpb_dont_show_extension_panel', array($this, 'extensionNotificationPanel'));
|
75 |
add_action('wp_ajax_sgpb_dont_show_problem_alert', array($this, 'dontShowProblemAlert'));
|
76 |
+
// autosave
|
77 |
+
add_action('wp_ajax_sgpb_autosave', array($this, 'sgpbAutosave'));
|
78 |
+
add_action('wp_ajax_nopriv_sgpb_autosave', array($this, 'sgpbAutosave'));
|
79 |
+
}
|
80 |
+
|
81 |
+
public function sgpbAutosave()
|
82 |
+
{
|
83 |
+
$popupData = SGPopup::parsePopupDataFromData($_POST['allPopupData']);
|
84 |
+
do_action('save_post_popupbuilder');
|
85 |
+
$popupType = $popupData['sgpb-type'];
|
86 |
+
$popupClassName = SGPopup::getPopupClassNameFormType($popupType);
|
87 |
+
$popupClassPath = SGPopup::getPopupTypeClassPath($popupType);
|
88 |
+
require_once($popupClassPath.$popupClassName.'.php');
|
89 |
+
$popupClassName = __NAMESPACE__.'\\'.$popupClassName;
|
90 |
+
$popupClassName::create($popupData, '_preview', 1);
|
91 |
+
|
92 |
+
wp_die();
|
93 |
}
|
94 |
|
95 |
public function dontShowReviewPopup()
|
192 |
check_ajax_referer(SG_AJAX_NONCE, 'nonce');
|
193 |
|
194 |
$popupParams = $_POST['params'];
|
195 |
+
if (isset($_GET['sg_popup_preview_id'])) {
|
196 |
+
wp_die();
|
197 |
+
}
|
198 |
$popupsIdCollection = $popupParams['popupsIdCollection'];
|
199 |
|
200 |
$popupsCounterData = get_option('SgpbCounter');
|
266 |
wp_die();
|
267 |
}
|
268 |
|
269 |
+
public function importSubscribers()
|
270 |
+
{
|
271 |
+
check_ajax_referer(SG_AJAX_NONCE, 'nonce');
|
272 |
+
$formId = (int)sanitize_text_field($_POST['popupSubscriptionList']);
|
273 |
+
$fileURL = sanitize_text_field($_POST['importListURL']);
|
274 |
+
|
275 |
+
ob_start();
|
276 |
+
require_once SG_POPUP_VIEWS_PATH.'importConfigView.php';
|
277 |
+
$content = ob_get_contents();
|
278 |
+
ob_end_clean();
|
279 |
+
|
280 |
+
echo $content;
|
281 |
+
wp_die();
|
282 |
+
}
|
283 |
+
|
284 |
+
public function saveImportedSubscribers()
|
285 |
+
{
|
286 |
+
check_ajax_referer(SG_AJAX_NONCE, 'nonce');
|
287 |
+
$formId = (int)sanitize_text_field($_POST['popupSubscriptionList']);
|
288 |
+
$fileURL = sanitize_text_field($_POST['importListURL']);
|
289 |
+
$mapping = $_POST['namesMapping'];
|
290 |
+
|
291 |
+
$fileContent = AdminHelper::getFileFromURL($fileURL);
|
292 |
+
$csvFileArray = array_map('str_getcsv', file($fileURL));
|
293 |
+
|
294 |
+
$header = $csvFileArray[0];
|
295 |
+
unset($csvFileArray[0]);
|
296 |
+
$subscriptionPlusContent = apply_filters('sgpbImportToSubscriptionList', $csvFileArray, $mapping, $formId);
|
297 |
+
|
298 |
+
// -1 it's mean saved from Subscription Plus
|
299 |
+
if ($subscriptionPlusContent != -1) {
|
300 |
+
foreach ($csvFileArray as $csvData) {
|
301 |
+
global $wpdb;
|
302 |
+
$subscribersTableName = $wpdb->prefix.SGPB_SUBSCRIBERS_TABLE_NAME;
|
303 |
+
|
304 |
+
$sql = $wpdb->prepare('INSERT INTO '.$subscribersTableName.' (firstName, lastName, email, cDate, subscriptionType, status, unsubscribed, submittedData) VALUES (%s, %s, %s, %s, %d, %d, %d, %s) ', $csvData[$mapping['firstName']], $csvData[$mapping['lastName']], $csvData[$mapping['email']], $csvData[$mapping['date']], $formId, 0, 0, '');
|
305 |
+
$wpdb->query($sql);
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
echo SGPB_AJAX_STATUS_TRUE;
|
310 |
+
wp_die();
|
311 |
+
}
|
312 |
+
|
313 |
public function sendNewsletter()
|
314 |
{
|
315 |
check_ajax_referer(SG_AJAX_NONCE, 'nonce');
|
377 |
{
|
378 |
$popupId = (int)$_POST['popupId'];
|
379 |
$obj = SGPopup::find($popupId);
|
380 |
+
$isDraft = '';
|
381 |
+
$postStatus = get_post_status($popupId);
|
382 |
+
if ($postStatus == 'draft') {
|
383 |
+
$isDraft = '_preview';
|
384 |
+
}
|
385 |
+
|
386 |
if (!$obj) {
|
387 |
wp_die(SGPB_AJAX_STATUS_FALSE);
|
388 |
}
|
390 |
$options['sgpb-is-active'] = sanitize_text_field($_POST['popupStatus']);
|
391 |
|
392 |
unset($options['sgpb-conditions']);
|
393 |
+
update_post_meta($popupId, 'sg_popup_options'.$isDraft, $options);
|
394 |
|
395 |
wp_die($popupId);
|
396 |
}
|
com/classes/ConditionBuilder.php
CHANGED
@@ -235,7 +235,6 @@ class ConditionBuilder
|
|
235 |
$builderObj->setSavedData($ruleData);
|
236 |
$builderObj->setConditionName($conditionName);
|
237 |
$builderObj->setGroupTotal(count($groupData) - 1);
|
238 |
-
$builderObj->setTakeValueFrom('operator');
|
239 |
$allCondition[] = $builderObj;
|
240 |
}
|
241 |
}
|
235 |
$builderObj->setSavedData($ruleData);
|
236 |
$builderObj->setConditionName($conditionName);
|
237 |
$builderObj->setGroupTotal(count($groupData) - 1);
|
|
|
238 |
$allCondition[] = $builderObj;
|
239 |
}
|
240 |
}
|
com/classes/Filters.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
namespace sgpb;
|
|
|
3 |
use \SgpbPopupConfig;
|
4 |
use sgpb\PopupBuilderActivePackage;
|
5 |
|
@@ -234,9 +235,99 @@ class Filters
|
|
234 |
|
235 |
public function editPopupPreviewLink($previewLink = '', $post = array())
|
236 |
{
|
237 |
-
if (
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
}
|
241 |
}
|
242 |
|
1 |
<?php
|
2 |
namespace sgpb;
|
3 |
+
use \WP_Query;
|
4 |
use \SgpbPopupConfig;
|
5 |
use sgpb\PopupBuilderActivePackage;
|
6 |
|
235 |
|
236 |
public function editPopupPreviewLink($previewLink = '', $post = array())
|
237 |
{
|
238 |
+
if (!empty($post) && $post->post_type == SG_POPUP_POST_TYPE) {
|
239 |
+
$popupId = $post->ID;
|
240 |
+
$targets = get_post_meta($popupId, 'sg_popup_target_preview', true);
|
241 |
+
if ((isset($targets['sgpb-target'][0][0]['param']) && $targets['sgpb-target'][0][0]['param'] == 'not_rule') || !isset($targets['sgpb-target'][0][0]['param'])) {
|
242 |
+
$previewLink = home_url();
|
243 |
+
$previewLink .= '/?sg_popup_preview_id='.$popupId;
|
244 |
+
|
245 |
+
return $previewLink;
|
246 |
+
}
|
247 |
+
foreach ($targets['sgpb-target'][0] as $targetKey => $targetValue) {
|
248 |
+
if (!isset($targetValue['operator']) || $targetValue['operator'] == '!=') {
|
249 |
+
continue;
|
250 |
+
}
|
251 |
+
$previewLink = self::getPopupPreviewLink($targetValue, $popupId);
|
252 |
+
$previewLink .= '/?sg_popup_preview_id='.$popupId;
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
return $previewLink;
|
257 |
+
}
|
258 |
+
|
259 |
+
public static function getPopupPreviewLink($targetData, $popupId)
|
260 |
+
{
|
261 |
+
$previewLink = home_url();
|
262 |
+
|
263 |
+
if (empty($targetData['param'])) {
|
264 |
+
return $previewLink;
|
265 |
+
}
|
266 |
+
$targetParam = $targetData['param'];
|
267 |
+
|
268 |
+
if ($targetParam == 'everywhere') {
|
269 |
+
return $previewLink;
|
270 |
+
}
|
271 |
+
|
272 |
+
$args = array(
|
273 |
+
'orderby' => 'rand'
|
274 |
+
);
|
275 |
+
|
276 |
+
// posts
|
277 |
+
if (strpos($targetData['param'], '_all')) {
|
278 |
+
if ($targetData['param'] == 'post_all') {
|
279 |
+
$args['post_type'] = 'post';
|
280 |
+
}
|
281 |
+
if ($targetData['param'] == 'page_all') {
|
282 |
+
$args['post_type'] = 'page';
|
283 |
+
}
|
284 |
+
}
|
285 |
+
if ($targetData['param'] == 'post_type' && !empty($targetData['value'])) {
|
286 |
+
$args['post_type'] = $targetData['value'];
|
287 |
+
}
|
288 |
+
if ($targetData['param'] == 'page_type' && !empty($targetData['value'])) {
|
289 |
+
$pageTypes = $targetData['value'];
|
290 |
+
foreach ($pageTypes as $pageType) {
|
291 |
+
|
292 |
+
if ($pageType == 'is_home_page') {
|
293 |
+
if (is_front_page() && is_home()) {
|
294 |
+
// default homepage
|
295 |
+
return get_home_url();
|
296 |
+
}
|
297 |
+
else if (is_front_page()) {
|
298 |
+
// static homepage
|
299 |
+
return get_home_url();
|
300 |
+
}
|
301 |
+
}
|
302 |
+
else if (function_exists($pageType)) {
|
303 |
+
if ($pageType == 'is_home') {
|
304 |
+
return get_home_url();
|
305 |
+
}
|
306 |
+
else if ($pageType == 'is_search') {
|
307 |
+
return get_search_link();
|
308 |
+
}
|
309 |
+
else if ($pageType == 'is_shop') {
|
310 |
+
return get_home_url().'/shop/';
|
311 |
+
}
|
312 |
+
}
|
313 |
+
}
|
314 |
+
}
|
315 |
+
if (isset($args['post_type'])) {
|
316 |
+
$the_query = new WP_Query($args);
|
317 |
+
foreach ($the_query->posts as $post) {
|
318 |
+
$postId = $post->ID;
|
319 |
+
if (get_permalink($postId)) {
|
320 |
+
return get_permalink($postId);
|
321 |
+
}
|
322 |
+
}
|
323 |
+
}
|
324 |
+
// selected post/page/custom_post_types...
|
325 |
+
if (strpos($targetData['param'], '_selected') && !empty($targetData['value'])) {
|
326 |
+
$value = array_keys($targetData['value']);
|
327 |
+
if (!empty($value[0])) {
|
328 |
+
if (get_permalink($value[0])) {
|
329 |
+
return get_permalink($value[0]);
|
330 |
+
}
|
331 |
}
|
332 |
}
|
333 |
|
com/classes/MediaButton.php
CHANGED
@@ -84,6 +84,12 @@ class MediaButton
|
|
84 |
$output = '';
|
85 |
return $output;
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
ob_start();
|
89 |
@include(SG_POPUP_VIEWS_PATH.'mediaButton.php');
|
84 |
$output = '';
|
85 |
return $output;
|
86 |
}
|
87 |
+
$currentPostType = AdminHelper::getCurrentPostType();
|
88 |
+
if (!empty($currentPostType) && $currentPostType == SG_POPUP_POST_TYPE) {
|
89 |
+
add_action('admin_footer', function() {
|
90 |
+
require_once(SG_POPUP_VIEWS_PATH.'htmlCustomButtonElement.php');
|
91 |
+
});
|
92 |
+
}
|
93 |
|
94 |
ob_start();
|
95 |
@include(SG_POPUP_VIEWS_PATH.'mediaButton.php');
|
com/classes/PopupLoader.php
CHANGED
@@ -49,15 +49,20 @@ class PopupLoader
|
|
49 |
|
50 |
public function addPopupFromUrl($popupsToLoad)
|
51 |
{
|
52 |
-
if (isset($_GET['sg_popup_id'])) {
|
53 |
-
$
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
55 |
if (function_exists('sgpb\sgpGetCorrectPopupId')) {
|
56 |
$getterId = sgpGetCorrectPopupId($getterId);
|
57 |
}
|
58 |
|
59 |
-
$popupFromUrl = SGPopup::find($getterId);
|
60 |
-
if (!empty($popupFromUrl)
|
61 |
global $SGPB_DATA_CONFIG_ARRAY;
|
62 |
$defaultEvent = array();
|
63 |
$customDelay = $popupFromUrl->getOptionValue('sgpb-popup-delay');
|
@@ -77,16 +82,10 @@ class PopupLoader
|
|
77 |
public function loadPopups()
|
78 |
{
|
79 |
$foundPopup = array();
|
80 |
-
$popupPreviewArgs = array();
|
81 |
if (is_preview()) {
|
82 |
global $post;
|
83 |
$foundPopup = $post;
|
84 |
}
|
85 |
-
// for the first time, when new wordpress with not changed theme
|
86 |
-
if (isset($_GET['popup_preview_id'])) {
|
87 |
-
$foundPopup = get_post($_GET['popup_preview_id']);
|
88 |
-
$popupPreviewArgs = array('preview' => true);
|
89 |
-
}
|
90 |
if (!empty($foundPopup)) {
|
91 |
global $SGPB_DATA_CONFIG_ARRAY;
|
92 |
if (@$post->post_type == SG_POPUP_POST_TYPE) {
|
@@ -103,7 +102,7 @@ class PopupLoader
|
|
103 |
}
|
104 |
}
|
105 |
if (@$foundPopup->post_type == SG_POPUP_POST_TYPE) {
|
106 |
-
$popup = SGPopup::find($foundPopup
|
107 |
|
108 |
$popup->setEvents($SGPB_DATA_CONFIG_ARRAY['events']['initialData'][0]);
|
109 |
$this->addLoadablePopup($popup);
|
49 |
|
50 |
public function addPopupFromUrl($popupsToLoad)
|
51 |
{
|
52 |
+
if (isset($_GET['sg_popup_id']) || isset($_GET['sg_popup_preview_id'])) {
|
53 |
+
$args = array();
|
54 |
+
$getterId = isset($_GET['sg_popup_id']) ? (int)$_GET['sg_popup_id'] : 0;
|
55 |
+
$previewedPopupId = isset($_GET['sg_popup_preview_id']) ? (int)$_GET['sg_popup_preview_id'] : 0;
|
56 |
+
if (isset($_GET['sg_popup_preview_id'])) {
|
57 |
+
$getterId = $previewedPopupId;
|
58 |
+
$args['is-preview'] = true;
|
59 |
+
}
|
60 |
if (function_exists('sgpb\sgpGetCorrectPopupId')) {
|
61 |
$getterId = sgpGetCorrectPopupId($getterId);
|
62 |
}
|
63 |
|
64 |
+
$popupFromUrl = SGPopup::find($getterId, $args);
|
65 |
+
if (!empty($popupFromUrl)) {
|
66 |
global $SGPB_DATA_CONFIG_ARRAY;
|
67 |
$defaultEvent = array();
|
68 |
$customDelay = $popupFromUrl->getOptionValue('sgpb-popup-delay');
|
82 |
public function loadPopups()
|
83 |
{
|
84 |
$foundPopup = array();
|
|
|
85 |
if (is_preview()) {
|
86 |
global $post;
|
87 |
$foundPopup = $post;
|
88 |
}
|
|
|
|
|
|
|
|
|
|
|
89 |
if (!empty($foundPopup)) {
|
90 |
global $SGPB_DATA_CONFIG_ARRAY;
|
91 |
if (@$post->post_type == SG_POPUP_POST_TYPE) {
|
102 |
}
|
103 |
}
|
104 |
if (@$foundPopup->post_type == SG_POPUP_POST_TYPE) {
|
105 |
+
$popup = SGPopup::find($foundPopup);
|
106 |
|
107 |
$popup->setEvents($SGPB_DATA_CONFIG_ARRAY['events']['initialData'][0]);
|
108 |
$this->addLoadablePopup($popup);
|
com/classes/extension/SgpbPopupExtension.php
CHANGED
@@ -269,7 +269,7 @@ class SgpbPopupExtension implements SgpbIPopupExtension
|
|
269 |
6 => AdminHelper::defaultButtonImage('sgpb-theme-6')
|
270 |
),
|
271 |
'homePageUrl' => get_home_url().'/',
|
272 |
-
'isPreview' =>
|
273 |
'convertedIdsReverse' => AdminHelper::getReverseConvertIds(),
|
274 |
'dontShowPopupExpireTime' => SGPB_DONT_SHOW_POPUP_EXPIRY,
|
275 |
'conditionalJsClasses' => apply_filters('sgpbConditionalJsClasses', array())
|
269 |
6 => AdminHelper::defaultButtonImage('sgpb-theme-6')
|
270 |
),
|
271 |
'homePageUrl' => get_home_url().'/',
|
272 |
+
'isPreview' => isset($_GET['sg_popup_preview_id']),
|
273 |
'convertedIdsReverse' => AdminHelper::getReverseConvertIds(),
|
274 |
'dontShowPopupExpireTime' => SGPB_DONT_SHOW_POPUP_EXPIRY,
|
275 |
'conditionalJsClasses' => apply_filters('sgpbConditionalJsClasses', array())
|
com/classes/popups/HtmlPopup.php
CHANGED
@@ -42,4 +42,4 @@ class HtmlPopup extends SGPopup
|
|
42 |
{
|
43 |
return array();
|
44 |
}
|
45 |
-
}
|
42 |
{
|
43 |
return array();
|
44 |
}
|
45 |
+
}
|
com/classes/popups/SGPopup.php
CHANGED
@@ -3,6 +3,10 @@ namespace sgpb;
|
|
3 |
use \ConfigDataHelper;
|
4 |
use \WP_Post;
|
5 |
|
|
|
|
|
|
|
|
|
6 |
abstract class SGPopup
|
7 |
{
|
8 |
protected $type;
|
@@ -213,6 +217,9 @@ abstract class SGPopup
|
|
213 |
*/
|
214 |
public static function find($popup, $args = array())
|
215 |
{
|
|
|
|
|
|
|
216 |
// If the popup is object get data from object otherwise we find needed data from WordPress functions
|
217 |
if ($popup instanceof WP_Post) {
|
218 |
$status = $popup->post_status;
|
@@ -230,7 +237,7 @@ abstract class SGPopup
|
|
230 |
$status = get_post_status($popupId);
|
231 |
$popupContent = $popupPost->post_content;
|
232 |
}
|
233 |
-
$allowedStatus = array('publish');
|
234 |
|
235 |
if (!empty($args['status'])) {
|
236 |
$allowedStatus = $args['status'];
|
@@ -239,15 +246,22 @@ abstract class SGPopup
|
|
239 |
if (!isset($args['checkActivePopupType']) && !in_array($status, $allowedStatus)) {
|
240 |
return $status;
|
241 |
}
|
242 |
-
|
243 |
$saveMode = '';
|
244 |
global $post;
|
245 |
if ((@is_preview() && $post->ID == $popupId) || isset($args['preview'])) {
|
246 |
$saveMode = '_preview';
|
247 |
}
|
|
|
|
|
|
|
248 |
if (isset($args['insidePopup']) && $args['insidePopup'] == 'on') {
|
249 |
$saveMode = '';
|
250 |
}
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
require_once(dirname(__FILE__).'/PopupData.php');
|
253 |
$savedData = PopupData::getPopupDataById($popupId, $saveMode);
|
@@ -414,6 +428,12 @@ abstract class SGPopup
|
|
414 |
if (strpos($key, 'sgpb') === 0) {
|
415 |
$popupData[$key] = $value;
|
416 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
}
|
418 |
|
419 |
return $popupData;
|
@@ -436,7 +456,6 @@ abstract class SGPopup
|
|
436 |
$obj->insertIntoSanitizedData(array('name' => $name,'value' => $sanitizedValue));
|
437 |
}
|
438 |
}
|
439 |
-
|
440 |
$obj->setSavedPopupById($data['sgpb-post-id']);
|
441 |
$result = $obj->save();
|
442 |
|
@@ -527,7 +546,9 @@ abstract class SGPopup
|
|
527 |
$paramsData = $targetConfig['paramsData'];
|
528 |
$attrs = $targetConfig['attrs'];
|
529 |
$popupTarget = array();
|
530 |
-
|
|
|
|
|
531 |
foreach ($targetData as $groupId => $groupData) {
|
532 |
foreach ($groupData as $ruleId => $ruleData) {
|
533 |
|
@@ -611,14 +632,13 @@ abstract class SGPopup
|
|
611 |
}
|
612 |
|
613 |
$popupEvents['formPopup'] = $eventsFromPopup;
|
614 |
-
|
615 |
$alreadySavedEvents = get_post_meta($popupId, 'sg_popup_events'.$saveMode, true);
|
616 |
if ($alreadySavedEvents === $eventsFromPopup) {
|
617 |
return true;
|
618 |
}
|
619 |
|
620 |
if ($saveMode) {
|
621 |
-
$eventsFromPopup[] =
|
622 |
}
|
623 |
|
624 |
$eventsFromPopup = apply_filters('sgpbPopupEventsMetadata', $eventsFromPopup);
|
@@ -759,6 +779,10 @@ abstract class SGPopup
|
|
759 |
|
760 |
public static function getPopupOptionsById($popupId, $saveMode = '')
|
761 |
{
|
|
|
|
|
|
|
|
|
762 |
$optionsData = array();
|
763 |
if (get_post_meta($popupId, 'sg_popup_options'.$saveMode, true)) {
|
764 |
$optionsData = get_post_meta($popupId, 'sg_popup_options'.$saveMode, true);
|
3 |
use \ConfigDataHelper;
|
4 |
use \WP_Post;
|
5 |
|
6 |
+
if (class_exists("sgpb\SGPopup")) {
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
|
10 |
abstract class SGPopup
|
11 |
{
|
12 |
protected $type;
|
217 |
*/
|
218 |
public static function find($popup, $args = array())
|
219 |
{
|
220 |
+
if (isset($_GET['sg_popup_preview_id'])) {
|
221 |
+
$args['is-preview'] = true;
|
222 |
+
}
|
223 |
// If the popup is object get data from object otherwise we find needed data from WordPress functions
|
224 |
if ($popup instanceof WP_Post) {
|
225 |
$status = $popup->post_status;
|
237 |
$status = get_post_status($popupId);
|
238 |
$popupContent = $popupPost->post_content;
|
239 |
}
|
240 |
+
$allowedStatus = array('publish', 'draft');
|
241 |
|
242 |
if (!empty($args['status'])) {
|
243 |
$allowedStatus = $args['status'];
|
246 |
if (!isset($args['checkActivePopupType']) && !in_array($status, $allowedStatus)) {
|
247 |
return $status;
|
248 |
}
|
|
|
249 |
$saveMode = '';
|
250 |
global $post;
|
251 |
if ((@is_preview() && $post->ID == $popupId) || isset($args['preview'])) {
|
252 |
$saveMode = '_preview';
|
253 |
}
|
254 |
+
if (isset($args['is-preview'])) {
|
255 |
+
$saveMode = '_preview';
|
256 |
+
}
|
257 |
if (isset($args['insidePopup']) && $args['insidePopup'] == 'on') {
|
258 |
$saveMode = '';
|
259 |
}
|
260 |
+
$currentPost = get_post($popupId);
|
261 |
+
$currentPostStatus = $currentPost->post_status;
|
262 |
+
if ($currentPostStatus == 'draft') {
|
263 |
+
$saveMode = '_preview';
|
264 |
+
}
|
265 |
|
266 |
require_once(dirname(__FILE__).'/PopupData.php');
|
267 |
$savedData = PopupData::getPopupDataById($popupId, $saveMode);
|
428 |
if (strpos($key, 'sgpb') === 0) {
|
429 |
$popupData[$key] = $value;
|
430 |
}
|
431 |
+
if (isset($value['name']) && strpos($value['name'], 'sgpb') === 0) {
|
432 |
+
$popupData[$value['name']] = $value['value'];
|
433 |
+
}
|
434 |
+
else if (isset($value['name']) && strpos($value['name'], 'post_ID') === 0) {
|
435 |
+
$popupData['sgpb-post-id'] = $value['value'];
|
436 |
+
}
|
437 |
}
|
438 |
|
439 |
return $popupData;
|
456 |
$obj->insertIntoSanitizedData(array('name' => $name,'value' => $sanitizedValue));
|
457 |
}
|
458 |
}
|
|
|
459 |
$obj->setSavedPopupById($data['sgpb-post-id']);
|
460 |
$result = $obj->save();
|
461 |
|
546 |
$paramsData = $targetConfig['paramsData'];
|
547 |
$attrs = $targetConfig['attrs'];
|
548 |
$popupTarget = array();
|
549 |
+
if (empty($targetData)) {
|
550 |
+
return array();
|
551 |
+
}
|
552 |
foreach ($targetData as $groupId => $groupData) {
|
553 |
foreach ($groupData as $ruleId => $ruleData) {
|
554 |
|
632 |
}
|
633 |
|
634 |
$popupEvents['formPopup'] = $eventsFromPopup;
|
|
|
635 |
$alreadySavedEvents = get_post_meta($popupId, 'sg_popup_events'.$saveMode, true);
|
636 |
if ($alreadySavedEvents === $eventsFromPopup) {
|
637 |
return true;
|
638 |
}
|
639 |
|
640 |
if ($saveMode) {
|
641 |
+
$eventsFromPopup[] = array();
|
642 |
}
|
643 |
|
644 |
$eventsFromPopup = apply_filters('sgpbPopupEventsMetadata', $eventsFromPopup);
|
779 |
|
780 |
public static function getPopupOptionsById($popupId, $saveMode = '')
|
781 |
{
|
782 |
+
$currentPost = get_post($popupId);
|
783 |
+
if ($currentPost->post_status == 'draft') {
|
784 |
+
$saveMode = '_preview';
|
785 |
+
}
|
786 |
$optionsData = array();
|
787 |
if (get_post_meta($popupId, 'sg_popup_options'.$saveMode, true)) {
|
788 |
$optionsData = get_post_meta($popupId, 'sg_popup_options'.$saveMode, true);
|
com/classes/popups/SubscriptionPopup.php
CHANGED
@@ -372,6 +372,14 @@ class SubscriptionPopup extends SGPopup
|
|
372 |
return $validateObj;
|
373 |
}
|
374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
$rules = 'rules: { ';
|
376 |
$messages = 'messages: { ';
|
377 |
|
@@ -507,6 +515,9 @@ class SubscriptionPopup extends SGPopup
|
|
507 |
{
|
508 |
$successMessage = $this->getOptionValue('sgpb-subs-success-message');
|
509 |
$errorMessage = $this->getOptionValue('sgpb-subs-error-message');
|
|
|
|
|
|
|
510 |
ob_start();
|
511 |
?>
|
512 |
<div class="subs-form-messages sgpb-alert sgpb-alert-success sg-hide-element">
|
372 |
return $validateObj;
|
373 |
}
|
374 |
|
375 |
+
if (empty($emailMessage)) {
|
376 |
+
$emailMessage = SGPB_SUBSCRIPTION_EMAIL_MESSAGE;
|
377 |
+
}
|
378 |
+
|
379 |
+
if (empty($requiredMessage)) {
|
380 |
+
$requiredMessage = SGPB_SUBSCRIPTION_VALIDATION_MESSAGE;
|
381 |
+
}
|
382 |
+
|
383 |
$rules = 'rules: { ';
|
384 |
$messages = 'messages: { ';
|
385 |
|
515 |
{
|
516 |
$successMessage = $this->getOptionValue('sgpb-subs-success-message');
|
517 |
$errorMessage = $this->getOptionValue('sgpb-subs-error-message');
|
518 |
+
if (empty($errorMessage)) {
|
519 |
+
$errorMessage = SGPB_SUBSCRIPTION_ERROR_MESSAGE;
|
520 |
+
}
|
521 |
ob_start();
|
522 |
?>
|
523 |
<div class="subs-form-messages sgpb-alert sgpb-alert-success sg-hide-element">
|
com/config/config.php
CHANGED
@@ -123,6 +123,10 @@ class SgpbPopupConfig
|
|
123 |
self::addDefine('SG_POPUP_AUTORESPONDER_POST_TYPE', 'sgpbautoresponder');
|
124 |
self::addDefine('SGPB_INACTIVE_EXTENSIONS', 'inactivePBExtensions');
|
125 |
self::addDefine('SGPB_POPUP_LICENSE_SCREEN', SG_POPUP_POST_TYPE.'_page_'.SGPB_POPUP_LICENSE);
|
|
|
|
|
|
|
|
|
126 |
self::popupTypesInit();
|
127 |
}
|
128 |
|
123 |
self::addDefine('SG_POPUP_AUTORESPONDER_POST_TYPE', 'sgpbautoresponder');
|
124 |
self::addDefine('SGPB_INACTIVE_EXTENSIONS', 'inactivePBExtensions');
|
125 |
self::addDefine('SGPB_POPUP_LICENSE_SCREEN', SG_POPUP_POST_TYPE.'_page_'.SGPB_POPUP_LICENSE);
|
126 |
+
|
127 |
+
self::addDefine('SGPB_SUBSCRIPTION_ERROR_MESSAGE', __('There was an error while trying to send your request. Please try again', SG_POPUP_TEXT_DOMAIN).'.');
|
128 |
+
self::addDefine('SGPB_SUBSCRIPTION_VALIDATION_MESSAGE', __('This field is required', SG_POPUP_TEXT_DOMAIN).'.');
|
129 |
+
self::addDefine('SGPB_SUBSCRIPTION_EMAIL_MESSAGE', __('Please enter a valid email address', SG_POPUP_TEXT_DOMAIN).'.');
|
130 |
self::popupTypesInit();
|
131 |
}
|
132 |
|
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.3');
|
7 |
define('SGPB_POPUP_PKG', SGPB_POPUP_PKG_FREE);
|
8 |
define('POPUP_BUILDER_BASENAME', 'popupbuilder-platinum/popup-builder.php');
|
com/config/dataConfig.php
CHANGED
@@ -505,7 +505,7 @@ class SgpbDataConfig
|
|
505 |
'key' => 'gamification',
|
506 |
'url' => SGPB_GAMIFICATION_PLUGIN_URL
|
507 |
);
|
508 |
-
|
509 |
'label' => __('Push Notification', SG_POPUP_TEXT_DOMAIN),
|
510 |
'pluginKey' => 'popupbuilder-push-notification/PopupBuilderPushNotification.php',
|
511 |
'key' => 'pushNotification',
|
@@ -688,7 +688,7 @@ class SgpbDataConfig
|
|
688 |
'operator' => array(
|
689 |
'select_behavior' => __('Select behavior', SG_POPUP_TEXT_DOMAIN),
|
690 |
__('Behaviors', SG_POPUP_TEXT_DOMAIN) => array(
|
691 |
-
'redirect-url' => __('Redirect to
|
692 |
'open-popup' => __('Open another popup', SG_POPUP_TEXT_DOMAIN),
|
693 |
'close-popup' => __('Close current popup', SG_POPUP_TEXT_DOMAIN)
|
694 |
)
|
@@ -887,7 +887,7 @@ class SgpbDataConfig
|
|
887 |
$options[] = array('name' => 'sgpb-subs-btn-progress-title', 'type' => 'text', 'defaultValue' => __('Please wait...', SG_POPUP_TEXT_DOMAIN));
|
888 |
$options[] = array('name' => 'sgpb-subs-btn-bg-color', 'type' => 'text', 'defaultValue' => '#4CAF50');
|
889 |
$options[] = array('name' => 'sgpb-subs-btn-text-color', 'type' => 'text', 'defaultValue' => '#FFFFFF');
|
890 |
-
$options[] = array('name' => 'sgpb-subs-error-message', 'type' => 'text', 'defaultValue' =>
|
891 |
$options[] = array('name' => 'sgpb-subs-invalid-message', 'type' => 'text', 'defaultValue' => __('Please enter a valid email address', SG_POPUP_TEXT_DOMAIN).'.');
|
892 |
$options[] = array('name' => 'sgpb-subs-success-behavior', 'type' => 'text', 'defaultValue' => 'showMessage');
|
893 |
$options[] = array('name' => 'sgpb-subs-success-message', 'type' => 'text', 'defaultValue' => __('You have successfully subscribed to the newsletter', SG_POPUP_TEXT_DOMAIN));
|
505 |
'key' => 'gamification',
|
506 |
'url' => SGPB_GAMIFICATION_PLUGIN_URL
|
507 |
);
|
508 |
+
$keys[] = array(
|
509 |
'label' => __('Push Notification', SG_POPUP_TEXT_DOMAIN),
|
510 |
'pluginKey' => 'popupbuilder-push-notification/PopupBuilderPushNotification.php',
|
511 |
'key' => 'pushNotification',
|
688 |
'operator' => array(
|
689 |
'select_behavior' => __('Select behavior', SG_POPUP_TEXT_DOMAIN),
|
690 |
__('Behaviors', SG_POPUP_TEXT_DOMAIN) => array(
|
691 |
+
'redirect-url' => __('Redirect to URL', SG_POPUP_TEXT_DOMAIN),
|
692 |
'open-popup' => __('Open another popup', SG_POPUP_TEXT_DOMAIN),
|
693 |
'close-popup' => __('Close current popup', SG_POPUP_TEXT_DOMAIN)
|
694 |
)
|
887 |
$options[] = array('name' => 'sgpb-subs-btn-progress-title', 'type' => 'text', 'defaultValue' => __('Please wait...', SG_POPUP_TEXT_DOMAIN));
|
888 |
$options[] = array('name' => 'sgpb-subs-btn-bg-color', 'type' => 'text', 'defaultValue' => '#4CAF50');
|
889 |
$options[] = array('name' => 'sgpb-subs-btn-text-color', 'type' => 'text', 'defaultValue' => '#FFFFFF');
|
890 |
+
$options[] = array('name' => 'sgpb-subs-error-message', 'type' => 'text', 'defaultValue' => SGPB_SUBSCRIPTION_ERROR_MESSAGE);
|
891 |
$options[] = array('name' => 'sgpb-subs-invalid-message', 'type' => 'text', 'defaultValue' => __('Please enter a valid email address', SG_POPUP_TEXT_DOMAIN).'.');
|
892 |
$options[] = array('name' => 'sgpb-subs-success-behavior', 'type' => 'text', 'defaultValue' => 'showMessage');
|
893 |
$options[] = array('name' => 'sgpb-subs-success-message', 'type' => 'text', 'defaultValue' => __('You have successfully subscribed to the newsletter', SG_POPUP_TEXT_DOMAIN));
|
com/helpers/AdminHelper.php
CHANGED
@@ -159,23 +159,23 @@ class AdminHelper
|
|
159 |
|
160 |
if (is_array($label)) {
|
161 |
$selectBox .= '<optgroup label="'.$value.'">';
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$selected = 'selected';
|
168 |
-
}
|
169 |
-
}
|
170 |
-
else if ($selectedValue == $key) {
|
171 |
-
$selected = 'selected';
|
172 |
-
}
|
173 |
-
else if (is_array($key) && in_array($selectedValue, $key)) {
|
174 |
$selected = 'selected';
|
175 |
}
|
176 |
-
|
177 |
-
$selectBox .= '<option value="'.$key.'" '.$selected.'>'.$optionLabel.'</option>';
|
178 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
$selectBox .= '</optgroup>';
|
180 |
}
|
181 |
else {
|
@@ -258,8 +258,8 @@ class AdminHelper
|
|
258 |
}
|
259 |
else {
|
260 |
$str .= '<div class="row form-group">';
|
261 |
-
|
262 |
-
|
263 |
$str .= '</div>';
|
264 |
}
|
265 |
}
|
@@ -323,14 +323,14 @@ class AdminHelper
|
|
323 |
$wpdb->query($prepareSql);
|
324 |
}
|
325 |
|
326 |
-
public static function subscribersRelatedQuery($query = '')
|
327 |
{
|
328 |
global $wpdb;
|
329 |
$subscribersTablename = $wpdb->prefix.SGPB_SUBSCRIBERS_TABLE_NAME;
|
330 |
$postsTablename = $wpdb->prefix.SGPB_POSTS_TABLE_NAME;
|
331 |
|
332 |
if ($query == '') {
|
333 |
-
$query = 'SELECT firstName, lastName, email, cDate, '.$postsTablename.'.post_title AS
|
334 |
}
|
335 |
$searchQuery = ' unsubscribed <> 1';
|
336 |
$filterCriteria = '';
|
@@ -487,7 +487,7 @@ class AdminHelper
|
|
487 |
if (!is_admin()) {
|
488 |
return true;
|
489 |
}
|
490 |
-
|
491 |
$savedUserRoles = self::getPopupPostAllowedUserRoles();
|
492 |
$currentUserRole = self::getCurrentUserRole();
|
493 |
if (!is_array($savedUserRoles) || !is_array($currentUserRole)) {
|
@@ -670,19 +670,19 @@ class AdminHelper
|
|
670 |
$extensions = self::getAllActiveExtensions();
|
671 |
ob_start();
|
672 |
?>
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
</div>
|
679 |
-
<ul class="sgpb-extensions-list">
|
680 |
-
<?php foreach ($extensions as $extensionName): ?>
|
681 |
-
<a target="_blank" href="https://popup-builder.com/forms/control-panel/"><li><?php echo $extensionName; ?></li></a>
|
682 |
-
<?php endforeach; ?>
|
683 |
-
</ul>
|
684 |
</div>
|
685 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
686 |
<?php
|
687 |
$content = ob_get_contents();
|
688 |
ob_get_clean();
|
@@ -1177,17 +1177,16 @@ class AdminHelper
|
|
1177 |
}
|
1178 |
add_action('admin_footer', function() use ($popupContent) {
|
1179 |
$popupId = 0;
|
1180 |
-
$popupOptions = array();
|
1181 |
$events = array(array('onload'));
|
1182 |
$events = json_encode($events);
|
1183 |
$popupContent = '<div style="position:absolute;top: -999999999999999999999px;">
|
1184 |
-
<div class="sg-popup-builder-content" id="sg-popup-content-wrapper-'.$popupId.'" data-id="'.esc_attr($popupId).'" data-events="'.esc_attr($events).'" data-options="
|
1185 |
<div class="sgpb-popup-builder-content-'.esc_attr($popupId).' sgpb-popup-builder-content-html">'.$popupContent.'</div>
|
1186 |
</div>
|
1187 |
</div>';
|
1188 |
|
1189 |
-
|
1190 |
-
|
1191 |
}
|
1192 |
|
1193 |
public static function shouldOpenForMaxOpenPopupMessage()
|
@@ -1539,7 +1538,7 @@ class AdminHelper
|
|
1539 |
* @since 3.1.9
|
1540 |
*
|
1541 |
* @return bool where true mean modified false mean there is not need modification
|
1542 |
-
|
1543 |
public static function makeRegisteredPluginsStaticPathsToDynamic()
|
1544 |
{
|
1545 |
$hasModifiedPaths = get_option('sgpbModifiedRegisteredPluginsPaths');
|
@@ -1621,4 +1620,33 @@ class AdminHelper
|
|
1621 |
|
1622 |
return $hasInactiveExtensions;
|
1623 |
}
|
1624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
if (is_array($label)) {
|
161 |
$selectBox .= '<optgroup label="'.$value.'">';
|
162 |
+
foreach ($label as $key => $optionLabel) {
|
163 |
+
$selected = '';
|
164 |
+
if (is_array($selectedValue)) {
|
165 |
+
$isSelected = in_array($key, $selectedValue);
|
166 |
+
if ($isSelected) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
$selected = 'selected';
|
168 |
}
|
|
|
|
|
169 |
}
|
170 |
+
else if ($selectedValue == $key) {
|
171 |
+
$selected = 'selected';
|
172 |
+
}
|
173 |
+
else if (is_array($key) && in_array($selectedValue, $key)) {
|
174 |
+
$selected = 'selected';
|
175 |
+
}
|
176 |
+
|
177 |
+
$selectBox .= '<option value="'.$key.'" '.$selected.'>'.$optionLabel.'</option>';
|
178 |
+
}
|
179 |
$selectBox .= '</optgroup>';
|
180 |
}
|
181 |
else {
|
258 |
}
|
259 |
else {
|
260 |
$str .= '<div class="row form-group">';
|
261 |
+
$str .= '<label class="col-md-5 control-label">'.__($element['title'], SG_POPUP_TEXT_DOMAIN).'</label>';
|
262 |
+
$str .= '<div class="col-sm-7"><input type="radio" name="'.esc_attr($name).'" value="'.esc_attr($value).'" '.$checked.' autocomplete="off"></div>';
|
263 |
$str .= '</div>';
|
264 |
}
|
265 |
}
|
323 |
$wpdb->query($prepareSql);
|
324 |
}
|
325 |
|
326 |
+
public static function subscribersRelatedQuery($query = '', $additionalColumn = '')
|
327 |
{
|
328 |
global $wpdb;
|
329 |
$subscribersTablename = $wpdb->prefix.SGPB_SUBSCRIBERS_TABLE_NAME;
|
330 |
$postsTablename = $wpdb->prefix.SGPB_POSTS_TABLE_NAME;
|
331 |
|
332 |
if ($query == '') {
|
333 |
+
$query = 'SELECT firstName, lastName, email, cDate, '.$additionalColumn.' '.$postsTablename.'.post_title AS subscriptionTitle FROM '.$subscribersTablename.' ';
|
334 |
}
|
335 |
$searchQuery = ' unsubscribed <> 1';
|
336 |
$filterCriteria = '';
|
487 |
if (!is_admin()) {
|
488 |
return true;
|
489 |
}
|
490 |
+
|
491 |
$savedUserRoles = self::getPopupPostAllowedUserRoles();
|
492 |
$currentUserRole = self::getCurrentUserRole();
|
493 |
if (!is_array($savedUserRoles) || !is_array($currentUserRole)) {
|
670 |
$extensions = self::getAllActiveExtensions();
|
671 |
ob_start();
|
672 |
?>
|
673 |
+
<p class="sgpb-extension-notice-close">x</p>
|
674 |
+
<div class="sgpb-extensions-list-wrapper">
|
675 |
+
<div class="sgpb-notice-header">
|
676 |
+
<h3><?php _e('Popup Builder plugin has been successfully updated', SG_POPUP_TEXT_DOMAIN); ?></h3>
|
677 |
+
<h4><?php _e('The following extensions need to be updated manually', SG_POPUP_TEXT_DOMAIN); ?></h4>
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
</div>
|
679 |
+
<ul class="sgpb-extensions-list">
|
680 |
+
<?php foreach ($extensions as $extensionName): ?>
|
681 |
+
<a target="_blank" href="https://popup-builder.com/forms/control-panel/"><li><?php echo $extensionName; ?></li></a>
|
682 |
+
<?php endforeach; ?>
|
683 |
+
</ul>
|
684 |
+
</div>
|
685 |
+
<p class="sgpb-extension-notice-dont-show"><?php _e('Don\'t show again', SG_POPUP_TEXT_DOMAIN)?></p>
|
686 |
<?php
|
687 |
$content = ob_get_contents();
|
688 |
ob_get_clean();
|
1177 |
}
|
1178 |
add_action('admin_footer', function() use ($popupContent) {
|
1179 |
$popupId = 0;
|
|
|
1180 |
$events = array(array('onload'));
|
1181 |
$events = json_encode($events);
|
1182 |
$popupContent = '<div style="position:absolute;top: -999999999999999999999px;">
|
1183 |
+
<div class="sg-popup-builder-content" id="sg-popup-content-wrapper-'.$popupId.'" data-id="'.esc_attr($popupId).'" data-events="'.esc_attr($events).'" data-options="">
|
1184 |
<div class="sgpb-popup-builder-content-'.esc_attr($popupId).' sgpb-popup-builder-content-html">'.$popupContent.'</div>
|
1185 |
</div>
|
1186 |
</div>';
|
1187 |
|
1188 |
+
echo $popupContent;
|
1189 |
+
});
|
1190 |
}
|
1191 |
|
1192 |
public static function shouldOpenForMaxOpenPopupMessage()
|
1538 |
* @since 3.1.9
|
1539 |
*
|
1540 |
* @return bool where true mean modified false mean there is not need modification
|
1541 |
+
*/
|
1542 |
public static function makeRegisteredPluginsStaticPathsToDynamic()
|
1543 |
{
|
1544 |
$hasModifiedPaths = get_option('sgpbModifiedRegisteredPluginsPaths');
|
1620 |
|
1621 |
return $hasInactiveExtensions;
|
1622 |
}
|
1623 |
+
|
1624 |
+
public static function getSubscriberDataById($id)
|
1625 |
+
{
|
1626 |
+
global $wpdb;
|
1627 |
+
$result = $wpdb->get_row('SELECT * FROM '.$wpdb->prefix.SGPB_SUBSCRIBERS_TABLE_NAME.' WHERE id='.$id, ARRAY_A);
|
1628 |
+
|
1629 |
+
return $result;
|
1630 |
+
}
|
1631 |
+
|
1632 |
+
public static function getSubscriptionColumnsById($id)
|
1633 |
+
{
|
1634 |
+
$popup = SGPopup::find($id);
|
1635 |
+
if (empty($popup) || !is_object($popup)) {
|
1636 |
+
return array();
|
1637 |
+
}
|
1638 |
+
$freeSavedOptions = $popup->getOptionValue('sgpb-subs-fields');
|
1639 |
+
|
1640 |
+
if (!empty($freeSavedOptions)) {
|
1641 |
+
return array('firstName' => 'First name','lastName' => 'Last name', 'email' => 'Email', 'date' => 'Date');
|
1642 |
+
}
|
1643 |
+
$formFieldsJson = $popup->getOptionValue('sgpb-subscription-fields-json');
|
1644 |
+
if (!empty($formFieldsJson)) {
|
1645 |
+
$data = apply_filters('sgpbGetSubscriptionLabels', array(), $popup);
|
1646 |
+
$data['date'] = 'Date';
|
1647 |
+
return $data;
|
1648 |
+
}
|
1649 |
+
|
1650 |
+
return array();
|
1651 |
+
}
|
1652 |
+
}
|
com/helpers/ConfigDataHelper.php
CHANGED
@@ -289,6 +289,71 @@ class ConfigDataHelper
|
|
289 |
)
|
290 |
);
|
291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
$data['popupDimensions'] = array(
|
293 |
'template' => array(
|
294 |
'fieldWrapperAttr' => array(
|
@@ -580,7 +645,7 @@ class ConfigDataHelper
|
|
580 |
'value' => 'redirectToURL'
|
581 |
),
|
582 |
'label' => array(
|
583 |
-
'name' => __('Redirect to
|
584 |
)
|
585 |
),
|
586 |
array(
|
@@ -676,7 +741,7 @@ class ConfigDataHelper
|
|
676 |
'value' => 'redirectToURL'
|
677 |
),
|
678 |
'label' => array(
|
679 |
-
'name' => __('Redirect to
|
680 |
)
|
681 |
),
|
682 |
array(
|
289 |
)
|
290 |
);
|
291 |
|
292 |
+
$data['htmlCustomButtonArgs'] = array(
|
293 |
+
'template' => array(
|
294 |
+
'fieldWrapperAttr' => array(
|
295 |
+
'class' => 'col-md-6 sgpb-choice-option-wrapper'
|
296 |
+
),
|
297 |
+
'labelAttr' => array(
|
298 |
+
'class' => 'col-md-6 sgpb-choice-option-wrapper sgpb-sub-option-label'
|
299 |
+
),
|
300 |
+
'groupWrapperAttr' => array(
|
301 |
+
'class' => 'row form-group sgpb-choice-wrapper'
|
302 |
+
)
|
303 |
+
),
|
304 |
+
'buttonPosition' => 'right',
|
305 |
+
'nextNewLine' => true,
|
306 |
+
'fields' => array(
|
307 |
+
array(
|
308 |
+
'attr' => array(
|
309 |
+
'type' => 'radio',
|
310 |
+
'name' => 'sgpb-custom-button',
|
311 |
+
'class' => 'custom-button-copy-to-clipboard',
|
312 |
+
'data-attr-href' => 'sgpb-custom-button-copy',
|
313 |
+
'value' => 'copyToClipBoard'
|
314 |
+
),
|
315 |
+
'label' => array(
|
316 |
+
'name' => __('Copy to clipboard', SG_POPUP_TEXT_DOMAIN).':'
|
317 |
+
)
|
318 |
+
),
|
319 |
+
array(
|
320 |
+
'attr' => array(
|
321 |
+
'type' => 'radio',
|
322 |
+
'name' => 'sgpb-custom-button',
|
323 |
+
'class' => 'custom-button-copy-to-clipboard',
|
324 |
+
'data-attr-href' => 'sgpb-custom-button-redirect-to-URL',
|
325 |
+
'value' => 'redirectToURL'
|
326 |
+
),
|
327 |
+
'label' => array(
|
328 |
+
'name' => __('Redirect to URL', SG_POPUP_TEXT_DOMAIN).':'
|
329 |
+
)
|
330 |
+
),
|
331 |
+
array(
|
332 |
+
'attr' => array(
|
333 |
+
'type' => 'radio',
|
334 |
+
'name' => 'sgpb-custom-button',
|
335 |
+
'class' => 'subs-success-open-popup',
|
336 |
+
'data-attr-href' => 'sgpb-custom-button-open-popup',
|
337 |
+
'value' => 'openPopup'
|
338 |
+
),
|
339 |
+
'label' => array(
|
340 |
+
'name' => __('Open popup', SG_POPUP_TEXT_DOMAIN).':'
|
341 |
+
)
|
342 |
+
),
|
343 |
+
array(
|
344 |
+
'attr' => array(
|
345 |
+
'type' => 'radio',
|
346 |
+
'name' => 'sgpb-custom-button',
|
347 |
+
'class' => 'sgpb-custom-button-hide-popup',
|
348 |
+
'value' => 'hidePopup'
|
349 |
+
),
|
350 |
+
'label' => array(
|
351 |
+
'name' => __('Hide popup', SG_POPUP_TEXT_DOMAIN).':'
|
352 |
+
)
|
353 |
+
)
|
354 |
+
)
|
355 |
+
);
|
356 |
+
|
357 |
$data['popupDimensions'] = array(
|
358 |
'template' => array(
|
359 |
'fieldWrapperAttr' => array(
|
645 |
'value' => 'redirectToURL'
|
646 |
),
|
647 |
'label' => array(
|
648 |
+
'name' => __('Redirect to URL', SG_POPUP_TEXT_DOMAIN).':'
|
649 |
)
|
650 |
),
|
651 |
array(
|
741 |
'value' => 'redirectToURL'
|
742 |
),
|
743 |
'label' => array(
|
744 |
+
'name' => __('Redirect to URL', SG_POPUP_TEXT_DOMAIN).':'
|
745 |
)
|
746 |
),
|
747 |
array(
|
languages/popupBuilder.pot
CHANGED
@@ -674,7 +674,7 @@ msgstr ""
|
|
674 |
|
675 |
#: com/config/dataConfig.php:659 com/helpers/ConfigDataHelper.php:525
|
676 |
#: com/helpers/ConfigDataHelper.php:632
|
677 |
-
msgid "Redirect to
|
678 |
msgstr ""
|
679 |
|
680 |
#: com/config/dataConfig.php:660
|
674 |
|
675 |
#: com/config/dataConfig.php:659 com/helpers/ConfigDataHelper.php:525
|
676 |
#: com/helpers/ConfigDataHelper.php:632
|
677 |
+
msgid "Redirect to URL"
|
678 |
msgstr ""
|
679 |
|
680 |
#: com/config/dataConfig.php:660
|
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.3
|
7 |
* Author: Sygnoos
|
8 |
* Author URI: https://sygnoos.com
|
9 |
* License: GPLv2
|
public/css/popupAdminStyles.css
CHANGED
@@ -14,6 +14,10 @@
|
|
14 |
float: right;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
17 |
.sgpb-popup-content-direction-right .sgpb-contact-admin-wrapper,
|
18 |
.sgpb-popup-content-direction-right .sgpb-subscription-admin-wrapper,
|
19 |
.sgpb-forms-preview-direction,
|
@@ -1107,6 +1111,7 @@ input:checked + .sgpb-slider:before {
|
|
1107 |
/* Subscribers page view */
|
1108 |
#sgpb-subscriber-data,
|
1109 |
#sgpb-add-new-subscriber,
|
|
|
1110 |
#sgpb-export-subscribers {
|
1111 |
position: fixed;
|
1112 |
top:0;
|
@@ -1149,7 +1154,8 @@ input:checked + .sgpb-slider:before {
|
|
1149 |
overflow: auto;
|
1150 |
}
|
1151 |
|
1152 |
-
.sgpb-add-subscriber-popup-btns
|
|
|
1153 |
width: 100%;
|
1154 |
}
|
1155 |
|
@@ -1551,6 +1557,14 @@ input:checked + .sgpb-slider:before {
|
|
1551 |
display: none;
|
1552 |
}
|
1553 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1554 |
.sgpb-insert-popup-title-border {
|
1555 |
width: 100%;
|
1556 |
height: 1px;
|
@@ -2214,3 +2228,29 @@ input:checked + .sgpb-slider:before {
|
|
2214 |
font-style: italic;
|
2215 |
font-weight: lighter;
|
2216 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
float: right;
|
15 |
}
|
16 |
|
17 |
+
.sgpb-clear {
|
18 |
+
clear: both;
|
19 |
+
}
|
20 |
+
|
21 |
.sgpb-popup-content-direction-right .sgpb-contact-admin-wrapper,
|
22 |
.sgpb-popup-content-direction-right .sgpb-subscription-admin-wrapper,
|
23 |
.sgpb-forms-preview-direction,
|
1111 |
/* Subscribers page view */
|
1112 |
#sgpb-subscriber-data,
|
1113 |
#sgpb-add-new-subscriber,
|
1114 |
+
.sgpb-subscribers-popup,
|
1115 |
#sgpb-export-subscribers {
|
1116 |
position: fixed;
|
1117 |
top:0;
|
1154 |
overflow: auto;
|
1155 |
}
|
1156 |
|
1157 |
+
.sgpb-add-subscriber-popup-btns,
|
1158 |
+
.sgpb-subscriber-popup-btns {
|
1159 |
width: 100%;
|
1160 |
}
|
1161 |
|
1557 |
display: none;
|
1558 |
}
|
1559 |
|
1560 |
+
#sgpb-custom-button-wrapper .col-md-6 .select2.select2-container:nth-child(n+3) {
|
1561 |
+
display: none;
|
1562 |
+
}
|
1563 |
+
|
1564 |
+
#sgpb-custom-button-wrapper {
|
1565 |
+
overflow-x: hidden;
|
1566 |
+
}
|
1567 |
+
|
1568 |
.sgpb-insert-popup-title-border {
|
1569 |
width: 100%;
|
1570 |
height: 1px;
|
2228 |
font-style: italic;
|
2229 |
font-weight: lighter;
|
2230 |
}
|
2231 |
+
|
2232 |
+
.sgpb-file-settings-available-wrapper,
|
2233 |
+
.sgpb-label-config-left {
|
2234 |
+
border-right: 1px solid #CCCCCC;
|
2235 |
+
}
|
2236 |
+
|
2237 |
+
.sgpb-file-settings-label {
|
2238 |
+
text-align: center;
|
2239 |
+
}
|
2240 |
+
|
2241 |
+
.sgpb-to-center-window {
|
2242 |
+
position: absolute;
|
2243 |
+
left: 50%;
|
2244 |
+
top: 50%;
|
2245 |
+
transform: translate(-50%, -50%);
|
2246 |
+
}
|
2247 |
+
|
2248 |
+
.sgpb-import-subscribers-close {
|
2249 |
+
margin-right: -8px !important;
|
2250 |
+
}
|
2251 |
+
|
2252 |
+
.sgpb-custom-button-close-popup {
|
2253 |
+
position: absolute;
|
2254 |
+
right: -3px;
|
2255 |
+
top: 6px;
|
2256 |
+
}
|
public/js/Backend.js
CHANGED
@@ -76,6 +76,174 @@ SGPBBackend.prototype.sgInit = function()
|
|
76 |
this.closeAnimationPreview();
|
77 |
this.resetToDefaultValue();
|
78 |
this.editPopupSettingsForFullscreenMode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
};
|
80 |
|
81 |
SGPBBackend.prototype.resetToDefaultValue = function()
|
@@ -301,6 +469,7 @@ SGPBBackend.prototype.multipleChoiceButton = function()
|
|
301 |
jQuery(this).on("click", function() {
|
302 |
that.hideAllChoiceWrapper(jQuery('.sgpb-choice-option-wrapper'));
|
303 |
that.buildChoiceShowOption(jQuery(this));
|
|
|
304 |
});
|
305 |
})
|
306 |
};
|
@@ -1380,10 +1549,14 @@ SGPBBackend.prototype.changeColor = function(element)
|
|
1380 |
SGPBBackend.prototype.previewInit = function()
|
1381 |
{
|
1382 |
jQuery('#post-preview').click(function() {
|
|
|
1383 |
/* when preview button clicked, set input value to 1 */
|
1384 |
jQuery('#sgpb-is-preview').val('1');
|
1385 |
var popupId = jQuery('#post_ID').val();
|
1386 |
});
|
|
|
|
|
|
|
1387 |
jQuery('#publish').click(function() {
|
1388 |
/* when bublish/update clicked, set input value to 0 */
|
1389 |
jQuery('#sgpb-is-preview').val('0');
|
@@ -1418,20 +1591,6 @@ SGPBBackend.makeContactAndSubscriptionFieldsRequired = function()
|
|
1418 |
|
1419 |
SGPBBackend.prototype.makePopupTitleRequired = function()
|
1420 |
{
|
1421 |
-
var editModeBtn = jQuery('#elementor-switch-mode-button');
|
1422 |
-
if (editModeBtn.length) {
|
1423 |
-
if (!SGPBBackend.getParamFromUrl('post')) {
|
1424 |
-
editModeBtn.attr('disabled', 'disabled');
|
1425 |
-
editModeBtn.after('<p class="sgpb-text-warning">'+SGPB_JS_LOCALIZATION.publishPopupBeforeElementor+'</p>');
|
1426 |
-
}
|
1427 |
-
}
|
1428 |
-
var editModeBtn = jQuery('#et_pb_toggle_builder');
|
1429 |
-
if (editModeBtn.length) {
|
1430 |
-
if (!SGPBBackend.getParamFromUrl('post')) {
|
1431 |
-
editModeBtn.hide();
|
1432 |
-
editModeBtn.after('<p class="sgpb-text-warning">'+SGPB_JS_LOCALIZATION.publishPopupBeforeDivi+'</p>');
|
1433 |
-
}
|
1434 |
-
}
|
1435 |
if (jQuery('#title').length) {
|
1436 |
var postType = jQuery('#post_type');
|
1437 |
if (postType.length && postType.val() == 'popupbuilder') {
|
@@ -1604,6 +1763,20 @@ SGPBBackend.resetCount = function(popupId)
|
|
1604 |
}
|
1605 |
};
|
1606 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1607 |
jQuery(document).ready(function() {
|
1608 |
var sgpbBackendObj = new SGPBBackend();
|
1609 |
sgpbBackendObj.sgInit();
|
76 |
this.closeAnimationPreview();
|
77 |
this.resetToDefaultValue();
|
78 |
this.editPopupSettingsForFullscreenMode();
|
79 |
+
this.autosave();
|
80 |
+
this.popupBuilderButton();
|
81 |
+
};
|
82 |
+
|
83 |
+
SGPBBackend.prototype.popupBuilderButton = function()
|
84 |
+
{
|
85 |
+
var that = this;
|
86 |
+
jQuery(document).on('tinymce-editor-setup', function( event, editor ) {
|
87 |
+
if (editor.settings.toolbar1.indexOf('popupBuilderHtmlButton') != -1) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
editor.settings.toolbar1 += ', popupBuilderHtmlButton';
|
91 |
+
editor.addButton('popupBuilderHtmlButton', {
|
92 |
+
text: 'Popup Builder Custom Button',
|
93 |
+
onclick: function () {
|
94 |
+
that.mediaButtonPopup('sgpb-custom-button-wrapper');
|
95 |
+
}
|
96 |
+
});
|
97 |
+
});
|
98 |
+
};
|
99 |
+
|
100 |
+
SGPBBackend.popups = [];
|
101 |
+
|
102 |
+
SGPBBackend.prototype.mediaButtonPopup = function(hiddenDivId)
|
103 |
+
{
|
104 |
+
var select2Init = 1;
|
105 |
+
var that = this;
|
106 |
+
var popupConfigObj = new PopupConfig();
|
107 |
+
popupConfigObj.magicCall('setContentPadding', 14);
|
108 |
+
popupConfigObj.magicCall('setContentBorderRadius', 4);
|
109 |
+
popupConfigObj.magicCall('setContentBorderRadiusType', 'px');
|
110 |
+
popupConfigObj.magicCall('setScrollingEnabled', true);
|
111 |
+
popupConfigObj.magicCall('setContentBorderWidth', 5);
|
112 |
+
popupConfigObj.magicCall('setContentBorderColor', '#506274');
|
113 |
+
popupConfigObj.magicCall('setShadowSpread', 1);
|
114 |
+
popupConfigObj.magicCall('setContentShadowBlur', 4);
|
115 |
+
popupConfigObj.magicCall('setContentShadowColor', '#cccccc');
|
116 |
+
popupConfigObj.magicCall('setMinWidth', 400);
|
117 |
+
popupConfigObj.magicCall('contents', document.getElementById(hiddenDivId));
|
118 |
+
popupConfigObj.magicCall('setOverlayColor', 'black');
|
119 |
+
popupConfigObj.magicCall('setOverlayOpacity', 40);
|
120 |
+
var config = popupConfigObj.combineConfigObj();
|
121 |
+
var popup = new SGPopup(config);
|
122 |
+
if (!SGPBBackend.popups.length) {
|
123 |
+
SGPBBackend.popups.push(popup);
|
124 |
+
}
|
125 |
+
SGPBBackend.popups[0].open();
|
126 |
+
jQuery(window).bind('sgpbDidOpen', function() {
|
127 |
+
jQuery('.sgpb-insert-popup').addClass('js-sg-select2');
|
128 |
+
/* one select box for inside popup shortcode */
|
129 |
+
if (select2Init == 1) {
|
130 |
+
that.popupSelect2();
|
131 |
+
}
|
132 |
+
select2Init++;
|
133 |
+
jQuery('.select2-container--below').remove();
|
134 |
+
that.popupSelect2();
|
135 |
+
that.customButtonColorPicker();
|
136 |
+
|
137 |
+
if (mediaButtonParams.currentPostType != mediaButtonParams.popupBuilderPostType) {
|
138 |
+
that.customButtonColorPicker();
|
139 |
+
jQuery('.sgpb-custom-button-popup').addClass('js-sg-select2');
|
140 |
+
if (select2Init == 1) {
|
141 |
+
that.popupSelect2();
|
142 |
+
}
|
143 |
+
select2Init++;
|
144 |
+
jQuery('.select2-container--below').remove();
|
145 |
+
that.popupSelect2();
|
146 |
+
}
|
147 |
+
else {
|
148 |
+
that.multipleChoiceButton();
|
149 |
+
that.customButtonColorPicker();
|
150 |
+
}
|
151 |
+
|
152 |
+
that.insertHTMLButtonToEditor();
|
153 |
+
that.closeMediaButtonPopup(popup);
|
154 |
+
});
|
155 |
+
|
156 |
+
that.accordion();
|
157 |
+
jQuery(window).on('sgpbMultichoiceChanged', function() {
|
158 |
+
that.accordion();
|
159 |
+
});
|
160 |
+
};
|
161 |
+
|
162 |
+
SGPBBackend.prototype.customButtonColorPicker = function()
|
163 |
+
{
|
164 |
+
var that = this;
|
165 |
+
var colorPicker = jQuery('.sgpb-custom-button-color-picker');
|
166 |
+
if (!colorPicker.length) {
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
colorPicker.wpColorPicker({
|
170 |
+
change: function() {
|
171 |
+
var colorPickerElement = jQuery(this);
|
172 |
+
that.changeColor(colorPickerElement);
|
173 |
+
}
|
174 |
+
});
|
175 |
+
jQuery('.wp-picker-holder').bind('click', function() {
|
176 |
+
var selectedInput = jQuery(this).prev().find('.sgpb-color-picker');
|
177 |
+
that.changeColor(selectedInput);
|
178 |
+
});
|
179 |
+
};
|
180 |
+
|
181 |
+
|
182 |
+
SGPBBackend.prototype.insertHTMLButtonToEditor = function()
|
183 |
+
{
|
184 |
+
jQuery('.sgpb-insert-custom-button-to-editor').unbind('click').bind('click', function () {
|
185 |
+
var buttonTitle = jQuery('#sgpb-custom-btn-title').val();
|
186 |
+
var style = '';
|
187 |
+
jQuery('.sgpb-custom-button-settings').each(function() {
|
188 |
+
var styleType = jQuery(this).data('style-type');
|
189 |
+
var val = jQuery(this).val();
|
190 |
+
style += styleType+': '+val+';';
|
191 |
+
});
|
192 |
+
var defaultStyles = {
|
193 |
+
padding: 0,
|
194 |
+
'font-size': '22px',
|
195 |
+
'font-weight': 900
|
196 |
+
};
|
197 |
+
|
198 |
+
for (var styleType in defaultStyles) {
|
199 |
+
style += styleType+': '+defaultStyles[styleType]+';';
|
200 |
+
}
|
201 |
+
|
202 |
+
|
203 |
+
var serizlizedOption = jQuery('#sgpb-custom-button-wrapper').find('select,textarea, input');
|
204 |
+
var allOptionsObj = {};
|
205 |
+
|
206 |
+
serizlizedOption.each(function() {
|
207 |
+
var name = jQuery(this).attr('name');
|
208 |
+
if (jQuery(this).attr('type') == 'checkbox') {
|
209 |
+
if (jQuery(this).is(':checked')) {
|
210 |
+
var value = jQuery(this).val();
|
211 |
+
allOptionsObj[name] = value;
|
212 |
+
}
|
213 |
+
return true;
|
214 |
+
}
|
215 |
+
if (jQuery(this).attr('type') == 'radio') {
|
216 |
+
if (jQuery(this).is(':checked')) {
|
217 |
+
var value = jQuery(this).val();
|
218 |
+
allOptionsObj[name] = value;
|
219 |
+
}
|
220 |
+
}
|
221 |
+
else {
|
222 |
+
var value = jQuery(this).val();
|
223 |
+
allOptionsObj[name] = value;
|
224 |
+
}
|
225 |
+
});
|
226 |
+
var bgColor = allOptionsObj['sgpb-custom-btn-bg-color'];
|
227 |
+
var hoverBgColor = allOptionsObj['sgpb-custom-btn-bg-color'];
|
228 |
+
|
229 |
+
var allOptionsJson = encodeURI(JSON.stringify(allOptionsObj));
|
230 |
+
var id = Math.floor(Math.random() * Math.floor(100000));
|
231 |
+
|
232 |
+
var button = '<button style="'+style+'" class="sgpb-html-custom-button sgpb-html-custom-button-'+id+'" data-options='+allOptionsJson+' onMouseOver="this.style.backgroundColor="'+hoverBgColor+'" onMouseOut="this.style.backgroundColor="'+bgColor+'" ">'+buttonTitle+'</button>';
|
233 |
+
button += '<style>.sgpb-html-custom-button-'+id+':hover {background-color: '+hoverBgColor+' !important;}</style>';
|
234 |
+
if (allOptionsObj['sgpb-custom-button'] == 'openPopup') {
|
235 |
+
var currentPopupId = allOptionsObj['sgpb-custom-button-popup'];
|
236 |
+
button = '[sg_popup id="'+currentPopupId+'" insidePopup="on"] <br>'+button+'<br>[/sg_popup]';
|
237 |
+
}
|
238 |
+
window.send_to_editor(button);
|
239 |
+
});
|
240 |
+
};
|
241 |
+
|
242 |
+
SGPBBackend.prototype.closeMediaButtonPopup = function(popup)
|
243 |
+
{
|
244 |
+
jQuery('.sgpb-close-media-popup-js').on('click', function() {
|
245 |
+
popup.close();
|
246 |
+
});
|
247 |
};
|
248 |
|
249 |
SGPBBackend.prototype.resetToDefaultValue = function()
|
469 |
jQuery(this).on("click", function() {
|
470 |
that.hideAllChoiceWrapper(jQuery('.sgpb-choice-option-wrapper'));
|
471 |
that.buildChoiceShowOption(jQuery(this));
|
472 |
+
jQuery(window).trigger('sgpbMultichoiceChanged');
|
473 |
});
|
474 |
})
|
475 |
};
|
1549 |
SGPBBackend.prototype.previewInit = function()
|
1550 |
{
|
1551 |
jQuery('#post-preview').click(function() {
|
1552 |
+
SGPBBackend.prototype.autosave();
|
1553 |
/* when preview button clicked, set input value to 1 */
|
1554 |
jQuery('#sgpb-is-preview').val('1');
|
1555 |
var popupId = jQuery('#post_ID').val();
|
1556 |
});
|
1557 |
+
jQuery('#title').on('change', function() {
|
1558 |
+
SGPBBackend.prototype.autosave();
|
1559 |
+
});
|
1560 |
jQuery('#publish').click(function() {
|
1561 |
/* when bublish/update clicked, set input value to 0 */
|
1562 |
jQuery('#sgpb-is-preview').val('0');
|
1591 |
|
1592 |
SGPBBackend.prototype.makePopupTitleRequired = function()
|
1593 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1594 |
if (jQuery('#title').length) {
|
1595 |
var postType = jQuery('#post_type');
|
1596 |
if (postType.length && postType.val() == 'popupbuilder') {
|
1763 |
}
|
1764 |
};
|
1765 |
|
1766 |
+
SGPBBackend.prototype.autosave = function()
|
1767 |
+
{
|
1768 |
+
var allPopupData = jQuery('form#post').serializeArray();
|
1769 |
+
var data = {
|
1770 |
+
nonce: SGPB_JS_PARAMS.nonce,
|
1771 |
+
action: 'sgpb_autosave',
|
1772 |
+
allPopupData: allPopupData
|
1773 |
+
};
|
1774 |
+
|
1775 |
+
jQuery.post(ajaxurl, data, function(response) {
|
1776 |
+
/*success*/
|
1777 |
+
});
|
1778 |
+
};
|
1779 |
+
|
1780 |
jQuery(document).ready(function() {
|
1781 |
var sgpbBackendObj = new SGPBBackend();
|
1782 |
sgpbBackendObj.sgInit();
|
public/js/MediaButton.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
function SGPBMediaButton(){}
|
2 |
SGPBMediaButton.prototype.init=function()
|
3 |
{this.tinymceButton();this.openMediaButtonPopup();this.openAskReviewBannerPopup();};SGPBMediaButton.prototype.tinymceButton=function()
|
4 |
-
{var that=this;jQuery(document).on('tinymce-editor-setup',function(event,editor){editor.settings.toolbar1
|
|
|
5 |
{var that=this;jQuery('.sgpb-tinymce-button, .sgpb-insert-media-button-js, .sgpb-insert-js-variable').unbind('click').bind('click',function(e){e.preventDefault();that.mediaButtonPopup(jQuery(this));});};SGPBMediaButton.prototype.mediaButtonPopup=function(currentTag)
|
6 |
{var select2Init=1;var that=this;var hiddenDivId=jQuery(currentTag).attr('data-id')||'sgpb-hidden-media-popup';var popupConfigObj=new PopupConfig();popupConfigObj.magicCall('setContentPadding',14);popupConfigObj.magicCall('setContentBorderRadius',4);popupConfigObj.magicCall('setContentBorderRadiusType','px');popupConfigObj.magicCall('setContentBorderWidth',5);popupConfigObj.magicCall('setContentBorderColor','#506274');popupConfigObj.magicCall('setShadowSpread',1);popupConfigObj.magicCall('setContentShadowBlur',4);popupConfigObj.magicCall('setContentShadowColor','#cccccc');popupConfigObj.magicCall('setMinWidth',400);popupConfigObj.magicCall('setSrcElement',hiddenDivId);popupConfigObj.magicCall('setOverlayColor','black');popupConfigObj.magicCall('setOverlayOpacity',40);var config=popupConfigObj.combineConfigObj();var popup=new SGPopup(config);popup.open();jQuery(window).bind('sgpbDidOpen',function(){jQuery('.sgpb-insert-popup').addClass('js-sg-select2');if(mediaButtonParams.currentPostType!=mediaButtonParams.popupBuilderPostType){jQuery('.sgpb-insert-popup-event').addClass('js-sg-select2');if(select2Init==1){that.popupSelect2();}
|
7 |
select2Init++;jQuery('.select2-container--below').remove();that.popupSelect2();}
|
1 |
function SGPBMediaButton(){}
|
2 |
SGPBMediaButton.prototype.init=function()
|
3 |
{this.tinymceButton();this.openMediaButtonPopup();this.openAskReviewBannerPopup();};SGPBMediaButton.prototype.tinymceButton=function()
|
4 |
+
{var that=this;jQuery(document).on('tinymce-editor-setup',function(event,editor){if(editor.settings.toolbar1.indexOf('popupBuilderEditorButton')!=-1){return;}
|
5 |
+
editor.settings.toolbar1+=', popupBuilderEditorButton';editor.addButton('popupBuilderEditorButton',{icon:'wp-menu-image dashicons-before dashicons-menu-icon-sgpb sgpb-tinymce-button',onclick:function(){that.mediaButtonPopup();}});});};SGPBMediaButton.prototype.openMediaButtonPopup=function()
|
6 |
{var that=this;jQuery('.sgpb-tinymce-button, .sgpb-insert-media-button-js, .sgpb-insert-js-variable').unbind('click').bind('click',function(e){e.preventDefault();that.mediaButtonPopup(jQuery(this));});};SGPBMediaButton.prototype.mediaButtonPopup=function(currentTag)
|
7 |
{var select2Init=1;var that=this;var hiddenDivId=jQuery(currentTag).attr('data-id')||'sgpb-hidden-media-popup';var popupConfigObj=new PopupConfig();popupConfigObj.magicCall('setContentPadding',14);popupConfigObj.magicCall('setContentBorderRadius',4);popupConfigObj.magicCall('setContentBorderRadiusType','px');popupConfigObj.magicCall('setContentBorderWidth',5);popupConfigObj.magicCall('setContentBorderColor','#506274');popupConfigObj.magicCall('setShadowSpread',1);popupConfigObj.magicCall('setContentShadowBlur',4);popupConfigObj.magicCall('setContentShadowColor','#cccccc');popupConfigObj.magicCall('setMinWidth',400);popupConfigObj.magicCall('setSrcElement',hiddenDivId);popupConfigObj.magicCall('setOverlayColor','black');popupConfigObj.magicCall('setOverlayOpacity',40);var config=popupConfigObj.combineConfigObj();var popup=new SGPopup(config);popup.open();jQuery(window).bind('sgpbDidOpen',function(){jQuery('.sgpb-insert-popup').addClass('js-sg-select2');if(mediaButtonParams.currentPostType!=mediaButtonParams.popupBuilderPostType){jQuery('.sgpb-insert-popup-event').addClass('js-sg-select2');if(select2Init==1){that.popupSelect2();}
|
8 |
select2Init++;jQuery('.select2-container--below').remove();that.popupSelect2();}
|
public/js/PopupBuilder.js
CHANGED
@@ -55,6 +55,59 @@ function SGPBPopup()
|
|
55 |
};
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
SGPBPopup.listeners = function () {
|
59 |
var that = this;
|
60 |
|
@@ -63,6 +116,7 @@ SGPBPopup.listeners = function () {
|
|
63 |
});
|
64 |
|
65 |
sgAddEvent(window, 'sgpbDidOpen', function(e) {
|
|
|
66 |
SGPBPopup.mobileSafariAdditionalSettings(e);
|
67 |
var args = e.detail;
|
68 |
var popupOptions = args.popupData;
|
@@ -75,6 +129,11 @@ SGPBPopup.listeners = function () {
|
|
75 |
obj.addToCounter(popupOptions);
|
76 |
}
|
77 |
}
|
|
|
|
|
|
|
|
|
|
|
78 |
});
|
79 |
|
80 |
setInterval(function() {
|
@@ -464,6 +523,29 @@ SGPBPopup.prototype.forceCheckCurrentPopupType = function(popupObj)
|
|
464 |
}
|
465 |
}
|
466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
return allowToOpen;
|
468 |
};
|
469 |
|
@@ -519,6 +601,7 @@ SGPBPopup.prototype.checkCurrentPopupType = function()
|
|
519 |
|
520 |
SGPBPopup.prototype.forceIsAllowJsConditions = function(popupObj) {
|
521 |
var conditions = SGPB_POPUP_PARAMS.conditionalJsClasses;
|
|
|
522 |
var isAllow = true;
|
523 |
|
524 |
for (var i in conditions) {
|
@@ -1187,10 +1270,6 @@ SGPBPopup.prototype.popupTriggeringListeners = function()
|
|
1187 |
that.formSubmissionDetection(args);
|
1188 |
var popupOptions = args.popupData;
|
1189 |
|
1190 |
-
if (popupOptions['sgpb-show-popup-same-user']) {
|
1191 |
-
that.setPopupLimitationCookie(popupOptions);
|
1192 |
-
}
|
1193 |
-
|
1194 |
var closeButtonDelay = parseInt(popupOptions['sgpb-close-button-delay']);
|
1195 |
if (closeButtonDelay) {
|
1196 |
that.closeButtonDisplay(popupOptions['sgpb-post-id'], 'show', closeButtonDelay);
|
@@ -1255,7 +1334,7 @@ SGPBPopup.prototype.sgpbDontShowPopup = function(popupId)
|
|
1255 |
|
1256 |
SGPBPopup.prototype.addToCounter = function(popupOptions)
|
1257 |
{
|
1258 |
-
if (SGPB_POPUP_PARAMS.isPreview
|
1259 |
return false;
|
1260 |
}
|
1261 |
var that = this;
|
@@ -2253,6 +2332,11 @@ SgpbEventListener.prototype.eventListener = function(eventData)
|
|
2253 |
eventName = 'sgpb'+eventName;
|
2254 |
popupObj.eventName = eventName;
|
2255 |
|
|
|
|
|
|
|
|
|
|
|
2256 |
try {
|
2257 |
eval('this.'+eventName)(this, eventData);
|
2258 |
}
|
@@ -2389,9 +2473,13 @@ SgpbEventListener.prototype.sgpbClick = function(listenerObj, eventData)
|
|
2389 |
}
|
2390 |
|
2391 |
jQuery(this).bind('click', function(e) {
|
2392 |
-
e.preventDefault();
|
2393 |
if (clickCount > 1) {
|
2394 |
-
return
|
|
|
|
|
|
|
|
|
|
|
2395 |
}
|
2396 |
++clickCount;
|
2397 |
jQuery(window).trigger('sgpbClickEvent', popupOptions);
|
@@ -2406,6 +2494,8 @@ SgpbEventListener.prototype.sgpbClick = function(listenerObj, eventData)
|
|
2406 |
popupObj.prepareOpen();
|
2407 |
clickCount = 1;
|
2408 |
}, delay);
|
|
|
|
|
2409 |
});
|
2410 |
});
|
2411 |
}
|
@@ -2498,12 +2588,15 @@ SgpbEventListener.prototype.sgpbConfirm = function(listenerObj, eventData)
|
|
2498 |
var confirmCount = 1;
|
2499 |
|
2500 |
confirmSelector.bind('click', function(e) {
|
2501 |
-
e.preventDefault();
|
2502 |
-
|
2503 |
if (confirmCount > 1) {
|
2504 |
return false;
|
2505 |
}
|
2506 |
++confirmCount;
|
|
|
|
|
|
|
|
|
|
|
2507 |
jQuery(window).trigger('sgpbConfirmEvent', popupOptions);
|
2508 |
var target = jQuery(this).attr('target');
|
2509 |
|
@@ -2521,6 +2614,7 @@ SgpbEventListener.prototype.sgpbConfirm = function(listenerObj, eventData)
|
|
2521 |
confirmCount = 1;
|
2522 |
}, delay);
|
2523 |
|
|
|
2524 |
});
|
2525 |
|
2526 |
sgAddEvent(window, 'sgpbDidClose', function(e) {
|
55 |
};
|
56 |
}
|
57 |
|
58 |
+
SGPBPopup.htmlCustomButton = function()
|
59 |
+
{
|
60 |
+
var buttons = jQuery('.sgpb-html-custom-button');
|
61 |
+
var buttonActionBehaviors = function(button, settings)
|
62 |
+
{
|
63 |
+
button.bind('click', function() {
|
64 |
+
var behavior = settings['sgpb-custom-button'];
|
65 |
+
|
66 |
+
if (behavior == 'redirectToURL') {
|
67 |
+
if (settings['sgpb-custom-button-redirect-new-tab']) {
|
68 |
+
window.open(settings['sgpb-custom-button-redirect-URL']);
|
69 |
+
}
|
70 |
+
else {
|
71 |
+
window.location.href = settings['sgpb-custom-button-redirect-URL']
|
72 |
+
}
|
73 |
+
}
|
74 |
+
if (behavior == 'hidePopup') {
|
75 |
+
SGPBPopup.closePopup();
|
76 |
+
}
|
77 |
+
if (behavior == 'copyToClipBoard') {
|
78 |
+
var textAreaId = 1;
|
79 |
+
var value = settings['sgpb-custom-button-copy-to-clipboard-text'];
|
80 |
+
var textArea = jQuery('<textarea>', {
|
81 |
+
id: textAreaId,
|
82 |
+
value: value,
|
83 |
+
style: 'position: absolute; right: -10000px'
|
84 |
+
});
|
85 |
+
|
86 |
+
if (!jQuery('#'+textAreaId).length) {
|
87 |
+
jQuery('body').append(textArea);
|
88 |
+
}
|
89 |
+
jQuery('#'+textAreaId).select();
|
90 |
+
document.execCommand('copy');
|
91 |
+
jQuery('#'+textAreaId).remove();
|
92 |
+
|
93 |
+
if (settings['sgpb-copy-to-clipboard-close-popup']) {
|
94 |
+
SGPBPopup.closePopup();
|
95 |
+
}
|
96 |
+
|
97 |
+
if (settings['sgpb-custom-button-copy-to-clipboard-alert']) {
|
98 |
+
alert(settings['sgpb-custom-button-copy-to-clipboard-message'])
|
99 |
+
}
|
100 |
+
}
|
101 |
+
});
|
102 |
+
};
|
103 |
+
|
104 |
+
buttons.each(function() {
|
105 |
+
var settings = jQuery.parseJSON(decodeURIComponent(jQuery(this).attr('data-options')));
|
106 |
+
buttonActionBehaviors(jQuery(this), settings);
|
107 |
+
})
|
108 |
+
|
109 |
+
};
|
110 |
+
|
111 |
SGPBPopup.listeners = function () {
|
112 |
var that = this;
|
113 |
|
116 |
});
|
117 |
|
118 |
sgAddEvent(window, 'sgpbDidOpen', function(e) {
|
119 |
+
window.dispatchEvent(new Event('resize'));
|
120 |
SGPBPopup.mobileSafariAdditionalSettings(e);
|
121 |
var args = e.detail;
|
122 |
var popupOptions = args.popupData;
|
129 |
obj.addToCounter(popupOptions);
|
130 |
}
|
131 |
}
|
132 |
+
|
133 |
+
if (popupOptions['sgpb-show-popup-same-user']) {
|
134 |
+
obj.setPopupLimitationCookie(popupOptions);
|
135 |
+
}
|
136 |
+
SGPBPopup.htmlCustomButton();
|
137 |
});
|
138 |
|
139 |
setInterval(function() {
|
523 |
}
|
524 |
}
|
525 |
|
526 |
+
var popupConfig = new PopupConfig();
|
527 |
+
var className = this.popupData['sgpb-type'];
|
528 |
+
/* make the first letter of a string uppercase, then concat prefix (uppercase all prefix string) */
|
529 |
+
className = popupConfig.prefix.toUpperCase() + className.firstToUpperCase();
|
530 |
+
/* hasOwnProperty returns boolean value */
|
531 |
+
if (window.hasOwnProperty(className)) {
|
532 |
+
className = eval(className);
|
533 |
+
/* create current popup type object */
|
534 |
+
var obj = new className;
|
535 |
+
/* call allowToOpen function if exists */
|
536 |
+
if (typeof obj.allowToOpen === 'function') {
|
537 |
+
allowToOpen = obj.allowToOpen(this.id);
|
538 |
+
if (!allowToOpen) {
|
539 |
+
isAllow = allowToOpen;
|
540 |
+
}
|
541 |
+
}
|
542 |
+
}
|
543 |
+
|
544 |
+
var allowToOpen = this.checkCurrentPopupType();
|
545 |
+
if (!allowToOpen) {
|
546 |
+
return false;
|
547 |
+
}
|
548 |
+
|
549 |
return allowToOpen;
|
550 |
};
|
551 |
|
601 |
|
602 |
SGPBPopup.prototype.forceIsAllowJsConditions = function(popupObj) {
|
603 |
var conditions = SGPB_POPUP_PARAMS.conditionalJsClasses;
|
604 |
+
|
605 |
var isAllow = true;
|
606 |
|
607 |
for (var i in conditions) {
|
1270 |
that.formSubmissionDetection(args);
|
1271 |
var popupOptions = args.popupData;
|
1272 |
|
|
|
|
|
|
|
|
|
1273 |
var closeButtonDelay = parseInt(popupOptions['sgpb-close-button-delay']);
|
1274 |
if (closeButtonDelay) {
|
1275 |
that.closeButtonDisplay(popupOptions['sgpb-post-id'], 'show', closeButtonDelay);
|
1334 |
|
1335 |
SGPBPopup.prototype.addToCounter = function(popupOptions)
|
1336 |
{
|
1337 |
+
if (SGPB_POPUP_PARAMS.isPreview) {
|
1338 |
return false;
|
1339 |
}
|
1340 |
var that = this;
|
2332 |
eventName = 'sgpb'+eventName;
|
2333 |
popupObj.eventName = eventName;
|
2334 |
|
2335 |
+
var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);
|
2336 |
+
|
2337 |
+
if (!allowToOpen) {
|
2338 |
+
return false;
|
2339 |
+
}
|
2340 |
try {
|
2341 |
eval('this.'+eventName)(this, eventData);
|
2342 |
}
|
2473 |
}
|
2474 |
|
2475 |
jQuery(this).bind('click', function(e) {
|
|
|
2476 |
if (clickCount > 1) {
|
2477 |
+
return true;
|
2478 |
+
}
|
2479 |
+
var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);
|
2480 |
+
|
2481 |
+
if (!allowToOpen) {
|
2482 |
+
return true;
|
2483 |
}
|
2484 |
++clickCount;
|
2485 |
jQuery(window).trigger('sgpbClickEvent', popupOptions);
|
2494 |
popupObj.prepareOpen();
|
2495 |
clickCount = 1;
|
2496 |
}, delay);
|
2497 |
+
|
2498 |
+
return false;
|
2499 |
});
|
2500 |
});
|
2501 |
}
|
2588 |
var confirmCount = 1;
|
2589 |
|
2590 |
confirmSelector.bind('click', function(e) {
|
|
|
|
|
2591 |
if (confirmCount > 1) {
|
2592 |
return false;
|
2593 |
}
|
2594 |
++confirmCount;
|
2595 |
+
var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);
|
2596 |
+
|
2597 |
+
if (!allowToOpen) {
|
2598 |
+
return true;
|
2599 |
+
}
|
2600 |
jQuery(window).trigger('sgpbConfirmEvent', popupOptions);
|
2601 |
var target = jQuery(this).attr('target');
|
2602 |
|
2614 |
confirmCount = 1;
|
2615 |
}, delay);
|
2616 |
|
2617 |
+
return false;
|
2618 |
});
|
2619 |
|
2620 |
sgAddEvent(window, 'sgpbDidClose', function(e) {
|
public/js/Subscribers.js
CHANGED
@@ -3,7 +3,10 @@ function SGPBSubscribers() {}
|
|
3 |
SGPBSubscribers.prototype.init = function()
|
4 |
{
|
5 |
this.openAddSubscriberPopup();
|
|
|
|
|
6 |
this.closeAddSubscriberPopup();
|
|
|
7 |
this.dataImport();
|
8 |
this.deleteSubscribers();
|
9 |
this.addSubscribers();
|
@@ -38,6 +41,154 @@ SGPBSubscribers.prototype.deleteSubscribers = function()
|
|
38 |
})
|
39 |
};
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
SGPBSubscribers.prototype.openAddSubscriberPopup = function()
|
42 |
{
|
43 |
if (jQuery('.bulkactions').empty()) {
|
3 |
SGPBSubscribers.prototype.init = function()
|
4 |
{
|
5 |
this.openAddSubscriberPopup();
|
6 |
+
this.openImportSubscriberPopup();
|
7 |
+
this.subscriberFileUploader();
|
8 |
this.closeAddSubscriberPopup();
|
9 |
+
this.importSubscriber();
|
10 |
this.dataImport();
|
11 |
this.deleteSubscribers();
|
12 |
this.addSubscribers();
|
41 |
})
|
42 |
};
|
43 |
|
44 |
+
SGPBSubscribers.prototype.openImportSubscriberPopup = function()
|
45 |
+
{
|
46 |
+
if (jQuery('.bulkactions').empty()) {
|
47 |
+
jQuery('.bulkactions').remove();
|
48 |
+
}
|
49 |
+
var that = this;
|
50 |
+
jQuery('.sgpb-import-subscriber').bind('click', function() {
|
51 |
+
jQuery('#sgpb-import-subscribers').addClass('sgpb-show-add-subscriber-popup');
|
52 |
+
SGPBSubscribers.prototype.escKeyClosePopup();
|
53 |
+
that.closePopup();
|
54 |
+
});
|
55 |
+
};
|
56 |
+
|
57 |
+
SGPBSubscribers.prototype.subscriberFileUploader = function()
|
58 |
+
{
|
59 |
+
var uploadButton = jQuery('#js-import-subscriber-button');
|
60 |
+
var supportedAudioTypes = ['text/plain', 'text/x-csv', 'text/csv'];
|
61 |
+
|
62 |
+
if (!uploadButton.length) {
|
63 |
+
return false;
|
64 |
+
}
|
65 |
+
var uploader;
|
66 |
+
uploadButton.bind('click', function(e) {
|
67 |
+
e.preventDefault();
|
68 |
+
|
69 |
+
if (uploader) {
|
70 |
+
uploader.open();
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
|
74 |
+
/* Extend the wp.media object */
|
75 |
+
uploader = wp.media.frames.file_frame = wp.media({
|
76 |
+
titleFF : SGPB_JS_LOCALIZATION.changeSound,
|
77 |
+
button : {
|
78 |
+
text : SGPB_JS_LOCALIZATION.changeSound
|
79 |
+
},
|
80 |
+
library : {type : supportedAudioTypes},
|
81 |
+
multiple : false
|
82 |
+
});
|
83 |
+
|
84 |
+
/* When a file is selected, grab the URL and set it as the text field's value */
|
85 |
+
uploader.on('select', function() {
|
86 |
+
var attachment = uploader.state().get('selection').first().toJSON();
|
87 |
+
if (supportedAudioTypes.indexOf(attachment.mime) === -1) {
|
88 |
+
alert(SGPB_JS_LOCALIZATION.audioSupportAlertMessage);
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
jQuery('#js-import-subscriber-file-url').val(attachment.url);
|
92 |
+
});
|
93 |
+
/* Open the uploader dialog */
|
94 |
+
uploader.open();
|
95 |
+
});
|
96 |
+
};
|
97 |
+
|
98 |
+
|
99 |
+
SGPBSubscribers.prototype.importSubscriber = function()
|
100 |
+
{
|
101 |
+
var importSubscriber = jQuery('.sgpb-import-subscriber-to-list');
|
102 |
+
var that = this;
|
103 |
+
|
104 |
+
if (!importSubscriber.length) {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
importSubscriber.bind('click', function() {
|
109 |
+
var popupSubscriptionList = jQuery('.js-sg-import-list').val();
|
110 |
+
var importListURL = jQuery('#js-import-subscriber-file-url').val();
|
111 |
+
|
112 |
+
var data = {
|
113 |
+
action: 'sgpb_import_subscribers',
|
114 |
+
nonce: SGPB_JS_PARAMS.nonce,
|
115 |
+
popupSubscriptionList: popupSubscriptionList,
|
116 |
+
importListURL: importListURL,
|
117 |
+
beforeSend: function() {
|
118 |
+
importSubscriber.prop('disabled', true);
|
119 |
+
}
|
120 |
+
};
|
121 |
+
|
122 |
+
jQuery.post(ajaxurl, data, function(response) {
|
123 |
+
importSubscriber.prop('disabled', false);
|
124 |
+
jQuery('.sgpb-add-subscriber-content-wrapper').html('');
|
125 |
+
jQuery('.sgpb-add-subscriber-content-wrapper').append(response);
|
126 |
+
that.closePopup();
|
127 |
+
that.disableSelectedValue();
|
128 |
+
jQuery('.sgpb-add-new-subscribers-wrapper').addClass('sgpb-to-center-window');
|
129 |
+
jQuery('.sgpb-add-new-subscribers-wrapper').css({'margin-top': 0});
|
130 |
+
that.saveImportValue();
|
131 |
+
});
|
132 |
+
});
|
133 |
+
};
|
134 |
+
|
135 |
+
SGPBSubscribers.prototype.disableSelectedValue = function() {
|
136 |
+
var selectOptioon = jQuery('.sgpb-our-fields-keys');
|
137 |
+
|
138 |
+
if (!selectOptioon.length) {
|
139 |
+
return false;
|
140 |
+
}
|
141 |
+
|
142 |
+
selectOptioon.bind('change', function() {
|
143 |
+
var currentVal = jQuery(this).val();
|
144 |
+
jQuery('.sgpb-our-fields-keys option[value="'+jQuery(this).attr('data-saved-value')+'"]').removeAttr('disabled');
|
145 |
+
jQuery(this).attr('data-saved-value', currentVal);
|
146 |
+
jQuery('.sgpb-our-fields-keys option[value="'+currentVal+'"]').not(jQuery(this)).attr('disabled', 'disabled');
|
147 |
+
});
|
148 |
+
};
|
149 |
+
|
150 |
+
SGPBSubscribers.prototype.saveImportValue = function()
|
151 |
+
{
|
152 |
+
var importSubscriber = jQuery('.sgpb-import-subscriber-to-list');
|
153 |
+
var mapping = {};
|
154 |
+
var data = {
|
155 |
+
action: 'sgpb_save_imported_subscribers',
|
156 |
+
nonce: SGPB_JS_PARAMS.nonce,
|
157 |
+
popupSubscriptionList: jQuery('.sgpb-to-import-popup-id').val(),
|
158 |
+
importListURL: jQuery('.sgpb-imported-file-url').val(),
|
159 |
+
};
|
160 |
+
|
161 |
+
jQuery('.sgpb-save-subscriber').bind('click', function() {
|
162 |
+
mapping = {};
|
163 |
+
|
164 |
+
var ourFields = jQuery('.sgpb-our-fields-keys');
|
165 |
+
ourFields.each(function () {
|
166 |
+
var currentValue = jQuery('option:selected', this).val();
|
167 |
+
if (currentValue) {
|
168 |
+
mapping[currentValue] = jQuery(this).attr('data-index');
|
169 |
+
}
|
170 |
+
});
|
171 |
+
data.namesMapping = mapping;
|
172 |
+
data.popupId = jQuery('.sgpb-to-import-popup-id').val();
|
173 |
+
data.beforeSend = function() {
|
174 |
+
jQuery('.sgpb-save-subscriber').prop('disabled', true);
|
175 |
+
};
|
176 |
+
jQuery.post(ajaxurl, data, function(response) {
|
177 |
+
window.location.reload();
|
178 |
+
jQuery('.sgpb-save-subscriber').prop('disabled', false);
|
179 |
+
});
|
180 |
+
});
|
181 |
+
};
|
182 |
+
|
183 |
+
SGPBSubscribers.prototype.closePopup = function ()
|
184 |
+
{
|
185 |
+
jQuery('.sgpb-subscriber-popup-close-btn-js').bind('click', function() {
|
186 |
+
jQuery(this).parents('.sgpb-subscribers-popup').first().removeClass('sgpb-show-add-subscriber-popup');
|
187 |
+
jQuery('.sgpb-add-subscriber-input:selected').prop('selected', false);
|
188 |
+
jQuery('.sgpb-add-subscriber-input').val('');
|
189 |
+
});
|
190 |
+
};
|
191 |
+
|
192 |
SGPBSubscribers.prototype.openAddSubscriberPopup = function()
|
193 |
{
|
194 |
if (jQuery('.bulkactions').empty()) {
|
public/js/Subscription.js
CHANGED
@@ -36,7 +36,8 @@ var styleObj={};styleObj[styleType]=dimension;jQuery('.'+selector).css(styleObj)
|
|
36 |
jQuery('.js-subs-color-picker').each(function(){var currentColorPicker=jQuery(this);currentColorPicker.wpColorPicker({change:function(){that.colorPickerChange(jQuery(this));}});});jQuery('.wp-picker-holder').mouseover(function(){var selectedInput=jQuery(this).prev().find('.js-subs-color-picker');that.colorPickerChange(selectedInput);});jQuery('.wp-picker-holder').bind('click',function(){var selectedInput=jQuery(this).prev().find('.js-subs-color-picker');that.colorPickerChange(selectedInput);});};SGPBSubscription.prototype.changeOpacity=function()
|
37 |
{var that=this;jQuery('.js-subs-bg-opacity').next().find('.range-handle').on('change mousemove',function(){that.colorPickerChange(jQuery('input[name=sgpb-subs-form-bg-color]'));});};SGPBSubscription.prototype.setupPlaceholderColor=function(element,color)
|
38 |
{jQuery('.'+element).each(function(){jQuery('#sgpb-placeholder-style').remove();var styleContent='.'+element+'::-webkit-input-placeholder {color: '+color+' !important;}';styleContent+='.'+element+'::-moz-placeholder {color: '+color+' !important;}';styleContent+='.'+element+'::-ms-placeholder {color: '+color+' !important;}';var styleBlock='<style id="sgpb-placeholder-style">'+styleContent+'</style>';jQuery('head').append(styleBlock);});};SGPBSubscription.prototype.colorPickerChange=function(colorPicker)
|
39 |
-
{var that=this;var opacity=jQuery('input[name=sgpb-subs-form-bg-opacity]').val();var colorValue=colorPicker.val();
|
|
|
40 |
var styleObj={};styleObj[styleType]=colorValue;jQuery('.'+selector).each(function(){jQuery(this).css(styleObj);})};SGPBSubscription.prototype.changeButtonTitle=function()
|
41 |
{jQuery('.js-subs-btn-title').bind('input',function(){var className=jQuery(this).attr('data-subs-rel');var val=jQuery(this).val();jQuery('.'+className).val(val);});};SGPBSubscription.prototype.changeLabels=function()
|
42 |
{jQuery('#sgpb-subs-gdpr-text').on('change',function(){var text=jQuery(this).val();jQuery(this).text('');jQuery(this).text(text);jQuery('.sgpb-gdpr-text-js').html(text);});jQuery('.js-subs-field-placeholder').each(function(){jQuery(this).bind('input',function(){var className=jQuery(this).attr('data-subs-rel');var placeholderText=jQuery(this).val();if(className=='js-subs-gdpr-label'){jQuery('.'+className).next().text(placeholderText);}
|
36 |
jQuery('.js-subs-color-picker').each(function(){var currentColorPicker=jQuery(this);currentColorPicker.wpColorPicker({change:function(){that.colorPickerChange(jQuery(this));}});});jQuery('.wp-picker-holder').mouseover(function(){var selectedInput=jQuery(this).prev().find('.js-subs-color-picker');that.colorPickerChange(selectedInput);});jQuery('.wp-picker-holder').bind('click',function(){var selectedInput=jQuery(this).prev().find('.js-subs-color-picker');that.colorPickerChange(selectedInput);});};SGPBSubscription.prototype.changeOpacity=function()
|
37 |
{var that=this;jQuery('.js-subs-bg-opacity').next().find('.range-handle').on('change mousemove',function(){that.colorPickerChange(jQuery('input[name=sgpb-subs-form-bg-color]'));});};SGPBSubscription.prototype.setupPlaceholderColor=function(element,color)
|
38 |
{jQuery('.'+element).each(function(){jQuery('#sgpb-placeholder-style').remove();var styleContent='.'+element+'::-webkit-input-placeholder {color: '+color+' !important;}';styleContent+='.'+element+'::-moz-placeholder {color: '+color+' !important;}';styleContent+='.'+element+'::-ms-placeholder {color: '+color+' !important;}';var styleBlock='<style id="sgpb-placeholder-style">'+styleContent+'</style>';jQuery('head').append(styleBlock);});};SGPBSubscription.prototype.colorPickerChange=function(colorPicker)
|
39 |
+
{var that=this;var opacity=jQuery('input[name=sgpb-subs-form-bg-opacity]').val();var colorValue=colorPicker.val();if(typeof colorValue=='undefined'){return false;}
|
40 |
+
colorValue=SGPBBackend.hexToRgba(colorValue,opacity);var styleType=colorPicker.attr('data-style-type');var selector=colorPicker.attr('data-subs-rel');if('placeholder'==styleType){that.setupPlaceholderColor(selector,colorValue);return false;}
|
41 |
var styleObj={};styleObj[styleType]=colorValue;jQuery('.'+selector).each(function(){jQuery(this).css(styleObj);})};SGPBSubscription.prototype.changeButtonTitle=function()
|
42 |
{jQuery('.js-subs-btn-title').bind('input',function(){var className=jQuery(this).attr('data-subs-rel');var val=jQuery(this).val();jQuery('.'+className).val(val);});};SGPBSubscription.prototype.changeLabels=function()
|
43 |
{jQuery('#sgpb-subs-gdpr-text').on('change',function(){var text=jQuery(this).val();jQuery(this).text('');jQuery(this).text(text);jQuery('.sgpb-gdpr-text-js').html(text);});jQuery('.js-subs-field-placeholder').each(function(){jQuery(this).bind('input',function(){var className=jQuery(this).attr('data-subs-rel');var placeholderText=jQuery(this).val();if(className=='js-subs-gdpr-label'){jQuery('.'+className).next().text(placeholderText);}
|
public/views/htmlCustomButtonElement.php
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php
|
3 |
+
use sgpb\AdminHelper;
|
4 |
+
$excludePostId = @$_GET['post'];
|
5 |
+
$excludedPopups = array($excludePostId);
|
6 |
+
$allPopups = AdminHelper::getPopupsIdAndTitle($excludedPopups);
|
7 |
+
?>
|
8 |
+
<div class="sgpb-hide">
|
9 |
+
<div id="sgpb-custom-button-wrapper">
|
10 |
+
<?php
|
11 |
+
$defaultData = ConfigDataHelper::defaultData();
|
12 |
+
$buttonDefaultStyles = array(
|
13 |
+
'title' => __('Button',SG_POPUP_TEXT_DOMAIN),
|
14 |
+
'width' => '300px',
|
15 |
+
'height' => '60px',
|
16 |
+
'borderWidth' => '0px',
|
17 |
+
'borderRadius' => '2px',
|
18 |
+
'borderColor' => '#1a48a5',
|
19 |
+
'backgroundColor' => '#1d6ab7',
|
20 |
+
'backgroundHoverColor' => '#2184d1',
|
21 |
+
'textColor' => '#FFFFFF'
|
22 |
+
);
|
23 |
+
?>
|
24 |
+
<div class="sgpb-wrapper">
|
25 |
+
<img class="sgpb-add-subscriber-popup-close-btn sgpb-custom-button-close-popup sgpb-close-media-popup-js" src="<?php echo SG_POPUP_IMG_URL.'subscribers_close.png'; ?>" width='15px'>
|
26 |
+
<div class="row form-group">
|
27 |
+
<label for="sgpb-custom-btn-width" class="col-md-6 control-label sgpb-static-padding-top sgpb-sub-option">
|
28 |
+
<?php _e('Title', SG_POPUP_TEXT_DOMAIN); ?>:
|
29 |
+
</label>
|
30 |
+
<div class="col-md-6">
|
31 |
+
<input class="form-control sgpb-full-width-events" data-contact-rel="js-contact-submit-btn" data-field-type="button" data-style-type="title" type="text" name="sgpb-custom-btn-title" id="sgpb-custom-btn-title" value="<?php echo $buttonDefaultStyles['title']; ?>">
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
<div class="row form-group">
|
35 |
+
<div class="col-md-6">
|
36 |
+
<div class="row form-group">
|
37 |
+
<label class="col-md-12 control-label">
|
38 |
+
<?php _e('Custom Button Styles', SG_POPUP_TEXT_DOMAIN); ?>
|
39 |
+
</label>
|
40 |
+
</div>
|
41 |
+
<div class="row form-group">
|
42 |
+
<label for="sgpb-custom-btn-width" class="col-md-6 control-label sgpb-static-padding-top sgpb-sub-option">
|
43 |
+
<?php _e('Width', SG_POPUP_TEXT_DOMAIN); ?>:
|
44 |
+
</label>
|
45 |
+
<div class="col-md-6">
|
46 |
+
<input class="form-control js-contact-dimension sgpb-full-width-events sgpb-custom-button-settings" data-contact-rel="js-contact-submit-btn" data-field-type="button" data-style-type="width" type="text" name="sgpb-custom-btn-width" id="sgpb-custom-btn-width" value="<?php echo $buttonDefaultStyles['width']; ?>">
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
<div class="row form-group">
|
50 |
+
<label for="sgpb-custom-btn-height" class="col-md-6 control-label sgpb-static-padding-top sgpb-sub-option">
|
51 |
+
<?php _e('Height', SG_POPUP_TEXT_DOMAIN); ?>:
|
52 |
+
</label>
|
53 |
+
<div class="col-md-6">
|
54 |
+
<input class="form-control js-contact-dimension sgpb-full-width-events sgpb-custom-button-settings" data-contact-rel="js-contact-submit-btn" data-field-type="button" data-style-type="height" type="text" name="sgpb-custom-btn-height" id="sgpb-custom-btn-height" value="<?php echo $buttonDefaultStyles['height']; ?>">
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
<div class="row form-group">
|
58 |
+
<label for="sgpb-custom-btn-border-width" class="col-md-6 control-label sgpb-static-padding-top sgpb-sub-option">
|
59 |
+
<?php _e('Border width', SG_POPUP_TEXT_DOMAIN); ?>:
|
60 |
+
</label>
|
61 |
+
<div class="col-md-6">
|
62 |
+
<input class="form-control js-contact-dimension sgpb-full-width-events sgpb-custom-button-settings" data-field-type="button" data-contact-rel="js-contact-submit-btn" data-style-type="border-width" type="text" name="sgpb-custom-btn-border-width" id="sgpb-custom-btn-border-width" value="<?php echo $buttonDefaultStyles['borderWidth']; ?>">
|
63 |
+
</div>
|
64 |
+
</div>
|
65 |
+
<div class="row form-group">
|
66 |
+
<label for="sgpb-custom-btn-border-radius" class="col-md-6 control-label sgpb-sub-option">
|
67 |
+
<?php _e('Border radius', SG_POPUP_TEXT_DOMAIN); ?>:
|
68 |
+
</label>
|
69 |
+
<div class="col-md-6">
|
70 |
+
<input class="form-control js-contact-dimension sgpb-full-width-events sgpb-custom-button-settings" data-contact-rel="js-contact-submit-btn" data-field-type="button" data-style-type="border-radius" type="text" name="sgpb-custom-btn-border-radius" id="sgpb-custom-btn-border-radius" value="<?php echo $buttonDefaultStyles['borderRadius']; ?>">
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
<div class="row form-group">
|
74 |
+
<label for="sgpb-custom-btn-border-color" class="col-md-6 control-label sgpb-sub-option">
|
75 |
+
<?php _e('Border color', SG_POPUP_TEXT_DOMAIN); ?>:
|
76 |
+
</label>
|
77 |
+
<div class="col-md-6">
|
78 |
+
<div class="sgpb-color-picker-wrapper">
|
79 |
+
<input id="sgpb-custom-btn-border-color" class="sgpb-custom-button-color-picker sgpb-custom-button-settings" data-field-type="button" data-contact-rel="js-contact-submit-btn" data-style-type="border-color" type="text" name="sgpb-custom-btn-border-color" value="<?php echo $buttonDefaultStyles['borderColor']; ?>">
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
<div class="row form-group">
|
84 |
+
<label class="col-md-6 control-label sgpb-sub-option">
|
85 |
+
<?php _e('Background color', SG_POPUP_TEXT_DOMAIN); ?>:
|
86 |
+
</label>
|
87 |
+
<div class="col-md-6">
|
88 |
+
<div class="sgpb-color-picker-wrapper">
|
89 |
+
<input class="sgpb-custom-button-color-picker sgpb-custom-button-settings" data-field-type="button" data-contact-rel="js-contact-submit-btn" data-style-type="background-color" type="text" name="sgpb-custom-btn-bg-color" value="<?php echo $buttonDefaultStyles['backgroundColor']; ?>">
|
90 |
+
</div>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
<div class="row form-group">
|
94 |
+
<label class="col-md-6 control-label sgpb-sub-option">
|
95 |
+
<?php _e('Hover background color', SG_POPUP_TEXT_DOMAIN); ?>:
|
96 |
+
</label>
|
97 |
+
<div class="col-md-6">
|
98 |
+
<div class="sgpb-color-picker-wrapper">
|
99 |
+
<input class="sgpb-custom-button-color-picker sgpb-custom-button-settings" data-field-type="button" data-contact-rel="js-contact-submit-btn" data-style-type="hover-color" type="text" name="sgpb-custom-btn-bg-color" value="<?php echo $buttonDefaultStyles['backgroundHoverColor']; ?>">
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
<div class="row form-group">
|
104 |
+
<label class="col-md-6 control-label sgpb-sub-option">
|
105 |
+
<?php _e('Text color', SG_POPUP_TEXT_DOMAIN); ?>:
|
106 |
+
</label>
|
107 |
+
<div class="col-md-6">
|
108 |
+
<div class="sgpb-color-picker-wrapper">
|
109 |
+
<input class="sgpb-custom-button-color-picker sgpb-custom-button-settings" data-field-type="button" data-contact-rel="js-contact-submit-btn" data-style-type="color" type="text" name="sgpb-custom-btn-text-color" value="<?php echo $buttonDefaultStyles['textColor']; ?>">
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
<div class="col-md-6">
|
115 |
+
<div class="row form-group">
|
116 |
+
<label class="col-md-12 control-label">
|
117 |
+
<?php _e('Button events', SG_POPUP_TEXT_DOMAIN); ?>
|
118 |
+
</label>
|
119 |
+
</div>
|
120 |
+
<?php
|
121 |
+
$multipleChoiceButton = new \sgpb\MultipleChoiceButton($defaultData['htmlCustomButtonArgs'], 'hidePopup');
|
122 |
+
echo $multipleChoiceButton;
|
123 |
+
?>
|
124 |
+
<div class="sg-hide sg-full-width" id="sgpb-custom-button-copy">
|
125 |
+
<div class="row form-group">
|
126 |
+
<label for="sgpb-custom-button-copy-to-clipboard-text" class="col-md-6 control-label sgpb-double-sub-option">
|
127 |
+
<?php _e('Text', SG_POPUP_TEXT_DOMAIN)?>:
|
128 |
+
</label>
|
129 |
+
<div class="col-md-6"><input name="sgpb-custom-button-copy-to-clipboard-text" id="sgpb-custom-button-copy-to-clipboard-text" class="form-control sgpb-full-width-events" value="some text here"></div>
|
130 |
+
</div>
|
131 |
+
<div class="row form-group">
|
132 |
+
<label for="sgpb-custom-button-copy-to-clipboard-close-popup" class="col-md-6 control-label sgpb-double-sub-option">
|
133 |
+
<?php _e('Close popup', SG_POPUP_TEXT_DOMAIN)?>:
|
134 |
+
</label>
|
135 |
+
<div class="col-md-6"><input type="checkbox" name="sgpb-custom-button-copy-to-clipboard-close-popup" id="sgpb-custom-button-copy-to-clipboard-close-popup"></div>
|
136 |
+
</div>
|
137 |
+
<div class="row form-group">
|
138 |
+
<label for="sgpb-custom-button-copy-to-clipboard-alert" class="col-md-6 control-label sgpb-double-sub-option">
|
139 |
+
<?php _e('Show alert', SG_POPUP_TEXT_DOMAIN)?>:
|
140 |
+
</label>
|
141 |
+
<div class="col-md-6">
|
142 |
+
<input type="checkbox" id="sgpb-custom-button-copy-to-clipboard-alert" class="js-checkbox-accordion" name="sgpb-custom-button-copy-to-clipboard-alert">
|
143 |
+
</div>
|
144 |
+
</div>
|
145 |
+
<div class="sg-full-width form-group">
|
146 |
+
<div class="row">
|
147 |
+
<label for="col-md-5 sgpb-copy-to-clipboard-message" class="col-md-6 control-label sgpb-double-sub-option">
|
148 |
+
<?php _e('Message', SG_POPUP_TEXT_DOMAIN)?>:
|
149 |
+
</label>
|
150 |
+
<div class="col-md-6">
|
151 |
+
<input type="text" id="sgpb-custom-button-copy-to-clipboard-message" class="form-control sgpb-full-width-events " name="sgpb-custom-button-copy-to-clipboard-message" value="Copied to clipboard!">
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</div>
|
156 |
+
<div class="sg-hide sg-full-width" id="sgpb-custom-button-redirect-to-URL">
|
157 |
+
<div class="row form-group">
|
158 |
+
<label for="sgpb-custom-button-redirect-URL" class="col-md-6 control-label sgpb-double-sub-option">
|
159 |
+
<?php _e('Redirect URL', SG_POPUP_TEXT_DOMAIN)?>:
|
160 |
+
</label>
|
161 |
+
<div class="col-md-6"><input type="url" name="sgpb-custom-button-redirect-URL" id="sgpb-custom-button-redirect-URL" placeholder="https://www.example.com" class="form-control sgpb-full-width-events" value=""></div>
|
162 |
+
</div>
|
163 |
+
<div class="row form-group">
|
164 |
+
<label for="sgpb-custom-button-redirect-new-tab" class="col-md-6 control-label sgpb-double-sub-option">
|
165 |
+
<?php _e('Redirect to new tab', SG_POPUP_TEXT_DOMAIN)?>:
|
166 |
+
</label>
|
167 |
+
<div class="col-md-6"><input type="checkbox" name="sgpb-custom-button-redirect-new-tab" id="sgpb-custom-button-redirect-new-tab" placeholder="https://www.example.com" ></div>
|
168 |
+
</div>
|
169 |
+
</div>
|
170 |
+
<div class="sg-hide sg-full-width" id="sgpb-custom-button-open-popup">
|
171 |
+
<div class="row form-group">
|
172 |
+
<label for="sgpb-subs-success-redirect-URL" class="col-md-6 control-label sgpb-double-sub-option">
|
173 |
+
<?php _e('Select popup', SG_POPUP_TEXT_DOMAIN)?>:
|
174 |
+
</label>
|
175 |
+
<div class="col-md-6">
|
176 |
+
<?php echo sgpb\AdminHelper::createSelectBox($allPopups, '', array('name' => 'sgpb-custom-button-popup', 'class'=>'js-sg-select2 sgpb-full-width-events sgpb-custom-button-popup')); ?>
|
177 |
+
</div>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
<div>
|
181 |
+
|
182 |
+
</div>
|
183 |
+
<div class="row">
|
184 |
+
<div class="col-md-6">
|
185 |
+
<input type="button" value="<?php _e('Insert', SG_POPUP_TEXT_DOMAIN); ?>" class="btn btn-sm btn-success sgpb-subscriber-popup-btns sgpb-insert-custom-button-to-editor sgpb-close-media-popup-js" data-ajaxnonce="popupBuilderAjaxNonce">
|
186 |
+
</div>
|
187 |
+
<div class="col-md-6">
|
188 |
+
<input type="button" value="<?php _e('Cancel', SG_POPUP_TEXT_DOMAIN); ?>" class="btn btn-sm btn-default sgpb-add-subscriber-popup-close-btn-js sgpb-subscriber-popup-btns sgpb-subscriber-popup-close-btn-js sgpb-close-media-popup-js" data-ajaxnonce="popupBuilderAjaxNonce">
|
189 |
+
</div>
|
190 |
+
</div>
|
191 |
+
</div>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
<style type="text/css">
|
197 |
+
.sgpb-popup-dialog-main-div-theme-wrapper-1 {
|
198 |
+
top: 86px !important;
|
199 |
+
}
|
200 |
+
</style>
|
public/views/importConfigView.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
use sgpb\AdminHelper;
|
3 |
+
use sgpb\SubscriptionPopup;
|
4 |
+
|
5 |
+
$fileContent = AdminHelper::getFileFromURL($fileURL);
|
6 |
+
$csvFileArray = array_map('str_getcsv', file($fileURL));
|
7 |
+
$ourFieldsArgs = array(
|
8 |
+
'class' => 'js-sg-select2 sgpb-our-fields-keys'
|
9 |
+
);
|
10 |
+
|
11 |
+
$formData = array('' => 'Select Field') + AdminHelper::getSubscriptionColumnsById($formId);
|
12 |
+
?>
|
13 |
+
<div class="sgpb-wrapper">
|
14 |
+
<div class="sgpb-import-settings-wrapper">
|
15 |
+
<div class="row form-group">
|
16 |
+
<div class="col-md-12 sgpb-file-settings-label">
|
17 |
+
<?php _e('Match Your Fields', SG_POPUP_TEXT_DOMAIN); ?>
|
18 |
+
</div>
|
19 |
+
</div>
|
20 |
+
<hr>
|
21 |
+
<div class="row form-group">
|
22 |
+
<div class="col-md-6 sgpb-file-settings-label sgpb-file-settings-available-wrapper">
|
23 |
+
<?php _e('Available fields', SG_POPUP_TEXT_DOMAIN); ?>
|
24 |
+
</div>
|
25 |
+
<div class="col-md-6 sgpb-file-settings-label">
|
26 |
+
<?php _e('Our list fields', SG_POPUP_TEXT_DOMAIN); ?>
|
27 |
+
</div>
|
28 |
+
</div>
|
29 |
+
<hr>
|
30 |
+
<?php foreach($csvFileArray[0] as $index => $current): ?>
|
31 |
+
<?php if (empty($current) || $current == 'popup'): ?>
|
32 |
+
<?php continue; ?>
|
33 |
+
<?php endif; ?>
|
34 |
+
<div class="row form-group">
|
35 |
+
<div class="col-md-6 sgpb-label-config-left"><?php echo $current; ?></div>
|
36 |
+
<div class="col-md-6">
|
37 |
+
<?php
|
38 |
+
$ourFieldsArgs['data-index'] = $index;
|
39 |
+
echo AdminHelper::createSelectBox($formData, '', $ourFieldsArgs);
|
40 |
+
?>
|
41 |
+
</div>
|
42 |
+
</div>
|
43 |
+
<?php endforeach;?>
|
44 |
+
<div class="row">
|
45 |
+
<div class="col-md-6">
|
46 |
+
<input type="button" value="<?php _e('Save', SG_POPUP_TEXT_DOMAIN); ?>" class="btn btn-sm btn-success sgpb-subscriber-popup-btns sgpb-save-subscriber" data-ajaxnonce="popupBuilderAjaxNonce">
|
47 |
+
</div>
|
48 |
+
<div class="col-md-6">
|
49 |
+
<input type="button" value="<?php _e('Cancel', SG_POPUP_TEXT_DOMAIN); ?>" class="btn btn-sm btn-default sgpb-add-subscriber-popup-close-btn-js sgpb-subscriber-popup-btns sgpb-subscriber-popup-close-btn-js" data-ajaxnonce="popupBuilderAjaxNonce">
|
50 |
+
</div>
|
51 |
+
</div>
|
52 |
+
<input type="hidden" class="sgpb-to-import-popup-id" value="<?php echo esc_attr($formId)?>">
|
53 |
+
<input type="hidden" class="sgpb-imported-file-url" value="<?php echo esc_attr($fileURL)?>">
|
54 |
+
</div>
|
55 |
+
</div>
|
public/views/options/subscription.php
CHANGED
@@ -423,4 +423,4 @@
|
|
423 |
</div>
|
424 |
</div>
|
425 |
</div>
|
426 |
-
</div>
|
423 |
</div>
|
424 |
</div>
|
425 |
</div>
|
426 |
+
</div>
|
public/views/subscribers.php
CHANGED
@@ -24,10 +24,26 @@ $subscribersSelectbox = AdminHelper::createSelectBox(
|
|
24 |
'autocomplete' => 'off'
|
25 |
)
|
26 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
?>
|
28 |
<div class="wrap subscribers-wrapper">
|
29 |
<div class="headers-wrapper">
|
30 |
<h1 class="wp-heading-inline"><?php _e('Subscribers', SG_POPUP_TEXT_DOMAIN)?></h1>
|
|
|
31 |
<a href="javascript:void(0)" class="page-title-action sgpb-export-subscriber"><?php _e('Export', SG_POPUP_TEXT_DOMAIN)?></a>
|
32 |
<a href="javascript:void(0)" class="page-title-action sgpb-add-subscriber"><?php _e('Add new', SG_POPUP_TEXT_DOMAIN)?></a>
|
33 |
</div>
|
@@ -41,6 +57,57 @@ $subscribersSelectbox = AdminHelper::createSelectBox(
|
|
41 |
?>
|
42 |
</div>
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
<!-- add subscribers popup start -->
|
45 |
<div id="sgpb-add-new-subscriber">
|
46 |
<div class="sgpb-add-new-subscribers-wrapper">
|
24 |
'autocomplete' => 'off'
|
25 |
)
|
26 |
);
|
27 |
+
|
28 |
+
$importSubscribersSelectbox = AdminHelper::createSelectBox(
|
29 |
+
$allData,
|
30 |
+
$fistElement,
|
31 |
+
array(
|
32 |
+
'name' => 'sgpb-import-subscriber-input',
|
33 |
+
'class' => 'js-sg-select2 js-sg-import-list sgpb-add-subscriber-input js-select-basic',
|
34 |
+
'autocomplete' => 'off'
|
35 |
+
)
|
36 |
+
);
|
37 |
+
$isEmpty = empty($allData);
|
38 |
+
$disable = '';
|
39 |
+
if ($isEmpty) {
|
40 |
+
$disable = 'disabled';
|
41 |
+
}
|
42 |
?>
|
43 |
<div class="wrap subscribers-wrapper">
|
44 |
<div class="headers-wrapper">
|
45 |
<h1 class="wp-heading-inline"><?php _e('Subscribers', SG_POPUP_TEXT_DOMAIN)?></h1>
|
46 |
+
<a href="javascript:void(0)" class="page-title-action sgpb-import-subscriber"><?php _e('Import', SG_POPUP_TEXT_DOMAIN)?></a>
|
47 |
<a href="javascript:void(0)" class="page-title-action sgpb-export-subscriber"><?php _e('Export', SG_POPUP_TEXT_DOMAIN)?></a>
|
48 |
<a href="javascript:void(0)" class="page-title-action sgpb-add-subscriber"><?php _e('Add new', SG_POPUP_TEXT_DOMAIN)?></a>
|
49 |
</div>
|
57 |
?>
|
58 |
</div>
|
59 |
|
60 |
+
<!-- -->
|
61 |
+
<div id="sgpb-import-subscribers" class="sgpb-subscribers-popup">
|
62 |
+
<div class="sgpb-add-new-subscribers-wrapper sgpb-import-settings-wrapper">
|
63 |
+
<div class="sgpb-wrapper">
|
64 |
+
<div class="sgpb-imges-wrapper">
|
65 |
+
<div class="col-sm-1 sgpb-add-subscriber-header-spinner-column">
|
66 |
+
<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">
|
67 |
+
</div>
|
68 |
+
<img src="<?php echo SG_POPUP_IMG_URL.'subscribers_close.png'; ?>" alt="gif" class="sgpb-add-subscriber-popup-close-btn sgpb-import-subscribers-close sgpb-subscriber-popup-close-btn-js" width="20px">
|
69 |
+
</div>
|
70 |
+
<div class="sgpb-add-subscriber-content-wrapper">
|
71 |
+
<div class="row">
|
72 |
+
<div class="col-sm-7 sgpb-add-subscriber-header-column sgpb-clear">
|
73 |
+
<h4>
|
74 |
+
<?php _e('Select subscription(s):', SG_POPUP_TEXT_DOMAIN); ?>
|
75 |
+
</h4>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
<div class="row form-group">
|
79 |
+
<div class="col-md-12">
|
80 |
+
<?php echo $importSubscribersSelectbox; ?>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
<div class="row">
|
84 |
+
<div class="col-sm-7">
|
85 |
+
<h4 for="js-import-subscriber-file-url">
|
86 |
+
<?php _e('Import Subscribers from file:', SG_POPUP_TEXT_DOMAIN); ?>
|
87 |
+
</h4>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
<div class="row form-group">
|
91 |
+
<div class="col-sm-9">
|
92 |
+
<input class="form-control input-sm" id="js-import-subscriber-file-url" type="text" size="36" name="js-import-subscriber-file-url" value="" required="">
|
93 |
+
</div>
|
94 |
+
<div class="col-sm-3">
|
95 |
+
<input id="js-import-subscriber-button" placeholder="<?php _e('No file selected', SG_POPUP_TEXT_DOMAIN); ?>" class="btn btn-primary btn-sm sgpb-subscriber-popup-btns" type="button" value="<?php _e('Select file', SG_POPUP_TEXT_DOMAIN); ?>">
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
<div class="row">
|
99 |
+
<div class="col-md-6">
|
100 |
+
<input type="button" value="<?php _e('Import', SG_POPUP_TEXT_DOMAIN); ?>" class="btn btn-sm btn-success sgpb-subscriber-popup-btns sgpb-import-subscriber-to-list" data-ajaxnonce="popupBuilderAjaxNonce" <?php echo $disable; ?>>
|
101 |
+
</div>
|
102 |
+
<div class="col-md-6">
|
103 |
+
<input type="button" value="<?php _e('Cancel', SG_POPUP_TEXT_DOMAIN); ?>" class="btn btn-sm btn-default sgpb-add-subscriber-popup-close-btn-js sgpb-subscriber-popup-btns sgpb-subscriber-popup-close-btn-js" data-ajaxnonce="popupBuilderAjaxNonce">
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
|
111 |
<!-- add subscribers popup start -->
|
112 |
<div id="sgpb-add-new-subscriber">
|
113 |
<div class="sgpb-add-new-subscribers-wrapper">
|
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.2
|
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,15 @@ Go to the Popup Builder settings and set your desired options.
|
|
185 |
|
186 |
== Changelog ==
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
= Version 3.2 =
|
189 |
* New Feature: PDF popup type.
|
190 |
* New Feature: Popup content can be set at the top and bottom of Subscription form.
|
9 |
Requires at least: 3.8
|
10 |
Tested up to: 5.2
|
11 |
Requires PHP: 5.3.3
|
12 |
+
Stable tag: 3.3
|
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.3 =
|
189 |
+
* Popup preview fixes.
|
190 |
+
* Improvement: If the popup is setup on the Link and the popup opening condition doesn’t meet the current state, the default Link functionality will be triggered.
|
191 |
+
* Added a Button element inside the WP editor.
|
192 |
+
* Fix: Mobile landscape issue, in all cases the popup sizes will be changed, if the window orientation is changed (mobile/desktop).
|
193 |
+
* Completely works with almost all page builders.
|
194 |
+
* Subscribers Import/export fixes.
|
195 |
+
* Popup showing limitation improvement.
|
196 |
+
|
197 |
= Version 3.2 =
|
198 |
* New Feature: PDF popup type.
|
199 |
* New Feature: Popup content can be set at the top and bottom of Subscription form.
|