From c765930a43410dc0259ddc12c6cce709604d73bc Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Thu, 4 Apr 2013 02:54:16 -0400 Subject: [PATCH] Support strings passed into processContext. --- jsonld.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jsonld.php b/jsonld.php index d22bff4..28dcc95 100644 --- a/jsonld.php +++ b/jsonld.php @@ -1,7 +1,7 @@ $ctx); + $local_ctx = self::copy($local_ctx); + if(is_string($local_ctx) or ( + is_object($local_ctx) && !property_exists($local_ctx, '@context'))) { + $local_ctx = (object)array('@context' => $local_ctx); } try { $this->_retrieveContextUrls( - $ctx, new stdClass(), $options['loadContext'], $options['base']); + $local_ctx, new stdClass(), $options['loadContext'], $options['base']); } catch(Exception $e) { throw new JsonLdException( @@ -1087,7 +1088,7 @@ class JsonLdProcessor { } // process context - return $this->_processContext($active_ctx, $ctx, $options); + return $this->_processContext($active_ctx, $local_ctx, $options); } /**