[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/ -> wiki_dokuwiki_api.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19   
  20      # --------------------------------------------------------
  21      # $Id: wiki_dokuwiki_api.php,v 1.1.2.1 2007-10-13 22:35:49 giallu Exp $
  22      # --------------------------------------------------------
  23   
  24      # ----------------------
  25      # Gets the URL for the page with the specified page id.  This function is used
  26      # internally by this API.
  27  	function wiki_dokuwiki_get_url_for_page_id( $p_page_id ) {
  28          $t_root_url = config_get_global( 'wiki_engine_url' );
  29   
  30          $t_root_namespace = config_get( 'wiki_root_namespace' );
  31   
  32          if ( is_blank( $t_root_namespace ) ) {
  33              $t_page_id = $p_page_id;
  34          } else {
  35              $t_page_id = $t_root_namespace . ':' . $p_page_id;
  36          }
  37   
  38          return $t_root_url . 'doku.php?id=' . urlencode( $t_page_id );
  39      }
  40   
  41      # ----------------------
  42      # Gets the page id for the specified issue.  The page id can then be converted
  43      # to a URL using wiki_dokuwiki_get_url_for_page_id().
  44  	function wiki_dokuwiki_get_page_id_for_issue( $p_issue_id ) {
  45          $c_issue_id = db_prepare_int( $p_issue_id );
  46   
  47          $t_project_id = bug_get_field( $p_issue_id, 'project_id' );
  48          $t_project_name = project_get_name( $t_project_id );
  49   
  50          # create a namespace for the project to contain all project documentation.
  51          # create within it a namespace for issues.  This is to allow the creation of a _template.txt
  52          # file to act as the template for issues belonging to this project.
  53          return $t_project_name . ':issue:' . $c_issue_id;
  54      }
  55   
  56       # ----------------------
  57      # Gets the page url for the specified issue id.
  58  	function wiki_dokuwiki_get_url_for_issue( $p_issue_id ) {
  59          return wiki_dokuwiki_get_url_for_page_id( wiki_dokuwiki_get_page_id_for_issue( $p_issue_id ) );
  60      }
  61   
  62      # ----------------------
  63      # Gets the page id for the specified project.  The project id can be ALL_PROJECTS
  64      # The page id can then be converted to URL using wiki_dokuwiki_get_url_for_page_id().
  65  	function wiki_dokuwiki_get_page_id_for_project( $p_project_id ) {
  66          $t_home = 'start';
  67          if ( $p_project_id == ALL_PROJECTS ) {
  68              return $t_home;
  69          } else {
  70              $t_project_name = project_get_name( $p_project_id );
  71              return $t_project_name . ':' . $t_home;
  72          }
  73      }
  74   
  75       # ----------------------
  76      # Get URL for the specified project id.  The project is can be ALL_PROJECTS.
  77  	function wiki_dokuwiki_get_url_for_project( $p_project_id ) {
  78          return wiki_dokuwiki_get_url_for_page_id( wiki_dokuwiki_get_page_id_for_project( $p_project_id ) );
  79      }
  80  
  81      /*
  82      function wiki_dokuwiki_string_display_links( $p_string ) {
  83          #$t_string = $p_string;
  84          #$t_string = str_replace( '[[', '{', $p_string );
  85      
  86          $t_wiki_web = config_get_global( 'wiki_engine_url' );
  87          
  88          preg_match_all( '/(^|.+?)(?:(?<=^|\W)' . '\[\[' . '([a-zA-Z0-9_:]+)\]\]|$)/s',
  89                                  $p_string, $t_matches, PREG_SET_ORDER );
  90          $t_result = '';
  91   
  92          foreach ( $t_matches as $t_match ) {
  93              $t_result .= $t_match[1];
  94   
  95              if ( isset( $t_match[2] ) ) {
  96                  $t_result .= '<a href="' . wiki_dokuwiki_get_url_for_page_id( $t_match[2] ) . '">[[' . $t_match[2] . ']]</a>'; 
  97              }
  98          }
  99   
 100          return $t_result;
 101      }
 102      */
 103  ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics