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: notice-presenter.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Presenters\Admin;
[2] Fix | Delete
[3] Fix | Delete
use WPSEO_Admin_Asset_Manager;
[4] Fix | Delete
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Represents the presenter class for Yoast-styled WordPress admin notices.
[8] Fix | Delete
*/
[9] Fix | Delete
class Notice_Presenter extends Abstract_Presenter {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* The title of the admin notice.
[13] Fix | Delete
*
[14] Fix | Delete
* @var string
[15] Fix | Delete
*/
[16] Fix | Delete
private $title;
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* The content of the admin notice.
[20] Fix | Delete
*
[21] Fix | Delete
* @var string
[22] Fix | Delete
*/
[23] Fix | Delete
private $content;
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* The filename of the image for the notice. Should be a file in the 'images' folder.
[27] Fix | Delete
*
[28] Fix | Delete
* @var string
[29] Fix | Delete
*/
[30] Fix | Delete
private $image_filename;
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* HTML string to be displayed after the main content, usually a button.
[34] Fix | Delete
*
[35] Fix | Delete
* @var string
[36] Fix | Delete
*/
[37] Fix | Delete
private $button;
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Whether the notice should be dismissible.
[41] Fix | Delete
*
[42] Fix | Delete
* @var bool
[43] Fix | Delete
*/
[44] Fix | Delete
private $is_dismissible;
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* The id for the div of the notice.
[48] Fix | Delete
*
[49] Fix | Delete
* @var string
[50] Fix | Delete
*/
[51] Fix | Delete
private $id;
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* An instance of the WPSEO_Admin_Asset_Manager class.
[55] Fix | Delete
*
[56] Fix | Delete
* @var WPSEO_Admin_Asset_Manager
[57] Fix | Delete
*/
[58] Fix | Delete
protected $asset_manager;
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Notice_Presenter constructor.
[62] Fix | Delete
*
[63] Fix | Delete
* @param string $title Title of the admin notice.
[64] Fix | Delete
* @param string $content Content of the admin notice.
[65] Fix | Delete
* @param string|null $image_filename Optional. The filename of the image of the admin notice,
[66] Fix | Delete
* should be inside the 'images' folder.
[67] Fix | Delete
* @param string|null $button Optional. An HTML string to be displayed after the main content,
[68] Fix | Delete
* usually a button.
[69] Fix | Delete
* @param bool $is_dismissible Optional. Whether the admin notice should be dismissible.
[70] Fix | Delete
* @param string $id Optional. The id of the notice.
[71] Fix | Delete
*/
[72] Fix | Delete
public function __construct( $title, $content, $image_filename = null, $button = null, $is_dismissible = false, $id = '' ) {
[73] Fix | Delete
$this->title = $title;
[74] Fix | Delete
$this->content = $content;
[75] Fix | Delete
$this->image_filename = $image_filename;
[76] Fix | Delete
$this->button = $button;
[77] Fix | Delete
$this->is_dismissible = $is_dismissible;
[78] Fix | Delete
$this->id = $id;
[79] Fix | Delete
[80] Fix | Delete
if ( ! $this->asset_manager ) {
[81] Fix | Delete
$this->asset_manager = new WPSEO_Admin_Asset_Manager();
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
$this->asset_manager->enqueue_style( 'notifications' );
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
/**
[88] Fix | Delete
* Presents the Notice.
[89] Fix | Delete
*
[90] Fix | Delete
* @return string The styled Notice.
[91] Fix | Delete
*/
[92] Fix | Delete
public function present() {
[93] Fix | Delete
$dismissible = ( $this->is_dismissible ) ? ' is-dismissible' : '';
[94] Fix | Delete
$id = ( $this->id ) ? ' id="' . $this->id . '"' : '';
[95] Fix | Delete
[96] Fix | Delete
// WordPress admin notice.
[97] Fix | Delete
$out = '<div' . $id . ' class="notice notice-yoast yoast' . $dismissible . '">';
[98] Fix | Delete
$out .= '<div class="notice-yoast__container">';
[99] Fix | Delete
[100] Fix | Delete
// Header.
[101] Fix | Delete
$out .= '<div>';
[102] Fix | Delete
$out .= '<div class="notice-yoast__header">';
[103] Fix | Delete
$out .= '<span class="yoast-icon"></span>';
[104] Fix | Delete
$out .= \sprintf(
[105] Fix | Delete
'<h2 class="notice-yoast__header-heading">%s</h2>',
[106] Fix | Delete
\esc_html( $this->title )
[107] Fix | Delete
);
[108] Fix | Delete
$out .= '</div>';
[109] Fix | Delete
$out .= '<p>' . $this->content . '</p>';
[110] Fix | Delete
if ( ! \is_null( $this->button ) ) {
[111] Fix | Delete
$out .= '<p>' . $this->button . '</p>';
[112] Fix | Delete
}
[113] Fix | Delete
$out .= '</div>';
[114] Fix | Delete
[115] Fix | Delete
if ( ! \is_null( $this->image_filename ) ) {
[116] Fix | Delete
$out .= '<img src="' . \esc_url( \plugin_dir_url( \WPSEO_FILE ) . 'images/' . $this->image_filename ) . '" alt="" height="60" width="75"/>';
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
$out .= '</div>';
[120] Fix | Delete
$out .= '</div>';
[121] Fix | Delete
[122] Fix | Delete
return $out;
[123] Fix | Delete
}
[124] Fix | Delete
}
[125] Fix | Delete
[126] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function