[ Index ]
 

Code source de Dotclear 1.2.5

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

title

Body

[fermer]

/inc/classes/ -> class.wiki2xhtml.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of DotClear.
   4  # Copyright (c) 2004 Olivier Meunier and contributors. All rights
   5  # reserved.
   6  #
   7  # DotClear 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  # DotClear 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 DotClear; if not, write to the Free Software
  19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20  #
  21  # ***** END LICENSE BLOCK *****
  22  
  23  require dirname(__FILE__).'/class.wiki2xhtml.basic.php';
  24  
  25  class wiki2xhtml extends wiki2xhtmlBasic
  26  {
  27  	function wiki2xhtml()
  28      {
  29          parent::wiki2xhtml();
  30          
  31          # Mise en place des options
  32          $this->setOpt('active_title',1);
  33          $this->setOpt('active_setext_title',0);
  34          $this->setOpt('active_hr',1);
  35          $this->setOpt('active_lists',1);
  36          $this->setOpt('active_quote',1);
  37          $this->setOpt('active_pre',1);
  38          $this->setOpt('active_empty',1);
  39          $this->setOpt('active_auto_urls',0);
  40          $this->setOpt('active_urls',1);
  41          $this->setOpt('active_auto_img',0);
  42          $this->setOpt('active_img',1);
  43          $this->setOpt('active_anchor',1);
  44          $this->setOpt('active_em',1);
  45          $this->setOpt('active_strong',1);
  46          $this->setOpt('active_br',1);
  47          $this->setOpt('active_q',1);
  48          $this->setOpt('active_code',1);
  49          $this->setOpt('active_acronym',1);
  50          $this->setOpt('active_ins',1);
  51          $this->setOpt('active_del',1);
  52          $this->setOpt('active_footnotes',1);
  53          $this->setOpt('active_wikiwords',0);
  54          $this->setOpt('active_macros',1);
  55  
  56          $this->setOpt('parse_pre',1);
  57          
  58          $this->setOpt('active_fix_word_entities',0);
  59          $this->setOpt('active_fr_syntax',0);
  60          
  61          $this->setOpt('first_title_level',3);
  62          
  63          $this->setOpt('note_prefix','wiki-footnote');
  64          $this->setOpt('note_str','<div class="footnotes"><h4>Notes</h4>%s</div>');
  65          $this->setOpt('words_pattern','((?<![A-Za-z0-9µÀ-ÖØ-öø-ÿ])([A-ZÀ-ÖØ-Þ][a-zµß-öø-ÿ]+){2,}(?![A-Za-z0-9µÀ-ÖØ-öø-ÿ]))');
  66          
  67          $this->foot_notes = array();
  68          
  69          $share_dir = dirname(__FILE__).'/../../share/';
  70          $acro_file = $share_dir.'wiki-acronyms.txt';
  71          $acro_user = $share_dir.'wiki-acronyms-user.txt';
  72          
  73          
  74          if (file_exists($acro_user)) {
  75              $acro_file = $acro_user;
  76          }
  77          
  78          $this->setOpt('acronyms_file',$acro_file);
  79          
  80          $this->acro_table = $this->__getAcronyms();
  81          
  82          $this->registerFunction('url:post',array('wiki2xhtml','postLink'));
  83      }
  84      
  85  	function postLink($url,$content)
  86      {
  87          if (!isset($GLOBALS['blog'])) {
  88              return null;
  89          }
  90          
  91          $id = substr($url,5);
  92          
  93          $post = $GLOBALS['blog']->getPostByID($id);
  94          
  95          if ($post === false || $post->isEmpty()) {
  96              return false;
  97          }
  98          
  99          $res['url'] = $post->getPermURL();
 100          
 101          if ($url == $content) {
 102              $res['content'] = $post->f('post_titre');
 103          } else {
 104              $res['content'] = $content;
 105              $res['title'] = $post->f('post_titre');
 106          }
 107          
 108          if ($post->f('post_lang')) {
 109              $res['lang'] = $post->f('post_lang');
 110          }
 111          
 112          return $res;
 113      }
 114  }
 115  
 116  # Wiki2xhtml pour les commentaires
 117  class wiki2xhtmlComment extends wiki2xhtmlBasic
 118  {
 119  	function wiki2xhtmlComment()
 120      {
 121          parent::wiki2xhtml();
 122          
 123          $this->setOpt('active_title',0);
 124          $this->setOpt('active_setext_title',0);
 125          $this->setOpt('active_hr',0);
 126          $this->setOpt('active_lists',1);
 127          $this->setOpt('active_quote',0);
 128          $this->setOpt('active_pre',1);
 129          $this->setOpt('active_empty',0);
 130          $this->setOpt('active_auto_urls',0);
 131          $this->setOpt('active_urls',1);
 132          $this->setOpt('active_auto_img',0);
 133          $this->setOpt('active_img',0);
 134          $this->setOpt('active_anchor',0);
 135          $this->setOpt('active_em',1);
 136          $this->setOpt('active_strong',1);
 137          $this->setOpt('active_br',1);
 138          $this->setOpt('active_q',1);
 139          $this->setOpt('active_code',1);
 140          $this->setOpt('active_acronym',1);
 141          $this->setOpt('active_ins',1);
 142          $this->setOpt('active_del',1);
 143          $this->setOpt('active_footnotes',0);
 144          $this->setOpt('active_wikiwords',0);
 145          $this->setOpt('active_macros',0);
 146          $this->setOpt('parse_pre',0);
 147          $this->setOpt('active_fix_word_entities',0); 
 148          $this->setOpt('active_fr_syntax',0);
 149      }
 150  }
 151  
 152  ?>


Généré le : Fri Feb 23 21:40:15 2007 par Balluche grâce à PHPXref 0.7