first commit

This commit is contained in:
2025-09-22 10:45:29 +02:00
commit bb5cc93cb0
6520 changed files with 2602936 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*
* @uses Yoast_Form $yform Form object.
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$feature_toggles = Yoast_Feature_Toggles::instance()->get_all();
?>
<h2><?php esc_html_e( 'Crawl settings', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
<?php
printf(
/* translators: %s expands to Yoast SEO */
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' ),
'Yoast SEO'
);
echo '<p style="margin: 0.5em 0 1em;">';
printf(
/* translators: %1$s opens the link to the Yoast.com article about Crawl settings, %2$s closes the link, */
esc_html__( '%1$sLearn more about crawl settings.%2$s', 'wordpress-seo' ),
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/crawl-settings' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
);
echo '</p>';
/**
* Fires when displaying the crawl cleanup network tab.
*
* @param Yoast_Form $yform The yoast form object.
*/
do_action( 'wpseo_settings_tab_crawl_cleanup_network', $yform );
?>
</div>
<?php
/*
* Required to prevent our settings framework from saving the default because the field
* isn't explicitly set when saving the Dashboard page.
*/
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );

View File

@@ -0,0 +1,115 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*
* @uses Yoast_Form $yform Form object.
*/
use Yoast\WP\SEO\Presenters\Admin\Beta_Badge_Presenter;
use Yoast\WP\SEO\Presenters\Admin\Premium_Badge_Presenter;
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$feature_toggles = Yoast_Feature_Toggles::instance()->get_all();
?>
<h2><?php esc_html_e( 'Features', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
<?php
printf(
/* translators: %s expands to Yoast SEO */
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' ),
'Yoast SEO'
);
foreach ( $feature_toggles as $feature ) {
$is_premium = YoastSEO()->helpers->product->is_premium();
$premium_version = YoastSEO()->helpers->product->get_premium_version();
if ( $feature->premium && $feature->premium_version ) {
$not_supported_in_current_premium_version = $is_premium && version_compare( $premium_version, $feature->premium_version, '<' );
if ( $not_supported_in_current_premium_version ) {
continue;
}
}
$help_text = esc_html( $feature->label );
if ( ! empty( $feature->extra ) ) {
$help_text .= ' ' . $feature->extra;
}
if ( ! empty( $feature->read_more_label ) ) {
$url = $feature->read_more_url;
if ( ! empty( $feature->premium ) && $feature->premium === true ) {
$url = $feature->premium_url;
}
$help_text .= sprintf(
'<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a>',
esc_url( WPSEO_Shortlinker::get( $url ) ),
esc_html( $feature->read_more_label )
);
}
$feature_help = new WPSEO_Admin_Help_Panel(
WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
/* translators: Hidden accessibility text; %s expands to a feature's name. */
sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $feature->name ) ),
$help_text
);
$name = $feature->name;
if ( ! empty( $feature->premium ) && $feature->premium === true ) {
$name .= ' ' . new Premium_Badge_Presenter( $feature->name );
}
if ( ! empty( $feature->in_beta ) && $feature->in_beta === true ) {
$name .= ' ' . new Beta_Badge_Presenter( $feature->name );
}
$disabled = false;
$show_premium_upsell = false;
$premium_upsell_url = '';
$note_when_disabled = '';
if ( $feature->premium === true && YoastSEO()->helpers->product->is_premium() === false ) {
$disabled = true;
$show_premium_upsell = true;
$premium_upsell_url = WPSEO_Shortlinker::get( $feature->premium_upsell_url );
}
$preserve_disabled_value = false;
if ( $disabled ) {
$preserve_disabled_value = true;
}
$yform->toggle_switch(
WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
[
'on' => __( 'Allow Control', 'wordpress-seo' ),
'off' => __( 'Disable', 'wordpress-seo' ),
],
$name,
$feature_help->get_button_html() . $feature_help->get_panel_html(),
[
'disabled' => $disabled,
'preserve_disabled_value' => $preserve_disabled_value,
'show_premium_upsell' => $show_premium_upsell,
'premium_upsell_url' => $premium_upsell_url,
'note_when_disabled' => $note_when_disabled,
]
);
}
?>
</div>
<?php
/*
* Required to prevent our settings framework from saving the default because the field
* isn't explicitly set when saving the Dashboard page.
*/
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );

View File

