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.../admin/menu
File: class-replacevar-editor.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WPSEO plugin file.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WPSEO\Admin\Menu
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders a replacement variable editor.
[8] Fix | Delete
*/
[9] Fix | Delete
class WPSEO_Replacevar_Editor {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Yoast Forms instance.
[13] Fix | Delete
*
[14] Fix | Delete
* @var Yoast_Form
[15] Fix | Delete
*/
[16] Fix | Delete
private $yform;
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* The arguments required for the div to render.
[20] Fix | Delete
*
[21] Fix | Delete
* @var array {
[22] Fix | Delete
* @type string $title The title field id.
[23] Fix | Delete
* @type string $description The description field id.
[24] Fix | Delete
* @type string $page_type_recommended The page type for the context of the recommended replace vars.
[25] Fix | Delete
* @type string $page_type_specific The page type for the context of the editor specific replace vars.
[26] Fix | Delete
* @type bool $paper_style Optional. Whether the editor has paper style.
[27] Fix | Delete
* @type string $label_title Optional. The label to use for the title field.
[28] Fix | Delete
* @type string $label_description Optional. The label to use for the description field.
[29] Fix | Delete
* @type string $description_placeholder Optional. The placeholder text to use for the description field.
[30] Fix | Delete
* @type bool $has_new_badge Optional. Whether to show the "New" badge.
[31] Fix | Delete
* @type bool $has_premium_badge Optional. Whether to show the "Premium" badge.
[32] Fix | Delete
* }
[33] Fix | Delete
*/
[34] Fix | Delete
private $arguments;
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* Constructs the object.
[38] Fix | Delete
*
[39] Fix | Delete
* @param Yoast_Form $yform Yoast forms.
[40] Fix | Delete
* @param array $arguments {
[41] Fix | Delete
* The arguments that can be given.
[42] Fix | Delete
*
[43] Fix | Delete
* @type string $title The title field id.
[44] Fix | Delete
* @type string $description The description field id.
[45] Fix | Delete
* @type string $page_type_recommended The page type for the context of the recommended replace vars.
[46] Fix | Delete
* @type string $page_type_specific The page type for the context of the editor specific replace vars.
[47] Fix | Delete
* @type bool $paper_style Optional. Whether the editor has paper style.
[48] Fix | Delete
* @type string $label_title Optional. The label to use for the title field.
[49] Fix | Delete
* @type string $label_description Optional. The label to use for the description field.
[50] Fix | Delete
* @type string $description_placeholder Optional. The placeholder text to use for the description field.
[51] Fix | Delete
* @type bool $has_new_badge Optional. Whether to show the "New" badge.
[52] Fix | Delete
* @type bool $has_premium_badge Optional. Whether to show the "Premium" badge.
[53] Fix | Delete
* }
[54] Fix | Delete
*/
[55] Fix | Delete
public function __construct( Yoast_Form $yform, $arguments ) {
[56] Fix | Delete
$arguments = wp_parse_args(
[57] Fix | Delete
$arguments,
[58] Fix | Delete
[
[59] Fix | Delete
'paper_style' => true,
[60] Fix | Delete
'label_title' => '',
[61] Fix | Delete
'label_description' => '',
[62] Fix | Delete
'description_placeholder' => '',
[63] Fix | Delete
'has_new_badge' => false,
[64] Fix | Delete
'is_disabled' => false,
[65] Fix | Delete
'has_premium_badge' => false,
[66] Fix | Delete
]
[67] Fix | Delete
);
[68] Fix | Delete
[69] Fix | Delete
$this->validate_arguments( $arguments );
[70] Fix | Delete
[71] Fix | Delete
$this->yform = $yform;
[72] Fix | Delete
$this->arguments = [
[73] Fix | Delete
'title' => (string) $arguments['title'],
[74] Fix | Delete
'description' => (string) $arguments['description'],
[75] Fix | Delete
'page_type_recommended' => (string) $arguments['page_type_recommended'],
[76] Fix | Delete
'page_type_specific' => (string) $arguments['page_type_specific'],
[77] Fix | Delete
'paper_style' => (bool) $arguments['paper_style'],
[78] Fix | Delete
'label_title' => (string) $arguments['label_title'],
[79] Fix | Delete
'label_description' => (string) $arguments['label_description'],
[80] Fix | Delete
'description_placeholder' => (string) $arguments['description_placeholder'],
[81] Fix | Delete
'has_new_badge' => (bool) $arguments['has_new_badge'],
[82] Fix | Delete
'is_disabled' => (bool) $arguments['is_disabled'],
[83] Fix | Delete
'has_premium_badge' => (bool) $arguments['has_premium_badge'],
[84] Fix | Delete
];
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
/**
[88] Fix | Delete
* Renders a div for the react application to mount to, and hidden inputs where
[89] Fix | Delete
* the app should store it's value so they will be properly saved when the form
[90] Fix | Delete
* is submitted.
[91] Fix | Delete
*
[92] Fix | Delete
* @return void
[93] Fix | Delete
*/
[94] Fix | Delete
public function render() {
[95] Fix | Delete
$this->yform->hidden( $this->arguments['title'], $this->arguments['title'] );
[96] Fix | Delete
$this->yform->hidden( $this->arguments['description'], $this->arguments['description'] );
[97] Fix | Delete
[98] Fix | Delete
printf(
[99] Fix | Delete
'<div
[100] Fix | Delete
data-react-replacevar-editor
[101] Fix | Delete
data-react-replacevar-title-field-id="%1$s"
[102] Fix | Delete
data-react-replacevar-metadesc-field-id="%2$s"
[103] Fix | Delete
data-react-replacevar-page-type-recommended="%3$s"
[104] Fix | Delete
data-react-replacevar-page-type-specific="%4$s"
[105] Fix | Delete
data-react-replacevar-paper-style="%5$s"
[106] Fix | Delete
data-react-replacevar-label-title="%6$s"
[107] Fix | Delete
data-react-replacevar-label-description="%7$s"
[108] Fix | Delete
data-react-replacevar-description-placeholder="%8$s"
[109] Fix | Delete
data-react-replacevar-has-new-badge="%9$s"
[110] Fix | Delete
data-react-replacevar-is-disabled="%10$s"
[111] Fix | Delete
data-react-replacevar-has-premium-badge="%11$s"
[112] Fix | Delete
></div>',
[113] Fix | Delete
esc_attr( $this->arguments['title'] ),
[114] Fix | Delete
esc_attr( $this->arguments['description'] ),
[115] Fix | Delete
esc_attr( $this->arguments['page_type_recommended'] ),
[116] Fix | Delete
esc_attr( $this->arguments['page_type_specific'] ),
[117] Fix | Delete
esc_attr( $this->arguments['paper_style'] ),
[118] Fix | Delete
esc_attr( $this->arguments['label_title'] ),
[119] Fix | Delete
esc_attr( $this->arguments['label_description'] ),
[120] Fix | Delete
esc_attr( $this->arguments['description_placeholder'] ),
[121] Fix | Delete
esc_attr( $this->arguments['has_new_badge'] ),
[122] Fix | Delete
esc_attr( $this->arguments['is_disabled'] ),
[123] Fix | Delete
esc_attr( $this->arguments['has_premium_badge'] )
[124] Fix | Delete
);
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
/**
[128] Fix | Delete
* Validates the replacement variable editor arguments.
[129] Fix | Delete
*
[130] Fix | Delete
* @param array $arguments The arguments to validate.
[131] Fix | Delete
*
[132] Fix | Delete
* @throws InvalidArgumentException Thrown when not all required arguments are present.
[133] Fix | Delete
*
[134] Fix | Delete
* @return void
[135] Fix | Delete
*/
[136] Fix | Delete
protected function validate_arguments( array $arguments ) {
[137] Fix | Delete
$required_arguments = [
[138] Fix | Delete
'title',
[139] Fix | Delete
'description',
[140] Fix | Delete
'page_type_recommended',
[141] Fix | Delete
'page_type_specific',
[142] Fix | Delete
'paper_style',
[143] Fix | Delete
];
[144] Fix | Delete
[145] Fix | Delete
foreach ( $required_arguments as $field_name ) {
[146] Fix | Delete
if ( ! array_key_exists( $field_name, $arguments ) ) {
[147] Fix | Delete
throw new InvalidArgumentException(
[148] Fix | Delete
sprintf(
[149] Fix | Delete
/* translators: %1$s expands to the missing field name. */
[150] Fix | Delete
__( 'Not all required fields are given. Missing field %1$s', 'wordpress-seo' ),
[151] Fix | Delete
$field_name
[152] Fix | Delete
)
[153] Fix | Delete
);
[154] Fix | Delete
}
[155] Fix | Delete
}
[156] Fix | Delete
}
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function