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/presente.../admin
File: indexing-notification-presenter.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Presenters\Admin;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Config\Indexing_Reasons;
[4] Fix | Delete
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
[5] Fix | Delete
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Class Indexing_Notification_Presenter.
[9] Fix | Delete
*
[10] Fix | Delete
* @package Yoast\WP\SEO\Presenters\Admin
[11] Fix | Delete
*/
[12] Fix | Delete
class Indexing_Notification_Presenter extends Abstract_Presenter {
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* The total number of unindexed objects.
[16] Fix | Delete
*
[17] Fix | Delete
* @var int
[18] Fix | Delete
*/
[19] Fix | Delete
protected $total_unindexed;
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* The message to show in the notification.
[23] Fix | Delete
*
[24] Fix | Delete
* @var string
[25] Fix | Delete
*/
[26] Fix | Delete
protected $reason;
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* The short link helper.
[30] Fix | Delete
*
[31] Fix | Delete
* @var Short_Link_Helper
[32] Fix | Delete
*/
[33] Fix | Delete
protected $short_link_helper;
[34] Fix | Delete
[35] Fix | Delete
/**
[36] Fix | Delete
* Indexing_Notification_Presenter constructor.
[37] Fix | Delete
*
[38] Fix | Delete
* @param Short_Link_Helper $short_link_helper The short link helper.
[39] Fix | Delete
* @param int $total_unindexed Total number of unindexed objects.
[40] Fix | Delete
* @param string $reason The reason to show in the notification.
[41] Fix | Delete
*/
[42] Fix | Delete
public function __construct( $short_link_helper, $total_unindexed, $reason ) {
[43] Fix | Delete
$this->short_link_helper = $short_link_helper;
[44] Fix | Delete
$this->total_unindexed = $total_unindexed;
[45] Fix | Delete
$this->reason = $reason;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Returns the notification as an HTML string.
[50] Fix | Delete
*
[51] Fix | Delete
* @return string The HTML string representation of the notification.
[52] Fix | Delete
*/
[53] Fix | Delete
public function present() {
[54] Fix | Delete
$notification_text = '<p>' . $this->get_message( $this->reason ) . '</p>';
[55] Fix | Delete
$notification_text .= '<p>' . $this->get_time_estimate( $this->total_unindexed ) . '</p>';
[56] Fix | Delete
$notification_text .= '<a class="button" href="' . \get_admin_url( null, 'admin.php?page=wpseo_tools&start-indexation=true' ) . '">';
[57] Fix | Delete
$notification_text .= \esc_html__( 'Start SEO data optimization', 'wordpress-seo' );
[58] Fix | Delete
$notification_text .= '</a>';
[59] Fix | Delete
[60] Fix | Delete
return $notification_text;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
/**
[64] Fix | Delete
* Determines the message to show in the indexing notification.
[65] Fix | Delete
*
[66] Fix | Delete
* @param string $reason The reason identifier.
[67] Fix | Delete
*
[68] Fix | Delete
* @return string The message to show in the notification.
[69] Fix | Delete
*/
[70] Fix | Delete
protected function get_message( $reason ) {
[71] Fix | Delete
switch ( $reason ) {
[72] Fix | Delete
case Indexing_Reasons::REASON_PERMALINK_SETTINGS:
[73] Fix | Delete
$text = \esc_html__( 'Because of a change in your permalink structure, some of your SEO data needs to be reprocessed.', 'wordpress-seo' );
[74] Fix | Delete
break;
[75] Fix | Delete
case Indexing_Reasons::REASON_HOME_URL_OPTION:
[76] Fix | Delete
$text = \esc_html__( 'Because of a change in your home URL setting, some of your SEO data needs to be reprocessed.', 'wordpress-seo' );
[77] Fix | Delete
break;
[78] Fix | Delete
case Indexing_Reasons::REASON_CATEGORY_BASE_PREFIX:
[79] Fix | Delete
$text = \esc_html__( 'Because of a change in your category base setting, some of your SEO data needs to be reprocessed.', 'wordpress-seo' );
[80] Fix | Delete
break;
[81] Fix | Delete
case Indexing_Reasons::REASON_TAG_BASE_PREFIX:
[82] Fix | Delete
$text = \esc_html__( 'Because of a change in your tag base setting, some of your SEO data needs to be reprocessed.', 'wordpress-seo' );
[83] Fix | Delete
break;
[84] Fix | Delete
case Indexing_Reasons::REASON_POST_TYPE_MADE_PUBLIC:
[85] Fix | Delete
$text = \esc_html__( 'We need to re-analyze some of your SEO data because of a change in the visibility of your post types. Please help us do that by running the SEO data optimization. ', 'wordpress-seo' );
[86] Fix | Delete
break;
[87] Fix | Delete
case Indexing_Reasons::REASON_TAXONOMY_MADE_PUBLIC:
[88] Fix | Delete
$text = \esc_html__( 'We need to re-analyze some of your SEO data because of a change in the visibility of your taxonomies. Please help us do that by running the SEO data optimization. ', 'wordpress-seo' );
[89] Fix | Delete
break;
[90] Fix | Delete
case Indexing_Reasons::REASON_ATTACHMENTS_MADE_ENABLED:
[91] Fix | Delete
$text = \esc_html__( 'It looks like you\'ve enabled media pages. We recommend that you help us to re-analyze your site by running the SEO data optimization. ', 'wordpress-seo' );
[92] Fix | Delete
break;
[93] Fix | Delete
default:
[94] Fix | Delete
$text = \esc_html__( 'You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored. ', 'wordpress-seo' );
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
/**
[98] Fix | Delete
* Filter: 'wpseo_indexables_indexation_alert' - Allow developers to filter the reason of the indexation
[99] Fix | Delete
*
[100] Fix | Delete
* @param string $text The text to show as reason.
[101] Fix | Delete
* @param string $reason The reason value.
[102] Fix | Delete
*/
[103] Fix | Delete
return (string) \apply_filters( 'wpseo_indexables_indexation_alert', $text, $reason );
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
/**
[107] Fix | Delete
* Creates a time estimate based on the total number on unindexed objects.
[108] Fix | Delete
*
[109] Fix | Delete
* @param int $total_unindexed The total number of unindexed objects.
[110] Fix | Delete
*
[111] Fix | Delete
* @return string The time estimate as a HTML string.
[112] Fix | Delete
*/
[113] Fix | Delete
protected function get_time_estimate( $total_unindexed ) {
[114] Fix | Delete
if ( $total_unindexed < 400 ) {
[115] Fix | Delete
return \esc_html__( 'We estimate this will take less than a minute.', 'wordpress-seo' );
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
if ( $total_unindexed < 2500 ) {
[119] Fix | Delete
return \esc_html__( 'We estimate this will take a couple of minutes.', 'wordpress-seo' );
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
$estimate = \esc_html__( 'We estimate this could take a long time, due to the size of your site. As an alternative to waiting, you could:', 'wordpress-seo' );
[123] Fix | Delete
$estimate .= '<ul class="ul-disc">';
[124] Fix | Delete
$estimate .= '<li>';
[125] Fix | Delete
$estimate .= \sprintf(
[126] Fix | Delete
/* translators: 1: Expands to Yoast SEO */
[127] Fix | Delete
\esc_html__( 'Wait for a week or so, until %1$s automatically processes most of your content in the background.', 'wordpress-seo' ),
[128] Fix | Delete
'Yoast SEO'
[129] Fix | Delete
);
[130] Fix | Delete
$estimate .= '</li>';
[131] Fix | Delete
$estimate .= '<li>';
[132] Fix | Delete
$estimate .= \sprintf(
[133] Fix | Delete
/* translators: 1: Link to article about indexation command, 2: Anchor closing tag, 3: Link to WP CLI. */
[134] Fix | Delete
\esc_html__( '%1$sRun the indexation process on your server%2$s using %3$sWP CLI%2$s.', 'wordpress-seo' ),
[135] Fix | Delete
'<a href="' . \esc_url( $this->short_link_helper->get( 'https://yoa.st/3-w' ) ) . '" target="_blank">',
[136] Fix | Delete
'</a>',
[137] Fix | Delete
'<a href="https://wp-cli.org/" target="_blank">'
[138] Fix | Delete
);
[139] Fix | Delete
[140] Fix | Delete
$estimate .= '</li>';
[141] Fix | Delete
$estimate .= '</ul>';
[142] Fix | Delete
[143] Fix | Delete
return $estimate;
[144] Fix | Delete
}
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function