| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPSEO plugin file. |
| 4 |
* |
| 5 |
* @package WPSEO\Admin\Views |
| 6 |
* |
| 7 |
* @uses Yoast_Form $yform Form object. |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! defined( 'WPSEO_VERSION' ) ) { |
| 11 |
header( 'Status: 403 Forbidden' ); |
| 12 |
header( 'HTTP/1.1 403 Forbidden' ); |
| 13 |
exit(); |
| 14 |
} |
| 15 |
|
| 16 |
$feature_toggles = Yoast_Feature_Toggles::instance()->get_all(); |
| 17 |
|
| 18 |
?> |
| 19 |
<h2><?php esc_html_e( 'Features', 'wordpress-seo' ); ?></h2> |
| 20 |
<div class="yoast-measure"> |
| 21 |
<?php |
| 22 |
echo sprintf( |
| 23 |
/* translators: %s expands to Yoast SEO */ |
| 24 |
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' ), |
| 25 |
'Yoast SEO' |
| 26 |
); |
| 27 |
|
| 28 |
foreach ( $feature_toggles as $feature ) { |
| 29 |
$help_text = esc_html( $feature->label ); |
| 30 |
if ( ! empty( $feature->extra ) ) { |
| 31 |
$help_text .= ' ' . $feature->extra; |
| 32 |
} |
| 33 |
if ( ! empty( $feature->read_more_label ) ) { |
| 34 |
$help_text .= ' '; |
| 35 |
$help_text .= sprintf( |
| 36 |
'<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a>', |
| 37 |
esc_url( WPSEO_Shortlinker::get( $feature->read_more_url ) ), |
| 38 |
esc_html( $feature->read_more_label ) |
| 39 |
); |
| 40 |
} |
| 41 |
|
| 42 |
$feature_help = new WPSEO_Admin_Help_Panel( |
| 43 |
WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting, |
| 44 |
/* translators: %s expands to a feature's name */ |
| 45 |
sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $feature->name ) ), |
| 46 |
$help_text |
| 47 |
); |
| 48 |
|
| 49 |
$yform->toggle_switch( |
| 50 |
WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting, |
| 51 |
[ |
| 52 |
'on' => __( 'Allow Control', 'wordpress-seo' ), |
| 53 |
'off' => __( 'Disable', 'wordpress-seo' ), |
| 54 |
], |
| 55 |
$feature->name, |
| 56 |
$feature_help->get_button_html() . $feature_help->get_panel_html() |
| 57 |
); |
| 58 |
} |
| 59 |
?> |
| 60 |
</div> |
| 61 |
<?php |
| 62 |
/* |
| 63 |
* Required to prevent our settings framework from saving the default because the field |
| 64 |
* isn't explicitly set when saving the Dashboard page. |
| 65 |
*/ |
| 66 |
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' ); |
| 67 |
|