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/wp-revie.../admin
File: metaboxes.php
'wp_review_total' => filter_input( INPUT_POST, 'wp_review_total', FILTER_SANITIZE_STRING ),
[1000] Fix | Delete
'wp_review_color' => filter_input( INPUT_POST, 'wp_review_color', FILTER_SANITIZE_STRING ),
[1001] Fix | Delete
'wp_review_inactive_color' => filter_input( INPUT_POST, 'wp_review_inactive_color', FILTER_SANITIZE_STRING ),
[1002] Fix | Delete
'wp_review_fontcolor' => filter_input( INPUT_POST, 'wp_review_fontcolor', FILTER_SANITIZE_STRING ),
[1003] Fix | Delete
'wp_review_bgcolor1' => filter_input( INPUT_POST, 'wp_review_bgcolor1', FILTER_SANITIZE_STRING ),
[1004] Fix | Delete
'wp_review_bgcolor2' => filter_input( INPUT_POST, 'wp_review_bgcolor2', FILTER_SANITIZE_STRING ),
[1005] Fix | Delete
'wp_review_bordercolor' => filter_input( INPUT_POST, 'wp_review_bordercolor', FILTER_SANITIZE_STRING ),
[1006] Fix | Delete
'wp_review_author' => filter_input( INPUT_POST, 'wp_review_author', FILTER_SANITIZE_STRING ),
[1007] Fix | Delete
'wp_review_schema' => filter_input( INPUT_POST, 'wp_review_schema', FILTER_SANITIZE_STRING ),
[1008] Fix | Delete
'wp_review_rating_schema' => filter_input( INPUT_POST, 'wp_review_rating_schema', FILTER_SANITIZE_STRING ),
[1009] Fix | Delete
'wp_review_show_schema_data' => filter_input( INPUT_POST, 'wp_review_show_schema_data', FILTER_SANITIZE_STRING ),
[1010] Fix | Delete
'wp_review_user_review_type' => filter_input( INPUT_POST, 'wp_review_user_review_type', FILTER_SANITIZE_STRING ),
[1011] Fix | Delete
'wp_review_product_price' => filter_input( INPUT_POST, 'wp_review_product_price', FILTER_SANITIZE_STRING ),
[1012] Fix | Delete
'wp_review_box_template' => filter_input( INPUT_POST, 'wp_review_box_template', FILTER_SANITIZE_STRING ),
[1013] Fix | Delete
);
[1014] Fix | Delete
[1015] Fix | Delete
$default_colors = wp_review_get_global_colors();
[1016] Fix | Delete
$default_color = $default_colors['color'];
[1017] Fix | Delete
$default_inactive = $default_colors['inactive_color'];
[1018] Fix | Delete
[1019] Fix | Delete
if ( $meta['wp_review_color'] === $default_color ) {
[1020] Fix | Delete
$meta['wp_review_color'] = '';
[1021] Fix | Delete
}
[1022] Fix | Delete
[1023] Fix | Delete
if ( $meta['wp_review_inactive_color'] === $default_inactive ) {
[1024] Fix | Delete
$meta['wp_review_inactive_color'] = '';
[1025] Fix | Delete
}
[1026] Fix | Delete
[1027] Fix | Delete
foreach ( $meta as $meta_key => $new_meta_value ) {
[1028] Fix | Delete
$new_meta_value = wp_review_normalize_option_value( $new_meta_value );
[1029] Fix | Delete
[1030] Fix | Delete
if ( false === $new_meta_value ) {
[1031] Fix | Delete
$new_meta_value = '0';
[1032] Fix | Delete
}
[1033] Fix | Delete
[1034] Fix | Delete
if ( 'wp_review_box_template' === $meta_key && ! in_array( $new_meta_value, array( 'default', 'aqua' ), true ) ) {
[1035] Fix | Delete
continue;
[1036] Fix | Delete
}
[1037] Fix | Delete
[1038] Fix | Delete
if ( current_user_can( 'delete_post_meta', $post_id ) && '' === $new_meta_value ) {
[1039] Fix | Delete
delete_post_meta( $post_id, $meta_key );
[1040] Fix | Delete
continue;
[1041] Fix | Delete
}
[1042] Fix | Delete
[1043] Fix | Delete
if ( current_user_can( 'edit_post_meta', $post_id ) ) {
[1044] Fix | Delete
update_post_meta( $post_id, $meta_key, $new_meta_value );
[1045] Fix | Delete
}
[1046] Fix | Delete
}
[1047] Fix | Delete
[1048] Fix | Delete
wp_review_save_review_items_data( $post_id );
[1049] Fix | Delete
[1050] Fix | Delete
$old = get_post_meta( $post_id, 'wp_review_item', true );
[1051] Fix | Delete
$link_text = (array) filter_input( INPUT_POST, 'wp_review_link_title', FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY );
[1052] Fix | Delete
$link_url = (array) filter_input( INPUT_POST, 'wp_review_link_url', FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY );
[1053] Fix | Delete
$new_links = array();
[1054] Fix | Delete
[1055] Fix | Delete
if ( ! empty( $link_text ) ) {
[1056] Fix | Delete
foreach ( $link_text as $key => $text ) {
[1057] Fix | Delete
if ( ! empty( $text ) && ! empty( $link_url[ $key ] ) ) {
[1058] Fix | Delete
$new_links[] = array(
[1059] Fix | Delete
'text' => $text,
[1060] Fix | Delete
'url' => $link_url[ $key ],
[1061] Fix | Delete
);
[1062] Fix | Delete
}
[1063] Fix | Delete
}
[1064] Fix | Delete
}
[1065] Fix | Delete
[1066] Fix | Delete
if ( empty( $new_links ) ) {
[1067] Fix | Delete
delete_post_meta( $post_id, 'wp_review_links' );
[1068] Fix | Delete
} else {
[1069] Fix | Delete
update_post_meta( $post_id, 'wp_review_links', $new_links );
[1070] Fix | Delete
}
[1071] Fix | Delete
if ( isset( $_POST['wp_review_schema_options'] ) ) {
[1072] Fix | Delete
update_post_meta( $post_id, 'wp_review_schema_options', $_POST['wp_review_schema_options'] );
[1073] Fix | Delete
}
[1074] Fix | Delete
[1075] Fix | Delete
/**
[1076] Fix | Delete
* Delete all data when switched to 'No Review' type.
[1077] Fix | Delete
*/
[1078] Fix | Delete
if ( 'none' === $type ) {
[1079] Fix | Delete
delete_post_meta( $post_id, 'wp_review_desc', $_POST['wp_review_desc'] );
[1080] Fix | Delete
delete_post_meta( $post_id, 'wp_review_heading', $_POST['wp_review_heading'] );
[1081] Fix | Delete
delete_post_meta( $post_id, 'wp_review_userReview', $_POST['wp_review_userReview'] );
[1082] Fix | Delete
delete_post_meta( $post_id, 'wp_review_item', $old );
[1083] Fix | Delete
}
[1084] Fix | Delete
}
[1085] Fix | Delete
[1086] Fix | Delete
/**
[1087] Fix | Delete
* Clears transients
[1088] Fix | Delete
*
[1089] Fix | Delete
* @param int $post_id Post ID.
[1090] Fix | Delete
* @param WP_Post $post Post object.
[1091] Fix | Delete
*/
[1092] Fix | Delete
function wp_review_clear_query_cache( $post_id, $post ) {
[1093] Fix | Delete
global $wpdb;
[1094] Fix | Delete
$where = $wpdb->prepare( 'WHERE option_name REGEXP %s', '_transient(_timeout)?_wp_review_[0-9a-f]{32}' );
[1095] Fix | Delete
$wpdb->query( "DELETE FROM {$wpdb->prefix}options {$where}" ); // WPCS: unprepared SQL ok.
[1096] Fix | Delete
}
[1097] Fix | Delete
[1098] Fix | Delete
/**
[1099] Fix | Delete
* Saves review items data.
[1100] Fix | Delete
*
[1101] Fix | Delete
* @param int $post_id Post ID.
[1102] Fix | Delete
*/
[1103] Fix | Delete
function wp_review_save_review_items_data( $post_id ) {
[1104] Fix | Delete
$old = get_post_meta( $post_id, 'wp_review_item', true );
[1105] Fix | Delete
[1106] Fix | Delete
if ( ! empty( $_POST['wp_review_item_title'] ) ) { // WPCS: csrf ok.
[1107] Fix | Delete
$title = $_POST['wp_review_item_title']; // WPCS: csrf ok.
[1108] Fix | Delete
$star = $_POST['wp_review_item_star']; // WPCS: csrf ok.
[1109] Fix | Delete
$ids = $_POST['wp_review_item_id']; // WPCS: csrf ok.
[1110] Fix | Delete
$new = array();
[1111] Fix | Delete
[1112] Fix | Delete
$count = count( $title );
[1113] Fix | Delete
[1114] Fix | Delete
for ( $i = 0; $i < $count; $i++ ) {
[1115] Fix | Delete
if ( empty( $star[ $i ] ) ) {
[1116] Fix | Delete
continue; // Prevent item without score.
[1117] Fix | Delete
}
[1118] Fix | Delete
[1119] Fix | Delete
$new[ $i ] = array();
[1120] Fix | Delete
$new[ $i ]['wp_review_item_star'] = floatval( $star[ $i ] );
[1121] Fix | Delete
[1122] Fix | Delete
if ( ! empty( $ids[ $i ] ) ) {
[1123] Fix | Delete
$new[ $i ]['id'] = sanitize_text_field( wp_unslash( $ids[ $i ] ) );
[1124] Fix | Delete
}
[1125] Fix | Delete
[1126] Fix | Delete
if ( ! empty( $title[ $i ] ) ) {
[1127] Fix | Delete
$new[ $i ]['wp_review_item_title'] = sanitize_text_field( wp_unslash( $title[ $i ] ) );
[1128] Fix | Delete
}
[1129] Fix | Delete
}
[1130] Fix | Delete
[1131] Fix | Delete
if ( ! empty( $new ) && $new !== $old ) {
[1132] Fix | Delete
update_post_meta( $post_id, 'wp_review_item', $new );
[1133] Fix | Delete
} elseif ( empty( $new ) && $old ) {
[1134] Fix | Delete
delete_post_meta( $post_id, 'wp_review_item', $old );
[1135] Fix | Delete
}
[1136] Fix | Delete
} else {
[1137] Fix | Delete
delete_post_meta( $post_id, 'wp_review_item' );
[1138] Fix | Delete
}
[1139] Fix | Delete
}
[1140] Fix | Delete
[1141] Fix | Delete
[1142] Fix | Delete
/**
[1143] Fix | Delete
* Fix for post previews
[1144] Fix | Delete
* With this code, the review meta data will actually get saved on Preview.
[1145] Fix | Delete
*
[1146] Fix | Delete
* @param array $fields Revision fields.
[1147] Fix | Delete
* @return array
[1148] Fix | Delete
*/
[1149] Fix | Delete
function add_field_debug_preview( $fields ) {
[1150] Fix | Delete
$fields['debug_preview'] = 'debug_preview';
[1151] Fix | Delete
return $fields;
[1152] Fix | Delete
}
[1153] Fix | Delete
add_filter( '_wp_post_revision_fields', 'add_field_debug_preview' );
[1154] Fix | Delete
[1155] Fix | Delete
[1156] Fix | Delete
/**
[1157] Fix | Delete
* Adds input debug preview.
[1158] Fix | Delete
*/
[1159] Fix | Delete
function add_input_debug_preview() {
[1160] Fix | Delete
echo '<input type="hidden" name="debug_preview" value="debug_preview">';
[1161] Fix | Delete
}
[1162] Fix | Delete
add_action( 'edit_form_after_title', 'add_input_debug_preview' );
[1163] Fix | Delete
[1164] Fix | Delete
[1165] Fix | Delete
/**
[1166] Fix | Delete
* Shows schema field.
[1167] Fix | Delete
*
[1168] Fix | Delete
* @param array $args Args.
[1169] Fix | Delete
* @param array $value Schema value.
[1170] Fix | Delete
* @param string $schema_type Schema type.
[1171] Fix | Delete
*/
[1172] Fix | Delete
function wp_review_schema_field( $args, $value, $schema_type ) {
[1173] Fix | Delete
$type = isset( $args['type'] ) ? $args['type'] : '';
[1174] Fix | Delete
$name = isset( $args['name'] ) ? $args['name'] : '';
[1175] Fix | Delete
$label = isset( $args['label'] ) ? $args['label'] : '';
[1176] Fix | Delete
$options = isset( $args['options'] ) ? $args['options'] : array();
[1177] Fix | Delete
$default = isset( $args['default'] ) ? $args['default'] : '';
[1178] Fix | Delete
$min = isset( $args['min'] ) ? $args['min'] : '0';
[1179] Fix | Delete
$max = isset( $args['max'] ) ? $args['max'] : '';
[1180] Fix | Delete
$info = isset( $args['info'] ) ? $args['info'] : '';
[1181] Fix | Delete
[1182] Fix | Delete
// Option value.
[1183] Fix | Delete
$opt_val = isset( $value[ $name ] ) ? $value[ $name ] : $default;
[1184] Fix | Delete
$opt_id_attr = 'wp_review_schema_options_' . $schema_type . '_' . $name;
[1185] Fix | Delete
$opt_name_attr = 'wp_review_schema_options[' . $schema_type . '][' . $name . ']';
[1186] Fix | Delete
[1187] Fix | Delete
$form_field = new WP_Review_Form_Field();
[1188] Fix | Delete
?>
[1189] Fix | Delete
<div class="wp-review-field-label">
[1190] Fix | Delete
<label for="<?php echo esc_attr( $opt_id_attr ); ?>" class="wp_review_schema_options_label"><?php echo esc_html( $label ); ?></label>
[1191] Fix | Delete
</div>
[1192] Fix | Delete
[1193] Fix | Delete
<div class="wp-review-field-option">
[1194] Fix | Delete
<?php
[1195] Fix | Delete
switch ( $type ) {
[1196] Fix | Delete
case 'text':
[1197] Fix | Delete
?>
[1198] Fix | Delete
<input type="text" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" />
[1199] Fix | Delete
<?php
[1200] Fix | Delete
break;
[1201] Fix | Delete
[1202] Fix | Delete
case 'select':
[1203] Fix | Delete
?>
[1204] Fix | Delete
<select name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>">
[1205] Fix | Delete
<?php foreach ( $options as $val => $label ) { ?>
[1206] Fix | Delete
<option value="<?php echo esc_attr( $val ); ?>" <?php selected( $opt_val, $val, true ); ?>><?php echo esc_html( $label ); ?></option>
[1207] Fix | Delete
<?php } ?>
[1208] Fix | Delete
</select>
[1209] Fix | Delete
<?php
[1210] Fix | Delete
break;
[1211] Fix | Delete
[1212] Fix | Delete
case 'number':
[1213] Fix | Delete
?>
[1214] Fix | Delete
<input type="number" step="1" min="<?php echo esc_attr( $min ); ?>" max="<?php echo esc_attr( $max ); ?>" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" class="small-text">
[1215] Fix | Delete
<?php
[1216] Fix | Delete
break;
[1217] Fix | Delete
[1218] Fix | Delete
case 'textarea':
[1219] Fix | Delete
?>
[1220] Fix | Delete
<textarea name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>"><?php echo esc_textarea( $opt_val ); ?></textarea>
[1221] Fix | Delete
<?php
[1222] Fix | Delete
break;
[1223] Fix | Delete
[1224] Fix | Delete
case 'checkbox':
[1225] Fix | Delete
?>
[1226] Fix | Delete
<input type="checkbox" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="1" <?php checked( $opt_val, '1', true ); ?> />
[1227] Fix | Delete
<?php
[1228] Fix | Delete
break;
[1229] Fix | Delete
[1230] Fix | Delete
case 'image':
[1231] Fix | Delete
?>
[1232] Fix | Delete
<span class="wpr_image_upload_field">
[1233] Fix | Delete
<span class="clearfix" id="<?php echo esc_attr( $opt_id_attr ); ?>-preview">
[1234] Fix | Delete
<?php
[1235] Fix | Delete
if ( ! empty( $opt_val['url'] ) ) {
[1236] Fix | Delete
echo '<img class="wpr_image_upload_img" src="' . esc_url( $opt_val['url'] ) . '" />';
[1237] Fix | Delete
}
[1238] Fix | Delete
?>
[1239] Fix | Delete
</span>
[1240] Fix | Delete
<input type="hidden" id="<?php echo esc_attr( $opt_id_attr ); ?>-id" name="<?php echo esc_attr( $opt_name_attr ); ?>[id]" value="<?php if ( isset( $opt_val['id'] ) ) echo $opt_val['id']; // phpcs:ignore ?>" />
[1241] Fix | Delete
<input type="hidden" id="<?php echo esc_attr( $opt_id_attr ); ?>-url" name="<?php echo esc_attr( $opt_name_attr ); ?>[url]" value="<?php if ( isset( $opt_val['url'] ) ) echo $opt_val['url']; // phpcs:ignore ?>" />
[1242] Fix | Delete
<button class="button" name="<?php echo esc_attr( $opt_id_attr ); ?>-upload" id="<?php echo esc_attr( $opt_id_attr ); ?>-upload" data-id="<?php echo esc_attr( $opt_id_attr ); ?>" onclick="wprImageField.uploader( '<?php echo esc_attr( $opt_id_attr ); ?>' ); return false;"><?php esc_html_e( 'Select Image', 'wp-review' ); ?></button>
[1243] Fix | Delete
<?php
[1244] Fix | Delete
if ( ! empty( $opt_val['url'] ) ) {
[1245] Fix | Delete
echo '<a href="#" class="button button-link clear-image">' . esc_html__( 'Remove Image', 'wp-review' ) . '</a>';
[1246] Fix | Delete
}
[1247] Fix | Delete
?>
[1248] Fix | Delete
<span class="clear"></span>
[1249] Fix | Delete
</span>
[1250] Fix | Delete
<?php
[1251] Fix | Delete
break;
[1252] Fix | Delete
[1253] Fix | Delete
case 'date':
[1254] Fix | Delete
?>
[1255] Fix | Delete
<input class="wpr-datepicker" type="text" name="<?php echo esc_attr( $opt_name_attr ); ?>" id="<?php echo esc_attr( $opt_id_attr ); ?>" value="<?php echo esc_attr( $opt_val ); ?>" size="30" />
[1256] Fix | Delete
<?php
[1257] Fix | Delete
break;
[1258] Fix | Delete
[1259] Fix | Delete
case 'switch':
[1260] Fix | Delete
$field_args = array(
[1261] Fix | Delete
'id' => $opt_id_attr,
[1262] Fix | Delete
'name' => $opt_name_attr,
[1263] Fix | Delete
'value' => $opt_val,
[1264] Fix | Delete
);
[1265] Fix | Delete
if ( ! empty( $args['on_label'] ) ) {
[1266] Fix | Delete
$field_args['on_label'] = $args['on_label'];
[1267] Fix | Delete
}
[1268] Fix | Delete
if ( ! empty( $args['off_label'] ) ) {
[1269] Fix | Delete
$field_args['off_label'] = $args['off_label'];
[1270] Fix | Delete
}
[1271] Fix | Delete
$form_field->render_switch( $field_args );
[1272] Fix | Delete
break;
[1273] Fix | Delete
}
[1274] Fix | Delete
[1275] Fix | Delete
if ( ! empty( $info ) ) {
[1276] Fix | Delete
printf( '<p class="description" style="color: #bbb">%s</p>', wp_kses_post( $info ) );
[1277] Fix | Delete
}
[1278] Fix | Delete
?>
[1279] Fix | Delete
</div>
[1280] Fix | Delete
<?php
[1281] Fix | Delete
}
[1282] Fix | Delete
[1283] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function