first commit

This commit is contained in:
Rachit Bhargava
2023-07-21 17:12:10 -04:00
parent d0fe47dde4
commit 5d0f0734d8
14003 changed files with 2829464 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Class WPSEO_HelpScout
*
* @codeCoverageIgnore
* @deprecated 20.3
*/
class WPSEO_HelpScout implements WPSEO_WordPress_Integration {
/**
* WPSEO_HelpScout constructor.
*
* @codeCoverageIgnore
* @deprecated 20.3
*
* @param string $beacon_id The beacon id.
* @param array $pages The pages where the beacon is loaded.
* @param array $products The products the beacon is loaded for.
* @param bool $ask_consent Optional. Whether to ask for consent before loading in HelpScout.
*/
public function __construct( $beacon_id, array $pages, array $products, $ask_consent = false ) {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
}
/**
* {@inheritDoc}
*
* @codeCoverageIgnore
* @deprecated 20.3
*/
public function register_hooks() {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3', 'HelpScout_Beacon::register_hooks' );
}
/**
* Enqueues the HelpScout script.
*
* @codeCoverageIgnore
* @deprecated 20.3
*/
public function enqueue_help_scout_script() {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3', 'HelpScout_Beacon::enqueue_help_scout_script' );
}
/**
* Outputs a small piece of javascript for the beacon.
*
* @codeCoverageIgnore
* @deprecated 20.3
*/
public function output_beacon_js() {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3', 'HelpScout_Beacon::output_beacon_js' );
}
}

View File

@@ -0,0 +1,169 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* This class handles the data for the option where the Ryte data is stored.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
class WPSEO_Ryte_Option {
/**
* Indicates the data is not fetched.
*
* @deprecated 19.6
* @var int
*/
const NOT_FETCHED = 0;
/**
* Indicates the option is indexable.
*
* @deprecated 19.6
* @var int
*/
const IS_INDEXABLE = 0;
/**
* Indicates the option is not indexable.
*
* @deprecated 19.6
* @var int
*/
const IS_NOT_INDEXABLE = 0;
/**
* Indicates the data could not be fetched.
*
* @deprecated 19.6
* @var int
*/
const CANNOT_FETCH = -1;
/**
* The name of the option where data will be stored.
*
* @deprecated 19.6
* @var string
*/
const OPTION_NAME = '';
/**
* The key of the status in the option.
*
* @deprecated 19.6
* @var string
*/
const STATUS = '';
/**
* The key of the last fetch date in the option.
*
* @deprecated 19.6
* @var string
*/
const LAST_FETCH = '';
/**
* The limit for fetching the status manually.
*
* @deprecated 19.6
* @var int
*/
const FETCH_LIMIT = 0;
/**
* Setting the object by setting the properties.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
public function __construct() {
_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Getting the status from the option.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return int|string
*/
public function get_status() {
_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return -1;
}
/**
* Saving the status to the options.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param string $status The status to save.
*/
public function set_status( $status ) {
_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Saving the last fetch timestamp to the options.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param int $timestamp Timestamp with the new value.
*/
public function set_last_fetch( $timestamp ) {
_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Determines whether the indexability status should be fetched.
*
* If LAST_FETCH isn't set, we assume the indexability status hasn't been fetched
* yet and return true. Then, we check whether the last fetch is within the
* FETCH_LIMIT time interval (15 seconds) to avoid too many consecutive API calls.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return bool Whether the indexability status should be fetched.
*/
public function should_be_fetched() {
_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return false;
}
/**
* Saving the option with the current data.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
public function save_option() {
_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Returns the value of the onpage_enabled status.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return bool
*/
public function is_enabled() {
_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return false;
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* This class will fetch a new status from Ryte and if it's necessary it will
* notify the site admin by email and remove the current meta value to hide the
* notice for all admin users.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
class WPSEO_Ryte_Request {
/**
* Sends a request to the Ryte API to check whether a URL is indexable.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param string $target_url The URL to check indexability for.
* @param array $parameters Array of extra parameters to send to the Ryte API.
*
* @return array
*/
public function do_request( $target_url, $parameters = [] ) {
_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
}

View File

@@ -0,0 +1,284 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Handles the request for getting the Ryte status.
*
* @deprecated 18.5
*/
class WPSEO_Ryte implements WPSEO_WordPress_Integration {
/**
* Is the request started by pressing the fetch button.
*
* @var bool
*/
private $is_manual_request = false;
/**
* Holds the Ryte API response.
*
* @var array
*/
private $ryte_response = null;
/**
* Constructs the object.
*
* @deprecated 18.5
* @codeCoverageIgnore
*/
public function __construct() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
$this->maybe_add_weekly_schedule();
}
/**
* Sets up the hooks.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
if ( ! self::is_active() ) {
return;
}
// Sets the action for the Ryte fetch cron job.
add_action( 'wpseo_ryte_fetch', [ $this, 'fetch_from_ryte' ] );
}
/**
* Determines if we can use the functionality.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return bool True if this functionality can be used.
*/
public static function is_active() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
if ( wp_doing_ajax() ) {
return false;
}
if ( ! WPSEO_Options::get( 'ryte_indexability' ) ) {
return false;
}
return true;
}
/**
* Hooks to run on plugin activation.
*
* @deprecated 18.5
* @codeCoverageIgnore
*/
public function activate_hooks() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
if ( $this->get_option()->is_enabled() ) {
$this->schedule_cron();
return;
}
$this->unschedule_cron();
}
/**
* Determines whether to add a custom cron weekly schedule.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return void
*/
public function maybe_add_weekly_schedule() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
// If there's no default cron weekly schedule, add a custom one.
add_filter( 'cron_schedules', [ $this, 'add_weekly_schedule' ] );
}
/**
* Adds a custom weekly cron schedule.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @param array $schedules The existing custom cron schedules.
*
* @return array Enriched list of custom cron schedules.
*/
public function add_weekly_schedule( $schedules ) {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
if ( ! is_array( $schedules ) ) {
$schedules = [];
}
/*
* Starting with version 5.4, WordPress does have a default weekly cron
* schedule. See https://core.trac.wordpress.org/changeset/47062.
* We need to add a custom one only if the default one doesn't exist.
*/
if ( isset( $schedules['weekly'] ) ) {
return $schedules;
}
$schedules['weekly'] = [
'interval' => WEEK_IN_SECONDS,
'display' => __( 'Once Weekly', 'wordpress-seo' ),
];
return $schedules;
}
/**
* Fetches the data from Ryte.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return bool|null Whether the request ran.
*/
public function fetch_from_ryte() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
// Don't do anything when the WordPress environment type isn't "production".
if ( wp_get_environment_type() !== 'production' ) {
return;
}
$ryte_option = $this->get_option();
if ( ! $ryte_option->should_be_fetched() ) {
return false;
}
$new_status = $this->request_indexability();
// Updates the timestamp in the option.
$ryte_option->set_last_fetch( time() );
$ryte_option->set_status( $new_status );
$ryte_option->save_option();
return true;
}
/**
* Retrieves the option to use.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return WPSEO_Ryte_Option The option.
*/
protected function get_option() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
return new WPSEO_Ryte_Option();
}
/**
* Sends a request to Ryte to get the indexability status.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return int The indexability status value.
*/
protected function request_indexability() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
$parameters = [];
if ( $this->wordfence_protection_enabled() ) {
$parameters['wf_strict'] = 1;
}
$request = new WPSEO_Ryte_Request();
$response = $request->do_request( get_option( 'home' ), $parameters );
// Populate the ryte_response property.
$this->ryte_response = $response;
// It's a valid Ryte response because the array contains an `is_indexable` element.
if ( isset( $response['is_indexable'] ) ) {
return (int) $response['is_indexable'];
}
// It's not a valid Ryte response.
return WPSEO_Ryte_Option::CANNOT_FETCH;
}
/**
* Schedules the cronjob to get the new indexability status.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return void
*/
private function schedule_cron() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
if ( wp_next_scheduled( 'wpseo_ryte_fetch' ) ) {
return;
}
wp_schedule_event( time(), 'weekly', 'wpseo_ryte_fetch' );
}
/**
* Unschedules the cronjob to get the new indexability status.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return void
*/
private function unschedule_cron() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
if ( ! wp_next_scheduled( 'wpseo_ryte_fetch' ) ) {
return;
}
wp_clear_scheduled_hook( 'wpseo_ryte_fetch' );
}
/**
* Checks if WordFence protects the site against 'fake' Google crawlers.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return bool True if WordFence protects the site.
*/
private function wordfence_protection_enabled() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
if ( ! class_exists( 'wfConfig' ) ) {
return false;
}
if ( ! method_exists( 'wfConfig', 'get' ) ) {
return false;
}
return (bool) wfConfig::get( 'blockFakeBots' );
}
/**
* Retrieves the Ryte API response property.
*
* @deprecated 18.5
* @codeCoverageIgnore
*
* @return array|WP_Error The response or WP_Error on failure.
*/
public function get_response() {
_deprecated_function( __METHOD__, 'Yoast SEO 18.5' );
return $this->ryte_response;
}
}

View File

@@ -0,0 +1,173 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
/**
* Class Yoast_View_Utils.
*
* @deprecated 20.3
* @codeCoverageIgnore
*/
class Yoast_View_Utils {
/**
* Form to use.
*
* @var Yoast_Form
*/
protected $form;
/**
* Yoast_View_Utils constructor.
*
* @deprecated 20.3
* @codeCoverageIgnore
*/
public function __construct() {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
$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.
* @deprecated 20.3
* @codeCoverageIgnore
*
* @return object The help panel instance.
*/
public function search_results_setting_help( $post_type, $help_text_switch = '' ) {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
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;
}
/**
* Generates the OpenGraph disabled alert, depending on whether the OpenGraph feature is disabled.
*
* @param string $type The type of message. Can be altered to homepage, taxonomies or archives. Empty string by default.
*
* @deprecated 20.3
* @codeCoverageIgnore
*
* @return string The alert. Returns an empty string if the setting is enabled.
*/
public function generate_opengraph_disabled_alert( $type = '' ) {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
$is_enabled = WPSEO_Options::get( 'opengraph', true );
if ( $is_enabled ) {
return '';
}
$message = $this->generate_opengraph_disabled_alert_text( $type );
if ( empty( $message ) ) {
return '';
}
$alert = new Alert_Presenter( $message, 'info' );
return sprintf(
'<div class="yoast-measure padded">%s</div>',
$alert->present()
);
}
/**
* Generates the OpenGraph disabled alert text.
*
* @param string $type The type of message. Can be altered to homepage, taxonomies or archives. Empty string by default.
*
* @return string The alert. Returns an empty string if the setting is enabled.
*/
private function generate_opengraph_disabled_alert_text( $type ) {
if ( $type === 'homepage' ) {
return sprintf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__(
'The social appearance settings for your homepage require Open Graph metadata (which is currently disabled). You can enable this in the %1$sSocial settings under the Facebook tab%2$s.',
'wordpress-seo'
),
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_social#top#facebook' ) ) . '">',
'</a>'
);
}
if ( ! YoastSEO()->helpers->product->is_premium() ) {
return '';
}
if ( $type === '' ) {
return sprintf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__(
'The social appearance settings for content types require Open Graph metadata (which is currently disabled). You can enable this in the %1$sSocial settings under the Facebook tab%2$s.',
'wordpress-seo'
),
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_social#top#facebook' ) ) . '">',
'</a>'
);
}
if ( $type === 'taxonomies' ) {
return sprintf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__(
'The social appearance settings for taxonomies require Open Graph metadata (which is currently disabled). You can enable this in the %1$sSocial settings under the Facebook tab%2$s.',
'wordpress-seo'
),
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_social#top#facebook' ) ) . '">',
'</a>'
);
}
if ( $type === 'archives' ) {
return sprintf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__(
'The social appearance settings for archives require Open Graph metadata (which is currently disabled). You can enable this in the %1$sSocial settings under the Facebook tab%2$s.',
'wordpress-seo'
),
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_social#top#facebook' ) ) . '">',
'</a>'
);
}
return '';
}
}

View File

@@ -0,0 +1,143 @@
<?php
/**
* Backwards compatibility class for breadcrumbs.
*
* @package Yoast\YoastSEO\Backwards_Compatibility
*/
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
use Yoast\WP\SEO\Presenters\Breadcrumbs_Presenter;
use Yoast\WP\SEO\Surfaces\Helpers_Surface;
/**
* Class WPSEO_Breadcrumbs
*
* @codeCoverageIgnore Because of deprecation.
*/
class WPSEO_Breadcrumbs {
/**
* Instance of this class.
*
* @var WPSEO_Breadcrumbs
*/
public static $instance;
/**
* Last used 'before' string.
*
* @var string
*/
public static $before = '';
/**
* Last used 'after' string.
*
* @var string
*/
public static $after = '';
/**
* The memoizer for the meta tags context.
*
* @var Meta_Tags_Context_Memoizer
*/
protected $context_memoizer;
/**
* The helpers surface.
*
* @var Helpers_Surface
*/
protected $helpers;
/**
* The replace vars helper
*
* @var WPSEO_Replace_Vars
*/
protected $replace_vars;
/**
* WPSEO_Breadcrumbs constructor.
*/
public function __construct() {
$this->context_memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->helpers = YoastSEO()->classes->get( Helpers_Surface::class );
$this->replace_vars = YoastSEO()->classes->get( WPSEO_Replace_Vars::class );
}
/**
* Get breadcrumb string using the singleton instance of this class.
*
* @param string $before Optional string to prepend.
* @param string $after Optional string to append.
* @param bool $display Echo or return flag.
*
* @return string Returns the breadcrumbs as a string.
*/
public static function breadcrumb( $before = '', $after = '', $display = true ) {
// Remember the last used before/after for use in case the object goes __toString().
self::$before = $before;
self::$after = $after;
$output = $before . self::get_instance()->render() . $after;
if ( $display === true ) {
echo $output;
return '';
}
return $output;
}
/**
* Magic method to use in case the class would be send to string.
*
* @return string The rendered breadcrumbs.
*/
public function __toString() {
return self::$before . $this->render() . self::$after;
}
/**
* Retrieves an instance of the class.
*
* @return static The instance.
*/
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Returns the collected links for the breadcrumbs.
*
* @return array The collected links.
*/
public function get_links() {
$context = $this->context_memoizer->for_current_page();
return $context->presentation->breadcrumbs;
}
/**
* Renders the breadcrumbs.
*
* @return string The rendered breadcrumbs.
*/
private function render() {
$presenter = new Breadcrumbs_Presenter();
$context = $this->context_memoizer->for_current_page();
/** This filter is documented in src/integrations/front-end-integration.php */
$presentation = apply_filters( 'wpseo_frontend_presentation', $context->presentation, $context );
$presenter->presentation = $presentation;
$presenter->replace_vars = $this->replace_vars;
$presenter->helpers = $this->helpers;
return $presenter->present();
}
}

