Ensure expand context URL option is processed.
This commit is contained in:
parent
8c0319895c
commit
44aae8c1a1
18
jsonld.php
18
jsonld.php
|
@ -796,6 +796,16 @@ class JsonLdProcessor {
|
||||||
'document' => self::copy($input),
|
'document' => self::copy($input),
|
||||||
'remoteContext' => (object)array(
|
'remoteContext' => (object)array(
|
||||||
'@context' => $remote_doc->contextUrl));
|
'@context' => $remote_doc->contextUrl));
|
||||||
|
if(isset($options['expandContext'])) {
|
||||||
|
$expand_context = self::copy($options['expandContext']);
|
||||||
|
if(is_object($expand_context) &&
|
||||||
|
property_exists($expand_context, '@context')) {
|
||||||
|
$input->expandContext = $expand_context;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$input->expandContext = (object)array('@context' => $expand_context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// retrieve all @context URLs in the input
|
// retrieve all @context URLs in the input
|
||||||
try {
|
try {
|
||||||
|
@ -813,13 +823,15 @@ class JsonLdProcessor {
|
||||||
$remote_context = $input->remoteContext->{'@context'};
|
$remote_context = $input->remoteContext->{'@context'};
|
||||||
|
|
||||||
// process optional expandContext
|
// process optional expandContext
|
||||||
if(isset($options['expandContext'])) {
|
if(property_exists($input, 'expandContext')) {
|
||||||
self::_processContext($active_ctx, $options->expandContext, $options);
|
$active_ctx = self::_processContext(
|
||||||
|
$active_ctx, $input->expandContext, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// process remote context from HTTP Link Header
|
// process remote context from HTTP Link Header
|
||||||
if($remote_context) {
|
if($remote_context) {
|
||||||
self::_processContext($active_ctx, $remote_context, $options);
|
$active_ctx = self::_processContext(
|
||||||
|
$active_ctx, $remote_context, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do expansion
|
// do expansion
|
||||||
|
|
Loading…
Reference in a new issue