PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,115 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
/**
* Class Yoast_View_Utils.
*/
class Yoast_View_Utils {
/**
* Form to use.
*
* @var Yoast_Form
*/
protected $form;
/**
* Yoast_View_Utils constructor.
*/
public function __construct() {
$this->form = Yoast_Form::get_instance();
}
/**
* Shows the search results help question mark and help section.
*
* Used for all the Help sections for indexable objects like post types, taxonomies, or archives.
*
* @param string|object $post_type The post type to show the search results help for.
* @param string $help_text_switch Switch the help text to one that's more appropriate
* for the indexable object type the help section is for.
*
* @return object The help panel instance.
*/
public function search_results_setting_help( $post_type, $help_text_switch = '' ) {
if ( ! is_object( $post_type ) ) {
$post_type = get_post_type_object( $post_type );
}
/* translators: 1: expands to an indexable object's name, like a post type or taxonomy; 2: expands to <code>noindex</code>; 3: link open tag; 4: link close tag. */
$help_text = esc_html__( 'Not showing %1$s in the search results technically means those will have a %2$s robots meta and will be excluded from XML sitemaps. %3$sMore info on the search results settings%4$s.', 'wordpress-seo' );
if ( $help_text_switch === 'archive' ) {
/* translators: 1: expands to an indexable object's name, like a post type or taxonomy; 2: expands to <code>noindex</code>; 3: link open tag; 4: link close tag. */
$help_text = esc_html__( 'Not showing the archive for %1$s in the search results technically means those will have a %2$s robots meta and will be excluded from XML sitemaps. %3$sMore info on the search results settings%4$s.', 'wordpress-seo' );
}
$help_panel = new WPSEO_Admin_Help_Panel(
// Sometimes the same post type is used more than once in the same page, we need a unique ID though.
uniqid( 'noindex-' . $post_type->name ),
esc_html__( 'Help on this search results setting', 'wordpress-seo' ),
sprintf(
$help_text,
$post_type->labels->name,
'<code>noindex</code>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
)
);
return $help_panel;
}
/**
* Shows the search appearance settings for a post type.
*
* @param string|object $post_type The post type to show the search appearance settings for.
* @param bool $paper_style Whether or not the paper style should be shown.
*
* @return void
*/
public function show_post_type_settings( $post_type, $paper_style = false ) {
if ( ! is_object( $post_type ) ) {
$post_type = get_post_type_object( $post_type );
}
$show_post_type_help = $this->search_results_setting_help( $post_type );
$noindex_option_name = 'noindex-' . $post_type->name;
$this->form->index_switch(
$noindex_option_name,
$post_type->labels->name,
$show_post_type_help->get_button_html() . $show_post_type_help->get_panel_html()
);
$this->form->show_hide_switch(
'showdate-' . $post_type->name,
__( 'Date in Snippet Preview', 'wordpress-seo' )
);
$this->form->show_hide_switch(
'display-metabox-pt-' . $post_type->name,
/* translators: %1$s expands to Yoast SEO */
sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' )
);
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$editor = new WPSEO_Replacevar_Editor(
$this->form,
array(
'title' => 'title-' . $post_type->name,
'description' => 'metadesc-' . $post_type->name,
'page_type_recommended' => $recommended_replace_vars->determine_for_post_type( $post_type->name ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_post_type( $post_type->name ),
'paper_style' => $paper_style,
)
);
$editor->render();
}
}

View File

@ -0,0 +1,133 @@
<?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 = '';
/**
* Feature toggle label.
*
* @var string
*/
protected $label = '';
/**
* URL to learn more about the feature.
*
* @var string
*/
protected $read_more_url = '';
/**
* Label for the learn more link.
*
* @var string
*/
protected $read_more_label = '';
/**
* Additional help content for the feature.
*
* @var string
*/
protected $extra = '';
/**
* Value to specify the feature toggle order.
*
* @var string
*/
protected $order = 100;
/**
* 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 $label Required. Feature toggle label.
* @type string $read_more_url URL to learn more about the feature. 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.
* }
*
* @throws InvalidArgumentException Thrown when a required argument is missing.
*/
public function __construct( array $args ) {
$required_keys = array( 'name', 'setting', 'label' );
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 );
}
}

View File

@ -0,0 +1,188 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* 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 = array(
(object) array(
'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) array(
'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) array(
'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) array(
'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) array(
'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,
'order' => 60,
),
(object) array(
/* translators: %s: Ryte */
'name' => sprintf( __( '%s integration', 'wordpress-seo' ), 'Ryte' ),
'setting' => 'onpage_indexability',
/* translators: 1: Ryte */
'label' => sprintf( __( '%1$s will check weekly if your site is still indexable by search engines and Yoast SEO will notify you when this is not the case.', 'wordpress-seo' ), 'Ryte' ),
/* translators: %s: Ryte */
'read_more_label' => sprintf( __( 'Read more about how %s works.', 'wordpress-seo' ), 'Ryte ' ),
'read_more_url' => 'https://yoa.st/2an',
'order' => 70,
),
(object) array(
'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) array(
'name' => __( 'Security: no advanced 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. 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,
),
);
/**
* 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( array( $this, 'ensure_toggle' ), $feature_toggles );
usort( $feature_toggles, array( $this, 'sort_toggles_callback' ) );
return $feature_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 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.
*
* @param Yoast_Feature_Toggle $feature_a Feature A.
* @param Yoast_Feature_Toggle $feature_b Feature B.
*
* @return bool Whether order for feature A is bigger than for feature B.
*/
protected function sort_toggles_callback( Yoast_Feature_Toggle $feature_a, Yoast_Feature_Toggle $feature_b ) {
return ( $feature_a->order > $feature_b->order );
}
}

View File

