aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/extender.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/extender.php')
-rw-r--r--engine/lib/extender.php34
1 files changed, 30 insertions, 4 deletions
diff --git a/engine/lib/extender.php b/engine/lib/extender.php
index 26166a225..5a5d29e08 100644
--- a/engine/lib/extender.php
+++ b/engine/lib/extender.php
@@ -41,9 +41,9 @@
switch ($this->attributes['value_type'])
{
case 'integer' : return (int)$this->attributes['value'];
- case 'tag' :
- case 'text' :
- case 'file' : return sanitise_string($this->attributes['value']);
+ //case 'tag' :
+ //case 'file' :
+ case 'text' : return sanitise_string($this->attributes['value']);
default : throw new InstallationException("Type {$this->attributes['value_type']} is not supported. This indicates an error in your installation, most likely caused by an incomplete upgrade.");
}
@@ -59,10 +59,14 @@
*
* @param string $name
* @param mixed $value
+ * @param string $value_type
* @return boolean
*/
- protected function set($name, $value) {
+ protected function set($name, $value, $value_type = "") {
+
$this->attributes[$name] = $value;
+ $this->attributes['value_type'] = detect_extender_valuetype($value, $value_type);
+
return true;
}
@@ -163,6 +167,28 @@
}
/**
+ * Detect the value_type for a given value.
+ * Currently this is very crude.
+ *
+ * TODO: Make better!
+ *
+ * @param mixed $value
+ * @param string $value_type If specified, overrides the detection.
+ * @return string
+ */
+ function detect_extender_valuetype($value, $value_type = "")
+ {
+ if ($value_type!="")
+ return $value_type;
+
+ // This is crude
+ if (is_int($value)) return 'integer';
+ if (is_numeric($value)) return 'integer';
+
+ return 'text';
+ }
+
+ /**
* Handler called by trigger_plugin_hook on the "import" event.
*/
function import_extender_plugin_hook($hook, $entity_type, $returnvalue, $params)