nlopess         Sun Mar 21 08:59:42 2004 EDT

  Added files:                 
    /livedocs   handlers.php 

  Removed files:               
    /livedocs   livedoc-index.php 

  Modified files:              
    /livedocs   configure.in livedoc.php 
  Log:
  fixing index for DYNAMIC
  moving all special handlers to handlers.php
  
http://cvs.php.net/diff.php/livedocs/configure.in?r1=1.19&r2=1.20&ty=u
Index: livedocs/configure.in
diff -u livedocs/configure.in:1.19 livedocs/configure.in:1.20
--- livedocs/configure.in:1.19  Sat Mar 20 11:07:29 2004
+++ livedocs/configure.in       Sun Mar 21 08:59:42 2004
@@ -1,5 +1,5 @@
 ## A configure script
-## $Id: configure.in,v 1.19 2004/03/20 16:07:29 didou Exp $
+## $Id: configure.in,v 1.20 2004/03/21 13:59:42 nlopess Exp $
 
 AC_PREREQ(2.13)
 AC_INIT(livedoc.php)
@@ -130,13 +130,14 @@
   AC_MSG_ERROR([HEY!! You should probably mkdir $OUTPUTDIR...])
 else
   echo "Copying livedoc files to $OUTPUTDIR..."
-  cp common.php config.php livedoc-index.php .htaccess $OUTPUTDIR
+  cp common.php config.php .htaccess $OUTPUTDIR
   rm -f .htaccess
   $lncmd $LIVEDOCS/livedoc.php $OUTPUTDIR/index.php
   $lncmd $LIVEDOCS/error.php $OUTPUTDIR/error.php
   $lncmd $LIVEDOCS/style_mapping.php $OUTPUTDIR/style_mapping.php
   $lncmd $LIVEDOCS/xml_classes.php $OUTPUTDIR/xml_classes.php
   $lncmd $LIVEDOCS/search.php $OUTPUTDIR/search.php
+  $lncmd $LIVEDOCS/handlers.php $OUTPUTDIR/handlers.php
   rm -rf $OUTPUTDIR/themes
   $lncmd $LIVEDOCS/themes $OUTPUTDIR/themes
   echo ""
http://cvs.php.net/diff.php/livedocs/livedoc.php?r1=1.84&r2=1.85&ty=u
Index: livedocs/livedoc.php
diff -u livedocs/livedoc.php:1.84 livedocs/livedoc.php:1.85
--- livedocs/livedoc.php:1.84   Sun Mar 21 06:17:54 2004
+++ livedocs/livedoc.php        Sun Mar 21 08:59:42 2004
@@ -18,13 +18,13 @@
 // | Generate an HTML version of a phpdoc/docbook page on the fly         |
 // +----------------------------------------------------------------------+
 //
-// $Id: livedoc.php,v 1.84 2004/03/21 11:17:54 nlopess Exp $
+// $Id: livedoc.php,v 1.85 2004/03/21 13:59:42 nlopess Exp $
 
 define('LIVEDOC_SOURCE', dirname(__FILE__));
 include LIVEDOC_SOURCE . '/common.php';
 include LIVEDOC_SOURCE . '/xml_classes.php';
 include LIVEDOC_SOURCE . '/style_mapping.php';
