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/wordpres.../admin/metabox
File: class-metabox.php
return $shortcode_tags;
[1000] Fix | Delete
}
[1001] Fix | Delete
[1002] Fix | Delete
/**
[1003] Fix | Delete
* Prepares the replace vars for localization.
[1004] Fix | Delete
*
[1005] Fix | Delete
* @return string[] Replace vars.
[1006] Fix | Delete
*/
[1007] Fix | Delete
private function get_replace_vars() {
[1008] Fix | Delete
$cached_replacement_vars = [];
[1009] Fix | Delete
[1010] Fix | Delete
$vars_to_cache = [
[1011] Fix | Delete
'date',
[1012] Fix | Delete
'id',
[1013] Fix | Delete
'sitename',
[1014] Fix | Delete
'sitedesc',
[1015] Fix | Delete
'sep',
[1016] Fix | Delete
'page',
[1017] Fix | Delete
'currentdate',
[1018] Fix | Delete
'currentyear',
[1019] Fix | Delete
'currentmonth',
[1020] Fix | Delete
'currentday',
[1021] Fix | Delete
'post_year',
[1022] Fix | Delete
'post_month',
[1023] Fix | Delete
'post_day',
[1024] Fix | Delete
'name',
[1025] Fix | Delete
'author_first_name',
[1026] Fix | Delete
'author_last_name',
[1027] Fix | Delete
'permalink',
[1028] Fix | Delete
'post_content',
[1029] Fix | Delete
'category_title',
[1030] Fix | Delete
'tag',
[1031] Fix | Delete
'category',
[1032] Fix | Delete
];
[1033] Fix | Delete
[1034] Fix | Delete
foreach ( $vars_to_cache as $var ) {
[1035] Fix | Delete
$cached_replacement_vars[ $var ] = wpseo_replace_vars( '%%' . $var . '%%', $this->get_metabox_post() );
[1036] Fix | Delete
}
[1037] Fix | Delete
[1038] Fix | Delete
// Merge custom replace variables with the WordPress ones.
[1039] Fix | Delete
return array_merge( $cached_replacement_vars, $this->get_custom_replace_vars( $this->get_metabox_post() ) );
[1040] Fix | Delete
}
[1041] Fix | Delete
[1042] Fix | Delete
/**
[1043] Fix | Delete
* Returns the list of replace vars that should be hidden inside the editor.
[1044] Fix | Delete
*
[1045] Fix | Delete
* @return string[] The hidden replace vars.
[1046] Fix | Delete
*/
[1047] Fix | Delete
protected function get_hidden_replace_vars() {
[1048] Fix | Delete
return ( new WPSEO_Replace_Vars() )->get_hidden_replace_vars();
[1049] Fix | Delete
}
[1050] Fix | Delete
[1051] Fix | Delete
/**
[1052] Fix | Delete
* Prepares the recommended replace vars for localization.
[1053] Fix | Delete
*
[1054] Fix | Delete
* @return array<string[]> Recommended replacement variables.
[1055] Fix | Delete
*/
[1056] Fix | Delete
private function get_recommended_replace_vars() {
[1057] Fix | Delete
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
[1058] Fix | Delete
[1059] Fix | Delete
// What is recommended depends on the current context.
[1060] Fix | Delete
$post_type = $recommended_replace_vars->determine_for_post( $this->get_metabox_post() );
[1061] Fix | Delete
[1062] Fix | Delete
return $recommended_replace_vars->get_recommended_replacevars_for( $post_type );
[1063] Fix | Delete
}
[1064] Fix | Delete
[1065] Fix | Delete
/**
[1066] Fix | Delete
* Gets the custom replace variables for custom taxonomies and fields.
[1067] Fix | Delete
*
[1068] Fix | Delete
* @param WP_Post $post The post to check for custom taxonomies and fields.
[1069] Fix | Delete
*
[1070] Fix | Delete
* @return array<string[]> Array containing all the replacement variables.
[1071] Fix | Delete
*/
[1072] Fix | Delete
private function get_custom_replace_vars( $post ) {
[1073] Fix | Delete
return [
[1074] Fix | Delete
'custom_fields' => $this->get_custom_fields_replace_vars( $post ),
[1075] Fix | Delete
'custom_taxonomies' => $this->get_custom_taxonomies_replace_vars( $post ),
[1076] Fix | Delete
];
[1077] Fix | Delete
}
[1078] Fix | Delete
[1079] Fix | Delete
/**
[1080] Fix | Delete
* Gets the custom replace variables for custom taxonomies.
[1081] Fix | Delete
*
[1082] Fix | Delete
* @param WP_Post $post The post to check for custom taxonomies.
[1083] Fix | Delete
*
[1084] Fix | Delete
* @return array<string[]> Array containing all the replacement variables.
[1085] Fix | Delete
*/
[1086] Fix | Delete
private function get_custom_taxonomies_replace_vars( $post ) {
[1087] Fix | Delete
$taxonomies = get_object_taxonomies( $post, 'objects' );
[1088] Fix | Delete
$custom_replace_vars = [];
[1089] Fix | Delete
[1090] Fix | Delete
foreach ( $taxonomies as $taxonomy_name => $taxonomy ) {
[1091] Fix | Delete
[1092] Fix | Delete
if ( is_string( $taxonomy ) ) { // If attachment, see https://core.trac.wordpress.org/ticket/37368 .
[1093] Fix | Delete
$taxonomy_name = $taxonomy;
[1094] Fix | Delete
$taxonomy = get_taxonomy( $taxonomy_name );
[1095] Fix | Delete
}
[1096] Fix | Delete
[1097] Fix | Delete
if ( $taxonomy->_builtin && $taxonomy->public ) {
[1098] Fix | Delete
continue;
[1099] Fix | Delete
}
[1100] Fix | Delete
[1101] Fix | Delete
$custom_replace_vars[ $taxonomy_name ] = [
[1102] Fix | Delete
'name' => $taxonomy->name,
[1103] Fix | Delete
'description' => $taxonomy->description,
[1104] Fix | Delete
];
[1105] Fix | Delete
}
[1106] Fix | Delete
[1107] Fix | Delete
return $custom_replace_vars;
[1108] Fix | Delete
}
[1109] Fix | Delete
[1110] Fix | Delete
/**
[1111] Fix | Delete
* Gets the custom replace variables for custom fields.
[1112] Fix | Delete
*
[1113] Fix | Delete
* @param WP_Post $post The post to check for custom fields.
[1114] Fix | Delete
*
[1115] Fix | Delete
* @return array<string[]> Array containing all the replacement variables.
[1116] Fix | Delete
*/
[1117] Fix | Delete
private function get_custom_fields_replace_vars( $post ) {
[1118] Fix | Delete
$custom_replace_vars = [];
[1119] Fix | Delete
[1120] Fix | Delete
// If no post object is passed, return the empty custom_replace_vars array.
[1121] Fix | Delete
if ( ! is_object( $post ) ) {
[1122] Fix | Delete
return $custom_replace_vars;
[1123] Fix | Delete
}
[1124] Fix | Delete
[1125] Fix | Delete
$custom_fields = get_post_custom( $post->ID );
[1126] Fix | Delete
[1127] Fix | Delete
// If $custom_fields is an empty string or generally not an array, return early.
[1128] Fix | Delete
if ( ! is_array( $custom_fields ) ) {
[1129] Fix | Delete
return $custom_replace_vars;
[1130] Fix | Delete
}
[1131] Fix | Delete
[1132] Fix | Delete
$meta = YoastSEO()->meta->for_post( $post->ID );
[1133] Fix | Delete
[1134] Fix | Delete
if ( ! $meta ) {
[1135] Fix | Delete
return $custom_replace_vars;
[1136] Fix | Delete
}
[1137] Fix | Delete
[1138] Fix | Delete
// Simply concatenate all fields containing replace vars so we can handle them all with a single regex find.
[1139] Fix | Delete
$replace_vars_fields = implode(
[1140] Fix | Delete
' ',
[1141] Fix | Delete
[
[1142] Fix | Delete
$meta->presentation->title,
[1143] Fix | Delete
$meta->presentation->meta_description,
[1144] Fix | Delete
]
[1145] Fix | Delete
);
[1146] Fix | Delete
[1147] Fix | Delete
preg_match_all( '/%%cf_([A-Za-z0-9_]+)%%/', $replace_vars_fields, $matches );
[1148] Fix | Delete
$fields_to_include = $matches[1];
[1149] Fix | Delete
foreach ( $custom_fields as $custom_field_name => $custom_field ) {
[1150] Fix | Delete
// Skip private custom fields.
[1151] Fix | Delete
if ( substr( $custom_field_name, 0, 1 ) === '_' ) {
[1152] Fix | Delete
continue;
[1153] Fix | Delete
}
[1154] Fix | Delete
[1155] Fix | Delete
// Skip custom fields that are not used, new ones will be fetched dynamically.
[1156] Fix | Delete
if ( ! in_array( $custom_field_name, $fields_to_include, true ) ) {
[1157] Fix | Delete
continue;
[1158] Fix | Delete
}
[1159] Fix | Delete
[1160] Fix | Delete
// Skip custom field values that are serialized.
[1161] Fix | Delete
if ( is_serialized( $custom_field[0] ) ) {
[1162] Fix | Delete
continue;
[1163] Fix | Delete
}
[1164] Fix | Delete
[1165] Fix | Delete
$custom_replace_vars[ $custom_field_name ] = $custom_field[0];
[1166] Fix | Delete
}
[1167] Fix | Delete
[1168] Fix | Delete
return $custom_replace_vars;
[1169] Fix | Delete
}
[1170] Fix | Delete
[1171] Fix | Delete
/**
[1172] Fix | Delete
* Checks if the page is the post overview page.
[1173] Fix | Delete
*
[1174] Fix | Delete
* @param string $page The page to check for the post overview page.
[1175] Fix | Delete
*
[1176] Fix | Delete
* @return bool Whether or not the given page is the post overview page.
[1177] Fix | Delete
*/
[1178] Fix | Delete
public static function is_post_overview( $page ) {
[1179] Fix | Delete
return $page === 'edit.php';
[1180] Fix | Delete
}
[1181] Fix | Delete
[1182] Fix | Delete
/**
[1183] Fix | Delete
* Checks if the page is the post edit page.
[1184] Fix | Delete
*
[1185] Fix | Delete
* @param string $page The page to check for the post edit page.
[1186] Fix | Delete
*
[1187] Fix | Delete
* @return bool Whether or not the given page is the post edit page.
[1188] Fix | Delete
*/
[1189] Fix | Delete
public static function is_post_edit( $page ) {
[1190] Fix | Delete
return $page === 'post.php'
[1191] Fix | Delete
|| $page === 'post-new.php';
[1192] Fix | Delete
}
[1193] Fix | Delete
[1194] Fix | Delete
/**
[1195] Fix | Delete
* Retrieves the product title.
[1196] Fix | Delete
*
[1197] Fix | Delete
* @return string The product title.
[1198] Fix | Delete
*/
[1199] Fix | Delete
protected function get_product_title() {
[1200] Fix | Delete
return YoastSEO()->helpers->product->get_product_name();
[1201] Fix | Delete
}
[1202] Fix | Delete
}
[1203] Fix | Delete
[1204] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function