Commit 06bd4cc3 authored by Simon's avatar Simon

plugins and core update

parent 535a2204
......@@ -94,18 +94,18 @@ services:
links:
- wordpress
restart: always
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
restart: unless-stopped
container_name: "${PROJECT}-certbot"
networks:
- "back"
volumes:
- ./certs:/etc/letsencrypt
- ./certs-data:/data/letsencrypt
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
# command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
# certbot:
# image: certbot/certbot
# restart: unless-stopped
# container_name: "${PROJECT}-certbot"
# networks:
# - "back"
# volumes:
# - ./certs:/etc/letsencrypt
# - ./certs-data:/data/letsencrypt
# entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
wordpress-cli:
image: ${IMAGE_WORDPRESS_CLI}
......
......@@ -293,15 +293,6 @@ jQuery( function ( $ ) {
img.src = akismet_mshot_url( linkUrl );
}
/**
* Sets the comment form privacy notice display to hide when one clicks Core's dismiss button on the related admin notice.
*/
$( '#akismet-privacy-notice-admin-notice' ).on( 'click', '.notice-dismiss', function () {
$.ajax( {
url: './options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide',
} );
});
$( '.akismet-could-be-primary' ).each( function () {
var form = $( this ).closest( 'form' );
......
......@@ -6,7 +6,7 @@
Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
Version: 4.1.4
Version: 4.1.5
Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later
......@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
exit;
}
define( 'AKISMET_VERSION', '4.1.4' );
define( 'AKISMET_VERSION', '4.1.5' );
define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
......
This diff is collapsed.
......@@ -32,10 +32,6 @@ class Akismet_Admin {
if ( isset( $_POST['action'] ) && $_POST['action'] == 'enter-key' ) {
self::enter_api_key();
}
if ( ! empty( $_GET['akismet_comment_form_privacy_notice'] ) && empty( $_GET['settings-updated']) ) {
self::set_form_privacy_notice_option( $_GET['akismet_comment_form_privacy_notice'] );
}
}
public static function init_hooks() {
......@@ -70,11 +66,6 @@ class Akismet_Admin {
add_filter( 'all_plugins', array( 'Akismet_Admin', 'modify_plugin_description' ) );
if ( class_exists( 'Jetpack' ) ) {
add_filter( 'akismet_comment_form_privacy_notice_url_display', array( 'Akismet_Admin', 'jetpack_comment_form_privacy_notice_url' ) );
add_filter( 'akismet_comment_form_privacy_notice_url_hide', array( 'Akismet_Admin', 'jetpack_comment_form_privacy_notice_url' ) );
}
// priority=1 because we need ours to run before core's comment anonymizer runs, and that's registered at priority=10
add_filter( 'wp_privacy_personal_data_erasers', array( 'Akismet_Admin', 'register_personal_data_eraser' ), 1 );
}
......@@ -890,14 +881,6 @@ class Akismet_Admin {
) );
}
public static function display_privacy_notice_control_warning() {
if ( !current_user_can( 'manage_options' ) )
return;
Akismet::view( 'notice', array(
'type' => 'privacy',
) );
}
public static function display_spam_check_warning() {
Akismet::fix_scheduled_recheck();
......@@ -1031,10 +1014,6 @@ class Akismet_Admin {
$notices[] = array( 'type' => $akismet_user->status );
}
if ( false === get_option( 'akismet_comment_form_privacy_notice' ) ) {
$notices[] = array( 'type' => 'privacy' );
}
/*
// To see all variants when testing.
$notices[] = array( 'type' => 'active-notice', 'time_saved' => 'Cleaning up spam takes time. Akismet has saved you 1 minute!' );
......@@ -1105,14 +1084,6 @@ class Akismet_Admin {
else if ( isset( $_GET['akismet_recheck_error'] ) ) {
echo '<div class="notice notice-error"><p>' . esc_html( __( 'Akismet could not recheck your comments for spam.', 'akismet' ) ) . '</p></div>';
}
$akismet_comment_form_privacy_notice_option = get_option( 'akismet_comment_form_privacy_notice' );
if ( ! in_array( $akismet_comment_form_privacy_notice_option, array( 'hide', 'display' ) ) ) {
$api_key = Akismet::get_api_key();
if ( ! empty( $api_key ) ) {
self::display_privacy_notice_control_warning();
}
}
}
public static function display_status() {
......@@ -1227,10 +1198,6 @@ class Akismet_Admin {
update_option( 'akismet_comment_form_privacy_notice', $state );
}
}
public static function jetpack_comment_form_privacy_notice_url( $url ) {
return str_replace( 'options-general.php', 'admin.php', $url );
}
public static function register_personal_data_eraser( $erasers ) {
$erasers['akismet'] = array(
......
This diff is collapsed.
......@@ -138,10 +138,4 @@
</p>
<?php endif; ?>
</div>
<?php elseif ( $type == 'privacy' ) :?>
<div class="notice notice-warning is-dismissible" id="akismet-privacy-notice-admin-notice">
<p><strong><?php esc_html_e( 'Akismet & Privacy.', 'akismet' );?></strong></p>
<p><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on below.', 'akismet' ); ?></p>
<p><?php printf( __(' Please <a href="%s">enable</a> or <a href="%s">disable</a> this feature. <a href="%s" id="akismet-privacy-notice-control-notice-info-link" target="_blank">More information</a>.', 'akismet' ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_display', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=display' ) ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_hide', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide' ) ), 'https://akismet.com/privacy/' ); ?></p>
</div>
<?php endif;?>
\ No newline at end of file
......@@ -190,13 +190,16 @@ class PLL_Admin extends PLL_Admin_Base {
/**
* Load the post synchronization object, depending on the editor in use.
*
* We must make sure to instantiate the class only once, as the function may be called from a filter,
* and that the synchronization model has been instantiated (due to InfiniteWP messing the actions wp_loaded and admin_init).
*
* @since 2.6
*
* @param bool $is_block_editor Whether to use the block editor or not.
* @return bool
*/
public function _maybe_load_sync_post( $is_block_editor ) {
if ( ! isset( $this->sync_post ) ) { // Make sure to instantiate the class only once, as the function may be called from a filter.
if ( ! isset( $this->sync_post ) && isset( $this->sync_post_model ) ) {
if ( class_exists( 'PLL_Sync_Post_REST' ) && pll_use_block_editor_plugin() && $is_block_editor ) {
$this->sync_post = new PLL_Sync_Post_REST( $this );
} elseif ( class_exists( 'PLL_Sync_Post' ) ) {
......
......@@ -2,6 +2,117 @@
This file contains only old changelog. See readme.txt for newer versions.
= 2.6.10 (2020-02-19) =
* Pro: Fix sticky posts not filtered in REST API (introduced in 2.6.9)
* Fix wrong language detected if a child page uses the slug of another language
* Fix a PHP notice with PHP 7.4. #438
* Fix lang-item-first class in language switcher when the current language is hidden. #445
* Fix partially a conflict with Fusion Builder (the other part of the conflict being in Fusion Builder).
= 2.6.9 (2020-01-15) =
* Pro: Use 'parse_query' rather than 'rest_{$type}_query' to filter REST requests.
* Pro: Filter the comments REST endpoint.
* Pro: Fix duplication of terms without language.
* Pro: Fix fatal error when Admin Columns is activated and no language is defined yet.
* Fix shortlink when using one subdomain or domain per language
= 2.6.8 (2019-12-11) =
* Pro: Fix conflict with JetThemesCore from Crocoblock
* Fix: better detection of REST requests when using plain permalinks
* Fix usage of deprecated action wpmu_new_blog in WP 5.1+
* Fix PHP notices with PHP 7.4
= 2.6.7 (2019-11-14) =
* Require PHP 5.6
* Fix PHP warning in WP 5.3
= 2.6.6 (2019-11-12) =
* Pro: Fix wrong ajax url when using one domain per language
* Pro: Fix conflict with user switching plugin when using multiple domains
* Pro: Fix latest posts block in WP 5.3
* Fix database error when attempting to sync an untranslated page parent
* Fix a conflict with the theme Neptune by Osetin
= 2.6.5 (2019-10-09) =
* Pro: Require ACF 5.7.11+ to activate the compatibility to avoid fatal errors with older versions
* Pro: Avoid translating empty front slug (could cause a wrong redirect to /wp-admin)
* Pro: Fix filter wp_unique_term_slug not always correctly applied.
* Pro: Fix a conflict with Divi causing post synchronization buttons to be displayed multiple times
* Avoid notice in WP CLI context
= 2.6.4 (2019-08-27) =
* Pro: Fix a conflict preventing meta synchronization when ACF is active
* Pro: Fix post metas not correctly copied when translating a Beaver Builder page
* Pro: Fix a fatal error when posts made with Elementor are synchronized
* Pro: Fix Prewiew button not working correctly when using one domain per language
* Pro: Fix post synchronization not available for WP CRON and WP CLI
* Fix future posts not available in the autocomplete input field of the languages metabox
* Fix translations files not loaded on REST requests
* Fix deleted term parent not synchronized
= 2.6.3 (2019-08-06) =
* Pro: Fix fatal error when updating an ACF field from frontend
* Pro: Add action 'pll_post_synchronized'
* Allow to get the current or default language object using the API. Props Jory Hogeveen. #359
* Fix empty span in languages switcher widget when showing only flags
* Fix wpml_register_single_string when updating the original string
= 2.6.2 (2019-07-16) =
* Pro: Fix slow admin in case the translations update server can't be reached
* Pro: Fix value not correctly translated for ACF clone fields in repeater
* Fix strings translations mixed when registered via the WPML compatibility. #381
= 2.6.1 (2019-07-03) =
* Pro: Fix Yoast SEO sitemap for inactive languages when using subdomains or multiple domains
* Fix fatal error in combination with Yoast SEO and Social Warfare
* Fix post type archive url in Yoast SEO sitemap
= 2.6 (2019-06-26) =
* Pro: Remove all languages files. All translations are now maintained on TranslationsPress
* Pro: Move the languages metabox to a block editor plugin
* Pro: Better management of user capabilities when synchronizing posts
* Pro: Separate REST requests from the frontend
* Pro: Copy the post slug when duplicating a post
* Pro: Duplicate ACF term metas when terms are automatically duplicated when creating a new post translation
* Pro: Fix hierarchy lost when duplicating terms
* Pro: Fix page shared slugs with special characters
* Pro: Fix synchronized posts sharing their slug when the language is set from the content
* Pro: Fix PHP warning with ACF Pro 5.8.1
* Pro: Fix ACF clone fields not translated in repeaters
* Better management of user capablities when synchronizing taxonomies terms and custom fields
* Extend string translations search to translated strings #207
* Update plugin updater to 1.6.18
* Honor the filter `pll_flag` when performing the flag validation when creating a new language
* Modify the title and the label for the language switcher menu items #307
* Add support for international domain names
* Add a title to the link icon used to add a translation #325
* Add a notice when a static front page is not translated in a language
* Add support for custom term fields in wpml-config.xml
* Add filter `pll_admin_languages_filter` for the list of items the admin bar language filter
* Add compatibility with WP Offload Media Lite. Props Daniel Berkman
* Yoast SEO: Add post type archive url in all languages to the sitemap
* Fix www. not redirected to not www. for the home page in multiple domains #311
* Fix cropped images not being synchronized
* Fix auto added page to menus when the page is created with the block editor
* Fix embed of translated static front page #318
* Fix a possible infinite redirect if the static front page is not translated
* Fix incorrect behavior of action 'wpml_register_single_string' when updating the string source
* Fix fatal error with Jetpack when no languages has been defined yet #330
* Fix a conflict with Laravel Valet. Props @chesio. #250
* Fix a conflict with Thesis.
* Fix a conflict with Pods in the block editor. Props Jory Hogeveen. #369
* Fix fatal error with Twenty Fourteen introduced in version 2.5.4. #374
= 2.5.4 (2019-05-28) =
......
......@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* Modified version with 'polylang' text domain and comments for translators
*
* @author Easy Digital Downloads
* @version 1.6.18
* @version 1.7
*/
class PLL_Plugin_Updater {
......@@ -120,6 +120,7 @@ class PLL_Plugin_Updater {
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
$no_update = false;
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
$_transient_data->response[ $this->name ] = $version_info;
......@@ -127,11 +128,25 @@ class PLL_Plugin_Updater {
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
$_transient_data->response[ $this->name ]->plugin = $this->name;
} else {
$no_update = new stdClass();
$no_update->id = '';
$no_update->slug = $this->slug;
$no_update->plugin = $this->name;
$no_update->new_version = $version_info->new_version;
$no_update->url = $version_info->homepage;
$no_update->package = isset( $version_info->package ) ? $version_info->package : ''; #modified#
$no_update->icons = $version_info->icons;
$no_update->banners = $version_info->banners;
$no_update->banners_rtl = array();
}
$_transient_data->last_checked = time();
$_transient_data->checked[ $this->name ] = $this->version;
if ( $no_update ) {
$_transient_data->no_update[ $this->name ] = $no_update;
}
}
return $_transient_data;
......@@ -188,6 +203,14 @@ class PLL_Plugin_Updater {
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
}
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
}
if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
$version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
}
$this->set_version_info_cache( $version_info );
}
......@@ -195,14 +218,29 @@ class PLL_Plugin_Updater {
return;
}
$no_update = false;
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
$update_cache->response[ $this->name ] = $version_info;
} else {
$no_update = new stdClass();
$no_update->id = '';
$no_update->slug = $this->slug;
$no_update->plugin = $this->name;
$no_update->new_version = $version_info->new_version;
$no_update->url = $version_info->homepage;
$no_update->package = isset( $version_info->package ) ? $version_info->package : ''; #modified#
$no_update->icons = $version_info->icons;
$no_update->banners = $version_info->banners;
$no_update->banners_rtl = array();
}
$update_cache->last_checked = time();
$update_cache->last_checked = time();
$update_cache->checked[ $this->name ] = $this->version;
if ( $no_update ) {
$update_cache->no_update[ $this->name ] = $no_update;
}
set_site_transient( 'update_plugins', $update_cache );
......@@ -324,6 +362,11 @@ class PLL_Plugin_Updater {
$_data->icons = $this->convert_object_to_array( $_data->icons );
}
// Convert contributors into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
}
if( ! isset( $_data->plugin ) ) {
$_data->plugin = $this->name;
}
......@@ -346,7 +389,7 @@ class PLL_Plugin_Updater {
private function convert_object_to_array( $data ) {
$new_data = array();
foreach ( $data as $key => $value ) {
$new_data[ $key ] = $value;
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
}
return $new_data;
......
......@@ -11,7 +11,7 @@ body {
margin: 0 0 24px;
padding: 0;
text-align: center;
font-family: Verdana;
font-family: sans-serif;
font-size: 64px;
text-transform: uppercase;
color: #000;
......
<?php
/**
Plugin Name: Polylang
Plugin URI: https://polylang.pro
Version: 2.7.1
Author: WP SYNTEX
Author uri: https://polylang.pro
Description: Adds multilingual capability to WordPress
Text Domain: polylang
Domain Path: /languages
* Plugin Name: Polylang
* Plugin URI: https://polylang.pro
* Description: Adds multilingual capability to WordPress
* Version: 2.7.2
* Requires at least: 4.9
* Requires PHP: 5.6
* Author: WP SYNTEX
* Author uri: https://polylang.pro
* License: GPL v3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: polylang
* Domain Path: /languages
*/
/*
......@@ -51,7 +55,7 @@ if ( defined( 'POLYLANG_BASENAME' ) ) {
}
} else {
// Go on loading the plugin
define( 'POLYLANG_VERSION', '2.7.1' );
define( 'POLYLANG_VERSION', '2.7.2' );
define( 'PLL_MIN_WP_VERSION', '4.9' );
define( 'PLL_MIN_PHP_VERSION', '5.6' );
......
......@@ -5,7 +5,7 @@ Tags: multilingual, bilingual, translate, translation, language, multilanguage,
Requires at least: 4.9
Tested up to: 5.4
Requires PHP: 5.6
Stable tag: 2.7.1
Stable tag: 2.7.2
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
......@@ -78,6 +78,15 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
== Changelog ==
= 2.7.2 (2020-04-27) =
* Pro: Re-allow to modify the capability for strings translations
* Pro: Fix redirect for posts having the same slug as a media
* Pro: Fix PHP notice with ACF flexible content
* Pro: Fix a fatal error with InfiniteWP
* Update plugin updater to 1.7
* Fix font in setup wizard
= 2.7.1 (2020-04-09) =
* Pro: Fix untranslated post types filtered by the parameter in the REST API #493
......@@ -114,116 +123,4 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
* Fix wildcards not correctly interpreted in wpml-config.xml
* Fix product categories with special characters duplicated when importing WooCommerce products #474
= 2.6.10 (2020-02-19) =
* Pro: Fix sticky posts not filtered in REST API (introduced in 2.6.9)
* Fix wrong language detected if a child page uses the slug of another language
* Fix a PHP notice with PHP 7.4. #438
* Fix lang-item-first class in language switcher when the current language is hidden. #445
* Fix partially a conflict with Fusion Builder (the other part of the conflict being in Fusion Builder).
= 2.6.9 (2020-01-15) =
* Pro: Use 'parse_query' rather than 'rest_{$type}_query' to filter REST requests.
* Pro: Filter the comments REST endpoint.
* Pro: Fix duplication of terms without language.
* Pro: Fix fatal error when Admin Columns is activated and no language is defined yet.
* Fix shortlink when using one subdomain or domain per language
= 2.6.8 (2019-12-11) =
* Pro: Fix conflict with JetThemesCore from Crocoblock
* Fix: better detection of REST requests when using plain permalinks
* Fix usage of deprecated action wpmu_new_blog in WP 5.1+
* Fix PHP notices with PHP 7.4
= 2.6.7 (2019-11-14) =
* Require PHP 5.6
* Fix PHP warning in WP 5.3
= 2.6.6 (2019-11-12) =
* Pro: Fix wrong ajax url when using one domain per language
* Pro: Fix conflict with user switching plugin when using multiple domains
* Pro: Fix latest posts block in WP 5.3
* Fix database error when attempting to sync an untranslated page parent
* Fix a conflict with the theme Neptune by Osetin
= 2.6.5 (2019-10-09) =
* Pro: Require ACF 5.7.11+ to activate the compatibility to avoid fatal errors with older versions
* Pro: Avoid translating empty front slug (could cause a wrong redirect to /wp-admin)
* Pro: Fix filter wp_unique_term_slug not always correctly applied.
* Pro: Fix a conflict with Divi causing post synchronization buttons to be displayed multiple times
* Avoid notice in WP CLI context
= 2.6.4 (2019-08-27) =
* Pro: Fix a conflict preventing meta synchronization when ACF is active
* Pro: Fix post metas not correctly copied when translating a Beaver Builder page
* Pro: Fix a fatal error when posts made with Elementor are synchronized
* Pro: Fix Prewiew button not working correctly when using one domain per language
* Pro: Fix post synchronization not available for WP CRON and WP CLI
* Fix future posts not available in the autocomplete input field of the languages metabox
* Fix translations files not loaded on REST requests
* Fix deleted term parent not synchronized
= 2.6.3 (2019-08-06) =
* Pro: Fix fatal error when updating an ACF field from frontend
* Pro: Add action 'pll_post_synchronized'
* Allow to get the current or default language object using the API. Props Jory Hogeveen. #359
* Fix empty span in languages switcher widget when showing only flags
* Fix wpml_register_single_string when updating the original string
= 2.6.2 (2019-07-16) =
* Pro: Fix slow admin in case the translations update server can't be reached
* Pro: Fix value not correctly translated for ACF clone fields in repeater
* Fix strings translations mixed when registered via the WPML compatibility. #381
= 2.6.1 (2019-07-03) =
* Pro: Fix Yoast SEO sitemap for inactive languages when using subdomains or multiple domains
* Fix fatal error in combination with Yoast SEO and Social Warfare
* Fix post type archive url in Yoast SEO sitemap
= 2.6 (2019-06-26) =
* Pro: Remove all languages files. All translations are now maintained on TranslationsPress
* Pro: Move the languages metabox to a block editor plugin
* Pro: Better management of user capabilities when synchronizing posts
* Pro: Separate REST requests from the frontend
* Pro: Copy the post slug when duplicating a post
* Pro: Duplicate ACF term metas when terms are automatically duplicated when creating a new post translation
* Pro: Fix hierarchy lost when duplicating terms
* Pro: Fix page shared slugs with special characters
* Pro: Fix synchronized posts sharing their slug when the language is set from the content
* Pro: Fix PHP warning with ACF Pro 5.8.1
* Pro: Fix ACF clone fields not translated in repeaters
* Better management of user capablities when synchronizing taxonomies terms and custom fields
* Extend string translations search to translated strings #207
* Update plugin updater to 1.6.18
* Honor the filter `pll_flag` when performing the flag validation when creating a new language
* Modify the title and the label for the language switcher menu items #307
* Add support for international domain names
* Add a title to the link icon used to add a translation #325
* Add a notice when a static front page is not translated in a language
* Add support for custom term fields in wpml-config.xml
* Add filter `pll_admin_languages_filter` for the list of items the admin bar language filter
* Add compatibility with WP Offload Media Lite. Props Daniel Berkman
* Yoast SEO: Add post type archive url in all languages to the sitemap
* Fix www. not redirected to not www. for the home page in multiple domains #311
* Fix cropped images not being synchronized
* Fix auto added page to menus when the page is created with the block editor
* Fix embed of translated static front page #318
* Fix a possible infinite redirect if the static front page is not translated
* Fix incorrect behavior of action 'wpml_register_single_string' when updating the string source
* Fix fatal error with Jetpack when no languages has been defined yet #330
* Fix a conflict with Laravel Valet. Props @chesio. #250
* Fix a conflict with Thesis.
* Fix a conflict with Pods in the block editor. Props Jory Hogeveen. #369
* Fix fatal error with Twenty Fourteen introduced in version 2.5.4. #374
See [changelog.txt](https://plugins.svn.wordpress.org/polylang/trunk/changelog.txt) for older changelog
......@@ -267,12 +267,13 @@ class WPSEO_Admin_Asset_Manager {
],
],
[
'name' => 'admin-global-script',
'src' => 'wp-seo-admin-global-' . $flat_version,
'deps' => [
'name' => 'admin-global-script',
'src' => 'wp-seo-admin-global-' . $flat_version,
'deps' => [
'jquery',
self::PREFIX . 'commons',
],
'in_footer' => false,
],
[
'name' => 'metabox',
......@@ -436,6 +437,17 @@ class WPSEO_Admin_Asset_Manager {
self::PREFIX . 'commons',
],
],
[
'name' => 'indexation',
'src' => 'wp-seo-indexation-' . $flat_version,
'deps' => [
'jquery',
'jquery-ui-core',
'jquery-ui-progressbar',
self::PREFIX . 'admin-global-script',
self::PREFIX . 'commons',
],
],
[
'name' => 'edit-page-script',
'src' => 'wp-seo-edit-page-' . $flat_version,
......@@ -631,6 +643,14 @@ class WPSEO_Admin_Asset_Manager {
'name' => 'search-appearance',
'src' => 'search-appearance-' . $flat_version,
],
/*
* Temporarily commented out to prevent unwanted monorepo styles seeping through.
* [
* 'name' => 'monorepo',
* 'src' => 'monorepo-' . $flat_version,
* ],
*/
[
'name' => 'structured-data-blocks',
'src' => 'structured-data-blocks-' . $flat_version,
......
......@@ -25,11 +25,11 @@ class WPSEO_Admin_Editor_Specific_Replace_Vars {
'custom-post-type_archive' => [ 'pt_single', 'pt_plural' ],
// Taxonomies.
'category' => [ 'term_title', 'term_description', 'category_description', 'parent_title' ],
'category' => [ 'term_title', 'term_description', 'category_description', 'parent_title', 'term_hierarchy' ],
'post_tag' => [ 'term_title', 'term_description', 'tag_description' ],
'post_format' => [],
// Custom taxonomy.
'term-in-custom-taxonomy' => [ 'term_title', 'term_description', 'category_description', 'parent_title' ],
'term-in-custom-taxonomy' => [ 'term_title', 'term_description', 'category_description', 'parent_title', 'term_hierarchy' ],
// Settings - special pages.
'search' => [ 'searchphrase' ],
......@@ -45,7 +45,7 @@ class WPSEO_Admin_Editor_Specific_Replace_Vars {
);
$this->add_for_page_types(
[ 'post', 'term-in-custom-taxonomies' ],
[ 'post', 'term-in-custom-taxonomy' ],
WPSEO_Custom_Taxonomies::get_custom_taxonomies()
);
}
......
......@@ -440,6 +440,26 @@ class WPSEO_Admin_Init {
'version' => '9.4',
'alternative' => null,
],
'wpseo_opengraph' => [
'version' => '14.0',
'alternative' => null,
],
'wpseo_twitter' => [
'version' => '14.0',
'alternative' => null,
],
'wpseo_twitter_taxonomy_image' => [
'version' => '14.0',
'alternative' => null,
],
'wpseo_twitter_metatag_key' => [
'version' => '14.0',
'alternative' => null,
],
'wp_seo_get_bc_ancestors' => [
'version' => '14.0',
'alternative' => 'wpseo_breadcrumb_links',
],
];
// Determine which filters have been registered.
......
......@@ -25,12 +25,12 @@ class WPSEO_Admin_Recommended_Replace_Vars {
'custom_post_type' => [ 'sitename', 'title', 'sep' ],
// Taxonomies.
'category' => [ 'sitename', 'term_title', 'sep' ],
'category' => [ 'sitename', 'term_title', 'sep', 'term_hierarchy' ],
'post_tag' => [ 'sitename', 'term_title', 'sep' ],
'post_format' => [ 'sitename', 'term_title', 'sep', 'page' ],
// Custom taxonomy.
'term-in-custom-taxomomy' => [ 'sitename', 'term_title', 'sep' ],
'term-in-custom-taxomomy' => [ 'sitename', 'term_title', 'sep', 'term_hierarchy' ],
// Settings - archive pages.
'author_archive' => [ 'sitename', 'title', 'sep', 'page' ],
......
......@@ -308,6 +308,7 @@ class WPSEO_Admin {
*/
private function localize_admin_global_script() {
return [
'isRtl' => is_rtl(),
'variable_warning' => sprintf(
/* translators: %1$s: '%%term_title%%' variable used in titles and meta's template that's not compatible with the given template, %2$s: expands to 'HelpScout beacon' */
__( 'Warning: the variable %1$s cannot be used in this template. See the %2$s for more info.', 'wordpress-seo' ),
......
......@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
*
* @var string
*/
const CURRENT_RELEASE = '7.8.0';
const CURRENT_RELEASE = '7.9.1';
/**
* The minimally supported version of Gutenberg by the plugin.
*
* @var string
*/
const MINIMUM_SUPPORTED = '7.8.0';
const MINIMUM_SUPPORTED = '7.9.1';
/**
* Holds the current version.
......
......@@ -21,9 +21,6 @@ class WPSEO_Primary_Term_Admin implements WPSEO_WordPress_Integration {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
add_action( 'save_post', [ $this, 'save_primary_terms' ] );
$primary_term = new WPSEO_Frontend_Primary_Category();
$primary_term->register_hooks();
}
/**
......
......@@ -44,7 +44,11 @@ class WPSEO_Link_Watcher {
*
* @return void
*/
public function save_post( $post_id, WP_Post $post ) {
public function save_post( $post_id, $post ) {
if ( ! $post instanceof WP_Post ) {
return;
}
// Bail if this is a multisite installation and the site has been switched.
if ( is_multisite() && ms_is_switched() ) {
return;
......
......@@ -834,6 +834,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
$asset_manager->enqueue_style( 'metabox-css' );
$asset_manager->enqueue_style( 'scoring' );
$asset_manager->enqueue_style( 'select2' );
$asset_manager->enqueue_style( 'monorepo' );
$asset_manager->enqueue_script( 'metabox' );
$asset_manager->enqueue_script( 'admin-media' );
......
......@@ -125,6 +125,7 @@ class WPSEO_Taxonomy {
$asset_manager = new WPSEO_Admin_Asset_Manager();
$asset_manager->enqueue_style( 'scoring' );
$asset_manager->enqueue_style( 'monorepo' );
$tag_id = filter_input( INPUT_GET, 'tag_ID' );
if (
......@@ -377,6 +378,7 @@ class WPSEO_Taxonomy {
'page',
'term_title',
'term_description',
'term_hierarchy',
'category_description',
'tag_description',
'searchphrase',
......@@ -434,9 +436,8 @@ class WPSEO_Taxonomy {
* @return string Content with shortcodes filtered out.
*/
public function custom_category_descriptions_add_shortcode_support( $desc ) {
_deprecated_function( __FUNCTION__, 'WPSEO 7.9.0', 'WPSEO_Frontend::custom_category_descriptions_add_shortcode_support' );
_deprecated_function( __FUNCTION__, 'WPSEO 7.9.0' );
$frontend = WPSEO_Frontend::get_instance();
return $frontend->custom_category_descriptions_add_shortcode_support( $desc );
return '';
}
}
......@@ -80,7 +80,6 @@ class WPSEO_Tracking_Settings_Data implements WPSEO_Collection {
'company_name',
'company_or_person',
'person_name',
'title_test',
'forcerewritetitle',
'separator',
'title-home-wpseo',
......
......@@ -105,9 +105,16 @@ class WPSEO_Tracking implements WPSEO_WordPress_Integration {
return;
}
// Set a 'content-type' header of 'application/json'.
$tracking_request_args = [
'headers' => [
'content-type:' => 'application/json',
],
];
$collector = $this->get_collector();
$request = new WPSEO_Remote_Request( $this->endpoint );
$request = new WPSEO_Remote_Request( $this->endpoint, $tracking_request_args );
$request->set_body( $collector->get_as_json() );
$request->send();
......
......@@ -143,6 +143,16 @@ class Yoast_Feature_Toggles {
),
'order' => 90,
],
(object) [
'name' => __( 'REST API: Head endpoint', 'wordpress-seo' ),
'setting' => 'enable_headless_rest_endpoints',
'label' => sprintf(
/* translators: 1: Yoast SEO */
__( 'This %1$s REST API endpoint gives you all the metadata you need for a specific URL. This will make it very easy for headless WordPress sites to use %1$s for all their SEO meta output.', 'wordpress-seo' ),
'Yoast SEO'
),
'order' => 100,
],
];
/**
......
......@@ -30,6 +30,10 @@ class Container_Compiler {
$cache = new ConfigCache( $file, $debug );
if ( ! $cache->isFresh() ) {
if ( ! defined( 'WPSEO_VERSION' ) ) {
define( 'WPSEO_VERSION', 'COMPILING' );
}
$container_builder = new ContainerBuilder();
$container_builder->addCompilerPass( new Loader_Pass() );
$loader = new Custom_Loader( $container_builder );
......
......@@ -105,31 +105,6 @@ class Custom_Loader extends PhpFileLoader {
}
}
/**
* Registers a definition in the container with its instanceof-conditionals.
*
* @param string $id The ID of the definition.
* @param \Symfony\Component\DependencyInjection\Definition $definition The definition.
*
* @throws InvalidArgumentException If invalid arguments were supplied.
*
* @return void
*/
protected function setDefinition( $id, Definition $definition ) {
$this->container->removeBindings( $id );
// @codingStandardsIgnoreLine WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar This is from an inherited class not abiding by that standard.
if ( $this->isLoadingInstanceof ) {
if ( ! $definition instanceof ChildDefinition ) {
throw new InvalidArgumentException( \sprintf( 'Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, \get_class( $definition ) ) );
}
$this->instanceof[ $id ] = $definition;
}
else {
$this->container->setDefinition( $id, ( $definition instanceof ChildDefinition ) ? $definition : $definition->setInstanceofConditionals( $this->instanceof ) );
}
}
/**
* Finds classes based on a given pattern and exclude pattern.
*
......
......@@ -10,11 +10,11 @@ namespace Yoast\WP\SEO\Dependency_Injection;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Yoast\WP\SEO\Conditionals\Conditional;
use Yoast\WP\SEO\Commands\Command_Interface;
use Yoast\WP\SEO\Initializers\Initializer_Interface;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Loader;
use Yoast\WP\SEO\WordPress\Initializer;
use Yoast\WP\SEO\WordPress\Integration;
use Yoast\WP\SEO\Routes\Route_Interface;
/**
* A pass is a step in the compilation process of the container.
......@@ -36,9 +36,6 @@ class Loader_Pass implements CompilerPassInterface {
}
$loader_definition = $container->getDefinition( Loader::class );
$loader_definition->setArgument( 0, new Reference( 'service_container' ) );
$loader_definition->setPublic( true );
$definitions = $container->getDefinitions();
foreach ( $definitions as $definition ) {
......@@ -55,18 +52,20 @@ class Loader_Pass implements CompilerPassInterface {
private function process_definition( Definition $definition, Definition $loader_definition ) {
$class = $definition->getClass();
if ( \is_subclass_of( $class, Initializer::class ) ) {
if ( \is_subclass_of( $class, Initializer_Interface::class ) ) {
$loader_definition->addMethodCall( 'register_initializer', [ $class ] );
$definition->setPublic( true );
}
if ( \is_subclass_of( $class, Integration::class ) ) {
if ( \is_subclass_of( $class, Integration_Interface::class ) ) {
$loader_definition->addMethodCall( 'register_integration', [ $class ] );
$definition->setPublic( true );
}
if ( \is_subclass_of( $class, Conditional::class ) ) {
$definition->setPublic( true );
if ( \is_subclass_of( $class, Route_Interface::class ) ) {
$loader_definition->addMethodCall( 'register_route', [ $class ] );
}
if ( \is_subclass_of( $class, Command_Interface::class ) ) {
$loader_definition->addMethodCall( 'register_command', [ $class ] );
}
}
}
......@@ -8,23 +8,28 @@
namespace Yoast\WP\SEO\Dependency_Injection;
use Symfony\Component\DependencyInjection\Definition;
use Yoast\WP\SEO\Repositories\Indexable_Repository;
use Yoast\WP\SEO\Repositories\Primary_Term_Repository;
use Yoast\WP\SEO\Repositories\SEO_Links_Repository;
use Yoast\WP\SEO\Repositories\SEO_Meta_Repository;
use WPSEO_Admin_Asset_Manager;
use WPSEO_Breadcrumbs;
use WPSEO_Frontend;
use WPSEO_Replace_Vars;
use Yoast\WP\SEO\WordPress\Wrapper;
use YoastSEO_Vendor\Symfony\Component\DependencyInjection\ContainerInterface;
/* @var $container \Symfony\Component\DependencyInjection\ContainerBuilder */
// WordPress factory functions.
$container->register( 'wpdb', 'wpdb' )->setFactory( [ Wrapper::class, 'get_wpdb' ] );
$container->register( 'wp_query', 'WP_Query' )->setFactory( [ Wrapper::class, 'get_wp_query' ] );
// Model repository factory functions.
$container->register( Indexable_Repository::class, Indexable_Repository::class )->setFactory( [ Indexable_Repository::class, 'get_instance' ] )->setAutowired( true );
$container->register( Primary_Term_Repository::class, Primary_Term_Repository::class )->setFactory( [ Primary_Term_Repository::class, 'get_instance' ] )->setAutowired( true );
$container->register( SEO_Meta_Repository::class, SEO_Meta_Repository::class )->setFactory( [ SEO_Meta_Repository::class, 'get_instance' ] )->setAutowired( true );
$container->register( SEO_Links_Repository::class, SEO_Links_Repository::class )->setFactory( [ SEO_Links_Repository::class, 'get_instance' ] )->setAutowired( true );
// Legacy classes.
$container->register( WPSEO_Replace_Vars::class, WPSEO_Replace_Vars::class )->setFactory( [ Wrapper::class, 'get_replace_vars' ] )->setPublic( true );
$container->register( WPSEO_Admin_Asset_Manager::class, WPSEO_Admin_Asset_Manager::class )->setFactory( [ Wrapper::class, 'get_admin_asset_manager' ] )->setPublic( true );
// Backwards-compatibility classes in the global namespace.
$container->register( WPSEO_Breadcrumbs::class, WPSEO_Breadcrumbs::class )->setAutowired( true )->setPublic( true );
$container->register( WPSEO_Frontend::class, WPSEO_Frontend::class )->setAutowired( true )->setPublic( true );
// The container itself.
$container->setAlias( ContainerInterface::class, 'service_container' );
$excluded_files = [
'main.php',
......@@ -36,6 +41,10 @@ $excluded_directories = [
'wordpress',
'generated',
'orm',
'backwards-compatibility',
'surfaces/values',
'presenters',
'config/migrations',
];
$excluded = \implode( ',', \array_merge( $excluded_directories, $excluded_files ) );
......@@ -45,7 +54,7 @@ $base_definition = new Definition();
$base_definition
->setAutowired( true )
->setAutoconfigured( true )
->setPublic( false );
->setPublic( true );
/* @var $loader \Yoast\WP\SEO\Dependency_Injection\Custom_Loader */
$loader->registerClasses( $base_definition, 'Yoast\\WP\\SEO\\', 'src/*', 'src/{' . $excluded . '}' );
......
<?php
declare(strict_types = 1);
use Isolated\Symfony\Component\Finder\Finder;
return array(
/*
* By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
* directory. You can however define which files should be scoped by defining a collection of Finders in the
* following configuration key.
*
* For more see: https://github.com/humbug/php-scoper#finders-and-paths
*/
'finders' => array(
Finder::create()->files()->in( 'vendor/j4mie/idiorm' )->name( [ 'idiorm.php', 'LICENSE', 'composer.json' ] ),
),
/*
* When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the
* original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited
* support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your
* heart contents.
*
* For more see: https://github.com/humbug/php-scoper#patchers
*/
'patchers' => array(),
/*
* By default, PHP-Scoper will not prefix the user defined constants, classes and functions belonging to the global
* namespace. You can however change that setting for them to be prefixed as usual unless explicitly whitelisted.
*
* https://github.com/humbug/php-scoper#whitelist
*/
'whitelist-global-classes' => false,
);
This diff is collapsed.
<?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();
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend
*/
/**
* Class WPSEO_Handle_404
*
* Handles intercepting requests.
*
* @deprecated 14.0
*
* @since 9.4
*/
class WPSEO_Handle_404 implements WPSEO_WordPress_Integration {
/**
* Registers all hooks to WordPress.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return void
*/
public function register_hooks() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Handle the 404 status code.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param bool $handled Whether we've handled the request.
*
* @return bool True if it's 404.
*/
public function handle_404( $handled ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return $handled;
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend
*/
use Yoast\WP\SEO\Values\Open_Graph\Images;
_deprecated_file( basename( __FILE__ ), 'WPSEO 14.0' );
/**
* Class WPSEO_OpenGraph_Image.
*
* @deprecated 14.0
*/
class WPSEO_OpenGraph_Image extends Images {
/**
* The image ID used when the image is external.
*
* @var string
*/
const EXTERNAL_IMAGE_ID = '-1';
/**
* Constructor.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @param null|string $image Optional. The Image to use.
* @param WPSEO_OpenGraph $opengraph Optional. The OpenGraph object.
*/
public function __construct( $image = null, WPSEO_OpenGraph $opengraph = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
}
......@@ -7,17 +7,19 @@
/**
* Class WPSEO_OpenGraph_OEmbed.
*
* @deprecated 14.0
*/
class WPSEO_OpenGraph_OEmbed implements WPSEO_WordPress_Integration {
/**
* Registers the hooks.
* @inheritDoc
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function register_hooks() {
// Check to make sure opengraph is enabled before adding filter.
if ( WPSEO_Options::get( 'opengraph' ) ) {
add_filter( 'oembed_response_data', [ $this, 'set_oembed_data' ], 10, 2 );
}
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
......@@ -26,47 +28,19 @@ class WPSEO_OpenGraph_OEmbed implements WPSEO_WordPress_Integration {
* address the concern where some social channels/subscribed use oEmebed data over OpenGraph data
* if both are present.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $data The oEmbed data.
* @param WP_Post $post The current Post object.
*
* @link https://developer.wordpress.org/reference/hooks/oembed_response_data/ for hook info.
*
* @return array $filter_data - An array of oEmbed data with modified values where appropriate.
* @return array An array of oEmbed data with modified values where appropriate.
*/
public function set_oembed_data( $data, $post ) {
// Data to be returned.
$filter_data = $data;
// Look for the Yoast meta values (image and title)...
$opengraph_title = WPSEO_Meta::get_value( 'opengraph-title', $post->ID );
$opengraph_image = WPSEO_Meta::get_value( 'opengraph-image', $post->ID );
// If yoast has a title set, update oEmbed with Yoast's title.
if ( ! empty( $opengraph_title ) ) {
$filter_data['title'] = $opengraph_title;
}
// If WPSEO Image was _not_ set, return the `$filter_data` as it currently is.
if ( empty( $opengraph_image ) ) {
return $filter_data;
}
// Since the a WPSEO Image was set, update the oEmbed data with the Yoast Image's info.
// Get the image's ID from a URL.
$image_id = WPSEO_Image_Utils::get_attachment_by_url( $opengraph_image );
// Get the image's info from it's ID.
$image_info = wp_get_attachment_metadata( $image_id );
// Update the oEmbed data.
$filter_data['thumbnail_url'] = $opengraph_image;
if ( ! empty( $image_info['height'] ) ) {
$filter_data['thumbnail_height'] = $image_info['height'];
}
if ( ! empty( $image_info['width'] ) ) {
$filter_data['thumbnail_width'] = $image_info['width'];
}
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return $filter_data;
return $data;
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend
*/
/**
* This code adds the OpenGraph output.
*
* @deprecated 14.0
*/
class WPSEO_OpenGraph {
/* ********************* DEPRECATED METHODS ********************* */
/**
* Class constructor.
*
* @deprecated 14.0
* @codeCoverageIgnore
*/
public function __construct() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Main OpenGraph output.
*
* @deprecated 14.0
* @codeCoverageIgnore
*/
public function opengraph() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Internal function to output FB tags. This also adds an output filter to each bit of output based on the property.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @param string $property Property attribute value.
* @param string $content Content attribute value.
*
* @return boolean
*/
public function og_tag( $property, $content ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
/**
* Filter: 'wpseo_og_' . $og_property - Allow developers to change the content of specific OG meta tags.
*
* @deprecated 14.0
*
* @api string $content The content of the property.
*/
$content = apply_filters_deprecated( 'wpseo_og_' . $og_property, $content, 'WPSEO 14.0');
return true;
}
/**
* Outputs the site owner.
*
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @return void
*
* @deprecated 7.1
* @codeCoverageIgnore
*/
public function site_owner() {
// As this is a frontend method, we want to make sure it is not displayed for non-logged in users.
if ( function_exists( 'wp_get_current_user' ) && current_user_can( 'manage_options' ) ) {
_deprecated_function( __METHOD__, '7.1', null );
}
}
/**
* Fallback method for plugins using image_output.
*
* @param string|bool $image Image URL.
*
* @deprecated 7.4
* @codeCoverageIgnore
*/
public function image_output( $image = false ) {
_deprecated_function( __METHOD__, '7.4', 'WPSEO_OpenGraph::image' );
}
/**
* Outputs the canonical URL as OpenGraph URL, which consolidates likes and shares.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @return boolean
*/
public function url() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return false;
}
/**
* Outputs the SEO title as OpenGraph title.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @param bool $echo Whether or not to echo the output.
*
* @return string|boolean
*/
public function og_title( $echo = true ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return false;
}
/**
* Outputs the OpenGraph description, specific OG description first, if not, grabs the meta description.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @param bool $echo Whether to echo or return the description.
*
* @return string $ogdesc
*/
public function description( $echo = true ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return '';
}
/**
* Outputs the author's FB page.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @link https://developers.facebook.com/blog/post/2013/06/19/platform-updates--new-open-graph-tags-for-media-publishers-and-more/
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @return boolean
*/
public function article_author_facebook() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return false;
}
/**
* Outputs the website's FB page.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @link https://developers.facebook.com/blog/post/2013/06/19/platform-updates--new-open-graph-tags-for-media-publishers-and-more/
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @return boolean
*/
public function website_facebook() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return false;
}
/**
* Outputs the OpenGraph type.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @param boolean $echo Whether to echo or return the type.
*
* @return string $type
*/
public function type( $echo = true ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return '';
}
/**
* Outputs the locale, doing some conversions to make sure the proper Facebook locale is output.
*
* Last update/compare with FB list done on 2015-03-16 by Rarst.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @link http://www.facebook.com/translations/FacebookLocales.xml for the list of supported locales.
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @param bool $echo Whether to echo or return the locale.
*
* @return string $locale
*/
public function locale( $echo = true ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return '';
}
/**
* Filters the Facebook plugins metadata.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @param array $meta_tags The array to fix.
*
* @return array $meta_tags
*/
public function facebook_filter( $meta_tags ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return array();
}
/**
* Outputs the site name straight from the blog info.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @return void
*/
public function site_name() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Outputs the article publish and last modification date.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @return boolean;
*/
public function publish_date() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return true;
}
/**
* Creates new WPSEO_OpenGraph_Image class and get the images to set the og:image.
*
* @deprecated 14.0
* @codeCoverageIgnore
* @param string|bool $image Optional. Image URL.
*
* @return void
*/
public function image( $image = false ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Outputs the Facebook app_id.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @return void
*/
public function app_id() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Outputs the article tags as article:tag tags.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @return boolean
*/
public function tags() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return false;
}
/**
* Outputs the article category as an article:section tag.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/article/
*
* @return boolean;
*/
public function category() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return false;
}
} /* End of class */
......@@ -7,6 +7,8 @@
/**
* Adds customizations to the front end for the primary category.
*
* @deprecated 14.0
*/
class WPSEO_Frontend_Primary_Category implements WPSEO_WordPress_Integration {
......@@ -14,7 +16,7 @@ class WPSEO_Frontend_Primary_Category implements WPSEO_WordPress_Integration {
* Registers the hooks necessary for correct primary category behaviour.
*/
public function register_hooks() {
add_filter( 'post_link_category', [ $this, 'post_link_category' ], 10, 3 );
add_filter( 'post_link_category', array( $this, 'post_link_category' ), 10, 3 );
}
/**
......@@ -24,47 +26,13 @@ class WPSEO_Frontend_Primary_Category implements WPSEO_WordPress_Integration {
* @param array $categories This parameter is not used.
* @param WP_Post $post The post in question.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return array|null|object|WP_Error The category we want to use for the post link.
*/
public function post_link_category( $category, $categories = null, $post = null ) {
$post = get_post( $post );
$primary_category = $this->get_primary_category( $post );
if ( false !== $primary_category && $primary_category !== $category->cat_ID ) {
$category = $this->get_category( $primary_category );
}
return $category;
}
/**
* Get the id of the primary category.
*
* @param WP_Post $post The post in question.
*
* @return int Primary category id.
*/
protected function get_primary_category( $post = null ) {
$post = get_post( $post );
if ( $post === null ) {
return false;
}
$primary_term = new WPSEO_Primary_Term( 'category', $post->ID );
return $primary_term->get_primary_term();
}
/**
* Wrapper for get category to make mocking easier.
*
* @param int $primary_category ID of primary category.
*
* @return array|null|object|WP_Error
*/
protected function get_category( $primary_category ) {
$category = get_category( $primary_category );
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return $category;
}
......
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend
*/
/**
* This class handles the Twitter card functionality.
*
* @deprecated 14.0
*
* @link https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards
*/
class WPSEO_Twitter {
/**
* Instance of this class.
*
* @var object
*/
public static $instance;
/**
* Images.
*
* @var array
*/
public $shown_images = array();
/**
* Class constructor.
*
* @deprecated 14.0
* @codeCoverageIgnore
*/
public function __construct() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Outputs the Twitter Card code on singular pages.
*
* @deprecated 14.0
* @codeCoverageIgnore
*/
public function twitter() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Get the singleton instance of this class.
*
* @deprecated 14.0
* @codeCoverageIgnore
*
* @return object
*/
public static function get_instance() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return null;
}
} /* End of class */
<?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.
*/
public function __call( $method, $arguments ) {
_deprecated_function( $method, 'WPSEO 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__, 'WPSEO 14.0' );
$presentation = $this->get_current_page_presentation();
if ( ! $echo ) {
return $presentation->canonical;
}
$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;
echo $presenter->present();
}
/**
* Retrieves the meta robots value.
*
* @return string
*/
public function get_robots() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
$presentation = $this->get_current_page_presentation();
return $presentation->robots;
}
/**
* Outputs the meta robots value.
*/
public function robots() {
_deprecated_function( __METHOD__, 'WPSEO 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__, 'WPSEO 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__, 'WPSEO 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__, 'WPSEO 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__, 'WPSEO 14.0' );
if ( 'right' === $seplocation ) {
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__, 'WPSEO 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__, 'WPSEO 14.0' );
$presentation = $this->get_current_page_presentation();
if ( ! $echo ) {
return $presentation->meta_description;
}
$presenter = new Meta_Description_Presenter();
$presenter->presentation = $presentation;
$presenter->helpers = $this->helpers;
$presenter->replace_vars = $this->replace_vars;
$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 );
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Generators\Schema\Article;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema Article data.
*
* @deprecated 14.0
*
* @since 10.2
*/
class WPSEO_Schema_Article extends Article implements WPSEO_Graph_Piece {
/**
* The date helper.
*
* @var WPSEO_Date_Helper
*/
protected $date;
/**
* WPSEO_Schema_Article constructor.
*
* @param array $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Article' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
$this->date = new WPSEO_Date_Helper();
}
/**
* Determines whether or not a piece should be added to the graph.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Article::is_needed' );
return parent::is_needed();
}
/**
* Returns Article data.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return array $data Article data.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Article::generate' );
return parent::generate();
}
/**
* Determines whether a given post type should have Article schema.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param string $post_type Post type to check.
*
* @return bool True if it has article schema, false if not.
*/
public static function is_article_post_type( $post_type = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->article->is_article_post_type' );
return YoastSEO()->helpers->schema->article->is_article_post_type( $post_type );
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Config\Schema_IDs;
use Yoast\WP\SEO\Generators\Schema\Author;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema Person data.
*
* @deprecated 14.0
*
* @since 10.2
*/
class WPSEO_Schema_Author extends Author implements WPSEO_Graph_Piece {
/**
* The hash used for images.
*
* @var string
*/
protected $image_hash = Schema_IDs::AUTHOR_LOGO_HASH;
/**
* The Schema type we use for this class.
*
* @var string[]
*/
protected $type = [ 'Person' ];
/**
* WPSEO_Schema_Author constructor.
*
* @param null $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Author' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
}
/**
* Determine whether we should return Person schema.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Author::is_needed' );
if ( $this->context->indexable->object_type === 'user' ) {
return true;
}
// This call to `is_post_author` is why this whole block could not be replaced with a `parent::is_needed()` call.
if ( $this->is_post_author() ) {
// If the author is the user the site represents, no need for an extra author block.
if ( parent::is_needed() ) {
return (int) $this->context->post->post_author !== $this->context->site_user_id;
}
return true;
}
return false;
}
/**
* Returns Person Schema data.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool|array Person data on success, false on failure.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Author::generate' );
return parent::generate();
}
/**
* Gets the Schema type we use for this class.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return string[] The schema type.
*/
public static function get_type() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return [ 'Person' ];
}
/**
* Determine whether the current URL is worthy of Article schema.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
protected function is_post_author() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return (
$this->context->indexable->object_type === 'post' &&
$this->helpers->schema->article->is_article_post_type( $this->context->indexable->object_sub_type )
);
}
/**
* Determines a User ID for the Person data.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool|int User ID or false upon return.
*/
protected function determine_user_id() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Author::determine_user_id' );
return parent::determine_user_id();
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Generators\Schema\Breadcrumb;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema Breadcrumb data.
*
* @deprecated 14.0
*
* @since 10.2
*/
class WPSEO_Schema_Breadcrumb extends Breadcrumb implements WPSEO_Graph_Piece {
/**
* WPSEO_Schema_Breadcrumb constructor.
*
* @param null $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Breadcrumb' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
}
/**
* Determine if we should add a breadcrumb attribute.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Breadcrumb::is_needed' );
return parent::is_needed();
}
/**
* Returns Schema breadcrumb data to allow recognition of page's position in the site hierarchy.
*
* @link https://developers.google.com/search/docs/data-types/breadcrumb
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool|array Array on success, false on failure.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Breadcrumb::generate' );
return parent::generate();
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
/**
* Returns a question object for each question in an FAQ block.
*
* @since 11.1
*
* @deprecated 14.0
*/
class WPSEO_Schema_FAQ_Question_List {
/**
* WPSEO_Schema_FAQ_Question_List constructor.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param WP_Block_Parser_Block[] $blocks An array of the FAQ blocks on this page.
* @param WPSEO_Schema_Context $context A value object with context variables.
*/
public function __construct( $blocks, $context ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Find an image based on its URL and generate a Schema object for it.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return array The Schema with a question list added.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return [];
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
/**
* Returns a question object for each question in an FAQ block.
*
* @deprecated 14.0
*
* @since 11.1
*/
class WPSEO_Schema_FAQ_Questions {
/**
* A value object with context variables.
* This property is public, because originally it was dynamically declared.
*
* @var WPSEO_Schema_Context
*/
public $context;
/**
* WPSEO_Schema_FAQ_Questions constructor.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $data Our schema graph.
* @param WP_Block_Parser_Block $block The FAQ block of this type.
* @param WPSEO_Schema_Context $context A value object with context variables.
*/
public function __construct( $data, $block, $context ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
$this->context = $context;
}
/**
* Find an image based on its URL and generate a Schema object for it.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return array The Schema with Questions added.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return [];
}
/**
* Generate a Question piece.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $question The question to generate schema for.
*
* @return array Schema.org Question piece.
*/
protected function generate_question_block( $question ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return [];
}
}
......@@ -5,65 +5,59 @@
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Generators\Schema\FAQ;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema FAQ data.
*
* @deprecated 14.0
*
* @since 11.3
*/
class WPSEO_Schema_FAQ implements WPSEO_Graph_Piece {
/**
* Determine whether this graph piece is needed or not.
*
* @var bool
*/
private $is_needed = false;
/**
* The FAQ blocks on the current page.
*
* @var array
*/
private $blocks;
/**
* A value object with context variables.
*
* @var WPSEO_Schema_Context
*/
private $context;
class WPSEO_Schema_FAQ extends FAQ implements WPSEO_Graph_Piece {
/**
* WPSEO_Schema_FAQ constructor.
*
* @param WPSEO_Schema_Context $context A value object with context variables.
* @param null $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( WPSEO_Schema_Context $context ) {
$this->context = $context;
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\FAQ' );
add_action( 'wpseo_pre_schema_block_type_yoast/faq-block', [ $this, 'prepare_schema' ], 10, 1 );
add_filter( 'wpseo_schema_block_yoast/faq-block', [ $this, 'render_schema_questions' ], 10, 3 );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
}
/**
* If this fires, we know there's an FAQ block ont he page, so filter the page type.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $blocks The blocks of this type on the current page.
*/
public function prepare_schema( $blocks ) {
$this->blocks = $blocks;
$this->is_needed = true;
add_filter( 'wpseo_schema_webpage_type', [ $this, 'change_schema_page_type' ] );
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Change the page type to an array if it isn't one, include FAQPage.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array|string $page_type The page type.
*
* @return array $page_type The page type that's now an array.
*/
public function change_schema_page_type( $page_type ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
if ( ! is_array( $page_type ) ) {
$page_type = [ $page_type ];
}
......@@ -75,18 +69,23 @@ class WPSEO_Schema_FAQ implements WPSEO_Graph_Piece {
/**
* Render a list of questions, referencing them by ID.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return array $data Our Schema graph.
*/
public function generate() {
$question_list = new WPSEO_Schema_FAQ_Question_List( $this->blocks, $this->context );
$graph = $question_list->generate();
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\FAQ::generate' );
return $graph;
return parent::generate();
}
/**
* Add the Questions in our FAQ blocks as separate pieces to the graph.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $graph Schema data for the current page.
* @param WP_Block_Parser_Block $block The block data array.
* @param WPSEO_Schema_Context $context A value object with context variables.
......@@ -94,18 +93,22 @@ class WPSEO_Schema_FAQ implements WPSEO_Graph_Piece {
* @return array $data Our Schema graph.
*/
public function render_schema_questions( $graph, $block, $context ) {
$questions = new WPSEO_Schema_FAQ_Questions( $graph, $block, $context );
$graph = $questions->generate();
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return $graph;
return [];
}
/**
* Determines whether or not a piece should be added to the graph.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
return $this->is_needed;
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\FAQ::is_needed' );
return parent::is_needed();
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Generators\Schema\HowTo;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema FAQ data.
*
* @deprecated 14.0
*
* @since 11.5
*/
class WPSEO_Schema_HowTo extends HowTo implements WPSEO_Graph_Piece {
/**
* The HowTo blocks count on the current page.
*
* @var int
*/
private $counter = 0;
/**
* WPSEO_Schema_FAQ constructor.
*
* @param null $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\HowTo' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
}
/**
* Renders a list of questions, referencing them by ID.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return array $data Our Schema graph.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\HowTo::generate' );
return parent::generate();
}
/**
* Renders the How-To block into our graph.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $graph Our Schema data.
* @param array $block The How-To block content.
*
* @return mixed
*/
public function render( $graph, $block ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\HowTo::add_how_to' );
$this->counter++;
$this->add_how_to( $graph, $block, $this->counter );
return $graph;
}
/**
* Determines whether or not a piece should be added to the graph.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\HowTo::is_needed' );
return parent::is_needed();
}
/**
* Determines whether we're part of an article or a webpage.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return string A reference URL.
*/
protected function get_main_schema_id() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return $this->context->main_schema_id;
}
/**
* Generates the image schema from the attachment $url.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param string $url Attachment url.
*
* @return array Image schema.
*
* @codeCoverageIgnore
*/
protected function get_image_schema( $url ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\HowTo::get_image_schema' );
return parent::get_image_schema( $url );
}
}
......@@ -8,6 +8,8 @@
/**
* Constants used for @id variables.
*
* @deprecated 14.0
*
* @since 10.2
*/
class WPSEO_Schema_IDs {
......
......@@ -10,6 +10,8 @@
*
* @since 11.1
*
* @deprecated 14.0
*
* @property string $schema_id The `@id` to use for the returned image.
* @property array $data The ImageObject Schema array.
* @property int $attachment_id The ID of the attachment used to generate the object.
......@@ -17,140 +19,70 @@
class WPSEO_Schema_Image {
/**
* The `@id` to use for the returned image.
* Value to use as the image id.
*
* @var string
*/
private $schema_id;
/**
* The ImageObject Schema array.
*
* @var array
*/
private $data;
/**
* The ID of the attachment used to generate the object.
*
* @var int
*/
private $attachment_id;
/**
* WPSEO_Schema_Image constructor.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param string $schema_id The string to use in an image's `@id`.
*/
public function __construct( $schema_id ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image' );
$this->schema_id = $schema_id;
$this->generate_object();
}
/**
* Find an image based on its URL and generate a Schema object for it.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param string $url The image URL to base our object on.
* @param string $caption An optional caption.
*
* @return array Schema ImageObject array.
*/
public function generate_from_url( $url, $caption = '' ) {
$attachment_id = WPSEO_Image_Utils::get_attachment_by_url( $url );
if ( $attachment_id > 0 ) {
return $this->generate_from_attachment_id( $attachment_id, $caption );
}
return $this->simple_image_object( $url, $caption );
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->generate_from_url' );
return YoastSEO()->helpers->schema->image->generate_from_url( $this->schema_id, $url, $caption );
}
/**
* Retrieve data about an image from the database and use it to generate a Schema object.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param int $attachment_id The attachment to retrieve data from.
* @param string $caption The caption string, if there is one.
*
* @return array Schema ImageObject array.
*/
public function generate_from_attachment_id( $attachment_id, $caption = '' ) {
$this->attachment_id = $attachment_id;
$this->data['url'] = wp_get_attachment_image_url( $this->attachment_id, 'full' );
$this->add_image_size();
$this->add_caption( $caption );
return $this->data;
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->generate_from_attachment_id' );
return YoastSEO()->helpers->schema->image->generate_from_attachment_id( $this->schema_id, $attachment_id, $caption );
}
/**
* If we can't find $url in our database, we output a simple ImageObject.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param string $url The image URL.
* @param string $caption A caption, if set.
*
* @return array $data Schema ImageObject array.
*/
public function simple_image_object( $url, $caption = '' ) {
$this->data['url'] = $url;
if ( ! empty( $caption ) ) {
$this->data['caption'] = $caption;
}
return $this->data;
}
/**
* Retrieves an image's caption if set, or uses the alt tag if that's set.
*
* @param string $caption The caption string, if there is one.
*
* @return void
*/
private function add_caption( $caption = '' ) {
if ( ! empty( $caption ) ) {
$this->data['caption'] = $caption;
return;
}
$caption = wp_get_attachment_caption();
if ( ! empty( $caption ) ) {
$this->data['caption'] = $caption;
return;
}
$caption = get_post_meta( $this->attachment_id, '_wp_attachment_image_alt', true );
if ( ! empty( $caption ) ) {
$this->data['caption'] = $caption;
}
}
/**
* Generates our bare bone ImageObject.
*
* @return void
*/
private function generate_object() {
$this->data = [
'@type' => 'ImageObject',
'@id' => $this->schema_id,
];
$this->data = WPSEO_Schema_Utils::add_piece_language( $this->data );
}
/**
* Adds image's width and height.
*
* @return void
*/
private function add_image_size() {
$image_meta = wp_get_attachment_metadata( $this->attachment_id );
if ( empty( $image_meta['width'] ) || empty( $image_meta['height'] ) ) {
return;
}
$this->data['width'] = $image_meta['width'];
$this->data['height'] = $image_meta['height'];
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->simple_image_object' );
return YoastSEO()->helpers->schema->image->simple_image_object( $this->schema_id, $url, $caption );
}
}
......@@ -5,42 +5,47 @@
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Generators\Schema\Main_Image;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns ImageObject schema data.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @since 11.5
*/
class WPSEO_Schema_MainImage implements WPSEO_Graph_Piece {
/**
* A value object with context variables.
*
* @var WPSEO_Schema_Context
*/
private $context;
class WPSEO_Schema_MainImage extends Main_Image implements WPSEO_Graph_Piece {
/**
* WPSEO_Schema_WebPage constructor.
*
* @codeCoverageIgnore
* @param null $context The context. No longer used but present for BC.
*
* @param WPSEO_Schema_Context $context A value object with context variables.
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( WPSEO_Schema_Context $context ) {
$this->context = $context;
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Main_Image' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
}
/**
* Determines whether or not a piece should be added to the graph.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
if ( is_singular() ) {
return true;
}
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Main_Image::is_needed' );
return false;
return parent::is_needed();
}
/**
......@@ -48,70 +53,30 @@ class WPSEO_Schema_MainImage implements WPSEO_Graph_Piece {
*
* This can be either the featured image, or fall back to the first image in the content of the page.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return false|array $data Image Schema.
*/
public function generate() {
$image_id = $this->context->canonical . WPSEO_Schema_IDs::PRIMARY_IMAGE_HASH;
$image_schema = $this->get_featured_image( $this->context->id, $image_id );
if ( $image_schema === null ) {
$image_schema = $this->get_first_content_image( $this->context->id, $image_id );
}
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Main_Image::generate' );
if ( $image_schema === null ) {
return false;
}
$this->context->has_image = true;
return $image_schema;
}
/**
* Gets the image schema for the web page based on the featured image.
*
* @param int $post_id The post id.
* @param string $image_id The image schema id.
*
* @return array|null The image schema object or null if there is no featured image.
*/
private function get_featured_image( $post_id, $image_id ) {
if ( ! has_post_thumbnail( $post_id ) ) {
return null;
}
return $this->generate_image_schema_from_attachment_id( $image_id );
}
/**
* Gets the image schema for the web page based on the first content image image.
*
* @param int $post_id The post id.
* @param string $image_id The image schema id.
*
* @return array|null The image schema object or null if there is no image in the content.
*/
private function get_first_content_image( $post_id, $image_id ) {
$image_url = $this->get_first_usable_content_image_for_post( $post_id );
if ( $image_url === null ) {
return null;
}
return $this->generate_image_schema_from_url( $image_id, $image_url );
return parent::generate();
}
/**
* Gets the post's first usable content image. Null if none is available.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param int $post_id The post id.
*
* @return string|null The image URL or null if there is no image.
*/
protected function get_first_usable_content_image_for_post( $post_id ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
return WPSEO_Image_Utils::get_first_usable_content_image_for_post( $post_id );
}
......@@ -119,20 +84,23 @@ class WPSEO_Schema_MainImage implements WPSEO_Graph_Piece {
* Generates image schema from the attachment id.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param string $image_id The image schema id.
*
* @return array Schema ImageObject array.
*/
protected function generate_image_schema_from_attachment_id( $image_id ) {
$schema_image = new WPSEO_Schema_Image( $image_id );
return $schema_image->generate_from_attachment_id( get_post_thumbnail_id() );
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->generate_from_attachment_id' );
return $this->helpers->schema->image->generate_from_attachment_id( $image_id, \get_post_thumbnail_id() );
}
/**
* Generates image schema from the url.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param string $image_id The image schema id.
* @param string $image_url The image URL.
......@@ -140,7 +108,8 @@ class WPSEO_Schema_MainImage implements WPSEO_Graph_Piece {
* @return array Schema ImageObject array.
*/
protected function generate_image_schema_from_url( $image_id, $image_url ) {
$schema_image = new WPSEO_Schema_Image( $image_id );
return $schema_image->generate_from_url( $image_url );
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->image->generate_from_url' );
return $this->helpers->schema->image->generate_from_url( $image_id, $image_url );
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Generators\Schema\Organization;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema Organization data.
*
* @deprecated 14.0
*
* @since 10.2
*/
class WPSEO_Schema_Organization extends Organization implements WPSEO_Graph_Piece {
/**
* WPSEO_Schema_Organization constructor.
*
* @param null $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Organization' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
}
/**
* Determines whether an Organization graph piece should be added.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Organization::is_needed' );
return parent::is_needed();
}
/**
* Returns the Organization Schema data.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return array $data The Organization schema.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Organization::generate' );
return parent::generate();
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Config\Schema_IDs;
use Yoast\WP\SEO\Generators\Schema\Person;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema Person data.
*
* @deprecated 14.0
*
* @since 10.2
*/
class WPSEO_Schema_Person extends Person implements WPSEO_Graph_Piece {
/**
* The hash used for images.
*
* @var string
*/
protected $image_hash = Schema_IDs::PERSON_LOGO_HASH;
/**
* WPSEO_Schema_Person constructor.
*
* @param null $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Person' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
}
/**
* Determine whether we should return Person schema.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Person::is_needed' );
return parent::is_needed();
}
/**
* Returns Person Schema data.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool|array Person data on success, false on failure.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Person::generate' );
return parent::generate();
}
/**
* Determines a User ID for the Person data.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool|int User ID or false upon return.
*/
protected function determine_user_id() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Person::determine_user_id' );
return parent::determine_user_id();
}
/**
* Retrieve a list of social profile URLs for Person.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param int $user_id User ID.
*
* @return string[] $output A list of social profiles.
*/
protected function get_social_profiles( $user_id ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Person::get_social_profiles' );
return parent::get_social_profiles( $user_id );
}
/**
* Builds our array of Schema Person data for a given user ID.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param int $user_id The user ID to use.
*
* @return array An array of Schema Person data.
*/
protected function build_person_data( $user_id ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Person::build_person_data' );
return parent::build_person_data( $user_id );
}
/**
* Returns an ImageObject for the persons avatar.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $data The Person schema.
* @param \WP_User $user_data User data.
*
* @return array $data The Person schema.
*/
protected function add_image( $data, $user_data ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Person::add_image' );
return parent::add_image( $data, $user_data );
}
/**
* Returns an author's social site URL.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param string $social_site The social site to retrieve the URL for.
* @param mixed $user_id The user ID to use function outside of the loop.
*
* @return string
*/
protected function url_social_site( $social_site, $user_id = false ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Person::url_social_site' );
return parent::url_social_site( $social_site, $user_id );
}
}
......@@ -8,6 +8,8 @@
/**
* Schema utility functions.
*
* @deprecated 14.0
*
* @since 11.6
*/
class WPSEO_Schema_Utils {
......@@ -15,32 +17,32 @@ class WPSEO_Schema_Utils {
/**
* Retrieves a user's Schema ID.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param int $user_id The ID of the User you need a Schema ID for.
* @param WPSEO_Schema_Context $context A value object with context variables.
*
* @return string The user's schema ID.
*/
public static function get_user_schema_id( $user_id, $context ) {
$user = get_userdata( $user_id );
if ( is_object( $user ) && isset( $user->user_login ) ) {
return $context->site_url . WPSEO_Schema_IDs::PERSON_HASH . wp_hash( $user->user_login . $user_id );
}
return $context->site_url . WPSEO_Schema_IDs::PERSON_HASH;
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->id->get_user_schema_id' );
return YoastSEO()->helpers->schema->id->get_user_schema_id( $user_id, $context );
}
/**
* Retrieves the post title with fallback to `No title`.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param int $post_id Optional. Post ID.
*
* @return string The post title with fallback to `No title`.
*/
public static function get_post_title_with_fallback( $post_id = 0 ) {
$post_title = get_the_title( $post_id );
$title = ( $post_title ) ? $post_title : __( 'No title', 'wordpress-seo' );
return $title;
_deprecated_function( __METHOD__, 'WPSEO 14.0', ' YoastSEO()->helpers->post->get_post_title_with_fallback' );
return YoastSEO()->helpers->post->get_post_title_with_fallback( $post_id );
}
/**
......@@ -50,18 +52,15 @@ class WPSEO_Schema_Utils {
* language tag syntax is made of one or more subtags separated by a hyphen
* e.g. "en", "en-US", "zh-Hant-CN".
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $data The Schema piece data.
*
* @return string The Schema piece language.
* @return array The Schema piece data with added language property.
*/
public static function add_piece_language( $data ) {
/**
* Filter: 'wpseo_schema_piece_language' - Allow changing the Schema piece language.
*
* @api string $type The Schema piece language.
*/
$data['inLanguage'] = apply_filters( 'wpseo_schema_piece_language', get_bloginfo( 'language' ), $data );
return $data;
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'YoastSEO()->helpers->schema->language->add_piece_language' );
return YoastSEO()->helpers->schema->language->add_piece_language( $data );
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Generators\Schema\WebPage;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema WebPage data.
*
* @deprecated 14.0
*
* @since 10.2
*/
class WPSEO_Schema_WebPage extends WebPage implements WPSEO_Graph_Piece {
/**
* The date helper.
*
* @var WPSEO_Date_Helper
*/
protected $date;
/**
* WPSEO_Schema_WebPage constructor.
*
* @param null $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\WebPage' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
$this->date = new WPSEO_Date_Helper();
}
/**
* Determines whether or not a piece should be added to the graph.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\WebPage::is_needed' );
return parent::is_needed();
}
/**
* Returns WebPage schema data.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return array WebPage schema data.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\WebPage::generate' );
return parent::generate();
}
/**
* Adds an author property to the $data if the WebPage is not represented.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $data The WebPage schema.
* @param WP_Post $post The post the context is representing.
*
* @return array The WebPage schema.
*/
public function add_author( $data, $post ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\WebPage::add_author' );
return parent::add_author( $data, $post );
}
/**
* If we have an image, make it the primary image of the page.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @param array $data WebPage schema data.
*/
public function add_image( &$data ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\WebPage::add_image' );
parent::add_image( $data );
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
use Yoast\WP\SEO\Generators\Schema\Website;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
/**
* Returns schema Website data.
*
* @deprecated 14.0
*
* @since 10.2
*/
class WPSEO_Schema_Website extends Website implements WPSEO_Graph_Piece {
/**
* WPSEO_Schema_Website constructor.
*
* @param null $context The context. No longer used but present for BC.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function __construct( $context = null ) {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Website' );
$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );
$this->context = $memoizer->for_current_page();
$this->helpers = YoastSEO()->helpers;
}
/**
* Determines whether or not a piece should be added to the graph.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @return bool
*/
public function is_needed() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Website::is_needed' );
return parent::is_needed();
}
/**
* Outputs code to allow recognition of the internal search engine.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @since 1.5.7
*
* @link https://developers.google.com/structured-data/site-name
*
* @return array Website data blob.
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\Website::generate' );
return parent::generate();
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Frontend\Schema
*/
/**
* Class WPSEO_Schema
*
* Outputs schema code specific for Google's JSON LD stuff.
*
* @deprecated 14.0
*
* @since 1.8
*/
class WPSEO_Schema implements WPSEO_WordPress_Integration {
/**
* Registers the hooks.
*
* @codeCoverageIgnore
* @deprecated 14.0
*/
public function register_hooks() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* JSON LD output function that the functions for specific code can hook into.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @since 1.8
*/
public function json_ld() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
/**
* Outputs the JSON LD code in a valid JSON+LD wrapper.
*
* @codeCoverageIgnore
* @deprecated 14.0
*
* @since 10.2
*
* @return void
*/
public function generate() {
_deprecated_function( __METHOD__, 'WPSEO 14.0' );
}
}
......@@ -9,6 +9,8 @@ if ( ! interface_exists( 'WPSEO_Graph_Piece' ) ) {
/**
* An interface for registering Schema Graph Pieces.
*
* @deprecated 14.0
*
* @since 10.2
*/
interface WPSEO_Graph_Piece {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment