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/clone/wp-conte.../plugins/wordpres.../vendor/yoast/whip/src
File: Host.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WHIPv2;
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* Represents a host.
[5] Fix | Delete
*/
[6] Fix | Delete
class Host {
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Key to an environment variable which should be set to the name of the host.
[10] Fix | Delete
*
[11] Fix | Delete
* @var string
[12] Fix | Delete
*/
[13] Fix | Delete
const HOST_NAME_KEY = 'WHIP_NAME_OF_HOST';
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Filter name for the filter which allows for pointing to the WP hosting page instead of the Yoast version.
[17] Fix | Delete
*
[18] Fix | Delete
* @var string
[19] Fix | Delete
*/
[20] Fix | Delete
const HOSTING_PAGE_FILTER_KEY = 'whip_hosting_page_url_wordpress';
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Retrieves the name of the host if set.
[24] Fix | Delete
*
[25] Fix | Delete
* @return string The name of the host.
[26] Fix | Delete
*/
[27] Fix | Delete
public static function name() {
[28] Fix | Delete
$name = (string) \getenv( self::HOST_NAME_KEY );
[29] Fix | Delete
[30] Fix | Delete
return self::filterName( $name );
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* Filters the name if we are in a WordPress context.
[35] Fix | Delete
* In a non-WordPress content this function just returns the passed name.
[36] Fix | Delete
*
[37] Fix | Delete
* @param string $name The current name of the host.
[38] Fix | Delete
*
[39] Fix | Delete
* @return string The filtered name of the host.
[40] Fix | Delete
*/
[41] Fix | Delete
private static function filterName( $name ) {
[42] Fix | Delete
if ( \function_exists( 'apply_filters' ) ) {
[43] Fix | Delete
return (string) \apply_filters( \strtolower( self::HOST_NAME_KEY ), $name );
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
return $name;
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* Retrieves the message from the host if set.
[51] Fix | Delete
*
[52] Fix | Delete
* @param string $messageKey The key to use as the environment variable.
[53] Fix | Delete
*
[54] Fix | Delete
* @return string The message as set by the host.
[55] Fix | Delete
*/
[56] Fix | Delete
public static function message( $messageKey ) {
[57] Fix | Delete
$message = (string) \getenv( $messageKey );
[58] Fix | Delete
[59] Fix | Delete
return self::filterMessage( $messageKey, $message );
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* Filters the message if we are in a WordPress context.
[64] Fix | Delete
* In a non-WordPress content this function just returns the passed message.
[65] Fix | Delete
*
[66] Fix | Delete
* @param string $messageKey The key used for the environment variable.
[67] Fix | Delete
* @param string $message The current message from the host.
[68] Fix | Delete
*
[69] Fix | Delete
* @return string
[70] Fix | Delete
*/
[71] Fix | Delete
private static function filterMessage( $messageKey, $message ) {
[72] Fix | Delete
if ( \function_exists( 'apply_filters' ) ) {
[73] Fix | Delete
return (string) \apply_filters( \strtolower( $messageKey ), $message );
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
return $message;
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
/**
[80] Fix | Delete
* Returns the URL for the hosting page.
[81] Fix | Delete
*
[82] Fix | Delete
* @return string The URL to the hosting overview page.
[83] Fix | Delete
*/
[84] Fix | Delete
public static function hostingPageUrl() {
[85] Fix | Delete
$url = 'https://yoa.st/w3';
[86] Fix | Delete
[87] Fix | Delete
return self::filterHostingPageUrl( $url );
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* Filters the hosting page url if we are in a WordPress context.
[92] Fix | Delete
* In a non-WordPress context this function just returns a link to the Yoast hosting page.
[93] Fix | Delete
*
[94] Fix | Delete
* @param string $url The previous URL.
[95] Fix | Delete
*
[96] Fix | Delete
* @return string The new URL to the hosting overview page.
[97] Fix | Delete
*/
[98] Fix | Delete
private static function filterHostingPageUrl( $url ) {
[99] Fix | Delete
if ( \function_exists( 'apply_filters' ) && \apply_filters( self::HOSTING_PAGE_FILTER_KEY, false ) ) {
[100] Fix | Delete
return 'https://wordpress.org/hosting/';
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
return $url;
[104] Fix | Delete
}
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function