| | |
| | | nameTrait, ownerTrait, potentialActionTrait, sameAsTrait, subjectOfTrait, urlTrait; |
| | | |
| | | protected string $id; |
| | | |
| | | protected bool $showID = true; |
| | | protected array $ignore = [ |
| | | 'mappedMethods', |
| | | 'ignore', |
| | | 'id' |
| | | 'id', |
| | | 'showID', |
| | | ]; |
| | | public function outputSchema():array |
| | | { |
| | | global $wp; |
| | | $current = home_url( add_query_arg( $_GET, $wp->request ) ); |
| | | $current = get_home_url(null, add_query_arg( $_GET, $wp->request ) ); |
| | | $id = (isset($this->id)) ? $this->id : $current.'/#'.strtolower($this->getTypeName()); |
| | | $elements = array_map( |
| | | function ($value) { |
| | |
| | | $value = $value->getTime(); |
| | | }else if (!is_string($value)) { |
| | | if (JVB_TESTING && !is_numeric($value)) { |
| | | error_log('Normal value? '.print_r($value, true)); |
| | | // error_log('Normal value? '.print_r($value, true)); |
| | | } |
| | | } |
| | | |
| | |
| | | }, ARRAY_FILTER_USE_KEY) |
| | | ); |
| | | |
| | | return array_merge([ |
| | | $id = $this->showID ? ['@id' => $id] : []; |
| | | |
| | | return array_merge($id, [ |
| | | '@type' => $this->getTypeName(), |
| | | '@id' => $id, |
| | | ], array_filter($elements)); |
| | | } |
| | | |
| | |
| | | ); |
| | | |
| | | } |
| | | |
| | | public function showID(bool $showIt = true):void |
| | | { |
| | | $this->showID = $showIt; |
| | | } |
| | | } |