View File

@@ -0,0 +1,276 @@
<?php
/**
* Backwards compatibility class for WPSEO_Frontend.
*
* @package Yoast\YoastSEO\Backwards_Compatibility
*/
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
use Yoast\WP\SEO\Presenters\Canonical_Presenter;
use Yoast\WP\SEO\Presenters\Meta_Description_Presenter;
use Yoast\WP\SEO\Presenters\Rel_Next_Presenter;
use Yoast\WP\SEO\Presenters\Rel_Prev_Presenter;
use Yoast\WP\SEO\Presenters\Robots_Presenter;
use Yoast\WP\SEO\Surfaces\Helpers_Surface;
/**
* Class WPSEO_Frontend
*
* @codeCoverageIgnore Because of deprecation.
*/
class WPSEO_Frontend {
/**
* Instance of this class.
*
* @var WPSEO_Frontend
*/
public static $instance;
/**
* The memoizer for the meta tags context.
*
* @var Meta_Tags_Context_Memoizer
*/
private $context_memoizer;
/**
* The WPSEO Replace Vars object.
*
* @var WPSEO_Replace_Vars
*/
private $replace_vars;
/**
* The helpers surface.
*
* @var Helpers_Surface
*/
private $helpers;
/**
* WPSEO_Frontend constructor.
*/
public function __construct() {
$this->context_memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->replace_vars = YoastSEO()->classes->get( WPSEO_Replace_Vars::class );
$this->helpers = YoastSEO()->classes->get( Helpers_Surface::class );
}
/**
* Catches call to methods that don't exist and might deprecated.
*
* @param string $method The called method.
* @param array $arguments The given arguments.
*
* @return mixed
*/
public function __call( $method, $arguments ) {
_deprecated_function( $method, 'Yoast SEO 14.0' );
$title_methods = [
'title',
'fix_woo_title',
'get_content_title',
'get_seo_title',
'get_taxonomy_title',
'get_author_title',
'get_title_from_options',
'get_default_title',
'force_wp_title',
];
if ( in_array( $method, $title_methods, true ) ) {
return $this->get_title();
}
return null;
}
/**
* Retrieves an instance of the class.
*
* @return static The instance.
*/
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Outputs the canonical value.
*
* @param bool $echo Whether or not to output the canonical element.
* @param bool $un_paged Whether or not to return the canonical with or without pagination added to the URL.
* @param bool $no_override Whether or not to return a manually overridden canonical.
*
* @return string|void
*/
public function canonical( $echo = true, $un_paged = false, $no_override = false ) {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
$presentation = $this->get_current_page_presentation();
$presenter = new Canonical_Presenter();
/** This filter is documented in src/integrations/front-end-integration.php */
$presenter->presentation = $presentation;
$presenter->helpers = $this->helpers;
$presenter->replace_vars = $this->replace_vars;
if ( ! $echo ) {
return $presenter->get();
}
echo $presenter->present();
}
/**
* Retrieves the meta robots value.
*
* @return string
*/
public function get_robots() {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
$presentation = $this->get_current_page_presentation();
return $presentation->robots;
}
/**
* Outputs the meta robots value.
*/
public function robots() {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
$presentation = $this->get_current_page_presentation();
$presenter = new Robots_Presenter();
$presenter->presentation = $presentation;
$presenter->helpers = $this->helpers;
$presenter->replace_vars = $this->replace_vars;
echo $presenter->present();
}
/**
* Determine $robots values for a single post.
*
* @param array $robots Robots data array.
* @param int $post_id The post ID for which to determine the $robots values, defaults to current post.
*
* @return array
*/
public function robots_for_single_post( $robots, $post_id = 0 ) {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
$presentation = $this->get_current_page_presentation();
return $presentation->robots;
}
/**
* Used for static home and posts pages as well as singular titles.
*
* @param object|null $object If filled, object to get the title for.
*
* @return string The content title.
*/
private function get_title( $object = null ) {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
$presentation = $this->get_current_page_presentation();
$title = $presentation->title;
return $this->replace_vars->replace( $title, $presentation->source );
}
/**
* This function adds paging details to the title.
*
* @param string $sep Separator used in the title.
* @param string $seplocation Whether the separator should be left or right.
* @param string $title The title to append the paging info to.
*
* @return string
*/
public function add_paging_to_title( $sep, $seplocation, $title ) {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
return $title;
}
/**
* Add part to title, while ensuring that the $seplocation variable is respected.
*
* @param string $sep Separator used in the title.
* @param string $seplocation Whether the separator should be left or right.
* @param string $title The title to append the title_part to.
* @param string $title_part The part to append to the title.
*
* @return string
*/
public function add_to_title( $sep, $seplocation, $title, $title_part ) {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
if ( $seplocation === 'right' ) {
return $title . $sep . $title_part;
}
return $title_part . $sep . $title;
}
/**
* Adds 'prev' and 'next' links to archives.
*
* @link http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html
*/
public function adjacent_rel_links() {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
$presentation = $this->get_current_page_presentation();
$rel_prev_presenter = new Rel_Prev_Presenter();
$rel_prev_presenter->presentation = $presentation;
$rel_prev_presenter->helpers = $this->helpers;
$rel_prev_presenter->replace_vars = $this->replace_vars;
echo $rel_prev_presenter->present();
$rel_next_presenter = new Rel_Next_Presenter();
$rel_next_presenter->presentation = $presentation;
$rel_next_presenter->helpers = $this->helpers;
$rel_next_presenter->replace_vars = $this->replace_vars;
echo $rel_next_presenter->present();
}
/**
* Outputs the meta description element or returns the description text.
*
* @param bool $echo Echo or return output flag.
*
* @return string
*/
public function metadesc( $echo = true ) {
_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );
$presentation = $this->get_current_page_presentation();
$presenter = new Meta_Description_Presenter();
$presenter->presentation = $presentation;
$presenter->helpers = $this->helpers;
$presenter->replace_vars = $this->replace_vars;
if ( ! $echo ) {
return $presenter->get();
}
$presenter->present();
}
/**
* Returns the current page presentation.
*
* @return Indexable_Presentation The current page presentation.
*/
private function get_current_page_presentation() {
$context = $this->context_memoizer->for_current_page();
/** This filter is documented in src/integrations/front-end-integration.php */
return apply_filters( 'wpseo_frontend_presentation', $context->presentation, $context );
}
}

View File

@@ -0,0 +1,99 @@
<?php
/**
* Yoast I18n module.
*
* @package Yoast\I18n-module
*/
/**
* This class defines a promo box and checks your translation site's API for stats about it,
* then shows them to the user.
*
* @deprecated 19.12
* @codeCoverageIgnore
* @phpcs:disable PEAR.NamingConventions.ValidClassName.Invalid
*/
class Yoast_I18n_v3 {
/**
* Class constructor.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @param array $args Contains the settings for the class.
* @param bool $show_translation_box Whether the translation box should be shown.
*/
public function __construct( $args, $show_translation_box = true ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
}
/**
* Returns whether the language is en_US.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @param string $language The language to check.
*
* @return bool Returns true if the language is en_US.
*/
protected function is_default_language( $language ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return true;
}
/**
* Returns the i18n_promo message from the i18n_module. Returns en empty string if the promo shouldn't be shown.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @access public
*
* @return string The i18n promo message.
*/
public function get_promo_message() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return '';
}
/**
* Returns a button that can be used to dismiss the i18n-message.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @access private
*
* @return string
*/
public function get_dismiss_i18n_message_button() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return '';
}
/**
* Outputs a promo box.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @access public
*/
public function promo() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
}
/**
* The API URL to use when requesting translation information.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @param string $api_url The new API URL.
*/
public function set_api_url( $api_url ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
}
}

View File

@@ -0,0 +1,4 @@
<?php
/**
* Nothing to see here.
*/

View File

@@ -0,0 +1,11 @@
<?php
namespace Yoast\WP\SEO\Actions\Configuration;
/**
* Class Configuration_Workout_Action.
*
* @deprecated 19.0 - Use \Yoast\WP\SEO\Actions\First_Time_Configuration_Action instead.
* @codeCoverageIgnore
*/
class Configuration_Workout_Action extends First_Time_Configuration_Action {}

View File

