aboutsummaryrefslogtreecommitdiff
path: root/engine/classes
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes')
-rw-r--r--engine/classes/ElggAnnotation.php22
-rw-r--r--engine/classes/ElggEntity.php5
-rw-r--r--engine/classes/ElggMetadata.php24
3 files changed, 45 insertions, 6 deletions
diff --git a/engine/classes/ElggAnnotation.php b/engine/classes/ElggAnnotation.php
index 10f4269cf..274cbb923 100644
--- a/engine/classes/ElggAnnotation.php
+++ b/engine/classes/ElggAnnotation.php
@@ -78,7 +78,27 @@ class ElggAnnotation extends ElggExtender {
* @return bool
*/
function delete() {
- return delete_annotation($this->id);
+ return elgg_delete_metastring_based_object_by_id($this->id, 'annotations');
+ }
+
+ /**
+ * Disable the annotation.
+ *
+ * @return bool
+ * @since 1.8
+ */
+ function disable() {
+ return elgg_set_metastring_based_object_enabled_by_id($this->id, 'no', 'annotations');
+ }
+
+ /**
+ * Enable the annotation.
+ *
+ * @return bool
+ * @since 1.8
+ */
+ function enable() {
+ return elgg_set_metastring_based_object_enabled_by_id($this->id, 'yes', 'annotations');
}
/**
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index ea2a329d9..4e1bc586c 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -292,9 +292,9 @@ abstract class ElggEntity extends ElggData implements
public function setMetaData($name, $value, $value_type = "", $multiple = false) {
if (is_array($value)) {
unset($this->temp_metadata[$name]);
- remove_metadata($this->getGUID(), $name);
foreach ($value as $v) {
if ((int) $this->guid > 0) {
+ elgg_delete_metadata(array('guid' => $this->guid, 'metadata_name' => $name));
$multiple = true;
if (!create_metadata($this->getGUID(), $name, $v, $value_type,
$this->getOwnerGUID(), $this->getAccessID(), $multiple)) {
@@ -349,7 +349,7 @@ abstract class ElggEntity extends ElggData implements
*
* @return mixed bool
*/
- public function clearMetaData($name = "") {
+ public function clearMetaData($name = '') {
if (empty($name)) {
return clear_metadata($this->getGUID());
} else {
@@ -357,7 +357,6 @@ abstract class ElggEntity extends ElggData implements
}
}
-
/**
* Get a piece of volatile (non-persisted) data on this entity.
*
diff --git a/engine/classes/ElggMetadata.php b/engine/classes/ElggMetadata.php
index 9c13e936e..f85bac6ce 100644
--- a/engine/classes/ElggMetadata.php
+++ b/engine/classes/ElggMetadata.php
@@ -75,12 +75,32 @@ class ElggMetadata extends ElggExtender {
}
/**
- * Delete a given metadata.
+ * Delete the metadata
*
* @return bool
*/
function delete() {
- return delete_metadata($this->id);
+ return elgg_delete_metastring_based_object_by_id($this->id, 'metadata');
+ }
+
+ /**
+ * Disable the metadata
+ *
+ * @return bool
+ * @since 1.8
+ */
+ function disable() {
+ return elgg_set_metastring_based_object_enabled_by_id($this->id, 'no', 'metadata');
+ }
+
+ /**
+ * Disable the metadata
+ *
+ * @return bool
+ * @since 1.8
+ */
+ function enable() {
+ return elgg_set_metastring_based_object_enabled_by_id($this->id, 'yes', 'metadata');
}
/**