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/integrat.../third-pa...
File: wpml-wpseo-notification.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Integrations\Third_Party;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Conditionals\Third_Party\WPML_Conditional;
[4] Fix | Delete
use Yoast\WP\SEO\Conditionals\Third_Party\WPML_WPSEO_Conditional;
[5] Fix | Delete
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
[6] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[7] Fix | Delete
use Yoast_Notification;
[8] Fix | Delete
use Yoast_Notification_Center;
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Adds a notification to the dashboard if the WPML plugin is installed,
[12] Fix | Delete
* but the Yoast SEO Multilingual plugin (a glue plugin to make Yoast SEO and WPML work nicely together)
[13] Fix | Delete
* is not.
[14] Fix | Delete
*/
[15] Fix | Delete
class WPML_WPSEO_Notification implements Integration_Interface {
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* The notification ID.
[19] Fix | Delete
*
[20] Fix | Delete
* @internal
[21] Fix | Delete
*/
[22] Fix | Delete
public const NOTIFICATION_ID = 'wpml-wpseo-not-installed';
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* The short link helper.
[26] Fix | Delete
*
[27] Fix | Delete
* @var Short_Link_Helper
[28] Fix | Delete
*/
[29] Fix | Delete
protected $short_link_helper;
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* The notification center.
[33] Fix | Delete
*
[34] Fix | Delete
* @var Yoast_Notification_Center
[35] Fix | Delete
*/
[36] Fix | Delete
protected $notification_center;
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* The WPML WPSEO conditional.
[40] Fix | Delete
*
[41] Fix | Delete
* @var WPML_WPSEO_Conditional
[42] Fix | Delete
*/
[43] Fix | Delete
protected $wpml_wpseo_conditional;
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* WPML WPSEO notification constructor.
[47] Fix | Delete
*
[48] Fix | Delete
* @param Short_Link_Helper $short_link_helper The short link helper.
[49] Fix | Delete
* @param Yoast_Notification_Center $notification_center The notification center.
[50] Fix | Delete
* @param WPML_WPSEO_Conditional $wpml_wpseo_conditional The WPML WPSEO conditional.
[51] Fix | Delete
*/
[52] Fix | Delete
public function __construct(
[53] Fix | Delete
Short_Link_Helper $short_link_helper,
[54] Fix | Delete
Yoast_Notification_Center $notification_center,
[55] Fix | Delete
WPML_WPSEO_Conditional $wpml_wpseo_conditional
[56] Fix | Delete
) {
[57] Fix | Delete
$this->short_link_helper = $short_link_helper;
[58] Fix | Delete
$this->notification_center = $notification_center;
[59] Fix | Delete
$this->wpml_wpseo_conditional = $wpml_wpseo_conditional;
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* Initializes the integration.
[64] Fix | Delete
*
[65] Fix | Delete
* @return void
[66] Fix | Delete
*/
[67] Fix | Delete
public function register_hooks() {
[68] Fix | Delete
\add_action( 'admin_notices', [ $this, 'notify_not_installed' ] );
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Returns the conditionals based in which this loadable should be active.
[73] Fix | Delete
*
[74] Fix | Delete
* This integration should only be active when WPML is installed and activated.
[75] Fix | Delete
*
[76] Fix | Delete
* @return array The conditionals.
[77] Fix | Delete
*/
[78] Fix | Delete
public static function get_conditionals() {
[79] Fix | Delete
return [ WPML_Conditional::class ];
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* Notify the user that the Yoast SEO Multilingual plugin is not installed
[84] Fix | Delete
* (when the WPML plugin is installed).
[85] Fix | Delete
*
[86] Fix | Delete
* Remove the notification again when it is installed.
[87] Fix | Delete
*
[88] Fix | Delete
* @return void
[89] Fix | Delete
*/
[90] Fix | Delete
public function notify_not_installed() {
[91] Fix | Delete
if ( ! $this->wpml_wpseo_conditional->is_met() ) {
[92] Fix | Delete
$this->notification_center->add_notification( $this->get_notification() );
[93] Fix | Delete
return;
[94] Fix | Delete
}
[95] Fix | Delete
$this->notification_center->remove_notification_by_id( self::NOTIFICATION_ID );
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
/**
[99] Fix | Delete
* Generates the notification to show to the user when WPML is installed,
[100] Fix | Delete
* but the Yoast SEO Multilingual plugin is not.
[101] Fix | Delete
*
[102] Fix | Delete
* @return Yoast_Notification The notification.
[103] Fix | Delete
*/
[104] Fix | Delete
protected function get_notification() {
[105] Fix | Delete
return new Yoast_Notification(
[106] Fix | Delete
\sprintf(
[107] Fix | Delete
/* translators: %1$s expands to an opening anchor tag, %2$s expands to an closing anchor tag. */
[108] Fix | Delete
\__( 'We notice that you have installed WPML. To make sure your canonical URLs are set correctly, %1$sinstall and activate the WPML SEO add-on%2$s as well!', 'wordpress-seo' ),
[109] Fix | Delete
'<a href="' . \esc_url( $this->short_link_helper->get( 'https://yoa.st/wpml-yoast-seo' ) ) . '" target="_blank">',
[110] Fix | Delete
'</a>'
[111] Fix | Delete
),
[112] Fix | Delete
[
[113] Fix | Delete
'id' => self::NOTIFICATION_ID,
[114] Fix | Delete
'type' => Yoast_Notification::WARNING,
[115] Fix | Delete
]
[116] Fix | Delete
);
[117] Fix | Delete
}
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function