]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added remove_subtype() and update_subtype().
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 23 Mar 2010 20:06:36 +0000 (20:06 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 23 Mar 2010 20:06:36 +0000 (20:06 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5488 36083f99-b078-4883-b0ff-0f9b5a30f544

CHANGES.txt
engine/lib/entities.php

index 3d64def69fae342d2d410363650116880540f5cb..074aa6c62f6bb0eab47d1ca63f76822129499d12 100644 (file)
@@ -5,6 +5,7 @@ Version 1.8.0
 
  Generic API changes:
   * Added elgg_instanceof().
+  * Added remove_subtype() and update_subtype().
 
  UI/UX API changes:
   * Added elgg_push_breadcrumb(), elgg_pop_breadcrumb(), and elgg_get_breadcrumbs().
index fd46b062dbe1715de1d67ee4262454e0132ce3c9..e3fa0cb52697db0c37455b0b8032f5255ee115f8 100644 (file)
@@ -1461,6 +1461,44 @@ function add_subtype($type, $subtype, $class = "") {
        return $id;
 }
 
+/**
+ * Removes a registered subtype
+ *
+ * @param string $type
+ * @param string $subtype
+ */
+function remove_subtype($type, $subtype) {
+       global $CONFIG;
+
+       $type = sanitise_string($type);
+       $subtype = sanitise_string($subtype);
+
+       return delete_data("DELETE FROM {$CONFIG->dbprefix}entity_subtypes WHERE type = '$type' AND subtype = '$subtype'");
+}
+
+/**
+ * Update the registered information
+ *
+ * @param string $type
+ * @param string $subtype
+ * @param string $class
+ */
+function update_subtype($type, $subtype, $class = '') {
+       global $CONFIG;
+
+       if (!$id = get_subtype_id($type, $subtype)) {
+               return FALSE;
+       }
+       $type = sanitise_string($type);
+       $subtype = sanitise_string($subtype);
+
+       return update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes
+               SET type = '$type', subtype = '$subtype', class = '$class'
+               WHERE id = $id
+       ");
+}
+
+
 /**
  * Update an existing entity.
  *