cvs: php-gtk-web / manual-lookup-indexed2.php /include manual-lookup-indexed.inc
| From: | Christian Weiske | Date: | Fri, 27 Aug 2004 08:21:57 +0000 |
| Subject: | cvs: php-gtk-web / manual-lookup-indexed2.php /include manual-lookup-indexed.inc | ||
| Groups: | php.gtk.webmaster | ||
| Request: | Send a blank email to php-gtk-webmaster+get-2585@lists.php.net to get a copy of this message | ||
cweiske Fri Aug 27 04:21:57 2004 EDT
Modified files:
/php-gtk-web manual-lookup-indexed2.php
/php-gtk-web/include manual-lookup-indexed.inc
Log:
Basic file title creation on the search results page (only on
classified view, means indexed2.php)
http://cvs.php.net/diff.php/php-gtk-web/manual-lookup-indexed2.php?r1=1.1&r2=1.2&ty=u
Index: php-gtk-web/manual-lookup-indexed2.php
diff -u php-gtk-web/manual-lookup-indexed2.php:1.1 php-gtk-web/manual-lookup-indexed2.php:1.2
--- php-gtk-web/manual-lookup-indexed2.php:1.1 Tue Aug 24 16:41:20 2004
+++ php-gtk-web/manual-lookup-indexed2.php Fri Aug 27 04:21:54 2004
@@ -32,7 +32,7 @@
if( $function == '') {
commonHeader( 'no search string');
- echo '<br/> <h1>No search string given</h1><br/>';
+ echo '<h1>No search string given</h1><br/>';
commonFooter();
die();
@@ -55,8 +55,8 @@
{
//nothing found
commonHeader( '404 Not Found');
- echo '<br/> <h1>Not Found</h1><br/>';
- echo ' No class/signal/method containing <strong>"' . $function .
'"</strong> could be found.';
+ echo '<h1>Not Found</h1><br/>';
+ echo 'No class/signal/method containing <strong>"' . $function .
'"</strong> could be found.';
if( isset( $_SERVER['HTTP_REFERER'])) {
echo '<br/><a href="' . $_SERVER['HTTP_REFERER'] .
'">Try
again</a><br/><br/><br/><br/><br/><br/><br/>';
@@ -102,7 +102,7 @@
echo '<h3>' . $strSectionName . ' ' . count(
$arSections[$strSection]) . 'x</h3>';
echo '<ul>';
foreach( $arSections[$strSection] as $strFile) {
- echo '<li><a href="' . getManualLocation( $strLang,
$strFile) . '">' . $strFile . '</a></li>';
+ echo '<li><a href="' . getManualLocation( $strLang,
$strFile) . '">' . getFileTitle( $strFile, $strSection) .
'</a></li>';
}
echo '</ul>';
}
http://cvs.php.net/diff.php/php-gtk-web/include/manual-lookup-indexed.inc?r1=1.1&r2=1.2&ty=u
Index: php-gtk-web/include/manual-lookup-indexed.inc
diff -u php-gtk-web/include/manual-lookup-indexed.inc:1.1
php-gtk-web/include/manual-lookup-indexed.inc:1.2
--- php-gtk-web/include/manual-lookup-indexed.inc:1.1 Tue Aug 24 16:41:20 2004
+++ php-gtk-web/include/manual-lookup-indexed.inc Fri Aug 27 04:21:57 2004
@@ -430,6 +430,75 @@
/**
+* returns the file title for the given file
+* for efficient working, the category has to be given
+*
+* The function tries to get the file title with some algorithms,
+* NOT from the direct html files.
+*
+* @param string The file name, e.g. gtk.gtkcolorselection.method.get_color.php
+* @param string The category of the file, e.g. class/enum/constructor/...
+*
+* @return string The file title, can be used for link titles
+*/
+function getFileTitle( $strFilename, $strCategory)
+{
+ $arParts = explode( '.', $strFilename);
+
+ switch( $strCategory)
+ {
+ case 'class':
+ return niceClassName( $arParts[1]);
+ case 'constructor':
+ return niceClassName( $arParts[1]) . ' constructor';
+ case 'method':
+ if( count( $arParts) == 5) {//class with method
+ return niceClassName( $arParts[1]) . '::' . $arParts[3] . '()';
+ } else {//gtk/gdk method
+ return niceClassName( $arParts[0]) . '::' . $arParts[2] . '()';
+ }
+ case 'property':
+ if( count( $arParts) == 5) {//class property
+ return niceClassName( $arParts[1]) . '::' . $arParts[3];
+ } else {//gtk/gdk property
+ return niceClassName( $arParts[0]) . '::' . $arParts[2];
+ }
+ case 'signal':
+ if( count( $arParts) == 5) {//class signal
+ return niceClassName( $arParts[1]) . ': ' . $arParts[3];
+ } else {//gtk/gdk signal
+ return niceClassName( $arParts[0]) . ': ' . $arParts[2];
+ }
+ default:
+ return $strFilename;
+ }
+}//function getFileTitle( $strFilename, $strCategory)
+
+
+
+/**
+* makes a nice class name from a lowercase name
+* given "gdkcolor" it returns "GdkColor"
+*
+* @param string The lowercase class name
+* @return string The nice cased class name
+*/
+function niceClassName( $strLowercaseClass)
+{
+ $strPrefix = substr( $strLowercaseClass, 0, 3);
+ if( $strPrefix == 'gdk' || $strPrefix == 'gtk')
+ {
+ $strNice = ucfirst( $strPrefix) . ucfirst( substr( $strLowercaseClass, 3));
+ } else {
+ $strNice = ucfirst( $strLowercaseClass);
+ }
+
+ return $strNice;
+}//function niceClassName( $strLowercaseClass)
+
+
+
+/**
* Looks up a given word in the index
* useful for debugging
*/