[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/reference/ -> ezreference.php (source)

   1  <?php
   2  //
   3  // Created on: <18-Apr-2002 10:04:48 amos>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  include_once ( 'kernel/common/template.php' );
  28  
  29  /*!
  30   Reads the doxygen generated HTML file and replaces hrefs and CSS classes
  31   with eZ publish&trade; SDK related ones.
  32  */
  33  function &referenceReadFile( $file, $htmlRoot, $base )
  34  {
  35      include_once ( "lib/ezutils/classes/ezsys.php" );
  36  
  37      // Settings for NVH setup
  38      $pathPrepend = eZSys::wwwDir();
  39      $indexPathPrepend = eZSys::indexDir();
  40  
  41      $fd = fopen( $file, "rb" );
  42      $data = fread( $fd, filesize( $file ) );
  43      fclose( $fd );
  44      $pos = strpos( $data, "<hr>" );
  45      if ( $pos !== false )
  46      {
  47          $data = substr( $data, $pos + 4 );
  48      }
  49      $id = "[a-zA-Z0-9_]+";
  50      $data = preg_replace( array( "/class=\"([^\"]+)\"/",
  51                                   "/<h1/",
  52                                   "/<caption/",
  53                                   "/<body/",
  54                                   "/src=\"(class($id)\.png)\"/",
  55                                   "/href=\"class($id)-members\.html(#$id)?\"/",
  56                                   "/href=\"class($id)\.html(#$id)?\"/",
  57                                   "/href=\"group__($id)\.html(#$id)?\"/",
  58                                   "/href=\"deprecated\.html(#$id)?\"/",
  59                                   "/href=\"todo\.html(#$id)?\"/",
  60                                   "/href=\"($id)_8php\.html(#$id)?\"/",
  61                                   "/href=\"($id)_8php-source\.html(#$id)?\"/"
  62                                   ),
  63                            array( "class=\"dox_$1\"",
  64                                   "<h1 class=\"dox\"",
  65                                   "<caption class=\"dox\"",
  66                                   "<body class=\"dox\"",
  67                                   "src=\"$pathPrepend/$htmlRoot/$1\"",
  68                                   "href=\"$indexPathPrepend$base/members/$1$2\"",
  69                                   "href=\"$indexPathPrepend$base/class/$1$2\"",
  70                                   "href=\"$indexPathPrepend$base/module/$1$2\"",
  71                                   "href=\"$indexPathPrepend$base/deprecated$1\"",
  72                                   "href=\"$indexPathPrepend$base/todo$1\"",
  73                                   "href=\"$indexPathPrepend$base/file/$1$2\"",
  74                                   "href=\"$indexPathPrepend$base/source/$1$2\""
  75                                   ),
  76                            $data );
  77      return $data;
  78  }
  79  
  80  function eZReferenceDocument( &$module, $referenceBaseURI, $referenceType, $parameters )
  81  {
  82      $content = "";
  83  
  84  //     $baseURI = $Params["base_uri"];
  85      $baseURI = $referenceBaseURI;
  86      $ReferenceType = false;
  87      if ( isset( $parameters[0] ) )
  88          $ReferenceType = $parameters[0];
  89      $ReferenceName = "";
  90      if ( isset( $parameters[1] ) )
  91          $ReferenceName = $parameters[1];
  92  
  93      $error = false;
  94  
  95      $result = array();
  96  
  97      $htmlRoot = 'doc/generated/html';
  98  
  99      switch ( $ReferenceType )
 100      {
 101          case "modules":
 102          {
 103              $refFile = "$htmlRoot/modules.html";
 104              if ( file_exists( $refFile ) )
 105              {
 106                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 107                  $content .= $refData;
 108              }
 109              else
 110                  $error = true;
 111          } break;
 112          case "module":
 113          {
 114              $refFile = "$htmlRoot/group__" . $ReferenceName . ".html";
 115              if ( file_exists( $refFile ) )
 116              {
 117                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 118                  $content .= $refData;
 119              }
 120              else
 121                  $error = true;
 122          } break;
 123          case "file":
 124          {
 125              $refFile = "$htmlRoot/" . $ReferenceName . "_8php.html";
 126              if ( file_exists( $refFile ) )
 127              {
 128                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 129                  $content .= $refData;
 130              }
 131              else
 132                  $error = true;
 133          } break;
 134          case "source":
 135          {
 136              $refFile = "$htmlRoot/" . $ReferenceName . "_8php-source.html";
 137              if ( file_exists( $refFile ) )
 138              {
 139                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 140                  $content .= $refData;
 141              }
 142              else
 143                  $error = true;
 144          } break;
 145          case "todo":
 146          {
 147              $refFile = "$htmlRoot/todo.html";
 148              if ( file_exists( $refFile ) )
 149              {
 150                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 151                  $content .= $refData;
 152              }
 153              else
 154                  $error = true;
 155          } break;
 156          case "deprecated":
 157          {
 158              $refFile = "$htmlRoot/deprecated.html";
 159              if ( file_exists( $refFile ) )
 160              {
 161                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 162                  $content .= $refData;
 163              }
 164              else
 165                  $error = true;
 166          } break;
 167          case "hierarchy":
 168          {
 169              $refFile = "$htmlRoot/hierarchy.html";
 170              if ( file_exists( $refFile ) )
 171              {
 172                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 173                  $content .= $refData;
 174              }
 175              else
 176                  $error = true;
 177          } break;
 178          case "annotated":
 179          {
 180              $refFile = "$htmlRoot/annotated.html";
 181              if ( file_exists( $refFile ) )
 182              {
 183                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 184                  $content .= $refData;
 185              }
 186              else
 187                  $error = true;
 188          } break;
 189          case "files":
 190          {
 191              $refFile = "$htmlRoot/files.html";
 192              if ( file_exists( $refFile ) )
 193              {
 194                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 195                  $content .= $refData;
 196              }
 197              else
 198                  $error = true;
 199          } break;
 200          case "functions":
 201          {
 202              $refFile = "$htmlRoot/functions.html";
 203              if ( file_exists( $refFile ) )
 204              {
 205                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 206                  $content .= $refData;
 207              }
 208              else
 209                  $error = true;
 210          } break;
 211          case "related":
 212          {
 213              $refFile = "$htmlRoot/pages.html";
 214              if ( file_exists( $refFile ) )
 215              {
 216                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 217                  $content .= $refData;
 218              }
 219              else
 220                  $error = true;
 221          } break;
 222          case "class":
 223          {
 224              $refFile = "$htmlRoot/class" . $ReferenceName . ".html";
 225              if ( file_exists( $refFile ) )
 226              {
 227                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 228                  $content .= $refData;
 229              }
 230              else
 231                  $error = true;
 232          } break;
 233          case "members":
 234          {
 235              $refFile = "$htmlRoot/class" . $ReferenceName . "-members.html";
 236              if ( file_exists( $refFile ) )
 237              {
 238                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 239                  $content .= $refData;
 240              }
 241              else
 242                  $error = true;
 243          } break;
 244          case "globals":
 245          {
 246              $refFile = "$htmlRoot/globals.html";
 247              if ( file_exists( $refFile ) )
 248              {
 249                  $refData =& referenceReadFile( $refFile, $htmlRoot, $baseURI );
 250                  $content .= $refData;
 251              }
 252              else
 253                  $error = true;
 254          } break;
 255          default:
 256          {
 257              $tpl =& templateInit();
 258              $content =& $tpl->fetch( "design:reference/view/$referenceType/intro.tpl" );
 259          } break;
 260      }
 261  
 262      if ( $error )
 263      {
 264          $tpl =& templateInit();
 265          $content =& $tpl->fetch( "design:reference/view/$referenceType/error.tpl" );
 266  //         return $module->handleError( EZ_ERROR_KERNEL_NOT_FOUND, 'kernel' );
 267      }
 268  
 269      $result["content"] = $content;
 270      return $result;
 271  }
 272  
 273  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7