@ -0,0 +1,180 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Generate the HTML for a form fieldset to wrap grouped form elements.
*/
class Yoast_Form_Fieldset implements Yoast_Form_Element {
/**
* The fieldset ID.
*
* @var string
*/
private $id;
/**
* The fieldset HTML default attributes.
*
* @var array
*/
private $attributes = array(
'class' => 'yoast-form-fieldset',
);
/**
* The grouped form elements for the fieldset.
*
* @var string
*/
private $content;
/**
* The fieldset legend HTML default attributes.
*
* @var array
*/
private $legend_attributes = array(
'class' => 'yoast-form-legend',
);
/**
* A translatable string for the fieldset legend content.
*
* @var string
*/
private $legend_content;
/**
* Constructor.
*
* @param string $id ID for the fieldset.
* @param string $legend_content The translatable legend text.
* @param string $content The grouped form elements for the fieldset.
*/
public function __construct( $id, $legend_content, $content ) {
$this->id = $id;
$this->legend_content = $legend_content;
$this->content = $content;
}
/**
* Render the view.
*/
public function render_view() {
/*
* Extract because we want values accessible via variables for later use
* in the view instead of accessing them as an array.
*/
extract( $this->get_parts() );
require WPSEO_PATH . 'admin/views/form/fieldset.php';
}
/**
* Start output buffering to catch the form elements to wrap in the fieldset.
*/
public function start() {
ob_start();
}
/**
* Return output buffering with the form elements to wrap in the fieldset.
*/
public function end() {
$this->content = ob_get_clean();
}
/**
* Return the rendered view.
*
* @return string
*/
public function get_html() {
ob_start();
$this->render_view();
return ob_get_clean();
}
/**
* Output the rendered view.
*/
public function html() {
echo $this->get_html();
}
/**
* Add attributes to the fieldset default attributes.
*
* @param array $attributes Array of attributes names and values to merge with the defaults.
*/
public function add_attributes( $attributes ) {
$this->attributes = wp_parse_args( $attributes, $this->attributes );
}
/**
* Add attributes to the fieldset legend default attributes.
*
* @param array $attributes Array of attributes names and values to merge with the defaults.
*/
public function legend_add_attributes( $attributes ) {
$this->legend_attributes = wp_parse_args( $attributes, $this->legend_attributes );
}
/**
* Visually hide the fieldset legend but keep it available to assistive technologies.
*/
public function legend_hide() {
$this->legend_attributes = wp_parse_args(
array( 'class' => 'screen-reader-text' ),
$this->legend_attributes
);
}
/**
* Return the set of attributes and content for the fieldset.
*
* @return array
*/
private function get_parts() {
return array(
'id' => $this->id,
'attributes' => $this->get_attributes_html( $this->attributes ),
'legend_content' => $this->legend_content,
'legend_attributes' => $this->get_attributes_html( $this->legend_attributes ),
'content' => $this->content,
);
}
/**
* Return HTML formatted attributes as a string, when there are attributes set.
*
* @param array $attributes Fieldset or legend attributes.
*
* @return string A space separated list of HTML formatted attributes or empty string.
*/
private function get_attributes_html( $attributes ) {
if ( ! empty( $attributes ) ) {
array_walk( $attributes, array( $this, 'parse_attribute' ) );
// Use an initial space as `implode()` adds a space only between array elements.
return ' ' . implode( ' ', $attributes );
}
return '';
}
/**
* Escape and format an attribute as an HTML attribute.
*
* @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"', esc_html( $attribute ), esc_attr( $value ) );
}
}

View File

@ -0,0 +1,134 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Class for generating a html select.
*/
class Yoast_Input_Select {
/**
* @var string
*/
private $select_id;
/**
* @var string
*/
private $select_name;
/**
* @var array
*/
private $select_attributes = array();
/**
* 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 array(
'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, array( $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"', esc_html( $attribute ), esc_attr( $value ) );
}
}

View File

@ -0,0 +1,25 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*
* @uses string $id ID attribute for the fieldset.
* @uses string $attributes Additional attributes for the fieldset.
* @uses string $legend_attributes Additional attributes for the legend.
* @uses string $legend_content The legend text.
* @uses string $content The fieldset content, i.e. a set of logically grouped form controls.
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
?>
<fieldset id="<?php echo esc_attr( $id ); ?>"<?php echo $attributes; ?>>
<legend id="<?php echo esc_attr( $id . '-legend' ); ?>"<?php echo $legend_attributes; ?>><?php echo esc_html( $legend_content ); ?></legend>
<?php echo $content; ?>
</fieldset>

View File

@ -0,0 +1,25 @@
<?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();
}
?>
<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>

View File

@ -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();
}

View File

@ -0,0 +1,43 @@
<?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">
<span class="screen-reader-text wpseo-primary-category-label"><?php
printf(
/* translators: %s is the taxonomy title. This will be shown to screenreaders */
'(' . esc_html__( 'Primary %s', 'wordpress-seo' ) . ')',
'{{data.taxonomy.title}}'
);
?></span>
</script>

View File

@ -0,0 +1,288 @@
<?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();
}
$extension_list = new WPSEO_Extensions();
$extensions = $extension_list->get();
// First invalidate all licenses.
array_map( array( $extension_list, 'invalidate' ), $extensions );
$premium_extension = new WPSEO_Extension(
array(
'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' ),
'image' => plugins_url( 'images/extensions-premium-ribbon.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
'benefits' => array(),
)
);
$extensions = array(
WPSEO_Addon_Manager::LOCAL_SLUG => new WPSEO_Extension(
array(
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zt' ),
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zs' ),
'title' => 'Local SEO',
'display_title' => 'Stop losing customers to other local businesses',
'desc' => __( 'Rank better locally and in Google Maps, without breaking a sweat!', 'wordpress-seo' ),
'image' => plugins_url( 'images/extensions-local.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
'benefits' => array(
__( 'Get better search results in local search', 'wordpress-seo' ),
__( 'Easily insert Google Maps, a store locator, opening hours and more', 'wordpress-seo' ),
/* translators: %1$s expands to WooCommerce */
sprintf( __( 'Allow customers to pick up their %s order locally', 'wordpress-seo' ), 'WooCommerce' ),
),
)
),
WPSEO_Addon_Manager::VIDEO_SLUG => new WPSEO_Extension(
array(
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zx/' ),
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zw/' ),
'title' => 'Video SEO',
'display_title' => 'Start ranking better for your videos',
'desc' => __( 'Optimize your videos to show them off in search results and get more clicks!', 'wordpress-seo' ),
'image' => plugins_url( 'images/extensions-video.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
'benefits' => array(
__( 'Show your videos in Google Videos', 'wordpress-seo' ),
__( 'Enhance the experience of sharing posts with videos', 'wordpress-seo' ),
__( 'Make videos responsive through enabling fitvids.js', 'wordpress-seo' ),
),
)
),
WPSEO_Addon_Manager::NEWS_SLUG => new WPSEO_Extension(
array(
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zv/' ),
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zu/' ),
'title' => 'News SEO',
'display_title' => 'Everything you need for Google News',
'desc' => __( 'Are you in Google News? Increase your traffic from Google News by optimizing for it!', 'wordpress-seo' ),
'image' => plugins_url( 'images/extensions-news.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
'benefits' => array(
__( 'Optimize your site for Google News', 'wordpress-seo' ),
__( 'Immediately pings Google on the publication of a new post', 'wordpress-seo' ),
__( 'Creates XML News Sitemaps', 'wordpress-seo' ),
),
)
),
);
// Add Yoast WooCommerce SEO when WooCommerce is active.
if ( WPSEO_Utils::is_woocommerce_active() ) {
$extensions[ WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ] = new WPSEO_Extension(
array(
'buyUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zr' ),
'infoUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/zq' ),
'title' => 'Yoast WooCommerce SEO',
'display_title' => 'Make your products stand out in Google',
/* 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/extensions-woo.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
'benefits' => array(
sprintf( __( 'Improve sharing on Facebook and Pinterest', 'wordpress-seo' ) ),
/* translators: %1$s expands to Yoast, %2$s expands to WooCommerce */
sprintf( __( 'Use %1$s breadcrumbs instead of %2$s ones', 'wordpress-seo' ), 'Yoast', 'WooCommerce' ),
/* translators: %1$s expands to Yoast SEO, %2$s expands to WooCommerce */
sprintf( __( 'A seamless integration between %1$s and %2$s', 'wordpress-seo' ), 'Yoast SEO', 'WooCommerce' ),
),
'buy_button' => 'WooCommerce SEO',
)
);
}
$addon_manager = new WPSEO_Addon_Manager();
$has_valid_premium_subscription = WPSEO_Utils::is_yoast_seo_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 = '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
?>
<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$s expands to Yoast SEO Premium */
esc_html__( '%1$s, take your optimization to the next level!', 'wordpress-seo' ),
'<span class="yoast-heading-highlight">' . $premium_extension->get_title() . '</span>'
);
?>
</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( 'Redirect manager', 'wordpress-seo' ); ?></span>
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'create and manage redirects from within your WordPress install.', 'wordpress-seo' ); ?></span>
</li>
<li class="yoast-seo-premium-benefits__item">
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Synonyms & related keyphrases', 'wordpress-seo' ); ?></span>
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'optimize a single post for synonyms and related keyphrases.', 'wordpress-seo' ); ?></span>
</li>
<li class="yoast-seo-premium-benefits__item">
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Social previews', 'wordpress-seo' ); ?></span>
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'check what your Facebook or Twitter post will look like.', '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 ( $extension_list->is_installed( $premium_extension->get_title() ) ) : ?>
<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 ) : ?>
<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
/* translators: %s expands to the extension title */
printf( esc_html( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ), $premium_extension->get_title() );
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
/* translators: %s expands to the extension title */
printf( esc_html( 'Activate %s for your site on MyYoast', 'wordpress-seo' ), $premium_extension->get_title() );
echo $new_tab_message;
?>
</a>
<?php endif; ?>
<?php else : ?>
<a target="_blank" href="<?php echo esc_url( $premium_extension->get_buy_url() ); ?>"
class="yoast-button-upsell">
<?php
/* translators: $1$s expands to Yoast SEO Premium */
printf( esc_html__( 'Buy %1$s', 'wordpress-seo' ), $premium_extension->get_title() );
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->get_info_url() ); ?>"
class="yoast-link--more-info">
<?php
printf(
/* translators: Text between %1$s and %2$s will only be shown to screen readers. %3$s expands to the product name. */
esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ),
'<span class="screen-reader-text">',
'</span>',
$premium_extension->get_title()
);
echo $new_tab_message;
?>
</a>
<?php endif; ?>
<?php if ( ! $has_valid_premium_subscription ) { ?>
<p>
<small class="yoast-money-back-guarantee"><?php esc_html_e( 'Comes with our 30-day no questions asked money back guarantee', 'wordpress-seo' ); ?></small>
</p>
<?php } ?>
</section>
<hr class="yoast-hr" aria-hidden="true"/>
<section class="yoast-promo-extensions">
<h2><?php
/* translators: %1$s expands to Yoast SEO */
$yoast_seo_extensions = sprintf( __( '%1$s extensions', 'wordpress-seo' ), 'Yoast SEO' );
$yoast_seo_extensions = '<span class="yoast-heading-highlight">' . $yoast_seo_extensions . '</span>';
/* translators: %1$s expands to Yoast SEO extensions */
printf( esc_html__( '%1$s to optimize your site even further', 'wordpress-seo' ), $yoast_seo_extensions );
?></h2>
<?php foreach ( $extensions as $slug => $extension ) : ?>
<section class="yoast-promoblock secondary yoast-promo-extension">
<img alt="" width="280" height="147" src="<?php echo esc_attr( $extension->get_image() ); ?>"/>
<h3><?php echo esc_html( $extension->get_display_title() ); ?></h3>
<ul class="yoast-list--usp">
<?php foreach ( $extension->get_benefits() as $benefit ) : ?>
<li><?php echo esc_html( $benefit ); ?></li>
<?php endforeach; ?>
</ul>
<div class="yoast-button-container">
<?php if ( $extension_list->is_installed( $extension->get_title() ) ) : ?>
<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 ) ) : ?>
<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
/* translators: %s expands to the extension title */
printf( esc_html( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ), $extension->get_title() );
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
/* translators: %s expands to the extension title */
printf( esc_html( 'Activate %s for your site on MyYoast', 'wordpress-seo' ), $extension->get_title() );
echo $new_tab_message;
?>
</a>
<?php endif; ?>
<?php else : ?>
<a target="_blank" class="yoast-button-upsell"
href="<?php echo esc_url( $extension->get_buy_url() ); ?>">
<?php
/* translators: %s expands to the product name */
printf( esc_html__( 'Buy %s', 'wordpress-seo' ), $extension->get_buy_button() );
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->get_info_url() ); ?>">
<?php
printf(
/* translators: Text between %1$s and %2$s will only be shown to screen readers. %3$s expands to the product name. */
esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ),
'<span class="screen-reader-text">',
'</span>',
$extension->get_title()
);
echo $new_tab_message;
?>
</a>
<?php endif; ?>
</div>
</section>
<?php endforeach; ?>
</section>
</div>
</div>

View File

@ -0,0 +1,45 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*
* @uses string $paper_id The ID of the paper.
* @uses bool $collapsible Whether the collapsible should be rendered.
* @uses array $collapsible_config Configuration for the collapsible.
* @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="paper tab-block"<?php echo ( $paper_id ) ? ' id="' . esc_attr( 'wpseo-' . $paper_id ) . '"' : ''; ?>>
<?php
if ( ! empty( $title ) ) {
if ( ! empty( $collapsible ) ) {
printf(
'<h2 class="help-button-inline"><button type="button" class="toggleable-container-trigger" aria-expanded="%3$s">%1$s <span class="toggleable-container-icon dashicons %2$s" aria-hidden="true"></span></button></h2>',
esc_html( $title ) . $title_after . $help_text->get_button_html(),
$collapsible_config['toggle_icon'],
$collapsible_config['expanded']
);
}
else {
printf( '<h2 class="help-button-inline">' . esc_html( $title ) . $title_after . $help_text->get_button_html() . '</h2>' );
}
}
?>
<?php echo $help_text->get_panel_html(); ?>
<div class="<?php echo esc_attr( $collapsible_config['class'] ); ?>">
<?php require $view_file; ?>
</div>
</div>

View File

@ -0,0 +1,24 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*
* @uses array $alerts_data
*/
$type = 'alerts';
$dashicon = 'warning';
$i18n_title = __( 'Problems', 'wordpress-seo' );
$i18n_issues = __( 'We have detected the following issues that affect the SEO of your site.', 'wordpress-seo' );
$i18n_no_issues = __( 'Good job! We could detect no serious SEO problems.', 'wordpress-seo' );
$i18n_muted_issues_title = __( 'Muted problems:', 'wordpress-seo' );
$active_total = count( $alerts_data['errors']['active'] );
$total = $alerts_data['metrics']['errors'];
$active = $alerts_data['errors']['active'];
$dismissed = $alerts_data['errors']['dismissed'];
require WPSEO_PATH . 'admin/views/partial-alerts-template.php';

View File

@ -0,0 +1,82 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*
* @uses string $type
* @uses string $dashicon
* @uses string $i18n_title
* @uses string $i18n_issues
* @uses string $i18n_no_issues
* @uses string $i18n_muted_issues_title
* @uses int $active_total
* @uses $total
* @uses array $active
* @uses array $dismissed
*/
if ( ! function_exists( '_yoast_display_alerts' ) ) {
/**
* Create the alert HTML with restore/dismiss button.
*
* @param array $list List of alerts.
* @param string $status Status of the alerts (active/dismissed).
*/
function _yoast_display_alerts( $list, $status ) {
foreach ( $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-no-alt"></span></button>', esc_html__( 'Dismiss 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 dashicons-hidden"></span></button>', esc_html__( 'Restore this item.', 'wordpress-seo' ) );
break;
}
printf(
'<div class="yoast-alert-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() ),
$notification,
$button
);
}
}
}
$wpseo_i18n_summary = $i18n_issues;
if ( ! $active ) {
$dashicon = 'yes';
$wpseo_i18n_summary = $i18n_no_issues;
}
?>
<h3><span class="dashicons <?php echo esc_attr( 'dashicons-' . $dashicon ); ?>"></span> <?php echo esc_html( $i18n_title ); ?> (<?php echo (int) $active_total; ?>)</h3>
<div id="<?php echo esc_attr( 'yoast-' . $type ); ?>">
<?php if ( $total ) : ?>
<p><?php echo esc_html( $wpseo_i18n_summary ); ?></p>
<div class="container" id="<?php echo esc_attr( 'yoast-' . $type . '-active' ); ?>">
<?php _yoast_display_alerts( $active, 'active' ); ?>
</div>
<?php if ( $dismissed ) : ?>
<h4 class="yoast-muted-title"><?php echo esc_html( $i18n_muted_issues_title ); ?></h4>
<?php endif; ?>
<div class="container" id="<?php echo esc_attr( 'yoast-' . $type . '-dismissed' ); ?>">
<?php _yoast_display_alerts( $dismissed, 'dismissed' ); ?>
</div>
<?php else : ?>
<p><?php echo esc_html( $i18n_no_issues ); ?></p>
<?php endif; ?>
</div>

