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/presente.../twitter
File: site-presenter.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Presenters\Twitter;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Presentations\Indexable_Presentation;
[4] Fix | Delete
use Yoast\WP\SEO\Presenters\Abstract_Indexable_Tag_Presenter;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Presenter class for the Twitter site tag.
[8] Fix | Delete
*/
[9] Fix | Delete
class Site_Presenter extends Abstract_Indexable_Tag_Presenter {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* The tag key name.
[13] Fix | Delete
*
[14] Fix | Delete
* @var string
[15] Fix | Delete
*/
[16] Fix | Delete
protected $key = 'twitter:site';
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Run the Twitter site through the `wpseo_twitter_site` filter.
[20] Fix | Delete
*
[21] Fix | Delete
* @return string The filtered Twitter site.
[22] Fix | Delete
*/
[23] Fix | Delete
public function get() {
[24] Fix | Delete
/**
[25] Fix | Delete
* Filter: 'wpseo_twitter_site' - Allow changing the Twitter site account as output in the Twitter card by Yoast SEO.
[26] Fix | Delete
*
[27] Fix | Delete
* @param string $twitter_site Twitter site account string.
[28] Fix | Delete
* @param Indexable_Presentation $presentation The presentation of an indexable.
[29] Fix | Delete
*/
[30] Fix | Delete
$twitter_site = \apply_filters( 'wpseo_twitter_site', $this->presentation->twitter_site, $this->presentation );
[31] Fix | Delete
$twitter_site = $this->get_twitter_id( $twitter_site );
[32] Fix | Delete
[33] Fix | Delete
if ( ! \is_string( $twitter_site ) || $twitter_site === '' ) {
[34] Fix | Delete
return '';
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
return '@' . $twitter_site;
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
/**
[41] Fix | Delete
* Checks if the given id is actually an id or a url and if url, distills the id from it.
[42] Fix | Delete
*
[43] Fix | Delete
* Solves issues with filters returning urls and theme's/other plugins also adding a user meta
[44] Fix | Delete
* twitter field which expects url rather than an id (which is what we expect).
[45] Fix | Delete
*
[46] Fix | Delete
* @param string $id Twitter ID or url.
[47] Fix | Delete
*
[48] Fix | Delete
* @return string|bool Twitter ID or false if it failed to get a valid Twitter ID.
[49] Fix | Delete
*/
[50] Fix | Delete
private function get_twitter_id( $id ) {
[51] Fix | Delete
if ( \preg_match( '`([A-Za-z0-9_]{1,25})$`', $id, $match ) ) {
[52] Fix | Delete
return $match[1];
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
return false;
[56] Fix | Delete
}
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function