@@ -0,0 +1,450 @@
<?php
namespace Yoast\WP\SEO\Actions;
use Yoast\WP\SEO\Helpers\Indexables_Page_Helper;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Helpers\Post_Type_Helper;
use Yoast\WP\SEO\Repositories\Indexable_Repository;
/**
* Get action for indexables.
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
class Indexables_Page_Action {
/**
* The indexable repository.
*
* @var Indexable_Repository
*/
private $indexable_repository;
/**
* The post type helper.
*
* @var Post_Type_Helper
*/
private $post_type_helper;
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The indexables page helper.
*
* @var Indexables_Page_Helper
*/
private $indexables_page_helper;
/**
* Indexable_Action constructor.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param Indexable_Repository $indexable_repository The indexable repository.
* @param Post_Type_Helper $post_type_helper The post type helper.
* @param Options_Helper $options_helper The options helper.
* @param Indexables_Page_Helper $indexables_page_helper The indexables page helper.
*/
public function __construct(
Indexable_Repository $indexable_repository,
Post_Type_Helper $post_type_helper,
Options_Helper $options_helper,
Indexables_Page_Helper $indexables_page_helper
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$this->indexable_repository = $indexable_repository;
$this->post_type_helper = $post_type_helper;
$this->options_helper = $options_helper;
$this->indexables_page_helper = $indexables_page_helper;
}
/**
* Get public sub types that are relevant for the indexable page.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return array The subtypes.
*/
protected function get_sub_types() {
$object_sub_types = \array_values( $this->post_type_helper->get_public_post_types() );
$excluded_post_types = \apply_filters( 'wpseo_indexable_excluded_post_types', [ 'attachment' ] );
/**
* Filter: 'wpseo_indexable_included_post_types' - Allow developers to specify which post types will
* be shown in the indexables overview cards.
*
* @param array $included_post_types The currently included post types.
*/
$included_post_types = \apply_filters_deprecated( 'wpseo_indexable_included_post_types', [ [ 'post', 'page' ] ], 'Yoast SEO 20.4' );
$object_sub_types = \array_diff( $object_sub_types, $excluded_post_types );
$only_post_pages = \array_intersect( $object_sub_types, $included_post_types );
$wanted_sub_types = [];
foreach ( $only_post_pages as $sub_type ) {
if ( $this->post_type_helper->has_metabox( $sub_type ) ) {
$wanted_sub_types[] = $sub_type;
}
}
return $wanted_sub_types;
}
/**
* Creates a query that can find public indexables.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return ORM Returns an ORM instance that can be used to execute the query.
*/
protected function query() {
$sub_types = $this->get_sub_types();
if ( empty( $sub_types ) ) {
// If there are no subtypes to display, any query should return an empty result.
return $this->indexable_repository->query()->where_raw( '1 = 0' );
}
// Make sure that we consider the noindex of both each post but also for the global values.
$build_where = '(';
foreach ( $sub_types as $sub_type ) {
$is_default_noindex = $this->post_type_helper->is_indexable( $sub_type ) ? ' OR is_robots_noindex IS NULL' : '';
$build_where .= '( object_sub_type = \'' . $sub_type . '\' AND ( is_robots_noindex = FALSE' . $is_default_noindex . ' ) ) OR';
}
$build_where = \rtrim( $build_where, ' OR' );
$build_where .= ')';
return $this->indexable_repository->query()
->where_raw( '( post_status = \'publish\' OR post_status IS NULL )' )
->where_in( 'object_type', [ 'post' ] )
->where_raw( $build_where );
}
/**
* Gets the neccessary information to set up the indexables page.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param int $content_threshold The threshold to check against for enough content.
* @param int $analysis_threshold The threshold to check against for enough analyzed content.
*
* @return array The neccessary information to set up the indexables page.
*/
public function get_setup_info( $content_threshold, $analysis_threshold ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$features = [
'isSeoScoreEnabled' => $this->options_helper->get( 'keyword_analysis_active', true ),
'isReadabilityEnabled' => $this->options_helper->get( 'content_analysis_active', true ),
'isLinkCountEnabled' => $this->options_helper->get( 'enable_text_link_counter', true ),
];
$posts_with_seo_score = 0;
$posts_with_readability = 0;
$posts_without_keyphrase = [];
$all_posts = $this->query()->count();
if ( $all_posts < 1 ) {
$this->set_indexables_state( 'no-content' );
return [
'enabledFeatures' => $features,
'enoughContent' => false,
'enoughAnalysedContent' => false,
];
}
$posts_with_seo_score = $this->query()
->where_not_equal( 'primary_focus_keyword', 0 )
->count();
$posts_without_keyphrase = $this->query()
->where_null( 'primary_focus_keyword' )
->order_by_desc( 'incoming_link_count' )
->find_many();
$posts_with_readability = $this->query()
->where_not_equal( 'readability_score', 0 )
->count();
$analysed_content = ( \max( $posts_with_seo_score, $posts_with_readability ) / $all_posts );
$enough_content = $all_posts > $content_threshold;
$enough_analysed_content = $analysed_content > $analysis_threshold;
if ( ! $enough_content ) {
$this->set_indexables_state( 'not-enough-content' );
}
elseif ( ! $enough_analysed_content ) {
$this->set_indexables_state( 'not-enough-analysed-content' );
}
else {
$this->set_indexables_state( 'lists-shown' );
}
return [
'enabledFeatures' => $features,
'enoughContent' => $enough_content,
'enoughAnalysedContent' => $enough_analysed_content,
'postsWithoutKeyphrase' => \array_map(
static function ( $indexable ) {
$output = $indexable;
if ( $indexable->incoming_link_count === null ) {
$output->incoming_link_count = 0;
}
return $output;
},
$posts_without_keyphrase
),
];
}
/**
* Gets the posts with the smallest readability scores.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param int $limit The maximum amount of results to return.
*
* @return array The posts with the smallest readability scores as an array.
*/
public function get_least_readable( $limit ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$least_readability_ignore_list = $this->options_helper->get( 'least_readability_ignore_list', [] );
$ignore_list = empty( $least_readability_ignore_list ) ? [ -1 ] : $least_readability_ignore_list;
$least_readable = $this->query()
->select_many( 'id', 'object_id', 'object_sub_type', 'permalink', 'breadcrumb_title', 'readability_score' )
->where_not_in( 'id', $ignore_list )
->where_not_equal( 'readability_score', 0 )
->order_by_asc( 'readability_score' )
->limit( $limit )
->find_many();
return \array_map( [ $this->indexable_repository, 'ensure_permalink' ], $least_readable );
}
/**
* Gets the posts with the lowest seo scores.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param int $limit The maximum amount of results to return.
*
* @return array The posts with the lowest seo scores as an array.
*/
public function get_least_seo_score( $limit ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
// Where_not_equal needs the set to check against not to be empty.
$least_seo_score_ignore_list = $this->options_helper->get( 'least_seo_score_ignore_list', [] );
$ignore_list = empty( $least_seo_score_ignore_list ) ? [ -1 ] : $least_seo_score_ignore_list;
$least_seo_score = $this->query()
->select_many( 'id', 'object_id', 'object_sub_type', 'permalink', 'breadcrumb_title', 'primary_focus_keyword', 'primary_focus_keyword_score' )
->where_not_in( 'id', $ignore_list )
->where_not_equal( 'primary_focus_keyword', 0 )
->order_by_asc( 'primary_focus_keyword_score' )
->limit( $limit )
->find_many();
return \array_map( [ $this->indexable_repository, 'ensure_permalink' ], $least_seo_score );
}
/**
* Gets the most linked posts.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param int $limit The maximum amount of results to return.
*
* @return array The most linked posts as an array.
*/
public function get_most_linked( $limit ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
// Where_not_equal needs the set to check against not to be empty.
$most_linked_ignore_list = $this->options_helper->get( 'most_linked_ignore_list', [] );
$ignore_list = empty( $most_linked_ignore_list ) ? [ -1 ] : $most_linked_ignore_list;
$most_linked = $this->query()
->select_many( 'id', 'object_id', 'object_sub_type', 'permalink', 'breadcrumb_title', 'incoming_link_count', 'is_cornerstone' )
->where_gt( 'incoming_link_count', 0 )
->where_not_null( 'incoming_link_count' )
->where_not_in( 'id', $ignore_list )
->order_by_desc( 'incoming_link_count' )
->limit( $limit )
->find_many();
return \array_map( [ $this->indexable_repository, 'ensure_permalink' ], $most_linked );
}
/**
* Gets the least linked posts.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param int $limit The maximum amount of results to return.
*
* @return array The most linked posts as an array.
*/
public function get_least_linked( $limit ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
// Where_not_equal needs the set to check against not to be empty.
$least_linked_ignore_list = $this->options_helper->get( 'least_linked_ignore_list', [] );
$ignore_list = empty( $least_linked_ignore_list ) ? [ -1 ] : $least_linked_ignore_list;
$least_linked = $this->query()
->select_many( 'id', 'object_id', 'object_sub_type', 'permalink', 'breadcrumb_title', 'incoming_link_count' )
->where_not_in( 'id', $ignore_list )
->order_by_asc( 'incoming_link_count' )
->limit( $limit )
->find_many();
$least_linked = \array_map( [ $this->indexable_repository, 'ensure_permalink' ], $least_linked );
return \array_map(
static function ( $indexable ) {
$output = $indexable;
if ( $indexable->incoming_link_count === null ) {
$output->incoming_link_count = 0;
}
return $output;
},
$least_linked
);
}
/**
* Stores an indexable in an ignore-list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param string $ignore_list_name The name of the ignore-list.
* @param array $ignored_indexable_ids The IDs of the updated ignored indexables.
*
* @return bool Whether saving the ignore-list to the database succeeded.
*/
public function update_ignored_indexables( $ignore_list_name, $ignored_indexable_ids ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
if ( ! $this->indexables_page_helper->is_valid_ignore_list_name( $ignore_list_name ) ) {
return false;
}
return $this->options_helper->set( $ignore_list_name, $ignored_indexable_ids );
}
/**
* Removes an indexable from its ignore-list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param string $ignore_list_name The name of the ignore-list.
* @param int $indexable_id The ID of the indexable to store in the ignore-list.
*
* @return bool Whether saving the ignore-list to the database succeeded.
*/
public function remove_indexable_from_ignore_list( $ignore_list_name, $indexable_id ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
if ( ! $this->indexables_page_helper->is_valid_ignore_list_name( $ignore_list_name ) ) {
return false;
}
$ignore_list = $this->options_helper->get( $ignore_list_name, [] );
$ignore_list = \array_values(
\array_filter(
$ignore_list,
static function( $indexable ) use ( $indexable_id ) {
return $indexable !== $indexable_id;
}
)
);
return $this->options_helper->set( $ignore_list_name, $ignore_list );
}
/**
* Removes all indexables from an ignore-list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param string $ignore_list_name The name of the ignore-list.
*
* @return bool Whether saving the ignore-list to the database succeeded.
*/
public function remove_all_indexables_from_ignore_list( $ignore_list_name ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
if ( ! $this->indexables_page_helper->is_valid_ignore_list_name( $ignore_list_name ) ) {
return false;
}
return $this->options_helper->set( $ignore_list_name, [] );
}
/**
* Gets the reading list state.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return array The state of each element in the reading list.
*/
public function get_reading_list() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
return $this->options_helper->get( 'indexables_page_reading_list', [ false, false, false, false, false ] );
}
/**
* Sets the reading list state.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param array $state The state to be saved.
*
* @return bool Whether saving the reading list state succeeded.
*/
public function set_reading_list( $state ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
return $this->options_helper->set( 'indexables_page_reading_list', $state );
}
/**
* Sets the indexables overview state.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param string $state The state to be saved.
*
* @return bool Whether saving the indexables overview state succeeded.
*/
public function set_indexables_state( $state ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
return $this->options_helper->set( 'indexables_overview_state', $state );
}
}

View File

