first
This commit is contained in:
@ -0,0 +1,206 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing a feature toggle.
|
||||
*/
|
||||
class Yoast_Feature_Toggle {
|
||||
|
||||
/**
|
||||
* Feature toggle identifier.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* Name of the setting the feature toggle is associated with.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $setting = '';
|
||||
|
||||
/**
|
||||
* Whether the feature is premium or not.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $premium = false;
|
||||
|
||||
/**
|
||||
* Whether the feature is in beta or not.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $in_beta = false;
|
||||
|
||||
/**
|
||||
* The Premium version in which this feature has been added.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $premium_version = '';
|
||||
|
||||
/**
|
||||
* The languages in which this feature is supported.
|
||||
* E.g. for language specific analysis support.
|
||||
*
|
||||
* If empty, the feature is considered to have support in all languages.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $supported_languages = [];
|
||||
|
||||
/**
|
||||
* Feature toggle label.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $label = '';
|
||||
|
||||
/**
|
||||
* URL to learn more about the feature.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $read_more_url = '';
|
||||
|
||||
/**
|
||||
* URL to learn more about the premium feature.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $premium_url = '';
|
||||
|
||||
/**
|
||||
* URL to buy premium.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $premium_upsell_url = '';
|
||||
|
||||
/**
|
||||
* Label for the learn more link.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $read_more_label = '';
|
||||
|
||||
/**
|
||||
* Additional help content for the feature.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $extra = '';
|
||||
|
||||
/**
|
||||
* Additional content to be rendered after the toggle.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $after = '';
|
||||
|
||||
/**
|
||||
* Value to specify the feature toggle order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $order = 100;
|
||||
|
||||
/**
|
||||
* Disable the integration toggle.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $disabled = false;
|
||||
|
||||
/**
|
||||
* Whether the feature is new or not.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $new = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Sets the feature toggle arguments.
|
||||
*
|
||||
* @param array $args {
|
||||
* Feature toggle arguments.
|
||||
*
|
||||
* @type string $name Required. Feature toggle identifier.
|
||||
* @type string $setting Required. Name of the setting the feature toggle is associated with.
|
||||
* @type string $disabled Whether the feature is premium or not.
|
||||
* @type string $label Feature toggle label.
|
||||
* @type string $read_more_url URL to learn more about the feature. Default empty string.
|
||||
* @type string $premium_upsell_url URL to buy premium. Default empty string.
|
||||
* @type string $read_more_label Label for the learn more link. Default empty string.
|
||||
* @type string $extra Additional help content for the feature. Default empty string.
|
||||
* @type int $order Value to specify the feature toggle order. A lower value indicates
|
||||
* a higher priority. Default 100.
|
||||
* @type bool $disabled Disable the integration toggle. Default false.
|
||||
* @type string $new Whether the feature is new or not.
|
||||
* @type bool $in_beta Whether the feature is in beta or not.
|
||||
* @type array $supported_languages The languages that this feature supports.
|
||||
* @type string $premium_version The Premium version in which this feature was added.
|
||||
* }
|
||||
*
|
||||
* @throws InvalidArgumentException Thrown when a required argument is missing.
|
||||
*/
|
||||
public function __construct( array $args ) {
|
||||
$required_keys = [ 'name', 'setting' ];
|
||||
|
||||
foreach ( $required_keys as $key ) {
|
||||
if ( empty( $args[ $key ] ) ) {
|
||||
/* translators: %s: argument name */
|
||||
throw new InvalidArgumentException( sprintf( __( '%s is a required feature toggle argument.', 'wordpress-seo' ), $key ) );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $args as $key => $value ) {
|
||||
if ( property_exists( $this, $key ) ) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic isset-er.
|
||||
*
|
||||
* @param string $key Key to check whether a value for it is set.
|
||||
*
|
||||
* @return bool True if set, false otherwise.
|
||||
*/
|
||||
public function __isset( $key ) {
|
||||
return isset( $this->$key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic getter.
|
||||
*
|
||||
* @param string $key Key to get the value for.
|
||||
*
|
||||
* @return mixed Value for the key, or null if not set.
|
||||
*/
|
||||
public function __get( $key ) {
|
||||
if ( isset( $this->$key ) ) {
|
||||
return $this->$key;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the feature for this toggle is enabled.
|
||||
*
|
||||
* @return bool True if the feature is enabled, false otherwise.
|
||||
*/
|
||||
public function is_enabled() {
|
||||
return (bool) WPSEO_Options::get( $this->setting );
|
||||
}
|
||||
}
|
@ -0,0 +1,284 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Helpers\Language_Helper;
|
||||
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
|
||||
|
||||
/**
|
||||
* Class for managing feature toggles.
|
||||
*/
|
||||
class Yoast_Feature_Toggles {
|
||||
|
||||
/**
|
||||
* Available feature toggles.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $toggles;
|
||||
|
||||
/**
|
||||
* Instance holder.
|
||||
*
|
||||
* @var self|null
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Gets the main feature toggles manager instance used.
|
||||
*
|
||||
* This essentially works like a Singleton, but for its drawbacks does not restrict
|
||||
* instantiation otherwise.
|
||||
*
|
||||
* @return self Main instance.
|
||||
*/
|
||||
public static function instance() {
|
||||
if ( self::$instance === null ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all available feature toggles.
|
||||
*
|
||||
* @return array List of sorted Yoast_Feature_Toggle instances.
|
||||
*/
|
||||
public function get_all() {
|
||||
if ( $this->toggles === null ) {
|
||||
$this->toggles = $this->load_toggles();
|
||||
}
|
||||
|
||||
return $this->toggles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the available feature toggles.
|
||||
*
|
||||
* Also ensures that the toggles are all Yoast_Feature_Toggle instances and sorted by their order value.
|
||||
*
|
||||
* @return array List of sorted Yoast_Feature_Toggle instances.
|
||||
*/
|
||||
protected function load_toggles() {
|
||||
$xml_sitemap_extra = false;
|
||||
if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
|
||||
$xml_sitemap_extra = '<a href="' . esc_url( WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' ) )
|
||||
. '" target="_blank">' . esc_html__( 'See the XML sitemap.', 'wordpress-seo' ) . '</a>';
|
||||
}
|
||||
|
||||
$feature_toggles = [
|
||||
(object) [
|
||||
'name' => __( 'SEO analysis', 'wordpress-seo' ),
|
||||
'setting' => 'keyword_analysis_active',
|
||||
'label' => __( 'The SEO analysis offers suggestions to improve the SEO of your text.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Learn how the SEO analysis can help you rank.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/2ak',
|
||||
'order' => 10,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Readability analysis', 'wordpress-seo' ),
|
||||
'setting' => 'content_analysis_active',
|
||||
'label' => __( 'The readability analysis offers suggestions to improve the structure and style of your text.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Discover why readability is important for SEO.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/2ao',
|
||||
'order' => 20,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Inclusive language analysis', 'wordpress-seo' ),
|
||||
'supported_languages' => Language_Helper::$languages_with_inclusive_language_support,
|
||||
'setting' => 'inclusive_language_analysis_active',
|
||||
'label' => __( 'The inclusive language analysis offers suggestions to write more inclusive copy.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Discover why inclusive language is important for SEO.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/inclusive-language-features-free',
|
||||
'order' => 25,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Cornerstone content', 'wordpress-seo' ),
|
||||
'setting' => 'enable_cornerstone_content',
|
||||
'label' => __( 'The cornerstone content feature lets you to mark and filter cornerstone content on your website.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Find out how cornerstone content can help you improve your site structure.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/dashboard-help-cornerstone',
|
||||
'order' => 30,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Text link counter', 'wordpress-seo' ),
|
||||
'setting' => 'enable_text_link_counter',
|
||||
'label' => __( 'The text link counter helps you improve your site structure.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Find out how the text link counter can enhance your SEO.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/2aj',
|
||||
'order' => 40,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Insights', 'wordpress-seo' ),
|
||||
'setting' => 'enable_metabox_insights',
|
||||
'label' => __( 'Find relevant data about your content right in the Insights section in the Yoast SEO metabox. You’ll see what words you use most often and if they’re a match with your keywords! ', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Find out how Insights can help you improve your content.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/4ew',
|
||||
'premium_url' => 'https://yoa.st/2ai',
|
||||
'order' => 41,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Link suggestions', 'wordpress-seo' ),
|
||||
'premium' => true,
|
||||
'setting' => 'enable_link_suggestions',
|
||||
'label' => __( 'Get relevant internal linking suggestions — while you’re writing! The link suggestions metabox shows a list of posts on your blog with similar content that might be interesting to link to. ', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Read more about how internal linking can improve your site structure.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/4ev',
|
||||
'premium_url' => 'https://yoa.st/17g',
|
||||
'premium_upsell_url' => 'https://yoa.st/get-link-suggestions',
|
||||
'order' => 42,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'XML sitemaps', 'wordpress-seo' ),
|
||||
'setting' => 'enable_xml_sitemap',
|
||||
/* translators: %s: Yoast SEO */
|
||||
'label' => sprintf( __( 'Enable the XML sitemaps that %s generates.', 'wordpress-seo' ), 'Yoast SEO' ),
|
||||
'read_more_label' => __( 'Read why XML Sitemaps are important for your site.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/2a-',
|
||||
'extra' => $xml_sitemap_extra,
|
||||
'after' => $this->sitemaps_toggle_after(),
|
||||
'order' => 60,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Admin bar menu', 'wordpress-seo' ),
|
||||
'setting' => 'enable_admin_bar_menu',
|
||||
/* translators: 1: Yoast SEO */
|
||||
'label' => sprintf( __( 'The %1$s admin bar menu contains useful links to third-party tools for analyzing pages and makes it easy to see if you have new notifications.', 'wordpress-seo' ), 'Yoast SEO' ),
|
||||
'order' => 80,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Security: no advanced or schema settings for authors', 'wordpress-seo' ),
|
||||
'setting' => 'disableadvanced_meta',
|
||||
'label' => sprintf(
|
||||
/* translators: 1: Yoast SEO, 2: translated version of "Off" */
|
||||
__( 'The advanced section of the %1$s meta box allows a user to remove posts from the search results or change the canonical. The settings in the schema tab allows a user to change schema meta data for a post. These are things you might not want any author to do. That\'s why, by default, only editors and administrators can do this. Setting to "%2$s" allows all users to change these settings.', 'wordpress-seo' ),
|
||||
'Yoast SEO',
|
||||
__( 'Off', 'wordpress-seo' )
|
||||
),
|
||||
'order' => 90,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Usage tracking', 'wordpress-seo' ),
|
||||
'label' => __( 'Usage tracking', 'wordpress-seo' ),
|
||||
'setting' => 'tracking',
|
||||
'read_more_label' => sprintf(
|
||||
/* translators: 1: Yoast SEO */
|
||||
__( 'Allow us to track some data about your site to improve our plugin.', 'wordpress-seo' ),
|
||||
'Yoast SEO'
|
||||
),
|
||||
'read_more_url' => 'https://yoa.st/usage-tracking-2',
|
||||
'order' => 95,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'REST API: Head endpoint', 'wordpress-seo' ),
|
||||
'setting' => 'enable_headless_rest_endpoints',
|
||||
'label' => sprintf(
|
||||
/* translators: 1: Yoast SEO */
|
||||
__( 'This %1$s REST API endpoint gives you all the metadata you need for a specific URL. This will make it very easy for headless WordPress sites to use %1$s for all their SEO meta output.', 'wordpress-seo' ),
|
||||
'Yoast SEO'
|
||||
),
|
||||
'order' => 100,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'Enhanced Slack sharing', 'wordpress-seo' ),
|
||||
'setting' => 'enable_enhanced_slack_sharing',
|
||||
'label' => __( 'This adds an author byline and reading time estimate to the article’s snippet when shared on Slack.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Find out how a rich snippet can improve visibility and click-through-rate.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/help-slack-share',
|
||||
'order' => 105,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'IndexNow', 'wordpress-seo' ),
|
||||
'premium' => true,
|
||||
'setting' => 'enable_index_now',
|
||||
'label' => __( 'Automatically ping search engines like Bing and Yandex whenever you publish, update or delete a post.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Find out how IndexNow can help your site.', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/index-now-read-more',
|
||||
'premium_url' => 'https://yoa.st/index-now-feature',
|
||||
'premium_upsell_url' => 'https://yoa.st/get-indexnow',
|
||||
'order' => 110,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'AI title & description generator', 'wordpress-seo' ),
|
||||
'premium' => true,
|
||||
'setting' => 'enable_ai_generator',
|
||||
'label' => __( 'Use the power of Yoast AI to automatically generate compelling titles and descriptions for your posts and pages.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Learn more', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/ai-generator-read-more',
|
||||
'premium_url' => 'https://yoa.st/ai-generator-feature',
|
||||
'premium_upsell_url' => 'https://yoa.st/get-ai-generator',
|
||||
'order' => 115,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Filter to add feature toggles from add-ons.
|
||||
*
|
||||
* @param array $feature_toggles Array with feature toggle objects where each object
|
||||
* should have a `name`, `setting` and `label` property.
|
||||
*/
|
||||
$feature_toggles = apply_filters( 'wpseo_feature_toggles', $feature_toggles );
|
||||
|
||||
$feature_toggles = array_map( [ $this, 'ensure_toggle' ], $feature_toggles );
|
||||
usort( $feature_toggles, [ $this, 'sort_toggles_callback' ] );
|
||||
|
||||
return $feature_toggles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html for a warning that core sitemaps are enabled when yoast seo sitemaps are disabled.
|
||||
*
|
||||
* @return string HTML string for the warning.
|
||||
*/
|
||||
protected function sitemaps_toggle_after() {
|
||||
$out = '<div id="yoast-seo-sitemaps-disabled-warning" style="display:none;">';
|
||||
$alert = new Alert_Presenter(
|
||||
/* translators: %1$s: expands to an opening anchor tag, %2$s: expands to a closing anchor tag */
|
||||
\sprintf( esc_html__( 'Disabling Yoast SEO\'s XML sitemaps will not disable WordPress\' core sitemaps. In some cases, this %1$s may result in SEO errors on your site%2$s. These may be reported in Google Search Console and other tools.', 'wordpress-seo' ), '<a target="_blank" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/44z' ) . '">', '</a>' ),
|
||||
'warning'
|
||||
);
|
||||
$out .= $alert->present();
|
||||
$out .= '</div>';
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the passed value is a Yoast_Feature_Toggle.
|
||||
*
|
||||
* @param Yoast_Feature_Toggle|object|array $toggle_data Feature toggle instance, or raw object or array
|
||||
* containing feature toggle data.
|
||||
* @return Yoast_Feature_Toggle Feature toggle instance based on $toggle_data.
|
||||
*/
|
||||
protected function ensure_toggle( $toggle_data ) {
|
||||
if ( $toggle_data instanceof Yoast_Feature_Toggle ) {
|
||||
return $toggle_data;
|
||||
}
|
||||
|
||||
if ( is_object( $toggle_data ) ) {
|
||||
$toggle_data = get_object_vars( $toggle_data );
|
||||
}
|
||||
|
||||
return new Yoast_Feature_Toggle( $toggle_data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for sorting feature toggles by their order.
|
||||
*
|
||||
* {@internal Once the minimum PHP version goes up to PHP 7.0, the logic in the function
|
||||
* can be replaced with the spaceship operator `<=>`.}
|
||||
*
|
||||
* @param Yoast_Feature_Toggle $feature_a Feature A.
|
||||
* @param Yoast_Feature_Toggle $feature_b Feature B.
|
||||
*
|
||||
* @return int An integer less than, equal to, or greater than zero indicating respectively
|
||||
* that feature A is considered to be less than, equal to, or greater than feature B.
|
||||
*/
|
||||
protected function sort_toggles_callback( Yoast_Feature_Toggle $feature_a, Yoast_Feature_Toggle $feature_b ) {
|
||||
return ( $feature_a->order - $feature_b->order );
|
||||
}
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for generating a html select.
|
||||
*/
|
||||
class Yoast_Input_Select {
|
||||
|
||||
/**
|
||||
* The id attribute value.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $select_id;
|
||||
|
||||
/**
|
||||
* The name attribute value.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $select_name;
|
||||
|
||||
/**
|
||||
* Additional select attributes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $select_attributes = [];
|
||||
|
||||
/**
|
||||
* Array with the options to parse.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $select_options;
|
||||
|
||||
/**
|
||||
* The current selected option.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $selected_option;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $select_id ID for the select.
|
||||
* @param string $select_name Name for the select.
|
||||
* @param array $select_options Array with the options to parse.
|
||||
* @param string $selected_option The current selected option.
|
||||
*/
|
||||
public function __construct( $select_id, $select_name, array $select_options, $selected_option ) {
|
||||
$this->select_id = $select_id;
|
||||
$this->select_name = $select_name;
|
||||
$this->select_options = $select_options;
|
||||
$this->selected_option = $selected_option;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the rendered view.
|
||||
*/
|
||||
public function output_html() {
|
||||
// Extract it, because we want each value accessible via a variable instead of accessing it as an array.
|
||||
extract( $this->get_select_values() );
|
||||
|
||||
require WPSEO_PATH . 'admin/views/form/select.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the rendered view.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_html() {
|
||||
ob_start();
|
||||
|
||||
$this->output_html();
|
||||
|
||||
$rendered_output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $rendered_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an attribute to the attributes property.
|
||||
*
|
||||
* @param string $attribute The name of the attribute to add.
|
||||
* @param string $value The value of the attribute.
|
||||
*/
|
||||
public function add_attribute( $attribute, $value ) {
|
||||
$this->select_attributes[ $attribute ] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the set fields for the select.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function get_select_values() {
|
||||
return [
|
||||
'id' => $this->select_id,
|
||||
'name' => $this->select_name,
|
||||
'attributes' => $this->get_attributes(),
|
||||
'options' => $this->select_options,
|
||||
'selected' => $this->selected_option,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the attribute string, when there are attributes set.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function get_attributes() {
|
||||
$attributes = $this->select_attributes;
|
||||
|
||||
if ( ! empty( $attributes ) ) {
|
||||
array_walk( $attributes, [ $this, 'parse_attribute' ] );
|
||||
|
||||
return implode( ' ', $attributes ) . ' ';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an attribute from the attributes.
|
||||
*
|
||||
* @param string $value The value of the attribute.
|
||||
* @param string $attribute The attribute to look for.
|
||||
*/
|
||||
private function parse_attribute( &$value, $attribute ) {
|
||||
$value = sprintf( '%s="%s"', sanitize_key( $attribute ), esc_attr( $value ) );
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for managing integration toggles.
|
||||
*/
|
||||
class Yoast_Integration_Toggles {
|
||||
|
||||
/**
|
||||
* Available integration toggles.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $toggles;
|
||||
|
||||
/**
|
||||
* Instance holder.
|
||||
*
|
||||
* @var self|null
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Gets the main integration toggles manager instance used.
|
||||
*
|
||||
* This essentially works like a Singleton, but for its drawbacks does not restrict
|
||||
* instantiation otherwise.
|
||||
*
|
||||
* @return self Main instance.
|
||||
*/
|
||||
public static function instance() {
|
||||
if ( self::$instance === null ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all available integration toggles.
|
||||
*
|
||||
* @return array List of sorted Yoast_Feature_Toggle instances.
|
||||
*/
|
||||
public function get_all() {
|
||||
if ( $this->toggles === null ) {
|
||||
$this->toggles = $this->load_toggles();
|
||||
}
|
||||
|
||||
return $this->toggles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the available integration toggles.
|
||||
*
|
||||
* Also ensures that the toggles are all Yoast_Feature_Toggle instances and sorted by their order value.
|
||||
*
|
||||
* @return array List of sorted Yoast_Feature_Toggle instances.
|
||||
*/
|
||||
protected function load_toggles() {
|
||||
$integration_toggles = [
|
||||
(object) [
|
||||
/* translators: %s: 'Semrush' */
|
||||
'name' => sprintf( __( '%s integration', 'wordpress-seo' ), 'Semrush' ),
|
||||
'setting' => 'semrush_integration_active',
|
||||
'label' => sprintf(
|
||||
/* translators: %s: 'Semrush' */
|
||||
__( 'The %s integration offers suggestions and insights for keywords related to the entered focus keyphrase.', 'wordpress-seo' ),
|
||||
'Semrush'
|
||||
),
|
||||
'order' => 10,
|
||||
],
|
||||
(object) [
|
||||
/* translators: %s: Algolia. */
|
||||
'name' => \sprintf( \esc_html__( '%s integration', 'wordpress-seo' ), 'Algolia' ),
|
||||
'premium' => true,
|
||||
'setting' => 'algolia_integration_active',
|
||||
'label' => __( 'Improve the quality of your site search! Automatically helps your users find your cornerstone and most important content in your internal search results. It also removes noindexed posts & pages from your site’s search results.', 'wordpress-seo' ),
|
||||
/* translators: %s: Algolia. */
|
||||
'read_more_label' => \sprintf( \__( 'Find out more about our %s integration.', 'wordpress-seo' ), 'Algolia' ),
|
||||
'read_more_url' => 'https://yoa.st/4eu',
|
||||
'premium_url' => 'https://yoa.st/4ex',
|
||||
'premium_upsell_url' => 'https://yoa.st/get-algolia-integration',
|
||||
'order' => 25,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Filter to add integration toggles from add-ons.
|
||||
*
|
||||
* @param array $integration_toggles Array with integration toggle objects where each object
|
||||
* should have a `name`, `setting` and `label` property.
|
||||
*/
|
||||
$integration_toggles = apply_filters( 'wpseo_integration_toggles', $integration_toggles );
|
||||
|
||||
$integration_toggles = array_map( [ $this, 'ensure_toggle' ], $integration_toggles );
|
||||
usort( $integration_toggles, [ $this, 'sort_toggles_callback' ] );
|
||||
|
||||
return $integration_toggles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the passed value is a Yoast_Feature_Toggle.
|
||||
*
|
||||
* @param Yoast_Feature_Toggle|object|array $toggle_data Feature toggle instance, or raw object or array
|
||||
* containing integration toggle data.
|
||||
* @return Yoast_Feature_Toggle Feature toggle instance based on $toggle_data.
|
||||
*/
|
||||
protected function ensure_toggle( $toggle_data ) {
|
||||
if ( $toggle_data instanceof Yoast_Feature_Toggle ) {
|
||||
return $toggle_data;
|
||||
}
|
||||
|
||||
if ( is_object( $toggle_data ) ) {
|
||||
$toggle_data = get_object_vars( $toggle_data );
|
||||
}
|
||||
|
||||
return new Yoast_Feature_Toggle( $toggle_data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for sorting integration toggles by their order.
|
||||
*
|
||||
* {@internal Once the minimum PHP version goes up to PHP 7.0, the logic in the function
|
||||
* can be replaced with the spaceship operator `<=>`.}
|
||||
*
|
||||
* @param Yoast_Feature_Toggle $feature_a Feature A.
|
||||
* @param Yoast_Feature_Toggle $feature_b Feature B.
|
||||
*
|
||||
* @return int An integer less than, equal to, or greater than zero indicating respectively
|
||||
* that feature A is considered to be less than, equal to, or greater than feature B.
|
||||
*/
|
||||
protected function sort_toggles_callback( Yoast_Feature_Toggle $feature_a, Yoast_Feature_Toggle $feature_b ) {
|
||||
return ( $feature_a->order - $feature_b->order );
|
||||
}
|
||||
}
|
26
wp-content/plugins/wordpress-seo/admin/views/form/select.php
Normal file
26
wp-content/plugins/wordpress-seo/admin/views/form/select.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*
|
||||
* @uses string $attributes Additional attributes for the select.
|
||||
* @uses string $name Value for the select name attribute.
|
||||
* @uses string $id ID attribute for the select.
|
||||
* @uses array $options Array with the options to show.
|
||||
* @uses string $selected The current set options.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
<?php /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $attributes is properly escaped in parse_attribute via get_attributes in class-yoast-input-select.php. */ ?>
|
||||
<select <?php echo $attributes; ?>name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $id ); ?>">
|
||||
<?php foreach ( $options as $option_attribute_value => $option_html_value ) : ?>
|
||||
<option value="<?php echo esc_attr( $option_attribute_value ); ?>"<?php echo selected( $selected, $option_attribute_value, false ); ?>><?php echo esc_html( $option_html_value ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generate the HTML for a form element.
|
||||
*/
|
||||
interface Yoast_Form_Element {
|
||||
|
||||
/**
|
||||
* Return the HTML for the form element.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_html();
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/html" id="tmpl-primary-term-ui">
|
||||
<?php
|
||||
/* translators: accessibility text. %1$s expands to the term title, %2$s to the taxonomy title. */
|
||||
$yoast_free_js_button_label = __( 'Make %1$s primary %2$s', 'wordpress-seo' );
|
||||
$yoast_free_js_button_label = sprintf(
|
||||
$yoast_free_js_button_label,
|
||||
'{{data.term}}',
|
||||
'{{data.taxonomy.title}}'
|
||||
);
|
||||
|
||||
printf(
|
||||
'<button type="button" class="wpseo-make-primary-term" aria-label="%1$s">%2$s</button>',
|
||||
esc_attr( $yoast_free_js_button_label ),
|
||||
esc_html__( 'Make primary', 'wordpress-seo' )
|
||||
);
|
||||
?>
|
||||
|
||||
<span class="wpseo-is-primary-term" aria-hidden="true"><?php esc_html_e( 'Primary', 'wordpress-seo' ); ?></span>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-primary-term-screen-reader">
|
||||
<?php
|
||||
/* translators: %s is the taxonomy title. This will be shown to screenreaders */
|
||||
$yoast_free_js_taxonomy_title = __( 'Primary %s', 'wordpress-seo' );
|
||||
$yoast_free_js_taxonomy_title = sprintf(
|
||||
'(' . $yoast_free_js_taxonomy_title . ')',
|
||||
'{{data.taxonomy.title}}'
|
||||
);
|
||||
?>
|
||||
<span class="screen-reader-text wpseo-primary-category-label"><?php echo esc_html( $yoast_free_js_taxonomy_title ); ?></span>
|
||||
</script>
|
368
wp-content/plugins/wordpress-seo/admin/views/licenses.php
Normal file
368
wp-content/plugins/wordpress-seo/admin/views/licenses.php
Normal file
@ -0,0 +1,368 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
* @since 5.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
do_action( 'wpseo_install_and_activate_addons' );
|
||||
|
||||
$premium_extension = [
|
||||
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zz' ),
|
||||
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zy' ),
|
||||
'title' => 'Yoast SEO Premium',
|
||||
/* translators: %1$s expands to Yoast SEO */
|
||||
'desc' => sprintf( __( 'The premium version of %1$s with more features & support.', 'wordpress-seo' ), 'Yoast SEO' ),
|
||||
'benefits' => [],
|
||||
];
|
||||
|
||||
$extensions = [
|
||||
WPSEO_Addon_Manager::LOCAL_SLUG => [
|
||||
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zt' ),
|
||||
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zs' ),
|
||||
'title' => 'Local SEO',
|
||||
'display_title' => __( 'Maximize your visibility for local searches', 'wordpress-seo' ),
|
||||
'desc' => __( 'Rank better locally and in Google Maps, without breaking a sweat!', 'wordpress-seo' ),
|
||||
'image' => plugins_url( 'images/local_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ),
|
||||
'benefits' => [
|
||||
__( 'Attract more local customers to your website and physical store', 'wordpress-seo' ),
|
||||
__( 'Automatically get technical SEO best practices for local businesses', 'wordpress-seo' ),
|
||||
__( 'Easily add maps, address finders, and opening hours to your content', 'wordpress-seo' ),
|
||||
__( 'Optimize your business for multiple locations', 'wordpress-seo' ),
|
||||
],
|
||||
],
|
||||
WPSEO_Addon_Manager::VIDEO_SLUG => [
|
||||
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zx/' ),
|
||||
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zw/' ),
|
||||
'title' => 'Video SEO',
|
||||
'display_title' => __( 'Drive more traffic to your videos', 'wordpress-seo' ),
|
||||
'desc' => __( 'Optimize your videos to show them off in search results and get more clicks!', 'wordpress-seo' ),
|
||||
'image' => plugins_url( 'images/video_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ),
|
||||
'benefits' => [
|
||||
__( 'Know that Google discovers your videos', 'wordpress-seo' ),
|
||||
__( 'Load pages faster that include videos', 'wordpress-seo' ),
|
||||
__( 'Make your videos responsive for all screen sizes', 'wordpress-seo' ),
|
||||
__( 'Get XML video sitemaps', 'wordpress-seo' ),
|
||||
],
|
||||
],
|
||||
WPSEO_Addon_Manager::NEWS_SLUG => [
|
||||
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zv/' ),
|
||||
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zu/' ),
|
||||
'title' => 'News SEO',
|
||||
'display_title' => __( 'Rank higher in Google\'s news carousel', 'wordpress-seo' ),
|
||||
'desc' => __( 'Are you in Google News? Increase your traffic from Google News by optimizing for it!', 'wordpress-seo' ),
|
||||
'image' => plugins_url( 'images/news_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ),
|
||||
'benefits' => [
|
||||
__( 'Optimize your site for Google News', 'wordpress-seo' ),
|
||||
__( 'Ping Google on the publication of a new post', 'wordpress-seo' ),
|
||||
__( 'Add all necessary schema.org markup', 'wordpress-seo' ),
|
||||
__( 'Get XML news sitemaps', 'wordpress-seo' ),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Add Yoast WooCommerce SEO when WooCommerce is active.
|
||||
if ( YoastSEO()->helpers->woocommerce->is_active() ) {
|
||||
$extensions[ WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ] = [
|
||||
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zr' ),
|
||||
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zq' ),
|
||||
'title' => 'Yoast WooCommerce SEO',
|
||||
'display_title' => __( 'Drive more traffic to your online store', 'wordpress-seo' ),
|
||||
/* translators: %1$s expands to Yoast SEO */
|
||||
'desc' => sprintf( __( 'Seamlessly integrate WooCommerce with %1$s and get extra features!', 'wordpress-seo' ), 'Yoast SEO' ),
|
||||
'image' => plugins_url( 'images/woo_plugin_assistant.svg?v=' . WPSEO_VERSION, WPSEO_FILE ),
|
||||
'benefits' => [
|
||||
__( 'Write product pages that rank with the enhanced SEO analysis', 'wordpress-seo' ),
|
||||
__( 'Increase clicks of Google search with rich results', 'wordpress-seo' ),
|
||||
__( 'Add global identifiers for variable products', 'wordpress-seo' ),
|
||||
/* translators: %1$s expands to Yoast SEO, %2$s expands to WooCommerce */
|
||||
sprintf( __( 'Seamless integration between %1$s and %2$s', 'wordpress-seo' ), 'Yoast SEO', 'WooCommerce' ),
|
||||
],
|
||||
'buy_button' => 'WooCommerce SEO',
|
||||
];
|
||||
}
|
||||
|
||||
// The total number of plugins to consider is the length of the array + 1 for Premium.
|
||||
// @phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||
$number_plugins_total = ( count( $extensions ) + 1 );
|
||||
// @phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||
$number_plugins_active = 0;
|
||||
|
||||
$extensions['yoast-seo-plugin-subscription'] = [
|
||||
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/premium-page-bundle-buy' ),
|
||||
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/premium-page-bundle-info' ),
|
||||
/* translators: used in phrases such as "More information about all the Yoast plugins" */
|
||||
'title' => __( 'all the Yoast plugins', 'wordpress-seo' ),
|
||||
'display_title' => __( 'Cover all your SEO bases', 'wordpress-seo' ),
|
||||
'desc' => '',
|
||||
'image' => plugins_url( 'images/plugin_subscription.svg?v=' . WPSEO_VERSION, WPSEO_FILE ),
|
||||
'benefits' => [
|
||||
__( 'Get all 5 Yoast plugins for WordPress with a big discount', 'wordpress-seo' ),
|
||||
__( 'Reach new customers that live near your business', 'wordpress-seo' ),
|
||||
__( 'Drive more traffic with your videos', 'wordpress-seo' ),
|
||||
__( 'Rank higher in Google\'s news carousel', 'wordpress-seo' ),
|
||||
__( 'Drive more traffic to your online store', 'wordpress-seo' ),
|
||||
|
||||
],
|
||||
/* translators: used in phrases such as "Buy all the Yoast plugins" */
|
||||
'buy_button' => __( 'all the Yoast plugins', 'wordpress-seo' ),
|
||||
];
|
||||
|
||||
$addon_manager = new WPSEO_Addon_Manager();
|
||||
$has_valid_premium_subscription = YoastSEO()->helpers->product->is_premium() && $addon_manager->has_valid_subscription( WPSEO_Addon_Manager::PREMIUM_SLUG );
|
||||
|
||||
/* translators: %1$s expands to Yoast SEO. */
|
||||
$wpseo_extensions_header = sprintf( __( '%1$s Extensions', 'wordpress-seo' ), 'Yoast SEO' );
|
||||
$new_tab_message = sprintf(
|
||||
'<span class="screen-reader-text">%1$s</span>',
|
||||
esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' )
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap yoast wpseo_table_page">
|
||||
|
||||
<h1 id="wpseo-title" class="yoast-h1"><?php echo esc_html( $wpseo_extensions_header ); ?></h1>
|
||||
|
||||
<div id="extensions">
|
||||
<section class="yoast-seo-premium-extension">
|
||||
<h2>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: expands to a opening span tag, 2: expands to a closing span tag, 3: expands to Yoast SEO Premium */
|
||||
esc_html__( '%1$sDrive more traffic to your site%2$s with %3$s', 'wordpress-seo' ),
|
||||
'<span class="yoast-heading-highlight">',
|
||||
'</span>',
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
|
||||
$premium_extension['title']
|
||||
);
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<?php
|
||||
if ( ! $has_valid_premium_subscription ) :
|
||||
?>
|
||||
<ul class="yoast-seo-premium-benefits yoast-list--usp">
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Be more efficient in creating content', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Use AI to create high-quality titles and meta descriptions for posts and pages', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Reach bigger audiences', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Optimize a single post for synonyms and related keyphrases and get extra checks with the Premium SEO analysis', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Save time on doing SEO', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'The Yoast SEO workouts guide you through important routine SEO tasks', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Improve your internal linking structure', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Get tools that tell you where and how to improve internal linking', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Reduce your site\'s carbon footprint', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Save energy by reducing the crawlability of your site without hurting your rankings!', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Prevents 404s', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Easily create and manage redirects when you move or delete content', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Stand out on social media', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Check what your Facebook or Twitter post will look like before posting them', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Premium support', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Gain access to our 24/7 support team', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php if ( $addon_manager->is_installed( WPSEO_Addon_Manager::PREMIUM_SLUG ) ) : ?>
|
||||
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-installed"><?php esc_html_e( 'Installed', 'wordpress-seo' ); ?></div>
|
||||
|
||||
<?php
|
||||
if ( $has_valid_premium_subscription ) :
|
||||
++$number_plugins_active;
|
||||
?>
|
||||
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div>
|
||||
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>" class="yoast-link--license">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s expands to the extension title */
|
||||
esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ),
|
||||
esc_html( $premium_extension['title'] )
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
|
||||
echo $new_tab_message;
|
||||
?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-not-activated"><?php esc_html_e( 'Not activated', 'wordpress-seo' ); ?></div>
|
||||
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>" class="yoast-link--license">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s expands to the extension title */
|
||||
esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ),
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
|
||||
esc_html( $premium_extension['title'] )
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
|
||||
echo $new_tab_message;
|
||||
?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<a target="_blank" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="<?php echo esc_url( $premium_extension['buyUrl'] ); ?>" class="yoast-button-upsell">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: $s expands to Yoast SEO Premium */
|
||||
esc_html__( 'Buy %s', 'wordpress-seo' ),
|
||||
esc_html( $premium_extension['title'] )
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
|
||||
echo $new_tab_message;
|
||||
echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
|
||||
?>
|
||||
</a>
|
||||
|
||||
<a target="_blank" href="<?php echo esc_url( $premium_extension['infoUrl'] ); ?>" class="yoast-link--more-info">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: Text between 1: and 2: will only be shown to screen readers. 3: expands to the product name. */
|
||||
esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ),
|
||||
'<span class="screen-reader-text">',
|
||||
'</span>',
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
|
||||
$premium_extension['title']
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
|
||||
echo $new_tab_message;
|
||||
?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! $has_valid_premium_subscription ) { ?>
|
||||
<p>
|
||||
<small class="yoast-money-back-guarantee"><?php esc_html_e( 'With 30-day money-back guarantee. No questions asked.', 'wordpress-seo' ); ?></small>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</section>
|
||||
|
||||
<hr class="yoast-hr" aria-hidden="true"/>
|
||||
|
||||
<section class="yoast-promo-extensions">
|
||||
<h2>
|
||||
<?php
|
||||
$yoast_outrank_copy = sprintf( esc_html__( 'Outrank your competitors even further', 'wordpress-seo' ) );
|
||||
$yoast_outrank_copy = '<span class="yoast-heading-highlight">' . $yoast_outrank_copy . '</span>';
|
||||
|
||||
printf(
|
||||
/* translators: 1: expands to Outrank your competitors even further, 2: expands to Yoast SEO */
|
||||
esc_html__( '%1$s with %2$s extensions', 'wordpress-seo' ),
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $yoast_seo_extensions is properly escaped.
|
||||
$yoast_outrank_copy,
|
||||
'Yoast SEO'
|
||||
);
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<?php
|
||||
foreach ( $extensions as $slug => $extension ) :
|
||||
|
||||
// Skip the "All the plugins" card if the user has already all the plugins active.
|
||||
if ( $slug === 'yoast-seo-plugin-subscription' && $number_plugins_active === $number_plugins_total ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<section class="yoast-promoblock secondary yoast-promo-extension">
|
||||
<h3>
|
||||
<img alt="" width="100" height="100" src="<?php echo esc_url( $extension['image'] ); ?>"/>
|
||||
<?php echo esc_html( $extension['display_title'] ); ?>
|
||||
</h3>
|
||||
<ul class="yoast-list--usp">
|
||||
<?php foreach ( $extension['benefits'] as $benefit ) : ?>
|
||||
<li><?php echo esc_html( $benefit ); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<div class="yoast-button-container">
|
||||
<?php if ( $addon_manager->is_installed( $slug ) ) : ?>
|
||||
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-installed"><?php esc_html_e( 'Installed', 'wordpress-seo' ); ?></div>
|
||||
|
||||
<?php
|
||||
if ( $addon_manager->has_valid_subscription( $slug ) ) :
|
||||
++$number_plugins_active;
|
||||
?>
|
||||
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div>
|
||||
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>" class="yoast-link--license">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s expands to the extension title */
|
||||
esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ),
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
|
||||
$extension['title']
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
|
||||
echo $new_tab_message;
|
||||
?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-not-activated"><?php esc_html_e( 'Not activated', 'wordpress-seo' ); ?></div>
|
||||
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>" class="yoast-link--license">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s expands to the extension title */
|
||||
esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ),
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
|
||||
$extension['title']
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
|
||||
echo $new_tab_message;
|
||||
?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<a target="_blank" class="yoast-button-upsell" href="<?php echo esc_url( $extension['buyUrl'] ); ?>">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s expands to the product name, e.g. "News SEO" or "all the Yoast Plugins" */
|
||||
esc_html__( 'Buy %s', 'wordpress-seo' ),
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The possible `get_buy_button` values are hardcoded (buy_button or title); only passed through the WPSEO_Extensions class.
|
||||
( isset( $extension['buy_button'] ) ) ? $extension['buy_button'] : $extension['title']
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
|
||||
echo $new_tab_message;
|
||||
echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
|
||||
?>
|
||||
</a>
|
||||
|
||||
<a target="_blank" class="yoast-link--more-info" href="<?php echo esc_url( $extension['infoUrl'] ); ?>">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: Text between 1: and 2: will only be shown to screen readers. 3: expands to the product name, e.g. "News SEO" or "all the Yoast Plugins" */
|
||||
esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ),
|
||||
'<span class="screen-reader-text">',
|
||||
'</span>',
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
|
||||
$extension['title']
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
|
||||
echo $new_tab_message;
|
||||
?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin\Views
|
||||
*
|
||||
* @uses string $paper_id The ID of the paper.
|
||||
* @uses string $paper_id_prefix The ID prefix of the paper.
|
||||
* @uses bool $collapsible Whether the collapsible should be rendered.
|
||||
* @uses array $collapsible_config Configuration for the collapsible.
|
||||
* @uses string $collapsible_header_class Class for the collapsible header.
|
||||
* @uses string $title The title.
|
||||
* @uses string $title_after Additional content to render after the title.
|
||||
* @uses string $view_file Path to the view file.
|
||||
* @uses WPSEO_Admin_Help_Panel $help_text The help text.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
<div
|
||||
class="<?php echo esc_attr( 'paper tab-block ' . $class ); ?>"<?php echo ( $paper_id ) ? ' id="' . esc_attr( $paper_id_prefix . $paper_id ) . '"' : ''; ?>>
|
||||
|
||||
<?php
|
||||
if ( ! empty( $title ) ) {
|
||||
|
||||
if ( ! empty( $collapsible ) ) {
|
||||
|
||||
$button_id_attr = '';
|
||||
if ( ! empty( $paper_id ) ) {
|
||||
$button_id_attr = sprintf( ' id="%s"', esc_attr( $paper_id_prefix . $paper_id . '-button' ) );
|
||||
}
|
||||
|
||||
printf(
|
||||
'<h2 class="%1$s"><button%2$s type="button" class="toggleable-container-trigger" aria-expanded="%3$s">%4$s%5$s <span class="toggleable-container-icon dashicons %6$s" aria-hidden="true"></span></button></h2>',
|
||||
esc_attr( 'collapsible-header ' . $collapsible_header_class ),
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput -- $button_id_attr is escaped above.
|
||||
$button_id_attr,
|
||||
esc_attr( $collapsible_config['expanded'] ),
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput -- $help_text is an instance of WPSEO_Admin_Help_Panel, which escapes it's own output.
|
||||
$help_text->get_button_html(),
|
||||
esc_html( $title ) . wp_kses_post( $title_after ),
|
||||
wp_kses_post( $collapsible_config['toggle_icon'] )
|
||||
);
|
||||
}
|
||||
else {
|
||||
echo '<div class="paper-title"><h2 class="help-button-inline">',
|
||||
esc_html( $title ),
|
||||
wp_kses_post( $title_after ),
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput -- $help_text is an instance of WPSEO_Admin_Help_Panel, which escapes it's own output.
|
||||
$help_text->get_button_html(),
|
||||
'</h2></div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput -- $help_text is an instance of WPSEO_Admin_Help_Panel, which escapes it's own output.
|
||||
echo $help_text->get_panel_html();
|
||||
|
||||
$container_id_attr = '';
|
||||
if ( ! empty( $paper_id ) ) {
|
||||
$container_id_attr = sprintf( ' id="%s"', esc_attr( $paper_id_prefix . $paper_id . '-container' ) );
|
||||
}
|
||||
|
||||
printf(
|
||||
'<div%1$s class="%2$s">%3$s</div>',
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput -- $container_id_attr is escaped above.
|
||||
$container_id_attr,
|
||||
esc_attr( 'paper-container ' . $collapsible_config['class'] ),
|
||||
$content
|
||||
);
|
||||
?>
|
||||
|
||||
</div>
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*
|
||||
* @uses array $notifications_data
|
||||
*/
|
||||
|
||||
$yoast_seo_type = 'errors';
|
||||
$yoast_seo_dashicon = 'warning';
|
||||
|
||||
$yoast_seo_active = $notifications_data['errors']['active'];
|
||||
$yoast_seo_dismissed = $notifications_data['errors']['dismissed'];
|
||||
|
||||
$yoast_seo_active_total = count( $yoast_seo_active );
|
||||
$yoast_seo_dismissed_total = count( $yoast_seo_dismissed );
|
||||
$yoast_seo_total = $notifications_data['metrics']['errors'];
|
||||
|
||||
$yoast_seo_i18n_title = __( 'Problems', 'wordpress-seo' );
|
||||
$yoast_seo_i18n_issues = __( 'We have detected the following issues that affect the SEO of your site.', 'wordpress-seo' );
|
||||
$yoast_seo_i18n_no_issues = __( 'Good job! We could detect no serious SEO problems.', 'wordpress-seo' );
|
||||
$yoast_seo_i18n_muted_issues_title = sprintf(
|
||||
/* translators: %d expands the amount of hidden problems. */
|
||||
_n( 'You have %d hidden problem:', 'You have %d hidden problems:', $yoast_seo_dismissed_total, 'wordpress-seo' ),
|
||||
$yoast_seo_dismissed_total
|
||||
);
|
||||
|
||||
require WPSEO_PATH . 'admin/views/partial-notifications-template.php';
|
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*
|
||||
* @uses string $yoast_seo_type
|
||||
* @uses string $yoast_seo_dashicon
|
||||
* @uses string $yoast_seo_i18n_title
|
||||
* @uses string $yoast_seo_i18n_issues
|
||||
* @uses string $yoast_seo_i18n_no_issues
|
||||
* @uses string $yoast_seo_i18n_muted_issues_title
|
||||
* @uses int $yoast_seo_active_total
|
||||
* @uses int $yoast_seo_dismissed_total
|
||||
* @uses int $yoast_seo_total
|
||||
* @uses array $yoast_seo_active
|
||||
* @uses array $yoast_seo_dismissed
|
||||
*/
|
||||
|
||||
if ( ! function_exists( '_yoast_display_notifications' ) ) {
|
||||
/**
|
||||
* Create the notifications HTML with restore/dismiss button.
|
||||
*
|
||||
* @param array $notifications_list List of notifications.
|
||||
* @param string $status Status of the notifications (active/dismissed).
|
||||
*
|
||||
* @return string The output to render.
|
||||
*/
|
||||
function _yoast_display_notifications( $notifications_list, $status ) {
|
||||
$notifications = '';
|
||||
|
||||
foreach ( $notifications_list as $notification ) {
|
||||
|
||||
switch ( $status ) {
|
||||
case 'active':
|
||||
$button = sprintf(
|
||||
'<button type="button" class="button dismiss"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-hidden"></span></button>',
|
||||
esc_html__( 'Hide this item.', 'wordpress-seo' )
|
||||
);
|
||||
break;
|
||||
|
||||
case 'dismissed':
|
||||
$button = sprintf(
|
||||
'<button type="button" class="button restore"><span class="screen-reader-text">%1$s</span><span class="dashicons yoast-svg-icon-eye"></span></button>',
|
||||
esc_html__( 'Show this item.', 'wordpress-seo' )
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$notifications .= sprintf(
|
||||
'<div class="yoast-notification-holder" id="%1$s" data-nonce="%2$s" data-json="%3$s">%4$s%5$s</div>',
|
||||
esc_attr( $notification->get_id() ),
|
||||
esc_attr( $notification->get_nonce() ),
|
||||
esc_attr( $notification->get_json() ),
|
||||
// This needs to be fixed in https://github.com/Yoast/wordpress-seo-premium/issues/2548.
|
||||
$notification,
|
||||
// Note: $button is properly escaped above.
|
||||
$button
|
||||
);
|
||||
}
|
||||
|
||||
return $notifications;
|
||||
}
|
||||
}
|
||||
|
||||
$wpseo_i18n_summary = $yoast_seo_i18n_issues;
|
||||
if ( ! $yoast_seo_active ) {
|
||||
$yoast_seo_dashicon = 'yes';
|
||||
$wpseo_i18n_summary = $yoast_seo_i18n_no_issues;
|
||||
}
|
||||
|
||||
?>
|
||||
<h3 class="yoast-notifications-header" id="<?php echo esc_attr( 'yoast-' . $yoast_seo_type . '-header' ); ?>">
|
||||
<span class="dashicons <?php echo esc_attr( 'dashicons-' . $yoast_seo_dashicon ); ?>"></span>
|
||||
<?php echo esc_html( $yoast_seo_i18n_title ); ?> (<?php echo (int) $yoast_seo_active_total; ?>)
|
||||
</h3>
|
||||
|
||||
<div id="<?php echo esc_attr( 'yoast-' . $yoast_seo_type ); ?>">
|
||||
|
||||
<?php if ( $yoast_seo_total ) : ?>
|
||||
<p><?php echo esc_html( $wpseo_i18n_summary ); ?></p>
|
||||
|
||||
<div class="container yoast-notifications-active" id="<?php echo esc_attr( 'yoast-' . $yoast_seo_type . '-active' ); ?>">
|
||||
<?php
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: _yoast_display_notifications() as declared above is safe.
|
||||
echo _yoast_display_notifications( $yoast_seo_active, 'active' );
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ( $yoast_seo_dismissed ) {
|
||||
$dismissed_paper = new WPSEO_Paper_Presenter(
|
||||
esc_html( $yoast_seo_i18n_muted_issues_title ),
|
||||
null,
|
||||
[
|
||||
'paper_id' => esc_attr( $yoast_seo_type . '-dismissed' ),
|
||||
'paper_id_prefix' => 'yoast-',
|
||||
'class' => 'yoast-notifications-dismissed',
|
||||
'content' => _yoast_display_notifications( $yoast_seo_dismissed, 'dismissed' ),
|
||||
'collapsible' => true,
|
||||
'collapsible_header_class' => 'yoast-notification',
|
||||
]
|
||||
);
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: get_output() output is properly escaped.
|
||||
echo $dismissed_paper->get_output();
|
||||
}
|
||||
?>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php echo esc_html( $yoast_seo_i18n_no_issues ); ?></p>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*
|
||||
* @uses array $notifications_data
|
||||
*/
|
||||
|
||||
$yoast_seo_type = 'warnings';
|
||||
$yoast_seo_dashicon = 'flag';
|
||||
|
||||
$yoast_seo_active = $notifications_data['warnings']['active'];
|
||||
$yoast_seo_dismissed = $notifications_data['warnings']['dismissed'];
|
||||
|
||||
$yoast_seo_active_total = count( $notifications_data['warnings']['active'] );
|
||||
$yoast_seo_dismissed_total = count( $notifications_data['warnings']['dismissed'] );
|
||||
$yoast_seo_total = $notifications_data['metrics']['warnings'];
|
||||
|
||||
$yoast_seo_i18n_title = __( 'Notifications', 'wordpress-seo' );
|
||||
$yoast_seo_i18n_issues = '';
|
||||
$yoast_seo_i18n_no_issues = __( 'No new notifications.', 'wordpress-seo' );
|
||||
$yoast_seo_i18n_muted_issues_title = sprintf(
|
||||
/* translators: %d expands the amount of hidden notifications. */
|
||||
_n( 'You have %d hidden notification:', 'You have %d hidden notifications:', $yoast_seo_dismissed_total, 'wordpress-seo' ),
|
||||
$yoast_seo_dismissed_total
|
||||
);
|
||||
|
||||
require WPSEO_PATH . 'admin/views/partial-notifications-template.php';
|
237
wp-content/plugins/wordpress-seo/admin/views/redirects.php
Normal file
237
wp-content/plugins/wordpress-seo/admin/views/redirects.php
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
* @since 19.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap yoast wpseo-admin-page page-wpseo_redirects">
|
||||
<h1 id="wpseo-title"><?php echo \esc_html( \get_admin_page_title() ); ?></h1>
|
||||
<div class="wpseo_content_wrapper" style="position: relative;">
|
||||
<div style="position: absolute;top: 0;bottom: 0;left: 0;right: 0;z-index: 100; display: flex;justify-content: center;align-items: center;background: radial-gradient(#ffffffcf 20%, #ffffff00 50%);">
|
||||
<a class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="<?php echo \esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/4e0/' ) ); ?>" target="_blank">
|
||||
<?php
|
||||
echo \esc_html__( 'Unlock with Premium', 'wordpress-seo' )
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput -- Already escapes correctly.
|
||||
. WPSEO_Admin_Utils::get_new_tab_message();
|
||||
?>
|
||||
<span aria-hidden="true" class="yoast-button-upsell__caret"></span></a>
|
||||
</div>
|
||||
<div class="wpseo_content_cell" id="wpseo_content_top" style="opacity: 0.5;">
|
||||
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
|
||||
<a class="nav-tab nav-tab-active" id="tab-url-tab" href="#" tabindex="-1">
|
||||
<?php
|
||||
\esc_html_e( 'Redirects', 'wordpress-seo' )
|
||||
?>
|
||||
</a>
|
||||
<a class="nav-tab" id="tab-url-tab" href="" tabindex="-1">
|
||||
<?php
|
||||
\esc_html_e( 'Regex Redirects', 'wordpress-seo' )
|
||||
?>
|
||||
</a>
|
||||
<a class="nav-tab" id="tab-url-tab" href="#" tabindex="-1">
|
||||
<?php
|
||||
\esc_html_e( 'Settings', 'wordpress-seo' )
|
||||
?>
|
||||
</a>
|
||||
</h2>
|
||||
|
||||
<div id="table-plain" class="tab-url redirect-table-tab">
|
||||
<h2>
|
||||
<?php
|
||||
\esc_html_e( 'Plain redirects', 'wordpress-seo' )
|
||||
?>
|
||||
</h2>
|
||||
<form class="wpseo-new-redirect-form" method="post">
|
||||
<div class="wpseo_redirect_form">
|
||||
<div class="redirect_form_row" id="row-wpseo_redirects_type">
|
||||
<label class="textinput" for="wpseo_redirects_type">
|
||||
<span class="title">
|
||||
<?php
|
||||
\esc_html_e( 'Type', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
</label>
|
||||
<select name="wpseo_redirects_type" id="wpseo_redirects_type" class="select select2-hidden-accessible" data-select2-id="wpseo_redirects_type" tabindex="-1" aria-hidden="true">
|
||||
<option value="301" data-select2-id="2">
|
||||
<?php
|
||||
\esc_html_e( '301 Moved Permanently', 'wordpress-seo' )
|
||||
?>
|
||||
</option>
|
||||
</select>
|
||||
<span class="select2 select2-container select2-container--default" dir="ltr" data-select2-id="1" style="width: 400px;">
|
||||
<span class="selection">
|
||||
<span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="-1" aria-disabled="false" aria-labelledby="select2-wpseo_redirects_type-container">
|
||||
<span class="select2-selection__rendered" id="select2-wpseo_redirects_type-container" role="textbox" aria-readonly="true" title="301 Moved Permanently">
|
||||
<?php
|
||||
\esc_html_e( '301 Moved Permanently', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
<span class="select2-selection__arrow" role="presentation">
|
||||
<b role="presentation"></b>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span class="dropdown-wrapper" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p class="label desc description wpseo-redirect-clear">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: opens a link. 2: closes the link. */
|
||||
esc_html__( 'The redirect type is the HTTP response code sent to the browser telling the browser what type of redirect is served. %1$sLearn more about redirect types%2$s.', 'wordpress-seo' ),
|
||||
'<a href="#" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
<div class="redirect_form_row" id="row-wpseo_redirects_origin">
|
||||
<label class="textinput" for="wpseo_redirects_origin">
|
||||
<span class="title">
|
||||
<?php
|
||||
\esc_html_e( 'Old URL', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
</label>
|
||||
<input type="text" class="textinput" name="wpseo_redirects_origin" id="wpseo_redirects_origin" value="" tabindex="-1">
|
||||
</div>
|
||||
<br class="clear">
|
||||
|
||||
<div class="redirect_form_row wpseo_redirect_target_holder" id="row-wpseo_redirects_target">
|
||||
<label class="textinput" for="wpseo_redirects_target">
|
||||
<span class="title">
|
||||
<?php
|
||||
\esc_html_e( 'URL', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
</label>
|
||||
<input type="text" class="textinput" name="wpseo_redirects_target" id="wpseo_redirects_target" value="" tabindex="-1">
|
||||
</div>
|
||||
<br class="clear">
|
||||
|
||||
<button type="button" class="button button-primary" tabindex="-1">
|
||||
<?php
|
||||
\esc_html_e( 'Add Redirect', 'wordpress-seo' )
|
||||
?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<p class="desc"> </p>
|
||||
<form id="plain" class="wpseo-redirects-table-form" method="post" action="">
|
||||
<input type="hidden" class="wpseo_redirects_ajax_nonce" name="wpseo_redirects_ajax_nonce" value="6ccb86df42">
|
||||
<input type="hidden" id="_wpnonce" name="_wpnonce" value="4b02cca185">
|
||||
<input type="hidden" name="_wp_http_referer" value="/wp-admin/admin.php?page=wpseo_redirects"> <div class="tablenav top">
|
||||
|
||||
<div class="alignleft actions">
|
||||
<select name="redirect-type" id="filter-by-redirect" tabindex="-1">
|
||||
<option selected="selected" value="0">
|
||||
<?php
|
||||
\esc_html_e( 'All redirect types', 'wordpress-seo' )
|
||||
?>
|
||||
</option>
|
||||
</select>
|
||||
<input type="button" name="filter_action" id="post-query-submit" class="button" value="<?php \esc_attr_e( 'Filter', 'wordpress-seo' ); ?>" tabindex="-1">
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
<table class="wp-list-table widefat fixed striped table-view-list plain">
|
||||
<thead>
|
||||
<tr>
|
||||
<td id="cb" class="manage-column column-cb check-column">
|
||||
<input id="cb-select-all-1" type="checkbox" tabindex="-1">
|
||||
</td>
|
||||
<th scope="col" id="type" class="manage-column column-type column-primary sortable desc">
|
||||
<a href="#" tabindex="-1">
|
||||
<span>
|
||||
<?php
|
||||
\esc_html_e( 'Type', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
<span class="sorting-indicator"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th scope="col" id="old" class="manage-column column-old sortable desc">
|
||||
<a href="#" tabindex="-1">
|
||||
<span>
|
||||
<?php
|
||||
\esc_html_e( 'Old URL', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
<span class="sorting-indicator"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th scope="col" id="new" class="manage-column column-new sortable desc">
|
||||
<a href="#" tabindex="-1">
|
||||
<span>
|
||||
<?php
|
||||
\esc_html_e( 'New URL', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
<span class="sorting-indicator"></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="the-list">
|
||||
<tr class="no-items">
|
||||
<td class="colspanchange" colspan="4">
|
||||
<?php
|
||||
\esc_html_e( 'No items found.', 'wordpress-seo' )
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="manage-column column-cb check-column">
|
||||
<input id="cb-select-all-2" type="checkbox" tabindex="-1">
|
||||
</td>
|
||||
<th scope="col" class="manage-column column-type column-primary sortable desc">
|
||||
<a href="#" tabindex="-1">
|
||||
<span>
|
||||
<?php
|
||||
\esc_html_e( 'Type', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
<span class="sorting-indicator"></span></a>
|
||||
</th>
|
||||
<th scope="col" class="manage-column column-old sortable desc">
|
||||
<a href="#" tabindex="-1">
|
||||
<span>
|
||||
<?php
|
||||
\esc_html_e( 'Old URL', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
<span class="sorting-indicator"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th scope="col" class="manage-column column-new sortable desc">
|
||||
<a href="#" tabindex="-1">
|
||||
<span>
|
||||
<?php
|
||||
\esc_html_e( 'New URL', 'wordpress-seo' )
|
||||
?>
|
||||
</span>
|
||||
<span class="sorting-indicator"></span></a>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<br class="clear">
|
||||
|
||||
</div><!-- end of div wpseo_content_top --></div><!-- end of div wpseo_content_wrapper -->
|
||||
</div>
|
@ -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>
|
@ -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>';
|
@ -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.'
|
||||
);
|
@ -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' );
|
@ -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' );
|
@ -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>';
|
@ -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' );
|
@ -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>';
|
@ -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 you’ve 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>
|
@ -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>
|
@ -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>
|
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes the parameters that have been sent.
|
||||
*
|
||||
* @return array The sanitized fields.
|
||||
*/
|
||||
function yoast_free_bulk_sanitize_input_fields() {
|
||||
$possible_params = [
|
||||
'type',
|
||||
'paged',
|
||||
'post_type_filter',
|
||||
'post_status',
|
||||
'order',
|
||||
'orderby',
|
||||
];
|
||||
|
||||
$input_get = [];
|
||||
foreach ( $possible_params as $param_name ) {
|
||||
if ( isset( $_GET[ $param_name ] ) ) {
|
||||
$input_get[ $param_name ] = sanitize_text_field( wp_unslash( $_GET[ $param_name ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $input_get;
|
||||
}
|
||||
|
||||
$yoast_free_input_fields = yoast_free_bulk_sanitize_input_fields();
|
||||
|
||||
// Verifies the nonce.
|
||||
if ( ! empty( $yoast_free_input_fields ) ) {
|
||||
check_admin_referer( 'bulk-editor-table', 'nonce' );
|
||||
}
|
||||
|
||||
// If type is empty, fill it with value of first tab (title).
|
||||
if ( ! isset( $yoast_free_input_fields['type'] ) ) {
|
||||
$yoast_free_input_fields['type'] = 'title';
|
||||
}
|
||||
|
||||
$yoast_bulk_editor_arguments = [
|
||||
'input_fields' => $yoast_free_input_fields,
|
||||
'nonce' => wp_create_nonce( 'bulk-editor-table' ),
|
||||
];
|
||||
|
||||
$wpseo_bulk_titles_table = new WPSEO_Bulk_Title_Editor_List_Table( $yoast_bulk_editor_arguments );
|
||||
$wpseo_bulk_description_table = new WPSEO_Bulk_Description_List_Table( $yoast_bulk_editor_arguments );
|
||||
|
||||
$yoast_free_screen_reader_content = [
|
||||
'heading_views' => __( 'Filter posts list', 'wordpress-seo' ),
|
||||
'heading_pagination' => __( 'Posts list navigation', 'wordpress-seo' ),
|
||||
'heading_list' => __( 'Posts list', 'wordpress-seo' ),
|
||||
];
|
||||
get_current_screen()->set_screen_reader_content( $yoast_free_screen_reader_content );
|
||||
|
||||
if ( ! empty( $_REQUEST['_wp_http_referer'] ) && isset( $_SERVER['REQUEST_URI'] ) ) {
|
||||
$request_uri = sanitize_file_name( wp_unslash( $_SERVER['REQUEST_URI'] ) );
|
||||
|
||||
wp_redirect(
|
||||
remove_query_arg(
|
||||
[ '_wp_http_referer', '_wpnonce' ],
|
||||
$request_uri
|
||||
)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a bulk editor tab.
|
||||
*
|
||||
* @param WPSEO_Bulk_List_Table $table The table to render.
|
||||
* @param string $id The id for the tab.
|
||||
*/
|
||||
function wpseo_get_rendered_tab( $table, $id ) {
|
||||
?>
|
||||
<div id="<?php echo esc_attr( $id ); ?>" class="wpseotab">
|
||||
<?php
|
||||
$table->show_page();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<script>
|
||||
<?php /* phpcs:ignore WordPress.Security.EscapeOutput -- WPSEO_Utils::format_json_encode is safe. */ ?>
|
||||
var wpseoBulkEditorNonce = <?php echo WPSEO_Utils::format_json_encode( wp_create_nonce( 'wpseo-bulk-editor' ) ); ?>;
|
||||
|
||||
// eslint-disable-next-line
|
||||
var wpseo_bulk_editor_nonce = wpseoBulkEditorNonce;
|
||||
</script>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<div class="wpseo_table_page">
|
||||
|
||||
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
|
||||
<a class="nav-tab" id="title-tab" href="#top#title"><?php esc_html_e( 'Title', 'wordpress-seo' ); ?></a>
|
||||
<a class="nav-tab" id="description-tab"
|
||||
href="#top#description"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></a>
|
||||
</h2>
|
||||
|
||||
<div class="tabwrapper">
|
||||
<?php wpseo_get_rendered_tab( $wpseo_bulk_titles_table, 'title' ); ?>
|
||||
<?php wpseo_get_rendered_tab( $wpseo_bulk_description_table, 'description' ); ?>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,244 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
$yform = Yoast_Form::get_instance();
|
||||
$home_path = get_home_path();
|
||||
|
||||
if ( ! is_writable( $home_path ) && ! empty( $_SERVER['DOCUMENT_ROOT'] ) ) {
|
||||
$home_path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
$robots_file = $home_path . 'robots.txt';
|
||||
$ht_access_file = $home_path . '.htaccess';
|
||||
|
||||
if ( isset( $_POST['create_robots'] ) ) {
|
||||
if ( ! current_user_can( 'edit_files' ) ) {
|
||||
$die_msg = sprintf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
__( 'You cannot create a %s file.', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
);
|
||||
die( esc_html( $die_msg ) );
|
||||
}
|
||||
|
||||
check_admin_referer( 'wpseo_create_robots' );
|
||||
|
||||
ob_start();
|
||||
error_reporting( 0 );
|
||||
do_robots();
|
||||
$robots_content = ob_get_clean();
|
||||
|
||||
$f = fopen( $robots_file, 'x' );
|
||||
fwrite( $f, $robots_content );
|
||||
}
|
||||
|
||||
if ( isset( $_POST['submitrobots'] ) ) {
|
||||
if ( ! current_user_can( 'edit_files' ) ) {
|
||||
$die_msg = sprintf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
__( 'You cannot edit the %s file.', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
);
|
||||
die( esc_html( $die_msg ) );
|
||||
}
|
||||
|
||||
check_admin_referer( 'wpseo-robotstxt' );
|
||||
|
||||
if ( isset( $_POST['robotsnew'] ) && file_exists( $robots_file ) ) {
|
||||
$robotsnew = sanitize_textarea_field( wp_unslash( $_POST['robotsnew'] ) );
|
||||
if ( is_writable( $robots_file ) ) {
|
||||
$f = fopen( $robots_file, 'w+' );
|
||||
fwrite( $f, $robotsnew );
|
||||
fclose( $f );
|
||||
$msg = sprintf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
__( 'Updated %s', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_POST['submithtaccess'] ) ) {
|
||||
if ( ! current_user_can( 'edit_files' ) ) {
|
||||
$die_msg = sprintf(
|
||||
/* translators: %s expands to ".htaccess". */
|
||||
__( 'You cannot edit the %s file.', 'wordpress-seo' ),
|
||||
'.htaccess'
|
||||
);
|
||||
die( esc_html( $die_msg ) );
|
||||
}
|
||||
|
||||
check_admin_referer( 'wpseo-htaccess' );
|
||||
|
||||
if ( isset( $_POST['htaccessnew'] ) && file_exists( $ht_access_file ) ) {
|
||||
$ht_access_new = wp_unslash( $_POST['htaccessnew'] );
|
||||
if ( is_writable( $ht_access_file ) ) {
|
||||
$f = fopen( $ht_access_file, 'w+' );
|
||||
fwrite( $f, $ht_access_new );
|
||||
fclose( $f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$action_url = network_admin_url( 'admin.php?page=wpseo_files' );
|
||||
$yform->admin_header( false, 'wpseo_ms' );
|
||||
}
|
||||
else {
|
||||
$action_url = admin_url( 'admin.php?page=wpseo_tools&tool=file-editor' );
|
||||
}
|
||||
|
||||
if ( isset( $msg ) && ! empty( $msg ) ) {
|
||||
echo '<div id="message" class="notice notice-success"><p>', esc_html( $msg ), '</p></div>';
|
||||
}
|
||||
|
||||
// N.B.: "robots.txt" is a fixed file name and should not be translatable.
|
||||
echo '<h2>robots.txt</h2>';
|
||||
|
||||
if ( ! file_exists( $robots_file ) ) {
|
||||
if ( is_writable( $home_path ) ) {
|
||||
echo '<form action="', esc_url( $action_url ), '" method="post" id="robotstxtcreateform">';
|
||||
wp_nonce_field( 'wpseo_create_robots', '_wpnonce', true, true );
|
||||
echo '<p>';
|
||||
printf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
esc_html__( 'You don\'t have a %s file, create one here:', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
);
|
||||
echo '</p>';
|
||||
|
||||
printf(
|
||||
'<input type="submit" class="button" name="create_robots" value="%s">',
|
||||
sprintf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
esc_attr__( 'Create %s file', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
)
|
||||
);
|
||||
echo '</form>';
|
||||
}
|
||||
else {
|
||||
echo '<p>';
|
||||
printf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
esc_html__( 'If you had a %s file and it was editable, you could edit it from here.', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
);
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$f = fopen( $robots_file, 'r' );
|
||||
|
||||
$content = '';
|
||||
if ( filesize( $robots_file ) > 0 ) {
|
||||
$content = fread( $f, filesize( $robots_file ) );
|
||||
}
|
||||
|
||||
if ( ! is_writable( $robots_file ) ) {
|
||||
echo '<p><em>';
|
||||
printf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
esc_html__( 'If your %s were writable, you could edit it from here.', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
);
|
||||
echo '</em></p>';
|
||||
echo '<textarea class="large-text code" disabled="disabled" rows="15" name="robotsnew">', esc_textarea( $content ), '</textarea><br/>';
|
||||
}
|
||||
else {
|
||||
echo '<form action="', esc_url( $action_url ), '" method="post" id="robotstxtform">';
|
||||
wp_nonce_field( 'wpseo-robotstxt', '_wpnonce', true, true );
|
||||
echo '<label for="robotsnew" class="yoast-inline-label">';
|
||||
printf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
esc_html__( 'Edit the content of your %s:', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
);
|
||||
echo '</label>';
|
||||
echo '<textarea class="large-text code" rows="15" name="robotsnew" id="robotsnew">', esc_textarea( $content ), '</textarea><br/>';
|
||||
printf(
|
||||
'<div class="submit"><input class="button" type="submit" name="submitrobots" value="%s" /></div>',
|
||||
sprintf(
|
||||
/* translators: %s expands to robots.txt. */
|
||||
esc_attr__( 'Save changes to %s', 'wordpress-seo' ),
|
||||
'robots.txt'
|
||||
)
|
||||
);
|
||||
echo '</form>';
|
||||
}
|
||||
}
|
||||
if ( ! WPSEO_Utils::is_nginx() ) {
|
||||
|
||||
echo '<h2>';
|
||||
printf(
|
||||
/* translators: %s expands to ".htaccess". */
|
||||
esc_html__( '%s file', 'wordpress-seo' ),
|
||||
'.htaccess'
|
||||
);
|
||||
echo '</h2>';
|
||||
|
||||
if ( file_exists( $ht_access_file ) ) {
|
||||
$f = fopen( $ht_access_file, 'r' );
|
||||
|
||||
$contentht = '';
|
||||
if ( filesize( $ht_access_file ) > 0 ) {
|
||||
$contentht = fread( $f, filesize( $ht_access_file ) );
|
||||
}
|
||||
|
||||
if ( ! is_writable( $ht_access_file ) ) {
|
||||
echo '<p><em>';
|
||||
printf(
|
||||
/* translators: %s expands to ".htaccess". */
|
||||
esc_html__( 'If your %s were writable, you could edit it from here.', 'wordpress-seo' ),
|
||||
'.htaccess'
|
||||
);
|
||||
echo '</em></p>';
|
||||
echo '<textarea class="large-text code" disabled="disabled" rows="15" name="robotsnew">', esc_textarea( $contentht ), '</textarea><br/>';
|
||||
}
|
||||
else {
|
||||
echo '<form action="', esc_url( $action_url ), '" method="post" id="htaccessform">';
|
||||
wp_nonce_field( 'wpseo-htaccess', '_wpnonce', true, true );
|
||||
echo '<label for="htaccessnew" class="yoast-inline-label">';
|
||||
printf(
|
||||
/* translators: %s expands to ".htaccess". */
|
||||
esc_html__( 'Edit the content of your %s:', 'wordpress-seo' ),
|
||||
'.htaccess'
|
||||
);
|
||||
echo '</label>';
|
||||
echo '<textarea class="large-text code" rows="15" name="htaccessnew" id="htaccessnew">', esc_textarea( $contentht ), '</textarea><br/>';
|
||||
printf(
|
||||
'<div class="submit"><input class="button" type="submit" name="submithtaccess" value="%s" /></div>',
|
||||
sprintf(
|
||||
/* translators: %s expands to ".htaccess". */
|
||||
esc_attr__( 'Save changes to %s', 'wordpress-seo' ),
|
||||
'.htaccess'
|
||||
)
|
||||
);
|
||||
echo '</form>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<p>';
|
||||
printf(
|
||||
/* translators: %s expands to ".htaccess". */
|
||||
esc_html__( 'If you had a %s file and it was editable, you could edit it from here.', 'wordpress-seo' ),
|
||||
'.htaccess'
|
||||
);
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$yform->admin_footer( false );
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
$yform = Yoast_Form::get_instance();
|
||||
$yoast_seo_import = false;
|
||||
|
||||
/**
|
||||
* The import method is used to determine if there should be something imported.
|
||||
*
|
||||
* In case of POST the user is on the Yoast SEO import page and in case of the GET the user sees a notice from
|
||||
* Yoast SEO that we can import stuff for that plugin.
|
||||
*/
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only comparing the variable so no need to sanitize.
|
||||
if ( isset( $_POST['import_external'] ) && wp_unslash( $_POST['import_external'] ) === 'Import' ) {
|
||||
check_admin_referer( 'wpseo-import-plugins' );
|
||||
if ( isset( $_POST['import_external_plugin'] ) && is_string( $_POST['import_external_plugin'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are using the variable as a class name.
|
||||
$yoast_seo_class = wp_unslash( $_POST['import_external_plugin'] );
|
||||
if ( class_exists( $yoast_seo_class ) ) {
|
||||
$yoast_seo_import = new WPSEO_Import_Plugin( new $yoast_seo_class(), 'import' );
|
||||
}
|
||||
}
|
||||
}
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only comparing the variable so no need to sanitize.
|
||||
elseif ( isset( $_POST['clean_external'] ) && wp_unslash( $_POST['clean_external'] ) === 'Clean up' ) {
|
||||
check_admin_referer( 'wpseo-clean-plugins' );
|
||||
if ( isset( $_POST['clean_external_plugin'] ) && is_string( $_POST['clean_external_plugin'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are using the variable as a class name.
|
||||
$yoast_seo_class = wp_unslash( $_POST['clean_external_plugin'] );
|
||||
if ( class_exists( $yoast_seo_class ) ) {
|
||||
$yoast_seo_import = new WPSEO_Import_Plugin( new $yoast_seo_class(), 'cleanup' );
|
||||
}
|
||||
}
|
||||
}
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only comparing to an empty string.
|
||||
elseif ( isset( $_POST['settings_import'] ) && wp_unslash( $_POST['settings_import'] ) !== '' ) {
|
||||
$yoast_seo_import = new WPSEO_Import_Settings();
|
||||
$yoast_seo_import->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow custom import actions.
|
||||
*
|
||||
* @api WPSEO_Import_Status $yoast_seo_import Contains info about the handled import.
|
||||
*/
|
||||
$yoast_seo_import = apply_filters( 'wpseo_handle_import', $yoast_seo_import );
|
||||
|
||||
if ( $yoast_seo_import ) {
|
||||
|
||||
$yoast_seo_message = '';
|
||||
if ( $yoast_seo_import->status instanceof WPSEO_Import_Status ) {
|
||||
$yoast_seo_message = $yoast_seo_import->status->get_msg();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow customization of import/export message.
|
||||
*
|
||||
* @api string $yoast_seo_msg The message.
|
||||
*/
|
||||
$yoast_seo_msg = apply_filters( 'wpseo_import_message', $yoast_seo_message );
|
||||
|
||||
if ( ! empty( $yoast_seo_msg ) ) {
|
||||
$yoast_seo_status = 'error';
|
||||
if ( $yoast_seo_import->status->status ) {
|
||||
$yoast_seo_status = 'updated';
|
||||
}
|
||||
|
||||
$yoast_seo_class = 'message ' . $yoast_seo_status;
|
||||
|
||||
echo '<div id="message" class="', esc_attr( $yoast_seo_status ), '"><p>', esc_html( $yoast_seo_msg ), '</p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$yoast_seo_tabs = [
|
||||
'wpseo-import' => [
|
||||
'label' => __( 'Import settings', 'wordpress-seo' ),
|
||||
],
|
||||
'wpseo-export' => [
|
||||
'label' => __( 'Export settings', 'wordpress-seo' ),
|
||||
],
|
||||
'import-seo' => [
|
||||
'label' => __( 'Import from other SEO plugins', 'wordpress-seo' ),
|
||||
],
|
||||
];
|
||||
|
||||
?>
|
||||
<br/><br/>
|
||||
|
||||
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
|
||||
<?php foreach ( $yoast_seo_tabs as $identifier => $tab ) : ?>
|
||||
<a class="nav-tab" id="<?php echo esc_attr( $identifier . '-tab' ); ?>" href="<?php echo esc_url( '#top#' . $identifier ); ?>"><?php echo esc_html( $tab['label'] ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Allow adding a custom import tab header.
|
||||
*/
|
||||
do_action( 'wpseo_import_tab_header' );
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<?php
|
||||
|
||||
foreach ( $yoast_seo_tabs as $identifier => $tab ) {
|
||||
printf( '<div id="%s" class="wpseotab">', esc_attr( $identifier ) );
|
||||
require_once WPSEO_PATH . 'admin/views/tabs/tool/' . $identifier . '.php';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow adding a custom import tab.
|
||||
*/
|
||||
do_action( 'wpseo_import_tab_content' );
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*
|
||||
* @uses object $user
|
||||
*/
|
||||
|
||||
/* translators: %1$s expands to Yoast SEO */
|
||||
$wpseo_up_settings_header = sprintf( __( '%1$s settings', 'wordpress-seo' ), 'Yoast SEO' );
|
||||
$wpseo_no_index_author_label = sprintf(
|
||||
/* translators: %s expands to "this author's archives". */
|
||||
__( 'Do not allow search engines to show %s in search results.', 'wordpress-seo' ),
|
||||
__( 'this author\'s archives', 'wordpress-seo' )
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="yoast yoast-settings">
|
||||
|
||||
<h2 id="wordpress-seo"><?php echo esc_html( $wpseo_up_settings_header ); ?></h2>
|
||||
|
||||
<?php if ( ! WPSEO_Options::get( 'disable-author' ) ) : ?>
|
||||
<label for="wpseo_author_title"><?php esc_html_e( 'Title to use for Author page', 'wordpress-seo' ); ?></label>
|
||||
<input class="yoast-settings__text regular-text" type="text" id="wpseo_author_title" name="wpseo_author_title"
|
||||
value="<?php echo esc_attr( get_the_author_meta( 'wpseo_title', $user->ID ) ); ?>"/><br>
|
||||
|
||||
<label for="wpseo_author_metadesc"><?php esc_html_e( 'Meta description to use for Author page', 'wordpress-seo' ); ?></label>
|
||||
<textarea rows="5" cols="30" id="wpseo_author_metadesc"
|
||||
class="yoast-settings__textarea yoast-settings__textarea--medium"
|
||||
name="wpseo_author_metadesc"><?php echo esc_textarea( get_the_author_meta( 'wpseo_metadesc', $user->ID ) ); ?></textarea><br>
|
||||
|
||||
<input class="yoast-settings__checkbox double" type="checkbox" id="wpseo_noindex_author"
|
||||
name="wpseo_noindex_author"
|
||||
value="on" <?php echo ( get_the_author_meta( 'wpseo_noindex_author', $user->ID ) === 'on' ) ? 'checked' : ''; ?> />
|
||||
<label class="yoast-label-strong"
|
||||
for="wpseo_noindex_author"><?php echo esc_html( $wpseo_no_index_author_label ); ?></label><br>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( WPSEO_Options::get( 'keyword_analysis_active', false ) ) : ?>
|
||||
<input class="yoast-settings__checkbox double" type="checkbox" id="wpseo_keyword_analysis_disable"
|
||||
name="wpseo_keyword_analysis_disable" aria-describedby="wpseo_keyword_analysis_disable_desc"
|
||||
value="on" <?php echo ( get_the_author_meta( 'wpseo_keyword_analysis_disable', $user->ID ) === 'on' ) ? 'checked' : ''; ?> />
|
||||
<label class="yoast-label-strong"
|
||||
for="wpseo_keyword_analysis_disable"><?php esc_html_e( 'Disable SEO analysis', 'wordpress-seo' ); ?></label>
|
||||
<br>
|
||||
<p class="description" id="wpseo_keyword_analysis_disable_desc">
|
||||
<?php esc_html_e( 'Removes the focus keyphrase section from the metabox and disables all SEO-related suggestions.', 'wordpress-seo' ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( WPSEO_Options::get( 'content_analysis_active', false ) ) : ?>
|
||||
<input class="yoast-settings__checkbox double" type="checkbox" id="wpseo_content_analysis_disable"
|
||||
name="wpseo_content_analysis_disable" aria-describedby="wpseo_content_analysis_disable_desc"
|
||||
value="on" <?php echo ( get_the_author_meta( 'wpseo_content_analysis_disable', $user->ID ) === 'on' ) ? 'checked' : ''; ?> />
|
||||
<label class="yoast-label-strong"
|
||||
for="wpseo_content_analysis_disable"><?php esc_html_e( 'Disable readability analysis', 'wordpress-seo' ); ?></label>
|
||||
<br>
|
||||
<p class="description" id="wpseo_content_analysis_disable_desc">
|
||||
<?php esc_html_e( 'Removes the readability analysis section from the metabox and disables all readability-related suggestions.', 'wordpress-seo' ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( WPSEO_Options::get( 'inclusive_language_analysis_active', false ) ) : ?>
|
||||
<input class="yoast-settings__checkbox double" type="checkbox" id="wpseo_inclusive_language_analysis_disable"
|
||||
name="wpseo_inclusive_language_analysis_disable" aria-describedby="wpseo_inclusive_language_analysis_disable_desc"
|
||||
value="on" <?php echo ( get_the_author_meta( 'wpseo_inclusive_language_analysis_disable', $user->ID ) === 'on' ) ? 'checked' : ''; ?> />
|
||||
<label class="yoast-label-strong"
|
||||
for="wpseo_inclusive_language_analysis_disable"><?php esc_html_e( 'Disable inclusive language analysis', 'wordpress-seo' ); ?></label>
|
||||
<br>
|
||||
<p class="description" id="wpseo_inclusive_language_analysis_disable_desc">
|
||||
<?php esc_html_e( 'Removes the inclusive language analysis section from the metabox and disables all inclusive language-related suggestions.', 'wordpress-seo' ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'wpseo_render_user_profile', $user ); ?>
|
||||
</div>
|
Reference in New Issue
Block a user