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.../public_h.../wp-conte.../plugins/wordpres.../src/presente.../admin
File: indexing-error-presenter.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Presenters\Admin;
[2] Fix | Delete
[3] Fix | Delete
use WPSEO_Addon_Manager;
[4] Fix | Delete
use Yoast\WP\SEO\Helpers\Product_Helper;
[5] Fix | Delete
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
[6] Fix | Delete
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* An error that should be shown when indexation has failed.
[10] Fix | Delete
*/
[11] Fix | Delete
class Indexing_Error_Presenter extends Abstract_Presenter {
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* The short link helper.
[15] Fix | Delete
*
[16] Fix | Delete
* @var Short_Link_Helper
[17] Fix | Delete
*/
[18] Fix | Delete
protected $short_link_helper;
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* The product helper
[22] Fix | Delete
*
[23] Fix | Delete
* @var Product_Helper
[24] Fix | Delete
*/
[25] Fix | Delete
protected $product_helper;
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* The addon manager.
[29] Fix | Delete
*
[30] Fix | Delete
* @var WPSEO_Addon_Manager
[31] Fix | Delete
*/
[32] Fix | Delete
protected $addon_manager;
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Indexing_Error_Presenter constructor.
[36] Fix | Delete
*
[37] Fix | Delete
* @param Short_Link_Helper $short_link_helper Represents the short link helper.
[38] Fix | Delete
* @param Product_Helper $product_helper The product helper.
[39] Fix | Delete
* @param WPSEO_Addon_Manager $addon_manager The addon manager.
[40] Fix | Delete
*/
[41] Fix | Delete
public function __construct(
[42] Fix | Delete
Short_Link_Helper $short_link_helper,
[43] Fix | Delete
Product_Helper $product_helper,
[44] Fix | Delete
WPSEO_Addon_Manager $addon_manager
[45] Fix | Delete
) {
[46] Fix | Delete
$this->short_link_helper = $short_link_helper;
[47] Fix | Delete
$this->product_helper = $product_helper;
[48] Fix | Delete
$this->addon_manager = $addon_manager;
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
/**
[52] Fix | Delete
* Generates the first paragraph of the error message to show when indexing failed.
[53] Fix | Delete
*
[54] Fix | Delete
* The contents of the paragraph varies based on whether WordPress SEO Premium has a valid, activated subscription or not.
[55] Fix | Delete
*
[56] Fix | Delete
* @param bool $is_premium Whether WordPress SEO Premium is currently active.
[57] Fix | Delete
* @param bool $has_valid_premium_subscription Whether WordPress SEO Premium currently has a valid subscription.
[58] Fix | Delete
*
[59] Fix | Delete
* @return string
[60] Fix | Delete
*/
[61] Fix | Delete
protected function generate_first_paragraph( $is_premium, $has_valid_premium_subscription ) {
[62] Fix | Delete
$message = \__(
[63] Fix | Delete
'Oops, something has gone wrong and we couldn\'t complete the optimization of your SEO data. Please click the button again to re-start the process. ',
[64] Fix | Delete
'wordpress-seo'
[65] Fix | Delete
);
[66] Fix | Delete
[67] Fix | Delete
if ( $is_premium ) {
[68] Fix | Delete
if ( $has_valid_premium_subscription ) {
[69] Fix | Delete
$message .= \__( 'If the problem persists, please contact support.', 'wordpress-seo' );
[70] Fix | Delete
}
[71] Fix | Delete
else {
[72] Fix | Delete
$message = \sprintf(
[73] Fix | Delete
/* translators: %1$s expands to an opening anchor tag for a link leading to the Premium installation page, %2$s expands to a closing anchor tag. */
[74] Fix | Delete
\__(
[75] Fix | Delete
'Oops, something has gone wrong and we couldn\'t complete the optimization of your SEO data. Please make sure to activate your subscription in MyYoast by completing %1$sthese steps%2$s.',
[76] Fix | Delete
'wordpress-seo'
[77] Fix | Delete
),
[78] Fix | Delete
'<a href="' . \esc_url( $this->short_link_helper->get( 'https://yoa.st/3wv' ) ) . '">',
[79] Fix | Delete
'</a>'
[80] Fix | Delete
);
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
return $message;
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
/**
[88] Fix | Delete
* Generates the second paragraph of the error message to show when indexing failed.
[89] Fix | Delete
*
[90] Fix | Delete
* The error message varies based on whether WordPress SEO Premium has a valid, activated subscription or not.
[91] Fix | Delete
*
[92] Fix | Delete
* @param bool $is_premium Whether WordPress SEO Premium is currently active.
[93] Fix | Delete
* @param bool $has_valid_premium_subscription Whether WordPress SEO Premium currently has a valid subscription.
[94] Fix | Delete
*
[95] Fix | Delete
* @return string The second paragraph of the error message.
[96] Fix | Delete
*/
[97] Fix | Delete
protected function generate_second_paragraph( $is_premium, $has_valid_premium_subscription ) {
[98] Fix | Delete
return \sprintf(
[99] Fix | Delete
/* translators: %1$s expands to an opening anchor tag for a link leading to the Premium installation page, %2$s expands to a closing anchor tag. */
[100] Fix | Delete
\__(
[101] Fix | Delete
'Below are the technical details for the error. See %1$sthis page%2$s for a more detailed explanation.',
[102] Fix | Delete
'wordpress-seo'
[103] Fix | Delete
),
[104] Fix | Delete
'<a href="' . \esc_url( $this->short_link_helper->get( 'https://yoa.st/4f3' ) ) . '">',
[105] Fix | Delete
'</a>'
[106] Fix | Delete
);
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
/**
[110] Fix | Delete
* Presents the error message to show if SEO optimization failed.
[111] Fix | Delete
*
[112] Fix | Delete
* The error message varies based on whether WordPress SEO Premium has a valid, activated subscription or not.
[113] Fix | Delete
*
[114] Fix | Delete
* @return string The error message to show.
[115] Fix | Delete
*/
[116] Fix | Delete
public function present() {
[117] Fix | Delete
$is_premium = $this->product_helper->is_premium();
[118] Fix | Delete
$has_valid_premium_subscription = $this->addon_manager->has_valid_subscription( WPSEO_Addon_Manager::PREMIUM_SLUG );
[119] Fix | Delete
[120] Fix | Delete
$output = '<p>' . $this->generate_first_paragraph( $is_premium, $has_valid_premium_subscription ) . '</p>';
[121] Fix | Delete
$output .= '<p>' . $this->generate_second_paragraph( $is_premium, $has_valid_premium_subscription ) . '</p>';
[122] Fix | Delete
[123] Fix | Delete
return $output;
[124] Fix | Delete
}
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function