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.../httpdocs/wp-conte.../plugins/wordpres.../src/presenta...
File: archive-adjacent-trait.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
use Yoast\WP\SEO\Models\Indexable;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Class Archive_Adjacent.
[8] Fix | Delete
*
[9] Fix | Delete
* Presentation object for indexables.
[10] Fix | Delete
*
[11] Fix | Delete
* @property Indexable $model The indexable.
[12] Fix | Delete
*/
[13] Fix | Delete
trait Archive_Adjacent {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Holds the Pagination_Helper instance.
[17] Fix | Delete
*
[18] Fix | Delete
* @var Pagination_Helper
[19] Fix | Delete
*/
[20] Fix | Delete
protected $pagination;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Sets the helpers for the trait.
[24] Fix | Delete
*
[25] Fix | Delete
* @required
[26] Fix | Delete
*
[27] Fix | Delete
* @codeCoverageIgnore
[28] Fix | Delete
*
[29] Fix | Delete
* @param Pagination_Helper $pagination The pagination helper.
[30] Fix | Delete
*
[31] Fix | Delete
* @return void
[32] Fix | Delete
*/
[33] Fix | Delete
public function set_archive_adjacent_helpers( Pagination_Helper $pagination ) {
[34] Fix | Delete
$this->pagination = $pagination;
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
/**
[38] Fix | Delete
* Generates the rel prev.
[39] Fix | Delete
*
[40] Fix | Delete
* @return string
[41] Fix | Delete
*/
[42] Fix | Delete
public function generate_rel_prev() {
[43] Fix | Delete
if ( $this->pagination->is_rel_adjacent_disabled() ) {
[44] Fix | Delete
return '';
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
$current_page = \max( 1, $this->pagination->get_current_archive_page_number() );
[48] Fix | Delete
// Check if there is a previous page.
[49] Fix | Delete
if ( $current_page === 1 ) {
[50] Fix | Delete
return '';
[51] Fix | Delete
}
[52] Fix | Delete
// Check if the previous page is the first page.
[53] Fix | Delete
if ( $current_page === 2 ) {
[54] Fix | Delete
return $this->permalink;
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
return $this->pagination->get_paginated_url( $this->permalink, ( $current_page - 1 ) );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Generates the rel next.
[62] Fix | Delete
*
[63] Fix | Delete
* @return string
[64] Fix | Delete
*/
[65] Fix | Delete
public function generate_rel_next() {
[66] Fix | Delete
if ( $this->pagination->is_rel_adjacent_disabled() ) {
[67] Fix | Delete
return '';
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
$current_page = \max( 1, $this->pagination->get_current_archive_page_number() );
[71] Fix | Delete
if ( $this->pagination->get_number_of_archive_pages() <= $current_page ) {
[72] Fix | Delete
return '';
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
return $this->pagination->get_paginated_url( $this->permalink, ( $current_page + 1 ) );
[76] Fix | Delete
}
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function