home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / class / xoopsform / formhidden.php < prev    next >
Encoding:
PHP Script  |  2007-12-05  |  3.7 KB  |  101 lines

  1. <?php
  2. // $Id: formhidden.php 1151 2007-12-04 15:43:01Z phppp $
  3. //  ------------------------------------------------------------------------ //
  4. //                XOOPS - PHP Content Management System                      //
  5. //                    Copyright (c) 2000 XOOPS.org                           //
  6. //                       <http://www.xoops.org/>                             //
  7. //  ------------------------------------------------------------------------ //
  8. //  This program is free software; you can redistribute it and/or modify     //
  9. //  it under the terms of the GNU General Public License as published by     //
  10. //  the Free Software Foundation; either version 2 of the License, or        //
  11. //  (at your option) any later version.                                      //
  12. //                                                                           //
  13. //  You may not change or alter any portion of this comment or credits       //
  14. //  of supporting developers from this source code or any supporting         //
  15. //  source code which is considered copyrighted (c) material of the          //
  16. //  original comment or credit authors.                                      //
  17. //                                                                           //
  18. //  This program is distributed in the hope that it will be useful,          //
  19. //  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
  20. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
  21. //  GNU General Public License for more details.                             //
  22. //                                                                           //
  23. //  You should have received a copy of the GNU General Public License        //
  24. //  along with this program; if not, write to the Free Software              //
  25. //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
  26. //  ------------------------------------------------------------------------ //
  27. // Author: Kazumi Ono (AKA onokazu)                                          //
  28. // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
  29. // Project: The XOOPS Project                                                //
  30. // ------------------------------------------------------------------------- //
  31. if (!defined('XOOPS_ROOT_PATH')) {
  32.     die("XOOPS root path not defined");
  33. }
  34. /**
  35.  * @package     kernel
  36.  * @subpackage  form
  37.  * 
  38.  * @author        Kazumi Ono    <onokazu@xoops.org>
  39.  * @copyright    copyright (c) 2000-2003 XOOPS.org
  40.  */
  41. /**
  42.  * A hidden field
  43.  * 
  44.  * @package     kernel
  45.  * @subpackage  form
  46.  * 
  47.  * @author        Kazumi Ono    <onokazu@xoops.org>
  48.  * @copyright    copyright (c) 2000-2003 XOOPS.org
  49.  */
  50. class XoopsFormHidden extends XoopsFormElement {
  51.  
  52.     /**
  53.      * Value
  54.      * @var    string    
  55.      * @access    private
  56.      */
  57.     var $_value;
  58.  
  59.     /**
  60.      * Constructor
  61.      * 
  62.      * @param    string    $name    "name" attribute
  63.      * @param    string    $value    "value" attribute
  64.      */
  65.     function XoopsFormHidden($name, $value) {
  66.         $this->setName($name);
  67.         $this->setHidden();
  68.         $this->setValue($value);
  69.         $this->setCaption("");
  70.     }
  71.  
  72.     /**
  73.      * Get the "value" attribute
  74.      * 
  75.      * @param    bool    $encode To sanitizer the text?
  76.      * @return    string
  77.      */
  78.     function getValue($encode = false) {
  79.         return $encode ? htmlspecialchars($this->_value, ENT_QUOTES) : $this->_value;
  80.     }
  81.  
  82.     /**
  83.      * Sets the "value" attribute
  84.      * 
  85.      * @patam  $value    string
  86.      */
  87.     function setValue($value) {
  88.         $this->_value = $value;
  89.     }
  90.  
  91.     /**
  92.      * Prepare HTML for output
  93.      * 
  94.      * @return    string    HTML
  95.      */
  96.     function render() {
  97.         $ele_name = $this->getName();
  98.         return "<input type='hidden' name='".$ele_name."' id='".$ele_name."' value='".$this->getValue()."' />";
  99.     }
  100. }
  101. ?>