rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -2,6 +2,7 @@
namespace Yoast\WP\SEO\Generators\Schema;
use WP_User;
use Yoast\WP\SEO\Config\Schema_IDs;
/**
@@ -49,7 +50,7 @@ class Article extends Abstract_Schema_Piece {
'@id' => $this->context->canonical . Schema_IDs::ARTICLE_HASH,
'isPartOf' => [ '@id' => $this->context->main_schema_id ],
'author' => [
'name' => ( $author instanceof \WP_User ) ? $this->helpers->schema->html->smart_strip_tags( $author->display_name ) : '',
'name' => ( $author instanceof WP_User ) ? $this->helpers->schema->html->smart_strip_tags( $author->display_name ) : '',
'@id' => $this->helpers->schema->id->get_user_schema_id( $this->context->post->post_author, $this->context ),
],
'headline' => $this->helpers->schema->html->smart_strip_tags( $this->helpers->post->get_post_title_with_fallback( $this->context->id ) ),
@@ -225,9 +226,6 @@ class Article extends Abstract_Schema_Piece {
$characters .= \mb_strtoupper( $characters );
}
// Remove characters from HTML entities.
$post_content = \preg_replace( '@&[a-z0-9]+;@i', ' ', \htmlentities( $post_content ) );

View File

@@ -34,7 +34,7 @@ class FAQ extends Abstract_Schema_Piece {
private function generate_ids() {
$ids = [];
foreach ( $this->context->blocks['yoast/faq-block'] as $block ) {
foreach ( $block['attrs']['questions'] as $index => $question ) {
foreach ( $block['attrs']['questions'] as $question ) {
if ( ! isset( $question['jsonAnswer'] ) || empty( $question['jsonAnswer'] ) ) {
continue;
}

View File

@@ -130,7 +130,7 @@ class HowTo extends Abstract_Schema_Piece {
* @param array $step The step block data.
*/
private function add_step_image( &$schema_step, $step ) {
if ( isset( $step['text'] ) && is_array( $step['text'] ) ) {
if ( isset( $step['text'] ) && \is_array( $step['text'] ) ) {
foreach ( $step['text'] as $line ) {
if ( \is_array( $line ) && isset( $line['type'] ) && $line['type'] === 'img' ) {
$schema_step['image'] = $this->get_image_schema( \esc_url( $line['props']['src'] ) );