init_json_filters(). */ public function __construct( &$plugin ) { $this->p =& $plugin; if ( $this->p->debug->enabled ) { $this->p->debug->mark(); } $this->p->util->add_plugin_filters( $this, array( 'json_data_https_schema_org_place' => 5, ) ); } public function filter_json_data_https_schema_org_place( $json_data, $mod, $mt_og, $page_type_id, $is_main ) { if ( $this->p->debug->enabled ) { $this->p->debug->mark(); } /* * Possibly inherit the schema type. */ if ( $this->p->debug->enabled ) { if ( ! empty( $json_data ) ) { $this->p->debug->log( 'possibly inherit the schema type' ); $this->p->debug->log_arr( 'json_data', $json_data ); } } $json_ret = WpssoSchema::get_data_context( $json_data ); // Returns array() if no schema type found. if ( $this->p->debug->enabled ) { $this->p->debug->log_arr( 'json_ret', $json_ret ); } /* * Add the Place. */ WpssoSchemaSingle::add_place_data( $json_ret, $mod, $place_id = null, $list_el = 'merge' ); /* * Add media. * * See https://schema.org/image as https://schema.org/ImageObject. * See https://schema.org/subjectOf as https://schema.org/VideoObject. */ if ( $this->p->debug->enabled ) { $this->p->debug->log( 'adding image and subjectOf properties for place' ); } WpssoSchema::add_media_data( $json_ret, $mod, $mt_og, $size_names = 'schema', $add_video = 'subjectOf' ); if ( $this->p->debug->enabled ) { $this->p->debug->log( 'merging json_data and json_ret arrays' ); $this->p->debug->log_arr( 'json_data', $json_data ); $this->p->debug->log_arr( 'json_ret', $json_ret ); } return WpssoSchema::return_data_from_filter( $json_data, $json_ret, $is_main ); } } }