[ 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_mediawiki_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_mediawiki_api.php,v 1.1.2.1 2007-10-13 22:35:50 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_mediawiki_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 . 'index.php/' . 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_mediawiki_get_url_for_page_id().
  44  	function wiki_mediawiki_get_page_id_for_issue( $p_issue_id ) {
  45          $c_issue_id = db_prepare_int( $p_issue_id );
  46           return $c_issue_id;
  47      }
  48   
  49       # ----------------------
  50      # Gets the page url for the specified issue id.
  51  	function wiki_mediawiki_get_url_for_issue( $p_issue_id ) {
  52          return wiki_mediawiki_get_url_for_page_id( wiki_mediawiki_get_page_id_for_issue( $p_issue_id ) );
  53      }
  54   
  55      # ----------------------
  56      # Gets the page id for the specified project.  The project id can be ALL_PROJECTS
  57      # The page id can then be converted to URL using wiki_mediawiki_get_url_for_page_id().
  58  	function wiki_mediawiki_get_page_id_for_project( $p_project_id ) {
  59          $t_home = 'start';
  60          if ( $p_project_id == ALL_PROJECTS ) {
  61              return $t_home;
  62          } else {
  63              $t_project_name = project_get_name( $p_project_id );
  64              #return $t_project_name . ':' . $t_home;
  65              return 'Project:'.$t_project_name;
  66          }
  67      }
  68   
  69       # ----------------------
  70      # Get URL for the specified project id.  The project is can be ALL_PROJECTS.
  71  	function wiki_mediawiki_get_url_for_project( $p_project_id ) {
  72          return wiki_mediawiki_get_url_for_page_id( wiki_mediawiki_get_page_id_for_project( $p_project_id ) );
  73      }
  74  
  75      /*
  76      function wiki_mediawiki_string_display_links( $p_string ) {
  77          #$t_string = $p_string;
  78          #$t_string = str_replace( '[[', '{', $p_string );
  79      
  80          $t_wiki_web = config_get_global( 'wiki_engine_url' );
  81          
  82          preg_match_all( '/(^|.+?)(?:(?<=^|\W)' . '\[\[' . '([a-zA-Z0-9_:]+)\]\]|$)/s',
  83                                  $p_string, $t_matches, PREG_SET_ORDER );
  84          $t_result = '';
  85   
  86          foreach ( $t_matches as $t_match ) {
  87              $t_result .= $t_match[1];
  88   
  89              if ( isset( $t_match[2] ) ) {
  90                  $t_result .= '<a href="' . wiki_mediawiki_get_url_for_page_id( $t_match[2] ) . '">[[' . $t_match[2] . ']]</a>'; 
  91              }
  92          }
  93   
  94          return $t_result;
  95      }
  96      */
  97  ?>


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