: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
protected $view_file_extension = '.php';
public static function create($view, $data = array()) {
return new self($view, $data);
public function __construct($view, $data = array()) {
$this->view_path = WORDFENCE_PATH . 'views';
* @throws wfViewNotFoundException
public function render() {
$view = preg_replace('/\.{2,}/', '.', $this->view);
$view_path = $this->view_path . '/' . $view . $this->view_file_extension;
if (!file_exists($view_path)) {
throw new wfViewNotFoundException(sprintf(/* translators: File path. */ __('The view %s does not exist or is not readable.', 'wordfence'), $view_path));
extract($this->data, EXTR_SKIP);
/** @noinspection PhpIncludeInspection */
public function __toString() {
} catch (wfViewNotFoundException $e) {
return defined('WP_DEBUG') && WP_DEBUG ? esc_html($e->getMessage()) : esc_html__('The view could not be loaded.', 'wordfence');
public function addData($data) {
$this->data = array_merge($data, $this->data);
public function getData() {
public function setData($data) {
public function getView() {
public function setView($view) {
public function __wakeup() {
$this->view_path = WORDFENCE_PATH . 'views';
$this->view_file_extension = '.php';
class wfViewNotFoundException extends Exception {