Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/popup-bu.../com/classes/popups
File: SubscriptionPopup.php
<?php
[0] Fix | Delete
namespace sgpb;
[1] Fix | Delete
require_once(dirname(__FILE__).'/SGPopup.php');
[2] Fix | Delete
require_once(ABSPATH.'wp-admin/includes/plugin.php');
[3] Fix | Delete
[4] Fix | Delete
class SubscriptionPopup extends SGPopup
[5] Fix | Delete
{
[6] Fix | Delete
private $data;
[7] Fix | Delete
private $formContent = '';
[8] Fix | Delete
[9] Fix | Delete
public function __construct()
[10] Fix | Delete
{
[11] Fix | Delete
add_filter('sgpbPopupRenderOptions', array($this, 'renderOptions'), 12, 1);
[12] Fix | Delete
add_filter('sgpbAdminJsFiles', array($this, 'adminJsFilter'), 1, 1);
[13] Fix | Delete
add_filter('sgpbAdminCssFiles', array($this, 'adminCssFilter'), 1, 1);
[14] Fix | Delete
add_filter('sgpbSubscriptionForm', array($this, 'subscriptionForm'), 1, 1);
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
private function frontendFilters()
[18] Fix | Delete
{
[19] Fix | Delete
$isSubscriptionPlusActive = is_plugin_active(SGPB_POPUP_SUBSCRIPTION_PLUS_EXTENSION_KEY);
[20] Fix | Delete
[21] Fix | Delete
if (!$isSubscriptionPlusActive) {
[22] Fix | Delete
add_filter('sgpbFrontendJsFiles', array($this, 'frontJsFilter'), 1, 1);
[23] Fix | Delete
}
[24] Fix | Delete
add_filter('sgpbFrontendCssFiles', array($this, 'frontCssFilter'), 1, 1);
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
public function setData($data)
[28] Fix | Delete
{
[29] Fix | Delete
$this->data = $data;
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
public function getData()
[33] Fix | Delete
{
[34] Fix | Delete
return $this->data;
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
public function setFormContent($formContent)
[38] Fix | Delete
{
[39] Fix | Delete
$this->formContent = $formContent;
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
public function getFormContent()
[43] Fix | Delete
{
[44] Fix | Delete
return $this->formContent;
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
public static function getTablesSql()
[48] Fix | Delete
{
[49] Fix | Delete
$tablesSql = array();
[50] Fix | Delete
$dbEngine = Functions::getDatabaseEngine();
[51] Fix | Delete
[52] Fix | Delete
$tablesSql[] = SGPB_SUBSCRIBERS_TABLE_NAME.' (
[53] Fix | Delete
`id` int(12) NOT NULL AUTO_INCREMENT,
[54] Fix | Delete
`firstName` varchar(255),
[55] Fix | Delete
`lastName` varchar(255),
[56] Fix | Delete
`email` varchar(255),
[57] Fix | Delete
`subscriptionType` int(12),
[58] Fix | Delete
`cDate` date,
[59] Fix | Delete
`status` varchar(255),
[60] Fix | Delete
`unsubscribed` int(11) default 0,
[61] Fix | Delete
PRIMARY KEY (id)
[62] Fix | Delete
) ENGINE='.$dbEngine.' DEFAULT CHARSET=utf8;';
[63] Fix | Delete
[64] Fix | Delete
$tablesSql[] = SGPB_SUBSCRIBERS_ERROR_TABLE_NAME.' (
[65] Fix | Delete
`id` int(12) NOT NULL AUTO_INCREMENT,
[66] Fix | Delete
`firstName` varchar(255),
[67] Fix | Delete
`popupType` varchar(255),
[68] Fix | Delete
`email` varchar(255),
[69] Fix | Delete
`date` varchar(255),
[70] Fix | Delete
PRIMARY KEY (id)
[71] Fix | Delete
) ENGINE='.$dbEngine.' DEFAULT CHARSET=utf8;';
[72] Fix | Delete
[73] Fix | Delete
return $tablesSql;
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
/**
[77] Fix | Delete
* Return Subscription popup type need all table names
[78] Fix | Delete
*
[79] Fix | Delete
* @since 1.0.0
[80] Fix | Delete
*
[81] Fix | Delete
* @return array $table names
[82] Fix | Delete
*
[83] Fix | Delete
*/
[84] Fix | Delete
public static function getTableNames()
[85] Fix | Delete
{
[86] Fix | Delete
$tableNames = array(
[87] Fix | Delete
SGPB_SUBSCRIBERS_TABLE_NAME,
[88] Fix | Delete
SGPB_SUBSCRIBERS_ERROR_TABLE_NAME
[89] Fix | Delete
);
[90] Fix | Delete
[91] Fix | Delete
return $tableNames;
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
public function frontJsFilter($jsFiles)
[95] Fix | Delete
{
[96] Fix | Delete
$jsFiles[] = array('folderUrl' => SG_POPUP_JS_URL, 'filename' => 'Subscription.js');
[97] Fix | Delete
$jsFiles[] = array('folderUrl' => SG_POPUP_JS_URL, 'filename' => 'Validate.js');
[98] Fix | Delete
[99] Fix | Delete
return $jsFiles;
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
public function adminJsFilter($jsFiles)
[103] Fix | Delete
{
[104] Fix | Delete
$jsFiles[] = array('folderUrl' => SG_POPUP_JS_URL, 'filename' => 'Subscription.js');
[105] Fix | Delete
[106] Fix | Delete
return $jsFiles;
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
public function adminCssFilter($cssFiles)
[110] Fix | Delete
{
[111] Fix | Delete
$cssFiles[] = array(
[112] Fix | Delete
'folderUrl' => SG_POPUP_CSS_URL,
[113] Fix | Delete
'filename' => 'ResetFormStyle.css'
[114] Fix | Delete
);
[115] Fix | Delete
$cssFiles[] = array(
[116] Fix | Delete
'folderUrl' => SG_POPUP_CSS_URL,
[117] Fix | Delete
'filename' => 'SubscriptionForm.css'
[118] Fix | Delete
);
[119] Fix | Delete
[120] Fix | Delete
return $cssFiles;
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
public function frontCssFilter($cssFiles)
[124] Fix | Delete
{
[125] Fix | Delete
$cssFiles[] = array(
[126] Fix | Delete
'folderUrl' => SG_POPUP_CSS_URL,
[127] Fix | Delete
'filename' => 'ResetFormStyle.css',
[128] Fix | Delete
'inFooter' => true
[129] Fix | Delete
);
[130] Fix | Delete
$cssFiles[] = array(
[131] Fix | Delete
'folderUrl' => SG_POPUP_CSS_URL,
[132] Fix | Delete
'filename' => 'SubscriptionForm.css',
[133] Fix | Delete
'inFooter' => true
[134] Fix | Delete
);
[135] Fix | Delete
[136] Fix | Delete
return $cssFiles;
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
public function addAdditionalSettings($postData = array(), $obj = null)
[140] Fix | Delete
{
[141] Fix | Delete
$this->setData($postData);
[142] Fix | Delete
$this->setPostData($postData);
[143] Fix | Delete
$isSubscriptionPlusActive = is_plugin_active(SGPB_POPUP_SUBSCRIPTION_PLUS_EXTENSION_KEY);
[144] Fix | Delete
[145] Fix | Delete
if (!$isSubscriptionPlusActive) {
[146] Fix | Delete
$postData['sgpb-subs-fields'] = $this->createFormFieldsData();
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
return $postData;
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
public function setSubsFormData($formId)
[153] Fix | Delete
{
[154] Fix | Delete
$savedData = array();
[155] Fix | Delete
[156] Fix | Delete
if (!empty($formId)) {
[157] Fix | Delete
$savedData = SGPopup::getSavedData($formId);
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
$this->setData($savedData);
[161] Fix | Delete
}
[162] Fix | Delete
[163] Fix | Delete
private function getFieldValue($optionName)
[164] Fix | Delete
{
[165] Fix | Delete
$optionValue = '';
[166] Fix | Delete
$postData = $this->getPostData();
[167] Fix | Delete
[168] Fix | Delete
if (!empty($postData[$optionName])) {
[169] Fix | Delete
return $postData[$optionName];
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
$defaultData = $this->getDefaultDataByName($optionName);
[173] Fix | Delete
[174] Fix | Delete
// when Saved data does not exist we try find inside default values
[175] Fix | Delete
if (empty($postData) && !empty($defaultData)) {
[176] Fix | Delete
return $defaultData['defaultValue'];
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
return $optionValue;
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
/**
[183] Fix | Delete
* Create form fields data
[184] Fix | Delete
*
[185] Fix | Delete
* @since 1.0.0
[186] Fix | Delete
*
[187] Fix | Delete
* @return array $formData
[188] Fix | Delete
*/
[189] Fix | Delete
public function createFormFieldsData()
[190] Fix | Delete
{
[191] Fix | Delete
$formData = array();
[192] Fix | Delete
$inputStyles = array();
[193] Fix | Delete
$submitStyles = array();
[194] Fix | Delete
$emailPlaceholder = $this->getFieldValue('sgpb-subs-email-placeholder');
[195] Fix | Delete
if ($this->getFieldValue('sgpb-subs-text-width')) {
[196] Fix | Delete
$inputWidth = $this->getFieldValue('sgpb-subs-text-width');
[197] Fix | Delete
$inputStyles['width'] = AdminHelper::getCSSSafeSize($inputWidth);
[198] Fix | Delete
}
[199] Fix | Delete
if ($this->getFieldValue('sgpb-subs-text-height')) {
[200] Fix | Delete
$inputHeight = $this->getFieldValue('sgpb-subs-text-height');
[201] Fix | Delete
$inputStyles['height'] = AdminHelper::getCSSSafeSize($inputHeight);
[202] Fix | Delete
}
[203] Fix | Delete
if ($this->getFieldValue('sgpb-subs-text-border-width')) {
[204] Fix | Delete
$inputBorderWidth = $this->getFieldValue('sgpb-subs-text-border-width');
[205] Fix | Delete
$inputStyles['border-width'] = AdminHelper::getCSSSafeSize($inputBorderWidth);
[206] Fix | Delete
}
[207] Fix | Delete
if ($this->getFieldValue('sgpb-subs-text-border-color')) {
[208] Fix | Delete
$inputStyles['border-color'] = $this->getFieldValue('sgpb-subs-text-border-color');
[209] Fix | Delete
}
[210] Fix | Delete
if ($this->getFieldValue('sgpb-subs-text-bg-color')) {
[211] Fix | Delete
$inputStyles['background-color'] = $this->getFieldValue('sgpb-subs-text-bg-color');
[212] Fix | Delete
}
[213] Fix | Delete
if ($this->getFieldValue('sgpb-subs-text-color')) {
[214] Fix | Delete
$inputStyles['color'] = $this->getFieldValue('sgpb-subs-text-color');
[215] Fix | Delete
}
[216] Fix | Delete
$inputStyles['autocomplete'] = 'off';
[217] Fix | Delete
[218] Fix | Delete
if ($this->getFieldValue('sgpb-subs-btn-width')) {
[219] Fix | Delete
$submitWidth = $this->getFieldValue('sgpb-subs-btn-width');
[220] Fix | Delete
$submitStyles['width'] = AdminHelper::getCSSSafeSize($submitWidth);
[221] Fix | Delete
}
[222] Fix | Delete
if ($this->getFieldValue('sgpb-subs-btn-height')) {
[223] Fix | Delete
$submitHeight = $this->getFieldValue('sgpb-subs-btn-height');
[224] Fix | Delete
$submitStyles['height'] = AdminHelper::getCSSSafeSize($submitHeight);
[225] Fix | Delete
}
[226] Fix | Delete
if ($this->getFieldValue('sgpb-subs-btn-bg-color')) {
[227] Fix | Delete
$submitStyles['background-color'] = $this->getFieldValue('sgpb-subs-btn-bg-color').' !important';
[228] Fix | Delete
}
[229] Fix | Delete
if ($this->getFieldValue('sgpb-subs-btn-text-color')) {
[230] Fix | Delete
$submitStyles['color'] = $this->getFieldValue('sgpb-subs-btn-text-color');
[231] Fix | Delete
}
[232] Fix | Delete
if ($this->getFieldValue('sgpb-subs-btn-border-radius')) {
[233] Fix | Delete
$submitStyles['border-radius'] = AdminHelper::getCSSSafeSize($this->getFieldValue('sgpb-subs-btn-border-radius')).' !important';
[234] Fix | Delete
}
[235] Fix | Delete
if ($this->getFieldValue('sgpb-subs-btn-border-width')) {
[236] Fix | Delete
$submitStyles['border-width'] = AdminHelper::getCSSSafeSize($this->getFieldValue('sgpb-subs-btn-border-width')).' !important';
[237] Fix | Delete
}
[238] Fix | Delete
if ($this->getFieldValue('sgpb-subs-btn-border-color')) {
[239] Fix | Delete
$submitStyles['border-color'] = $this->getFieldValue('sgpb-subs-btn-border-color').' !important';
[240] Fix | Delete
}
[241] Fix | Delete
$submitStyles['text-transform'] = 'none !important';
[242] Fix | Delete
$submitStyles['border-style'] = 'solid';
[243] Fix | Delete
[244] Fix | Delete
$formData['email'] = array(
[245] Fix | Delete
'isShow' => true,
[246] Fix | Delete
'attrs' => array(
[247] Fix | Delete
'type' => 'email',
[248] Fix | Delete
'data-required' => true,
[249] Fix | Delete
'name' => 'sgpb-subs-email',
[250] Fix | Delete
'placeholder' => $emailPlaceholder,
[251] Fix | Delete
'class' => 'js-subs-text-inputs js-subs-email-input',
[252] Fix | Delete
'data-error-message-class' => 'sgpb-subs-email-error-message'
[253] Fix | Delete
),
[254] Fix | Delete
'style' => $inputStyles,
[255] Fix | Delete
'errorMessageBoxStyles' => isset($inputStyles["width"]) ?$inputStyles["width"] : ''
[256] Fix | Delete
);
[257] Fix | Delete
[258] Fix | Delete
$firstNamePlaceholder = $this->getFieldValue('sgpb-subs-first-placeholder');
[259] Fix | Delete
$firstNameRequired = $this->getOptionValueFromSavedData('sgpb-subs-first-name-required');
[260] Fix | Delete
$firstNameRequired = (!empty($firstNameRequired)) ? true : false;
[261] Fix | Delete
$isShow = ($this->getFieldValue('sgpb-subs-first-name-status')) ? true : false;
[262] Fix | Delete
[263] Fix | Delete
$formData['first-name'] = array(
[264] Fix | Delete
'isShow' => $isShow,
[265] Fix | Delete
'attrs' => array(
[266] Fix | Delete
'type' => 'text',
[267] Fix | Delete
'data-required' => $firstNameRequired,
[268] Fix | Delete
'name' => 'sgpb-subs-first-name',
[269] Fix | Delete
'placeholder' => $firstNamePlaceholder,
[270] Fix | Delete
'class' => 'js-subs-text-inputs js-subs-first-name-input',
[271] Fix | Delete
'data-error-message-class' => 'sgpb-subs-first-name-error-message'
[272] Fix | Delete
),
[273] Fix | Delete
'style' => $inputStyles,
[274] Fix | Delete
'errorMessageBoxStyles' => isset($inputStyles['width']) ? $inputStyles['width'] : ''
[275] Fix | Delete
);
[276] Fix | Delete
[277] Fix | Delete
$lastNamePlaceholder = $this->getFieldValue('sgpb-subs-last-placeholder');
[278] Fix | Delete
$lastNameRequired = $this->getOptionValueFromSavedData('sgpb-subs-last-name-required');
[279] Fix | Delete
$lastNameRequired = (!empty($lastNameRequired)) ? true : false;
[280] Fix | Delete
$isShow = ($this->getFieldValue('sgpb-subs-last-name-status')) ? true : false;
[281] Fix | Delete
[282] Fix | Delete
$formData['last-name'] = array(
[283] Fix | Delete
'isShow' => $isShow,
[284] Fix | Delete
'attrs' => array(
[285] Fix | Delete
'type' => 'text',
[286] Fix | Delete
'data-required' => $lastNameRequired,
[287] Fix | Delete
'name' => 'sgpb-subs-last-name',
[288] Fix | Delete
'placeholder' => $lastNamePlaceholder,
[289] Fix | Delete
'class' => 'js-subs-text-inputs js-subs-last-name-input',
[290] Fix | Delete
'data-error-message-class' => 'sgpb-subs-last-name-error-message'
[291] Fix | Delete
),
[292] Fix | Delete
'style' => $inputStyles,
[293] Fix | Delete
'errorMessageBoxStyles' => isset($inputStyles['width']) ? $inputStyles['width'] : ''
[294] Fix | Delete
);
[295] Fix | Delete
[296] Fix | Delete
/* GDPR checkbox */
[297] Fix | Delete
$gdprLabel = $this->getOptionValueFromSavedData('sgpb-subs-gdpr-label');
[298] Fix | Delete
$gdprRequired = ($this->getOptionValueFromSavedData('sgpb-subs-gdpr-status')) ? true : false;
[299] Fix | Delete
$isShow = ($this->getOptionValueFromSavedData('sgpb-subs-gdpr-status')) ? true : false;
[300] Fix | Delete
[301] Fix | Delete
$formData['gdpr'] = array(
[302] Fix | Delete
'isShow' => $isShow,
[303] Fix | Delete
'attrs' => array(
[304] Fix | Delete
'type' => 'customCheckbox',
[305] Fix | Delete
'data-required' => $gdprRequired,
[306] Fix | Delete
'name' => 'sgpb-subs-gdpr',
[307] Fix | Delete
'class' => 'js-subs-gdpr-inputs js-subs-gdpr-label',
[308] Fix | Delete
'id' => 'sgpb-gdpr-field-label',
[309] Fix | Delete
'data-error-message-class' => 'sgpb-gdpr-error-message'
[310] Fix | Delete
),
[311] Fix | Delete
'style' => array('width' => isset($inputWidth)? $inputWidth :''),
[312] Fix | Delete
'label' => $gdprLabel,
[313] Fix | Delete
'text' => wp_kses($this->getFieldValue('sgpb-subs-gdpr-text'), AdminHelper::allowed_html_tags(false)),
[314] Fix | Delete
'errorMessageBoxStyles' => isset($inputStyles['width'])?$inputStyles['width']:''
[315] Fix | Delete
);
[316] Fix | Delete
/* GDPR checkbox */
[317] Fix | Delete
[318] Fix | Delete
$hiddenChecker['position'] = 'absolute';
[319] Fix | Delete
// For protected bots and spams
[320] Fix | Delete
$hiddenChecker['left'] = '-5000px';
[321] Fix | Delete
$hiddenChecker['padding'] = '0';
[322] Fix | Delete
$formData['hidden-checker'] = array(
[323] Fix | Delete
'isShow' => false,
[324] Fix | Delete
'attrs' => array(
[325] Fix | Delete
'type' => 'hidden',
[326] Fix | Delete
'data-required' => false,
[327] Fix | Delete
'name' => 'sgpb-subs-hidden-checker',
[328] Fix | Delete
'value' => '',
[329] Fix | Delete
'class' => 'js-subs-text-inputs js-subs-last-name-input'
[330] Fix | Delete
),
[331] Fix | Delete
'style' => $hiddenChecker
[332] Fix | Delete
);
[333] Fix | Delete
[334] Fix | Delete
$submitTitle = $this->getFieldValue('sgpb-subs-btn-title');
[335] Fix | Delete
$progressTitle = $this->getFieldValue('sgpb-subs-btn-progress-title');
[336] Fix | Delete
$formData['submit'] = array(
[337] Fix | Delete
'isShow' => true,
[338] Fix | Delete
'attrs' => array(
[339] Fix | Delete
'type' => 'submit',
[340] Fix | Delete
'name' => 'sgpb-subs-submit',
[341] Fix | Delete
'value' => $submitTitle,
[342] Fix | Delete
'data-title' => $submitTitle,
[343] Fix | Delete
'data-progress-title' => $progressTitle,
[344] Fix | Delete
'class' => 'js-subs-submit-btn'
[345] Fix | Delete
),
[346] Fix | Delete
'style' => $submitStyles
[347] Fix | Delete
);
[348] Fix | Delete
[349] Fix | Delete
return $formData;
[350] Fix | Delete
}
[351] Fix | Delete
[352] Fix | Delete
/**
[353] Fix | Delete
* Create validation obj for jQuery validate
[354] Fix | Delete
*
[355] Fix | Delete
* @since 1.0.0
[356] Fix | Delete
*
[357] Fix | Delete
* @param array $subsFields
[358] Fix | Delete
* @param array $validationMessages
[359] Fix | Delete
*
[360] Fix | Delete
* @return string
[361] Fix | Delete
*/
[362] Fix | Delete
private function createValidateObj($subsFields, $validationMessages)
[363] Fix | Delete
{
[364] Fix | Delete
$validateObj = '';
[365] Fix | Delete
$id = $this->getId();
[366] Fix | Delete
$requiredMessage = $this->getOptionValue('sgpb-subs-validation-message');
[367] Fix | Delete
$emailMessage = $this->getOptionValue('sgpb-subs-invalid-message');
[368] Fix | Delete
[369] Fix | Delete
if (empty($subsFields)) {
[370] Fix | Delete
return $validateObj;
[371] Fix | Delete
}
[372] Fix | Delete
[373] Fix | Delete
if (empty($emailMessage)) {
[374] Fix | Delete
$emailMessage = SGPB_SUBSCRIPTION_EMAIL_MESSAGE;
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
if (empty($requiredMessage)) {
[378] Fix | Delete
$requiredMessage = SGPB_SUBSCRIPTION_VALIDATION_MESSAGE;
[379] Fix | Delete
}
[380] Fix | Delete
[381] Fix | Delete
$rules = 'rules: { ';
[382] Fix | Delete
$messages = 'messages: { ';
[383] Fix | Delete
[384] Fix | Delete
$validateObj = 'var sgpbSubsValidateObj'.$id.' = { ';
[385] Fix | Delete
foreach ($subsFields as $subsField) {
[386] Fix | Delete
[387] Fix | Delete
if (empty($subsField['attrs'])) {
[388] Fix | Delete
continue;
[389] Fix | Delete
}
[390] Fix | Delete
[391] Fix | Delete
$attrs = $subsField['attrs'];
[392] Fix | Delete
$type = 'text';
[393] Fix | Delete
$name = '';
[394] Fix | Delete
$required = false;
[395] Fix | Delete
[396] Fix | Delete
if (!empty($attrs['type'])) {
[397] Fix | Delete
$type = $attrs['type'];
[398] Fix | Delete
}
[399] Fix | Delete
if (!empty($attrs['name'])) {
[400] Fix | Delete
$name = $attrs['name'];
[401] Fix | Delete
}
[402] Fix | Delete
if (!empty($attrs['data-required'])) {
[403] Fix | Delete
$required = $attrs['data-required'];
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
if ($type == 'email') {
[407] Fix | Delete
$rules .= '"'.$name.'": {required: true, email: true},';
[408] Fix | Delete
$messages .= '"'.$name.'": {
[409] Fix | Delete
"required": "'.$requiredMessage.'",
[410] Fix | Delete
"email": "'.$emailMessage.'"
[411] Fix | Delete
},';
[412] Fix | Delete
continue;
[413] Fix | Delete
}
[414] Fix | Delete
[415] Fix | Delete
if (!$required) {
[416] Fix | Delete
continue;
[417] Fix | Delete
}
[418] Fix | Delete
[419] Fix | Delete
$messages .= '"'.$name.'": "'.$requiredMessage.'",';
[420] Fix | Delete
$rules .= '"'.$name.'" : "required",';
[421] Fix | Delete
[422] Fix | Delete
}
[423] Fix | Delete
$rules = rtrim($rules, ',');
[424] Fix | Delete
$messages = rtrim($messages, ',');
[425] Fix | Delete
[426] Fix | Delete
$rules .= '},';
[427] Fix | Delete
$messages .= '}';
[428] Fix | Delete
[429] Fix | Delete
$validateObj .= $rules;
[430] Fix | Delete
$validateObj .= $messages;
[431] Fix | Delete
[432] Fix | Delete
$validateObj .= '};';
[433] Fix | Delete
[434] Fix | Delete
return $validateObj;
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
private function getSubscriptionValidationScripts($validateObj)
[438] Fix | Delete
{
[439] Fix | Delete
wp_register_script( 'sgpb-subscriptionpopup-js-footer', '', array("jquery"), SGPB_POPUP_VERSION, true );
[440] Fix | Delete
wp_enqueue_script( 'sgpb-subscriptionpopup-js-footer' );
[441] Fix | Delete
wp_add_inline_script( 'sgpb-subscriptionpopup-js-footer', $validateObj);
[442] Fix | Delete
return '';
[443] Fix | Delete
}
[444] Fix | Delete
[445] Fix | Delete
public function getFormCustomStyles($styleData)
[446] Fix | Delete
{
[447] Fix | Delete
$placeholderColor = $styleData['placeholderColor'];
[448] Fix | Delete
$formBackgroundColor = $this->getFieldValue('sgpb-subs-form-bg-color');
[449] Fix | Delete
$formPadding = $this->getFieldValue('sgpb-subs-form-padding');
[450] Fix | Delete
$formBackgroundOpacity = $this->getFieldValue('sgpb-subs-form-bg-opacity');
[451] Fix | Delete
$popupId = $this->getId();
[452] Fix | Delete
if (isset($styleData['formBackgroundOpacity'])) {
[453] Fix | Delete
$formBackgroundOpacity = $styleData['formBackgroundOpacity'];
[454] Fix | Delete
}
[455] Fix | Delete
if (isset($styleData['formColor'])) {
[456] Fix | Delete
$formBackgroundColor = $styleData['formColor'];
[457] Fix | Delete
}
[458] Fix | Delete
if (isset($styleData['formPadding'])) {
[459] Fix | Delete
$formPadding = $styleData['formPadding'];
[460] Fix | Delete
}
[461] Fix | Delete
$formBackgroundColor = AdminHelper::hexToRgba($formBackgroundColor, $formBackgroundOpacity);
[462] Fix | Delete
[463] Fix | Delete
ob_start();
[464] Fix | Delete
?>
[465] Fix | Delete
<style type="text/css">
[466] Fix | Delete
.sgpb-subs-form-<?php echo esc_attr($popupId); ?> {background-color: <?php echo esc_html($formBackgroundColor); ?>;padding: <?php echo esc_html($formPadding).'px'; ?>}
[467] Fix | Delete
.sgpb-subs-form-<?php echo esc_attr($popupId); ?> .js-subs-text-inputs::-webkit-input-placeholder {color: <?php echo esc_html($placeholderColor); ?>;font-weight: lighter;}
[468] Fix | Delete
.sgpb-subs-form-<?php echo esc_attr($popupId); ?> .js-subs-text-inputs::-moz-placeholder {color:<?php echo esc_html($placeholderColor); ?>;font-weight: lighter;}
[469] Fix | Delete
.sgpb-subs-form-<?php echo esc_attr($popupId); ?> .js-subs-text-inputs:-ms-input-placeholder {color:<?php echo esc_html($placeholderColor); ?>;font-weight: lighter;} /* ie */
[470] Fix | Delete
.sgpb-subs-form-<?php echo esc_attr($popupId); ?> .js-subs-text-inputs:-moz-placeholder {color:<?php echo esc_html($placeholderColor); ?>;font-weight: lighter;}
[471] Fix | Delete
.sgpb-subs-form-<?php echo esc_attr($popupId); ?> input[type="checkbox"] {-webkit-appearance: checkbox;!important}
[472] Fix | Delete
.sgpb-subs-form-<?php echo esc_attr($popupId); ?> input[type="checkbox"]:before {content: none!important; }
[473] Fix | Delete
</style>
[474] Fix | Delete
<?php
[475] Fix | Delete
$styles = ob_get_contents();
[476] Fix | Delete
ob_get_clean();
[477] Fix | Delete
[478] Fix | Delete
return $styles;
[479] Fix | Delete
}
[480] Fix | Delete
[481] Fix | Delete
public function getOptionValue($optionName, $forceDefaultValue = false)
[482] Fix | Delete
{
[483] Fix | Delete
return parent::getOptionValue($optionName, $forceDefaultValue);
[484] Fix | Delete
}
[485] Fix | Delete
[486] Fix | Delete
public function getPopupTypeOptionsView()
[487] Fix | Delete
{
[488] Fix | Delete
$optionsViewData = array(
[489] Fix | Delete
'filePath' => SG_POPUP_TYPE_OPTIONS_PATH . 'subscription.php',
[490] Fix | Delete
'metaboxTitle' => __('Subscription Settings', 'popup-builder'),
[491] Fix | Delete
'short_description' => 'Create subscription form, customize the fields and styles'
[492] Fix | Delete
);
[493] Fix | Delete
[494] Fix | Delete
$isSubscriptionPlusActive = is_plugin_active(SGPB_POPUP_SUBSCRIPTION_PLUS_EXTENSION_KEY);
[495] Fix | Delete
[496] Fix | Delete
if ($isSubscriptionPlusActive) {
[497] Fix | Delete
return array();
[498] Fix | Delete
}
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function