class-yoast-form.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin
  6. */
  7. /**
  8. * Admin form class.
  9. *
  10. * @since 2.0
  11. */
  12. class Yoast_Form {
  13. /**
  14. * @var object Instance of this class
  15. * @since 2.0
  16. */
  17. public static $instance;
  18. /**
  19. * @var string
  20. * @since 2.0
  21. */
  22. public $option_name;
  23. /**
  24. * @var array
  25. * @since 2.0
  26. */
  27. public $options;
  28. /**
  29. * Get the singleton instance of this class
  30. *
  31. * @since 2.0
  32. *
  33. * @return Yoast_Form
  34. */
  35. public static function get_instance() {
  36. if ( ! ( self::$instance instanceof self ) ) {
  37. self::$instance = new self();
  38. }
  39. return self::$instance;
  40. }
  41. /**
  42. * Generates the header for admin pages
  43. *
  44. * @since 2.0
  45. *
  46. * @param bool $form Whether or not the form start tag should be included.
  47. * @param string $option The short name of the option to use for the current page.
  48. * @param bool $contains_files Whether the form should allow for file uploads.
  49. * @param bool $option_long_name Group name of the option.
  50. */
  51. public function admin_header( $form = true, $option = 'wpseo', $contains_files = false, $option_long_name = false ) {
  52. if ( ! $option_long_name ) {
  53. $option_long_name = WPSEO_Options::get_group_name( $option );
  54. }
  55. ?>
  56. <div class="wrap yoast wpseo-admin-page <?php echo esc_attr( 'page-' . $option ); ?>">
  57. <?php
  58. /**
  59. * Display the updated/error messages
  60. * Only needed as our settings page is not under options, otherwise it will automatically be included
  61. *
  62. * @see settings_errors()
  63. */
  64. require_once ABSPATH . 'wp-admin/options-head.php';
  65. ?>
  66. <h1 id="wpseo-title"><?php echo esc_html( get_admin_page_title() ); ?></h1>
  67. <div class="wpseo_content_wrapper">
  68. <div class="wpseo_content_cell" id="wpseo_content_top">
  69. <?php
  70. if ( $form === true ) {
  71. $enctype = ( $contains_files ) ? ' enctype="multipart/form-data"' : '';
  72. $network_admin = new Yoast_Network_Admin();
  73. if ( $network_admin->meets_requirements() ) {
  74. $action_url = network_admin_url( 'settings.php' );
  75. $hidden_fields_cb = array( $network_admin, 'settings_fields' );
  76. }
  77. else {
  78. $action_url = admin_url( 'options.php' );
  79. $hidden_fields_cb = 'settings_fields';
  80. }
  81. echo '<form action="' . esc_url( $action_url ) . '" method="post" id="wpseo-conf"' . $enctype . ' accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">';
  82. call_user_func( $hidden_fields_cb, $option_long_name );
  83. }
  84. $this->set_option( $option );
  85. }
  86. /**
  87. * Set the option used in output for form elements
  88. *
  89. * @since 2.0
  90. *
  91. * @param string $option_name Option key.
  92. */
  93. public function set_option( $option_name ) {
  94. $this->option_name = $option_name;
  95. $this->options = $this->get_option();
  96. }
  97. /**
  98. * Sets a value in the options.
  99. *
  100. * @since 5.4
  101. *
  102. * @param string $key The key of the option to set.
  103. * @param mixed $value The value to set the option to.
  104. * @param bool $overwrite Whether to overwrite existing options. Default is false.
  105. */
  106. public function set_options_value( $key, $value, $overwrite = false ) {
  107. if ( $overwrite || ! array_key_exists( $key, $this->options ) ) {
  108. $this->options[ $key ] = $value;
  109. }
  110. }
  111. /**
  112. * Retrieve options based on whether we're on multisite or not.
  113. *
  114. * @since 1.2.4
  115. * @since 2.0 Moved to this class.
  116. *
  117. * @return array
  118. */
  119. public function get_option() {
  120. if ( is_network_admin() ) {
  121. return get_site_option( $this->option_name );
  122. }
  123. return get_option( $this->option_name );
  124. }
  125. /**
  126. * Generates the footer for admin pages
  127. *
  128. * @since 2.0
  129. *
  130. * @param bool $submit Whether or not a submit button and form end tag should be shown.
  131. * @param bool $show_sidebar Whether or not to show the banner sidebar - used by premium plugins to disable it.
  132. */
  133. public function admin_footer( $submit = true, $show_sidebar = true ) {
  134. if ( $submit ) {
  135. submit_button( __( 'Save changes', 'wordpress-seo' ) );
  136. echo '
  137. </form>';
  138. }
  139. /**
  140. * Apply general admin_footer hooks
  141. */
  142. do_action( 'wpseo_admin_footer', $this );
  143. /**
  144. * Run possibly set actions to add for example an i18n box
  145. */
  146. do_action( 'wpseo_admin_promo_footer' );
  147. echo '
  148. </div><!-- end of div wpseo_content_top -->';
  149. if ( $show_sidebar ) {
  150. $this->admin_sidebar();
  151. }
  152. echo '</div><!-- end of div wpseo_content_wrapper -->';
  153. do_action( 'wpseo_admin_below_content', $this );
  154. echo '
  155. </div><!-- end of wrap -->';
  156. }
  157. /**
  158. * Generates the sidebar for admin pages.
  159. *
  160. * @since 2.0
  161. */
  162. public function admin_sidebar() {
  163. // No banners in Premium.
  164. if ( class_exists( 'WPSEO_Product_Premium' ) ) {
  165. $product_premium = new WPSEO_Product_Premium();
  166. $extension_manager = new WPSEO_Extension_Manager();
  167. if ( $extension_manager->is_activated( $product_premium->get_slug() ) ) {
  168. return;
  169. }
  170. }
  171. require_once 'views/sidebar.php';
  172. }
  173. /**
  174. * Output a label element
  175. *
  176. * @since 2.0
  177. *
  178. * @param string $text Label text string.
  179. * @param array $attr HTML attributes set.
  180. */
  181. public function label( $text, $attr ) {
  182. $attr = wp_parse_args( $attr, array(
  183. 'class' => 'checkbox',
  184. 'close' => true,
  185. 'for' => '',
  186. )
  187. );
  188. echo "<label class='" . esc_attr( $attr['class'] ) . "' for='" . esc_attr( $attr['for'] ) . "'>$text";
  189. if ( $attr['close'] ) {
  190. echo '</label>';
  191. }
  192. }
  193. /**
  194. * Output a legend element.
  195. *
  196. * @since 3.4
  197. *
  198. * @param string $text Legend text string.
  199. * @param array $attr HTML attributes set.
  200. */
  201. public function legend( $text, $attr ) {
  202. $attr = wp_parse_args( $attr, array(
  203. 'id' => '',
  204. 'class' => '',
  205. )
  206. );
  207. $id = ( '' === $attr['id'] ) ? '' : ' id="' . esc_attr( $attr['id'] ) . '"';
  208. echo '<legend class="yoast-form-legend ' . esc_attr( $attr['class'] ) . '"' . $id . '>' . $text . '</legend>';
  209. }
  210. /**
  211. * Create a Checkbox input field.
  212. *
  213. * @since 2.0
  214. *
  215. * @param string $var The variable within the option to create the checkbox for.
  216. * @param string $label The label to show for the variable.
  217. * @param bool $label_left Whether the label should be left (true) or right (false).
  218. */
  219. public function checkbox( $var, $label, $label_left = false ) {
  220. if ( ! isset( $this->options[ $var ] ) ) {
  221. $this->options[ $var ] = false;
  222. }
  223. if ( $this->options[ $var ] === true ) {
  224. $this->options[ $var ] = 'on';
  225. }
  226. $class = '';
  227. if ( $label_left !== false ) {
  228. if ( ! empty( $label_left ) ) {
  229. $label_left .= ':';
  230. }
  231. $this->label( $label_left, array( 'for' => $var ) );
  232. }
  233. else {
  234. $class = 'double';
  235. }
  236. echo '<input class="checkbox ', esc_attr( $class ), '" type="checkbox" id="', esc_attr( $var ), '" name="', esc_attr( $this->option_name ), '[', esc_attr( $var ), ']" value="on"', checked( $this->options[ $var ], 'on', false ), '/>';
  237. if ( ! empty( $label ) ) {
  238. $this->label( $label, array( 'for' => $var ) );
  239. }
  240. echo '<br class="clear" />';
  241. }
  242. /**
  243. * Create a light switch input field using a single checkbox.
  244. *
  245. * @since 3.1
  246. *
  247. * @param string $var The variable within the option to create the checkbox for.
  248. * @param string $label The label element text for the checkbox.
  249. * @param array $buttons Array of two visual labels for the buttons (defaults Disabled/Enabled).
  250. * @param boolean $reverse Reverse order of buttons (default true).
  251. * @param string $help Inline Help that will be printed out before the visible toggles text.
  252. */
  253. public function light_switch( $var, $label, $buttons = array(), $reverse = true, $help = '' ) {
  254. if ( ! isset( $this->options[ $var ] ) ) {
  255. $this->options[ $var ] = false;
  256. }
  257. if ( $this->options[ $var ] === true ) {
  258. $this->options[ $var ] = 'on';
  259. }
  260. $class = 'switch-light switch-candy switch-yoast-seo';
  261. $aria_labelledby = esc_attr( $var ) . '-label';
  262. if ( $reverse ) {
  263. $class .= ' switch-yoast-seo-reverse';
  264. }
  265. if ( empty( $buttons ) ) {
  266. $buttons = array( __( 'Disabled', 'wordpress-seo' ), __( 'Enabled', 'wordpress-seo' ) );
  267. }
  268. list( $off_button, $on_button ) = $buttons;
  269. $help_class = '';
  270. $screen_reader_text_class = '';
  271. $help_class = ! empty( $help ) ? ' switch-container__has-help' : '';
  272. echo "<div class='switch-container$help_class'>",
  273. "<span class='switch-light-visual-label'>{$label}</span>" . $help,
  274. '<label class="', $class, '"><b class="switch-yoast-seo-jaws-a11y">&nbsp;</b>',
  275. '<input type="checkbox" aria-labelledby="', $aria_labelledby, '" id="', esc_attr( $var ), '" name="', esc_attr( $this->option_name ), '[', esc_attr( $var ), ']" value="on"', checked( $this->options[ $var ], 'on', false ), '/>',
  276. "<b class='label-text screen-reader-text' id='{$aria_labelledby}'>{$label}</b>",
  277. '<span aria-hidden="true">
  278. <span>', esc_html( $off_button ) ,'</span>
  279. <span>', esc_html( $on_button ) ,'</span>
  280. <a></a>
  281. </span>
  282. </label><div class="clear"></div></div>';
  283. }
  284. /**
  285. * Create a Text input field.
  286. *
  287. * @since 2.0
  288. * @since 2.1 Introduced the `$attr` parameter.
  289. *
  290. * @param string $var The variable within the option to create the text input field for.
  291. * @param string $label The label to show for the variable.
  292. * @param array|string $attr Extra class to add to the input field.
  293. */
  294. public function textinput( $var, $label, $attr = array() ) {
  295. if ( ! is_array( $attr ) ) {
  296. $attr = array(
  297. 'class' => $attr,
  298. );
  299. }
  300. $attr = wp_parse_args( $attr, array(
  301. 'placeholder' => '',
  302. 'class' => '',
  303. ) );
  304. $val = ( isset( $this->options[ $var ] ) ) ? $this->options[ $var ] : '';
  305. $this->label(
  306. $label . ':',
  307. array(
  308. 'for' => $var,
  309. 'class' => 'textinput',
  310. )
  311. );
  312. echo '<input class="textinput ' . esc_attr( $attr['class'] ) . ' " placeholder="' . esc_attr( $attr['placeholder'] ) . '" type="text" id="', esc_attr( $var ), '" name="', esc_attr( $this->option_name ), '[', esc_attr( $var ), ']" value="', esc_attr( $val ), '"/>', '<br class="clear" />';
  313. }
  314. /**
  315. * Create a textarea.
  316. *
  317. * @since 2.0
  318. *
  319. * @param string $var The variable within the option to create the textarea for.
  320. * @param string $label The label to show for the variable.
  321. * @param string|array $attr The CSS class or an array of attributes to assign to the textarea.
  322. */
  323. public function textarea( $var, $label, $attr = array() ) {
  324. if ( ! is_array( $attr ) ) {
  325. $attr = array(
  326. 'class' => $attr,
  327. );
  328. }
  329. $attr = wp_parse_args( $attr, array(
  330. 'cols' => '',
  331. 'rows' => '',
  332. 'class' => '',
  333. ) );
  334. $val = ( isset( $this->options[ $var ] ) ) ? $this->options[ $var ] : '';
  335. $this->label(
  336. $label . ':',
  337. array(
  338. 'for' => $var,
  339. 'class' => 'textinput',
  340. )
  341. );
  342. echo '<textarea cols="' . esc_attr( $attr['cols'] ) . '" rows="' . esc_attr( $attr['rows'] ) . '" class="textinput ' . esc_attr( $attr['class'] ) . '" id="' . esc_attr( $var ) . '" name="' . esc_attr( $this->option_name ) . '[' . esc_attr( $var ) . ']">' . esc_textarea( $val ) . '</textarea><br class="clear" />';
  343. }
  344. /**
  345. * Create a hidden input field.
  346. *
  347. * @since 2.0
  348. *
  349. * @param string $var The variable within the option to create the hidden input for.
  350. * @param string $id The ID of the element.
  351. */
  352. public function hidden( $var, $id = '' ) {
  353. $val = ( isset( $this->options[ $var ] ) ) ? $this->options[ $var ] : '';
  354. if ( is_bool( $val ) ) {
  355. $val = ( $val === true ) ? 'true' : 'false';
  356. }
  357. if ( '' === $id ) {
  358. $id = 'hidden_' . $var;
  359. }
  360. echo '<input type="hidden" id="' . esc_attr( $id ) . '" name="' . esc_attr( $this->option_name ) . '[' . esc_attr( $var ) . ']" value="' . esc_attr( $val ) . '"/>';
  361. }
  362. /**
  363. * Create a Select Box.
  364. *
  365. * @since 2.0
  366. *
  367. * @param string $field_name The variable within the option to create the select for.
  368. * @param string $label The label to show for the variable.
  369. * @param array $select_options The select options to choose from.
  370. */
  371. public function select( $field_name, $label, array $select_options ) {
  372. if ( empty( $select_options ) ) {
  373. return;
  374. }
  375. $this->label(
  376. $label . ':',
  377. array(
  378. 'for' => $field_name,
  379. 'class' => 'select',
  380. )
  381. );
  382. $select_name = esc_attr( $this->option_name ) . '[' . esc_attr( $field_name ) . ']';
  383. $active_option = ( isset( $this->options[ $field_name ] ) ) ? $this->options[ $field_name ] : '';
  384. $select = new Yoast_Input_Select( $field_name, $select_name, $select_options, $active_option );
  385. $select->add_attribute( 'class', 'select' );
  386. $select->output_html();
  387. echo '<br class="clear"/>';
  388. }
  389. /**
  390. * Create a File upload field.
  391. *
  392. * @since 2.0
  393. *
  394. * @param string $var The variable within the option to create the file upload field for.
  395. * @param string $label The label to show for the variable.
  396. */
  397. public function file_upload( $var, $label ) {
  398. $val = '';
  399. if ( isset( $this->options[ $var ] ) && is_array( $this->options[ $var ] ) ) {
  400. $val = $this->options[ $var ]['url'];
  401. }
  402. $var_esc = esc_attr( $var );
  403. $this->label(
  404. $label . ':',
  405. array(
  406. 'for' => $var,
  407. 'class' => 'select',
  408. )
  409. );
  410. echo '<input type="file" value="' . esc_attr( $val ) . '" class="textinput" name="' . esc_attr( $this->option_name ) . '[' . $var_esc . ']" id="' . $var_esc . '"/>';
  411. // Need to save separate array items in hidden inputs, because empty file inputs type will be deleted by settings API.
  412. if ( ! empty( $this->options[ $var ] ) ) {
  413. $this->hidden( 'file', $this->option_name . '_file' );
  414. $this->hidden( 'url', $this->option_name . '_url' );
  415. $this->hidden( 'type', $this->option_name . '_type' );
  416. }
  417. echo '<br class="clear"/>';
  418. }
  419. /**
  420. * Media input
  421. *
  422. * @since 2.0
  423. *
  424. * @param string $var Option name.
  425. * @param string $label Label message.
  426. */
  427. public function media_input( $var, $label ) {
  428. $val = '';
  429. if ( isset( $this->options[ $var ] ) ) {
  430. $val = $this->options[ $var ];
  431. }
  432. $var_esc = esc_attr( $var );
  433. $this->label(
  434. $label . ':',
  435. array(
  436. 'for' => 'wpseo_' . $var,
  437. 'class' => 'select',
  438. )
  439. );
  440. echo '<input class="textinput" id="wpseo_', $var_esc, '" type="text" size="36" name="', esc_attr( $this->option_name ), '[', $var_esc, ']" value="', esc_attr( $val ), '" />';
  441. echo '<input id="wpseo_', $var_esc, '_button" class="wpseo_image_upload_button button" type="button" value="', esc_attr__( 'Upload Image', 'wordpress-seo' ), '" />';
  442. echo '<br class="clear"/>';
  443. }
  444. /**
  445. * Create a Radio input field.
  446. *
  447. * @since 2.0
  448. *
  449. * @param string $var The variable within the option to create the radio button for.
  450. * @param array $values The radio options to choose from.
  451. * @param string $legend Optional. The legend to show for the field set, if any.
  452. * @param array $legend_attr Optional. The attributes for the legend, if any.
  453. */
  454. public function radio( $var, $values, $legend = '', $legend_attr = array() ) {
  455. if ( ! is_array( $values ) || $values === array() ) {
  456. return;
  457. }
  458. if ( ! isset( $this->options[ $var ] ) ) {
  459. $this->options[ $var ] = false;
  460. }
  461. $var_esc = esc_attr( $var );
  462. echo '<fieldset class="yoast-form-fieldset wpseo_radio_block" id="' . $var_esc . '">';
  463. if ( is_string( $legend ) && '' !== $legend ) {
  464. $legend_attr = wp_parse_args( $legend_attr, array(
  465. 'id' => '',
  466. 'class' => 'radiogroup',
  467. ) );
  468. $this->legend( $legend, $legend_attr );
  469. }
  470. foreach ( $values as $key => $value ) {
  471. $key_esc = esc_attr( $key );
  472. echo '<input type="radio" class="radio" id="' . $var_esc . '-' . $key_esc . '" name="' . esc_attr( $this->option_name ) . '[' . $var_esc . ']" value="' . $key_esc . '" ' . checked( $this->options[ $var ], $key_esc, false ) . ' />';
  473. $this->label(
  474. $value,
  475. array(
  476. 'for' => $var_esc . '-' . $key_esc,
  477. 'class' => 'radio',
  478. )
  479. );
  480. }
  481. echo '</fieldset>';
  482. }
  483. /**
  484. * Create a toggle switch input field using two radio buttons.
  485. *
  486. * @since 3.1
  487. *
  488. * @param string $var The variable within the option to create the radio buttons for.
  489. * @param array $values Associative array of on/off keys and their values to be used as
  490. * the label elements text for the radio buttons. Optionally, each
  491. * value can be an array of visible label text and screen reader text.
  492. * @param string $label The visual label for the radio buttons group, used as the fieldset legend.
  493. * @param string $help Inline Help that will be printed out before the visible toggles text.
  494. */
  495. public function toggle_switch( $var, $values, $label, $help = '' ) {
  496. if ( ! is_array( $values ) || $values === array() ) {
  497. return;
  498. }
  499. if ( ! isset( $this->options[ $var ] ) ) {
  500. $this->options[ $var ] = false;
  501. }
  502. if ( $this->options[ $var ] === true ) {
  503. $this->options[ $var ] = 'on';
  504. }
  505. if ( $this->options[ $var ] === false ) {
  506. $this->options[ $var ] = 'off';
  507. }
  508. $help_class = ! empty( $help ) ? ' switch-container__has-help' : '';
  509. $var_esc = esc_attr( $var );
  510. printf( '<div class="%s">', esc_attr( 'switch-container' . $help_class ) );
  511. echo '<fieldset id="', $var_esc, '" class="fieldset-switch-toggle"><legend>', $label, '</legend>', $help,
  512. '<div class="switch-toggle switch-candy switch-yoast-seo">';
  513. foreach ( $values as $key => $value ) {
  514. $screen_reader_text = '';
  515. $screen_reader_text_html = '';
  516. if ( is_array( $value ) ) {
  517. $screen_reader_text = $value['screen_reader_text'];
  518. $screen_reader_text_html = '<span class="screen-reader-text"> ' . esc_html( $screen_reader_text ) . '</span>';
  519. $value = $value['text'];
  520. }
  521. $key_esc = esc_attr( $key );
  522. $for = $var_esc . '-' . $key_esc;
  523. echo '<input type="radio" id="' . $for . '" name="' . esc_attr( $this->option_name ) . '[' . $var_esc . ']" value="' . $key_esc . '" ' . checked( $this->options[ $var ], $key_esc, false ) . ' />',
  524. '<label for="', $for, '">', esc_html( $value ), $screen_reader_text_html,'</label>';
  525. }
  526. echo '<a></a></div></fieldset><div class="clear"></div></div>' . "\n\n";
  527. }
  528. /**
  529. * Creates a toggle switch to define whether an indexable should be indexed or not.
  530. *
  531. * @param string $var The variable within the option to create the radio buttons for.
  532. * @param string $label The visual label for the radio buttons group, used as the fieldset legend.
  533. * @param string $help Inline Help that will be printed out before the visible toggles text.
  534. *
  535. * @return void
  536. */
  537. public function index_switch( $var, $label, $help = '' ) {
  538. $index_switch_values = array(
  539. 'off' => __( 'Yes', 'wordpress-seo' ),
  540. 'on' => __( 'No', 'wordpress-seo' ),
  541. );
  542. $this->toggle_switch(
  543. $var,
  544. $index_switch_values,
  545. sprintf(
  546. /* translators: %s expands to an indexable object's name, like a post type or taxonomy */
  547. esc_html__( 'Show %s in search results?', 'wordpress-seo' ),
  548. '<strong>' . esc_html( $label ) . '</strong>'
  549. ),
  550. $help
  551. );
  552. }
  553. /**
  554. * Creates a toggle switch to show hide certain options.
  555. *
  556. * @param string $var The variable within the option to create the radio buttons for.
  557. * @param string $label The visual label for the radio buttons group, used as the fieldset legend.
  558. * @param bool $inverse_keys Whether or not the option keys need to be inverted to support older functions.
  559. * @param string $help Inline Help that will be printed out before the visible toggles text.
  560. *
  561. * @return void
  562. */
  563. public function show_hide_switch( $var, $label, $inverse_keys = false, $help = '' ) {
  564. $on_key = ( $inverse_keys ) ? 'off' : 'on';
  565. $off_key = ( $inverse_keys ) ? 'on' : 'off';
  566. $show_hide_switch = array(
  567. $on_key => __( 'Show', 'wordpress-seo' ),
  568. $off_key => __( 'Hide', 'wordpress-seo' ),
  569. );
  570. $this->toggle_switch( $var, $show_hide_switch, $label, $help );
  571. }
  572. }