Version Description
Download this release
Release Info
Developer | Sygnoos |
Plugin | Popup Builder – Responsive WordPress Pop up |
Version | 4.1.5 |
Comparing to | |
See all releases |
Code changes from version 4.1.4 to 4.1.5
- com/classes/Ajax.php +18 -5
- com/classes/ConditionCreator.php +30 -5
- com/classes/PopupChecker.php +2 -2
- com/classes/PopupLoader.php +3 -5
- com/classes/popups/SGPopup.php +6 -0
- com/config/configPackage.php +1 -1
- com/config/dataConfig.php +27 -7
- com/helpers/ConfigDataHelper.php +57 -22
- popup-builder.php +1 -1
- public/js/PopupBuilder.js +4 -2
- readme.txt +8 -2
com/classes/Ajax.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
namespace sgpb;
|
3 |
use \ConfigDataHelper;
|
4 |
-
use \SgpbDataConfig;
|
5 |
|
6 |
class Ajax
|
7 |
{
|
@@ -411,8 +410,12 @@ class Ajax
|
|
411 |
// we will use array_walk_recursive method for sanitizing current data because we can receive an multidimensional array!
|
412 |
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
413 |
$newsletterData = isset($_POST['newsletterData']) ? stripslashes_deep($_POST['newsletterData']) : [];
|
414 |
-
array_walk_recursive($newsletterData, function(&$item){
|
415 |
-
$
|
|
|
|
|
|
|
|
|
416 |
});
|
417 |
if(isset($newsletterData['testSendingStatus']) && $newsletterData['testSendingStatus'] == 'test') {
|
418 |
AdminHelper::sendTestNewsletter($newsletterData);
|
@@ -618,9 +621,19 @@ class Ajax
|
|
618 |
{
|
619 |
check_ajax_referer(SG_AJAX_NONCE, 'nonce_ajax');
|
620 |
|
621 |
-
$postTypeName = isset($_POST['searchKey']) ? sanitize_text_field($_POST['searchKey']) : '';
|
622 |
$search = isset($_POST['searchTerm']) ? sanitize_text_field($_POST['searchTerm']) : '';
|
623 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
624 |
|
625 |
if(isset($_POST['searchCallback'])) {
|
626 |
$searchCallback = sanitize_text_field($_POST['searchCallback']);
|
1 |
<?php
|
2 |
namespace sgpb;
|
3 |
use \ConfigDataHelper;
|
|
|
4 |
|
5 |
class Ajax
|
6 |
{
|
410 |
// we will use array_walk_recursive method for sanitizing current data because we can receive an multidimensional array!
|
411 |
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
412 |
$newsletterData = isset($_POST['newsletterData']) ? stripslashes_deep($_POST['newsletterData']) : [];
|
413 |
+
array_walk_recursive($newsletterData, function(&$item, $k){
|
414 |
+
if ($k === 'messageBody'){
|
415 |
+
$item = wp_kses($item, AdminHelper::allowed_html_tags());
|
416 |
+
} else {
|
417 |
+
$item = sanitize_text_field($item);
|
418 |
+
}
|
419 |
});
|
420 |
if(isset($newsletterData['testSendingStatus']) && $newsletterData['testSendingStatus'] == 'test') {
|
421 |
AdminHelper::sendTestNewsletter($newsletterData);
|
621 |
{
|
622 |
check_ajax_referer(SG_AJAX_NONCE, 'nonce_ajax');
|
623 |
|
624 |
+
$postTypeName = isset($_POST['searchKey']) ? sanitize_text_field($_POST['searchKey']) : ''; // TODO strongly validate postTypeName example: use ENUM
|
625 |
$search = isset($_POST['searchTerm']) ? sanitize_text_field($_POST['searchTerm']) : '';
|
626 |
+
|
627 |
+
switch($postTypeName){
|
628 |
+
case 'postCategories':
|
629 |
+
$searchResults = ConfigDataHelper::getPostsAllCategories('post', [], $search);
|
630 |
+
break;
|
631 |
+
case 'postTags':
|
632 |
+
$searchResults = ConfigDataHelper::getAllTags($search);
|
633 |
+
break;
|
634 |
+
default:
|
635 |
+
$searchResults = $this->selectFromPost($postTypeName, $search);
|
636 |
+
}
|
637 |
|
638 |
if(isset($_POST['searchCallback'])) {
|
639 |
$searchCallback = sanitize_text_field($_POST['searchCallback']);
|
com/classes/ConditionCreator.php
CHANGED
@@ -363,6 +363,13 @@ class ConditionCreator
|
|
363 |
return self::createElementHeader($ruleElementData);
|
364 |
}
|
365 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
public static function createRuleField($ruleElementData)
|
367 |
{
|
368 |
$attr = array();
|
@@ -387,11 +394,29 @@ class ConditionCreator
|
|
387 |
$savedData = $ruleElementData['saved'];
|
388 |
|
389 |
if (empty($ruleElementData['data'])) {
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
}
|
396 |
}
|
397 |
|
363 |
return self::createElementHeader($ruleElementData);
|
364 |
}
|
365 |
|
366 |
+
private static function isAssociativeArrayOrEmptyString($args)
|
367 |
+
{
|
368 |
+
if (gettype($args) === 'string') return true;
|
369 |
+
if (array() === $args) return false;
|
370 |
+
return array_keys($args) !== range(0, count($args) - 1);
|
371 |
+
}
|
372 |
+
|
373 |
public static function createRuleField($ruleElementData)
|
374 |
{
|
375 |
$attr = array();
|
394 |
$savedData = $ruleElementData['saved'];
|
395 |
|
396 |
if (empty($ruleElementData['data'])) {
|
397 |
+
// this check is for current version update!
|
398 |
+
// the old value was a simple array!
|
399 |
+
// after update we need to convert them all to a associative array
|
400 |
+
// this check will resolve UI issues and also prevent bugs after update-ing the existing popup
|
401 |
+
// this change is for post_category and post_tags!
|
402 |
+
if (self::isAssociativeArrayOrEmptyString($ruleElementData['saved'])){
|
403 |
+
$ruleElementData['data'] = $ruleElementData['saved'];
|
404 |
+
$savedData = array();
|
405 |
+
|
406 |
+
if (!empty($ruleElementData['saved'])) {
|
407 |
+
$savedData = array_keys($ruleElementData['saved']);
|
408 |
+
}
|
409 |
+
} else {
|
410 |
+
$ruleElementData['data'] = $ruleElementData['saved'];
|
411 |
+
|
412 |
+
if (!empty($ruleElementData['saved'])) {
|
413 |
+
if (isset($attr['isPostCategory'])){
|
414 |
+
$ruleElementData['data'] = \ConfigDataHelper::getTermsByIds($ruleElementData['saved']);
|
415 |
+
} elseif(isset($attr['isPostTag'])) {
|
416 |
+
$ruleElementData['data'] = \ConfigDataHelper::getTagsByIds($ruleElementData['saved']);
|
417 |
+
}
|
418 |
+
$savedData = $ruleElementData['saved'];
|
419 |
+
}
|
420 |
}
|
421 |
}
|
422 |
|
com/classes/PopupChecker.php
CHANGED
@@ -424,7 +424,7 @@ class PopupChecker
|
|
424 |
}
|
425 |
|
426 |
foreach ($currentPostCategories as $categoryName) {
|
427 |
-
if (in_array($categoryName->term_id, $values)) {
|
428 |
$isSatisfy = true;
|
429 |
break;
|
430 |
}
|
@@ -469,7 +469,7 @@ class PopupChecker
|
|
469 |
$selectedTags = array_values($postTagsValues);
|
470 |
|
471 |
foreach ($tagsObj as $tagObj) {
|
472 |
-
if (in_array($tagObj->slug, $selectedTags)) {
|
473 |
$isSatisfy = true;
|
474 |
break;
|
475 |
}
|
424 |
}
|
425 |
|
426 |
foreach ($currentPostCategories as $categoryName) {
|
427 |
+
if (in_array($categoryName->term_id, $values) || in_array($categoryName->term_id, array_keys($values))) {
|
428 |
$isSatisfy = true;
|
429 |
break;
|
430 |
}
|
469 |
$selectedTags = array_values($postTagsValues);
|
470 |
|
471 |
foreach ($tagsObj as $tagObj) {
|
472 |
+
if (in_array($tagObj->slug, $selectedTags) || in_array($tagObj->slug, array_keys($postTagsValues))) {
|
473 |
$isSatisfy = true;
|
474 |
break;
|
475 |
}
|
com/classes/PopupLoader.php
CHANGED
@@ -73,10 +73,9 @@ class PopupLoader
|
|
73 |
|
74 |
$popupFromUrl = SGPopup::find($getterId, $args);
|
75 |
if (!empty($popupFromUrl)) {
|
76 |
-
global $SGPB_DATA_CONFIG_ARRAY;
|
77 |
$defaultEvent = array();
|
78 |
$customDelay = $popupFromUrl->getOptionValue('sgpb-popup-delay');
|
79 |
-
$defaultEvent[] =
|
80 |
$defaultEvent[0]['value'] = 0;
|
81 |
if ($customDelay) {
|
82 |
$defaultEvent[0]['value'] = $customDelay;
|
@@ -101,10 +100,9 @@ class PopupLoader
|
|
101 |
$foundPopup = $post;
|
102 |
}
|
103 |
if (!empty($foundPopup)) {
|
104 |
-
global $SGPB_DATA_CONFIG_ARRAY;
|
105 |
if (@$foundPopup->post_type == SG_POPUP_POST_TYPE) {
|
106 |
-
$events =
|
107 |
-
$targets = array(
|
108 |
// for any targets preview popup should open
|
109 |
if (!empty($targets[0][0])) {
|
110 |
$targets[0][0]['param'] = 'post_all';
|
73 |
|
74 |
$popupFromUrl = SGPopup::find($getterId, $args);
|
75 |
if (!empty($popupFromUrl)) {
|
|
|
76 |
$defaultEvent = array();
|
77 |
$customDelay = $popupFromUrl->getOptionValue('sgpb-popup-delay');
|
78 |
+
$defaultEvent[] = \SgpbDataConfig::websiteDefaultConfigs()[0];
|
79 |
$defaultEvent[0]['value'] = 0;
|
80 |
if ($customDelay) {
|
81 |
$defaultEvent[0]['value'] = $customDelay;
|
100 |
$foundPopup = $post;
|
101 |
}
|
102 |
if (!empty($foundPopup)) {
|
|
|
103 |
if (@$foundPopup->post_type == SG_POPUP_POST_TYPE) {
|
104 |
+
$events = \SgpbDataConfig::websiteDefaultConfigs()['events'][0];
|
105 |
+
$targets = array(\SgpbDataConfig::websiteDefaultConfigs()['target']);
|
106 |
// for any targets preview popup should open
|
107 |
if (!empty($targets[0][0])) {
|
108 |
$targets[0][0]['param'] = 'post_all';
|
com/classes/popups/SGPopup.php
CHANGED
@@ -660,6 +660,12 @@ abstract class SGPopup
|
|
660 |
$isNotPostType = false;
|
661 |
}
|
662 |
|
|
|
|
|
|
|
|
|
|
|
|
|
663 |
/*
|
664 |
* $isNotPostType => false must search inside post types post
|
665 |
* $isNotPostType => true must save array data
|
660 |
$isNotPostType = false;
|
661 |
}
|
662 |
|
663 |
+
if (isset($valueAttrs['isPostCategory'])){
|
664 |
+
$targetData[$groupId][$ruleId]['value'] = ConfigDataHelper::getTermsByIds($ruleData['value']);
|
665 |
+
} elseif(isset($valueAttrs['isPostTag'])) {
|
666 |
+
$targetData[$groupId][$ruleId]['value'] = ConfigDataHelper::getTagsByIds($ruleData['value']);
|
667 |
+
}
|
668 |
+
|
669 |
/*
|
670 |
* $isNotPostType => false must search inside post types post
|
671 |
* $isNotPostType => true must save array data
|
com/config/configPackage.php
CHANGED
@@ -3,6 +3,6 @@ if (!defined('ABSPATH')) {
|
|
3 |
exit();
|
4 |
}
|
5 |
|
6 |
-
define('SG_POPUP_VERSION', '4.1.
|
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', '4.1.5');
|
7 |
define('SGPB_POPUP_PKG', SGPB_POPUP_PKG_FREE);
|
8 |
define('POPUP_BUILDER_BASENAME', 'popupbuilder-platinum/popup-builder.php');
|
com/config/dataConfig.php
CHANGED
@@ -68,11 +68,11 @@ class SgpbDataConfig
|
|
68 |
$targetDataParams['operator'] = apply_filters('sgPopupTargetOperator', $targetDataOperator);
|
69 |
$targetDataParams['post_selected'] = apply_filters('sgPopupTargetPostData', array());
|
70 |
$targetDataParams['page_selected'] = apply_filters('sgPopupTargetPageSelected', array());
|
71 |
-
$targetDataParams['post_type'] = apply_filters('sgPopupTargetPostType',
|
72 |
-
$targetDataParams['post_category'] = apply_filters('sgPopupTargetPostCategory',
|
73 |
-
$targetDataParams['page_type'] = apply_filters('sgPopupTargetPageType',
|
74 |
$targetDataParams['page_template'] = apply_filters('sgPopupPageTemplates', array());
|
75 |
-
$targetDataParams['post_tags_ids'] = apply_filters('sgPopupTags',
|
76 |
$targetDataParams['everywhere'] = null;
|
77 |
$targetDataParams['not_rule'] = null;
|
78 |
$targetDataParams['post_all'] = null;
|
@@ -148,9 +148,10 @@ class SgpbDataConfig
|
|
148 |
'htmlAttrs' => array(
|
149 |
'class' => 'js-sg-select2 js-select-ajax',
|
150 |
'data-select-class' => 'js-select-ajax',
|
151 |
-
'data-select-type' => '
|
152 |
'data-value-param' => 'postCategories',
|
153 |
'isNotPostType' => true,
|
|
|
154 |
'multiple' => 'multiple'
|
155 |
),
|
156 |
'infoAttrs' => array(
|
@@ -163,7 +164,7 @@ class SgpbDataConfig
|
|
163 |
'class' => 'js-sg-select2 js-select-ajax',
|
164 |
'data-select-class' => 'js-select-ajax',
|
165 |
'data-select-type' => 'multiple',
|
166 |
-
'data-value-param' => '
|
167 |
'isNotPostType' => true,
|
168 |
'multiple' => 'multiple'
|
169 |
),
|
@@ -190,9 +191,10 @@ class SgpbDataConfig
|
|
190 |
'htmlAttrs' => array(
|
191 |
'class' => 'js-sg-select2 js-select-ajax',
|
192 |
'data-select-class' => 'js-select-ajax',
|
193 |
-
'data-select-type' => '
|
194 |
'data-value-param' => 'postTags',
|
195 |
'isNotPostType' => true,
|
|
|
196 |
'multiple' => 'multiple'
|
197 |
),
|
198 |
'infoAttrs' => array(
|
@@ -1030,4 +1032,22 @@ class SgpbDataConfig
|
|
1030 |
|
1031 |
$SGPB_TRANSIENT_CONFIG = apply_filters('sgpbAllTransients', $SGPB_TRANSIENT_CONFIG);
|
1032 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
}
|
68 |
$targetDataParams['operator'] = apply_filters('sgPopupTargetOperator', $targetDataOperator);
|
69 |
$targetDataParams['post_selected'] = apply_filters('sgPopupTargetPostData', array());
|
70 |
$targetDataParams['page_selected'] = apply_filters('sgPopupTargetPageSelected', array());
|
71 |
+
$targetDataParams['post_type'] = apply_filters('sgPopupTargetPostType', array());
|
72 |
+
$targetDataParams['post_category'] = apply_filters('sgPopupTargetPostCategory', array());
|
73 |
+
$targetDataParams['page_type'] = apply_filters('sgPopupTargetPageType', array());
|
74 |
$targetDataParams['page_template'] = apply_filters('sgPopupPageTemplates', array());
|
75 |
+
$targetDataParams['post_tags_ids'] = apply_filters('sgPopupTags', array());
|
76 |
$targetDataParams['everywhere'] = null;
|
77 |
$targetDataParams['not_rule'] = null;
|
78 |
$targetDataParams['post_all'] = null;
|
148 |
'htmlAttrs' => array(
|
149 |
'class' => 'js-sg-select2 js-select-ajax',
|
150 |
'data-select-class' => 'js-select-ajax',
|
151 |
+
'data-select-type' => 'ajax',
|
152 |
'data-value-param' => 'postCategories',
|
153 |
'isNotPostType' => true,
|
154 |
+
'isPostCategory' => true,
|
155 |
'multiple' => 'multiple'
|
156 |
),
|
157 |
'infoAttrs' => array(
|
164 |
'class' => 'js-sg-select2 js-select-ajax',
|
165 |
'data-select-class' => 'js-select-ajax',
|
166 |
'data-select-type' => 'multiple',
|
167 |
+
'data-value-param' => 'pageTypes',
|
168 |
'isNotPostType' => true,
|
169 |
'multiple' => 'multiple'
|
170 |
),
|
191 |
'htmlAttrs' => array(
|
192 |
'class' => 'js-sg-select2 js-select-ajax',
|
193 |
'data-select-class' => 'js-select-ajax',
|
194 |
+
'data-select-type' => 'ajax',
|
195 |
'data-value-param' => 'postTags',
|
196 |
'isNotPostType' => true,
|
197 |
+
'isPostTag' => true,
|
198 |
'multiple' => 'multiple'
|
199 |
),
|
200 |
'infoAttrs' => array(
|
1032 |
|
1033 |
$SGPB_TRANSIENT_CONFIG = apply_filters('sgpbAllTransients', $SGPB_TRANSIENT_CONFIG);
|
1034 |
}
|
1035 |
+
|
1036 |
+
/**
|
1037 |
+
* method to get popup default conditions or other configs
|
1038 |
+
*
|
1039 |
+
*/
|
1040 |
+
public static function websiteDefaultConfigs() {
|
1041 |
+
$configs = array();
|
1042 |
+
$eventsInitialData = array(
|
1043 |
+
array('param' => 'load', 'value' => '', 'hiddenOption' => array())
|
1044 |
+
);
|
1045 |
+
$targetInitialData = array(
|
1046 |
+
array('param' => 'everywhere')
|
1047 |
+
);
|
1048 |
+
$configs['events'] = apply_filters('sgPopupEventsInitialData', $eventsInitialData);
|
1049 |
+
$configs['target'] = apply_filters('sgPopupTargetInitialData', $targetInitialData);
|
1050 |
+
|
1051 |
+
return $configs;
|
1052 |
+
}
|
1053 |
}
|
com/helpers/ConfigDataHelper.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
class ConfigDataHelper
|
3 |
{
|
4 |
public static $customPostType;
|
|
|
5 |
|
6 |
public static function getPostTypeData($args = array())
|
7 |
{
|
@@ -32,6 +33,12 @@ class ConfigDataHelper
|
|
32 |
return $query;
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
public static function getAllCustomPosts()
|
36 |
{
|
37 |
$args = array(
|
@@ -44,8 +51,8 @@ class ConfigDataHelper
|
|
44 |
if (isset($allCustomPosts[SG_POPUP_POST_TYPE])) {
|
45 |
unset($allCustomPosts[SG_POPUP_POST_TYPE]);
|
46 |
}
|
47 |
-
|
48 |
-
return $allCustomPosts;
|
49 |
}
|
50 |
|
51 |
public static function addFilters()
|
@@ -55,16 +62,19 @@ class ConfigDataHelper
|
|
55 |
|
56 |
private static function addPostTypeToFilters()
|
57 |
{
|
|
|
58 |
add_filter('sgPopupTargetParams', array(__CLASS__, 'addPopupTargetParams'), 1, 1);
|
59 |
add_filter('sgPopupTargetData', array(__CLASS__, 'addPopupTargetData'), 1, 1);
|
60 |
add_filter('sgPopupTargetTypes', array(__CLASS__, 'addPopupTargetTypes'), 1, 1);
|
61 |
add_filter('sgPopupTargetAttrs', array(__CLASS__, 'addPopupTargetAttrs'), 1, 1);
|
62 |
add_filter('sgPopupPageTemplates', array(__CLASS__, 'addPopupPageTemplates'), 1, 1);
|
|
|
|
|
63 |
}
|
64 |
|
65 |
public static function addPopupTargetParams($targetParams)
|
66 |
{
|
67 |
-
$allCustomPostTypes = self
|
68 |
// for conditions, to exclude other post types, tags etc.
|
69 |
if (isset($targetParams['select_role'])) {
|
70 |
return $targetParams;
|
@@ -84,7 +94,7 @@ class ConfigDataHelper
|
|
84 |
|
85 |
public static function addPopupTargetData($targetData)
|
86 |
{
|
87 |
-
$allCustomPostTypes = self
|
88 |
|
89 |
foreach ($allCustomPostTypes as $customPostType) {
|
90 |
$targetData[$customPostType.'_all'] = null;
|
@@ -108,7 +118,7 @@ class ConfigDataHelper
|
|
108 |
|
109 |
public static function addPopupTargetTypes($targetTypes)
|
110 |
{
|
111 |
-
$allCustomPostTypes = self
|
112 |
|
113 |
foreach ($allCustomPostTypes as $customPostType) {
|
114 |
$targetTypes[$customPostType.'_selected'] = 'select';
|
@@ -120,7 +130,7 @@ class ConfigDataHelper
|
|
120 |
|
121 |
public static function addPopupTargetAttrs($targetAttrs)
|
122 |
{
|
123 |
-
$allCustomPostTypes = self
|
124 |
|
125 |
foreach ($allCustomPostTypes as $customPostType) {
|
126 |
$targetAttrs[$customPostType.'_selected']['htmlAttrs'] = array('class' => 'js-sg-select2 js-select-ajax', 'data-select-class' => 'js-select-ajax', 'data-select-type' => 'ajax', 'data-value-param' => $customPostType, 'multiple' => 'multiple');
|
@@ -157,21 +167,20 @@ class ConfigDataHelper
|
|
157 |
return $allCustomPosts;
|
158 |
}
|
159 |
|
160 |
-
public static function getPostsAllCategories($postType = 'post', $taxonomies = array())
|
161 |
{
|
162 |
-
$cats =
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
)
|
173 |
-
|
174 |
-
}
|
175 |
|
176 |
$supportedTaxonomies = array('category');
|
177 |
if (!empty($taxonomies)) {
|
@@ -229,11 +238,12 @@ class ConfigDataHelper
|
|
229 |
return $pageTemplates;
|
230 |
}
|
231 |
|
232 |
-
public static function getAllTags()
|
233 |
{
|
234 |
$allTags = array();
|
235 |
$tags = get_tags(array(
|
236 |
-
'hide_empty' => false
|
|
|
237 |
));
|
238 |
|
239 |
foreach ($tags as $tag) {
|
@@ -242,6 +252,31 @@ class ConfigDataHelper
|
|
242 |
|
243 |
return $allTags;
|
244 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
public static function defaultData()
|
247 |
{
|
2 |
class ConfigDataHelper
|
3 |
{
|
4 |
public static $customPostType;
|
5 |
+
public static $allCustomPosts = array();
|
6 |
|
7 |
public static function getPostTypeData($args = array())
|
8 |
{
|
33 |
return $query;
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* this method is used for to get all other post types
|
38 |
+
* that may created by another plugins or theme or website owner!
|
39 |
+
*
|
40 |
+
* example: download from EDD, product from Woocommerce!
|
41 |
+
*/
|
42 |
public static function getAllCustomPosts()
|
43 |
{
|
44 |
$args = array(
|
51 |
if (isset($allCustomPosts[SG_POPUP_POST_TYPE])) {
|
52 |
unset($allCustomPosts[SG_POPUP_POST_TYPE]);
|
53 |
}
|
54 |
+
self::$allCustomPosts = $allCustomPosts;
|
55 |
+
return $allCustomPosts; // TODO check for usages and remove this line
|
56 |
}
|
57 |
|
58 |
public static function addFilters()
|
62 |
|
63 |
private static function addPostTypeToFilters()
|
64 |
{
|
65 |
+
self::getAllCustomPosts();
|
66 |
add_filter('sgPopupTargetParams', array(__CLASS__, 'addPopupTargetParams'), 1, 1);
|
67 |
add_filter('sgPopupTargetData', array(__CLASS__, 'addPopupTargetData'), 1, 1);
|
68 |
add_filter('sgPopupTargetTypes', array(__CLASS__, 'addPopupTargetTypes'), 1, 1);
|
69 |
add_filter('sgPopupTargetAttrs', array(__CLASS__, 'addPopupTargetAttrs'), 1, 1);
|
70 |
add_filter('sgPopupPageTemplates', array(__CLASS__, 'addPopupPageTemplates'), 1, 1);
|
71 |
+
add_filter('sgPopupTargetPostType', array(__CLASS__, 'getAllCustomPostTypes'), 1, 1);
|
72 |
+
add_filter('sgPopupTargetPageType', array(__CLASS__, 'getPageTypes'), 1, 1);
|
73 |
}
|
74 |
|
75 |
public static function addPopupTargetParams($targetParams)
|
76 |
{
|
77 |
+
$allCustomPostTypes = self::$allCustomPosts;
|
78 |
// for conditions, to exclude other post types, tags etc.
|
79 |
if (isset($targetParams['select_role'])) {
|
80 |
return $targetParams;
|
94 |
|
95 |
public static function addPopupTargetData($targetData)
|
96 |
{
|
97 |
+
$allCustomPostTypes = self::$allCustomPosts;
|
98 |
|
99 |
foreach ($allCustomPostTypes as $customPostType) {
|
100 |
$targetData[$customPostType.'_all'] = null;
|
118 |
|
119 |
public static function addPopupTargetTypes($targetTypes)
|
120 |
{
|
121 |
+
$allCustomPostTypes = self::$allCustomPosts;
|
122 |
|
123 |
foreach ($allCustomPostTypes as $customPostType) {
|
124 |
$targetTypes[$customPostType.'_selected'] = 'select';
|
130 |
|
131 |
public static function addPopupTargetAttrs($targetAttrs)
|
132 |
{
|
133 |
+
$allCustomPostTypes = self::$allCustomPosts;
|
134 |
|
135 |
foreach ($allCustomPostTypes as $customPostType) {
|
136 |
$targetAttrs[$customPostType.'_selected']['htmlAttrs'] = array('class' => 'js-sg-select2 js-select-ajax', 'data-select-class' => 'js-select-ajax', 'data-select-type' => 'ajax', 'data-value-param' => $customPostType, 'multiple' => 'multiple');
|
167 |
return $allCustomPosts;
|
168 |
}
|
169 |
|
170 |
+
public static function getPostsAllCategories($postType = 'post', $taxonomies = array(), $search_text = '')
|
171 |
{
|
172 |
+
$cats = get_terms(
|
173 |
+
array(
|
174 |
+
'taxonomy' => $taxonomies,
|
175 |
+
'hide_empty' => false,
|
176 |
+
'type' => $postType,
|
177 |
+
'orderby' => 'name',
|
178 |
+
'order' => 'ASC',
|
179 |
+
'number' => 200,
|
180 |
+
'offset' => 0,
|
181 |
+
'name__like' => $search_text
|
182 |
+
)
|
183 |
+
);
|
|
|
184 |
|
185 |
$supportedTaxonomies = array('category');
|
186 |
if (!empty($taxonomies)) {
|
238 |
return $pageTemplates;
|
239 |
}
|
240 |
|
241 |
+
public static function getAllTags($search_text = '')
|
242 |
{
|
243 |
$allTags = array();
|
244 |
$tags = get_tags(array(
|
245 |
+
'hide_empty' => false,
|
246 |
+
'name__like' => $search_text
|
247 |
));
|
248 |
|
249 |
foreach ($tags as $tag) {
|
252 |
|
253 |
return $allTags;
|
254 |
}
|
255 |
+
public static function getTagsByIds($ids = [])
|
256 |
+
{
|
257 |
+
$allTags = array();
|
258 |
+
$tags = get_tags(array(
|
259 |
+
'hide_empty' => false,
|
260 |
+
'include' => $ids
|
261 |
+
));
|
262 |
+
foreach ($tags as $tag) {
|
263 |
+
$allTags[$tag->slug] = $tag->name;
|
264 |
+
}
|
265 |
+
return $allTags;
|
266 |
+
}
|
267 |
+
|
268 |
+
public static function getTermsByIds($ids = array())
|
269 |
+
{
|
270 |
+
$allTags = array();
|
271 |
+
$terms = get_terms(array(
|
272 |
+
'hide_empty' => false,
|
273 |
+
'include' => $ids
|
274 |
+
));
|
275 |
+
foreach ($terms as $term) {
|
276 |
+
$allTags[$term->term_id] = $term->name;
|
277 |
+
}
|
278 |
+
return $allTags;
|
279 |
+
}
|
280 |
|
281 |
public static function defaultData()
|
282 |
{
|
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: 4.1.
|
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: 4.1.5
|
7 |
* Author: Sygnoos
|
8 |
* Author URI: https://sygnoos.com
|
9 |
* License: GPLv2
|
public/js/PopupBuilder.js
CHANGED
@@ -197,8 +197,10 @@ SGPBPopup.mobileSafariAdditionalSettings = function(e)
|
|
197 |
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
|
198 |
if (typeof popupOptions['sgpb-popup-dimension-mode'] !== 'undefined' && popupOptions['sgpb-popup-dimension-mode'] === 'responsiveMode') {
|
199 |
var openedPopupWidth = parseInt(window.innerHeight-100);
|
200 |
-
if (
|
201 |
-
jQuery('.sgpb-popup-builder-content-'+popupId
|
|
|
|
|
202 |
}
|
203 |
}
|
204 |
}
|
197 |
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
|
198 |
if (typeof popupOptions['sgpb-popup-dimension-mode'] !== 'undefined' && popupOptions['sgpb-popup-dimension-mode'] === 'responsiveMode') {
|
199 |
var openedPopupWidth = parseInt(window.innerHeight-100);
|
200 |
+
if (e.detail.popupData['sgpb-type'] === 'iframe' || e.detail.popupData['sgpb-type'] === 'video') {
|
201 |
+
if (jQuery('.sgpb-popup-builder-content-'+popupId +' iframe').length) {
|
202 |
+
jQuery('.sgpb-popup-builder-content-'+popupId).attr('style', 'height:'+openedPopupWidth+'px !important;');
|
203 |
+
}
|
204 |
}
|
205 |
}
|
206 |
}
|
readme.txt
CHANGED
@@ -8,7 +8,7 @@ Tags: popup, pop up, wordpress popup, popup maker, exit popup, popup builder, wo
|
|
8 |
Requires at least: 4.2
|
9 |
Tested up to: 5.9
|
10 |
Requires PHP: 5.3.3
|
11 |
-
Stable tag: 4.1.
|
12 |
License: GPLv2 or later
|
13 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
14 |
|
@@ -146,6 +146,12 @@ Go to the Popup Builder settings and set your desired options.
|
|
146 |
|
147 |
== Changelog ==
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
= Version 4.1.4 =
|
150 |
* Bug fixed related to filenames that contain non ascii characters
|
151 |
* Bug fixed related to UI issues on multisite
|
@@ -519,4 +525,4 @@ Leave us a good review :)
|
|
519 |
|
520 |
== Upgrade Notice ==
|
521 |
|
522 |
-
Current Version of Popup Builder is 4.1.
|
8 |
Requires at least: 4.2
|
9 |
Tested up to: 5.9
|
10 |
Requires PHP: 5.3.3
|
11 |
+
Stable tag: 4.1.5
|
12 |
License: GPLv2 or later
|
13 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
14 |
|
146 |
|
147 |
== Changelog ==
|
148 |
|
149 |
+
= Version 4.1.5 =
|
150 |
+
* Improvement of code, some queries are optimized
|
151 |
+
* Bug fixed related to popup opening issues on iOS devices
|
152 |
+
* Bug fixed related to Newsletter text formatting in testing mode
|
153 |
+
* Bug fixed related to popups that are set to appear on post categories
|
154 |
+
|
155 |
= Version 4.1.4 =
|
156 |
* Bug fixed related to filenames that contain non ascii characters
|
157 |
* Bug fixed related to UI issues on multisite
|
525 |
|
526 |
== Upgrade Notice ==
|
527 |
|
528 |
+
Current Version of Popup Builder is 4.1.5
|