]> git.mjollnir.org Git - s9y.git/commitdiff
Commit falks method :)
authorgarvinhicking <garvinhicking>
Wed, 21 Jun 2006 10:24:17 +0000 (10:24 +0000)
committergarvinhicking <garvinhicking>
Wed, 21 Jun 2006 10:24:17 +0000 (10:24 +0000)
include/plugin_api_extension.inc.php

index 0e67c290843efd9b3cc9e729847aafadacb218af..9dd5e2d5808b30243fed0b5e9855945679c0f805 100644 (file)
@@ -41,6 +41,33 @@ class serendipity_plugin_api_extension extends serendipity_plugin_api
         return $array;
     }
 
+    /**
+     * Prepare a given one dimension array for deleting
+     *
+     * @access public
+     * @author Falk Doering
+     * @param  array  the array
+     * @param  string the key of the main id
+     * @param  string the key of the parent id
+     * @return array  the final array with one new keys: 'delete' with true or false
+     */
+    function prepareDelete($array, $this_id = 'id', $parent_id = 'parent_id')
+    {
+        global $serendipity;
+
+        if (is_array($array)) {
+            for ($i = 0, $ii = count($array); $i < $ii; $i++) {
+                if (isset($array[$i+1]) && ($array[$i+1][$parent_id] == $array[$i][$this_id])) {
+                   $array[$i]['delete'] = false;
+               } else {
+                   $array[$i]['delete'] = true;
+               }
+            }
+        }
+        return $array;
+    }
+
+
     /**
      * Update table for re-ordering
      *