aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_rss.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-08 21:33:13 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-08 21:33:13 +0100
commit250cd79251f5474915ad2230e786db70643b0ef3 (patch)
tree3b757a544dfb0239bd119b953c316d27860f70cf /lib/lib_rss.php
parent0e4e16ac55097aa173c7c439367294ebd7645562 (diff)
parentb23fc3187cb90800aad6417badf7822a8d280b74 (diff)
Merge branch '252-extensions' into dev
Diffstat (limited to 'lib/lib_rss.php')
-rw-r--r--lib/lib_rss.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index ffd56eae4..083e87745 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -375,6 +375,7 @@ function recursive_unlink($dir) {
if (!is_dir($dir)) {
return true;
}
+
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $filename) {
$filename = $dir . '/' . $filename;
@@ -385,6 +386,7 @@ function recursive_unlink($dir) {
unlink($filename);
}
}
+
return rmdir($dir);
}
@@ -404,3 +406,26 @@ function remove_query_by_get($get, $queries) {
}
return $final_queries;
}
+
+
+/**
+ * Add a value in an array and take care it is unique.
+ * @param $array the array in which we add the value.
+ * @param $value the value to add.
+ */
+function array_push_unique(&$array, $value) {
+ $found = array_search($value, $array) !== false;
+ if (!$found) {
+ $array[] = $value;
+ }
+}
+
+
+/**
+ * Remove a value from an array.
+ * @param $array the array from wich value is removed.
+ * @param $value the value to remove.
+ */
+function array_remove(&$array, $value) {
+ $array = array_diff($array, array($value));
+}