View File

@ -0,0 +1,24 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*
* @uses array $alerts_data
*/
$type = 'warnings';
$dashicon = 'flag';
$i18n_title = __( 'Notifications', 'wordpress-seo' );
$i18n_issues = '';
$i18n_no_issues = __( 'No new notifications.', 'wordpress-seo' );
$i18n_muted_issues_title = __( 'Muted notifications:', 'wordpress-seo' );
$active_total = count( $alerts_data['warnings']['active'] );
$total = $alerts_data['metrics']['warnings'];
$active = $alerts_data['warnings']['active'];
$dismissed = $alerts_data['warnings']['dismissed'];
require WPSEO_PATH . 'admin/views/partial-alerts-template.php';

View File

@ -0,0 +1,140 @@
<?php
/**
* View for the banner sidebar.
*
* @package WPSEO\Admin\Views
*/
$wpseo_plugin_dir_url = plugin_dir_url( WPSEO_FILE );
$new_tab_message = WPSEO_Admin_Utils::get_new_tab_message();
?>
<div class="wpseo_content_cell" id="sidebar-container">
<div id="sidebar" class="yoast-sidebar">
<div class="wpseo_content_cell_title yoast-sidebar__title">
<?php
/* translators: %1$s expands to Yoast */
printf( esc_html__( '%1$s recommendations for you', 'wordpress-seo' ), 'Yoast' );
?>
</div>
<div class="yoast-sidebar__section">
<h2>
<?php
/* translators: %1$s expands to the plugin name */
printf( esc_html__( 'Upgrade to %1$s', 'wordpress-seo' ), 'Yoast SEO Premium' );
?>
</h2>
<ul>
<li><strong><?php esc_html_e( 'Rank better with synonyms & related keyphrases', 'wordpress-seo' ); ?></strong></li>
<li><strong><?php esc_html_e( 'Preview your page in Facebook and Twitter', 'wordpress-seo' ); ?></strong></li>
<li><strong><?php esc_html_e( 'Get real-time suggestions for internal links', 'wordpress-seo' ); ?></strong></li>
<li><strong><?php esc_html_e( 'No more dead links a.k.a. 404 pages', 'wordpress-seo' ); ?></strong></li>
<li><strong><?php esc_html_e( '24/7 email support', 'wordpress-seo' ); ?></strong></li>
<li><strong><?php esc_html_e( 'No ads', 'wordpress-seo' ); ?></strong></li>
</ul>
<a id="wpseo-premium-button" class="yoast-button-upsell" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jj' ); ?>" target="_blank">
<?php
/* translators: %s is replaced by the plugin name */
printf( esc_html__( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
echo $new_tab_message;
echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
?>
</a><br>
</div>
<div class="yoast-sidebar__section">
<h2><?php esc_html_e( 'Improve your SEO skills', 'wordpress-seo' ); ?></h2>
<div class="wp-clearfix">
<p>
<strong><?php echo esc_html_x( 'Free:', 'course', 'wordpress-seo' ); ?></strong>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/2oi' ); ?>" target="_blank">
<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/SEO_for_beginners.svg' ); ?>" alt="">
<strong><?php esc_html_e( 'SEO for Beginners training', 'wordpress-seo' ); ?></strong>
<?php echo $new_tab_message; ?>
</a><br>
<?php esc_html_e( 'Get quick wins to make your site rank higher in search engines.', 'wordpress-seo' ); ?>
</p>
</div>
<div class="wp-clearfix">
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jv' ); ?>" target="_blank">
<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/yoast_seo_for_wp_2.svg' ); ?>" alt="">
<strong>
<?php
/* translators: %s expands to Yoast SEO */
printf( esc_html__( '%s for WordPress training', 'wordpress-seo' ), 'Yoast SEO' );
?>
</strong>
<?php echo $new_tab_message; ?>
</a><br>
<?php esc_html_e( 'Dont waste time figuring out the best settings yourself.', 'wordpress-seo' ); ?>
</p>
</div>
<div class="wp-clearfix">
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/3lj' ); ?>" target="_blank">
<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/all-round-SEO.svg' ); ?>" alt="">
<strong><?php esc_html_e( 'All-around SEO training', 'wordpress-seo' ); ?></strong>
<?php echo $new_tab_message; ?>
</a><br>
<?php esc_html_e( 'Learn practical SEO skills to rank higher in Google.', 'wordpress-seo' ); ?>
</p>
</div>
</div>
<div class="yoast-sidebar__section">
<h2><?php esc_html_e( 'Extend Yoast SEO', 'wordpress-seo' ); ?></h2>
<div class="wp-clearfix">
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jq' ); ?>" target="_blank">
<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/Local_SEO_Icon.svg' ); ?>" alt="">
<strong>Local SEO</strong>
<?php echo $new_tab_message; ?>
</a><br>
<?php esc_html_e( 'Be found in Google Maps and local results.', 'wordpress-seo' ); ?>
</p>
</div>
<div class="wp-clearfix">
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jo' ); ?>" target="_blank">
<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/Video_SEO_Icon.svg' ); ?>" alt="">
<strong>Video SEO</strong>
<?php echo $new_tab_message; ?>
</a><br>
<?php esc_html_e( 'Be found in Google Video search and enhance your video sharing on social media.', 'wordpress-seo' ); ?>
</p>
</div>
<div class="wp-clearfix">
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jp' ); ?>" target="_blank">
<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/Woo_SEO_Icon.svg' ); ?>" alt="">
<strong>WooCommerce SEO</strong>
<?php echo $new_tab_message; ?>
</a><br>
<?php esc_html_e( 'Optimize your shop\'s SEO and sell more products!', 'wordpress-seo' ); ?>
</p>
</div>
<div class="wp-clearfix">
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jr' ); ?>" target="_blank">
<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/News_SEO_Icon.svg' ); ?>" alt="">
<strong>News SEO</strong>
<?php echo $new_tab_message; ?>
</a><br>
<?php esc_html_e( 'Optimize your site for Google News.', 'wordpress-seo' ); ?>
</p>
</div>
</div>
<div class="yoast-sidebar__section">
<strong><?php esc_html_e( 'Remove these ads?', 'wordpress-seo' ); ?></strong>
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jy' ); ?>" target="_blank">
<?php
/* translators: %s expands to Yoast SEO Premium. */
printf( esc_html__( 'Upgrade to %s »', 'wordpress-seo' ), 'Yoast SEO Premium' );
echo $new_tab_message;
?>
</a>
</p>
</div>
</div>
</div>

View File

@ -0,0 +1,53 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/** @noinspection PhpUnusedLocalVariableInspection */
$alerts_data = Yoast_Alerts::get_template_variables();
$notifier = new WPSEO_Configuration_Notifier();
$notifier->listen();
$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-alerts">
<?php echo $notifier->notify(); ?>
<div class="yoast-container yoast-container__alert">
<?php require WPSEO_PATH . 'admin/views/partial-alerts-errors.php'; ?>
</div>
<div class="yoast-container yoast-container__warning">
<?php require WPSEO_PATH . 'admin/views/partial-alerts-warnings.php'; ?>
</div>
</div>
</div>
<div class="tab-block">
<h3><?php esc_html_e( 'Credits', 'wordpress-seo' ); ?></h3>
<p>
<span class="dashicons dashicons-groups"></span>
<a href="<?php WPSEO_Shortlinker::show( 'http://yoa.st/yoast-seo-credits' ); ?>"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
</p>
</div>
<?php
/**
* Action: 'wpseo_internal_linking' - Hook to add the internal linking analyze interface to the interface.
*
* @deprecated 7.0
*/
do_action_deprecated( 'wpseo_internal_linking', array(), 'WPSEO 7.0' );

View File

@ -0,0 +1,67 @@
<?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( 'Features', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
<?php
echo sprintf(
/* translators: %1$s expands to Yoast SEO */
esc_html__( '%1$s comes with a lot of features. You can enable / disable some of them below. Clicking the question mark gives more information about the feature.', 'wordpress-seo' ),
'Yoast SEO'
);
foreach ( $feature_toggles as $feature ) {
$help_text = esc_html( $feature->label );
if ( ! empty( $feature->extra ) ) {
$help_text .= ' ' . $feature->extra;
}
if ( ! empty( $feature->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( $feature->read_more_url ) ),
esc_html( $feature->read_more_label )
);
}
$feature_help = new WPSEO_Admin_Help_Panel(
$feature->setting,
/* translators: %s expands to a feature's name */
sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $feature->name ) ),
$help_text
);
$yform->toggle_switch(
$feature->setting,
array(
'on' => __( 'On', 'wordpress-seo' ),
'off' => __( 'Off', 'wordpress-seo' ),
),
'<strong>' . $feature->name . '</strong>',
$feature_help->get_button_html() . $feature_help->get_panel_html()
);
}
?>
</div>
<?php
/*
* Required to prevent our settings framework from saving the default because the field isn't
* explicitly set when saving the Dashboard page.
*/
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );

View File

@ -0,0 +1,21 @@
<?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();
}
/**
* Fires when displaying the site wide analysis tab.
*
* @param Yoast_Form $yform The yoast form object.
*/
do_action( 'wpseo_settings_tab_site_analysis', $yform );

View File