@@ -0,0 +1,162 @@
<?php
namespace Yoast\WP\SEO\Actions;
use Exception;
use Yoast\WP\SEO\Helpers\User_Helper;
/**
* Settings_Introduction_Action class.
*
* @deprecated 20.7
* @codeCoverageIgnore
*/
class Settings_Introduction_Action {
const USER_META_KEY = '_yoast_settings_introduction';
const DEFAULT_VALUES = [
'wistia_embed_permission' => false,
'show' => true,
];
/**
* Holds the User_Helper instance.
*
* @var User_Helper
*/
private $user_helper;
/**
* Constructs Settings_Introduction_Action.
*
* @param User_Helper $user_helper The User_Helper.
*
* @deprecated 20.7
* @codeCoverageIgnore
*/
public function __construct( User_Helper $user_helper ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
$this->user_helper = $user_helper;
}
/**
* Retrieves the Wistia embed permission value.
*
* @throws Exception If an invalid user ID is supplied.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return bool The value of the Wistia embed permission.
*/
public function get_wistia_embed_permission() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
$user_id = $this->user_helper->get_current_user_id();
$values = $this->get_values_for_user( $user_id );
return $values['wistia_embed_permission'];
}
/**
* Sets the Wistia embed permission value.
*
* @param bool $value The value.
*
* @throws Exception If an invalid user ID is supplied.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return bool Whether the update was successful.
*/
public function set_wistia_embed_permission( $value ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
$user_id = $this->user_helper->get_current_user_id();
$values = $this->get_values_for_user( $user_id );
// Check if there is anything to update.
if ( $values['wistia_embed_permission'] === $value ) {
return true;
}
$values['wistia_embed_permission'] = $value;
return $this->user_helper->update_meta( $user_id, self::USER_META_KEY, $values ) !== false;
}
/**
* Retrieves the show value.
*
* @throws Exception If an invalid user ID is supplied.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return bool The value of show.
*/
public function get_show() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
$user_id = $this->user_helper->get_current_user_id();
$values = $this->get_values_for_user( $user_id );
return $values['show'];
}
/**
* Sets the show value.
*
* @param bool $value The value.
*
* @throws Exception If an invalid user ID is supplied.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return bool Whether the update was successful.
*/
public function set_show( $value ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
$user_id = $this->user_helper->get_current_user_id();
$values = $this->get_values_for_user( $user_id );
// Check if there is anything to update.
if ( $values['show'] === $value ) {
return true;
}
$values['show'] = $value;
return $this->user_helper->update_meta( $user_id, self::USER_META_KEY, $values ) !== false;
}
/**
* Retrieves the (meta) values for a user.
*
* @param int $user_id User ID.
*
* @throws Exception If an invalid user ID is supplied.
*
* @return array The (meta) values.
*/
private function get_values_for_user( $user_id ) {
$values = $this->user_helper->get_meta( $user_id, self::USER_META_KEY, true );
if ( $values === false ) {
throw new Exception( 'Invalid User ID' );
}
if ( \is_array( $values ) && \array_key_exists( 'wistia_embed_permission', $values ) && \array_key_exists( 'show', $values ) ) {
return $values;
}
// Why could $values be invalid?
// - When the database row does not exist yet, $values can be an empty string.
// - Faulty data was stored?
return self::DEFAULT_VALUES;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Feature flag conditional for the front-end inspector.
*
* @deprecated 19.5
*/
class Front_End_Inspector_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
*
* @deprecated 19.5
*
* @return string The name of the feature flag.
*/
protected function get_feature_flag() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.5' );
return 'FRONT_END_INSPECTOR';
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Feature flag conditional for the new indexables page.
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
class Indexables_Page_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return string The name of the feature flag.
*/
protected function get_feature_flag() {
return 'INDEXABLES_PAGE';
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the YOAST_SEO_JAPANESE_SUPPORT constant is set.
*
* @deprecated 17.9
* @codeCoverageIgnore
*/
class Japanese_Support_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @deprecated 17.9
* @codeCoverageIgnore
*
* @return string the name of the feature flag.
*/
public function get_feature_flag() {
\_deprecated_function( __METHOD__, 'Yoast SEO 17.9' );
return 'JAPANESE_SUPPORT';
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the YOAST_SEO_SCHEMA_BLOCKS constant is set.
*
* @deprecated 20.5
* @codeCoverageIgnore
*/
class Schema_Blocks_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @return string the name of the feature flag.
*/
protected function get_feature_flag() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return 'SCHEMA_BLOCKS';
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when The Events Calendar exists.
*
* @deprecated 19.12
* @codeCoverageIgnore
*/
class The_Events_Calendar_Conditional implements Conditional {
/**
* Returns whether this conditional is met.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return bool Whether the conditional is met.
*/
public function is_met() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return false;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when the CoAuthors Plus plugin is installed and activated.
*
* @deprecated 19.12
* @codeCoverageIgnore
*/
class CoAuthors_Plus_Activated_Conditional implements Conditional {
/**
* Checks if the CoAuthors Plus plugin is installed and activated.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return bool `true` when the CoAuthors Plus plugin is installed and activated.
*/
public function is_met() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return \defined( 'COAUTHORS_PLUS_VERSION' );
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Feature_Flag_Conditional;
/**
* Feature flag conditional for the CoAuthors Plus integration.
*
* @deprecated 19.12
* @codeCoverageIgnore
*/
class CoAuthors_Plus_Flag_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the CoAuthors Plus integration feature flag.
*
* @return string The name of the feature flag.
*/
protected function get_feature_flag() {
return 'COAUTHORS_PLUS';
}
}

View File

@@ -0,0 +1,88 @@
<?php
namespace Yoast\WP\SEO\Generators\Schema\Third_Party;
use Yoast\WP\SEO\Generators\Schema\Author;
/**
* Returns schema Author data for the CoAuthor Plus assigned user on a post.
*
* @deprecated 19.12
* @codeCoverageIgnore
*/
class CoAuthor extends Author {
/**
* The user ID of the author we're generating data for.
*
* @var int
*/
private $user_id;
/**
* Determine whether we should return Person schema.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return bool
*/
public function is_needed() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return true;
}
/**
* Returns Person Schema data.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return bool|array Person data on success, false on failure.
*/
public function generate() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
$user_id = $this->determine_user_id();
if ( ! $user_id ) {
return false;
}
$data = $this->build_person_data( $user_id, true );
$data['@type'] = 'Person';
unset( $data['logo'] );
// If this is a post and the author archives are enabled, set the author archive url as the author url.
if ( $this->helpers->options->get( 'disable-author' ) !== true ) {
$data['url'] = $this->helpers->user->get_the_author_posts_url( $user_id );
}
return $data;
}
/**
* Generate the Person data given a user ID.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @param int $user_id User ID.
*
* @return array|bool
*/
public function generate_from_user_id( $user_id ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
$this->user_id = $user_id;
return $this->generate();
}
/**
* Determines a User ID for the Person data.
*
* @return bool|int User ID or false upon return.
*/
protected function determine_user_id() {
return $this->user_id;
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace Yoast\WP\SEO\Generators\Schema\Third_Party;
use Yoast\WP\SEO\Context\Meta_Tags_Context;
use Yoast\WP\SEO\Generators\Schema\Abstract_Schema_Piece;
use Yoast\WP\SEO\Surfaces\Helpers_Surface;
/**
* A class to handle textdomains and other Yoast Event Schema related logic..
*
* @deprecated 19.12
* @codeCoverageIgnore
*/
class Events_Calendar_Schema extends Abstract_Schema_Piece {
/**
* The meta tags context.
*
* @var Meta_Tags_Context
*/
public $context;
/**
* The helpers surface
*
* @var Helpers_Surface
*/
public $helpers;
/**
* Determines whether or not a piece should be added to the graph.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return bool
*/
public function is_needed() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return false;
}
/**
* Adds our Event piece of the graph.
* Partially lifted from the 'Tribe__JSON_LD__Abstract' class.
*
* @see https://docs.theeventscalendar.com/reference/classes/tribe__json_ld__abstract/
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return array Event Schema markup
*/
public function generate() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return [];
}
}

View File

@@ -0,0 +1,215 @@
<?php
namespace Yoast\WP\SEO\Helpers;
/**
* A helper object for the indexable page.
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
class Indexables_Page_Helper {
/**
* The default size of the indexable lists.
*
* @var int
*/
const LIST_SIZE = 5;
/**
* The default size of the buffer, in terms of how many times is bigger than the list size.
*
* @var int
*/
const BUFFER_SIZE = 20;
/**
* The default minimum threshold for the amount of posts in the site.
*
* @var int
*/
const POSTS_THRESHOLD = 20;
/**
* The default minimum threshold for the amount of analysed posts in the site, as a fraction of the total posts.
*
* @var float
*/
const ANALYSED_POSTS_THRESHOLD = 0.5;
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* Indexables_Page_Helper constructor.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param Options_Helper $options The options helper.
*/
public function __construct( Options_Helper $options ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$this->options = $options;
}
/**
* Retrieves the size of the Indexables lists. This size is the amount of indexables that are displayed in each list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return int The size of the Indexables lists.
*/
public function get_indexables_list_size() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
/**
* Filter 'wpseo_indexables_list_size' - Allow filtering the size of the Indexables lists.
*
* @api int The size of the Indexables lists.
*/
return \apply_filters_deprecated( 'wpseo_indexables_list_size', [ self::LIST_SIZE ], 'Yoast SEO 20.4' );
}
/**
* Retrieves the size of the buffer for the Indexables lists, in terms of how many times bigger it is from the lists' size. This size is the amount of indexables that are fetched upon page load.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return int The size of the Indexables lists.
*/
public function get_buffer_size() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
/**
* Filter 'wpseo_indexables_buffer_size' - Allow filtering the size of the buffer for the Indexables lists, in terms of how many times bigger it is from the lists' size.
*
* @api int The size of the buffer for the Indexables lists, in terms of how many times bigger it is from the lists' size.
*/
$times = \apply_filters_deprecated( 'wpseo_indexables_buffer_size', [ self::BUFFER_SIZE ], 'Yoast SEO 20.4' );
if ( $times < 3 ) {
$times = 3;
}
return ( $this->get_indexables_list_size() * \intval( $times ) );
}
/**
* Retrieves the minimum threshold for the amount of posts in the site, in order for lists to be relevant.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return int The size of the Indexables lists.
*/
public function get_minimum_posts_threshold() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
/**
* Filter 'wpseo_posts_threshold' - Allow filtering the minimum threshold for the amount of posts in the site, in order for Indexable lists to be relevant.
*
* @api int The minimum threshold for the amount of posts in the site, in order for Indexable lists to be relevant.
*/
return \apply_filters_deprecated( 'wpseo_posts_threshold', [ self::POSTS_THRESHOLD ], 'Yoast SEO 20.4' );
}
/**
* Retrieves the minimum threshold for the amount of analyzed posts in the site, in order for lists to be relevant.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return int The size of the Indexables lists.
*/
public function get_minimum_analyzed_posts_threshold() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
/**
* Filter 'wpseo_analyzed_posts_threshold' - Allow filtering the minimum threshold for the amount of analyzed posts in the site, in order for Indexable lists to be relevant.
*
* @api int The minimum threshold for the amount of analyzed posts in the site, in order for Indexable lists to be relevant.
*/
return \apply_filters_deprecated( 'wpseo_analyzed_posts_threshold', [ self::ANALYSED_POSTS_THRESHOLD ], 'Yoast SEO 20.4' );
}
/**
* Checks if link suggestions are enabled or not
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return bool Wether enable_link_suggestions is set to true or not.
*/
public function get_link_suggestions_enabled() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
return $this->options->get( 'enable_link_suggestions', false ) === true;
}
/**
* Returns the list names that are valid.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return array An array with valid list names.
*/
public function get_list_names() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$valid_list_names = [
'least_readability',
'least_seo_score',
'most_linked',
'least_linked',
];
return $valid_list_names;
}
/**
* Returns the ignore list names that are valid.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return array An array with valid ignore list names.
*/
public function get_ignore_list_names() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$valid_list_names = $this->get_list_names();
$valid_ignore_list_names = [];
foreach ( $valid_list_names as $valid_list_name ) {
$valid_ignore_list_names[] = $valid_list_name . '_ignore_list';
}
return $valid_ignore_list_names;
}
/**
* Checks if the ignore list name is a valid list name
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param string $list_name The list name.
*
* @return bool Wether the list name is valid or not.
*/
public function is_valid_ignore_list_name( $list_name ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$valid_list_names = $this->get_ignore_list_names();
return \in_array( $list_name, $valid_list_names, true );
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Yoast\WP\SEO\Helpers;
/**
* A helper object for the filter_input.
*
* @deprecated 20.3
* @codeCoverageIgnore
*/
class Input_Helper {
/**
* Returns the result of the filter_input. This is mostly a wrapper so we can test.
*
* @deprecated 20.3
* @codeCoverageIgnore
*
* @param int $input_type The type of input constant (e.g. INPUT_POST, INPUT_GET ).
* @param string $search_string The property to get from the input.
* @param int $filter Optional. The constant that defines the sanitization.
*
* @return string The result of the get input.
*/
public function filter( $input_type, $search_string, $filter = \FILTER_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
return \filter_input( $input_type, $search_string, $filter );
}
}

View File

@@ -0,0 +1,246 @@
<?php
namespace Yoast\WP\SEO\Integrations\Admin;
use WPSEO_Addon_Manager;
use WPSEO_Admin_Asset_Manager;
use WPSEO_Shortlinker;
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
use Yoast\WP\SEO\Conditionals\Indexables_Page_Conditional;
use Yoast\WP\SEO\Helpers\Indexables_Page_Helper;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Helpers\Product_Helper;
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Presenters\Admin\Indexing_Error_Presenter;
use Yoast\WP\SEO\Routes\Indexing_Route;
/**
* Indexables_Page_Integration class
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
class Indexables_Page_Integration implements Integration_Interface {
/**
* The shortlinker.
*
* @var WPSEO_Shortlinker
*/
private $shortlinker;
/**
* The admin asset manager.
*
* @var WPSEO_Admin_Asset_Manager
*/
private $admin_asset_manager;
/**
* The short link helper.
*
* @var Short_Link_Helper
*/
protected $short_link_helper;
/**
* The addon manager.
*
* @var WPSEO_Addon_Manager
*/
protected $addon_manager;
/**
* The indexables page helper.
*
* @var Indexables_Page_Helper
*/
private $indexables_page_helper;
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The product helper.
*
* @var Product_Helper
*/
private $product_helper;
/**
* {@inheritDoc}
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
public static function get_conditionals() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
return [
Admin_Conditional::class,
Indexables_Page_Conditional::class,
];
}
/**
* Indexables_Page_Integration constructor.
*
* @param WPSEO_Admin_Asset_Manager $admin_asset_manager The admin asset manager.
* @param WPSEO_Addon_Manager $addon_manager The addon manager.
* @param WPSEO_Shortlinker $shortlinker The shortlinker.
* @param Short_Link_Helper $short_link_helper The short link helper.
* @param Indexables_Page_Helper $indexables_page_helper The indexables page helper.
* @param Options_Helper $options_helper The options helper.
* @param Product_Helper $product_helper The product helper.
*/
public function __construct(
WPSEO_Admin_Asset_Manager $admin_asset_manager,
WPSEO_Addon_Manager $addon_manager,
WPSEO_Shortlinker $shortlinker,
Short_Link_Helper $short_link_helper,
Indexables_Page_Helper $indexables_page_helper,
Options_Helper $options_helper,
Product_Helper $product_helper
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$this->admin_asset_manager = $admin_asset_manager;
$this->addon_manager = $addon_manager;
$this->shortlinker = $shortlinker;
$this->short_link_helper = $short_link_helper;
$this->indexables_page_helper = $indexables_page_helper;
$this->options_helper = $options_helper;
$this->product_helper = $product_helper;
}
/**
* {@inheritDoc}
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
public function register_hooks() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
\add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
}
/**
* Enqueues assets for the Indexables Page.
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
public function enqueue_assets() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpseo_dashboard' || \is_network_admin() ) {
return;
}
$this->admin_asset_manager->enqueue_script( 'indexables-page' );
$this->admin_asset_manager->enqueue_style( 'tailwind' );
$this->admin_asset_manager->enqueue_style( 'monorepo' );
$this->admin_asset_manager->enqueue_script( 'indexation' );
$data = [
'disabled' => ! \YoastSEO()->helpers->indexable->should_index_indexables(),
'amount' => \YoastSEO()->helpers->indexing->get_filtered_unindexed_count(),
// Forcing this to 0 to not display the initial alert notice.
'firstTime' => '0',
'errorMessage' => $this->render_indexing_error(),
'restApi' => [
'root' => \esc_url_raw( \rest_url() ),
'indexing_endpoints' => $this->get_endpoints(),
'nonce' => \wp_create_nonce( 'wp_rest' ),
],
];
/**
* Filter: 'wpseo_indexing_data' Filter to adapt the data used in the indexing process.
*
* @param array $data The indexing data to adapt.
*/
$data = \apply_filters( 'wpseo_indexing_data', $data );
$this->admin_asset_manager->localize_script( 'indexation', 'yoastIndexingData', $data );
$this->admin_asset_manager->localize_script(
'indexables-page',
'wpseoIndexablesPageData',
[
'environment' => \wp_get_environment_type(),
'listSize' => $this->indexables_page_helper->get_indexables_list_size(),
'isLinkSuggestionsEnabled' => $this->indexables_page_helper->get_link_suggestions_enabled(),
'isPremium' => $this->product_helper->is_premium(),
'ignoreLists' => [
'least_readability' => $this->options_helper->get( 'least_readability_ignore_list', [] ),
'least_seo_score' => $this->options_helper->get( 'least_seo_score_ignore_list', [] ),
'most_linked' => $this->options_helper->get( 'most_linked_ignore_list', [] ),
'least_linked' => $this->options_helper->get( 'least_linked_ignore_list', [] ),
],
'shortlinks' => [
'orphanedContent' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-orphaned-content' ),
'cornerstoneContent' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-cornerstone-content' ),
'recommendedReadingOne' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-recommended-reading-1' ),
'recommendedReadingTwo' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-recommended-reading-2' ),
'recommendedReadingThree' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-recommended-reading-3' ),
'recommendedReadingFour' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-recommended-reading-4' ),
'recommendedReadingFive' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-recommended-reading-5' ),
'internalLinks' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-internal-linking-suggestions' ),
'getPremium' => $this->shortlinker->build_shortlink( 'https://yoa.st/indexables-get-premium' ),
],
]
);
}
/**
* Retrieves a list of the endpoints to use.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return array The endpoints.
*/
protected function get_endpoints() {
$endpoints = [
'prepare' => Indexing_Route::FULL_PREPARE_ROUTE,
'terms' => Indexing_Route::FULL_TERMS_ROUTE,
'posts' => Indexing_Route::FULL_POSTS_ROUTE,
'archives' => Indexing_Route::FULL_POST_TYPE_ARCHIVES_ROUTE,
'general' => Indexing_Route::FULL_GENERAL_ROUTE,
'indexablesComplete' => Indexing_Route::FULL_INDEXABLES_COMPLETE_ROUTE,
'post_link' => Indexing_Route::FULL_POST_LINKS_INDEXING_ROUTE,
'term_link' => Indexing_Route::FULL_TERM_LINKS_INDEXING_ROUTE,
];
$endpoints = \apply_filters( 'wpseo_indexing_endpoints', $endpoints );
$endpoints['complete'] = Indexing_Route::FULL_COMPLETE_ROUTE;
return $endpoints;
}
/**
* The error to show if optimization failed.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return string The error to show if optimization failed.
*/
protected function render_indexing_error() {
$presenter = new Indexing_Error_Presenter(
$this->short_link_helper,
$this->product_helper,
$this->addon_manager
);
return $presenter->present();
}
}

