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.../src/helpers
File: wincher-helper.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Helpers;
[2] Fix | Delete
[3] Fix | Delete
use WPSEO_Shortlinker;
[4] Fix | Delete
use Yoast\WP\SEO\Conditionals\Non_Multisite_Conditional;
[5] Fix | Delete
use Yoast\WP\SEO\Config\Wincher_Client;
[6] Fix | Delete
use Yoast\WP\SEO\Exceptions\OAuth\Authentication_Failed_Exception;
[7] Fix | Delete
use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Property_Exception;
[8] Fix | Delete
use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Token_Exception;
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* A helper object for Wincher matters.
[12] Fix | Delete
*/
[13] Fix | Delete
class Wincher_Helper {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Holds the Options Page helper instance.
[17] Fix | Delete
*
[18] Fix | Delete
* @var Options_Helper
[19] Fix | Delete
*/
[20] Fix | Delete
protected $options;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Options_Helper constructor.
[24] Fix | Delete
*
[25] Fix | Delete
* @param Options_Helper $options The options helper.
[26] Fix | Delete
*/
[27] Fix | Delete
public function __construct( Options_Helper $options ) {
[28] Fix | Delete
$this->options = $options;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Checks if the integration should be active for the current user.
[33] Fix | Delete
*
[34] Fix | Delete
* @return bool Whether the integration is active.
[35] Fix | Delete
*/
[36] Fix | Delete
public function is_active() {
[37] Fix | Delete
$conditional = new Non_Multisite_Conditional();
[38] Fix | Delete
[39] Fix | Delete
if ( ! $conditional->is_met() ) {
[40] Fix | Delete
return false;
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
if ( ! \current_user_can( 'publish_posts' ) && ! \current_user_can( 'publish_pages' ) ) {
[44] Fix | Delete
return false;
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
return (bool) $this->options->get( 'wincher_integration_active', true );
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* Checks if the user is logged in to Wincher.
[52] Fix | Delete
*
[53] Fix | Delete
* @return bool The Wincher login status.
[54] Fix | Delete
*/
[55] Fix | Delete
public function login_status() {
[56] Fix | Delete
try {
[57] Fix | Delete
$wincher = \YoastSEO()->classes->get( Wincher_Client::class );
[58] Fix | Delete
} catch ( Empty_Property_Exception $e ) {
[59] Fix | Delete
// Return false if token is malformed (empty property).
[60] Fix | Delete
return false;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
// Get token (and refresh it if it's expired).
[64] Fix | Delete
try {
[65] Fix | Delete
$wincher->get_tokens();
[66] Fix | Delete
} catch ( Authentication_Failed_Exception $e ) {
[67] Fix | Delete
return false;
[68] Fix | Delete
} catch ( Empty_Token_Exception $e ) {
[69] Fix | Delete
return false;
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
return $wincher->has_valid_tokens();
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
/**
[76] Fix | Delete
* Returns the Wincher links that can be used to localize the global admin
[77] Fix | Delete
* script. Mainly exists to avoid duplicating these links in multiple places
[78] Fix | Delete
* around the code base.
[79] Fix | Delete
*
[80] Fix | Delete
* @return string[]
[81] Fix | Delete
*/
[82] Fix | Delete
public function get_admin_global_links() {
[83] Fix | Delete
return [
[84] Fix | Delete
'links.wincher.login' => 'https://app.wincher.com/login?utm_medium=plugin&utm_source=yoast&referer=yoast&partner=yoast',
[85] Fix | Delete
'links.wincher.about' => WPSEO_Shortlinker::get( 'https://yoa.st/dashboard-about-wincher' ),
[86] Fix | Delete
'links.wincher.pricing' => WPSEO_Shortlinker::get( 'https://yoa.st/wincher-popup-pricing' ),
[87] Fix | Delete
'links.wincher.website' => WPSEO_Shortlinker::get( 'https://yoa.st/wincher-popup' ),
[88] Fix | Delete
'links.wincher.upgrade' => WPSEO_Shortlinker::get( 'https://yoa.st/wincher-upgrade' ),
[89] Fix | Delete
];
[90] Fix | Delete
}
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function