diff options
Diffstat (limited to 'includes/atom.php')
-rw-r--r-- | includes/atom.php | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/includes/atom.php b/includes/atom.php index be8d8f8..726c4b6 100644 --- a/includes/atom.php +++ b/includes/atom.php @@ -39,6 +39,8 @@ function atom_header($metadatafile) print("\t<author><name>" . $author . "</name></author>\n"); print("\t<link rel=\"self\" href=\"http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\" />\n"); + if (isset($license_rdf) && !empty($license_rdf)) + print("\t<link rel=\"license\" type=\"application/rdf+xml\" href=\"" . $license_rdf . "\" />\n"); if (isset($copyright) && !empty($copyright)) print("\t<rights>" . $copyright . "</rights>\n"); $description = extract_description($body); @@ -46,9 +48,9 @@ function atom_header($metadatafile) print("\t<description>" . $description . "</description>\n"); } -function create_entry($dir, $file) +function create_entry($dir, $file, $full) { - unset($title, $body, $summary, $author, $language, $category, $updated); + unset($title, $body, $summary, $author, $language, $category, $updated, $license_rdf); include($_SERVER['DOCUMENT_ROOT'] . "/" . $dir . "/" . $file); print("\t<entry>\n"); @@ -63,11 +65,15 @@ function create_entry($dir, $file) print("\t\t<author><name>" . $author . "</name></author>\n"); print("\t\t<link rel=\"alternate\" href=\"" . "http://" . $_SERVER['HTTP_HOST'] . "/" . $dir . "/" . $file . "\" />\n"); + if (isset($license_rdf) && !empty($license_rdf)) + print("\t\t<link rel=\"license\" type=\"application/rdf+xml\" href=\"" . $license_rdf . "\" />\n"); + $summary = extract_description($body); if (!empty($summary)) print("\t\t<summary>" . $summary . "</summary>\n"); - print("\t\t<content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\">" . $body . "</div></content>\n"); + if ($full) + print("\t\t<content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\">" . $body . "</div></content>\n"); $category = ereg_replace("^text", "", $dir); /* dir after text */ if (!empty($category)) @@ -76,17 +82,17 @@ function create_entry($dir, $file) print("\t</entry>\n"); } -function create_entries_from_dir($dir) +function create_entries_from_dir($dir, $full=false) { if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (!is_dir($file)) { if ($file[0] != "." && ereg(".php$", $file)) - create_entry($dir, $file); + create_entry($dir, $file, $full); } else { if ($file[0] != ".") - create_entries_from_dir($dir . "/" . $file); + create_entries_from_dir($dir . "/" . $file, $full); } } closedir($handle); |