@ -0,0 +1,81 @@
<?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();
}
$webmaster_tools_help = new WPSEO_Admin_Help_Panel(
'dashboard-webmaster-tools',
esc_html__( 'Learn more about the Webmaster Tools verification', 'wordpress-seo' ),
esc_html__( 'You can use the boxes below to verify with the different Webmaster Tools. This feature will add a verification meta tag on your home page. Follow the links to the different Webmaster Tools and look for instructions for the meta tag verification method to get the verification code. If your site is already verified, you can just forget about these.', 'wordpress-seo' ),
'has-wrapper'
);
echo '<h2 class="help-button-inline">' . esc_html__( 'Webmaster Tools verification', 'wordpress-seo' ) . $webmaster_tools_help->get_button_html() . '</h2>';
echo $webmaster_tools_help->get_panel_html();
$msverify_link = 'https://www.bing.com/toolbox/webmaster/#/Dashboard/?url=' .
rawurlencode( str_replace( 'http://', '', get_bloginfo( 'url' ) ) );
$googleverify_link = add_query_arg(
array(
'hl' => 'en',
'tid' => 'alternate',
'siteUrl' => rawurlencode( get_bloginfo( 'url' ) ) . '/',
),
'https://www.google.com/webmasters/verification/verification'
);
$yform->textinput( 'baiduverify', __( 'Baidu verification code', 'wordpress-seo' ) );
echo '<p class="desc label">';
printf(
/* translators: %1$s expands to a link start tag to the Baidu Webmaster Tools site add page, %2$s is the link closing tag. */
esc_html__( 'Get your Baidu verification code in %1$sBaidu Webmaster Tools%2$s.', 'wordpress-seo' ),
/**
* Get the Baidu Webmaster Tools site add link from this 3rd party article.
* {@link http://www.dragonmetrics.com/how-to-optimize-your-site-with-baidu-webmaster-tools/}
* We are unable to create a Baidu Webmaster Tools account due to the Chinese phone number verification.
*/
'<a target="_blank" href="' . esc_url( 'https://ziyuan.baidu.com/site/siteadd' ) . '" rel="noopener noreferrer">',
'</a>'
);
echo '</p>';
$yform->textinput( 'msverify', __( 'Bing verification code', 'wordpress-seo' ) );
echo '<p class="desc label">';
printf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__( 'Get your Bing verification code in %1$sBing Webmaster Tools%2$s.', 'wordpress-seo' ),
'<a target="_blank" href="' . esc_url( $msverify_link ) . '" rel="noopener noreferrer">',
'</a>'
);
echo '</p>';
$yform->textinput( 'googleverify', __( 'Google verification code', 'wordpress-seo' ) );
echo '<p class="desc label">';
printf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__( 'Get your Google verification code in %1$sGoogle Search Console%2$s.', 'wordpress-seo' ),
'<a target="_blank" href="' . esc_url( $googleverify_link ) . '" rel="noopener noreferrer">',
'</a>'
);
echo '</p>';
$yform->textinput( 'yandexverify', __( 'Yandex verification code', 'wordpress-seo' ) );
echo '<p class="desc label">';
printf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__( 'Get your Yandex verification code in %1$sYandex Webmaster Tools%2$s.', 'wordpress-seo' ),
'<a target="_blank" href="' . esc_url( 'https://webmaster.yandex.com/sites/add/' ) . '" rel="noopener noreferrer">',
'</a>'
);
echo '</p>';

View File

@ -0,0 +1,54 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
// To improve readability, this tab has been divided into separate blocks, included below.
require dirname( __FILE__ ) . '/archives/help.php';
$wpseo_archives = array(
array(
'title' => esc_html__( 'Author archives settings', 'wordpress-seo' ),
'view_file' => 'paper-content/author-archive-settings.php',
'paper_id' => 'settings-author-archives',
),
array(
'title' => esc_html__( 'Date archives settings', 'wordpress-seo' ),
'view_file' => 'paper-content/date-archives-settings.php',
'paper_id' => 'settings-date-archives',
),
array(
'title' => esc_html__( 'Special Pages', 'wordpress-seo' ),
'view_file' => 'paper-content/special-pages.php',
'paper_id' => 'settings-special-pages',
),
);
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
foreach ( $wpseo_archives as $wpseo_archive_index => $wpseo_archive ) {
$wpseo_archive_presenter = new WPSEO_Paper_Presenter(
$wpseo_archive['title'],
dirname( __FILE__ ) . '/' . $wpseo_archive['view_file'],
array(
'collapsible' => true,
'expanded' => ( $wpseo_archive_index === 0 ),
'paper_id' => $wpseo_archive['paper_id'],
'recommended_replace_vars' => $recommended_replace_vars,
'editor_specific_replace_vars' => $editor_specific_replace_vars,
)
);
echo $wpseo_archive_presenter->get_output();
}
unset( $wpseo_archives, $wpseo_archive_presenter, $wpseo_archive_index );

View File

@ -0,0 +1,32 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Archive
*/
$archives_help_content = array(
sprintf(
/* translators: %1$s / %2$s: links to an article about duplicate content on yoast.com */
esc_html__( 'If you\'re running a one author blog, the author archive will be exactly the same as your homepage. This is what\'s called a %1$sduplicate content problem%2$s.', 'wordpress-seo' ),
'<a target="_blank" href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/duplicate-content' ) ) . '">',
'</a>'
),
sprintf(
/* translators: %s expands to <code>noindex, follow</code> */
esc_html__( 'If this is the case on your site, you can choose to either disable it (which makes it redirect to the homepage), or to add %s to it so it doesn\'t show up in the search results.', 'wordpress-seo' ),
'<code>noindex,follow</code>'
),
esc_html__( 'Note that links to archives might be still output by your theme and you would need to remove them separately.', 'wordpress-seo' ),
esc_html__( 'Date-based archives could in some cases also be seen as duplicate content.', 'wordpress-seo' ),
);
$archives_help = new WPSEO_Admin_Help_Panel(
'search-appearance-archives',
__( 'Learn more about the archives setting', 'wordpress-seo' ),
implode( ' ', $archives_help_content ),
'has-wrapper'
);
echo '<p class="help-button-inline"><strong>' . esc_html__( 'Archives settings help', 'wordpress-seo' ) . $archives_help->get_button_html() . '</strong><p>';
echo $archives_help->get_panel_html();

View File

@ -0,0 +1,21 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_breadcrumbs_presenter = new WPSEO_Paper_Presenter(
esc_html__( 'Breadcrumbs settings', 'wordpress-seo' ),
dirname( __FILE__ ) . '/paper-content/breadcrumbs-content.php',
array(
'paper_id' => 'settings-breadcrumbs',
)
);
echo $wpseo_breadcrumbs_presenter->get_output();

View File

@ -0,0 +1,22 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_general_presenter = new WPSEO_Paper_Presenter(
'',
dirname( __FILE__ ) . '/paper-content/general-content.php',
array(
'paper_id' => 'settings-general',
)
);
echo $wpseo_general_presenter->get_output();

View File

@ -0,0 +1,28 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_media_presenter = new WPSEO_Paper_Presenter(
esc_html__( 'Media & attachment URLs', 'wordpress-seo' ),
dirname( __FILE__ ) . '/paper-content/media-content.php',
array(
'help_text' => new WPSEO_Admin_Help_Panel(
'search-appearance-media',
__( 'Learn more about the Media and attachment URLs setting', 'wordpress-seo' ),
__( 'When you upload media (an image or video for example) to WordPress, it doesn\'t just save the media, it creates an attachment URL for it. These attachment pages are quite empty: they contain the media item and maybe a title if you entered one. Because of that, if you never use these attachment URLs, it\'s better to disable them, and redirect them to the media item itself.', 'wordpress-seo' ),
'has-wrapper'
),
'paper_id' => 'settings-media-attachment-url',
)
);
echo $wpseo_media_presenter->get_output();

View File

