4 This makes the core of the wiki page meta/ data framework, as it
5 represents the main user interface. It places a smaller <textarea>
6 below the edit/ box, which allows to add meta data for the edited
8 Such meta data is evaluated by other plugins to group pages together
9 or provide additional hints for users or for handling them in a
15 $ewiki_config["meta"]["rename_tag"] = array(
16 "description"=>"teaser", "desc"=>"teaser",
19 "forward"=>"next", "forw"=>"next",
21 # "pageno"=>"num", "no"=>"num", "number"=>"num", "n"=>"num",
23 $ewiki_config["meta"]["keep_string"] = array(
28 define("EWIKI_UP_METABOX", "edit_meta_data");
29 $ewiki_t["de"]["meta data"] = "Meta-Data";
33 $ewiki_plugins["edit_form_append"][] = "ewiki_aedit_metadata_box";
34 function ewiki_aedit_metadata_box($id, &$data, $action) {
38 #-- retrieve {meta} data
40 if ($m = $data["meta"]["meta"]) foreach ($m as $id => $line) {
41 if (!in_array($id, $ewiki_config["meta"]["keep_string"])) {
42 $line = preg_replace("/,\s*/", ", ", $line);
44 $val .= "$id: " . $line . "\n";
47 #-- show it up in an edit box
48 $var = EWIKI_UP_METABOX;
49 $val = htmlentities($val);
50 return(ewiki_t(<<< EOT
52 _{meta data}:<br /><textarea rows="4" cols="50" name="$var">$val</textarea>
59 #-- save into db {meta}{meta} field
60 $ewiki_plugins["edit_save"][] = "ewiki_edit_save_metadata";
61 function ewiki_edit_save_metadata(&$save, &$old_data) {
65 #-- clean old meta array (to allow for entry removal)
66 unset($save["meta"]["meta"]);
68 if ($val = trim($_REQUEST[EWIKI_UP_METABOX])) {
70 #-- walk through specified entries
71 preg_match_all('/^(\w+):(.+(?:(?:\n[^:\n]+)*\n)?)/m', $val, $uu);
73 foreach ($uu[1] as $i=>$name) {
76 $name = strtolower($name);
77 if ($new = $ewiki_config["meta"]["rename_tag"][$name]) {
82 if (!in_array($id, $ewiki_config["meta"]["keep_string"])) {
83 $str = preg_replace("/\s*,\s*/", ",", trim($uu[2][$i]));
86 #-- store (also empty strings)
87 $save["meta"]["meta"][$name] = $str;