View File

@@ -0,0 +1,81 @@
<?php
namespace Yoast\WP\SEO\Integrations\Admin;
use WPSEO_Admin_Asset_Manager;
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
use Yoast\WP\SEO\Conditionals\Admin\Non_Network_Admin_Conditional;
use Yoast\WP\SEO\Integrations\Integration_Interface;
/**
* Redirect_Old_Features_Tab_Integration class
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
class Redirect_Old_Features_Tab_Integration implements Integration_Interface {
/**
* Asset manager instance.
*
* @var WPSEO_Admin_Asset_Manager
*/
protected $asset_manager;
/**
* Redirect_Old_Features_Tab_Integration constructor.
*
* @param WPSEO_Admin_Asset_Manager $asset_manager The admin asset manager.
*/
public function __construct( WPSEO_Admin_Asset_Manager $asset_manager ) {
$this->asset_manager = $asset_manager;
}
/**
* {@inheritDoc}
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
public function register_hooks() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
\add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_redirect_old_features_tab_script' ] );
}
/**
* Returns the conditionals based on which this loadable should be active.
*
* In this case: only when on an admin page and on a non-multisite installation.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return array The conditionals.
*/
public static function get_conditionals() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
return [
Admin_Conditional::class,
Non_Network_Admin_Conditional::class,
];
}
/**
* Enqueues the redirect-old-features-tab script.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return void
*/
public function enqueue_redirect_old_features_tab_script() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpseo_dashboard' ) {
return;
}
$this->asset_manager->enqueue_script( 'redirect-old-features-tab' );
}
}

View File

@@ -0,0 +1,163 @@
<?php
namespace Yoast\WP\SEO\Integrations\Admin;
use WPSEO_Ryte_Option;
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Integrations\Integration_Interface;
/**
* Handles the request for getting the Ryte status.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
class Ryte_Integration implements Integration_Interface {
/**
* Constructor.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param Options_Helper $options_helper The options helper object used to determine if Ryte is active or not.
*/
public function __construct( Options_Helper $options_helper ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Sets up the hooks.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Returns the conditionals based on which this loadable should be active.
*
* In this case: only when on an admin page.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return array The conditionals.
*/
public static function get_conditionals() {
return [ Admin_Conditional::class ];
}
/**
* Determines if we can use the functionality.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return bool True if this functionality can be used.
*/
public function is_active() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return false;
}
/**
* Hooks to run on plugin activation.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
public function activate_hooks() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Determines whether to add a custom cron weekly schedule.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return void
*/
public function maybe_add_weekly_schedule() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Adds a custom weekly cron schedule.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param array $schedules The existing custom cron schedules.
*
* @return array Enriched list of custom cron schedules.
*/
public function add_weekly_schedule( $schedules ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
/**
* Fetches the data from Ryte.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return bool Whether the request ran.
*/
public function fetch_from_ryte() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return true;
}
/**
* Retrieves the option to use.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return WPSEO_Ryte_Option The option.
*/
public function get_option() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return new WPSEO_Ryte_Option();
}
/**
* Sends a request to Ryte to get the indexability status.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return int The indexability status value.
*/
protected function request_indexability() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return -1;
}
/**
* Retrieves the Ryte API response property.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return array The response or WP_Error on failure.
*/
public function get_response() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
}

View File

@@ -0,0 +1,290 @@
<?php
namespace Yoast\WP\SEO\Integrations\Admin;
use WP_Taxonomy;
use WPSEO_Admin_Editor_Specific_Replace_Vars;
use WPSEO_Admin_Recommended_Replace_Vars;
use WPSEO_Admin_Utils;
use WPSEO_Replacevar_Editor;
use WPSEO_Shortlinker;
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
use Yoast\WP\SEO\Conditionals\Open_Graph_Conditional;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
use Yoast\WP\SEO\Presenters\Admin\Badge_Presenter;
use Yoast\WP\SEO\Presenters\Admin\Premium_Badge_Presenter;
use Yoast_Form;
/**
* Class Social_Templates_Integration.
*
* Adds the social fields to the meta tabs for post types, taxonomies and archives.
*
* @deprecated 20.3
* @codeCoverageIgnore
*/
class Social_Templates_Integration implements Integration_Interface {
/**
* Service that can be used to recommend a set of variables for a WPSEO_Replacevar_Editor.
*
* @var WPSEO_Admin_Recommended_Replace_Vars
*/
private $recommended_replace_vars;
/**
* Service that can be used to recommend an editor specific set of variables for a WPSEO_Replacevar_Editor.
*
* @var WPSEO_Admin_Editor_Specific_Replace_Vars
*/
private $editor_specific_replace_vars;
/**
* Group to which the 'New' badges belong to.
*
* @var string
*/
private $group = 'global-templates';
/**
* Returns the conditionals based in which this loadable should be active.
*
* @deprecated 20.3
* @codeCoverageIgnore
*
* @return array
*/
public static function get_conditionals() {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
return [ Admin_Conditional::class, Open_Graph_Conditional::class ];
}
/**
* Initializes the integration.
*
* @deprecated 20.3
* @codeCoverageIgnore
*/
public function register_hooks() {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
\add_action( 'Yoast\WP\SEO\admin_author_archives_meta_internal', [ $this, 'social_author_archives' ] );
\add_action( 'Yoast\WP\SEO\admin_date_archives_meta_internal', [ $this, 'social_date_archives' ] );
\add_action( 'Yoast\WP\SEO\admin_post_types_beforearchive_internal', [ $this, 'social_post_type' ], \PHP_INT_MAX, 2 );
\add_action( 'Yoast\WP\SEO\admin_post_types_archive_internal', [ $this, 'social_post_types_archive' ], 10, 2 );
\add_action( 'Yoast\WP\SEO\admin_taxonomies_meta_internal', [ $this, 'social_taxonomies' ], 10, 2 );
}
/**
* Returns the recommended replacements variables object, creating it if needed.
*
* @return WPSEO_Admin_Recommended_Replace_Vars
*/
protected function get_admin_recommended_replace_vars() {
if ( \is_null( $this->recommended_replace_vars ) ) {
$this->recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
}
return $this->recommended_replace_vars;
}
/**
* Returns the editor specific replacements variables object, creating it if needed.
*
* @return WPSEO_Admin_Editor_Specific_Replace_Vars
*/
protected function get_admin_editor_specific_replace_vars() {
if ( \is_null( $this->editor_specific_replace_vars ) ) {
$this->editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
}
return $this->editor_specific_replace_vars;
}
/**
* Build a set of social fields for the author archives in the Search Appearance section.
*
* @deprecated 20.3
* @codeCoverageIgnore
*
* @param Yoast_Form $yform The form builder.
*/
public function social_author_archives( $yform ) {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
$identifier = 'author-wpseo';
$page_type_recommended = $this->get_admin_recommended_replace_vars()->determine_for_archive( 'author' );
$page_type_specific = $this->get_admin_editor_specific_replace_vars()->determine_for_archive( 'author' );
$this->build_social_fields( $yform, $identifier, $page_type_recommended, $page_type_specific );
}
/**
* Build a set of social fields for the date archives in the Search Appearance section.
*
* @deprecated 20.3
* @codeCoverageIgnore
*
* @param Yoast_Form $yform The form builder.
*/
public function social_date_archives( $yform ) {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
$identifier = 'archive-wpseo';
$page_type_recommended = $this->get_admin_recommended_replace_vars()->determine_for_archive( 'date' );
$page_type_specific = $this->get_admin_editor_specific_replace_vars()->determine_for_archive( 'date' );
$this->build_social_fields( $yform, $identifier, $page_type_recommended, $page_type_specific );
}
/**
* Build a set of social fields for the post types in the Search Appearance section.
*
* @deprecated 20.3
* @codeCoverageIgnore
*
* @param Yoast_Form $yform The form builder.
* @param string $post_type_name The name of the current post_type that gets the social fields added.
*/
public function social_post_type( $yform, $post_type_name ) {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
if ( $post_type_name === 'attachment' ) {
return;
}
$page_type_recommended = $this->get_admin_recommended_replace_vars()->determine_for_post_type( $post_type_name );
$page_type_specific = $this->get_admin_editor_specific_replace_vars()->determine_for_post_type( $post_type_name );
$this->build_social_fields( $yform, $post_type_name, $page_type_recommended, $page_type_specific );
}
/**
* Build a set of social fields for the post types archives in the Search Appearance section.
*
* @deprecated 20.3
* @codeCoverageIgnore
*
* @param Yoast_Form $yform The form builder.
* @param string $post_type_name The name of the current post_type that gets the social fields added.
*/
public function social_post_types_archive( $yform, $post_type_name ) {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
$identifier = 'ptarchive-' . $post_type_name;
$page_type_recommended = $this->get_admin_recommended_replace_vars()->determine_for_archive( $post_type_name );
$page_type_specific = $this->get_admin_editor_specific_replace_vars()->determine_for_archive( $post_type_name );
$this->build_social_fields( $yform, $identifier, $page_type_recommended, $page_type_specific );
}
/**
* Build a set of social fields for the taxonomies in the Search Appearance section.
*
* @deprecated 20.3
* @codeCoverageIgnore
*
* @param Yoast_Form $yform The form builder.
* @param WP_Taxonomy $taxonomy The taxonomy that gets the social fields added.
*/
public function social_taxonomies( $yform, $taxonomy ) {
_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
$identifier = 'tax-' . $taxonomy->name;
$page_type_recommended = $this->get_admin_recommended_replace_vars()->determine_for_term( $taxonomy->name );
$page_type_specific = $this->get_admin_editor_specific_replace_vars()->determine_for_term( $taxonomy->name );
$this->build_social_fields( $yform, $identifier, $page_type_recommended, $page_type_specific );
}
/**
* Build a set of social fields for the Search Appearance section.
*
* @param Yoast_Form $yform The form builder.
* @param string $identifier A page-wide unique identifier for data storage and unique DOM elements.
* @param string $page_type_recommended Recommended type of page for a list of replaceable variables.
* @param string $page_type_specific Editor specific type of page for a list of replaceable variables.
*/
protected function build_social_fields( Yoast_Form $yform, $identifier, $page_type_recommended, $page_type_specific ) {
$image_url_field_id = 'social-image-url-' . $identifier;
$image_id_field_id = 'social-image-id-' . $identifier;
$is_premium = \YoastSEO()->helpers->product->is_premium();
$is_premium_16_5_or_up = \defined( '\WPSEO_PREMIUM_VERSION' ) && \version_compare( \WPSEO_PREMIUM_VERSION, '16.5-RC0', '>=' );
$is_form_enabled = $is_premium && $is_premium_16_5_or_up;
$section_class = 'yoast-settings-section';
if ( ! $is_form_enabled ) {
$section_class .= ' yoast-settings-section-disabled';
}
\printf( '<div class="%s">', \esc_attr( $section_class ) );
echo '<div class="social-settings-heading-container">';
echo '<h3 class="social-settings-heading">' . \esc_html__( 'Social settings', 'wordpress-seo' ) . '</h3>';
if ( $is_form_enabled ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Is correctly escaped in the Premium_Badge_Presenter.
echo new Premium_Badge_Presenter( 'global-templates-' . $identifier );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Is correctly escaped in the Badge_Presenter.
echo new Badge_Presenter( 'global-templates-' . $identifier, '', $this->group );
}
echo '</div>';
$yform->hidden( $image_url_field_id, $image_url_field_id );
$yform->hidden( $image_id_field_id, $image_id_field_id );
\printf(
'<div
id="%1$s"
data-react-image-portal
data-react-image-portal-target-image="%2$s"
data-react-image-portal-target-image-id="%3$s"
data-react-image-portal-is-disabled="%4$s"
data-react-image-portal-has-image-validation="%5$s"
></div>',
\esc_attr( 'yoast-social-' . $identifier . '-image-select' ),
\esc_attr( $image_url_field_id ),
\esc_attr( $image_id_field_id ),
\esc_attr( ! $is_form_enabled ),
true
);
$editor = new WPSEO_Replacevar_Editor(
$yform,
[
'title' => 'social-title-' . $identifier,
'description' => 'social-description-' . $identifier,
'page_type_recommended' => $page_type_recommended,
'page_type_specific' => $page_type_specific,
'paper_style' => false,
'label_title' => \__( 'Social title', 'wordpress-seo' ),
'label_description' => \__( 'Social description', 'wordpress-seo' ),
'description_placeholder' => '',
'is_disabled' => ! $is_form_enabled,
]
);
$editor->render();
if ( $is_premium && ! $is_premium_16_5_or_up ) {
echo '<div class="yoast-settings-section-upsell">';
$unlock_alert = \sprintf(
/* translators: %s expands to 'Yoast SEO Premium'. */
\esc_html__( 'To unlock this feature please update %s to the latest version.', 'wordpress-seo' ),
'Yoast SEO Premium'
);
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped above.
echo new Alert_Presenter( $unlock_alert );
echo '</div>';
}
if ( ! $is_premium ) {
echo '<div class="yoast-settings-section-upsell">';
echo '<a class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="' . \esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/4e0' ) ) . '" target="_blank">'
. \esc_html__( 'Unlock with Premium', 'wordpress-seo' )
// phpcs:ignore WordPress.Security.EscapeOutput -- Already escapes correctly.
. WPSEO_Admin_Utils::get_new_tab_message()
. '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>'
. '</a>';
echo '</div>';
}
echo '</div>';
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace Yoast\WP\SEO\Integrations\Admin;
use Yoast\WP\SEO\Conditionals\Yoast_Admin_And_Dashboard_Conditional;
use Yoast\WP\SEO\Integrations\Integration_Interface;
/**
* Class Unsupported_PHP_Version.
*
* @package Yoast\WP\SEO\Integrations\Admin
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
class Unsupported_PHP_Version implements Integration_Interface {
/**
* Returns the conditionals based on which this integration should be active.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return array The array of conditionals.
*/
public static function get_conditionals() {
\_deprecated_function( __METHOD__, 'WPSEO 20.4' );
return [
Yoast_Admin_And_Dashboard_Conditional::class,
];
}
/**
* Register hooks.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
\_deprecated_function( __METHOD__, 'WPSEO 20.4' );
}
/**
* Checks the current PHP version.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return void
*/
public function check_php_version() {
\_deprecated_function( __METHOD__, 'WPSEO 20.4' );
}
/**
* Composes the body of the message to display.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return string The message to display.
*/
public function body() {
\_deprecated_function( __METHOD__, 'WPSEO 20.4' );
return '';
}
}

View File

@@ -0,0 +1,130 @@
<?php
namespace Yoast\WP\SEO\Integrations;
use WPSEO_Admin_Asset_Manager;
use Yoast\WP\SEO\Conditionals\No_Conditionals;
use Yoast\WP\SEO\Conditionals\Schema_Blocks_Conditional;
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
/**
* Loads schema block templates into Gutenberg.
*
* @deprecated 20.5
* @codeCoverageIgnore
*/
class Schema_Blocks implements Integration_Interface {
use No_Conditionals;
/**
* The registered templates.
*
* @var string[]
*/
protected $templates = [];
/**
* Contains the asset manager.
*
* @var WPSEO_Admin_Asset_Manager
*/
protected $asset_manager;
/**
* Represents the schema blocks conditional.
*
* @var Schema_Blocks_Conditional
*/
protected $blocks_conditional;
/**
* Represents the short link helper.
*
* @var Short_Link_Helper
*/
protected $short_link_helper;
/**
* Schema_Blocks constructor.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param WPSEO_Admin_Asset_Manager $asset_manager The asset manager.
* @param Schema_Blocks_Conditional $blocks_conditional The schema blocks conditional.
* @param Short_Link_Helper $short_link_helper The short link helper.
*/
public function __construct(
WPSEO_Admin_Asset_Manager $asset_manager,
Schema_Blocks_Conditional $blocks_conditional,
Short_Link_Helper $short_link_helper
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
$this->asset_manager = $asset_manager;
$this->blocks_conditional = $blocks_conditional;
$this->short_link_helper = $short_link_helper;
}
/**
* Initializes the integration.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* This is the place to register hooks and filters.
*
* @return void
*/
public function register_hooks() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
}
/**
* Registers a schema template.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param string $template The template to be registered.
* If starting with a / is assumed to be an absolute path.
* If not starting with a / is assumed to be relative to WPSEO_PATH.
*
* @return void
*/
public function register_template( $template ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
}
/**
* Loads all schema block templates and the required JS library for them.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @return void
*/
public function load() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
}
/**
* Outputs the set templates.
*
* @deprecated 20.5
* @codeCoverageIgnore
*/
public function output() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
}
/**
* Loads the translations and localizes the schema-blocks script file.
*
* @codeCoverageIgnore
* @deprecated 18.0
*/
public function load_translations() {
\_deprecated_function( __FUNCTION__, '18.0' );
}
}

