From 4a990db44980aee2b88c1ceecfe71e697d173556 Mon Sep 17 00:00:00 2001 From: Nick White Date: Fri, 18 Sep 2009 08:25:29 +0100 Subject: Added license link and use atom for excerpt Added optional license rdf link to feeds Use atom for excerpt feed also --- atom-excerpt.php | 27 +++++++++++++++++++++++++++ atom.php | 2 +- includes/atom.php | 18 ++++++++++++------ includes/header.php | 2 +- 4 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 atom-excerpt.php diff --git a/atom-excerpt.php b/atom-excerpt.php new file mode 100644 index 0000000..27832e3 --- /dev/null +++ b/atom-excerpt.php @@ -0,0 +1,27 @@ +. + */ + +include($_SERVER['DOCUMENT_ROOT'] . "/includes/atom.php"); + +atom_header("/text/index.php"); + +create_entries_from_dir("text", false); + +atom_footer(); + +?> diff --git a/atom.php b/atom.php index f33f81d..daa0ff3 100644 --- a/atom.php +++ b/atom.php @@ -20,7 +20,7 @@ include($_SERVER['DOCUMENT_ROOT'] . "/includes/atom.php"); atom_header("/text/index.php"); -create_entries_from_dir("text"); +create_entries_from_dir("text", true); atom_footer(); 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 . "\n"); print("\t\n"); + if (isset($license_rdf) && !empty($license_rdf)) + print("\t\n"); if (isset($copyright) && !empty($copyright)) print("\t" . $copyright . "\n"); $description = extract_description($body); @@ -46,9 +48,9 @@ function atom_header($metadatafile) print("\t" . $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\n"); @@ -63,11 +65,15 @@ function create_entry($dir, $file) print("\t\t" . $author . "\n"); print("\t\t\n"); + if (isset($license_rdf) && !empty($license_rdf)) + print("\t\t\n"); + $summary = extract_description($body); if (!empty($summary)) print("\t\t" . $summary . "\n"); - print("\t\t
" . $body . "
\n"); + if ($full) + print("\t\t
" . $body . "
\n"); $category = ereg_replace("^text", "", $dir); /* dir after text */ if (!empty($category)) @@ -76,17 +82,17 @@ function create_entry($dir, $file) print("\t
\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); diff --git a/includes/header.php b/includes/header.php index cb0ef21..e03a7d6 100644 --- a/includes/header.php +++ b/includes/header.php @@ -35,7 +35,7 @@ function xhtml_header($title) ' . $newtitle . ' - + -- cgit v1.2.3