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-date-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\Pagination_Helper;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Class Indexable_Date_Archive_Presentation.
[7] Fix | Delete
*
[8] Fix | Delete
* Presentation object for indexables.
[9] Fix | Delete
*/
[10] Fix | Delete
class Indexable_Date_Archive_Presentation extends Indexable_Presentation {
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* Holds the Pagination_Helper instance.
[14] Fix | Delete
*
[15] Fix | Delete
* @var Pagination_Helper
[16] Fix | Delete
*/
[17] Fix | Delete
protected $pagination;
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Indexable_Date_Archive_Presentation constructor.
[21] Fix | Delete
*
[22] Fix | Delete
* @param Pagination_Helper $pagination The pagination helper.
[23] Fix | Delete
*/
[24] Fix | Delete
public function __construct( Pagination_Helper $pagination ) {
[25] Fix | Delete
$this->pagination = $pagination;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Generates the canonical.
[30] Fix | Delete
*
[31] Fix | Delete
* @return string The canonical.
[32] Fix | Delete
*/
[33] Fix | Delete
public function generate_canonical() {
[34] Fix | Delete
$canonical = $this->current_page->get_date_archive_permalink();
[35] Fix | Delete
[36] Fix | Delete
$current_page = $this->pagination->get_current_archive_page_number();
[37] Fix | Delete
if ( $current_page > 1 ) {
[38] Fix | Delete
return $this->pagination->get_paginated_url( $canonical, $current_page );
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
return $canonical;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Generates the robots value.
[46] Fix | Delete
*
[47] Fix | Delete
* @return array The robots value.
[48] Fix | Delete
*/
[49] Fix | Delete
public function generate_robots() {
[50] Fix | Delete
$robots = $this->get_base_robots();
[51] Fix | Delete
[52] Fix | Delete
if ( $this->options->get( 'noindex-archive-wpseo', false ) ) {
[53] Fix | Delete
$robots['index'] = 'noindex';
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
return $this->filter_robots( $robots );
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* Generates the title.
[61] Fix | Delete
*
[62] Fix | Delete
* @return string The title.
[63] Fix | Delete
*/
[64] Fix | Delete
public function generate_title() {
[65] Fix | Delete
if ( $this->model->title ) {
[66] Fix | Delete
return $this->model->title;
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
return $this->options->get_title_default( 'title-archive-wpseo' );
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
/**
[73] Fix | Delete
* Generates the rel prev.
[74] Fix | Delete
*
[75] Fix | Delete
* @return string The rel prev value.
[76] Fix | Delete
*/
[77] Fix | Delete
public function generate_rel_prev() {
[78] Fix | Delete
if ( $this->pagination->is_rel_adjacent_disabled() ) {
[79] Fix | Delete
return '';
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
$current_page = \max( 1, $this->pagination->get_current_archive_page_number() );
[83] Fix | Delete
// Check if there is a previous page.
[84] Fix | Delete
if ( $current_page === 1 ) {
[85] Fix | Delete
return '';
[86] Fix | Delete
}
[87] Fix | Delete
// Check if the previous page is the first page.
[88] Fix | Delete
if ( $current_page === 2 ) {
[89] Fix | Delete
return $this->current_page->get_date_archive_permalink();
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
return $this->pagination->get_paginated_url( $this->current_page->get_date_archive_permalink(), ( $current_page - 1 ) );
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
/**
[96] Fix | Delete
* Generates the rel next.
[97] Fix | Delete
*
[98] Fix | Delete
* @return string The rel prev next.
[99] Fix | Delete
*/
[100] Fix | Delete
public function generate_rel_next() {
[101] Fix | Delete
if ( $this->pagination->is_rel_adjacent_disabled() ) {
[102] Fix | Delete
return '';
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
$current_page = \max( 1, $this->pagination->get_current_archive_page_number() );
[106] Fix | Delete
if ( $this->pagination->get_number_of_archive_pages() <= $current_page ) {
[107] Fix | Delete
return '';
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
return $this->pagination->get_paginated_url( $this->current_page->get_date_archive_permalink(), ( $current_page + 1 ) );
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
/**
[114] Fix | Delete
* Generates the open graph url.
[115] Fix | Delete
*
[116] Fix | Delete
* @return string The open graph url.
[117] Fix | Delete
*/
[118] Fix | Delete
public function generate_open_graph_url() {
[119] Fix | Delete
return $this->current_page->get_date_archive_permalink();
[120] Fix | Delete
}
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function