Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
wordpress-seo
/
src
/
deprecated
/
frontend
/
schema
/
File Content:
class-schema-howto.php
<?php /** * WPSEO plugin file. * * @package WPSEO\Frontend\Schema */ use Yoast\WP\SEO\Generators\Schema\HowTo; /** * Returns schema FAQ data. * * @since 11.5 * @deprecated 14.0 */ class WPSEO_Schema_HowTo extends WPSEO_Deprecated_Graph_Piece { /** * The HowTo blocks count on the current page. * * @var int */ private $counter = 0; /** * WPSEO_Schema_FAQ constructor. * * @deprecated 14.0 * @codeCoverageIgnore * * @param null $context The context. No longer used but present for BC. */ public function __construct( $context = null ) { parent::__construct( HowTo::class ); } /** * Renders the How-To block into our graph. * * @deprecated 14.0 * @codeCoverageIgnore * * @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; } /** * Generates the HowTo schema for a block. * * @param array $graph Our Schema data. * @param array $block The How-To block content. * @param int $index The index of the current block. */ protected function add_how_to( &$graph, $block, $index ) { $data = [ '@type' => 'HowTo', '@id' => $this->stable->context->canonical . '#howto-' . ( $index + 1 ), 'name' => $this->helpers->schema->html->smart_strip_tags( $this->helpers->post->get_post_title_with_fallback( $this->stable->context->id ) ), 'mainEntityOfPage' => [ '@id' => $this->stable->context->main_schema_id ], 'description' => '', ]; if ( isset( $block['attrs']['jsonDescription'] ) ) { $data['description'] = $this->helpers->schema->html->sanitize( $block['attrs']['jsonDescription'] ); } $this->add_duration( $data, $block['attrs'] ); $this->add_steps( $data, $block['attrs']['steps'] ); $data = $this->helpers->schema->language->add_piece_language( $data ); $graph[] = $data; } /** * Adds the steps to our How-To output. * * @param array $data Our How-To schema data. * @param array $steps Our How-To block's steps. */ private function add_steps( &$data, $steps ) { foreach ( $steps as $step ) { $schema_id = $this->stable->context->canonical . '#' . esc_attr( $step['id'] ); $schema_step = [ '@type' => 'HowToStep', 'url' => $schema_id, ]; if ( isset( $step['jsonText'] ) ) { $json_text = $this->helpers->schema->html->sanitize( $step['jsonText'] ); } if ( isset( $step['jsonName'] ) ) { $json_name = $this->helpers->schema->html->smart_strip_tags( $step['jsonName'] ); } if ( empty( $json_name ) ) { if ( empty( $step['text'] ) ) { continue; } $schema_step['text'] = ''; $this->add_step_image( $schema_step, $step ); // If there is no text and no image, don't output the step. if ( empty( $json_text ) && empty( $schema_step['image'] ) ) { continue; } if ( ! empty( $json_text ) ) { $schema_step['text'] = $json_text; } } elseif ( empty( $json_text ) ) { $schema_step['text'] = $json_name; } else { $schema_step['name'] = $json_name; $schema_step['itemListElement'] = [ [ '@type' => 'HowToDirection', 'text' => $json_text, ], ]; $this->add_step_description( $schema_step, $json_text ); $this->add_step_image( $schema_step, $step ); } $data['step'][] = $schema_step; } } /** * Adds the duration of the task to the Schema. * * @param array $data Our How-To schema data. * @param array $attributes The block data attributes. */ private function add_duration( &$data, $attributes ) { if ( empty( $attributes['hasDuration'] ) ) { return; } $days = empty( $attributes['days'] ) ? 0 : $attributes['days']; $hours = empty( $attributes['hours'] ) ? 0 : $attributes['hours']; $minutes = empty( $attributes['minutes'] ) ? 0 : $attributes['minutes']; if ( ( $days + $hours + $minutes ) > 0 ) { $data['totalTime'] = esc_attr( 'P' . $days . 'DT' . $hours . 'H' . $minutes . 'M' ); } } /** * Determines whether we're part of an article or a webpage. * * @deprecated 14.0 * @codeCoverageIgnore * * @return string A reference URL. */ protected function get_main_schema_id() { _deprecated_function( __METHOD__, 'WPSEO 14.0' ); return $this->stable->context->main_schema_id; } /** * Checks if we have a step description, if we do, add it. * * @param array $schema_step Our Schema output for the Step. * @param string $json_text The step text. */ private function add_step_description( &$schema_step, $json_text ) { $schema_step['itemListElement'] = [ [ '@type' => 'HowToDirection', 'text' => $json_text, ], ]; } /** * Checks if we have a step image, if we do, add it. * * @param array $schema_step Our Schema output for the Step. * @param array $step The step block data. */ private function add_step_image( &$schema_step, $step ) { 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'] ) ); } } } /** * Generates the image schema from the attachment $url. * * @deprecated 14.0 * @codeCoverageIgnore * * @param string $url Attachment url. * * @return array Image schema. */ protected function get_image_schema( $url ) { _deprecated_function( __METHOD__, 'WPSEO 14.0', 'Yoast\WP\SEO\Generators\Schema\HowTo::get_image_schema' ); $schema_id = $this->stable->context->canonical . '#schema-image-' . md5( $url ); return $this->helpers->schema->image->generate_from_url( $schema_id, $url ); } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
.DS_Store
10234 bytes
0644
AjaxController.php
2162 bytes
0644
JsonSerializable.php
577 bytes
0644
LimitStream.php
4209 bytes
0644
base.php
2793 bytes
0644
class-metabox-formatter-20260704221715.php
12602 bytes
0644
class-metabox-formatter.php
12602 bytes
0644
class-option-tabs-formatter.php
2321 bytes
0644
class-schema-article.php
1190 bytes
0644
class-schema-author.php
2638 bytes
0644
class-schema-breadcrumb.php
554 bytes
0644
class-schema-faq-question-list.php
907 bytes
0644
class-schema-faq-questions.php
1492 bytes
0644
class-schema-faq.php
1854 bytes
0644
class-schema-howto.php
5925 bytes
0644
class-schema-ids.php
1179 bytes
0644
class-schema-image.php
2630 bytes
0644
class-schema-main-image.php
2073 bytes
0644
class-schema-organization.php
564 bytes
0644
class-schema-person.php
4181 bytes
0644
class-schema-utils-20260623075741.php
1927 bytes
0644
class-schema-utils.php
1927 bytes
0644
class-schema-webpage.php
1517 bytes
0644
class-schema-website.php
539 bytes
0644
class-schema.php
934 bytes
0644
class-sitemaps-admin-20260703023908.php
3665 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class.pack.database.php
30838 bytes
0644
dashboard-1650-rtl.css
1634 bytes
0644
define.php
4567 bytes
0644
duplicator.php
1781 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
environment-helper.php
596 bytes
0644
exceptions.php
708 bytes
0644
inc.data.php
5121 bytes
0644
inc.validator.php
5401 bytes
0644
index.php
38 bytes
0644
interface-wpseo-graph-piece.php
557 bytes
0644
loco.php
5626 bytes
0644
loco.xml
657 bytes
0644
manager.php
14659 bytes
0644
quick-edit-handler-1650.js
1848 bytes
0644
root.php
1951 bytes
0644
uninstall.php
4401 bytes
0644
wordpress-seo-es_ES.json
25583 bytes
0644
wordpress-seojs-ar.json
25925 bytes
0644
wordpress-seojs-bs_BA.json
13790 bytes
0644
wordpress-seojs-gl_ES.json
20143 bytes
0644
wordpress-seojs-ja.json
21424 bytes
0644
wordpress-seojs-uk.json
26506 bytes
0644
N4ST4R_ID | Naxtarrr