aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/metastrings.php
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-11 11:08:39 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-11 11:08:39 +0000
commitbe6535c536471feae1c16299d3d8121c9feabd5b (patch)
tree29ce114154a0710d2ec6f8889e25e127bd3a83c8 /engine/lib/metastrings.php
parent1ad8a0f51959a7bcbf6e2f77e9f40f0d2f80bf64 (diff)
downloadelgg-be6535c536471feae1c16299d3d8121c9feabd5b.tar.gz
elgg-be6535c536471feae1c16299d3d8121c9feabd5b.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Added metadata/metastrings tag stuff. Lorks. git-svn-id: https://code.elgg.org/elgg/trunk@151 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/metastrings.php')
-rw-r--r--engine/lib/metastrings.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php
new file mode 100644
index 000000000..17c9a751b
--- /dev/null
+++ b/engine/lib/metastrings.php
@@ -0,0 +1,34 @@
+<?php
+ /**
+ * Elgg metastrngs
+ * Functions to manage object metastrings.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey <marcus@dushka.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+
+ /**
+ * Add a metastring.
+ * It returns the id of the tag, whether by creating it or updating it.
+ *
+ * @param string $tag The value (whatever that is) to be stored
+ * @return mixed Integer tag or false.
+ */
+ function add_metastring($tag)
+ {
+ global $CONFIG;
+
+ $tag = sanitise_string($tag);
+
+ $row = get_data_row("SELECT * from {$CONFIG->dbprefix}metastrings where tag='$tag' limit 1");
+ if ($row)
+ return $row->id;
+
+ return insert_data("INSERT into {$CONFIG->dbprefix}metastrings (tag) values ('$tag')");
+ }
+?> \ No newline at end of file