@ -0,0 +1,85 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Archive
*
* @uses Yoast_Form $yform Form object.
*/
$yform->toggle_switch(
'disable-author',
array(
'off' => __( 'Enabled', 'wordpress-seo' ),
'on' => __( 'Disabled', 'wordpress-seo' ),
),
__( 'Author archives', 'wordpress-seo' )
);
?>
<div id='author-archives-titles-metas-content' class='archives-titles-metas-content'>
<?php
$author_archives_help = new WPSEO_Admin_Help_Panel(
'noindex-author-wpseo',
esc_html__( 'Help on the author archives search results setting', 'wordpress-seo' ),
sprintf(
/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
esc_html__( 'Not showing the archive for authors in the search results technically means those will have a %1$s robots meta and will be excluded from XML sitemaps. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
'<code>noindex</code>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
)
);
$yform->index_switch(
'noindex-author-wpseo',
__( 'author archives', 'wordpress-seo' ),
$author_archives_help->get_button_html() . $author_archives_help->get_panel_html()
);
?>
<div id='noindex-author-noposts-wpseo-container'>
<?php
$author_archives_no_posts_help = new WPSEO_Admin_Help_Panel(
'noindex-author-noposts-wpseo',
esc_html__( 'Help on the authors without posts archive search results setting', 'wordpress-seo' ),
sprintf(
/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
esc_html__( 'Not showing the archives for authors without posts in the search results technically means those will have a %1$s robots meta and will be excluded from XML sitemaps. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
'<code>noindex</code>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
)
);
$yform->index_switch(
'noindex-author-noposts-wpseo',
__( 'archives for authors without posts', 'wordpress-seo' ),
$author_archives_no_posts_help->get_button_html() . $author_archives_no_posts_help->get_panel_html()
);
?>
</div>
<?php
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$editor = new WPSEO_Replacevar_Editor(
$yform,
array(
'title' => 'title-author-wpseo',
'description' => 'metadesc-author-wpseo',
'page_type_recommended' => $recommended_replace_vars->determine_for_archive( 'author' ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_archive( 'author' ),
'paper_style' => false,
)
);
$editor->render();
?>
</div>

View File

@ -0,0 +1,113 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Breadcrumbs
*
* @uses Yoast_Form $yform Form object.
*/
if ( ! current_theme_supports( 'yoast-seo-breadcrumbs' ) ) {
$yform->light_switch( 'breadcrumbs-enable', __( 'Enable Breadcrumbs', 'wordpress-seo' ) );
echo '<br/>';
}
echo '<div id="breadcrumbsinfo">';
$yform->textinput( 'breadcrumbs-sep', __( 'Separator between breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-home', __( 'Anchor text for the Homepage', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-prefix', __( 'Prefix for the breadcrumb path', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-archiveprefix', __( 'Prefix for Archive breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-searchprefix', __( 'Prefix for Search Page breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-404crumb', __( 'Breadcrumb for 404 Page', 'wordpress-seo' ) );
echo '<br/>';
if ( get_option( 'show_on_front' ) === 'page' && get_option( 'page_for_posts' ) > 0 ) {
$yform->show_hide_switch( 'breadcrumbs-display-blog-page', __( 'Show Blog page', 'wordpress-seo' ) );
}
$yoast_free_breadcrumb_bold_texts = array(
'on' => __( 'Bold', 'wordpress-seo' ),
'off' => __( 'Regular', 'wordpress-seo' ),
);
$yform->toggle_switch(
'breadcrumbs-boldlast',
$yoast_free_breadcrumb_bold_texts,
__( 'Bold the last page', 'wordpress-seo' )
);
echo '<br/><br/>';
/*
* WPSEO_Post_Type::get_accessible_post_types() should *not* be used here.
* Even posts that are not indexed, should be able to get breadcrumbs for accessibility/usability.
*/
$post_types = get_post_types( array( 'public' => true ), 'objects' );
if ( is_array( $post_types ) && $post_types !== array() ) {
echo '<h2>' . esc_html__( 'Taxonomy to show in breadcrumbs for content types', 'wordpress-seo' ) . '</h2>';
foreach ( $post_types as $pt ) {
$taxonomies = get_object_taxonomies( $pt->name, 'objects' );
if ( is_array( $taxonomies ) && $taxonomies !== array() ) {
$values = array( 0 => __( 'None', 'wordpress-seo' ) );
foreach ( $taxonomies as $tax ) {
if ( ! $tax->public ) {
continue;
}
$values[ $tax->name ] = $tax->labels->singular_name;
}
$label = $pt->labels->name . ' (<code>' . $pt->name . '</code>)';
$yform->select( 'post_types-' . $pt->name . '-maintax', $label, $values );
unset( $values, $tax );
}
unset( $taxonomies );
}
unset( $pt );
}
echo '<br/>';
$taxonomies = get_taxonomies(
array(
'public' => true,
'_builtin' => false,
),
'objects'
);
if ( is_array( $taxonomies ) && $taxonomies !== array() ) {
echo '<h2>' . esc_html__( 'Content type archive to show in breadcrumbs for taxonomies', 'wordpress-seo' ) . '</h2>';
foreach ( $taxonomies as $tax ) {
$values = array( 0 => __( 'None', 'wordpress-seo' ) );
if ( get_option( 'show_on_front' ) === 'page' && get_option( 'page_for_posts' ) > 0 ) {
$values['post'] = __( 'Blog', 'wordpress-seo' );
}
if ( is_array( $post_types ) && $post_types !== array() ) {
foreach ( $post_types as $pt ) {
if ( WPSEO_Post_Type::has_archive( $pt ) ) {
$values[ $pt->name ] = $pt->labels->name;
}
}
unset( $pt );
}
$label = $tax->labels->singular_name . ' (<code>' . $tax->name . '</code>)';
$yform->select( 'taxonomy-' . $tax->name . '-ptparent', $label, $values );
unset( $values, $tax );
}
}
unset( $taxonomies, $post_types );
?>
<br class="clear"/>
</div>
<h2><?php esc_html_e( 'How to insert breadcrumbs in your theme', 'wordpress-seo' ); ?></h2>
<p>
<?php
printf(
/* translators: %1$s / %2$s: links to the breadcrumbs implementation page on the Yoast knowledgebase */
esc_html__( 'Usage of this breadcrumbs feature is explained in %1$sour knowledge-base article on breadcrumbs implementation%2$s.', 'wordpress-seo' ),
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'http://yoa.st/breadcrumbs' ) ) . '" target="_blank">',
'</a>'
);
?>
</p>

View File

@ -0,0 +1,55 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Archive
*
* @uses Yoast_Form $yform Form object.
*/
$yform->toggle_switch(
'disable-date',
array(
'off' => __( 'Enabled', 'wordpress-seo' ),
'on' => __( 'Disabled', 'wordpress-seo' ),
),
__( 'Date archives', 'wordpress-seo' )
);
?>
<div id='date-archives-titles-metas-content' class='archives-titles-metas-content'>
<?php
$date_archives_help = new WPSEO_Admin_Help_Panel(
'noindex-archive-wpseo',
esc_html__( 'Help on the date archives search results setting', 'wordpress-seo' ),
sprintf(
/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
esc_html__( 'Not showing the date archives in the search results technically means those will have a %1$s robots meta. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
'<code>noindex</code>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
)
);
$yform->index_switch(
'noindex-archive-wpseo',
__( 'date archives', 'wordpress-seo' ),
$date_archives_help->get_button_html() . $date_archives_help->get_panel_html()
);
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$editor = new WPSEO_Replacevar_Editor(
$yform,
array(
'title' => 'title-archive-wpseo',
'description' => 'metadesc-archive-wpseo',
'page_type_recommended' => $recommended_replace_vars->determine_for_archive( 'date' ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_archive( 'date' ),
'paper_style' => false,
)
);
$editor->render();
?>
</div>

View File

@ -0,0 +1,12 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Media
*/
// To improve readability, this tab has been divided into separate blocks, included below.
require dirname( __FILE__ ) . '/general/force-rewrite-title.php';
require dirname( __FILE__ ) . '/general/title-separator.php';
require dirname( __FILE__ ) . '/general/homepage.php';
require dirname( __FILE__ ) . '/general/knowledge-graph.php';

View File

@ -0,0 +1,25 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
if ( ! current_theme_supports( 'title-tag' ) ) {
?>
<div class="tab-block">
<?php
$yform->light_switch( 'forcerewritetitle', __( 'Force rewrite titles', 'wordpress-seo' ) );
echo '<p class="description">';
printf(
/* translators: %1$s expands to Yoast SEO */
esc_html__( '%1$s has auto-detected whether it needs to force rewrite the titles for your pages, if you think it\'s wrong and you know what you\'re doing, you can change the setting here.', 'wordpress-seo' ),
'Yoast SEO'
);
echo '</p>';
?>
</div>
<?php
}

View File

@ -0,0 +1,58 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
?>
<div class="tab-block">
<?php
if ( 'posts' === get_option( 'show_on_front' ) ) {
$homepage_help = new WPSEO_Admin_Help_Panel(
'search-appearance-homepage',
__( 'Learn more about the homepage setting', 'wordpress-seo' ),
__( 'This is what shows in the search results when people find your homepage. This means this is probably what they see when they search for your brand name.', 'wordpress-seo' ),
'has-wrapper'
);
echo '<h2 class="help-button-inline">', esc_html__( 'Homepage', 'wordpress-seo' ), $homepage_help->get_button_html(), '</h2>';
echo $homepage_help->get_panel_html();
$editor = new WPSEO_Replacevar_Editor(
$yform,
array(
'title' => 'title-home-wpseo',
'description' => 'metadesc-home-wpseo',
'page_type_recommended' => 'homepage',
'page_type_specific' => 'page',
'paper_style' => false,
)
);
$editor->render();
}
else {
echo '<h2>', esc_html__( 'Homepage &amp; Front page', 'wordpress-seo' ), '</h2>';
echo '<p>';
printf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__( 'You can determine the title and description for the front page by %1$sediting the front page itself &raquo;%2$s', 'wordpress-seo' ),
'<a href="' . esc_url( get_edit_post_link( get_option( 'page_on_front' ) ) ) . '">',
'</a>'
);
echo '</p>';
if ( get_option( 'page_for_posts' ) > 0 ) {
echo '<p>';
printf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__( 'You can determine the title and description for the blog page by %1$sediting the blog page itself &raquo;%2$s', 'wordpress-seo' ),
'<a href="' . esc_url( get_edit_post_link( get_option( 'page_for_posts' ) ) ) . '">',
'</a>'
);
echo '</p>';
}
}
?>
</div>

View File

@ -0,0 +1,61 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
$knowledge_graph_help = new WPSEO_Admin_Help_Panel(
'search-appearance-knowledge-graph',
__( 'Learn more about the knowledge graph setting', 'wordpress-seo' ),
sprintf(
/* translators: %1$s opens the link to the Yoast.com article about Google's Knowledge Graph, %2$s closes the link, */
__( 'This data is shown as metadata in your site. It is intended to appear in %1$sGoogle\'s Knowledge Graph%2$s. You can be either an organization, or a person.', 'wordpress-seo' ),
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1-p' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
),
'has-wrapper'
);
?>
<div class="tab-block">
<h2 class="help-button-inline"><?php echo esc_html__( 'Knowledge Graph & Schema.org', 'wordpress-seo' ) . $knowledge_graph_help->get_button_html(); ?></h2>
<?php
echo $knowledge_graph_help->get_panel_html();
/**
* Filter: 'wpseo_knowledge_graph_setting_msg' - Allows adding a message above these settings.
*
* @api string unsigned Message.
*/
$message = apply_filters( 'wpseo_knowledge_graph_setting_msg', '' );
if ( ! empty( $message ) ) {
echo '<p><strong>', esc_html( $message ), '</strong></p>';
}
?>
<p>
<?php esc_html_e( 'Choose whether the site represents an organization or a person.', 'wordpress-seo' ); ?>
</p>
<?php
$yoast_free_kg_select_options = array(
'company' => __( 'Organization', 'wordpress-seo' ),
'person' => __( 'Person', 'wordpress-seo' ),
);
$yform->select( 'company_or_person', __( 'Organization or person', 'wordpress-seo' ), $yoast_free_kg_select_options, 'styled', false );
?>
<div id="knowledge-graph-company">
<h3><?php esc_html_e( 'Organization', 'wordpress-seo' ); ?></h3>
<?php
$yform->textinput( 'company_name', __( 'Organization name', 'wordpress-seo' ), array( 'autocomplete' => 'organization' ) );
$yform->media_input( 'company_logo', __( 'Organization logo', 'wordpress-seo' ) );
?>
<div id="wpseo-local-seo-upsell"></div>
</div>
<div id="knowledge-graph-person">
<h3><?php esc_html_e( 'Personal info', 'wordpress-seo' ); ?></h3>
<?php
echo '<div id="wpseo-person-selector"></div>';
$yform->hidden( 'company_or_person_user_id', 'person_id' );
?>
</div>
</div>

View File

@ -0,0 +1,25 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
$title_separator_help = new WPSEO_Admin_Help_Panel(
'search-appearance-title-separator',
__( 'Learn more about the title separator setting', 'wordpress-seo' ),
__( 'Choose the symbol to use as your title separator. This will display, for instance, between your post title and site name. Symbols are shown in the size they\'ll appear in the search results.', 'wordpress-seo' ),
'has-wrapper'
);
?>
<div class="tab-block">
<h2 class="help-button-inline"><?php echo esc_html__( 'Title Separator', 'wordpress-seo' ) . $title_separator_help->get_button_html(); ?></h2>
<?php
echo $title_separator_help->get_panel_html();
$legend = __( 'Title separator symbol', 'wordpress-seo' );
$legend_attr = array( 'class' => 'radiogroup screen-reader-text' );
$yform->radio( 'separator', WPSEO_Option_Titles::get_instance()->get_separator_options_for_display(), $legend, $legend_attr );
?>
</div>

View File

@ -0,0 +1,51 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Media
*
* @uses Yoast_Form $yform Form object.
*/
$wpseo_post_type = get_post_type_object( 'attachment' );
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$view_utils = new Yoast_View_Utils();
?>
<p><strong><?php esc_html_e( 'We recommend you set this to Yes.', 'wordpress-seo' ); ?></strong></p>
<?php
$yoast_free_disable_attachments_texts = array(
'on' => __( 'Yes', 'wordpress-seo' ),
'off' => __( 'No', 'wordpress-seo' ),
);
$yform->toggle_switch(
'disable-attachment',
$yoast_free_disable_attachments_texts,
__( 'Redirect attachment URLs to the attachment itself?', 'wordpress-seo' )
);
?>
<div id="media_settings">
<br/>
<br/>
<?php
$noindex_option_name = 'noindex-' . $wpseo_post_type->name;
if ( WPSEO_Options::get( 'is-media-purge-relevant' ) && WPSEO_Options::get( $noindex_option_name ) === false ) {
$description =
esc_html__( 'By enabling this option, attachment URLs become visible to both your visitors and Google. To add value to your website, they should contain useful information, or they might have a negative impact on your ranking.', 'wordpress-seo' ) . ' ' .
sprintf(
/* translators: %1$s expands to the link to the article, %2$s closes the link to the article */
esc_html__( 'Please carefully consider the implications and %1$sread this post%2$s if you want more information about the impact of showing media in search results.', 'wordpress-seo' ),
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/2r8' ) ) . '" rel="noopener noreferrer" target="_blank">',
'</a>'
);
echo '<div style="clear:both; background-color: #ffeb3b; color: #000000; padding: 16px; max-width: 450px; margin-bottom: 32px;">' . $description . '</div>';
}
require dirname( __FILE__ ) . '/post_type/post-type.php';
?>
</div>

View File

@ -0,0 +1,73 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Taxonomies
*
* @uses Yoast_Form $yform Form object.
* @uses WP_Post_Type $wpseo_post_type
* @uses Yoast_View_Utils $view_utils
* @uses WPSEO_Admin_Recommended_Replace_Vars $recommended_replace_vars
* @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
*/
$single_label = $wpseo_post_type->labels->singular_name;
$paper_style = false;
/* translators: %s is the singular version of the post type's name. */
echo '<h3>' . esc_html( sprintf( __( 'Settings for single %s URLs', 'wordpress-seo' ), $wpseo_post_type->labels->singular_name ) ) . '</h3>';
require dirname( __FILE__ ) . '/post_type/post-type.php';
if ( $wpseo_post_type->name === 'product' && WPSEO_Utils::is_woocommerce_active() ) {
require dirname( __FILE__ ) . '/post_type/woocommerce-shop-page.php';
return;
}
if ( WPSEO_Post_Type::has_archive( $wpseo_post_type ) ) {
$plural_label = $wpseo_post_type->labels->name;
/* translators: %s is the plural version of the post type's name. */
echo '<h3>' . esc_html( sprintf( __( 'Settings for %s archive', 'wordpress-seo' ), $plural_label ) ) . '</h3>';
$custom_post_type_archive_help = $view_utils->search_results_setting_help( $wpseo_post_type, 'archive' );
$yform->index_switch(
'noindex-ptarchive-' . $wpseo_post_type->name,
sprintf(
/* translators: %s expands to the post type's name. */
__( 'the archive for %s', 'wordpress-seo' ),
$plural_label
),
$custom_post_type_archive_help->get_button_html() . $custom_post_type_archive_help->get_panel_html()
);
$page_type = $recommended_replace_vars->determine_for_archive( $wpseo_post_type->name );
$editor = new WPSEO_Replacevar_Editor(
$yform,
array(
'title' => 'title-ptarchive-' . $wpseo_post_type->name,
'description' => 'metadesc-ptarchive-' . $wpseo_post_type->name,
'page_type_recommended' => $recommended_replace_vars->determine_for_archive( $wpseo_post_type->name ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_archive( $wpseo_post_type->name ),
'paper_style' => false,
)
);
$editor->render();
if ( WPSEO_Options::get( 'breadcrumbs-enable' ) === true ) {
/* translators: %s is the plural version of the post type's name. */
echo '<h4>' . esc_html( sprintf( __( 'Breadcrumb settings for %s archive', 'wordpress-seo' ), $plural_label ) ) . '</h4>';
$yform->textinput( 'bctitle-ptarchive-' . $wpseo_post_type->name, __( 'Breadcrumbs title', 'wordpress-seo' ) );
}
}
/**
* Allow adding a custom checkboxes to the admin meta page - Post Types tab.
*
* @api WPSEO_Admin_Pages $yform The WPSEO_Admin_Pages object
* @api String $name The post type name
*/
do_action( 'wpseo_admin_page_meta_post_types', $yform, $wpseo_post_type->name );

View File

@ -0,0 +1,45 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\PaperContent
*
* @uses Yoast_Form $yform Form object.
* @uses WP_Taxonomy $wpseo_post_type
* @uses Yoast_View_Utils $view_utils
* @uses WPSEO_Admin_Recommended_Replace_Vars $recommended_replace_vars
* @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
*/
$show_post_type_help = $view_utils->search_results_setting_help( $wpseo_post_type );
$noindex_option_name = 'noindex-' . $wpseo_post_type->name;
$yform->index_switch(
$noindex_option_name,
$wpseo_post_type->labels->name,
$show_post_type_help->get_button_html() . $show_post_type_help->get_panel_html()
);
$yform->show_hide_switch(
'showdate-' . $wpseo_post_type->name,
__( 'Date in Snippet Preview', 'wordpress-seo' )
);
$yform->show_hide_switch(
'display-metabox-pt-' . $wpseo_post_type->name,
/* translators: %1$s expands to Yoast SEO */
sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' )
);
$editor = new WPSEO_Replacevar_Editor(
$yform,
array(
'title' => 'title-' . $wpseo_post_type->name,
'description' => 'metadesc-' . $wpseo_post_type->name,
'page_type_recommended' => $recommended_replace_vars->determine_for_post_type( $wpseo_post_type->name ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_post_type( $wpseo_post_type->name ),
'paper_style' => false,
)
);
$editor->render();

View File

@ -0,0 +1,24 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses WP_Post_Type $wpseo_post_type
*/
$woocommerce_shop_page = new WPSEO_WooCommerce_Shop_Page();
$description = __( 'You haven\'t set a Shop page in your WooCommerce settings. Please do this first.', 'wordpress-seo' );
if ( $woocommerce_shop_page->get_shop_page_id() !== -1 ) {
$description = sprintf(
/* translators: %1$s expands to an opening anchor tag, %2$s expands to a closing anchor tag. */
__( 'You can edit the SEO meta-data for this custom type on the %1$sShop page%2$s.', 'wordpress-seo' ),
'<a href="' . get_edit_post_link( $woocommerce_shop_page->get_shop_page_id() ) . '">',
'</a>'
);
}
/* translators: %s expands to the post type name. */
echo '<h3>' . esc_html( sprintf( __( 'Settings for %s archive', 'wordpress-seo' ), $wpseo_post_type->labels->name ) ) . '</h3>';
echo '<p>' . $description . '</p>';

View File

@ -0,0 +1,52 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Rss
*
* @uses Yoast_Form $yform Form object.
*/
$textarea_atts = array(
'cols' => '50',
'rows' => '5',
);
$yform->textarea( 'rssbefore', __( 'Content to put before each post in the feed', 'wordpress-seo' ), $textarea_atts );
$yform->textarea( 'rssafter', __( 'Content to put after each post in the feed', 'wordpress-seo' ), $textarea_atts );
$rss_variables_help = new WPSEO_Admin_Help_Panel(
'search-appearance-rss-variables',
__( 'Learn more about the available variables', 'wordpress-seo' ),
__( 'You can use the following variables within the content, they will be replaced by the value on the right.', 'wordpress-seo' ),
'has-wrapper'
);
echo '<h2 class="help-button-inline">' . esc_html__( 'Available variables', 'wordpress-seo' ) . $rss_variables_help->get_button_html() . '</h2>';
echo $rss_variables_help->get_panel_html();
?>
<table class="wpseo yoast_help yoast-table-scrollable">
<thead>
<tr>
<th scope="col"><?php esc_html_e( 'Variable', 'wordpress-seo' ); ?></th>
<th scope="col"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="yoast-variable-name">%%AUTHORLINK%%</td>
<td class="yoast-variable-desc"><?php esc_html_e( 'A link to the archive for the post author, with the authors name as anchor text.', 'wordpress-seo' ); ?></td>
</tr>
<tr>
<td class="yoast-variable-name">%%POSTLINK%%</td>
<td class="yoast-variable-desc"><?php esc_html_e( 'A link to the post, with the title as anchor text.', 'wordpress-seo' ); ?></td>
</tr>
<tr>
<td class="yoast-variable-name">%%BLOGLINK%%</td>
<td class="yoast-variable-desc"><?php esc_html_e( "A link to your site, with your site's name as anchor text.", 'wordpress-seo' ); ?></td>
</tr>
<tr>
<td class="yoast-variable-name">%%BLOGDESCLINK%%</td>
<td class="yoast-variable-desc"><?php esc_html_e( "A link to your site, with your site's name and description as anchor text.", 'wordpress-seo' ); ?></td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,27 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Archive
*
* @uses Yoast_Form $yform Form object.
*/
$special_pages_help = new WPSEO_Admin_Help_Panel(
'search-appearance-special-pages',
__( 'Learn more about the special pages setting', 'wordpress-seo' ),
sprintf(
/* translators: %s expands to <code>noindex, follow</code>. */
__( 'These pages will be %s by default, so they will never show up in search results.', 'wordpress-seo' ),
'<code>noindex, follow</code>'
),
'has-wrapper'
);
$editor = new WPSEO_Replacevar_Field( $yform, 'title-search-wpseo', __( 'Search pages', 'wordpress-seo' ), 'search', 'search' );
$editor->render();
echo '<br/>';
$editor = new WPSEO_Replacevar_Field( $yform, 'title-404-wpseo', __( '404 pages', 'wordpress-seo' ), '404', '404' );
$editor->render();

View File

@ -0,0 +1,63 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Taxonomies
*
* @uses Yoast_Form $yform Form object.
* @uses WP_Taxonomy $wpseo_taxonomy
* @uses Yoast_View_Utils $view_utils
* @uses string $title
* @uses WPSEO_Admin_Recommended_Replace_Vars $recommended_replace_vars
* @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
*/
if ( $wpseo_taxonomy->name === 'post_format' ) {
$yform->light_switch(
'disable-post_format',
__( 'Format-based archives', 'wordpress-seo' ),
array( __( 'Enabled', 'wordpress-seo' ), __( 'Disabled', 'wordpress-seo' ) ),
false
);
}
echo "<div id='" . esc_attr( $wpseo_taxonomy->name ) . "-titles-metas'>";
$taxonomies_help = $view_utils->search_results_setting_help( $wpseo_taxonomy );
$yform->index_switch(
'noindex-tax-' . $wpseo_taxonomy->name,
$title,
$taxonomies_help->get_button_html() . $taxonomies_help->get_panel_html()
);
// Determine the page type for the term, this is needed for the recommended replacement variables.
$page_type = $recommended_replace_vars->determine_for_term( $wpseo_taxonomy->name );
$editor = new WPSEO_Replacevar_Editor(
$yform,
array(
'title' => 'title-tax-' . $wpseo_taxonomy->name,
'description' => 'metadesc-tax-' . $wpseo_taxonomy->name,
'page_type_recommended' => $recommended_replace_vars->determine_for_term( $wpseo_taxonomy->name ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_term( $wpseo_taxonomy->name ),
'paper_style' => false,
)
);
$editor->render();
if ( $wpseo_taxonomy->name !== 'post_format' ) {
/* translators: %1$s expands to Yoast SEO */
$yform->show_hide_switch( 'display-metabox-tax-' . $wpseo_taxonomy->name, sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' ) );
}
/**
* Allow adding custom checkboxes to the admin meta page - Taxonomies tab.
*
* @api WPSEO_Admin_Pages $yform The WPSEO_Admin_Pages object
* @api Object $tax The taxonomy
*/
do_action( 'wpseo_admin_page_meta_taxonomies', $yform, $wpseo_taxonomy );
echo '</div>';

View File

@ -0,0 +1,54 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
/*
* WPSEO_Post_Type::get_accessible_post_types() should *not* be used here.
* Otherwise setting a post-type to `noindex` will remove it from the list,
* making it very hard to restore the setting again.
*/
$wpseo_post_types = get_post_types( array( 'public' => true ), 'objects' );
// We'll show attachments on the Media tab.
$wpseo_post_types = WPSEO_Post_Type::filter_attachment_post_type( $wpseo_post_types );
echo '<p>';
esc_html_e( 'The settings on this page allow you to specify what the default search appearance should be for any type of content you have. You can choose which content types appear in search results and what their default description should be.', 'wordpress-seo' );
echo '</p>';
if ( is_array( $wpseo_post_types ) && $wpseo_post_types !== array() ) {
$view_utils = new Yoast_View_Utils();
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
foreach ( array_values( $wpseo_post_types ) as $wpseo_post_type_index => $post_type ) {
$wpseo_post_type_presenter = new WPSEO_Paper_Presenter(
$post_type->labels->name,
dirname( __FILE__ ) . '/paper-content/post-type-content.php',
array(
'collapsible' => true,
'expanded' => ( $wpseo_post_type_index === 0 ),
'paper_id' => 'settings-' . $post_type->name,
'view_data' => array(
'wpseo_post_type' => $post_type,
'view_utils' => $view_utils,
'recommended_replace_vars' => $recommended_replace_vars,
'editor_specific_replace_vars' => $editor_specific_replace_vars,
),
'title' => $post_type->labels->name,
'title_after' => ' (<code>' . esc_html( $post_type->name ) . '</code>)',
)
);
echo $wpseo_post_type_presenter->get_output();
}
}

View File

@ -0,0 +1,28 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_rss_presenter = new WPSEO_Paper_Presenter(
esc_html__( 'RSS feed settings', 'wordpress-seo' ),
dirname( __FILE__ ) . '/paper-content/rss-content.php',
array(
'help_text' => new WPSEO_Admin_Help_Panel(
'search-appearance-rss',
__( 'Learn more about the RSS feed setting', 'wordpress-seo' ),
__( 'This feature is used to automatically add content to your RSS, more specifically, it\'s meant to add links back to your blog and your blog posts, so dumb scrapers will automatically add these links too, helping search engines identify you as the original source of the content.', 'wordpress-seo' ),
'has-wrapper'
),
'paper_id' => 'settings-rss-feed',
)
);
echo $wpseo_rss_presenter->get_output();

View File

@ -0,0 +1,49 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
if ( is_array( $wpseo_taxonomies ) && $wpseo_taxonomies !== array() ) {
$view_utils = new Yoast_View_Utils();
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
// Explicitly hide all the core taxonomies we never want to do stuff for.
$wpseo_taxonomies = array_diff_key( $wpseo_taxonomies, array_flip( array( 'link_category', 'nav_menu' ) ) );
foreach ( array_values( $wpseo_taxonomies ) as $wpseo_taxonomy_index => $wpseo_taxonomy ) {
$wpseo_taxonomy_presenter = new WPSEO_Paper_Presenter(
$wpseo_taxonomy->labels->name,
dirname( __FILE__ ) . '/paper-content/taxonomy-content.php',
array(
'collapsible' => true,
'expanded' => ( $wpseo_taxonomy_index === 0 ),
'paper_id' => 'settings-' . $wpseo_taxonomy->name,
'view_data' => array(
'wpseo_taxonomy' => $wpseo_taxonomy,
'view_utils' => $view_utils,
'recommended_replace_vars' => $recommended_replace_vars,
'editor_specific_replace_vars' => $editor_specific_replace_vars,
),
'title_after' => ' (<code>' . esc_html( $wpseo_taxonomy->name ) . '</code>)',
)
);
echo $wpseo_taxonomy_presenter->get_output();
}
unset( $wpseo_taxonomy_index, $wpseo_taxonomy_presenter, $view_utils, $recommended_replace_vars );
}
unset( $wpseo_taxonomies );
printf( '<h2>%s</h2>', esc_html__( 'Category URLs', 'wordpress-seo' ) );
require dirname( __FILE__ ) . '/taxonomies/category-url.php';

View File

@ -0,0 +1,28 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Taxonomies
*
* @uses Yoast_Form $yform Form object.
*/
$remove_buttons = array( __( 'Keep', 'wordpress-seo' ), __( 'Remove', 'wordpress-seo' ) );
$stripcategorybase_help = new WPSEO_Admin_Help_Panel(
'opengraph',
esc_html__( 'Help on the category prefix setting', 'wordpress-seo' ),
sprintf(
/* translators: %s expands to <code>/category/</code> */
esc_html__( 'Category URLs in WordPress contain a prefix, usually %s, this feature removes that prefix, for categories only.', 'wordpress-seo' ),
'<code>/category/</code>'
)
);
$yform->light_switch(
'stripcategorybase',
__( 'Remove the categories prefix', 'wordpress-seo' ),
$remove_buttons,
false,
$stripcategorybase_help->get_button_html() . $stripcategorybase_help->get_panel_html()
);

View File

@ -0,0 +1,67 @@
<?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( '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 ) {
$help_text = esc_html( $feature->label );
if ( ! empty( $feature->extra ) ) {
$help_text .= ' ' . $feature->extra;
}
if ( ! empty( $feature->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( $feature->read_more_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
);
$yform->toggle_switch(
WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
array(
'on' => __( 'Allow Control', 'wordpress-seo' ),
'off' => __( 'Disable', 'wordpress-seo' ),
),
'<strong>' . $feature->name . '</strong>',
$feature_help->get_button_html() . $feature_help->get_panel_html()
);
}
?>
</div>
<?php
/*
* Required to prevent our settings framework from saving the default because the field
* isn't explicitly set when saving the Dashboard page.
*/
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );

View File

@ -0,0 +1,52 @@
<?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();
}
/*
* {@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' ),
array(
'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>';

View File

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

View File

@ -0,0 +1,92 @@
<?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();
}
$social_profiles_help = new WPSEO_Admin_Help_Panel(
'social-accounts',
__( 'Learn more about your social profiles settings', 'wordpress-seo' ),
__( 'To let search engines know which social profiles are associated to this site, enter your site social profiles data below.', 'wordpress-seo' ) . ' ' .
__( 'If a Wikipedia page for you or your organization exists, add it too.', 'wordpress-seo' ),
'has-wrapper'
);
$company_or_person = WPSEO_Options::get( 'company_or_person', '' );
$organization_social_fields = array(
array(
'id' => 'facebook_site',
'label' => __( 'Facebook Page URL', 'wordpress-seo' ),
),
array(
'id' => 'twitter_site',
'label' => __( 'Twitter Username', 'wordpress-seo' ),
),
array(
'id' => 'instagram_url',
'label' => __( 'Instagram URL', 'wordpress-seo' ),
),
array(
'id' => 'linkedin_url',
'label' => __( 'LinkedIn URL', 'wordpress-seo' ),
),
array(
'id' => 'myspace_url',
'label' => __( 'MySpace URL', 'wordpress-seo' ),
),
array(
'id' => 'pinterest_url',
'label' => __( 'Pinterest URL', 'wordpress-seo' ),
),
array(
'id' => 'youtube_url',
'label' => __( 'YouTube URL', 'wordpress-seo' ),
),
array(
'id' => 'wikipedia_url',
'label' => __( 'Wikipedia URL', 'wordpress-seo' ),
),
);
$yform = Yoast_Form::get_instance();
if ( $company_or_person === 'person' ) {
echo '<div class="paper tab-block">';
echo '<h2><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Your website is currently configured to represent a Person', 'wordpress-seo' ) . '</h2>';
echo '<p><em>';
esc_html_e( 'That means that the form and information below is disabled, and not used.', 'wordpress-seo' );
echo '</em></p>';
echo '<p>';
$user_id = WPSEO_Options::get( 'company_or_person_user_id', '' );
$person = get_userdata( $user_id );
printf( esc_html__( 'To change the social accounts used for your site, update the details for %1$s.', 'wordpress-seo' ), '<a href="' . admin_url( 'user-edit.php?user_id=' . $user_id ) . '">' . $person->display_name . '</a>' );
echo ' ';
printf( esc_html__( 'To make your site represent a Company or Organization go to %1$sSearch Appearance%2$s and set Organization or Person to "Organization".', 'wordpress-seo' ), '<a href="' . admin_url( 'admin.php?page=wpseo_titles' ) . '">', '</a>' );
echo '</p></div>';
// Organization social fields should still be rendered, because other wise the values are lost on save.
foreach ( $organization_social_fields as $organization ) {
$yform->hidden( $organization['id'] );
}
}
if ( $company_or_person === 'company' ) {
echo '<h2 class="help-button-inline">' . esc_html__( 'Organization social profiles', 'wordpress-seo' ) . $social_profiles_help->get_button_html() . '</h2>';
echo $social_profiles_help->get_panel_html();
foreach ( $organization_social_fields as $organization ) {
$yform->textinput( $organization['id'], $organization['label'] );
}
}
do_action( 'wpseo_admin_other_section' );

View File

@ -0,0 +1,82 @@
<?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 '<h2>' . esc_html__( 'Facebook settings', 'wordpress-seo' ) . '</h2>';
$yform->light_switch( 'opengraph', __( 'Add Open Graph meta data', 'wordpress-seo' ) );
?>
<p>
<?php
esc_html_e( 'Enable this feature if you want Facebook and other social media to display a preview with images and a text excerpt when a link to your site is shared.', 'wordpress-seo' );
?>
</p>
<?php
$yform->textinput( 'fbadminapp', __( 'Facebook App ID', 'wordpress-seo' ) );
if ( 'posts' === get_option( 'show_on_front' ) ) {
$social_facebook_frontpage_help = new WPSEO_Admin_Help_Panel(
'social-facebook-frontpage',
esc_html__( 'Learn more about the title separator setting', 'wordpress-seo' ),
esc_html__( 'These are the title, description and image used in the Open Graph meta tags on the front page of your site.', 'wordpress-seo' ),
'has-wrapper'
);
echo '<h2 class="help-button-inline">' . esc_html__( 'Frontpage settings', 'wordpress-seo' ) . $social_facebook_frontpage_help->get_button_html() . '</h2>';
echo $social_facebook_frontpage_help->get_panel_html();
$yform->media_input( 'og_frontpage_image', __( 'Image URL', 'wordpress-seo' ) );
$yform->textinput( 'og_frontpage_title', __( 'Title', 'wordpress-seo' ) );
$yform->textinput( 'og_frontpage_desc', __( 'Description', 'wordpress-seo' ) );
$copy_home_description_button_label = esc_html__( 'Copy home meta description', 'wordpress-seo' );
// Offer copying of meta description.
$homepage_meta_description = WPSEO_Options::get( 'metadesc-home-wpseo' );
if ( ! empty( $homepage_meta_description ) ) {
$copy_home_meta_desc_help = new WPSEO_Admin_Help_Panel(
'copy-home-meda-desc',
esc_html__( 'Help on copying the home meta description', 'wordpress-seo' ),
sprintf(
/* translators: 1: link open tag; 2: link close tag., 3: the translated label of the button */
esc_html__( 'Click the "%3$s" button to use the meta description already set in the %1$sSearch Appearance Homepage%2$s setting.', 'wordpress-seo' ),
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_titles' ) ) . '">',
'</a>',
$copy_home_description_button_label
)
);
echo '<input type="hidden" id="meta_description" value="', esc_attr( $homepage_meta_description ), '" />';
echo '<div class="label desc copy-home-meta-description">' .
'<button type="button" id="copy-home-meta-description" class="button">', $copy_home_description_button_label, '</button>' .
$copy_home_meta_desc_help->get_button_html() .
$copy_home_meta_desc_help->get_panel_html() .
'</div>';
}
}
echo '<h2>' . esc_html__( 'Default settings', 'wordpress-seo' ) . '</h2>';
$yform->media_input( 'og_default_image', __( 'Image URL', 'wordpress-seo' ) );
?>
<p class="desc label">
<?php esc_html_e( 'This image is used if the post/page being shared does not contain any images.', 'wordpress-seo' ); ?>
</p>
<?php
do_action( 'wpseo_admin_opengraph_section' );

View File

@ -0,0 +1,38 @@
<?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 '<h2>' . esc_html__( 'Pinterest settings', 'wordpress-seo' ) . '</h2>';
printf(
'<p>%s</p>',
esc_html__( 'Pinterest uses Open Graph metadata just like Facebook, so be sure to keep the Open Graph checkbox on the Facebook tab checked if you want to optimize your site for Pinterest.', 'wordpress-seo' )
);
printf(
'<p>%s</p>',
esc_html__( 'If you have already confirmed your website with Pinterest, you can skip the step below.', 'wordpress-seo' )
);
echo '<p>';
printf(
/* translators: %1$s / %2$s expands to a link to pinterest.com's help page. */
esc_html__( 'To %1$sconfirm your site with Pinterest%2$s, add the meta tag here:', 'wordpress-seo' ),
'<a target="_blank" href="https://pinterest.com/settings/#claimWebsite">',
'</a>'
);
echo '</p>';
$yform->textinput( 'pinterestverify', __( 'Pinterest confirmation', 'wordpress-seo' ) );
do_action( 'wpseo_admin_pinterest_section' );

View File

@ -0,0 +1,29 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*
* @uses Yoast_Form $yform Form object.
* @uses array WPSEO_Option_Social::$twitter_card_types
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
echo '<h2>' . esc_html__( 'Twitter settings', 'wordpress-seo' ) . '</h2>';
$yform->light_switch( 'twitter', __( 'Add Twitter card meta data', 'wordpress-seo' ) );
echo '<p>';
esc_html_e( 'Enable this feature if you want Twitter to display a preview with images and a text excerpt when a link to your site is shared.', 'wordpress-seo' );
echo '</p>';
echo '<br />';
$yform->select( 'twitter_card_type', __( 'The default card type to use', 'wordpress-seo' ), WPSEO_Option_Social::$twitter_card_types );
do_action( 'wpseo_admin_twitter_section' );

View File

@ -0,0 +1,110 @@
<?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>';
esc_html_e( 'Yoast SEO did not detect any plugin data from plugins it can import from.', 'wordpress-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>
<?php esc_html_e( 'This will import the post metadata like SEO titles and descriptions into your Yoast SEO metadata. It will only do this when there is no existing Yoast SEO metadata yet. The original data will remain in place.', '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-import-plugins', '_wpnonce', true, true );
wpseo_import_external_select( 'import_external_plugin', $import_check->needs_import );
?>
<?php
do_action( 'wpseo_import_other_plugins' );
?>
<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: Run the configuration wizard', 'wordpress-seo' ); ?></h3>
<p>
<?php
printf(
esc_html__( 'You should run the configuration wizard, from the SEO &rarr; General &rarr; Dashboard page, to make sure all the settings for your site are correct.', 'wordpress-seo' ),
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_dashboard' ) ) . '">',
'</a>'
);
?>
</p>
</div>
<div class="tab-block">
<h3><?php esc_html_e( 'Step 5: Clean up', 'wordpress-seo' ); ?></h3>
<p>
<?php esc_html_e( 'Once you\'re certain your site is OK, you can clean up. This will remove all the original data.', 'wordpress-seo' ); ?>
</p>
<form action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#import-seo' ) ); ?>"
method="post" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
<?php
wp_nonce_field( 'wpseo-clean-plugins', '_wpnonce', true, true );
wpseo_import_external_select( 'clean_external_plugin', $import_check->needs_import );
?>
<input type="submit" class="button button-primary" name="clean_external"
value="<?php esc_attr_e( 'Clean', 'wordpress-seo' ); ?>"/>
</form>
</div>

View File

@ -0,0 +1,38 @@
<?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' );
if ( filter_input( INPUT_POST, 'do_export' ) ) {
$export = new WPSEO_Export();
$export->export();
return;
}
$wpseo_export_phrase = sprintf(
/* translators: %1$s expands to Yoast SEO */
__( 'Export your %1$s settings here, to copy them on another site.', 'wordpress-seo' ),
'Yoast SEO'
);
?>
<p><?php echo esc_html( $wpseo_export_phrase ); ?></p>
<form
action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#wpseo-export' ) ); ?>"
method="post"
accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
<?php wp_nonce_field( WPSEO_Export::NONCE_ACTION ); ?>
<input type="hidden" name="do_export" value="1" />
<button type="submit" class="button button-primary" id="export-button"><?php echo esc_html( $submit_button_value ); ?></button>
</form>

View File

@ -0,0 +1,37 @@
<?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>
<?php
printf(
/* translators: 1: Import settings button string from below. */
esc_html__( 'Import settings by pasting the settings you copied from another site here and clicking "%s".', 'wordpress-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="screen-reader-text" for="settings-import"><?php esc_html_e( 'Paste your settings from another Yoast SEO installation.', 'wordpress-seo' ); ?></label>
<textarea id="settings-import" rows="10" cols="140" name="settings_import"></textarea><br/>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Import settings', 'wordpress-seo' ); ?>"/>
</form>

View File

@ -0,0 +1,144 @@
<?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 = array(
'type',
'paged',
'post_type_filter',
'post_status',
'order',
'orderby',
);
$input_get = array();
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 = array(
'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 = array(
'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(
array( '_wp_http_referer', '_wpnonce' ),
$request_uri
)
);
exit;
}
/**
* Outputs a help center.
*/
function wpseo_render_help_center() {
$tabs = new WPSEO_Option_Tabs( '', '' );
$bulk_editor_tab_title = new WPSEO_Option_Tab(
'title',
__( 'Bulk editor', 'wordpress-seo' ),
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-bulk-editor' ) )
);
$tabs->add_tab( $bulk_editor_tab_title );
$bulk_editor_tab_description = new WPSEO_Option_Tab(
'description',
__( 'Bulk editor', 'wordpress-seo' ),
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-bulk-editor' ) )
);
$tabs->add_tab( $bulk_editor_tab_description );
$helpcenter = new WPSEO_Help_Center( '', $tabs, WPSEO_Utils::is_yoast_seo_premium() );
$helpcenter->localize_data();
$helpcenter->mount();
}
/**
* 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>
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>
<?php wpseo_render_help_center(); ?>
<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>

View File

@ -0,0 +1,250 @@
<?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();
$robots_file = get_home_path() . 'robots.txt';
$ht_access_file = get_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 ) ) {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Writing to .htaccess file and escaping for HTML will break functionality.
$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>';
}
$helpcenter_tab = new WPSEO_Option_Tab(
'bulk-editor',
__( 'Bulk editor', 'wordpress-seo' ),
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-file-editor' ) )
);
$helpcenter = new WPSEO_Help_Center( 'bulk-editor', $helpcenter_tab, WPSEO_Utils::is_yoast_seo_premium() );
$helpcenter->localize_data();
$helpcenter->mount();
// 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( get_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 '<p><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></p>';
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 '<p><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></p>';
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 );
}

View File

@ -0,0 +1,143 @@
<?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();
$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.
*/
if ( filter_input( INPUT_POST, 'import' ) || filter_input( INPUT_GET, 'import' ) ) {
check_admin_referer( 'wpseo-import' );
$post_wpseo = filter_input( INPUT_POST, 'wpseo', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
$action = 'import';
}
elseif ( filter_input( INPUT_POST, 'import_external' ) ) {
check_admin_referer( 'wpseo-import-plugins' );
$class = filter_input( INPUT_POST, 'import_external_plugin' );
if ( class_exists( $class ) ) {
$import = new WPSEO_Import_Plugin( new $class(), 'import' );
}
}
elseif ( filter_input( INPUT_POST, 'clean_external' ) ) {
check_admin_referer( 'wpseo-clean-plugins' );
$class = filter_input( INPUT_POST, 'clean_external_plugin' );
if ( class_exists( $class ) ) {
$import = new WPSEO_Import_Plugin( new $class(), 'cleanup' );
}
}
elseif ( filter_input( INPUT_POST, 'settings_import' ) ) {
$import = new WPSEO_Import_Settings();
$import->import();
}
/**
* Allow custom import actions.
*
* @api WPSEO_Import_Status $import Contains info about the handled import.
*/
$import = apply_filters( 'wpseo_handle_import', $import );
if ( $import ) {
$message = '';
if ( $import->status instanceof WPSEO_Import_Status ) {
$message = $import->status->get_msg();
}
/**
* Allow customization of import/export message.
*
* @api string $msg The message.
*/
$msg = apply_filters( 'wpseo_import_message', $message );
if ( ! empty( $msg ) ) {
$status = 'error';
if ( $import->status->status ) {
$status = 'updated';
}
echo '<div id="message" class="message ', $status, '"><p>', esc_html( $msg ), '</p></div>';
}
}
$tabs = array(
'wpseo-import' => array(
'label' => __( 'Import settings', 'wordpress-seo' ),
'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
),
'wpseo-export' => array(
'label' => __( 'Export settings', 'wordpress-seo' ),
'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
),
'import-seo' => array(
'label' => __( 'Import from other SEO plugins', 'wordpress-seo' ),
'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
),
);
?>
<br/><br/>
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
<?php foreach ( $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
$helpcenter_tabs = new WPSEO_Option_Tabs( '', '' );
foreach ( $tabs as $identifier => $tab ) {
if ( ! empty( $tab['screencast_video_url'] ) ) {
$tab_video_url = $tab['screencast_video_url'];
$helpcenter_tab = new WPSEO_Option_Tab(
$identifier,
$tab['label'],
array( 'video_url' => $tab['screencast_video_url'] )
);
}
$helpcenter_tabs->add_tab( $helpcenter_tab );
}
$helpcenter = new WPSEO_Help_Center( '', $helpcenter_tabs, WPSEO_Utils::is_yoast_seo_premium() );
$helpcenter->localize_data();
$helpcenter->mount();
foreach ( $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' );

View File

@ -0,0 +1,63 @@
<?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; ?>
</div>