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
File: class-meta-columns.php
*
[500] Fix | Delete
* @param array $score_filters Array containing the score filters.
[501] Fix | Delete
*
[502] Fix | Delete
* @return array Array containing the score filters that need to be applied to the meta query.
[503] Fix | Delete
*/
[504] Fix | Delete
protected function determine_score_filters( $score_filters ) {
[505] Fix | Delete
if ( count( $score_filters ) > 1 ) {
[506] Fix | Delete
return array_merge( [ 'relation' => 'AND' ], $score_filters );
[507] Fix | Delete
}
[508] Fix | Delete
[509] Fix | Delete
return $score_filters;
[510] Fix | Delete
}
[511] Fix | Delete
[512] Fix | Delete
/**
[513] Fix | Delete
* Retrieves the post type from the $_GET variable.
[514] Fix | Delete
*
[515] Fix | Delete
* @return string|null The sanitized current post type or null when the variable is not set in $_GET.
[516] Fix | Delete
*/
[517] Fix | Delete
public function get_current_post_type() {
[518] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[519] Fix | Delete
if ( isset( $_GET['post_type'] ) && is_string( $_GET['post_type'] ) ) {
[520] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[521] Fix | Delete
return sanitize_text_field( wp_unslash( $_GET['post_type'] ) );
[522] Fix | Delete
}
[523] Fix | Delete
return null;
[524] Fix | Delete
}
[525] Fix | Delete
[526] Fix | Delete
/**
[527] Fix | Delete
* Retrieves the SEO filter from the $_GET variable.
[528] Fix | Delete
*
[529] Fix | Delete
* @return string|null The sanitized seo filter or null when the variable is not set in $_GET.
[530] Fix | Delete
*/
[531] Fix | Delete
public function get_current_seo_filter() {
[532] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[533] Fix | Delete
if ( isset( $_GET['seo_filter'] ) && is_string( $_GET['seo_filter'] ) ) {
[534] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[535] Fix | Delete
return sanitize_text_field( wp_unslash( $_GET['seo_filter'] ) );
[536] Fix | Delete
}
[537] Fix | Delete
return null;
[538] Fix | Delete
}
[539] Fix | Delete
[540] Fix | Delete
/**
[541] Fix | Delete
* Retrieves the Readability filter from the $_GET variable.
[542] Fix | Delete
*
[543] Fix | Delete
* @return string|null The sanitized readability filter or null when the variable is not set in $_GET.
[544] Fix | Delete
*/
[545] Fix | Delete
public function get_current_readability_filter() {
[546] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[547] Fix | Delete
if ( isset( $_GET['readability_filter'] ) && is_string( $_GET['readability_filter'] ) ) {
[548] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[549] Fix | Delete
return sanitize_text_field( wp_unslash( $_GET['readability_filter'] ) );
[550] Fix | Delete
}
[551] Fix | Delete
return null;
[552] Fix | Delete
}
[553] Fix | Delete
[554] Fix | Delete
/**
[555] Fix | Delete
* Retrieves the keyword filter from the $_GET variable.
[556] Fix | Delete
*
[557] Fix | Delete
* @return string|null The sanitized seo keyword filter or null when the variable is not set in $_GET.
[558] Fix | Delete
*/
[559] Fix | Delete
public function get_current_keyword_filter() {
[560] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[561] Fix | Delete
if ( isset( $_GET['seo_kw_filter'] ) && is_string( $_GET['seo_kw_filter'] ) ) {
[562] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[563] Fix | Delete
return sanitize_text_field( wp_unslash( $_GET['seo_kw_filter'] ) );
[564] Fix | Delete
}
[565] Fix | Delete
return null;
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
/**
[569] Fix | Delete
* Uses the vars to create a complete filter query that can later be executed to filter out posts.
[570] Fix | Delete
*
[571] Fix | Delete
* @param array $vars Array containing the variables that will be used in the meta query.
[572] Fix | Delete
* @param array $filters Array containing the filters that we need to apply in the meta query.
[573] Fix | Delete
*
[574] Fix | Delete
* @return array Array containing the complete filter query.
[575] Fix | Delete
*/
[576] Fix | Delete
protected function build_filter_query( $vars, $filters ) {
[577] Fix | Delete
// If no filters were applied, just return everything.
[578] Fix | Delete
if ( count( $filters ) === 0 ) {
[579] Fix | Delete
return $vars;
[580] Fix | Delete
}
[581] Fix | Delete
[582] Fix | Delete
$result = [ 'meta_query' => [] ];
[583] Fix | Delete
$result['meta_query'] = array_merge( $result['meta_query'], [ $this->determine_score_filters( $filters ) ] );
[584] Fix | Delete
[585] Fix | Delete
$current_seo_filter = $this->get_current_seo_filter();
[586] Fix | Delete
[587] Fix | Delete
// This only applies for the SEO score filter because it can because the SEO score can be altered by the no-index option.
[588] Fix | Delete
if ( $this->is_valid_filter( $current_seo_filter ) && ! in_array( $current_seo_filter, [ WPSEO_Rank::NO_INDEX, WPSEO_Rank::NO_FOCUS ], true ) ) {
[589] Fix | Delete
$result['meta_query'] = array_merge( $result['meta_query'], [ $this->get_meta_robots_query_values() ] );
[590] Fix | Delete
}
[591] Fix | Delete
[592] Fix | Delete
return array_merge( $vars, $result );
[593] Fix | Delete
}
[594] Fix | Delete
[595] Fix | Delete
/**
[596] Fix | Delete
* Creates a Readability score filter.
[597] Fix | Delete
*
[598] Fix | Delete
* @param number $low The lower boundary of the score.
[599] Fix | Delete
* @param number $high The higher boundary of the score.
[600] Fix | Delete
*
[601] Fix | Delete
* @return array The Readability Score filter.
[602] Fix | Delete
*/
[603] Fix | Delete
protected function create_readability_score_filter( $low, $high ) {
[604] Fix | Delete
return [
[605] Fix | Delete
[
[606] Fix | Delete
'key' => WPSEO_Meta::$meta_prefix . 'content_score',
[607] Fix | Delete
'value' => [ $low, $high ],
[608] Fix | Delete
'type' => 'numeric',
[609] Fix | Delete
'compare' => 'BETWEEN',
[610] Fix | Delete
],
[611] Fix | Delete
];
[612] Fix | Delete
}
[613] Fix | Delete
[614] Fix | Delete
/**
[615] Fix | Delete
* Creates an SEO score filter.
[616] Fix | Delete
*
[617] Fix | Delete
* @param number $low The lower boundary of the score.
[618] Fix | Delete
* @param number $high The higher boundary of the score.
[619] Fix | Delete
*
[620] Fix | Delete
* @return array The SEO score filter.
[621] Fix | Delete
*/
[622] Fix | Delete
protected function create_seo_score_filter( $low, $high ) {
[623] Fix | Delete
return [
[624] Fix | Delete
[
[625] Fix | Delete
'key' => WPSEO_Meta::$meta_prefix . 'linkdex',
[626] Fix | Delete
'value' => [ $low, $high ],
[627] Fix | Delete
'type' => 'numeric',
[628] Fix | Delete
'compare' => 'BETWEEN',
[629] Fix | Delete
],
[630] Fix | Delete
];
[631] Fix | Delete
}
[632] Fix | Delete
[633] Fix | Delete
/**
[634] Fix | Delete
* Creates a filter to retrieve posts that were set to no-index.
[635] Fix | Delete
*
[636] Fix | Delete
* @return array Array containin the no-index filter.
[637] Fix | Delete
*/
[638] Fix | Delete
protected function create_no_index_filter() {
[639] Fix | Delete
return [
[640] Fix | Delete
[
[641] Fix | Delete
'key' => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex',
[642] Fix | Delete
'value' => '1',
[643] Fix | Delete
'compare' => '=',
[644] Fix | Delete
],
[645] Fix | Delete
];
[646] Fix | Delete
}
[647] Fix | Delete
[648] Fix | Delete
/**
[649] Fix | Delete
* Creates a filter to retrieve posts that have no keyword set.
[650] Fix | Delete
*
[651] Fix | Delete
* @return array Array containing the no focus keyword filter.
[652] Fix | Delete
*/
[653] Fix | Delete
protected function create_no_focus_keyword_filter() {
[654] Fix | Delete
return [
[655] Fix | Delete
[
[656] Fix | Delete
'key' => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex',
[657] Fix | Delete
'value' => 'needs-a-value-anyway',
[658] Fix | Delete
'compare' => 'NOT EXISTS',
[659] Fix | Delete
],
[660] Fix | Delete
[
[661] Fix | Delete
'key' => WPSEO_Meta::$meta_prefix . 'linkdex',
[662] Fix | Delete
'value' => 'needs-a-value-anyway',
[663] Fix | Delete
'compare' => 'NOT EXISTS',
[664] Fix | Delete
],
[665] Fix | Delete
];
[666] Fix | Delete
}
[667] Fix | Delete
[668] Fix | Delete
/**
[669] Fix | Delete
* Determines whether a particular post_id is of an indexable post type.
[670] Fix | Delete
*
[671] Fix | Delete
* @param string $post_id The post ID to check.
[672] Fix | Delete
*
[673] Fix | Delete
* @return bool Whether or not it is indexable.
[674] Fix | Delete
*/
[675] Fix | Delete
protected function is_indexable( $post_id ) {
[676] Fix | Delete
if ( ! empty( $post_id ) && ! $this->uses_default_indexing( $post_id ) ) {
[677] Fix | Delete
return WPSEO_Meta::get_value( 'meta-robots-noindex', $post_id ) === '2';
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
$post = get_post( $post_id );
[681] Fix | Delete
[682] Fix | Delete
if ( is_object( $post ) ) {
[683] Fix | Delete
// If the option is false, this means we want to index it.
[684] Fix | Delete
return WPSEO_Options::get( 'noindex-' . $post->post_type, false ) === false;
[685] Fix | Delete
}
[686] Fix | Delete
[687] Fix | Delete
return true;
[688] Fix | Delete
}
[689] Fix | Delete
[690] Fix | Delete
/**
[691] Fix | Delete
* Determines whether the given post ID uses the default indexing settings.
[692] Fix | Delete
*
[693] Fix | Delete
* @param int $post_id The post ID to check.
[694] Fix | Delete
*
[695] Fix | Delete
* @return bool Whether or not the default indexing is being used for the post.
[696] Fix | Delete
*/
[697] Fix | Delete
protected function uses_default_indexing( $post_id ) {
[698] Fix | Delete
return WPSEO_Meta::get_value( 'meta-robots-noindex', $post_id ) === '0';
[699] Fix | Delete
}
[700] Fix | Delete
[701] Fix | Delete
/**
[702] Fix | Delete
* Returns filters when $order_by is matched in the if-statement.
[703] Fix | Delete
*
[704] Fix | Delete
* @param string $order_by The ID of the column by which to order the posts.
[705] Fix | Delete
*
[706] Fix | Delete
* @return array Array containing the order filters.
[707] Fix | Delete
*/
[708] Fix | Delete
private function filter_order_by( $order_by ) {
[709] Fix | Delete
switch ( $order_by ) {
[710] Fix | Delete
case 'wpseo-metadesc':
[711] Fix | Delete
return [
[712] Fix | Delete
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Reason: Only used when user requests sorting.
[713] Fix | Delete
'meta_key' => WPSEO_Meta::$meta_prefix . 'metadesc',
[714] Fix | Delete
'orderby' => 'meta_value',
[715] Fix | Delete
];
[716] Fix | Delete
[717] Fix | Delete
case 'wpseo-focuskw':
[718] Fix | Delete
return [
[719] Fix | Delete
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Reason: Only used when user requests sorting.
[720] Fix | Delete
'meta_key' => WPSEO_Meta::$meta_prefix . 'focuskw',
[721] Fix | Delete
'orderby' => 'meta_value',
[722] Fix | Delete
];
[723] Fix | Delete
[724] Fix | Delete
case 'wpseo-score':
[725] Fix | Delete
return [
[726] Fix | Delete
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Reason: Only used when user requests sorting.
[727] Fix | Delete
'meta_key' => WPSEO_Meta::$meta_prefix . 'linkdex',
[728] Fix | Delete
'orderby' => 'meta_value_num',
[729] Fix | Delete
];
[730] Fix | Delete
[731] Fix | Delete
case 'wpseo-score-readability':
[732] Fix | Delete
return [
[733] Fix | Delete
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Reason: Only used when user requests sorting.
[734] Fix | Delete
'meta_key' => WPSEO_Meta::$meta_prefix . 'content_score',
[735] Fix | Delete
'orderby' => 'meta_value_num',
[736] Fix | Delete
];
[737] Fix | Delete
}
[738] Fix | Delete
[739] Fix | Delete
return [];
[740] Fix | Delete
}
[741] Fix | Delete
[742] Fix | Delete
/**
[743] Fix | Delete
* Parses the score column.
[744] Fix | Delete
*
[745] Fix | Delete
* @param int $post_id The ID of the post for which to show the score.
[746] Fix | Delete
*
[747] Fix | Delete
* @return string The HTML for the SEO score indicator.
[748] Fix | Delete
*/
[749] Fix | Delete
private function parse_column_score( $post_id ) {
[750] Fix | Delete
$meta = $this->get_meta( $post_id );
[751] Fix | Delete
[752] Fix | Delete
if ( $meta ) {
[753] Fix | Delete
return $this->score_icon_helper->for_seo( $meta->indexable, '', __( 'Post is set to noindex.', 'wordpress-seo' ) );
[754] Fix | Delete
}
[755] Fix | Delete
}
[756] Fix | Delete
[757] Fix | Delete
/**
[758] Fix | Delete
* Parsing the readability score column.
[759] Fix | Delete
*
[760] Fix | Delete
* @param int $post_id The ID of the post for which to show the readability score.
[761] Fix | Delete
*
[762] Fix | Delete
* @return string The HTML for the readability score indicator.
[763] Fix | Delete
*/
[764] Fix | Delete
private function parse_column_score_readability( $post_id ) {
[765] Fix | Delete
$meta = $this->get_meta( $post_id );
[766] Fix | Delete
if ( $meta ) {
[767] Fix | Delete
return $this->score_icon_helper->for_readability( $meta->indexable->readability_score );
[768] Fix | Delete
}
[769] Fix | Delete
}
[770] Fix | Delete
[771] Fix | Delete
/**
[772] Fix | Delete
* Sets up the hooks for the post_types.
[773] Fix | Delete
*
[774] Fix | Delete
* @return void
[775] Fix | Delete
*/
[776] Fix | Delete
private function set_post_type_hooks() {
[777] Fix | Delete
$post_types = WPSEO_Post_Type::get_accessible_post_types();
[778] Fix | Delete
[779] Fix | Delete
if ( ! is_array( $post_types ) || $post_types === [] ) {
[780] Fix | Delete
return;
[781] Fix | Delete
}
[782] Fix | Delete
[783] Fix | Delete
foreach ( $post_types as $post_type ) {
[784] Fix | Delete
if ( $this->display_metabox( $post_type ) === false ) {
[785] Fix | Delete
continue;
[786] Fix | Delete
}
[787] Fix | Delete
[788] Fix | Delete
add_filter( 'manage_' . $post_type . '_posts_columns', [ $this, 'column_heading' ], 10, 1 );
[789] Fix | Delete
add_action( 'manage_' . $post_type . '_posts_custom_column', [ $this, 'column_content' ], 10, 2 );
[790] Fix | Delete
add_action( 'manage_edit-' . $post_type . '_sortable_columns', [ $this, 'column_sort' ], 10, 2 );
[791] Fix | Delete
}
[792] Fix | Delete
[793] Fix | Delete
unset( $post_type );
[794] Fix | Delete
}
[795] Fix | Delete
[796] Fix | Delete
/**
[797] Fix | Delete
* Wraps the WPSEO_Metabox check to determine whether the metabox should be displayed either by
[798] Fix | Delete
* choice of the admin or because the post type is not a public post type.
[799] Fix | Delete
*
[800] Fix | Delete
* @since 7.0
[801] Fix | Delete
*
[802] Fix | Delete
* @param string|null $post_type Optional. The post type to test, defaults to the current post post_type.
[803] Fix | Delete
*
[804] Fix | Delete
* @return bool Whether or not the meta box (and associated columns etc) should be hidden.
[805] Fix | Delete
*/
[806] Fix | Delete
private function display_metabox( $post_type = null ) {
[807] Fix | Delete
$current_post_type = $this->get_current_post_type();
[808] Fix | Delete
[809] Fix | Delete
if ( ! isset( $post_type ) && ! empty( $current_post_type ) ) {
[810] Fix | Delete
$post_type = $current_post_type;
[811] Fix | Delete
}
[812] Fix | Delete
[813] Fix | Delete
return WPSEO_Utils::is_metabox_active( $post_type, 'post_type' );
[814] Fix | Delete
}
[815] Fix | Delete
[816] Fix | Delete
/**
[817] Fix | Delete
* Determines whether or not filter dropdowns should be displayed.
[818] Fix | Delete
*
[819] Fix | Delete
* @return bool Whether or the current page can display the filter drop downs.
[820] Fix | Delete
*/
[821] Fix | Delete
public function can_display_filter() {
[822] Fix | Delete
if ( $GLOBALS['pagenow'] === 'upload.php' ) {
[823] Fix | Delete
return false;
[824] Fix | Delete
}
[825] Fix | Delete
[826] Fix | Delete
if ( $this->display_metabox() === false ) {
[827] Fix | Delete
return false;
[828] Fix | Delete
}
[829] Fix | Delete
[830] Fix | Delete
$screen = get_current_screen();
[831] Fix | Delete
if ( $screen === null ) {
[832] Fix | Delete
return false;
[833] Fix | Delete
}
[834] Fix | Delete
[835] Fix | Delete
return WPSEO_Post_Type::is_post_type_accessible( $screen->post_type );
[836] Fix | Delete
}
[837] Fix | Delete
}
[838] Fix | Delete
[839] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function