diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..677166a --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "devium/toml": "*" + } +} diff --git a/includes/GlModelHooks.php b/includes/GlModelHooks.php index 1ab8bbe..82d4c40 100644 --- a/includes/GlModelHooks.php +++ b/includes/GlModelHooks.php @@ -44,7 +44,7 @@ class GlModelHooks { } /** - * Render the config json in a
tag
+ * Render the config toml in a tag
*
* @param $input The text inside the custom tag
* @param array $args Any attributes given in the tag
@@ -170,15 +170,8 @@ class GlModelHooks {
$uploadFormObj->mComment .= <<
- {
- "viewerConfig": {
- "default": {
- "camera-controls": true
- }
- },
- "annotations": {},
- "annotationSets": {}
- }
+ [viewerConfig.default]
+ camera-controls = true
CONF;
}
diff --git a/includes/GlModelTransformOutput.php b/includes/GlModelTransformOutput.php
index d8ca64e..87e57af 100644
--- a/includes/GlModelTransformOutput.php
+++ b/includes/GlModelTransformOutput.php
@@ -1,6 +1,9 @@
file->getDescriptionText();
preg_match('/([\S\s]*?)<\/pre>/',$descriptText,$modelDescript);
- $metadata = json_decode($modelDescript[1], true);
+ $metadata = toml_decode($modelDescript[1], true);
if ($this->thumb) {
$poster = $metadata['viewerConfig'][$this->view]['poster'] ?? false;