-include LIVEDOC_SOURCE . '/livedoc-index.php';
+include LIVEDOC_SOURCE . '/handlers.php';
 include LIVEDOC_SOURCE . '/themes/' . THEME_NAME . '/html_format.php';
 
 if (!isset($_GET['q'])) {
@@ -46,16 +46,16 @@
  */
 $aliases = array(
        'api'             => 'streams',
-       'appendixes'      => 'handle_appendixes',
+       'appendixes'      => 'handle_appendixes_funcref',
        'faq'             => 'faq.general',
        'features'        => 'features.http-auth',
-       'funcref'         => 'handle_funcref',
+       'funcref'         => 'handle_appendixes_funcref',
        'getting-started' => 'introduction',
        'installation'    => 'install.general',
        'langref'         => 'language.basic-syntax',
        'manual'          => 'handle_contents',
        'security'        => 'security.index',
-       'indexes'         => 'func_index'
+       'indexes'         => 'handle_index'
 );
 
 if (isset($_GET['i'])) {
@@ -63,7 +63,7 @@
        list($title, $filename, $fileid, $dirid) = do_nav($idx, $fb_idx, $lang, 
$current_page, $nav, $children);
 
        echo manual_page_header();
-       func_index();
+       handle_index();
        $filename = 'index';
        $file_revision = '1.1';
        echo manual_page_footer();
@@ -444,31 +444,6 @@
        return "<xref linkend=\"$id\">$title</xref>";
 }
 
-function handle_funcref() 
-{
-       global $current_page_title, $children, $lang;
-
-       $ret = "<h1>$current_page_title</h1>\n";
-       foreach ($children as $id => $title) {
-               $url = generate_url_for_id($lang, $id);
-               $ret .= "<h2 class='funcref'><a href='$url'>$title</a></h2>\n";
-       }
-       return $ret."<br /><br />";
-}
-
-function handle_appendixes() 
-{
-       global $current_page_title, $children, $lang;
-
-       $ret = "<h1>$current_page_title</h1>\n";
-       foreach ($children as $id => $title) {
-               $url = generate_url_for_id($lang, $id);
-               $ret .= "<h2 class='funcref'><a href='$url'>$title</a></h2>\n";
-       }
-       return $ret . "<br /><br />";
-       
-}
-
 function do_contents($id, $level) 
 {
        global $lang;
@@ -498,13 +473,6 @@
        return $ret .= "</ul>\n";
 }
 
-function handle_contents() 
-{
-       global $current_page_title, $children, $lang;
-
-       return "<center><h1>PHP Manual</h1></center><h2>Contents</h2>" . 
do_contents(1, 0);
-}
-
 function handle_include($node) 
 {
        $filename = BASE . strtr($node->attributes['ref'], '.', '/') . '.xml';

http://cvs.php.net/co.php/livedocs/handlers.php?r=1.1&p=1
Index: livedocs/handlers.php
+++ livedocs/handlers.php
<?php
/* vim: set tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.php.net/license/3_0.txt.                                  |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | [EMAIL PROTECTED] so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Wez Furlong, Derick Rethans, Ilia Alshanetsky               |
// +----------------------------------------------------------------------+
// | Special Handlers for $aliases                                        |
// +----------------------------------------------------------------------+
//
// $Id: handlers.php,v 1.1 2004/03/21 13:59:42 nlopess Exp $


/***********************************
  Appendixes & Function Reference
************************************/

function handle_appendixes_funcref() 
{
        global $current_page_title, $children, $lang;

        $ret = "<h1>$current_page_title</h1>\n";
        foreach ($children as $id => $title) {
                $url = generate_url_for_id($lang, $id);
                $ret .= "<h2 class='funcref'><a href='$url'>$title</a></h2>\n";
        }
        return $ret . "<br /><br />";
        
}


/*******************
    First Page
********************/

function handle_contents() 
{
        return '<center><h1>PHP Manual</h1></center><h2>Contents</h2>' . 
do_contents(1, 0);
}

/*******************
   Function Index
********************/

function handle_index() {
        GLOBAL $idx, $lang, $FORCE_DYNAMIC;

        $alphabet = range('a', 'z');
        foreach ($alphabet as $char) {
                echo "<a href='" . WEBBASE . "index.php?l=$lang&i=$char'>$char</a> ";
        }

        echo "</div><hr />\n";

        /* Sanitize index letter */
        if (!isset($_GET['i'])) {
                $idxl = 'a';
        } else {
                $idxl = substr($_GET['i'], 0, 1);
        }

        /* Create function call back for STARTS_WITH and TO_LOWER */
        sqlite_create_function($idx, 'STARTS_WITH', 'sqlite_starts_with');
        sqlite_create_function($idx, 'TO_LOWER', 'strtolower');

        /* Select all titles starting with $idxl */
        $q = sqlite_query($idx, "SELECT title, id FROM idents WHERE STARTS_WITH(title, 
'$idxl') ORDER BY TO_LOWER(title)");
        if ($q) {
                while ($r = sqlite_fetch_array($q, SQLITE_NUM)) {
                        list($title, $id) = $r;
                        $url = FORCE_DYNAMIC ? "?l=$lang&q=$id#$id" : "$lang/$id#$id";
                        echo "<span class='index'><a href='" . WEBBASE . 
"$url'>$title</a></span><br />\n";
                }
        }
}

function sqlite_starts_with($title, $char) {
        $title = strtolower($title);
        $char  = strtolower($char);
        if (!strlen($title) || !strlen($char)) {
                return FALSE;
        }
        return ($title{0} == $char{0});
}
?>

Reply via email to