| Server IP : 121.121.20.254 / Your IP : 216.73.216.66 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/KnowledgeBase/wp-content/plugins/wp-seopress-pro/src/JsonSchemas/ |
Upload File : |
<?php
namespace SEOPressPro\JsonSchemas;
if ( ! defined('ABSPATH')) {
exit;
}
use SEOPress\Helpers\RichSnippetType;
use SEOPress\JsonSchemas\Image;
use SEOPress\Models\GetJsonData;
use SEOPressPro\Models\JsonSchemaValue;
class HowToStep extends JsonSchemaValue implements GetJsonData {
const NAME = 'how-to-step';
protected function getName() {
return self::NAME;
}
/**
* @since 4.5.0
*
* @param array $context
*
* @return array
*/
public function getJsonData($context = null) {
$data = $this->getArrayJson();
$typeSchema = isset($context['type']) ? $context['type'] : RichSnippetType::MANUAL;
$variables = $this->getVariablesByType($typeSchema, $context);
if (isset($variables['image_url']) && ! empty($variables['image_url'])) {
$variablesContext = [
'url' => $variables['image_url'],
'width' => isset($variables['image_width']) ? $variables['image_width'] : '',
'height' => isset($variables['image_height']) ? $variables['image_height'] : '',
];
$contextWithVariables = $context;
$contextWithVariables['variables'] = $variablesContext;
$contextWithVariables['type'] = RichSnippetType::SUB_TYPE;
$schema = seopress_get_service('JsonSchemaGenerator')->getJsonFromSchema(Image::NAME, $contextWithVariables, ['remove_empty' => true]);
if (count($schema) > 1) {
$data['image'] = $schema;
}
}
return apply_filters('seopress_pro_get_json_data_how_to_step', $data, $context);
}
}