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
/home/sportsfe.../public_h.../wp-conte.../plugins/wordpres.../src/presenta...
File: indexable-author-archive-presentation.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Presentations;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Helpers\Author_Archive_Helper;
[4] Fix | Delete
use Yoast\WP\SEO\Helpers\Post_Type_Helper;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Class Indexable_Author_Archive_Presentation.
[8] Fix | Delete
*
[9] Fix | Delete
* Presentation object for indexables.
[10] Fix | Delete
*/
[11] Fix | Delete
class Indexable_Author_Archive_Presentation extends Indexable_Presentation {
[12] Fix | Delete
[13] Fix | Delete
use Archive_Adjacent;
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Holds the post type helper instance.
[17] Fix | Delete
*
[18] Fix | Delete
* @var Post_Type_Helper
[19] Fix | Delete
*/
[20] Fix | Delete
protected $post_type;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Holds the author archive helper instance.
[24] Fix | Delete
*
[25] Fix | Delete
* @var Author_Archive_Helper
[26] Fix | Delete
*/
[27] Fix | Delete
protected $author_archive;
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* Indexable_Author_Archive_Presentation constructor.
[31] Fix | Delete
*
[32] Fix | Delete
* @codeCoverageIgnore
[33] Fix | Delete
*
[34] Fix | Delete
* @param Post_Type_Helper $post_type The post type helper.
[35] Fix | Delete
* @param Author_Archive_Helper $author_archive The author archive helper.
[36] Fix | Delete
*/
[37] Fix | Delete
public function __construct( Post_Type_Helper $post_type, Author_Archive_Helper $author_archive ) {
[38] Fix | Delete
$this->post_type = $post_type;
[39] Fix | Delete
$this->author_archive = $author_archive;
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Generates the canonical.
[44] Fix | Delete
*
[45] Fix | Delete
* @return string The canonical.
[46] Fix | Delete
*/
[47] Fix | Delete
public function generate_canonical() {
[48] Fix | Delete
if ( $this->model->canonical ) {
[49] Fix | Delete
return $this->model->canonical;
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
if ( ! $this->permalink ) {
[53] Fix | Delete
return '';
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
$current_page = $this->pagination->get_current_archive_page_number();
[57] Fix | Delete
if ( $current_page > 1 ) {
[58] Fix | Delete
return $this->pagination->get_paginated_url( $this->permalink, $current_page );
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
return $this->permalink;
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* Generates the title.
[66] Fix | Delete
*
[67] Fix | Delete
* @return string The title.
[68] Fix | Delete
*/
[69] Fix | Delete
public function generate_title() {
[70] Fix | Delete
if ( $this->model->title ) {
[71] Fix | Delete
return $this->model->title;
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
$option_titles_key = 'title-author-wpseo';
[75] Fix | Delete
$title = $this->options->get( $option_titles_key );
[76] Fix | Delete
if ( $title ) {
[77] Fix | Delete
return $title;
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
return $this->options->get_title_default( $option_titles_key );
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
/**
[84] Fix | Delete
* Generates the meta description.
[85] Fix | Delete
*
[86] Fix | Delete
* @return string The meta description.
[87] Fix | Delete
*/
[88] Fix | Delete
public function generate_meta_description() {
[89] Fix | Delete
if ( $this->model->description ) {
[90] Fix | Delete
return $this->model->description;
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
$option_titles_key = 'metadesc-author-wpseo';
[94] Fix | Delete
$description = $this->options->get( $option_titles_key );
[95] Fix | Delete
if ( $description ) {
[96] Fix | Delete
return $description;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
return $this->options->get_title_default( $option_titles_key );
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Generates the robots value.
[104] Fix | Delete
*
[105] Fix | Delete
* @return array The robots value.
[106] Fix | Delete
*/
[107] Fix | Delete
public function generate_robots() {
[108] Fix | Delete
$robots = $this->get_base_robots();
[109] Fix | Delete
[110] Fix | Delete
// Global option: "Show author archives in search results".
[111] Fix | Delete
if ( $this->options->get( 'noindex-author-wpseo', false ) ) {
[112] Fix | Delete
$robots['index'] = 'noindex';
[113] Fix | Delete
return $this->filter_robots( $robots );
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
$current_author = \get_userdata( $this->model->object_id );
[117] Fix | Delete
[118] Fix | Delete
// Safety check. The call to `get_user_data` could return false (called in `get_queried_object`).
[119] Fix | Delete
if ( $current_author === false ) {
[120] Fix | Delete
$robots['index'] = 'noindex';
[121] Fix | Delete
return $this->filter_robots( $robots );
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
$author_archive_post_types = $this->author_archive->get_author_archive_post_types();
[125] Fix | Delete
[126] Fix | Delete
// Global option: "Show archives for authors without posts in search results".
[127] Fix | Delete
if ( $this->options->get( 'noindex-author-noposts-wpseo', false ) && $this->user->count_posts( $current_author->ID, $author_archive_post_types ) === 0 ) {
[128] Fix | Delete
$robots['index'] = 'noindex';
[129] Fix | Delete
return $this->filter_robots( $robots );
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
// User option: "Do not allow search engines to show this author's archives in search results".
[133] Fix | Delete
if ( $this->user->get_meta( $current_author->ID, 'wpseo_noindex_author', true ) === 'on' ) {
[134] Fix | Delete
$robots['index'] = 'noindex';
[135] Fix | Delete
return $this->filter_robots( $robots );
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
return $this->filter_robots( $robots );
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
/**
[142] Fix | Delete
* Generates the Open Graph type.
[143] Fix | Delete
*
[144] Fix | Delete
* @return string The Open Graph type.
[145] Fix | Delete
*/
[146] Fix | Delete
public function generate_open_graph_type() {
[147] Fix | Delete
return 'profile';
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
/**
[151] Fix | Delete
* Generates the open graph images.
[152] Fix | Delete
*
[153] Fix | Delete
* @return array The open graph images.
[154] Fix | Delete
*/
[155] Fix | Delete
public function generate_open_graph_images() {
[156] Fix | Delete
if ( $this->context->open_graph_enabled === false ) {
[157] Fix | Delete
return [];
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
return $this->open_graph_image_generator->generate_for_author_archive( $this->context );
[161] Fix | Delete
}
[162] Fix | Delete
[163] Fix | Delete
/**
[164] Fix | Delete
* Generates the source.
[165] Fix | Delete
*
[166] Fix | Delete
* @return array The source.
[167] Fix | Delete
*/
[168] Fix | Delete
public function generate_source() {
[169] Fix | Delete
return [ 'post_author' => $this->model->object_id ];
[170] Fix | Delete
}
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function