This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@ -0,0 +1,44 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Notifications template variables.
*
* @noinspection PhpUnusedLocalVariableInspection
*
* @var array
*/
$notifications_data = Yoast_Notifications::get_template_variables();
$wpseo_contributors_phrase = sprintf(
/* translators: %1$s expands to Yoast SEO */
__( 'See who contributed to %1$s.', 'wordpress-seo' ),
'Yoast SEO'
);
?>
<div class="tab-block">
<div class="yoast-notifications">
<div class="yoast-container yoast-container__error">
<?php require WPSEO_PATH . 'admin/views/partial-notifications-errors.php'; ?>
</div>
<div class="yoast-container yoast-container__warning">
<?php require WPSEO_PATH . 'admin/views/partial-notifications-warnings.php'; ?>
</div>
</div>
</div>
<div class="tab-block">
<h2><?php esc_html_e( 'Credits', 'wordpress-seo' ); ?></h2>
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/yoast-seo-credits' ); ?>" target="_blank"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
</p>
</div>

View File

@ -0,0 +1,14 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
echo '<div id="wpseo-first-time-configuration"></div>';

View File

@ -0,0 +1,35 @@
<?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();
}
/**
* WARNING: This hook is intended for internal use only.
* Don't use it in your code as it will be removed shortly.
*/
do_action( 'wpseo_settings_tab_site_analysis_internal', $yform );
/**
* Fires when displaying the site wide analysis tab.
*
* @deprecated 19.10 No replacement available.
*
* @param Yoast_Form $yform The yoast form object.
*/
do_action_deprecated(
'wpseo_settings_tab_site_analysis',
[ $yform ],
'19.10',
'',
'This action is going away with no replacement. If you want to add settings that interact with Yoast SEO, please create your own settings page.'
);

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
echo sprintf(
/* 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;">';
echo sprintf(
/* 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
echo sprintf(
/* 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: %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
echo sprintf(
/* 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: %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>';

View File

@ -0,0 +1,139 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
// Determine if we have plugins we can import from. If so, load that tab. Otherwise, load an empty tab.
$import_check = new WPSEO_Import_Plugins_Detector();
$import_check->detect();
if ( count( $import_check->needs_import ) === 0 ) {
echo '<h2>', esc_html__( 'Import from other SEO plugins', 'wordpress-seo' ), '</h2>';
echo '<p>';
printf(
/* translators: %s expands to Yoast SEO */
esc_html__( '%s did not detect any plugin data from plugins it can import from.', 'wordpress-seo' ),
'Yoast SEO'
);
echo '</p>';
return;
}
/**
* Creates a select box given a name and plugins array.
*
* @param string $name Name field for the select field.
* @param array $plugins An array of plugins and classes.
*
* @return void
*/
function wpseo_import_external_select( $name, $plugins ) {
esc_html_e( 'Plugin: ', 'wordpress-seo' );
echo '<select name="', esc_attr( $name ), '">';
foreach ( $plugins as $class => $plugin ) {
/* translators: %s is replaced with the name of the plugin we're importing from. */
echo '<option value="' . esc_attr( $class ) . '">' . esc_html( $plugin ) . '</option>';
}
echo '</select>';
}
?>
<h2><?php esc_html_e( 'Import from other SEO plugins', 'wordpress-seo' ); ?></h2>
<p>
<?php esc_html_e( 'We\'ve detected data from one or more SEO plugins on your site. Please follow the following steps to import that data:', 'wordpress-seo' ); ?>
</p>
<div class="tab-block">
<h3><?php esc_html_e( 'Step 1: Create a backup', 'wordpress-seo' ); ?></h3>
<p>
<?php esc_html_e( 'Please make a backup of your database before starting this process.', 'wordpress-seo' ); ?>
</p>
</div>
<div class="tab-block">
<h3><?php esc_html_e( 'Step 2: Import', 'wordpress-seo' ); ?></h3>
<p class="yoast-import-explanation">
<?php
printf(
/* translators: 1: expands to Yoast SEO */
esc_html__( 'This will import the post metadata like SEO titles and descriptions into your %1$s metadata. It will only do this when there is no existing %1$s metadata yet. The original data will remain in place.', 'wordpress-seo' ),
'Yoast SEO'
);
?>
</p>
<form action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#import-seo' ) ); ?>"
method="post" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
<?php
wp_nonce_field( 'wpseo-import-plugins', '_wpnonce', true, true );
wpseo_import_external_select( 'import_external_plugin', $import_check->needs_import );
?>
<?php
/**
* WARNING: This hook is intended for internal use only.
* Don't use it in your code as it will be removed shortly.
*/
do_action( 'wpseo_import_other_plugins_internal' );
/**
* Hook used to import other plugins.
*
* @deprecated 19.10 No replacement available.
*/
do_action_deprecated(
'wpseo_import_other_plugins',
[],
'19.10',
'',
'This action is going away with no replacement. If you want to add settings that interact with Yoast SEO, please create your own settings page.'
);
?>
<input type="submit" class="button button-primary" name="import_external"
value="<?php esc_attr_e( 'Import', 'wordpress-seo' ); ?>"/>
</form>
</div>
<div class="tab-block">
<h3><?php esc_html_e( 'Step 3: Check your data', 'wordpress-seo' ); ?></h3>
<p>
<?php esc_html_e( 'Please check your posts and pages and see if the metadata was successfully imported.', 'wordpress-seo' ); ?>
</p>
</div>
<div class="tab-block">
<h3><?php esc_html_e( 'Step 4: Go through the first time configuration', 'wordpress-seo' ); ?></h3>
<p>
<?php
printf(
/* translators: 1: Link start tag to the First time configuration tab in the General page, 2: Link closing tag. */
esc_html__( 'You should finish the %1$sfirst time configuration%2$s to make sure your SEO data has been optimized and youve set the essential Yoast SEO settings for your site.', 'wordpress-seo' ),
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_dashboard#top#first-time-configuration' ) ) . '">',
'</a>'
);
?>
</p>
</div>
<div class="tab-block">
<h3><?php esc_html_e( 'Step 5: Clean up', 'wordpress-seo' ); ?></h3>
<p class="yoast-cleanup-explanation">
<?php esc_html_e( 'Once you\'re certain your site is OK, you can clean up. This will remove all the original data.', 'wordpress-seo' ); ?>
</p>
<form action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#import-seo' ) ); ?>"
method="post" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
<?php
wp_nonce_field( 'wpseo-clean-plugins', '_wpnonce', true, true );
wpseo_import_external_select( 'clean_external_plugin', $import_check->needs_import );
?>
<input type="submit" class="button button-primary" name="clean_external"
value="<?php esc_attr_e( 'Clean', 'wordpress-seo' ); ?>"/>
</form>
</div>

