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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/popup-bu.../com/helpers
File: AdminHelper.php
$firstHeader = sprintf('<h1 class="sgpb-review-h1"><strong class="sgrb-review-strong">%1$s</strong> %2$s %3$d %4$s</h1>',
[1000] Fix | Delete
__('This is great!','popup-builder'),
[1001] Fix | Delete
__('We have noticed that you are using Popup Builder plugin on your site for','popup-builder'),
[1002] Fix | Delete
esc_html( $getUsageDays ),
[1003] Fix | Delete
__('days, we are thankful for that.','popup-builder')
[1004] Fix | Delete
);
[1005] Fix | Delete
$popupContent = self::getMaxOpenPopupContent($firstHeader, 'days');
[1006] Fix | Delete
[1007] Fix | Delete
return $popupContent;
[1008] Fix | Delete
}
[1009] Fix | Delete
[1010] Fix | Delete
public static function getPopupUsageDays()
[1011] Fix | Delete
{
[1012] Fix | Delete
$installDate = get_option('SGPBInstallDate');
[1013] Fix | Delete
[1014] Fix | Delete
$timeDate = new \DateTime('now');
[1015] Fix | Delete
$timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
[1016] Fix | Delete
$diff = $timeNow-$installDate;
[1017] Fix | Delete
$days = floor($diff/(60*60*24));
[1018] Fix | Delete
[1019] Fix | Delete
return $days;
[1020] Fix | Delete
}
[1021] Fix | Delete
[1022] Fix | Delete
public static function getMaxOpenPopupContent($firstHeader, $type)
[1023] Fix | Delete
{
[1024] Fix | Delete
ob_start();
[1025] Fix | Delete
?>
[1026] Fix | Delete
<style>
[1027] Fix | Delete
.sgpb-buttons-wrapper .press{
[1028] Fix | Delete
box-sizing:border-box;
[1029] Fix | Delete
cursor:pointer;
[1030] Fix | Delete
display:inline-block;
[1031] Fix | Delete
font-size:1em;
[1032] Fix | Delete
margin:0;
[1033] Fix | Delete
padding:0.5em 0.75em;
[1034] Fix | Delete
text-decoration:none;
[1035] Fix | Delete
transition:background 0.15s linear
[1036] Fix | Delete
}
[1037] Fix | Delete
.sgpb-buttons-wrapper .press-grey {
[1038] Fix | Delete
background-color:#9E9E9E;
[1039] Fix | Delete
border:2px solid #9E9E9E;
[1040] Fix | Delete
color: #FFF;
[1041] Fix | Delete
}
[1042] Fix | Delete
.sgpb-buttons-wrapper .press-lightblue {
[1043] Fix | Delete
background-color:#03A9F4;
[1044] Fix | Delete
border:2px solid #03A9F4;
[1045] Fix | Delete
color: #FFF;
[1046] Fix | Delete
}
[1047] Fix | Delete
.sgpb-buttons-wrapper {
[1048] Fix | Delete
text-align: center;
[1049] Fix | Delete
}
[1050] Fix | Delete
.sgpb-review-wrapper{
[1051] Fix | Delete
text-align: center;
[1052] Fix | Delete
padding: 20px;
[1053] Fix | Delete
}
[1054] Fix | Delete
.sgpb-review-wrapper p {
[1055] Fix | Delete
color: black;
[1056] Fix | Delete
}
[1057] Fix | Delete
.sgpb-review-h1 {
[1058] Fix | Delete
font-size: 22px;
[1059] Fix | Delete
font-weight: normal;
[1060] Fix | Delete
line-height: 1.384;
[1061] Fix | Delete
}
[1062] Fix | Delete
.sgrb-review-h2{
[1063] Fix | Delete
font-size: 20px;
[1064] Fix | Delete
font-weight: normal;
[1065] Fix | Delete
}
[1066] Fix | Delete
:root {
[1067] Fix | Delete
--main-bg-color: #1ac6ff;
[1068] Fix | Delete
}
[1069] Fix | Delete
.sgrb-review-strong{
[1070] Fix | Delete
color: var(--main-bg-color);
[1071] Fix | Delete
}
[1072] Fix | Delete
.sgrb-review-mt20{
[1073] Fix | Delete
margin-top: 20px
[1074] Fix | Delete
}
[1075] Fix | Delete
</style>
[1076] Fix | Delete
<div class="sgpb-review-wrapper">
[1077] Fix | Delete
<div class="sgpb-review-description">
[1078] Fix | Delete
<?php echo wp_kses($firstHeader, 'post'); ?>
[1079] Fix | Delete
<h2 class="sgrb-review-h2"><?php esc_html_e('This is really great for your website score.', 'popup-builder'); ?></h2>
[1080] Fix | Delete
<p class="sgrb-review-mt20"><?php esc_html_e('Have your input in the development of our plugin, and we’ll provide better conversions for your site!<br /> Leave your 5-star positive review and help us go further to the perfection!', 'popup-builder'); ?></p>
[1081] Fix | Delete
</div>
[1082] Fix | Delete
<div class="sgpb-buttons-wrapper">
[1083] Fix | Delete
<button class="press press-grey sgpb-button-1 sgpb-close-promo-notification" data-action="sg-already-did-review"><?php esc_html_e('I already did', 'popup-builder'); ?></button>
[1084] Fix | Delete
<button class="press press-lightblue sgpb-button-3 sgpb-close-promo-notification" data-action="sg-you-worth-it"><?php esc_html_e('You worth it!', 'popup-builder'); ?></button>
[1085] Fix | Delete
<button class="press press-grey sgpb-button-2 sgpb-close-promo-notification" data-action="sg-show-popup-period" data-message-type="<?php echo esc_attr($type); ?>"><?php esc_html_e('Maybe later', 'popup-builder'); ?></button></div>
[1086] Fix | Delete
<div> </div>
[1087] Fix | Delete
</div>
[1088] Fix | Delete
<?php
[1089] Fix | Delete
$popupContent = ob_get_clean();
[1090] Fix | Delete
[1091] Fix | Delete
return $popupContent;
[1092] Fix | Delete
}
[1093] Fix | Delete
[1094] Fix | Delete
public static function shouldOpenReviewPopupForDays()
[1095] Fix | Delete
{
[1096] Fix | Delete
$shouldOpen = true;
[1097] Fix | Delete
$dontShowAgain = get_option('SGPBCloseReviewPopup-notification');
[1098] Fix | Delete
$periodNextTime = get_option('SGPBOpenNextTime');
[1099] Fix | Delete
/*if (!$dontShowAgain) {
[1100] Fix | Delete
return true;
[1101] Fix | Delete
}
[1102] Fix | Delete
else {
[1103] Fix | Delete
return false;
[1104] Fix | Delete
}*/
[1105] Fix | Delete
// When period next time does not exits it means the user is old
[1106] Fix | Delete
if (!$periodNextTime) {
[1107] Fix | Delete
$usageDays = self::getPopupMainTableCreationDate();
[1108] Fix | Delete
update_option('SGPBUsageDays', $usageDays);
[1109] Fix | Delete
if (!defined('SGPB_REVIEW_POPUP_PERIOD')) {
[1110] Fix | Delete
define('SGPB_REVIEW_POPUP_PERIOD', '500');
[1111] Fix | Delete
}
[1112] Fix | Delete
// For old users
[1113] Fix | Delete
if (defined('SGPB_REVIEW_POPUP_PERIOD') && $usageDays > SGPB_REVIEW_POPUP_PERIOD && !$dontShowAgain) {
[1114] Fix | Delete
return $shouldOpen;
[1115] Fix | Delete
}
[1116] Fix | Delete
$remainingDays = SGPB_REVIEW_POPUP_PERIOD - $usageDays;
[1117] Fix | Delete
[1118] Fix | Delete
$popupTimeZone = \SGPBConfigDataHelper::getDefaultTimezone();
[1119] Fix | Delete
$timeDate = new DateTime('now', new DateTimeZone($popupTimeZone));
[1120] Fix | Delete
$timeDate->modify('+'.$remainingDays.' day');
[1121] Fix | Delete
[1122] Fix | Delete
$timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
[1123] Fix | Delete
update_option('SGPBOpenNextTime', $timeNow);
[1124] Fix | Delete
[1125] Fix | Delete
return false;
[1126] Fix | Delete
}
[1127] Fix | Delete
[1128] Fix | Delete
$currentData = new \DateTime('now');
[1129] Fix | Delete
$timeNow = $currentData->format('Y-m-d H:i:s');
[1130] Fix | Delete
$timeNow = strtotime($timeNow);
[1131] Fix | Delete
[1132] Fix | Delete
if ($periodNextTime > $timeNow) {
[1133] Fix | Delete
$shouldOpen = false;
[1134] Fix | Delete
}
[1135] Fix | Delete
[1136] Fix | Delete
return $shouldOpen;
[1137] Fix | Delete
}
[1138] Fix | Delete
[1139] Fix | Delete
public static function getPopupMainTableCreationDate()
[1140] Fix | Delete
{
[1141] Fix | Delete
global $wpdb;
[1142] Fix | Delete
[1143] Fix | Delete
$results = $wpdb->get_results( $wpdb->prepare('SELECT table_name, create_time FROM information_schema.tables WHERE table_schema=%s AND table_name=%s', DB_NAME, $wpdb->prefix.'sgpb_subscribers'), ARRAY_A);
[1144] Fix | Delete
if (empty($results)) {
[1145] Fix | Delete
return 0;
[1146] Fix | Delete
}
[1147] Fix | Delete
[1148] Fix | Delete
$createTime = $results[0]['create_time'];
[1149] Fix | Delete
$createTime = strtotime($createTime);
[1150] Fix | Delete
update_option('SGPBInstallDate', $createTime);
[1151] Fix | Delete
$diff = time() - $createTime;
[1152] Fix | Delete
$days = floor($diff/(60*60*24));
[1153] Fix | Delete
[1154] Fix | Delete
return $days;
[1155] Fix | Delete
}
[1156] Fix | Delete
[1157] Fix | Delete
public static function shouldOpenForMaxOpenPopupMessage()
[1158] Fix | Delete
{
[1159] Fix | Delete
$counterMaxPopup = self::getMaxOpenPopupId();
[1160] Fix | Delete
[1161] Fix | Delete
if (empty($counterMaxPopup)) {
[1162] Fix | Delete
return false;
[1163] Fix | Delete
}
[1164] Fix | Delete
$dontShowAgain = get_option('SGPBCloseReviewPopup-notification');
[1165] Fix | Delete
$maxCountDefine = get_option('SGPBMaxOpenCount');
[1166] Fix | Delete
[1167] Fix | Delete
if (!$maxCountDefine) {
[1168] Fix | Delete
$maxCountDefine = SGPB_ASK_REVIEW_POPUP_COUNT;
[1169] Fix | Delete
}
[1170] Fix | Delete
[1171] Fix | Delete
return $counterMaxPopup['maxCount'] >= $maxCountDefine && !$dontShowAgain;
[1172] Fix | Delete
}
[1173] Fix | Delete
[1174] Fix | Delete
public static function getMaxOpenPopupId()
[1175] Fix | Delete
{
[1176] Fix | Delete
$popupsCounterData = get_option('SgpbCounter');
[1177] Fix | Delete
if (!$popupsCounterData) {
[1178] Fix | Delete
return 0;
[1179] Fix | Delete
}
[1180] Fix | Delete
[1181] Fix | Delete
$counters = array_values($popupsCounterData);
[1182] Fix | Delete
$maxCount = max($counters);
[1183] Fix | Delete
$popupId = array_search($maxCount, $popupsCounterData);
[1184] Fix | Delete
[1185] Fix | Delete
$maxPopupData = array(
[1186] Fix | Delete
'popupId' => $popupId,
[1187] Fix | Delete
'maxCount' => $maxCount
[1188] Fix | Delete
);
[1189] Fix | Delete
[1190] Fix | Delete
return $maxPopupData;
[1191] Fix | Delete
}
[1192] Fix | Delete
[1193] Fix | Delete
public static function getMaxOpenPopupsMessage()
[1194] Fix | Delete
{
[1195] Fix | Delete
$counterMaxPopup = self::getMaxOpenPopupId();
[1196] Fix | Delete
$maxCountDefine = get_option('SGPBMaxOpenCount');
[1197] Fix | Delete
$popupTitle = get_the_title($counterMaxPopup['popupId']);
[1198] Fix | Delete
[1199] Fix | Delete
if (!empty($counterMaxPopup['maxCount'])) {
[1200] Fix | Delete
$maxCountDefine = $counterMaxPopup['maxCount'];
[1201] Fix | Delete
}
[1202] Fix | Delete
/* translators: popup Title, max Count Define */
[1203] Fix | Delete
$firstHeader = sprintf('<h1 class="sgpb-review-h1"><strong class="sgrb-review-strong">%1$s</strong> <b>%2$s</b> %3$s <strong class="sgrb-review-strong">%4$s </strong>%5$s <strong class="sgrb-review-strong">%6$d %7$s</strong></h1>',
[1204] Fix | Delete
__('Awesome news!','popup-builder'),
[1205] Fix | Delete
__('Popup Builder','popup-builder'),
[1206] Fix | Delete
__('plugin helped you to share your message via','popup-builder'),
[1207] Fix | Delete
esc_html( $popupTitle ),
[1208] Fix | Delete
__('popup with your visitors for','popup-builder'),
[1209] Fix | Delete
esc_html( $maxCountDefine ),
[1210] Fix | Delete
__('times!','popup-builder')
[1211] Fix | Delete
);
[1212] Fix | Delete
$popupContent = self::getMaxOpenPopupContent($firstHeader, 'count');
[1213] Fix | Delete
[1214] Fix | Delete
return $popupContent;
[1215] Fix | Delete
}
[1216] Fix | Delete
[1217] Fix | Delete
/**
[1218] Fix | Delete
* Get email headers
[1219] Fix | Delete
*
[1220] Fix | Delete
* @since 3.1.0
[1221] Fix | Delete
*
[1222] Fix | Delete
* @param email $fromEmail
[1223] Fix | Delete
* @param array $args
[1224] Fix | Delete
*
[1225] Fix | Delete
* @return string $headers
[1226] Fix | Delete
*/
[1227] Fix | Delete
public static function getEmailHeader($fromEmail, $args = array())
[1228] Fix | Delete
{
[1229] Fix | Delete
$contentType = 'text/html';
[1230] Fix | Delete
$charset = 'UTF-8';
[1231] Fix | Delete
$blogInfo = wp_specialchars_decode( get_bloginfo() );
[1232] Fix | Delete
[1233] Fix | Delete
if (!empty($args['contentType'])) {
[1234] Fix | Delete
$contentType = $args['contentType'];
[1235] Fix | Delete
}
[1236] Fix | Delete
if (!empty($args['charset'])) {
[1237] Fix | Delete
$charset = $args['charset'];
[1238] Fix | Delete
}
[1239] Fix | Delete
$headers = 'MIME-Version: 1.0'."\r\n";
[1240] Fix | Delete
$headers .= 'From: "'.$blogInfo.'" <'.$fromEmail.'>'."\r\n";
[1241] Fix | Delete
$headers .= 'Content-type: '.$contentType.'; charset='.$charset.''."\r\n"; //set UTF-8
[1242] Fix | Delete
[1243] Fix | Delete
return $headers;
[1244] Fix | Delete
}
[1245] Fix | Delete
[1246] Fix | Delete
/**
[1247] Fix | Delete
* Get file content from URL
[1248] Fix | Delete
*
[1249] Fix | Delete
* @since 3.1.0
[1250] Fix | Delete
*
[1251] Fix | Delete
* @param $url
[1252] Fix | Delete
*
[1253] Fix | Delete
* @return string
[1254] Fix | Delete
*/
[1255] Fix | Delete
public static function getFileFromURL($url)
[1256] Fix | Delete
{
[1257] Fix | Delete
$data = '';
[1258] Fix | Delete
$remoteData = wp_safe_remote_get( $url );
[1259] Fix | Delete
[1260] Fix | Delete
if ( is_wp_error( $remoteData ) ) {
[1261] Fix | Delete
return $data;
[1262] Fix | Delete
}
[1263] Fix | Delete
[1264] Fix | Delete
$data = wp_remote_retrieve_body( $remoteData );
[1265] Fix | Delete
[1266] Fix | Delete
return $data;
[1267] Fix | Delete
}
[1268] Fix | Delete
[1269] Fix | Delete
public static function getRightMetaboxBannerText()
[1270] Fix | Delete
{
[1271] Fix | Delete
$bannerText = get_option('sgpb-metabox-banner-remote-get');
[1272] Fix | Delete
[1273] Fix | Delete
return $bannerText;
[1274] Fix | Delete
}
[1275] Fix | Delete
[1276] Fix | Delete
public static function getGutenbergPopupsIdAndTitle($excludesPopups = array())
[1277] Fix | Delete
{
[1278] Fix | Delete
$allPopups = SGPopup::getAllPopups();
[1279] Fix | Delete
$popupIdTitles = array();
[1280] Fix | Delete
$excludesPopups = apply_filters('sgpb_exclude_from_popups_list', $excludesPopups);
[1281] Fix | Delete
[1282] Fix | Delete
if (empty($allPopups)) {
[1283] Fix | Delete
return $popupIdTitles;
[1284] Fix | Delete
}
[1285] Fix | Delete
[1286] Fix | Delete
foreach ($allPopups as $popup) {
[1287] Fix | Delete
if (empty($popup)) {
[1288] Fix | Delete
continue;
[1289] Fix | Delete
}
[1290] Fix | Delete
[1291] Fix | Delete
$id = $popup->getId();
[1292] Fix | Delete
$title = $popup->getTitle();
[1293] Fix | Delete
$type = $popup->getType();
[1294] Fix | Delete
[1295] Fix | Delete
if (!empty($excludesPopups)) {
[1296] Fix | Delete
foreach ($excludesPopups as $excludesPopupId) {
[1297] Fix | Delete
if ($excludesPopupId != $id) {
[1298] Fix | Delete
$array = array();
[1299] Fix | Delete
$array['id'] = $id;
[1300] Fix | Delete
$array['title'] = $title.' - '.$type;
[1301] Fix | Delete
$popupIdTitles[] = $array;
[1302] Fix | Delete
}
[1303] Fix | Delete
}
[1304] Fix | Delete
}
[1305] Fix | Delete
else {
[1306] Fix | Delete
$array = array();
[1307] Fix | Delete
$array['id'] = $id;
[1308] Fix | Delete
$array['title'] = $title.' - '.$type;
[1309] Fix | Delete
$popupIdTitles[] = $array;
[1310] Fix | Delete
}
[1311] Fix | Delete
}
[1312] Fix | Delete
[1313] Fix | Delete
return $popupIdTitles;
[1314] Fix | Delete
}
[1315] Fix | Delete
[1316] Fix | Delete
public static function getGutenbergPopupsEvents()
[1317] Fix | Delete
{
[1318] Fix | Delete
$data = array(
[1319] Fix | Delete
array('value' => '', 'title' => __('Select Event', 'popup-builder')),
[1320] Fix | Delete
array('value' => 'inherit', 'title' => __('Inherit', 'popup-builder')),
[1321] Fix | Delete
array('value' => 'onLoad', 'title' => __('On load', 'popup-builder')),
[1322] Fix | Delete
array('value' => 'click', 'title' => __('On click', 'popup-builder')),
[1323] Fix | Delete
array('value' => 'hover', 'title' => __('On hover', 'popup-builder'))
[1324] Fix | Delete
);
[1325] Fix | Delete
[1326] Fix | Delete
return $data;
[1327] Fix | Delete
}
[1328] Fix | Delete
[1329] Fix | Delete
public static function checkEditorByPopupId($popupId)
[1330] Fix | Delete
{
[1331] Fix | Delete
$popupContent = '';
[1332] Fix | Delete
if (class_exists('\Elementor\Plugin')) {
[1333] Fix | Delete
$elementorContent = get_post_meta($popupId, '_elementor_edit_mode', true);
[1334] Fix | Delete
if (!empty($elementorContent) && $elementorContent == 'builder') {
[1335] Fix | Delete
$popupContent = Elementor\Plugin::instance()->frontend->get_builder_content_for_display($popupId);
[1336] Fix | Delete
}
[1337] Fix | Delete
}
[1338] Fix | Delete
else if (class_exists('Vc_Manager')) {
[1339] Fix | Delete
$stylesAndScripts = self::renderWPBakeryScriptsAndStyles($popupId);
[1340] Fix | Delete
$popupContent .= '<style>'.$stylesAndScripts.'</style>';
[1341] Fix | Delete
}
[1342] Fix | Delete
[1343] Fix | Delete
return $popupContent;
[1344] Fix | Delete
}
[1345] Fix | Delete
[1346] Fix | Delete
public static function renderWPBakeryScriptsAndStyles($popupId = 0)
[1347] Fix | Delete
{
[1348] Fix | Delete
return get_post_meta($popupId, '_wpb_shortcodes_custom_css', true);
[1349] Fix | Delete
}
[1350] Fix | Delete
[1351] Fix | Delete
/**
[1352] Fix | Delete
* countdown popup, convert date to seconds
[1353] Fix | Delete
*
[1354] Fix | Delete
* @param $dueDate
[1355] Fix | Delete
* @param $timezone
[1356] Fix | Delete
* @return false|int|string
[1357] Fix | Delete
*/
[1358] Fix | Delete
public static function dateToSeconds($dueDate, $timezone)
[1359] Fix | Delete
{
[1360] Fix | Delete
if (empty($timezone)) {
[1361] Fix | Delete
return '';
[1362] Fix | Delete
}
[1363] Fix | Delete
[1364] Fix | Delete
$dateObj = self::getDateObjFromDate('now', $timezone);
[1365] Fix | Delete
$timeNow = gettype($dateObj) == 'string' ? strtotime($dateObj) : 0;
[1366] Fix | Delete
$dueDateTime = gettype($dueDate) == 'string' ? strtotime($dueDate) : 0;
[1367] Fix | Delete
$seconds = $dueDateTime-$timeNow;
[1368] Fix | Delete
if ($seconds < 0) {
[1369] Fix | Delete
$seconds = 0;
[1370] Fix | Delete
}
[1371] Fix | Delete
[1372] Fix | Delete
return $seconds;
[1373] Fix | Delete
}
[1374] Fix | Delete
[1375] Fix | Delete
/**
[1376] Fix | Delete
* Get site protocol
[1377] Fix | Delete
*
[1378] Fix | Delete
* @since 1.0.0
[1379] Fix | Delete
*
[1380] Fix | Delete
* @return string $protocol
[1381] Fix | Delete
*
[1382] Fix | Delete
*/
[1383] Fix | Delete
public static function getSiteProtocol()
[1384] Fix | Delete
{
[1385] Fix | Delete
$protocol = 'http';
[1386] Fix | Delete
[1387] Fix | Delete
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
[1388] Fix | Delete
$protocol = 'https';
[1389] Fix | Delete
}
[1390] Fix | Delete
[1391] Fix | Delete
return $protocol;
[1392] Fix | Delete
}
[1393] Fix | Delete
[1394] Fix | Delete
public static function findSubscribersByEmail($subscriberEmail = '', $list = 0)
[1395] Fix | Delete
{
[1396] Fix | Delete
global $wpdb;
[1397] Fix | Delete
$subscriber = array();
[1398] Fix | Delete
$subscribersTableName = $wpdb->prefix.SGPB_SUBSCRIBERS_TABLE_NAME;
[1399] Fix | Delete
$subscriber = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $subscribersTableName WHERE email = %s AND subscriptionType = %d ", $subscriberEmail, $list), ARRAY_A);
[1400] Fix | Delete
if (!$list) {
[1401] Fix | Delete
$subscriber = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $subscribersTableName WHERE email = %s ", $subscriberEmail), ARRAY_A);
[1402] Fix | Delete
}
[1403] Fix | Delete
[1404] Fix | Delete
return $subscriber;
[1405] Fix | Delete
}
[1406] Fix | Delete
[1407] Fix | Delete
/**
[1408] Fix | Delete
* Update option
[1409] Fix | Delete
*
[1410] Fix | Delete
* @since 3.1.9
[1411] Fix | Delete
*
[1412] Fix | Delete
* @return void
[1413] Fix | Delete
*/
[1414] Fix | Delete
public static function updateOption($optionKey, $optionValue)
[1415] Fix | Delete
{
[1416] Fix | Delete
update_option($optionKey, $optionValue);
[1417] Fix | Delete
}
[1418] Fix | Delete
[1419] Fix | Delete
public static function getOption($optionKey, $default = false)
[1420] Fix | Delete
{
[1421] Fix | Delete
return get_option($optionKey, $default);
[1422] Fix | Delete
}
[1423] Fix | Delete
[1424] Fix | Delete
public static function deleteOption($optionKey)
[1425] Fix | Delete
{
[1426] Fix | Delete
delete_option($optionKey);
[1427] Fix | Delete
}
[1428] Fix | Delete
[1429] Fix | Delete
/**
[1430] Fix | Delete
* It's change popup registered plugins static paths to dynamic
[1431] Fix | Delete
*
[1432] Fix | Delete
* @since 3.1.9
[1433] Fix | Delete
*
[1434] Fix | Delete
* @return bool where true mean modified false mean there is not need modification
[1435] Fix | Delete
*/
[1436] Fix | Delete
public static function makeRegisteredPluginsStaticPathsToDynamic()
[1437] Fix | Delete
{
[1438] Fix | Delete
// remove old outdated option sgpbModifiedRegisteredPluginsPaths
[1439] Fix | Delete
delete_option('sgpbModifiedRegisteredPluginsPaths');
[1440] Fix | Delete
delete_option('SG_POPUP_BUILDER_REGISTERED_PLUGINS');
[1441] Fix | Delete
$hasModifiedPaths = AdminHelper::getOption(SGPB_REGISTERED_PLUGINS_PATHS_MODIFIED);
[1442] Fix | Delete
if ($hasModifiedPaths) {
[1443] Fix | Delete
return false;
[1444] Fix | Delete
}
[1445] Fix | Delete
else {
[1446] Fix | Delete
Installer::registerPlugin();
[1447] Fix | Delete
}
[1448] Fix | Delete
AdminHelper::updateOption(SGPB_REGISTERED_PLUGINS_PATHS_MODIFIED, 1);
[1449] Fix | Delete
[1450] Fix | Delete
$registeredPlugins = AdminHelper::getOption(SGPB_POPUP_BUILDER_REGISTERED_PLUGINS);
[1451] Fix | Delete
if (empty($registeredPlugins)) {
[1452] Fix | Delete
return false;
[1453] Fix | Delete
}
[1454] Fix | Delete
[1455] Fix | Delete
$registeredPlugins = json_decode($registeredPlugins, true);
[1456] Fix | Delete
if (empty($registeredPlugins)) {
[1457] Fix | Delete
return false;
[1458] Fix | Delete
}
[1459] Fix | Delete
[1460] Fix | Delete
foreach ($registeredPlugins as $key => $registeredPlugin) {
[1461] Fix | Delete
if (empty($registeredPlugin['classPath'])) {
[1462] Fix | Delete
continue;
[1463] Fix | Delete
}
[1464] Fix | Delete
$registeredPlugins[$key]['classPath'] = str_replace(WP_PLUGIN_DIR, '', $registeredPlugin['classPath']);
[1465] Fix | Delete
if (!empty($registeredPlugin['options']['licence']['file'])) {
[1466] Fix | Delete
$registeredPlugins[$key]['options']['licence']['file'] = $registeredPlugin['options']['licence']['file'];
[1467] Fix | Delete
}
[1468] Fix | Delete
}
[1469] Fix | Delete
$registeredPlugins = wp_json_encode($registeredPlugins);
[1470] Fix | Delete
[1471] Fix | Delete
AdminHelper::updateOption(SGPB_POPUP_BUILDER_REGISTERED_PLUGINS, $registeredPlugins);
[1472] Fix | Delete
return true;
[1473] Fix | Delete
}
[1474] Fix | Delete
[1475] Fix | Delete
public static function hasInactiveExtensions()
[1476] Fix | Delete
{
[1477] Fix | Delete
$hasInactiveExtensions = false;
[1478] Fix | Delete
$allRegiseredPBPlugins = AdminHelper::getOption(SGPB_POPUP_BUILDER_REGISTERED_PLUGINS);
[1479] Fix | Delete
$allRegiseredPBPlugins = !empty($allRegiseredPBPlugins) ? json_decode($allRegiseredPBPlugins, true) : array();
[1480] Fix | Delete
if (empty($allRegiseredPBPlugins)) {
[1481] Fix | Delete
return $hasInactiveExtensions;
[1482] Fix | Delete
}
[1483] Fix | Delete
[1484] Fix | Delete
foreach ($allRegiseredPBPlugins as $pluginPath => $registeredPlugin) {
[1485] Fix | Delete
if (!isset($registeredPlugin['options']['licence']['key'])) {
[1486] Fix | Delete
continue;
[1487] Fix | Delete
}
[1488] Fix | Delete
if (!isset($registeredPlugin['options']['licence']['file'])) {
[1489] Fix | Delete
continue;
[1490] Fix | Delete
}
[1491] Fix | Delete
$extensionKey = $registeredPlugin['options']['licence']['file'];
[1492] Fix | Delete
$isPluginActive = is_plugin_active($extensionKey);
[1493] Fix | Delete
$pluginKey = $registeredPlugin['options']['licence']['key'];
[1494] Fix | Delete
$isValidLicense = get_option('sgpb-license-status-'.$pluginKey);
[1495] Fix | Delete
[1496] Fix | Delete
// if we even have at least one inactive extension, we don't need to check remaining extensions
[1497] Fix | Delete
if ($isValidLicense != 'valid' && $isPluginActive) {
[1498] Fix | Delete
$hasInactiveExtensions = true;
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function