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/wp-conte.../plugins/popup-bu.../com/classes
File: Actions.php
[1000] Fix | Delete
public function supportLinks()
[1001] Fix | Delete
{
[1002] Fix | Delete
if (SGPB_POPUP_PKG == SGPB_POPUP_PKG_FREE) {
[1003] Fix | Delete
if (method_exists($this->customPostTypeObj, 'supportLinks')) {
[1004] Fix | Delete
$this->customPostTypeObj->supportLinks();
[1005] Fix | Delete
}
[1006] Fix | Delete
}
[1007] Fix | Delete
}
[1008] Fix | Delete
[1009] Fix | Delete
public function popupMetaboxes()
[1010] Fix | Delete
{
[1011] Fix | Delete
$this->customPostTypeObj->addPopupMetaboxes();
[1012] Fix | Delete
}
[1013] Fix | Delete
[1014] Fix | Delete
public function savePost($postId = 0, $post = array(), $update = false)
[1015] Fix | Delete
{
[1016] Fix | Delete
global $SGPB_OPTIONS;
[1017] Fix | Delete
[1018] Fix | Delete
if ($post->post_type !== SG_POPUP_POST_TYPE) {
[1019] Fix | Delete
return;
[1020] Fix | Delete
}
[1021] Fix | Delete
[1022] Fix | Delete
if( !isset( $_POST['sgpb-type'] ) )
[1023] Fix | Delete
{
[1024] Fix | Delete
return;
[1025] Fix | Delete
}
[1026] Fix | Delete
/* Validate nonce */
[1027] Fix | Delete
$nonce = isset( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
[1028] Fix | Delete
if ( empty( $nonce ) || !wp_verify_nonce( $nonce, 'update-post_'.$postId ) ) {
[1029] Fix | Delete
return;
[1030] Fix | Delete
}
[1031] Fix | Delete
[1032] Fix | Delete
$allowToAction = AdminHelper::userCanAccessTo();
[1033] Fix | Delete
Functions::clearAllTransients();
[1034] Fix | Delete
[1035] Fix | Delete
// Do not processing the whole input
[1036] Fix | Delete
$sgpb_postData = array_filter(
[1037] Fix | Delete
$_POST,
[1038] Fix | Delete
function ($key) { return preg_match('/sgpb-*/', $key) === 1;},
[1039] Fix | Delete
ARRAY_FILTER_USE_KEY
[1040] Fix | Delete
);
[1041] Fix | Delete
[1042] Fix | Delete
$postData = SGPopup::parsePopupDataFromData($sgpb_postData);
[1043] Fix | Delete
[1044] Fix | Delete
$saveMode = '';
[1045] Fix | Delete
$postData['sgpb-post-id'] = $postId;
[1046] Fix | Delete
// If preview mode
[1047] Fix | Delete
if (isset($postData['sgpb-is-preview']) && $postData['sgpb-is-preview'] == 1) {
[1048] Fix | Delete
$saveMode = '_preview';
[1049] Fix | Delete
SgpbPopupConfig::popupTypesInit();
[1050] Fix | Delete
SgpbDataConfig::init();
[1051] Fix | Delete
// published popup
[1052] Fix | Delete
if (empty($post)) {
[1053] Fix | Delete
global $post;
[1054] Fix | Delete
$postId = $post->ID;
[1055] Fix | Delete
}
[1056] Fix | Delete
if ($post->post_status != 'draft') {
[1057] Fix | Delete
$posts = array();
[1058] Fix | Delete
$popupContent = $post->post_content;
[1059] Fix | Delete
[1060] Fix | Delete
$query = new WP_Query(
[1061] Fix | Delete
array(
[1062] Fix | Delete
'post_parent' => $postId,
[1063] Fix | Delete
'posts_per_page' => - 1,
[1064] Fix | Delete
'post_type' => 'revision',
[1065] Fix | Delete
'post_status' => 'inherit'
[1066] Fix | Delete
)
[1067] Fix | Delete
);
[1068] Fix | Delete
$query = apply_filters('sgpbSavePostQuery', $query);
[1069] Fix | Delete
[1070] Fix | Delete
while ($query->have_posts()) {
[1071] Fix | Delete
$query->the_post();
[1072] Fix | Delete
if (empty($posts)) {
[1073] Fix | Delete
$posts[] = $post;
[1074] Fix | Delete
}
[1075] Fix | Delete
}
[1076] Fix | Delete
if (!empty($posts[0])) {
[1077] Fix | Delete
$popup = $posts[0];
[1078] Fix | Delete
$popupContent = $popup->post_content;
[1079] Fix | Delete
}
[1080] Fix | Delete
}
[1081] Fix | Delete
}
[1082] Fix | Delete
[1083] Fix | Delete
[1084] Fix | Delete
if (empty($post)) {
[1085] Fix | Delete
$saveMode = '';
[1086] Fix | Delete
}
[1087] Fix | Delete
[1088] Fix | Delete
if ($post->post_status == 'draft') {
[1089] Fix | Delete
$saveMode = '_preview';
[1090] Fix | Delete
}
[1091] Fix | Delete
[1092] Fix | Delete
/* In preview mode saveMode should be true*/
[1093] Fix | Delete
if ((!empty($post) && $post->post_type == SG_POPUP_POST_TYPE) || $saveMode || (empty($post) && !$saveMode)) {
[1094] Fix | Delete
if (!$allowToAction) {
[1095] Fix | Delete
wp_redirect(get_home_url());
[1096] Fix | Delete
exit();
[1097] Fix | Delete
}
[1098] Fix | Delete
if (!empty($postData['sgpb-type'])) {
[1099] Fix | Delete
$popupType = $postData['sgpb-type'];
[1100] Fix | Delete
$popupClassName = SGPopup::getPopupClassNameFormType($popupType);
[1101] Fix | Delete
$popupClassPath = SGPopup::getPopupTypeClassPath($popupType);
[1102] Fix | Delete
require_once($popupClassPath.$popupClassName.'.php');
[1103] Fix | Delete
$popupClassName = __NAMESPACE__.'\\'.$popupClassName;
[1104] Fix | Delete
$popupClassName::create($postData, $saveMode, 1);
[1105] Fix | Delete
}
[1106] Fix | Delete
}
[1107] Fix | Delete
else {
[1108] Fix | Delete
$content = get_post_field('post_content', $postId);
[1109] Fix | Delete
SGPopup::deletePostCustomInsertedData($postId);
[1110] Fix | Delete
SGPopup::deletePostCustomInsertedEvents($postId);
[1111] Fix | Delete
/*We detect all the popups that were inserted as a custom ones, in the content.*/
[1112] Fix | Delete
SGPopup::savePopupsFromContentClasses($content, $post);
[1113] Fix | Delete
}
[1114] Fix | Delete
}
[1115] Fix | Delete
[1116] Fix | Delete
/**
[1117] Fix | Delete
* Check Popup is satisfy for popup condition
[1118] Fix | Delete
*
[1119] Fix | Delete
* @param array $args
[1120] Fix | Delete
*
[1121] Fix | Delete
* @return array
[1122] Fix | Delete
*
[1123] Fix | Delete
*@since 1.0.0
[1124] Fix | Delete
*
[1125] Fix | Delete
*/
[1126] Fix | Delete
public function conditionsSatisfy($args = array())
[1127] Fix | Delete
{
[1128] Fix | Delete
if (isset($args['status']) && $args['status'] === false) {
[1129] Fix | Delete
return $args;
[1130] Fix | Delete
}
[1131] Fix | Delete
$args['status'] = PopupChecker::checkOtherConditionsActions($args);
[1132] Fix | Delete
[1133] Fix | Delete
return $args;
[1134] Fix | Delete
}
[1135] Fix | Delete
[1136] Fix | Delete
public function popupsTableColumnsValues($column, $postId)
[1137] Fix | Delete
{
[1138] Fix | Delete
$postId = (int)sanitize_text_field($postId);// Convert to int for security reasons
[1139] Fix | Delete
global $post_type;
[1140] Fix | Delete
if ($postId) {
[1141] Fix | Delete
$args['status'] = array('publish', 'draft', 'pending', 'private', 'trash');
[1142] Fix | Delete
$popup = SGPopup::find($postId, $args);
[1143] Fix | Delete
}
[1144] Fix | Delete
[1145] Fix | Delete
if (empty($popup) && $post_type == SG_POPUP_POST_TYPE) {
[1146] Fix | Delete
return false;
[1147] Fix | Delete
}
[1148] Fix | Delete
[1149] Fix | Delete
if ($column == 'shortcode') {
[1150] Fix | Delete
$shortcodeInput = '<input type="text" onfocus="this.select();" readonly value="[sg_popup id='.esc_attr($postId).']" class="large-text code">';
[1151] Fix | Delete
echo wp_kses($shortcodeInput, AdminHelper::allowed_html_tags());
[1152] Fix | Delete
}
[1153] Fix | Delete
if ($column == 'className') {
[1154] Fix | Delete
$className = '<input type="text" onfocus="this.select();" readonly value="sg-popup-id-'.esc_attr($postId).'" class="large-text code">';
[1155] Fix | Delete
echo wp_kses($className, AdminHelper::allowed_html_tags());
[1156] Fix | Delete
}
[1157] Fix | Delete
else if ($column == 'counter') {
[1158] Fix | Delete
$count = $popup->getPopupOpeningCountById($postId);
[1159] Fix | Delete
$counter = '<div ><span>'.$count.'</span>'.'<input onclick="SGPBBackend.resetCount('.esc_attr($postId).', true);" type="button" name="" class="sgpb-btn sgpb-btn-dark-outline" value="'.__('reset', 'popup-builder').'"></div>';
[1160] Fix | Delete
echo wp_kses($counter, AdminHelper::allowed_html_tags());
[1161] Fix | Delete
}
[1162] Fix | Delete
else if ($column == 'type') {
[1163] Fix | Delete
global $SGPB_POPUP_TYPES;
[1164] Fix | Delete
$type = $popup->getType();
[1165] Fix | Delete
if (isset($SGPB_POPUP_TYPES['typeLabels'][$type])) {
[1166] Fix | Delete
$type = $SGPB_POPUP_TYPES['typeLabels'][$type];
[1167] Fix | Delete
}
[1168] Fix | Delete
echo esc_html($type);
[1169] Fix | Delete
}
[1170] Fix | Delete
else if ($column == 'onOff') {
[1171] Fix | Delete
$popupPostStatus = get_post_status($postId);
[1172] Fix | Delete
if ($popupPostStatus == 'publish' || $popupPostStatus == 'draft'|| $popupPostStatus == 'private') {
[1173] Fix | Delete
$isActive = $popup->getOptionValue('sgpb-is-active', true);
[1174] Fix | Delete
}
[1175] Fix | Delete
$checked = isset($isActive) && $isActive ? 'checked' : '';
[1176] Fix | Delete
$switcher = '<label class="sgpb-switch">
[1177] Fix | Delete
<input class="sg-switch-checkbox sgpb-popup-status-js" value="1" data-switch-id="'.esc_attr($postId).'" type="checkbox" '.esc_attr($checked).'>
[1178] Fix | Delete
<div class="sgpb-slider sgpb-round"></div>
[1179] Fix | Delete
</label>';
[1180] Fix | Delete
echo wp_kses($switcher, AdminHelper::allowed_html_tags());
[1181] Fix | Delete
}
[1182] Fix | Delete
else if ($column == 'sgpbIsRandomEnabled') {
[1183] Fix | Delete
$showValues = apply_filters('sgpbAddRandomTableColumnValues', $postId);
[1184] Fix | Delete
echo wp_kses($showValues, AdminHelper::allowed_html_tags());
[1185] Fix | Delete
}
[1186] Fix | Delete
else if ($column == 'options') {
[1187] Fix | Delete
$cloneUrl = AdminHelper::popupGetClonePostLink($postId);
[1188] Fix | Delete
$actionButtons = '<div class="icon icon_blue">
[1189] Fix | Delete
<img src="'.SG_POPUP_PUBLIC_URL.'icons/iconEdit.png" title="Edit" alt="Edit" class="icon_edit" onclick="location.href=\''.get_edit_post_link($postId).'\'">
[1190] Fix | Delete
</div>';
[1191] Fix | Delete
$actionButtons .= '<div class="icon icon_blue">
[1192] Fix | Delete
<img src="'.SG_POPUP_PUBLIC_URL.'icons/iconClone.png" title="Clone" alt="Clone" class="icon_clone" onclick="location.href=\''.esc_url($cloneUrl).'\'">
[1193] Fix | Delete
</div>';
[1194] Fix | Delete
$actionButtons .= '<div class="icon icon_pink">
[1195] Fix | Delete
<img src="'.SG_POPUP_PUBLIC_URL.'icons/recycle-bin.svg" title="Remove" alt="Remove" class="icon_remove" onclick="location.href=\''.get_delete_post_link($postId).'\'">
[1196] Fix | Delete
</div>';
[1197] Fix | Delete
[1198] Fix | Delete
echo wp_kses($actionButtons, AdminHelper::allowed_html_tags());
[1199] Fix | Delete
}
[1200] Fix | Delete
}
[1201] Fix | Delete
[1202] Fix | Delete
/*
[1203] Fix | Delete
* This function calls the creation of a new copy of the selected post (by default preserving the original publish status)
[1204] Fix | Delete
* then redirects to the post list
[1205] Fix | Delete
*/
[1206] Fix | Delete
public function popupSaveAsNew($status = '')
[1207] Fix | Delete
{
[1208] Fix | Delete
/**
[1209] Fix | Delete
* We only allow administrator to do this action
[1210] Fix | Delete
*/
[1211] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[1212] Fix | Delete
[1213] Fix | Delete
wp_die(esc_html__('You do not have permission to clone the popup!', 'popup-builder'));
[1214] Fix | Delete
}
[1215] Fix | Delete
[1216] Fix | Delete
/* Validate nonce */
[1217] Fix | Delete
$nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
[1218] Fix | Delete
$postId = (int) sanitize_text_field($_REQUEST['post']);
[1219] Fix | Delete
[1220] Fix | Delete
if ( empty( $nonce ) || !wp_verify_nonce( $nonce, 'duplicate-post_'.$postId ) ) {
[1221] Fix | Delete
wp_die(esc_html__('You do not have permission to clone the popup!', 'popup-builder'));
[1222] Fix | Delete
}
[1223] Fix | Delete
[1224] Fix | Delete
if (!(isset($_GET['post']) || isset($_POST['post']) || (isset($_REQUEST['action']) && 'popupSaveAsNew' == sanitize_text_field($_REQUEST['action'])))) {
[1225] Fix | Delete
wp_die(esc_html__('No post to duplicate has been supplied!', 'popup-builder'));
[1226] Fix | Delete
}
[1227] Fix | Delete
// Get the original post
[1228] Fix | Delete
$id = (isset($_GET['post']) ? sanitize_text_field($_GET['post']) : sanitize_text_field($_POST['post']));
[1229] Fix | Delete
[1230] Fix | Delete
check_admin_referer('duplicate-post_'.$id);
[1231] Fix | Delete
[1232] Fix | Delete
$post = get_post($id);
[1233] Fix | Delete
[1234] Fix | Delete
// Copy the post and insert it
[1235] Fix | Delete
if (isset($post) && $post != null) {
[1236] Fix | Delete
$newId = $this->popupCreateDuplicate($post, $status);
[1237] Fix | Delete
$postType = $post->post_type;
[1238] Fix | Delete
[1239] Fix | Delete
if ($status == '') {
[1240] Fix | Delete
$sendBack = wp_get_referer();
[1241] Fix | Delete
if (!$sendBack ||
[1242] Fix | Delete
strpos($sendBack, 'post.php') !== false ||
[1243] Fix | Delete
strpos($sendBack, 'post-new.php') !== false) {
[1244] Fix | Delete
if ('attachment' == $postType) {
[1245] Fix | Delete
$sendBack = admin_url('upload.php');
[1246] Fix | Delete
}
[1247] Fix | Delete
else {
[1248] Fix | Delete
$sendBack = admin_url('edit.php');
[1249] Fix | Delete
if (!empty($postType)) {
[1250] Fix | Delete
$sendBack = add_query_arg('post_type', $postType, $sendBack);
[1251] Fix | Delete
}
[1252] Fix | Delete
}
[1253] Fix | Delete
}
[1254] Fix | Delete
else {
[1255] Fix | Delete
$sendBack = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'cloned', 'ids'), $sendBack);
[1256] Fix | Delete
}
[1257] Fix | Delete
// Redirect to the post list screen
[1258] Fix | Delete
wp_redirect(add_query_arg(array('cloned' => 1, 'ids' => $post->ID), $sendBack));
[1259] Fix | Delete
}
[1260] Fix | Delete
else {
[1261] Fix | Delete
// Redirect to the edit screen for the new draft post
[1262] Fix | Delete
wp_redirect(add_query_arg(array('cloned' => 1, 'ids' => $post->ID), admin_url('post.php?action=edit&post='.$newId)));
[1263] Fix | Delete
}
[1264] Fix | Delete
exit;
[1265] Fix | Delete
[1266] Fix | Delete
}
[1267] Fix | Delete
else {
[1268] Fix | Delete
/* translators: ID of original. */
[1269] Fix | Delete
wp_die( sprintf( wp_kses_post( __('Copy creation failed, could not find original: %d','popup-builder') ), esc_html( $id ) ) );
[1270] Fix | Delete
}
[1271] Fix | Delete
}
[1272] Fix | Delete
[1273] Fix | Delete
/**
[1274] Fix | Delete
* Create a duplicate from a post
[1275] Fix | Delete
*/
[1276] Fix | Delete
public function popupCreateDuplicate($post, $status = '', $parent_id = '')
[1277] Fix | Delete
{
[1278] Fix | Delete
$newPostStatus = (empty($status))? $post->post_status: $status;
[1279] Fix | Delete
[1280] Fix | Delete
if ($post->post_type != 'attachment') {
[1281] Fix | Delete
$title = $post->post_title;
[1282] Fix | Delete
if ($title == '') {
[1283] Fix | Delete
// empty title
[1284] Fix | Delete
$title = __('(no title) (clone)');
[1285] Fix | Delete
}
[1286] Fix | Delete
else {
[1287] Fix | Delete
$title .= ' '.__('(clone)');
[1288] Fix | Delete
}
[1289] Fix | Delete
[1290] Fix | Delete
if ('publish' == $newPostStatus || 'future' == $newPostStatus) {
[1291] Fix | Delete
// check if the user has the right capability
[1292] Fix | Delete
if (is_post_type_hierarchical($post->post_type)) {
[1293] Fix | Delete
if (!current_user_can('publish_pages')) {
[1294] Fix | Delete
$newPostStatus = 'pending';
[1295] Fix | Delete
}
[1296] Fix | Delete
}
[1297] Fix | Delete
else {
[1298] Fix | Delete
if (!current_user_can('publish_posts')) {
[1299] Fix | Delete
$newPostStatus = 'pending';
[1300] Fix | Delete
}
[1301] Fix | Delete
}
[1302] Fix | Delete
}
[1303] Fix | Delete
}
[1304] Fix | Delete
[1305] Fix | Delete
$newPostAuthor = wp_get_current_user();
[1306] Fix | Delete
$newPostAuthorId = $newPostAuthor->ID;
[1307] Fix | Delete
// check if the user has the right capability
[1308] Fix | Delete
if (is_post_type_hierarchical($post->post_type)) {
[1309] Fix | Delete
if (current_user_can('edit_others_pages')) {
[1310] Fix | Delete
$newPostAuthorId = $post->post_author;
[1311] Fix | Delete
}
[1312] Fix | Delete
}
[1313] Fix | Delete
else {
[1314] Fix | Delete
if (current_user_can('edit_others_posts')) {
[1315] Fix | Delete
$newPostAuthorId = $post->post_author;
[1316] Fix | Delete
}
[1317] Fix | Delete
}
[1318] Fix | Delete
[1319] Fix | Delete
$newPost = array(
[1320] Fix | Delete
'menu_order' => $post->menu_order,
[1321] Fix | Delete
'comment_status' => $post->comment_status,
[1322] Fix | Delete
'ping_status' => $post->ping_status,
[1323] Fix | Delete
'post_author' => $newPostAuthorId,
[1324] Fix | Delete
'post_content' => $post->post_content,
[1325] Fix | Delete
'post_content_filtered' => $post->post_content_filtered,
[1326] Fix | Delete
'post_excerpt' => $post->post_excerpt,
[1327] Fix | Delete
'post_mime_type' => $post->post_mime_type,
[1328] Fix | Delete
'post_parent' => $newPostParent = empty($parent_id)? $post->post_parent : $parent_id,
[1329] Fix | Delete
'post_password' => $post->post_password,
[1330] Fix | Delete
'post_status' => $newPostStatus,
[1331] Fix | Delete
'post_title' => $title,
[1332] Fix | Delete
'post_type' => $post->post_type,
[1333] Fix | Delete
);
[1334] Fix | Delete
[1335] Fix | Delete
$newPost['post_date'] = $newPostDate = $post->post_date;
[1336] Fix | Delete
$newPost['post_date_gmt'] = get_gmt_from_date($newPostDate);
[1337] Fix | Delete
$newPostId = wp_insert_post(wp_slash($newPost));
[1338] Fix | Delete
[1339] Fix | Delete
// If the copy is published or scheduled, we have to set a proper slug.
[1340] Fix | Delete
if ($newPostStatus == 'publish' || $newPostStatus == 'future') {
[1341] Fix | Delete
$postName = $post->post_name;
[1342] Fix | Delete
$postName = wp_unique_post_slug($postName, $newPostId, $newPostStatus, $post->post_type, $newPostParent);
[1343] Fix | Delete
[1344] Fix | Delete
$newPost = array();
[1345] Fix | Delete
$newPost['ID'] = $newPostId;
[1346] Fix | Delete
$newPost['post_name'] = $postName;
[1347] Fix | Delete
[1348] Fix | Delete
// Update the post into the database
[1349] Fix | Delete
wp_update_post(wp_slash($newPost));
[1350] Fix | Delete
}
[1351] Fix | Delete
[1352] Fix | Delete
// If you have written a plugin which uses non-WP database tables to save
[1353] Fix | Delete
// information about a post you can hook this action to dupe that data.
[1354] Fix | Delete
if ($post->post_type == 'page' || is_post_type_hierarchical($post->post_type)) {
[1355] Fix | Delete
do_action('dp_duplicate_page', $newPostId, $post, $status);
[1356] Fix | Delete
}
[1357] Fix | Delete
else {
[1358] Fix | Delete
do_action('sgpb_duplicate_post', $newPostId, $post, $status);
[1359] Fix | Delete
}
[1360] Fix | Delete
[1361] Fix | Delete
delete_post_meta($newPostId, '_sgpb_original');
[1362] Fix | Delete
add_post_meta($newPostId, '_sgpb_original', $post->ID);
[1363] Fix | Delete
[1364] Fix | Delete
return $newPostId;
[1365] Fix | Delete
}
[1366] Fix | Delete
[1367] Fix | Delete
/**
[1368] Fix | Delete
* Copy the meta information of a post to another post
[1369] Fix | Delete
*/
[1370] Fix | Delete
public function popupCopyPostMetaInfo($newId, $post)
[1371] Fix | Delete
{
[1372] Fix | Delete
$postMetaKeys = get_post_custom_keys($post->ID);
[1373] Fix | Delete
$metaBlacklist = '';
[1374] Fix | Delete
[1375] Fix | Delete
if (empty($postMetaKeys) || !is_array($postMetaKeys)) {
[1376] Fix | Delete
return;
[1377] Fix | Delete
}
[1378] Fix | Delete
$metaBlacklist = explode(',', $metaBlacklist);
[1379] Fix | Delete
$metaBlacklist = array_filter($metaBlacklist);
[1380] Fix | Delete
$metaBlacklist = array_map('trim', $metaBlacklist);
[1381] Fix | Delete
$metaBlacklist[] = '_edit_lock';
[1382] Fix | Delete
$metaBlacklist[] = '_edit_last';
[1383] Fix | Delete
$metaBlacklist[] = '_wp_page_template';
[1384] Fix | Delete
$metaBlacklist[] = '_thumbnail_id';
[1385] Fix | Delete
[1386] Fix | Delete
$metaBlacklist = apply_filters('duplicate_post_blacklist_filter' , $metaBlacklist);
[1387] Fix | Delete
[1388] Fix | Delete
$metaBlacklistString = '('.implode(')|(',$metaBlacklist).')';
[1389] Fix | Delete
$metaKeys = array();
[1390] Fix | Delete
[1391] Fix | Delete
if (strpos($metaBlacklistString, '*') !== false) {
[1392] Fix | Delete
$metaBlacklistString = str_replace(array('*'), array('[a-zA-Z0-9_]*'), $metaBlacklistString);
[1393] Fix | Delete
[1394] Fix | Delete
foreach ($postMetaKeys as $metaKey) {
[1395] Fix | Delete
if (!preg_match('#^'.$metaBlacklistString.'$#', $metaKey)) {
[1396] Fix | Delete
$metaKeys[] = $metaKey;
[1397] Fix | Delete
}
[1398] Fix | Delete
}
[1399] Fix | Delete
}
[1400] Fix | Delete
else {
[1401] Fix | Delete
$metaKeys = array_diff($postMetaKeys, $metaBlacklist);
[1402] Fix | Delete
}
[1403] Fix | Delete
[1404] Fix | Delete
$metaKeys = apply_filters('duplicate_post_meta_keys_filter', $metaKeys);
[1405] Fix | Delete
[1406] Fix | Delete
foreach ($metaKeys as $metaKey) {
[1407] Fix | Delete
$metaValues = get_post_custom_values($metaKey, $post->ID);
[1408] Fix | Delete
foreach ($metaValues as $metaValue) {
[1409] Fix | Delete
$metaValue = maybe_unserialize($metaValue);
[1410] Fix | Delete
if (is_array($metaValue)) {
[1411] Fix | Delete
$metaValue['sgpb-post-id'] = $newId;
[1412] Fix | Delete
}
[1413] Fix | Delete
add_post_meta($newId, $metaKey, $this->popupWpSlash($metaValue));
[1414] Fix | Delete
}
[1415] Fix | Delete
}
[1416] Fix | Delete
}
[1417] Fix | Delete
[1418] Fix | Delete
public function popupAddSlashesDeep($value)
[1419] Fix | Delete
{
[1420] Fix | Delete
if (function_exists('map_deep')) {
[1421] Fix | Delete
return map_deep($value, array($this, 'popupAddSlashesToStringsOnly'));
[1422] Fix | Delete
}
[1423] Fix | Delete
else {
[1424] Fix | Delete
return wp_slash($value);
[1425] Fix | Delete
}
[1426] Fix | Delete
}
[1427] Fix | Delete
[1428] Fix | Delete
public function popupAddSlashesToStringsOnly($value)
[1429] Fix | Delete
{
[1430] Fix | Delete
return is_string($value) ? addslashes($value) : $value;
[1431] Fix | Delete
}
[1432] Fix | Delete
[1433] Fix | Delete
public function popupWpSlash($value)
[1434] Fix | Delete
{
[1435] Fix | Delete
return $this->popupAddSlashesDeep($value);
[1436] Fix | Delete
}
[1437] Fix | Delete
[1438] Fix | Delete
public function removePostPermalink($args)
[1439] Fix | Delete
{
[1440] Fix | Delete
global $post_type;
[1441] Fix | Delete
[1442] Fix | Delete
if ($post_type == SG_POPUP_POST_TYPE && is_admin()) {
[1443] Fix | Delete
// hide permalink for popupbuilder post type
[1444] Fix | Delete
return '';
[1445] Fix | Delete
}
[1446] Fix | Delete
[1447] Fix | Delete
return $args;
[1448] Fix | Delete
}
[1449] Fix | Delete
[1450] Fix | Delete
// remove link ( e.g.: (View post) ), from popup updated/published message
[1451] Fix | Delete
public function popupPublishedMessage($messages)
[1452] Fix | Delete
{
[1453] Fix | Delete
global $post_type;
[1454] Fix | Delete
[1455] Fix | Delete
if ($post_type == SG_POPUP_POST_TYPE) {
[1456] Fix | Delete
// post(popup) updated
[1457] Fix | Delete
if (isset($messages['post'][1])) {
[1458] Fix | Delete
$messages['post'][1] = __('Popup updated.', 'popup-builder');
[1459] Fix | Delete
}
[1460] Fix | Delete
// post(popup) published
[1461] Fix | Delete
if (isset($messages['post'][6])) {
[1462] Fix | Delete
$messages['post'][6] = __('Popup published.', 'popup-builder');
[1463] Fix | Delete
}
[1464] Fix | Delete
}
[1465] Fix | Delete
$messages = apply_filters('sgpbPostUpdateMessage', $messages);
[1466] Fix | Delete
[1467] Fix | Delete
return $messages;
[1468] Fix | Delete
}
[1469] Fix | Delete
private function subscriberFields() {
[1470] Fix | Delete
return array('id', 'firstName', 'lastName', 'email', 'cDate', 'subscriptionType');
[1471] Fix | Delete
}
[1472] Fix | Delete
public function getSubscribersCsvFile()
[1473] Fix | Delete
{
[1474] Fix | Delete
global $wpdb;
[1475] Fix | Delete
$allowToAction = AdminHelper::userCanAccessTo();
[1476] Fix | Delete
if (!$allowToAction) {
[1477] Fix | Delete
wp_redirect(get_home_url());
[1478] Fix | Delete
exit();
[1479] Fix | Delete
}
[1480] Fix | Delete
$fields = $this->subscriberFields();
[1481] Fix | Delete
$query = AdminHelper::subscribersRelatedQuery();
[1482] Fix | Delete
if (isset($_GET['orderby']) && !empty($_GET['orderby'])) {
[1483] Fix | Delete
$orderBy = sanitize_text_field($_GET['orderby']);
[1484] Fix | Delete
if (!in_array($orderBy, $fields)){
[1485] Fix | Delete
wp_redirect(get_home_url());
[1486] Fix | Delete
exit();
[1487] Fix | Delete
}
[1488] Fix | Delete
if (isset($_GET['order']) && !empty($_GET['order'])) {
[1489] Fix | Delete
$order = array('ASC', 'DESC');
[1490] Fix | Delete
if (!in_array(sanitize_text_field($_GET['order']), $order)){
[1491] Fix | Delete
wp_redirect(get_home_url());
[1492] Fix | Delete
exit();
[1493] Fix | Delete
}
[1494] Fix | Delete
$query .= ' ORDER BY '.$orderBy.' '.sanitize_text_field($_GET['order']);
[1495] Fix | Delete
}
[1496] Fix | Delete
}
[1497] Fix | Delete
$content = '';
[1498] Fix | Delete
$rows = array('first name', 'last name', 'email', 'date', 'popup');
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function