Aquarionics

/home/a/aquarion/sites/www.aquarionics.com/epistula/chapters/meta.inc.php

All my code (That is, anything not in the "Others" list on the right) is BSD licenced.

You can also view this page as text/plain or colour-coded source


<?PHP
/*******************************************************************************
    Chapter - Meta
********************************************************************************

    Display metadata, including XML feeds of the site

    $Id: meta.inc.php,v 1.2 2004/06/04 09:49:41 aquarion Exp $

    $log$

*******************************************************************************/

#Meta Stuff

if ($wanted[1] == "xfml"){
    include("include/xfml.inc");
}elseif (isset($wanted[1]) && $wanted[1] != ""){
    $request = implode($wanted,"/");
    if (file_exists($request)){
        readfile($request);
        die();
    } 
    $file = explode(".",$wanted[1]);
    $title = $_EP['book']." - ".ucwords($file[0]);
    $url = $_EP['url']."/".$file[0];

    switch ($file[0]) {
        case "link":
        case "journal":
        case "writing":
        case "article":
            $types = array($file[0]);
            $items = getIndex($types,"full",10);
            break;
        
        case "postcard":
            $types = array($file[0]);
            $items = getIndex($types,"description",10);
            break;


        case "comment":
            $items = getCommentsIndex(10);
            break;

        #case "blink":
        #    $items = getBlinkIndex(10);
        #    break;

        case "moblog":
            $items = getMoblogIndex(10);
            break;

        case "all":
            $items = getIndex($types,"full",10);
            foreach($items as $index => $item){
                $items[$index]['title'] = ucwords($item['epistulatype'])." - ".$item['title'];
            }
            $url = $_EP['url'];
            $title = $_EP['book'];
            break;

        case "category":

            if (isset($wanted[2]) && !empty($wanted[2])){
                $file = explode(".",$wanted[2]);
                if (preg_match("/\+$/",$file[0])){
                    $file[0]=chop($file[0],"+");
                    $title .= " - ".$file[0]." and Subcategories";
                    $cats = getSubCats(getCatID(ep_decode($file[0])));
                    $cat_q .= "( cat_id=".array_pop($cats);
                    foreach ($cats as $kitten){
                        $cat_q .= " or cat_id = $kitten";
                    }
                    $cat_q .= ")";
                } else {
                    $title .= " - ".$file[0];
                    $cat_q = "cat_id = ".getCatID(ep_decode($file[0]));
                }
                $url = $_EP['url']."/category/".$file[0];
                #print_r($file);
                $display = "readmore";
                $items = getIndex($types,$display,20,", cat_links where $cat_q and [ITEM].id = page_id and page_type = \"[ITEM]\"");
            } else {
                $out = "To get the Syndication for a category, go to it's ".$page->ulink("/category/","archive")." page and click the desired format. Easy, huh? :-)";
            }
            break;

        default:
            $page->status = 404;
            $out = ""; 
        } 

    if (!strcasecmp ($wanted[0],"rss")){
        $items = array(
            "title" => "This feed is obsolete",
            "content" => "You're grabbing this feed from a place that it isn't published to any more. Please get your feed administrator to switch to the feed from its new location at http://www.aquarionics.com/meta/".$file[0].".".$file[1].".\n This URL will self destruct in about four weeks (March 1st 2003)",
            "epistulatype" => "journal",
            "id" => 992,
            "timestamp" => 000000001,
            "attachments" => array()
            );
            $page->status = 410;
    }
    if ($out){
        $page->content .= $page->item($out);
    } else {
        $object = strtolower($file[1]);
        $feed = new $object;
        $feed->title = $title;
        $feed->url = $url;
        $feed->description = $description;
        $feed->items = $items;
        $out = $feed->build();
        $finalOutput = $out;
    }
    /*$out = $feed->build();
    if (!strcasecmp ($file[1],"rss")){
        $out = $page->rssout($items);
    } elseif(!strcasecmp ($file[1],"rss2")) {
        #$out = $page->rss2out($items);

    } elseif(!strcasecmp ($file[1],"esf")) {
        $out = $page->esfout($items);
    }*/

} else {


    $feeds = array(
    #array("ext" => "rss",    "name" => "RSS 0.93",        "link" => "http://backend.userland.com/rss092/",        "title" => "Really Simple Syndication"),
    array("ext" => "rss2",    "name" => "RSS 2",        "link" => "http://backend.userland.com/rss",        "title" => "Really Simple Syndiction, but more complicated"),
    array("ext" => "esf",    "name" => "ESF",        "link" => "http://www.aquarionics.com/article/name/esf",        "title" => "Epistula Syndication Format"),
    array("ext" => "cdf",    "name" => "CDF",        "link" => "http://msdn.microsoft.com/library/default.asp?url=/workshop/delivery/channel/channel_node_entry.asp",        "title" => "Common Data Format or Channel Definition Format"),
    #array("ext" => "necho",    "name" => "Not Echo",        "link" => "http://http://www.intertwingly.net/pie",        "title" => "Not Echo, the Weblog XML format")
    );

    $page->title = "Meta Data";
    $out = "<i>Data... about data... is the happiest data...</i>";
    $out .= "<p>These are the various syndication formats I make Aquarionics available in. Yeah, Atom support will come when it becomes a fairly standard draft, since too much of my time with Netscape 4 to be happy supporting a format's mass acceptance before it's settled down.</p>";

    $out .= "<ul>\n";
    $out .= "\t<li><a href=\"/meta/xfml/\">XFML Feeds</a></li>";
    $out .= "\t<li>Syndication feeds:";
    #$out .= "\t<li> Front Page Feed (Everything) [ <a href=\"/meta/all.rss\">RSS 0.9</a> | "
    #    ."<a href=\"/meta/all.rss2\">RSS 2</a> | <a href=\"/meta/all.esf\">ESF</a> | <a href=\"/meta/all.cdf\">CDF</a> ]";

    $types[] = array("comment", "Latest Comments");
    $types[] = array("all", "Front Page");
    ksort($types);

    $menu = array();

    foreach ($feeds as $feed){
        $menu_out = $page->ulink( $feed['link'], $feed['name'], $feed['title'])." [ ";
        $index = 1;
        foreach ($types as $type){
            if (is_array($type)){
                $name = $type[0];
                $title = $type[1];
            } else {
                $name = $type;
                $title = $type;
            } 
            $menu_out .= $page->ulink("/meta/".$name.".".$feed['ext'],$title);
            if ($index == count($types)){
                $menu_out .= " ]";
            } else {
                $menu_out .= " | ";
            }
            $index++;
        }
        $menu[] = $menu_out;
    }
    $out .= $page->buildlist($menu);
    $out .= "\n</li>\n</ul>";

    /*
    foreach ($types as $type){
            if (is_array($type){
                $name = $type[0];
                $title = $type[1];
            } else {
                $name = $type;
                $title = $type;
            } 
            $out .= "\t<li> ".ucwords($title)." Feed ";
            
            $index = 0;
            foreach ($feeds as $feed)[ <a href=\"/meta/".$name.".rss\">RSS 0.9</a> | "
                    ."<a href=\"/meta/".$type.".rss2\">RSS 2</a> | <a href=\"/meta/".$type.".esf\">ESF</a> | <a href=\"/meta/".$type.".cdf\">CDF</a> ]</li>\n";
    }

        $out .= "\t<li> Comments Feed [ <a href=\"/meta/comment.rss\">RSS 0.9</a> | "
                ."<a href=\"/meta/comment.rss2\">RSS 2</a> | <a href=\"/meta/comment.esf\">ESF</a> | <a href=\"/meta/comment.cdf\">CDF</a> ]";

    $out .= "</ul>\n";
    */

    $page->content .= $out;
}

?>



Using a heavily customised version of Tom's PHPCode2ValidXHTML Thing

Nicholas 'Aquarion' Avenell is a web developer in London, you can find out more about him or how to get in touch.

There are more Articles, Projects, Journal Entries, Photographs and things that defy description here, too.

If you're looking for something specific, there are Calendar & Category -based lists of everything.

And if you want to follow stuff that appears here, try a Syndication Feed, or the generic Feed of everything.


Aquarion's last Twitter was: [updating]
Twitter last updated


© 2000 to 2008 inclusive Nicholas Avenell
All comments are the property of their creators, published with permission
(Unless otherwise indicated, the opinions and sentiments expressed on this site are those of the author and not of any organisation of which he is an affiliate, including his employer. Caveat Lector, E&OE. sigh)
0.029 seconds, 1 queries, 2.7Mb on Sat, 05 Jul 2008 10:45:09 +0000, Not cached
Generated by Epistula Version 2.0.3