Changeset 1096


Ignore:
Timestamp:
Jun 20, 2007, 7:54:54 PM (14 years ago)
Author:
Dominic Hargreaves
Message:

Add OpenSearch? description (references #180)

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MANIFEST

    r1092 r1096  
    142142t/76_detect_spam.t
    143143t/77_send_email.t
     144t/78_about.t
    144145t/templates/15_test.tt
    145146wiki.cgi
  • trunk/lib/OpenGuides.pm

    r1093 r1096  
    11241124}
    11251125
     1126=item B<display_about>
     1127
     1128                print $guide->display_about(format => "rdf");
     1129
     1130Displays static 'about' information in various format. Defaults to HTML.
     1131
     1132=cut
     1133
    11261134sub display_about {
    11271135    my ($self, %args) = @_;
     
    11891197
    11901198</rdf:RDF>};
    1191     }
    1192     else {
     1199    } elsif ($args{format} && $args{format} eq 'opensearch') {
     1200        my $site_name  = $self->config->site_name;
     1201        my $search_url = $self->config->script_url . 'search.cgi';
     1202        my $contact_email = $self->config->contact_email;
     1203        $output = qq{Content-Type: application/opensearchdescription+xml; charset=utf-8
     1204
     1205<?xml version="1.0" encoding="UTF-8"?>
     1206
     1207<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
     1208 <ShortName>$site_name</ShortName>
     1209 <Description>Search the $site_name</Description>
     1210 <Tags>$site_name</Tags>
     1211 <Contact>$contact_email</Contact>
     1212 <Url type="application/atom+xml"
     1213   template="$search_url?search={searchTerms};format=atom"/>
     1214 <Url type="application/rss+xml"
     1215   template="$search_url?search={searchTerms};format=rss"/>
     1216 <Url type="text/html"
     1217   template="$search_url?search={searchTerms}"/>
     1218 <Query role="example" searchTerms="pubs"/>
     1219</OpenSearchDescription>};
     1220    } else {
    11931221        my $site_name  = $self->config->{site_name};
    11941222        my $script_name = $self->config->{script_name};
Note: See TracChangeset for help on using the changeset viewer.