View File

@@ -0,0 +1,173 @@
<?php
namespace Yoast\WP\SEO\Integrations\Third_Party;
use WP_User;
use Yoast\WP\SEO\Conditionals\Third_Party\CoAuthors_Plus_Activated_Conditional;
use Yoast\WP\SEO\Conditionals\Third_Party\CoAuthors_Plus_Flag_Conditional;
use Yoast\WP\SEO\Config\Schema_Types;
use Yoast\WP\SEO\Context\Meta_Tags_Context;
use Yoast\WP\SEO\Generators\Schema\Abstract_Schema_Piece;
use Yoast\WP\SEO\Generators\Schema\Third_Party\CoAuthor;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Surfaces\Helpers_Surface;
/**
* Integrates the multiple authors capability from CoAuthors Plus into Yoast SEO schema.
*
* @deprecated 19.12
* @codeCoverageIgnore
*/
class CoAuthors_Plus implements Integration_Interface {
/**
* The helpers surface.
*
* @var Helpers_Surface
*/
protected $helpers;
/**
* Initializes the integration.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
\add_filter( 'wpseo_schema_graph', [ $this, 'filter_graph' ], 11, 2 );
\add_filter( 'wpseo_schema_author', [ $this, 'filter_author_graph' ], 11, 4 );
}
/**
* Returns the conditionals based in which this loadable should be active.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return array
*/
public static function get_conditionals() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return [
CoAuthors_Plus_Activated_Conditional::class,
CoAuthors_Plus_Flag_Conditional::class,
];
}
/**
* CoAuthors_Plus constructor.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @param Helpers_Surface $helpers The helper surface.
*/
public function __construct( Helpers_Surface $helpers ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
$this->helpers = $helpers;
}
/**
* Filters the graph output to add authors.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @param array $data The schema graph.
* @param Meta_Tags_Context $context The context object.
* @param Abstract_Schema_Piece $graph_piece_generator The graph piece generator.
* @param Abstract_Schema_Piece[] $graph_piece_generators The graph piece generators.
*
* @return array The (potentially altered) schema graph.
*/
public function filter_author_graph( $data, $context, $graph_piece_generator, $graph_piece_generators ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
if ( ! isset( $data['image']['url'] ) ) {
return $data;
}
if ( isset( $data['image']['@id'] ) ) {
$data['image']['@id'] .= \md5( $data['image']['url'] );
}
if ( isset( $data['logo']['@id'] ) ) {
$data['logo']['@id'] .= \md5( $data['image']['url'] );
}
return $data;
}
/**
* Filters the graph output to add authors.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @param array $data The schema graph.
* @param Meta_Tags_Context $context Context object.
*
* @return array The (potentially altered) schema graph.
*/
public function filter_graph( $data, $context ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
if ( ! \is_singular() ) {
return $data;
}
if ( ! \function_exists( '\get_coauthors' ) ) {
return $data;
}
/**
* Contains the authors from the CoAuthors Plus plugin.
*
* @var WP_User[] $author_objects
*/
$author_objects = \get_coauthors( $context->post->ID );
if ( \count( $author_objects ) <= 1 ) {
return $data;
}
$ids = [];
// Add the authors to the schema.
foreach ( $author_objects as $author ) {
if ( $author->ID === (int) $context->post->post_author ) {
continue;
}
$author_generator = new CoAuthor();
$author_generator->context = $context;
$author_generator->helpers = $this->helpers;
$author_data = $author_generator->generate_from_user_id( $author->ID );
if ( ! empty( $author_data ) ) {
$ids[] = [ '@id' => $author_data['@id'] ];
}
}
$schema_types = new Schema_Types();
$article_types = $schema_types->get_article_type_options_values();
// Change the author reference to reference our multiple authors.
$add_to_graph = false;
foreach ( $data as $key => $piece ) {
if ( \in_array( $piece['@type'], $article_types, true ) ) {
$data[ $key ]['author'] = \array_merge( [ $piece['author'] ], $ids );
$add_to_graph = true;
break;
}
}
if ( $add_to_graph ) {
if ( ! empty( $author_data ) ) {
if ( $context->site_represents !== 'person' || $author->ID !== $context->site_user_id ) {
$data[] = $author_data;
}
}
}
return $data;
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace Yoast\WP\SEO\Integrations\Third_Party;
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
use Yoast\WP\SEO\Conditionals\Open_Graph_Conditional;
use Yoast\WP\SEO\Conditionals\The_Events_Calendar_Conditional;
use Yoast\WP\SEO\Integrations\Integration_Interface;
/**
* Class The_Events_Calendar
*
* @deprecated 19.12
* @codeCoverageIgnore
*/
class The_Events_Calendar implements Integration_Interface {
/**
* Returns the conditionals based in which this loadable should be active.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return array
*/
public static function get_conditionals() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return [ Front_End_Conditional::class, Open_Graph_Conditional::class ];
}
/**
* Initializes the integration.
*
* This is the place to register hooks and filters.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
}
/**
* Adds the events graph pieces to the schema collector.
*
* @param array $pieces The current graph pieces.
* @param string $context The current context.
*
* @deprecated 19.12
* @codeCoverageIgnore
*
* @return array Extended graph pieces.
*/
public function add_graph_pieces( $pieces, $context ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.12' );
return $pieces;
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace Yoast\WP\SEO\Presenters\Admin;
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
/**
* Class Auto_Update_Notification_Presenter.
*
* @deprecated 19.8
* @codeCoverageIgnore
*/
class Auto_Update_Notification_Presenter extends Abstract_Presenter {
/**
* Returns the notification as an HTML string.
*
* @deprecated 19.8
* @codeCoverageIgnore
*
* @return string The notification in an HTML string representation.
*/
public function present() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.8' );
return '';
}
/**
* Returns the message to show.
*
* @deprecated 19.8
* @codeCoverageIgnore
*
* @return string The message.
*/
protected function get_message() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.8' );
return '';
}
}

View File

@@ -0,0 +1,188 @@
<?php
namespace Yoast\WP\SEO\Routes;
use WP_REST_Request;
use Yoast\WP\SEO\Actions\Configuration\Configuration_Workout_Action;
use Yoast\WP\SEO\Conditionals\No_Conditionals;
/**
* Configuration_Workout_Route class.
*
* @deprecated 19.0 - Use \Yoast\WP\SEO\Actions\First_Time_Configuration_Action instead.
* @codeCoverageIgnore
*/
class Configuration_Workout_Route implements Route_Interface {
use No_Conditionals;
/**
* Represents a site representation route.
*
* @var string
*/
const SITE_REPRESENTATION_ROUTE = '/site_representation';
/**
* Represents a social profiles route.
*
* @var string
*/
const SOCIAL_PROFILES_ROUTE = '/social_profiles';
/**
* Represents a person's social profiles route.
*
* @var string
*/
const PERSON_SOCIAL_PROFILES_ROUTE = '/person_social_profiles';
/**
* Represents a route to enable/disable tracking.
*
* @var string
*/
const ENABLE_TRACKING_ROUTE = '/enable_tracking';
/**
* Represents a route to check if current user has the correct capabilities to edit another user's profile.
*
* @var string
*/
const CHECK_CAPABILITY_ROUTE = '/check_capability';
/**
* Configuration_Workout_Route constructor.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @param Configuration_Workout_Action $configuration_workout_action The configuration workout action.
*/
public function __construct(
Configuration_Workout_Action $configuration_workout_action
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0' );
}
/**
* Registers routes with WordPress.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @return void
*/
public function register_routes() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::register_routes' );
}
/**
* Sets the site representation values.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request.
*
* @return void
*/
public function set_site_representation( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::set_site_representation' );
}
/**
* Sets the social profiles values.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request.
*
* @return void
*/
public function set_social_profiles( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::set_social_profiles' );
}
/**
* Gets a person's social profiles values.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request.
*
* @return void
*/
public function get_person_social_profiles( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::get_person_social_profiles' );
}
/**
* Sets a person's social profiles values.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request.
*
* @return void
*/
public function set_person_social_profiles( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::set_person_social_profiles' );
}
/**
* Checks if the current user has the correct capability to edit a specific user.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request.
*
* @return void
*/
public function check_capability( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::check_capability' );
}
/**
* Enables or disables tracking.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request.
*
* @return void
*/
public function set_enable_tracking( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::set_enable_tracking' );
}
/**
* Checks if the current user has the right capability.
*
* @deprecated 19.0
* @codeCoverageIgnore
*
* @return bool
*/
public function can_manage_options() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::can_manage_options' );
return \current_user_can( 'wpseo_manage_options' );
}
/**
* Checks if the current user has the capability to edit a specific user.
*
* @param WP_REST_Request $request The request.
*
* @return void
*/
public function can_edit_user( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.0', '\Yoast\WP\SEO\Routes\First_Time_Configuration_Route::can_edit_user' );
}
}

View File

