[ Index ]
 

Code source de DokuWiki 2006-11-06

Accdez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/inc/ -> toolbar.php (source)

   1  <?php
   2  /**
   3   * Editing toolbar functions
   4   *
   5   * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
   6   * @author     Andreas Gohr <andi@splitbrain.org>
   7   */
   8  
   9    if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
  10  
  11  require_once (DOKU_INC.'inc/JSON.php');
  12  
  13  
  14  /**
  15   * Prepares and prints an JavaScript array with all toolbar buttons
  16   *
  17   * @todo add toolbar plugins
  18   * @param  string $varname Name of the JS variable to fill
  19   * @author Andreas Gohr <andi@splitbrain.org>
  20   */
  21  function toolbar_JSdefines($varname){
  22      global $ID;
  23      global $conf;
  24      global $lang;
  25  
  26      // build button array
  27      $menu = array(
  28         array(
  29              'type'   => 'format',
  30              'title'  => $lang['qb_bold'],
  31              'icon'   => 'bold.png',
  32              'key'    => 'b',
  33              'open'   => '**',
  34              'close'  => '**',
  35              ),
  36         array(
  37              'type'   => 'format',
  38              'title'  => $lang['qb_italic'],
  39              'icon'   => 'italic.png',
  40              'key'    => 'i',
  41              'open'   => '//',
  42              'close'  => '//',
  43              ),
  44         array(
  45              'type'   => 'format',
  46              'title'  => $lang['qb_underl'],
  47              'icon'   => 'underline.png',
  48              'key'    => 'u',
  49              'open'   => '__',
  50              'close'  => '__',
  51              ),
  52         array(
  53              'type'   => 'format',
  54              'title'  => $lang['qb_code'],
  55              'icon'   => 'mono.png',
  56              'key'    => 'c',
  57              'open'   => "''",
  58              'close'  => "''",
  59              ),
  60         array(
  61              'type'   => 'format',
  62              'title'  => $lang['qb_strike'],
  63              'icon'   => 'strike.png',
  64              'key'    => 'd',
  65              'open'  => '<del>',
  66              'close'   => '</del>',
  67              ),
  68         array(
  69              'type'   => 'format',
  70              'title'  => $lang['qb_h1'],
  71              'icon'   => 'h1.png',
  72              'key'    => '1',
  73              'open'   => '====== ',
  74              'close'  => ' ======\n',
  75              ),
  76         array(
  77              'type'   => 'format',
  78              'title'  => $lang['qb_h2'],
  79              'icon'   => 'h2.png',
  80              'key'    => '2',
  81              'open'   => '===== ',
  82              'close'  => ' =====\n',
  83              ),
  84         array(
  85              'type'   => 'format',
  86              'title'  => $lang['qb_h3'],
  87              'icon'   => 'h3.png',
  88              'key'    => '3',
  89              'open'   => '==== ',
  90              'close'  => ' ====\n',
  91              ),
  92         array(
  93              'type'   => 'format',
  94              'title'  => $lang['qb_h4'],
  95              'icon'   => 'h4.png',
  96              'key'    => '4',
  97              'open'   => '=== ',
  98              'close'  => ' ===\n',
  99              ),
 100         array(
 101              'type'   => 'format',
 102              'title'  => $lang['qb_h5'],
 103              'icon'   => 'h5.png',
 104              'key'    => '5',
 105              'open'   => '== ',
 106              'close'  => ' ==\n',
 107              ),
 108         array(
 109              'type'   => 'format',
 110              'title'  => $lang['qb_link'],
 111              'icon'   => 'link.png',
 112              'key'    => 'l',
 113              'open'   => '[[',
 114              'close'  => ']]',
 115              ),
 116         array(
 117              'type'   => 'format',
 118              'title'  => $lang['qb_extlink'],
 119              'icon'   => 'linkextern.png',
 120              'open'   => '[[',
 121              'close'  => ']]',
 122              'sample' => 'http://example.com|'.$lang['qb_extlink'],
 123              ),
 124         array(
 125              'type'   => 'format',
 126              'title'  => $lang['qb_ol'],
 127              'icon'   => 'ol.png',
 128              'open'   => '  - ',
 129              'close'  => '\n',
 130              ),
 131         array(
 132              'type'   => 'format',
 133              'title'  => $lang['qb_ul'],
 134              'icon'   => 'ul.png',
 135              'open'   => '  * ',
 136              'close'  => '\n',
 137              ),
 138         array(
 139              'type'   => 'insert',
 140              'title'  => $lang['qb_hr'],
 141              'icon'   => 'hr.png',
 142              'insert' => '----\n',
 143              ),
 144         array(
 145              'type'   => 'mediapopup',
 146              'title'  => $lang['qb_media'],
 147              'icon'   => 'image.png',
 148              'url'    => DOKU_BASE.'lib/exe/mediamanager.php?ns=',
 149              'name'   => 'mediaselect',
 150              'options'=> 'width=750,height=500,left=20,top=20,scrollbars=yes,resizable=yes',
 151              ),
 152        array(
 153              'type'   => 'picker',
 154              'title'  => $lang['qb_smileys'],
 155              'icon'   => 'smiley.png',
 156              'list'   => getSmileys(),
 157              'icobase'=> 'smileys',
 158             ),
 159        array(
 160              'type'   => 'picker',
 161              'title'  => $lang['qb_chars'],
 162              'icon'   => 'chars.png',
 163              'list'   => explode(' ','À à Á á  â à ã Ä ä Ǎ ǎ Ă ă Å å Ā ā Ą ą Æ æ Ć ć Ç ç Č č Ĉ ĉ Ċ ċ Ð đ ð Ď ď È è É é Ê ê Ë ë Ě ě Ē ē Ė ė Ę ę Ģ ģ Ĝ ĝ Ğ ğ Ġ ġ Ĥ ĥ Ì ì Í í Î î Ï ï Ǐ ǐ Ī ī İ ı Į į Ĵ ĵ Ķ ķ Ĺ ĺ Ļ ļ Ľ ľ Ł ł Ŀ ŀ Ń ń Ñ ñ Ņ ņ Ň ň Ò ò Ó ó Ô ô Õ õ Ö ö Ǒ ǒ Ō ō Ő ő Œ œ Ø ø Ŕ ŕ Ŗ ŗ Ř ř Ś ś Ş ş Š š Ŝ ŝ Ţ ţ Ť ť Ù ù Ú ú Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ů ů ǖ ǘ ǚ ǜ Ų ų Ű ű Ŵ ŵ Ý ý Ÿ ÿ Ŷ ŷ Ź ź Ž ž Ż ż Þ þ ß Ħ ħ ¿ ¡ ¢ £ ¤ ¥ € ¦ § ª ¬ ¯ ° ± ÷ ‰ ¼ ½ ¾ ¹ ² ³ µ ¶ † ‡ · • º ∀ ∂ ∃ Ə ə ∅ ∇ ∈ ∉ ∋ ∏ ∑ ‾ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ◊ ℘ ℑ ℜ ℵ ♠ ♣ ♥ ♦ α β Γ γ Δ δ ε ζ η Θ θ ι κ Λ λ μ Ξ ξ Π π ρ Σ σ Τ τ υ Φ φ χ Ψ ψ Ω ω ★ ☆ ☎ ☚ ☛ ☜ ☝ ☞ ☟ ☹ ☺ ✔ ✘'),
 164             ),
 165        array(
 166              'type'   => 'signature',
 167              'title'  => $lang['qb_sig'],
 168              'icon'   => 'sig.png',
 169              'key'    => 'y',
 170             ),
 171      );
 172  
 173      // use JSON to build the JavaScript array
 174      $json = new JSON();
 175      print "var $varname = ".$json->encode($menu).";\n";
 176  }
 177  
 178  /**
 179   * prepares the signature string as configured in the config
 180   *
 181   * @author Andreas Gohr <andi@splitbrain.org>
 182   */
 183  function toolbar_signature(){
 184    global $conf;
 185  
 186    $sig = $conf['signature'];
 187    $sig = strftime($sig);
 188    $sig = str_replace('@USER@',$_SERVER['REMOTE_USER'],$sig);
 189    $sig = str_replace('@NAME@',$_SESSION[DOKU_COOKIE]['auth']['info']['name'],$sig);
 190    $sig = str_replace('@MAIL@',$_SESSION[DOKU_COOKIE]['auth']['info']['mail'],$sig);
 191    $sig = str_replace('@DATE@',date($conf['dformat']),$sig);
 192    $sig = str_replace('\\\\n','\\n',addslashes($sig));
 193    return $sig;
 194  }
 195  
 196  //Setup VIM: ex: et ts=4 enc=utf-8 :


Gnr le : Tue Apr 3 20:47:31 2007 par Balluche grce PHPXref 0.7