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/integrat.../front-en...
File: rss-footer-embed.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Integrations\Front_End;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
[4] Fix | Delete
use Yoast\WP\SEO\Helpers\Options_Helper;
[5] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Class RSS_Footer_Embed.
[9] Fix | Delete
*/
[10] Fix | Delete
class RSS_Footer_Embed implements Integration_Interface {
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* The options helper.
[14] Fix | Delete
*
[15] Fix | Delete
* @var Options_Helper
[16] Fix | Delete
*/
[17] Fix | Delete
protected $options;
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Returns the conditionals based in which this loadable should be active.
[21] Fix | Delete
*
[22] Fix | Delete
* @return array
[23] Fix | Delete
*/
[24] Fix | Delete
public static function get_conditionals() {
[25] Fix | Delete
return [ Front_End_Conditional::class ];
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Sets the required helpers.
[30] Fix | Delete
*
[31] Fix | Delete
* @codeCoverageIgnore It only handles dependencies.
[32] Fix | Delete
*
[33] Fix | Delete
* @param Options_Helper $options The options helper.
[34] Fix | Delete
*/
[35] Fix | Delete
public function __construct( Options_Helper $options ) {
[36] Fix | Delete
$this->options = $options;
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Initializes the integration.
[41] Fix | Delete
*
[42] Fix | Delete
* This is the place to register hooks and filters.
[43] Fix | Delete
*
[44] Fix | Delete
* @return void
[45] Fix | Delete
*/
[46] Fix | Delete
public function register_hooks() {
[47] Fix | Delete
\add_filter( 'the_content_feed', [ $this, 'embed_rssfooter' ] );
[48] Fix | Delete
\add_filter( 'the_excerpt_rss', [ $this, 'embed_rssfooter_excerpt' ] );
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
/**
[52] Fix | Delete
* Adds the RSS footer (or header) to the full RSS feed item.
[53] Fix | Delete
*
[54] Fix | Delete
* @param string $content Feed item content.
[55] Fix | Delete
*
[56] Fix | Delete
* @return string
[57] Fix | Delete
*/
[58] Fix | Delete
public function embed_rssfooter( $content ) {
[59] Fix | Delete
if ( ! $this->include_rss_footer( 'full' ) ) {
[60] Fix | Delete
return $content;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
return $this->embed_rss( $content );
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
/**
[67] Fix | Delete
* Adds the RSS footer (or header) to the excerpt RSS feed item.
[68] Fix | Delete
*
[69] Fix | Delete
* @param string $content Feed item excerpt.
[70] Fix | Delete
*
[71] Fix | Delete
* @return string
[72] Fix | Delete
*/
[73] Fix | Delete
public function embed_rssfooter_excerpt( $content ) {
[74] Fix | Delete
if ( ! $this->include_rss_footer( 'excerpt' ) ) {
[75] Fix | Delete
return $content;
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
return $this->embed_rss( \wpautop( $content ) );
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
/**
[82] Fix | Delete
* Checks if the RSS footer should included.
[83] Fix | Delete
*
[84] Fix | Delete
* @param string $context The context of the RSS content.
[85] Fix | Delete
*
[86] Fix | Delete
* @return bool Whether or not the RSS footer should included.
[87] Fix | Delete
*/
[88] Fix | Delete
protected function include_rss_footer( $context ) {
[89] Fix | Delete
if ( ! \is_feed() ) {
[90] Fix | Delete
return false;
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
/**
[94] Fix | Delete
* Filter: 'wpseo_include_rss_footer' - Allow the RSS footer to be dynamically shown/hidden.
[95] Fix | Delete
*
[96] Fix | Delete
* @param bool $show_embed Indicates if the RSS footer should be shown or not.
[97] Fix | Delete
* @param string $context The context of the RSS content - 'full' or 'excerpt'.
[98] Fix | Delete
*/
[99] Fix | Delete
if ( ! \apply_filters( 'wpseo_include_rss_footer', true, $context ) ) {
[100] Fix | Delete
return false;
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
return $this->is_configured();
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
/**
[107] Fix | Delete
* Checks if the RSS feed fields are configured.
[108] Fix | Delete
*
[109] Fix | Delete
* @return bool True when one of the fields has a value.
[110] Fix | Delete
*/
[111] Fix | Delete
protected function is_configured() {
[112] Fix | Delete
return ( $this->options->get( 'rssbefore', '' ) !== '' || $this->options->get( 'rssafter', '' ) );
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
/**
[116] Fix | Delete
* Adds the RSS footer and/or header to an RSS feed item.
[117] Fix | Delete
*
[118] Fix | Delete
* @param string $content Feed item content.
[119] Fix | Delete
*
[120] Fix | Delete
* @return string The content to add.
[121] Fix | Delete
*/
[122] Fix | Delete
protected function embed_rss( $content ) {
[123] Fix | Delete
$before = $this->rss_replace_vars( $this->options->get( 'rssbefore', '' ) );
[124] Fix | Delete
$after = $this->rss_replace_vars( $this->options->get( 'rssafter', '' ) );
[125] Fix | Delete
$content = $before . $content . $after;
[126] Fix | Delete
[127] Fix | Delete
return $content;
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
/**
[131] Fix | Delete
* Replaces the possible RSS variables with their actual values.
[132] Fix | Delete
*
[133] Fix | Delete
* @param string $content The RSS content that should have the variables replaced.
[134] Fix | Delete
*
[135] Fix | Delete
* @return string
[136] Fix | Delete
*/
[137] Fix | Delete
protected function rss_replace_vars( $content ) {
[138] Fix | Delete
if ( $content === '' ) {
[139] Fix | Delete
return $content;
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
$replace_vars = $this->get_replace_vars( $this->get_link_template(), \get_post() );
[143] Fix | Delete
[144] Fix | Delete
$content = \stripslashes( \trim( $content ) );
[145] Fix | Delete
$content = \str_ireplace( \array_keys( $replace_vars ), \array_values( $replace_vars ), $content );
[146] Fix | Delete
[147] Fix | Delete
return \wpautop( $content );
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
/**
[151] Fix | Delete
* Retrieves the replacement variables.
[152] Fix | Delete
*
[153] Fix | Delete
* @codeCoverageIgnore It just contains too much WordPress functions.
[154] Fix | Delete
*
[155] Fix | Delete
* @param string $link_template The link template.
[156] Fix | Delete
* @param mixed $post The post to use.
[157] Fix | Delete
*
[158] Fix | Delete
* @return array The replacement variables.
[159] Fix | Delete
*/
[160] Fix | Delete
protected function get_replace_vars( $link_template, $post ) {
[161] Fix | Delete
$author_link = '';
[162] Fix | Delete
if ( \is_object( $post ) ) {
[163] Fix | Delete
$author_link = \sprintf( $link_template, \esc_url( \get_author_posts_url( $post->post_author ) ), \esc_html( \get_the_author() ) );
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
return [
[167] Fix | Delete
'%%AUTHORLINK%%' => $author_link,
[168] Fix | Delete
'%%POSTLINK%%' => \sprintf( $link_template, \esc_url( \get_permalink() ), \esc_html( \get_the_title() ) ),
[169] Fix | Delete
'%%BLOGLINK%%' => \sprintf( $link_template, \esc_url( \get_bloginfo( 'url' ) ), \esc_html( \get_bloginfo( 'name' ) ) ),
[170] Fix | Delete
'%%BLOGDESCLINK%%' => \sprintf( $link_template, \esc_url( \get_bloginfo( 'url' ) ), \esc_html( \get_bloginfo( 'name' ) ) . ' - ' . \esc_html( \get_bloginfo( 'description' ) ) ),
[171] Fix | Delete
];
[172] Fix | Delete
}
[173] Fix | Delete
[174] Fix | Delete
/**
[175] Fix | Delete
* Retrieves the link template.
[176] Fix | Delete
*
[177] Fix | Delete
* @return string The link template.
[178] Fix | Delete
*/
[179] Fix | Delete
protected function get_link_template() {
[180] Fix | Delete
/**
[181] Fix | Delete
* Filter: 'nofollow_rss_links' - Allow the developer to determine whether or not to follow the links in
[182] Fix | Delete
* the bits Yoast SEO adds to the RSS feed, defaults to false.
[183] Fix | Delete
*
[184] Fix | Delete
* @since 1.4.20
[185] Fix | Delete
*
[186] Fix | Delete
* @param bool $unsigned Whether or not to follow the links in RSS feed, defaults to true.
[187] Fix | Delete
*/
[188] Fix | Delete
if ( \apply_filters( 'nofollow_rss_links', false ) ) {
[189] Fix | Delete
return '<a rel="nofollow" href="%1$s">%2$s</a>';
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
return '<a href="%1$s">%2$s</a>';
[193] Fix | Delete
}
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function