cvs: phpweb /include manual-lookup.inc shared-manual.inc site.inc
| From: | Hannes Magnusson | Date: | Fri, 10 Apr 2009 09:50:50 +0000 |
| Subject: | cvs: phpweb /include manual-lookup.inc shared-manual.inc site.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-4379@lists.php.net to get a copy of this message | ||
bjori Fri Apr 10 09:50:50 2009 UTC
Modified files:
/phpweb/include manual-lookup.inc shared-manual.inc site.inc
Log:
Add support for rev=canonical
# examples:
# http://www.php.net/manual/en/control-structures.continue.php
# => http://php.net/continue
# http://www.php.net/manual/en/function.strpos.php
# => http://php.net/strpos
# http://www.php.net/manual/en/language.oop5.overloading.php
# => http://no.php.net/oop5.overloading
http://cvs.php.net/viewvc.cgi/phpweb/include/manual-lookup.inc?r1=1.38&r2=1.39&diff_format=u
Index: phpweb/include/manual-lookup.inc
diff -u phpweb/include/manual-lookup.inc:1.38 phpweb/include/manual-lookup.inc:1.39
--- phpweb/include/manual-lookup.inc:1.38 Thu Apr 9 19:46:05 2009
+++ phpweb/include/manual-lookup.inc Fri Apr 10 09:50:49 2009
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: manual-lookup.inc,v 1.38 2009/04/09 19:46:05 philip Exp $
+// $Id: manual-lookup.inc,v 1.39 2009/04/10 09:50:49 bjori Exp $
// We need this for error reporting
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/errors.inc';
@@ -49,11 +49,7 @@
function find_manual_page_slow($lang, $keyword)
{
// Possible prefixes to test
- $sections = array(
- "", "book.", "ref.", "function.",
"class.",
- "feature-", "control-structures.", "language.",
- "about.", "faq.", "features.",
- );
+ $sections = get_manual_search_sections();
// Remove .. for security reasons
$keyword = str_replace("..", "", $keyword);
http://cvs.php.net/viewvc.cgi/phpweb/include/shared-manual.inc?r1=1.242&r2=1.243&diff_format=u
Index: phpweb/include/shared-manual.inc
diff -u phpweb/include/shared-manual.inc:1.242 phpweb/include/shared-manual.inc:1.243
--- phpweb/include/shared-manual.inc:1.242 Thu Jan 1 21:30:42 2009
+++ phpweb/include/shared-manual.inc Fri Apr 10 09:50:49 2009
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: shared-manual.inc,v 1.242 2009/01/01 21:30:42 bjori Exp $
+// $Id: shared-manual.inc,v 1.243 2009/04/10 09:50:49 bjori Exp $
/*
@@ -60,6 +60,23 @@
// Set base href for this manual page
$_SERVER['BASE_HREF'] = $MYSITE . $_SERVER['BASE_PAGE'];
+ // {{{ Build rev=canonical
+ $sections = get_manual_search_sections();
+ // Kill the first entry (empty)
+ array_shift($sections);
+
+ // We can at the very least kill the .php
+ $shorturl = substr($PGI['this'][0], 0, -4);
+
+ foreach($sections as $section) {
+ // If we know this section
+ if (strpos($PGI['this'][0], $section) === 0) {
+ // We can make it even shorter
+ $shorturl = substr($PGI['this'][0], strlen($section), -4);
+ }
+ }
+ // }}}
+
manual_sidebar();
site_header("$title - Manual", array(
"link" => array(
@@ -69,6 +86,11 @@
"next" => $PGI["next"][0],
"schema.dc" => "http://purl.org/dc/elements/1.1/",
"schema.rdfs" => "http://www.w3.org/2000/01/rdf-schema#",
+ array(
+ "rev" => "canonical",
+ "rel" => "self alternate shorter",
+ "href" => "http://php.net/" . $shorturl,
+ ),
),
"profile" => "http://purl.org/NET/erdf/profile",
));
http://cvs.php.net/viewvc.cgi/phpweb/include/site.inc?r1=1.264&r2=1.265&diff_format=u
Index: phpweb/include/site.inc
diff -u phpweb/include/site.inc:1.264 phpweb/include/site.inc:1.265
--- phpweb/include/site.inc:1.264 Tue Apr 7 17:05:40 2009
+++ phpweb/include/site.inc Fri Apr 10 09:50:49 2009
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: site.inc,v 1.264 2009/04/07 17:05:40 philip Exp $
+// $Id: site.inc,v 1.265 2009/04/10 09:50:49 bjori Exp $
// Define $MIRRORS array, and some constants
include $_SERVER['DOCUMENT_ROOT'] . '/include/mirrors.inc';
@@ -329,6 +329,16 @@
return $avail;
}
+// Get all manual prefix search sections
+function get_manual_search_sections() {
+ return array(
+ "", "book.", "ref.", "function.",
"class.",
+ "feature-", "control-structures.", "language.",
+ "about.", "faq.", "features.",
+ );
+}
+
+
// Guess the current site from what Apache tells us.
// This should be the main name of the mirror (in case
// it works under more then one name). SERVER_NAME is