@@ -0,0 +1,56 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*
* @uses Yoast_Form $yform Form object.
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
echo '<div class="tab-block">';
/*
* {@internal Important: Make sure the options added to the array here are in line with the
* options set in the WPSEO_Option_MS::$allowed_access_options property.}}
*/
$yform->select(
'access',
/* translators: %1$s expands to Yoast SEO */
sprintf( __( 'Who should have access to the %1$s settings', 'wordpress-seo' ), 'Yoast SEO' ),
[
'admin' => __( 'Site Admins (default)', 'wordpress-seo' ),
'superadmin' => __( 'Super Admins only', 'wordpress-seo' ),
]
);
if ( get_blog_count() <= 100 ) {
$network_admin = new Yoast_Network_Admin();
$yform->select(
'defaultblog',
__( 'New sites in the network inherit their SEO settings from this site', 'wordpress-seo' ),
$network_admin->get_site_choices( true, true )
);
echo '<p>' . esc_html__( 'Choose the site whose settings you want to use as default for all sites that are added to your network. If you choose \'None\', the normal plugin defaults will be used.', 'wordpress-seo' ) . '</p>';
}
else {
$yform->textinput( 'defaultblog', __( 'New sites in the network inherit their SEO settings from this site', 'wordpress-seo' ) );
echo '<p>';
printf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__( 'Enter the %1$sSite ID%2$s for the site whose settings you want to use as default for all sites that are added to your network. Leave empty for none (i.e. the normal plugin defaults will be used).', 'wordpress-seo' ),
'<a href="' . esc_url( network_admin_url( 'sites.php' ) ) . '">',
'</a>'
);
echo '</p>';
}
echo '<p><strong>' . esc_html__( 'Take note:', 'wordpress-seo' ) . '</strong> ' . esc_html__( 'Privacy sensitive (FB admins and such), theme specific (title rewrite) and a few very site specific settings will not be imported to new sites.', 'wordpress-seo' ) . '</p>';
echo '</div>';

View File

@@ -0,0 +1,103 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*
* @uses Yoast_Form $yform Form object.
*/
use Yoast\WP\SEO\Presenters\Admin\Badge_Presenter;
use Yoast\WP\SEO\Presenters\Admin\Premium_Badge_Presenter;
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$integration_toggles = Yoast_Integration_Toggles::instance()->get_all();
?>
<h2><?php esc_html_e( 'Integrations', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
<?php
printf(
/* translators: %1$s expands to Yoast SEO */
esc_html__( 'This tab allows you to selectively disable %1$s integrations with third-party products for all sites in the network. By default all integrations are enabled, which allows site admins to choose for themselves if they want to toggle an integration on or off for their site. When you disable an integration here, site admins will not be able to use that integration at all.', 'wordpress-seo' ),
'Yoast SEO'
);
foreach ( $integration_toggles as $integration ) {
$help_text = esc_html( $integration->label );
if ( ! empty( $integration->extra ) ) {
$help_text .= ' ' . $integration->extra;
}
if ( ! empty( $integration->read_more_label ) ) {
$help_text .= ' ';
$help_text .= sprintf(
'<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a>',
esc_url( WPSEO_Shortlinker::get( $integration->read_more_url ) ),
esc_html( $integration->read_more_label )
);
}
$feature_help = new WPSEO_Admin_Help_Panel(
WPSEO_Option::ALLOW_KEY_PREFIX . $integration->setting,
/* translators: Hidden accessibility text; %s expands to an integration's name. */
sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $integration->name ) ),
$help_text
);
$name = $integration->name;
if ( ! empty( $integration->premium ) && $integration->premium === true ) {
$name .= ' ' . new Premium_Badge_Presenter( $integration->name );
}
if ( ! empty( $integration->new ) && $integration->new === true ) {
$name .= ' ' . new Badge_Presenter( $integration->name );
}
$disabled = $integration->disabled;
$show_premium_upsell = false;
$premium_upsell_url = '';
if ( $integration->premium === true && YoastSEO()->helpers->product->is_premium() === false ) {
$disabled = true;
$show_premium_upsell = true;
$premium_upsell_url = WPSEO_Shortlinker::get( $integration->premium_upsell_url );
}
$preserve_disabled_value = false;
if ( $disabled ) {
$preserve_disabled_value = true;
}
$yform->toggle_switch(
WPSEO_Option::ALLOW_KEY_PREFIX . $integration->setting,
[
'on' => __( 'Allow Control', 'wordpress-seo' ),
'off' => __( 'Disable', 'wordpress-seo' ),
],
$name,
$feature_help->get_button_html() . $feature_help->get_panel_html(),
[
'disabled' => $disabled,
'preserve_disabled_value' => $preserve_disabled_value,
'show_premium_upsell' => $show_premium_upsell,
'premium_upsell_url' => $premium_upsell_url,
]
);
do_action( 'Yoast\WP\SEO\admin_network_integration_after', $integration );
}
?>
</div>
<?php
/*
* Required to prevent our settings framework from saving the default because the field isn't
* explicitly set when saving the Dashboard page.
*/
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );

View File

@@ -0,0 +1,32 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*
* @uses Yoast_Form $yform Form object.
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
echo '<p>' . esc_html__( 'Using this form you can reset a site to the default SEO settings.', 'wordpress-seo' ) . '</p>';
if ( get_blog_count() <= 100 ) {
$network_admin = new Yoast_Network_Admin();
$yform->select(
'site_id',
__( 'Site ID', 'wordpress-seo' ),
$network_admin->get_site_choices( false, true )
);
}
else {
$yform->textinput( 'site_id', __( 'Site ID', 'wordpress-seo' ) );
}
wp_nonce_field( 'wpseo-network-restore', 'restore_site_nonce', false );
echo '<button type="submit" name="action" value="' . esc_attr( Yoast_Network_Admin::RESTORE_SITE_ACTION ) . '" class="button button-primary">' . esc_html__( 'Restore site to defaults', 'wordpress-seo' ) . '</button>';