@@ -0,0 +1,637 @@
<?php
namespace Yoast\WP\SEO\Routes;
use WP_Error;
use WP_REST_Request;
use WP_REST_Response;
use Yoast\WP\SEO\Actions\Indexables_Page_Action;
use Yoast\WP\SEO\Conditionals\Indexables_Page_Conditional;
use Yoast\WP\SEO\Helpers\Indexables_Page_Helper;
use Yoast\WP\SEO\Main;
/**
* Indexables_Page_Route class.
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
class Indexables_Page_Route implements Route_Interface {
/**
* Represents the route that retrieves the neccessary information for setting up the Indexables Page.
*
* @var string
*/
const SETUP_INFO = '/setup_info';
/**
* Represents the least readability route.
*
* @var string
*/
const LEAST_READABILITY_ROUTE = '/least_readability';
/**
* Represents the least SEO score route.
*
* @var string
*/
const LEAST_SEO_SCORE_ROUTE = '/least_seo_score';
/**
* Represents the most linked route.
*
* @var string
*/
const MOST_LINKED_ROUTE = '/most_linked';
/**
* Represents the least linked route.
*
* @var string
*/
const LEAST_LINKED_ROUTE = '/least_linked';
/**
* Allows to mark an indexable to be ignored.
*
* @var string
*/
const UPDATE_IGNORED_INDEXABLES_ROUTE = '/update_ignored_indexables';
/**
* Allows to restore an indexable previously ignored.
*
* @var string
*/
const RESTORE_INDEXABLE_ROUTE = '/restore_indexable';
/**
* Allows to restore all indexables previously ignored.
*
* @var string
*/
const RESTORE_ALL_INDEXABLES_ROUTE = '/restore_all_indexables';
/**
* Allows to restore all indexables previously ignored for a certain list.
*
* @var string
*/
const RESTORE_ALL_INDEXABLES_FOR_LIST_ROUTE = '/restore_all_indexables_for_list';
/**
* Gets the reading list state.
*
* @var string
*/
const GET_READING_LIST_STATE = '/get_reading_list';
/**
* Sets the reading list state.
*
* @var string
*/
const SET_READING_LIST_STATE = '/set_reading_list';
/**
* The indexable actions.
*
* @var Indexables_Page_Action
*/
private $indexables_page_action;
/**
* The indexables page helper.
*
* @var Indexables_Page_Helper
*/
private $indexables_page_helper;
/**
* Indexables_Route constructor.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param Indexables_Page_Action $indexables_page_action The indexable actions.
* @param Indexables_Page_Helper $indexables_page_helper The indexables page helper.
*/
public function __construct( Indexables_Page_Action $indexables_page_action, Indexables_Page_Helper $indexables_page_helper ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$this->indexables_page_action = $indexables_page_action;
$this->indexables_page_helper = $indexables_page_helper;
}
/**
* {@inheritDoc}
*
* @deprecated 20.4
* @codeCoverageIgnore
*/
public static function get_conditionals() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
return [
Indexables_Page_Conditional::class,
];
}
/**
* Permission callback.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return bool true when user has 'edit_others_posts' permission.
*/
public static function permission_edit_others_posts() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
return \current_user_can( 'edit_others_posts' );
}
/**
* Registers routes with WordPress.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return void
*/
public function register_routes() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$setup_info_route = [
[
'methods' => 'GET',
'callback' => [ $this, 'get_setup_info' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::SETUP_INFO, $setup_info_route );
$least_readability_route = [
[
'methods' => 'GET',
'callback' => [ $this, 'get_least_readable' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::LEAST_READABILITY_ROUTE, $least_readability_route );
$least_seo_score_route = [
[
'methods' => 'GET',
'callback' => [ $this, 'get_least_seo_score' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::LEAST_SEO_SCORE_ROUTE, $least_seo_score_route );
$most_linked_route = [
[
'methods' => 'GET',
'callback' => [ $this, 'get_most_linked' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::MOST_LINKED_ROUTE, $most_linked_route );
$least_linked_route = [
[
'methods' => 'GET',
'callback' => [ $this, 'get_least_linked' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::LEAST_LINKED_ROUTE, $least_linked_route );
$update_ignored_indexables_route = [
[
'methods' => 'POST',
'callback' => [ $this, 'update_ignored_indexables' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
'args' => [
'id' => [
'type' => 'integer',
'minimum' => 0,
],
'type' => [
'type' => 'string',
'enum' => [
'least_readability',
'least_seo_score',
'most_linked',
'least_linked',
],
],
],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::UPDATE_IGNORED_INDEXABLES_ROUTE, $update_ignored_indexables_route );
$restore_indexable_route = [
[
'methods' => 'POST',
'callback' => [ $this, 'restore_indexable' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
'args' => [
'id' => [
'type' => 'integer',
'minimum' => 0,
],
'type' => [
'type' => 'string',
'enum' => [
'least_readability',
'least_seo_score',
'most_linked',
'least_linked',
],
],
],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::RESTORE_INDEXABLE_ROUTE, $restore_indexable_route );
$restore_all_indexables_route = [
[
'methods' => 'POST',
'callback' => [ $this, 'restore_all_indexables' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::RESTORE_ALL_INDEXABLES_ROUTE, $restore_all_indexables_route );
$restore_all_indexables_for_list_route = [
[
'methods' => 'POST',
'callback' => [ $this, 'restore_all_indexables_for_list' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
'args' => [
'type' => [
'type' => 'string',
'enum' => [
'least_readability',
'least_seo_score',
'most_linked',
'least_linked',
],
],
],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::RESTORE_ALL_INDEXABLES_FOR_LIST_ROUTE, $restore_all_indexables_for_list_route );
$get_reading_list_route = [
[
'methods' => 'GET',
'callback' => [ $this, 'get_reading_list' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::GET_READING_LIST_STATE, $get_reading_list_route );
$set_reading_list_route = [
[
'methods' => 'POST',
'callback' => [ $this, 'set_reading_list' ],
'permission_callback' => [ $this, 'permission_edit_others_posts' ],
'args' => [
'state' => [
'type' => 'array',
],
],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::SET_READING_LIST_STATE, $set_reading_list_route );
}
/**
* Gets the necessary information to set up the indexables page.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return WP_REST_Response The neccessary information to set up the indexables page.
*/
public function get_setup_info() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$setup_info = $this->indexables_page_action->get_setup_info( $this->indexables_page_helper->get_minimum_posts_threshold(), $this->indexables_page_helper->get_minimum_analyzed_posts_threshold() );
return new WP_REST_Response(
[
'json' => $setup_info,
]
);
}
/**
* Gets the posts with the smallest readability scores.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return WP_REST_Response The posts with the smallest readability scores.
*/
public function get_least_readable() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$least_readable = $this->indexables_page_action->get_least_readable( $this->indexables_page_helper->get_buffer_size() );
return new WP_REST_Response(
[
'json' => [
'list' => $least_readable,
'length' => \count( $least_readable ),
],
]
);
}
/**
* Gets the posts with the smallest readability scores.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return WP_REST_Response The posts with the smallest readability scores.
*/
public function get_least_seo_score() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$least_seo_score = $this->indexables_page_action->get_least_seo_score( $this->indexables_page_helper->get_buffer_size() );
return new WP_REST_Response(
[
'json' => [
'list' => $least_seo_score,
'length' => \count( $least_seo_score ),
],
]
);
}
/**
* Gets the most linked posts.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return WP_REST_Response The most linked posts.
*/
public function get_most_linked() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$most_linked = $this->indexables_page_action->get_most_linked( $this->indexables_page_helper->get_buffer_size() );
return new WP_REST_Response(
[
'json' => [
'list' => $most_linked,
'length' => \count( $most_linked ),
],
]
);
}
/**
* Gets the least linked posts.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return WP_REST_Response The most linked posts.
*/
public function get_least_linked() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$least_linked = $this->indexables_page_action->get_least_linked( $this->indexables_page_helper->get_buffer_size() );
return new WP_REST_Response(
[
'json' => [
'list' => $least_linked,
'length' => \count( $least_linked ),
],
]
);
}
/**
* Adds an indexable id in the ignore list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request object.
*
* @return WP_REST_Response|WP_Error The success or failure response.
*/
public function update_ignored_indexables( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$params = $request->get_json_params();
$ignore_list_name = $params['type'] . '_ignore_list';
$ignored_indexable_ids = \array_map(
static function ( $ignored_indexable_id ) {
return \intval( $ignored_indexable_id );
},
$params['list']
);
if ( $this->indexables_page_action->update_ignored_indexables( $ignore_list_name, $ignored_indexable_ids ) ) {
return new WP_REST_Response(
[
'json' => (object) [ 'success' => true ],
],
200
);
}
return new WP_Error(
'ignore_failed',
'Could not save the option in the database',
[
'status' => 500,
]
);
}
/**
* Restores an indexable id from the ignore list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request object.
*
* @return WP_REST_Response|WP_Error The success or failure response.
*/
public function restore_indexable( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$params = $request->get_json_params();
$ignore_list_name = $params['type'] . '_ignore_list';
$indexable_id = \intval( $params['id'] );
if ( $this->indexables_page_action->remove_indexable_from_ignore_list( $ignore_list_name, $indexable_id ) ) {
return new WP_REST_Response(
[
'json' => (object) [ 'success' => true ],
],
200
);
}
return new WP_Error(
'restore_failed',
'Could not save the option in the database',
[
'status' => 500,
]
);
}
/**
* Restores all indexables from all ignore lists.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return WP_REST_Response|WP_Error The success or failure response.
*/
public function restore_all_indexables() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$list_names = $this->indexables_page_helper->get_ignore_list_names();
$success = true;
foreach ( $list_names as $list_name ) {
$result = $this->indexables_page_action->remove_all_indexables_from_ignore_list( $list_name );
if ( $result === false ) {
$success = false;
}
}
if ( $success === true ) {
return new WP_REST_Response(
[
'json' => (object) [ 'success' => true ],
],
200
);
}
return new WP_Error(
'restore_all_failed',
'Could not save the option in the database',
[
'status' => 500,
]
);
}
/**
* Restores all indexables from a specific ignore list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request object.
*
* @return WP_REST_Response|WP_Error The success or failure response.
*/
public function restore_all_indexables_for_list( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$params = $request->get_json_params();
$ignore_list_name = $params['type'] . '_ignore_list';
if ( $this->indexables_page_action->remove_all_indexables_from_ignore_list( $ignore_list_name ) ) {
return new WP_REST_Response(
[
'json' => (object) [ 'success' => true ],
],
200
);
}
return new WP_Error(
'restore_all_list_failed',
'Could not save the option in the database',
[
'status' => 500,
]
);
}
/**
* Gets the state of the reading list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @return WP_REST_Response A list of boolean values which are true if an article has been flagged as read.
*/
public function get_reading_list() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$reading_list = $this->indexables_page_action->get_reading_list();
return new WP_REST_Response(
[
'json' => [
'state' => $reading_list,
],
]
);
}
/**
* Sets the state of the reading list.
*
* @deprecated 20.4
* @codeCoverageIgnore
*
* @param WP_REST_Request $request The request object.
*
* @return WP_REST_Response|WP_Error The success or failure response.
*/
public function set_reading_list( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
$params = $request->get_json_params();
$reading_list_state = \array_map(
static function ( $article ) {
return \boolval( $article );
},
$params['state']
);
if ( $this->indexables_page_action->set_reading_list( $reading_list_state ) ) {
return new WP_REST_Response(
[
'json' => (object) [ 'success' => true ],
],
200
);
}
return new WP_Error(
'set_list_failed',
'Could not save the option in the database',
[
'status' => 500,
]
);
}
}

View File

@@ -0,0 +1,278 @@
<?php
namespace Yoast\WP\SEO\Routes;
use Exception;
use WP_Error;
use WP_REST_Request;
use WP_REST_Response;
use Yoast\WP\SEO\Actions\Settings_Introduction_Action;
use Yoast\WP\SEO\Conditionals\Settings_Conditional;
use Yoast\WP\SEO\Main;
/**
* Settings_Introduction_Route class.
*
* @deprecated 20.7
* @codeCoverageIgnore
*/
class Settings_Introduction_Route implements Route_Interface {
/**
* Represents the Settings_Introduction_Route prefix.
*
* @var string
*/
const ROUTE_PREFIX = '/settings_introduction';
/**
* Represents the Wistia embed permission.
*
* @var string
*/
const WISTIA_EMBED_PERMISSION = self::ROUTE_PREFIX . '/wistia_embed_permission';
/**
* Represents showing the introduction.
*
* @var string
*/
const SHOW = self::ROUTE_PREFIX . '/show';
/**
* Holds the Settings_Introduction_Action.
*
* @var Settings_Introduction_Action
*/
private $settings_introduction_action;
/**
* Constructs Settings_Introduction_Route.
*
* @param Settings_Introduction_Action $settings_introduction_action The $settings_introduction_action.
*
* @deprecated 20.7
* @codeCoverageIgnore
*/
public function __construct( Settings_Introduction_Action $settings_introduction_action ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
$this->settings_introduction_action = $settings_introduction_action;
}
/**
* {@inheritDoc}
*
* @deprecated 20.7
* @codeCoverageIgnore
*/
public static function get_conditionals() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
return [ Settings_Conditional::class ];
}
/**
* Permission callback.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return bool True when user has 'wpseo_manage_options' permission.
*/
public static function permission_manage_options() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
return \current_user_can( 'wpseo_manage_options' );
}
/**
* Registers routes with WordPress.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return void
*/
public function register_routes() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
\register_rest_route(
Main::API_V1_NAMESPACE,
self::WISTIA_EMBED_PERMISSION,
[
[
'methods' => 'GET',
'callback' => [ $this, 'get_wistia_embed_permission' ],
'permission_callback' => [ $this, 'permission_manage_options' ],
],
[
'methods' => 'POST',
'callback' => [ $this, 'set_wistia_embed_permission' ],
'permission_callback' => [ $this, 'permission_manage_options' ],
'args' => [
'value' => [
'required' => true,
'type' => 'bool',
],
],
],
]
);
\register_rest_route(
Main::API_V1_NAMESPACE,
self::SHOW,
[
[
'methods' => 'GET',
'callback' => [ $this, 'get_show' ],
'permission_callback' => [ $this, 'permission_manage_options' ],
],
[
'methods' => 'POST',
'callback' => [ $this, 'set_show' ],
'permission_callback' => [ $this, 'permission_manage_options' ],
'args' => [
'value' => [
'required' => true,
'type' => 'bool',
],
],
],
]
);
}
/**
* Gets the value of the wistia embed permission.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return WP_REST_Response|WP_Error The response, or an error.
*/
public function get_wistia_embed_permission() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
try {
$value = $this->settings_introduction_action->get_wistia_embed_permission();
} catch ( Exception $exception ) {
return new WP_Error(
'wpseo_settings_introduction_error',
$exception->getMessage(),
(object) []
);
}
return new WP_REST_Response(
[
'json' => (object) [
'value' => $value,
],
]
);
}
/**
* Sets the value of the wistia embed permission.
*
* @param WP_REST_Request $request The request object.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return WP_REST_Response|WP_Error The success or failure response.
*/
public function set_wistia_embed_permission( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
$params = $request->get_json_params();
$value = \boolval( $params['value'] );
try {
$result = $this->settings_introduction_action->set_wistia_embed_permission( $value );
} catch ( Exception $exception ) {
return new WP_Error(
'wpseo_settings_introduction_error',
$exception->getMessage(),
(object) []
);
}
return new WP_REST_Response(
[
'json' => (object) [
'success' => $result,
],
],
( $result ) ? 200 : 400
);
}
/**
* Gets the value of show.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return WP_REST_Response|WP_Error The response, or an error.
*/
public function get_show() {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
try {
$value = $this->settings_introduction_action->get_show();
} catch ( Exception $exception ) {
return new WP_Error(
'wpseo_settings_introduction_error',
$exception->getMessage(),
(object) []
);
}
return new WP_REST_Response(
[
'json' => (object) [
'value' => $value,
],
]
);
}
/**
* Sets the value of show.
*
* @param WP_REST_Request $request The request object.
*
* @deprecated 20.7
* @codeCoverageIgnore
*
* @return WP_REST_Response|WP_Error The success or failure response.
*/
public function set_show( WP_REST_Request $request ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.7' );
$params = $request->get_json_params();
$value = \boolval( $params['value'] );
try {
$result = $this->settings_introduction_action->set_show( $value );
} catch ( Exception $exception ) {
return new WP_Error(
'wpseo_settings_introduction_error',
$exception->getMessage(),
(object) []
);
}
return new WP_REST_Response(
[
'json' => (object) [
'success' => $result,
],
],
( $result ) ? 200 : 400
);
}
}

View File

@@ -0,0 +1,393 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.MaxExceeded
// phpcs:disable Yoast.NamingConventions.NamespaceName.Invalid
namespace Yoast\WP\SEO\Schema_Templates\Assets;
/**
* Class Icons.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* Provides SVG icons as strings.
*/
class Icons {
/**
* Represents the start of the SVG tag.
*/
const SVG_START_TAG = "<svg xmlns='http://www.w3.org/2000/svg' fill='none' style='fill:none' viewBox='0 0 24 24' stroke='currentColor' height='%SIZE%' width='%SIZE%' >";
/**
* The default height and width of an icon.
*/
const SIZE_DEFAULT = 24;
/**
* The height and width of an icon in a variation picker.
*/
const SIZE_VARIATION = 36;
/**
* The Heroicons academic cap svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_academic_cap( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path fill='#fff' d='M12 14l9-5-9-5-9 5 9 5z' />"
. "<path fill='#fff' d='M12 14l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14z' />"
. "<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 14l9-5-9-5-9 5 9 5zm0 0l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14zm-4 6v-7.5l4-2.222' />",
$size
);
}
/**
* The Heroicons annotation svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_annotation( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z' />",
$size
);
}
/**
* The Heroicons ban svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_ban( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636' />",
$size
);
}
/**
* The Heroicons briefcase svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_briefcase( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z' />",
$size
);
}
/**
* The Heroicons calendar svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_calendar( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z' />",
$size
);
}
/**
* The Heroicons clipboard check svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_clipboard_check( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4' />",
$size
);
}
/**
* The Heroicons clipboard copy svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_clipboard_copy( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3' />",
$size
);
}
/**
* The Heroicons clipboard list svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_clipboard_list( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01' />",
$size
);
}
/**
* The Heroicons clock svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_clock( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z' />",
$size
);
}
/**
* The Heroicons currency dollar svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_currency_dollar( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z' />",
$size
);
}
/**
* The Heroicons cursor_click svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_cursor_click( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122' />",
$size
);
}
/**
* The Heroicons document text svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_document_text( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z' />",
$size
);
}
/**
* The Heroicons globe svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_globe( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z' />",
$size
);
}
/**
* The Heroicons identification svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_identification( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-4 0V5a2 2 0 114 0v1m-4 0a2 2 0 104 0m-5 8a2 2 0 100-4 2 2 0 000 4zm0 0c1.306 0 2.417.835 2.83 2M9 14a3.001 3.001 0 00-2.83 2M15 11h3m-3 4h2' />",
$size
);
}
/**
* The Heroicons location marker svg icon
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_location_marker( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z' />"
. "<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 11a3 3 0 11-6 0 3 3 0 016 0z' />",
$size
);
}
/**
* The Heroicons office building svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_office_building( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path d='M19 21V5C19 3.89543 18.1046 3 17 3H7C5.89543 3 5 3.89543 5 5V21M19 21L21 21M19 21H14M5 21L3 21M5 21H10M9 6.99998H10M9 11H10M14 6.99998H15M14 11H15M10 21V16C10 15.4477 10.4477 15 11 15H13C13.5523 15 14 15.4477 14 16V21M10 21H14' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/>",
$size
);
}
/**
* The Heroicons photograph svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_photograph( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z' />",
$size
);
}
/**
* The Heroicons switch horizontal svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
* @return string
*/
public static function heroicons_switch_horizontal( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4' />",
$size
);
}
/**
* The Heroicons grid svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
*
* @return string The generated icon.
*/
public static function heroicons_grid( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z' />",
$size
);
}
/**
* The Heroicons book open svg icon.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param int $size The Height and Width of the SVG icon.
*
* @return string The generated icon.
*/
public static function heroicons_book_open( $size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
return self::svg(
"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253' />",
$size
);
}
/**
* Generates the SVG based on given path.
*
* @deprecated 20.5
* @codeCoverageIgnore
*
* @param string $path The path to generate svg for.
* @param int $svg_size The Height and Width of the SVG icon.
*
* @return string The generated icon svg.
*/
protected static function svg( $path, $svg_size = self::SIZE_DEFAULT ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 20.5' );
$start = \str_replace( '%SIZE%', $svg_size, self::SVG_START_TAG );
return $start . $path . '</svg>';
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace Yoast\WP\SEO\Services\Health_Check;
/**
* Passes if the health check can reach the MyYoast API using a recent enough cURL version.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*/
class Curl_Check extends Health_Check {
/**
* Constructor.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @param Curl_Runner $runner The object that implements the actual health check.
* @param Curl_Reports $reports The object that generates WordPress-friendly results.
*/
public function __construct(
Curl_Runner $runner,
Curl_Reports $reports
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
}
/**
* Returns a human-readable label for this health check.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return string The human-readable label.
*/
public function get_test_label() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return '';
}
/**
* Returns the WordPress-friendly health check result.
*
* @return string[] The WordPress-friendly health check result.
*/
protected function get_result() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return [];
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace Yoast\WP\SEO\Services\Health_Check;
use WPSEO_Shortlinker;
/**
* Presents a set of different messages for the cURL health check.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*/
class Curl_Reports {
/**
* Constructor
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @param Report_Builder_Factory $report_builder_factory The factory for result builder objects.
* This class uses the report builder to generate WordPress-friendly
* health check results.
* @param WPSEO_Shortlinker $shortlinker The WPSEO_Shortlinker object used to generate short links.
*/
public function __construct(
Report_Builder_Factory $report_builder_factory,
WPSEO_Shortlinker $shortlinker
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
}
/**
* Returns the message for a successful health check.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return string[] The message as a WordPress site status report.
*/
public function get_success_result() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return [];
}
/**
* Returns the message for when the health check was unable to reach the MyYoast API.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return string[] The message as a WordPress site status report.
*/
public function get_my_yoast_api_not_reachable_result() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return [];
}
/**
* Returns the message for a successful health check.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return string[] The message as a WordPress site status report.
*/
public function get_no_recent_curl_version_installed_result() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return [];
}
}

View File

@@ -0,0 +1,113 @@
<?php
namespace Yoast\WP\SEO\Services\Health_Check;
use WPSEO_Addon_Manager;
use Yoast\WP\SEO\Helpers\Curl_Helper;
/**
* Runs the Curl health check.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*/
class Curl_Runner implements Runner_Interface {
/**
* Sets the minimum cURL version for this health check to pass.
*/
const MINIMUM_CURL_VERSION = '7.34.0';
/**
* Sets the target URL for testing whether the MyYoast API is reachable.
*/
const MYYOAST_API_REQUEST_URL = 'sites/current';
/**
* Constructor.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @psalm-suppress InvalidClass MyYoast is a product name, so it's an exception to the class naming conventions.
* @param WPSEO_Addon_Manager $addon_manager The add-on manager.
* @param MyYoast_Api_Request_Factory $my_yoast_api_request_factory A MyYoast API request object.
* @param Curl_Helper $curl_helper A cURL helper object for obtaining
* cURL installation information.
*/
public function __construct(
WPSEO_Addon_Manager $addon_manager,
MyYoast_Api_Request_Factory $my_yoast_api_request_factory,
Curl_Helper $curl_helper
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
}
/**
* Runs the health check. Checks if cURL is installed and up to date, and if it's able to reach the MyYoast API
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return void
*/
public function run() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
}
/**
* Returns whether the health check was successful.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return bool True if all the routines for this health check were successful.
*/
public function is_successful() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return true;
}
/**
* Returns whether there are premium plugins installed.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return bool True if there are premium plugins installed.
*/
public function has_premium_plugins_installed() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return false;
}
/**
* Returns whether cURL was able to reach the MyYoast API.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return bool True if cURL was able to reach the MyYoast API.
*/
public function can_reach_my_yoast_api() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return true;
}
/**
* Returns whether the installed cURL version is recent enough.
*
* @deprecated 19.7.2
* @codeCoverageIgnore
*
* @return bool True if the installed cURL version is more recent than MINIMUM_CURL_VERSION.
*/
public function has_recent_curl_version_installed() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.7.2' );
return true;
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace Yoast\WP\SEO\Services\Health_Check;
/**
* Passes if the health check determines that the site is indexable using Ryte.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
class Ryte_Check extends Health_Check {
/**
* Constructor.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param Ryte_Runner $runner The object that implements the actual health check.
* @param Ryte_Reports $reports The object that generates WordPress-friendly results.
*/
public function __construct(
Ryte_Runner $runner,
Ryte_Reports $reports
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Returns a human-readable label for this health check.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return string The human-readable label.
*/
public function get_test_label() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return '';
}
/**
* Returns the WordPress-friendly health check result.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return string[] The WordPress-friendly health check result.
*/
protected function get_result() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace Yoast\WP\SEO\Services\Health_Check;
use WPSEO_Shortlinker;
/**
* Presents a set of different messages for the Ryte health check.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
class Ryte_Reports {
use Reports_Trait;
/**
* Constructor
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param Report_Builder_Factory $report_builder_factory The factory for result builder objects.
* This class uses the report builder to generate
* WordPress-friendly health check results.
* @param WPSEO_Shortlinker $shortlinker The WPSEO_Shortlinker object used to generate short
* links.
*/
public function __construct(
Report_Builder_Factory $report_builder_factory,
WPSEO_Shortlinker $shortlinker
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Returns the message for a successful health check.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return string[] The message as a WordPress site status report.
*/
public function get_success_result() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
/**
* Returns the report for a health check result in which the site was not indexable.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return string[] The message as a WordPress site status report.
*/
public function get_not_indexable_result() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
/**
* Returns the report for when the health check was unable to determine indexability.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return string[] The message as a WordPress site status report.
*/
public function get_unknown_indexability_result() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
/**
* Returns the result for when the health check got an error response from Ryte.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param array $response_error The error response from Ryte.
*
* @return string[] The message as a WordPress site status report.
*/
public function get_response_error_result( $response_error ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
}

View File

@@ -0,0 +1,114 @@
<?php
namespace Yoast\WP\SEO\Services\Health_Check;
use WPSEO_Utils;
use Yoast\WP\SEO\Integrations\Admin\Ryte_Integration;
/**
* Runs the Ryte health check.
*
* @deprecated 19.6
* @codeCoverageIgnore
*/
class Ryte_Runner implements Runner_Interface {
/**
* Constructor.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @param Ryte_Integration $ryte The Ryte_Integration object that the health check uses to check indexability.
* @param WPSEO_Utils $utils The WPSEO_Utils object used to determine whether the site is in development mode.
*/
public function __construct(
Ryte_Integration $ryte,
WPSEO_Utils $utils
) {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Runs the health check. Checks if Ryte is accessible and whether the site is indexable.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return void
*/
public function run() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
}
/**
* Checks if the site is a live production site that has Ryte enabled.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return bool
*/
public function should_run() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return false;
}
/**
* Checks if the site is indexable.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return bool
*/
public function is_successful() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return true;
}
/**
* Checks if the site's indexability is unknown.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return bool Returns true if the site indexability is unknown even though getting a response from Ryte was
* successful.
*/
public function has_unknown_indexability() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return false;
}
/**
* Checks whether there was a response error when attempting a request to Ryte.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return bool True if the health check got a valid error response.
*/
public function got_response_error() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return true;
}
/**
* Returns the error response is there was one.
*
* @deprecated 19.6
* @codeCoverageIgnore
*
* @return array|null
*/
public function get_error_response() {
\_deprecated_function( __METHOD__, 'Yoast SEO 19.6' );
return [];
}
}