[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/phpgwapi/inc/savant2/Savant2/ -> Savant2_Plugin_textarea.php (source)

   1  <?php
   2  
   3  /**
   4  * Base plugin class.
   5  */
   6  require_once 'Savant2/Plugin.php';
   7  
   8  /**
   9  * 
  10  * Outputs a single <textarea> element.
  11  * 
  12  * $Id: Savant2_Plugin_textarea.php 18360 2005-05-26 19:38:09Z mipmip $
  13  * 
  14  * @author Paul M. Jones <pmjones@ciaweb.net>
  15  * 
  16  * @package Savant2
  17  * 
  18  * @license http://www.gnu.org/copyleft/lesser.html LGPL
  19  * 
  20  * This program is free software; you can redistribute it and/or modify
  21  * it under the terms of the GNU Lesser General Public License as
  22  * published by the Free Software Foundation; either version 2.1 of the
  23  * License, or (at your option) any later version.
  24  * 
  25  * This program is distributed in the hope that it will be useful, but
  26  * WITHOUT ANY WARRANTY; without even the implied warranty of
  27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  28  * Lesser General Public License for more details.
  29  * 
  30  */
  31  
  32  class Savant2_Plugin_textarea extends Savant2_Plugin {
  33      
  34      /**
  35      * 
  36      * Outputs a single <textarea> element.
  37      * 
  38      * @access public
  39      * 
  40      * @param string $name The HTML "name=" value.
  41      * 
  42      * @param string $text The initial value of the textarea element.
  43      * 
  44      * @param int $rows How many rows tall should the area be?
  45      * 
  46      * @param int $cols The many columns wide should the area be?
  47      * 
  48      * @param string $attr Any "extra" HTML code to place within the
  49      * checkbox element.
  50      * 
  51      * @return string
  52      * 
  53      */
  54      
  55  	function plugin($name, $text = '', $rows = 24, $cols = 80, $attr = null)
  56      {
  57          // start the tag
  58          $html = '<textarea name="' . htmlspecialchars($name) . '"';
  59          $html .= ' rows="' . htmlspecialchars($rows) . '"';
  60          $html .= ' cols="' . htmlspecialchars($cols) . '"';
  61          
  62          // add extra attributes
  63          if (is_array($attr)) {
  64              // add from array
  65              foreach ($attr as $key => $val) {
  66                  $key = htmlspecialchars($key);
  67                  $val = htmlspecialchars($val);
  68                  $html .= " $key=\"$val\"";
  69              }
  70          } elseif (! is_null($attr)) {
  71              // add from scalar
  72              $html .= " $attr";
  73          }
  74          
  75          // add the default text, close the tag, and return
  76          $html .= '>' . htmlspecialchars($text) . '</textarea>';
  77          return $html;
  78      }
  79  }
  80  
  81  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7