| | |
| | | |
| | | switch ($variable) { |
| | | case 'CREATOR': |
| | | return JVB()->seo()->getCreator(); |
| | | return SchemaOutput::getInstance()->getCreator(); |
| | | case 'name': |
| | | if (!$meta && is_post_type_archive()) { |
| | | $obj = get_queried_object(); |
| | |
| | | |
| | | $ignore = ['description', 'name']; |
| | | if (JVB_TESTING && !in_array($property, $ignore)) { |
| | | error_log('[SEO]Resolver - No method found for '.$property.' with value: '.print_r($value, true).'. Defaulting to base Resolver'); |
| | | // error_log('[SEO]Resolver - No method found for '.$property.' with value: '.print_r($value, true).'. Defaulting to base Resolver'); |
| | | } |
| | | |
| | | |
| | |
| | | if (!$imgID || $imgID === '') { |
| | | return null; |
| | | } |
| | | |
| | | return self::imgIDToSchema($imgID); |
| | | |
| | | } |
| | | public static function imgIDToSchema(int $imgID):ImageObject|null |
| | | { |
| | | $img = wp_get_attachment_image_src($imgID,'full'); |
| | | if (!$img) { |
| | | return null; |
| | |
| | | $imageObject = new ImageObject(); |
| | | $imageObject->setContentUrl($img[0]); |
| | | $width = new QuantitativeValue(); |
| | | $width->showID(false); |
| | | $width->setValue($img[1]); |
| | | $width->setUnitText('px'); |
| | | $imageObject->setWidth($width); |
| | | $height = new QuantitativeValue(); |
| | | $height->showID(false); |
| | | $height->setValue($img[2]); |
| | | $width->setUnitText('px'); |
| | | $height->setUnitText('px'); |
| | | $imageObject->setHeight($height); |
| | | |
| | | $image_path = get_attached_file($imgID); |
| | |
| | | return $imageObject; |
| | | } |
| | | ); |
| | | |
| | | } |
| | | |
| | | public static function resolveCreator(string $type, mixed $value, mixed $schema, ?Meta $meta):mixed |
| | |
| | | //TODO generate from id |
| | | |
| | | } else if (str_contains($value, 'CREATOR')) { |
| | | return JVB()->seo()->getCreator(); |
| | | return SchemaOutput::getInstance()->getCreator(); |
| | | } |
| | | return ''; |
| | | } |