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/integrat.../admin
File: first-time-configuration-notice-integration.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Integrations\Admin;
[2] Fix | Delete
[3] Fix | Delete
use WPSEO_Admin_Asset_Manager;
[4] Fix | Delete
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
[5] Fix | Delete
use Yoast\WP\SEO\Helpers\First_Time_Configuration_Notice_Helper;
[6] Fix | Delete
use Yoast\WP\SEO\Helpers\Options_Helper;
[7] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[8] Fix | Delete
use Yoast\WP\SEO\Presenters\Admin\Notice_Presenter;
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* First_Time_Configuration_Notice_Integration class
[12] Fix | Delete
*/
[13] Fix | Delete
class First_Time_Configuration_Notice_Integration implements Integration_Interface {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* The options' helper.
[17] Fix | Delete
*
[18] Fix | Delete
* @var Options_Helper
[19] Fix | Delete
*/
[20] Fix | Delete
private $options_helper;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* The admin asset manager.
[24] Fix | Delete
*
[25] Fix | Delete
* @var WPSEO_Admin_Asset_Manager
[26] Fix | Delete
*/
[27] Fix | Delete
private $admin_asset_manager;
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* The first time configuration notice helper.
[31] Fix | Delete
*
[32] Fix | Delete
* @var First_Time_Configuration_Notice_Helper
[33] Fix | Delete
*/
[34] Fix | Delete
private $first_time_configuration_notice_helper;
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* {@inheritDoc}
[38] Fix | Delete
*/
[39] Fix | Delete
public static function get_conditionals() {
[40] Fix | Delete
return [ Admin_Conditional::class ];
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* First_Time_Configuration_Notice_Integration constructor.
[45] Fix | Delete
*
[46] Fix | Delete
* @param Options_Helper $options_helper The options helper.
[47] Fix | Delete
* @param First_Time_Configuration_Notice_Helper $first_time_configuration_notice_helper The first time configuration notice helper.
[48] Fix | Delete
* @param WPSEO_Admin_Asset_Manager $admin_asset_manager The admin asset manager.
[49] Fix | Delete
*/
[50] Fix | Delete
public function __construct(
[51] Fix | Delete
Options_Helper $options_helper,
[52] Fix | Delete
First_Time_Configuration_Notice_Helper $first_time_configuration_notice_helper,
[53] Fix | Delete
WPSEO_Admin_Asset_Manager $admin_asset_manager
[54] Fix | Delete
) {
[55] Fix | Delete
$this->options_helper = $options_helper;
[56] Fix | Delete
$this->admin_asset_manager = $admin_asset_manager;
[57] Fix | Delete
$this->first_time_configuration_notice_helper = $first_time_configuration_notice_helper;
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* {@inheritDoc}
[62] Fix | Delete
*/
[63] Fix | Delete
public function register_hooks() {
[64] Fix | Delete
\add_action( 'wp_ajax_dismiss_first_time_configuration_notice', [ $this, 'dismiss_first_time_configuration_notice' ] );
[65] Fix | Delete
\add_action( 'admin_notices', [ $this, 'first_time_configuration_notice' ] );
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* Dismisses the First-time configuration notice.
[70] Fix | Delete
*
[71] Fix | Delete
* @return bool
[72] Fix | Delete
*/
[73] Fix | Delete
public function dismiss_first_time_configuration_notice() {
[74] Fix | Delete
// Check for nonce.
[75] Fix | Delete
if ( ! \check_ajax_referer( 'wpseo-dismiss-first-time-configuration-notice', 'nonce', false ) ) {
[76] Fix | Delete
return false;
[77] Fix | Delete
}
[78] Fix | Delete
return $this->options_helper->set( 'dismiss_configuration_workout_notice', true );
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
/**
[82] Fix | Delete
* Determines whether and where the "First-time SEO Configuration" admin notice should be displayed.
[83] Fix | Delete
*
[84] Fix | Delete
* @return bool Whether the "First-time SEO Configuration" admin notice should be displayed.
[85] Fix | Delete
*/
[86] Fix | Delete
public function should_display_first_time_configuration_notice() {
[87] Fix | Delete
return $this->first_time_configuration_notice_helper->should_display_first_time_configuration_notice();
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* Displays an admin notice when the first-time configuration has not been finished yet.
[92] Fix | Delete
*
[93] Fix | Delete
* @return void
[94] Fix | Delete
*/
[95] Fix | Delete
public function first_time_configuration_notice() {
[96] Fix | Delete
if ( ! $this->should_display_first_time_configuration_notice() ) {
[97] Fix | Delete
return;
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
$this->admin_asset_manager->enqueue_style( 'monorepo' );
[101] Fix | Delete
[102] Fix | Delete
$title = $this->first_time_configuration_notice_helper->get_first_time_configuration_title();
[103] Fix | Delete
$link_url = \esc_url( \self_admin_url( 'admin.php?page=wpseo_dashboard#top#first-time-configuration' ) );
[104] Fix | Delete
[105] Fix | Delete
if ( ! $this->first_time_configuration_notice_helper->should_show_alternate_message() ) {
[106] Fix | Delete
$content = \sprintf(
[107] Fix | Delete
/* translators: 1: Link start tag to the first-time configuration, 2: Yoast SEO, 3: Link closing tag. */
[108] Fix | Delete
\__( 'Get started quickly with the %1$s%2$s First-time configuration%3$s and configure Yoast SEO with the optimal SEO settings for your site!', 'wordpress-seo' ),
[109] Fix | Delete
'<a href="' . $link_url . '">',
[110] Fix | Delete
'Yoast SEO',
[111] Fix | Delete
'</a>'
[112] Fix | Delete
);
[113] Fix | Delete
}
[114] Fix | Delete
else {
[115] Fix | Delete
$content = \sprintf(
[116] Fix | Delete
/* translators: 1: Link start tag to the first-time configuration, 2: Link closing tag. */
[117] Fix | Delete
\__( 'We noticed that you haven\'t fully configured Yoast SEO yet. Optimize your SEO settings even further by using our improved %1$s First-time configuration%2$s.', 'wordpress-seo' ),
[118] Fix | Delete
'<a href="' . $link_url . '">',
[119] Fix | Delete
'</a>'
[120] Fix | Delete
);
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
$notice = new Notice_Presenter(
[124] Fix | Delete
$title,
[125] Fix | Delete
$content,
[126] Fix | Delete
'mirrored_fit_bubble_woman_1_optim.svg',
[127] Fix | Delete
null,
[128] Fix | Delete
true,
[129] Fix | Delete
'yoast-first-time-configuration-notice'
[130] Fix | Delete
);
[131] Fix | Delete
[132] Fix | Delete
//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output from present() is considered safe.
[133] Fix | Delete
echo $notice->present();
[134] Fix | Delete
[135] Fix | Delete
// Enable permanently dismissing the notice.
[136] Fix | Delete
echo '<script>
[137] Fix | Delete
jQuery( document ).ready( function() {
[138] Fix | Delete
jQuery( "body" ).on( "click", "#yoast-first-time-configuration-notice .notice-dismiss", function() {
[139] Fix | Delete
const data = {
[140] Fix | Delete
"action": "dismiss_first_time_configuration_notice",
[141] Fix | Delete
"nonce": "' . \esc_js( \wp_create_nonce( 'wpseo-dismiss-first-time-configuration-notice' ) ) . '"
[142] Fix | Delete
};
[143] Fix | Delete
jQuery.post( ajaxurl, data, function( response ) {
[144] Fix | Delete
jQuery( this ).parent( "#yoast-first-time-configuration-notice" ).hide();
[145] Fix | Delete
});
[146] Fix | Delete
} );
[147] Fix | Delete
} );
[148] Fix | Delete
</script>';
[149] Fix | Delete
}
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function