View File

@ -0,0 +1,39 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
/* translators: %1$s expands to Yoast SEO */
$submit_button_value = sprintf( __( 'Export your %1$s settings', 'wordpress-seo' ), 'Yoast SEO' );
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: The nonce will be verified in WPSEO_Export below, We are only strictly comparing with '1'.
if ( isset( $_POST['do_export'] ) && wp_unslash( $_POST['do_export'] ) === '1' ) {
$export = new WPSEO_Export();
$export->export();
return;
}
$wpseo_export_phrase = sprintf(
/* translators: %1$s expands to Yoast SEO */
__( 'Export your %1$s settings here, to copy them on another site.', 'wordpress-seo' ),
'Yoast SEO'
);
?>
<p><?php echo esc_html( $wpseo_export_phrase ); ?></p>
<form
action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#wpseo-export' ) ); ?>"
method="post"
accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
<?php wp_nonce_field( WPSEO_Export::NONCE_ACTION ); ?>
<input type="hidden" name="do_export" value="1" />
<button type="submit" class="button button-primary" id="export-button"><?php echo esc_html( $submit_button_value ); ?></button>
</form>

View File

@ -0,0 +1,46 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
if ( ! defined( 'WPSEO_NAMESPACES' ) || ! WPSEO_NAMESPACES ) {
esc_html_e( 'Import of settings is only supported on servers that run PHP 5.3 or higher.', 'wordpress-seo' );
return;
}
?>
<p id="settings-import-desc">
<?php
printf(
/* translators: 1: expands to Yoast SEO, 2: expands to Import settings. */
esc_html__( 'Import settings from another %1$s installation by pasting them here and clicking "%2$s".', 'wordpress-seo' ),
'Yoast SEO',
esc_html__( 'Import settings', 'wordpress-seo' )
);
?>
</p>
<form
action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#wpseo-import' ) ); ?>"
method="post"
accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
<?php wp_nonce_field( WPSEO_Import_Settings::NONCE_ACTION ); ?>
<label class="yoast-inline-label" for="settings-import">
<?php
printf(
/* translators: %s expands to Yoast SEO */
esc_html__( '%s settings to import:', 'wordpress-seo' ),
'Yoast SEO'
);
?>
</label><br />
<textarea id="settings-import" rows="10" cols="140" name="settings_import" aria-describedby="settings-import-desc"></textarea><br/>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Import settings', 'wordpress-seo' ); ?>"/>
</form>