features.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Views
  6. *
  7. * @uses Yoast_Form $yform Form object.
  8. */
  9. if ( ! defined( 'WPSEO_VERSION' ) ) {
  10. header( 'Status: 403 Forbidden' );
  11. header( 'HTTP/1.1 403 Forbidden' );
  12. exit();
  13. }
  14. $feature_toggles = Yoast_Feature_Toggles::instance()->get_all();
  15. ?>
  16. <h2><?php esc_html_e( 'Features', 'wordpress-seo' ); ?></h2>
  17. <div class="yoast-measure">
  18. <?php
  19. echo sprintf(
  20. /* translators: %s expands to Yoast SEO */
  21. esc_html__( 'This tab allows you to selectively disable %s features for all sites in the network. By default all features are enabled, which allows site admins to choose for themselves if they want to toggle a feature on or off for their site. When you disable a feature here, site admins will not be able to use that feature at all.', 'wordpress-seo' ),
  22. 'Yoast SEO'
  23. );
  24. foreach ( $feature_toggles as $feature ) {
  25. $help_text = esc_html( $feature->label );
  26. if ( ! empty( $feature->extra ) ) {
  27. $help_text .= ' ' . $feature->extra;
  28. }
  29. if ( ! empty( $feature->read_more_label ) ) {
  30. $help_text .= ' ';
  31. $help_text .= sprintf(
  32. '<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a>',
  33. esc_url( WPSEO_Shortlinker::get( $feature->read_more_url ) ),
  34. esc_html( $feature->read_more_label )
  35. );
  36. }
  37. $feature_help = new WPSEO_Admin_Help_Panel(
  38. WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
  39. /* translators: %s expands to a feature's name */
  40. sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $feature->name ) ),
  41. $help_text
  42. );
  43. $yform->toggle_switch(
  44. WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
  45. [
  46. 'on' => __( 'Allow Control', 'wordpress-seo' ),
  47. 'off' => __( 'Disable', 'wordpress-seo' ),
  48. ],
  49. '<strong>' . $feature->name . '</strong>',
  50. $feature_help->get_button_html() . $feature_help->get_panel_html()
  51. );
  52. }
  53. ?>
  54. </div>
  55. <?php
  56. /*
  57. * Required to prevent our settings framework from saving the default because the field
  58. * isn't explicitly set when saving the Dashboard page.
  59. */
  60. $yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );