From: <txm...@us...> - 2012-12-11 23:01:08
|
Revision: 10365 http://sourceforge.net/p/xoops/svn/10365 Author: txmodxoops Date: 2012-12-11 23:01:05 +0000 (Tue, 11 Dec 2012) Log Message: ----------- Modified for mobile Added Paths: ----------- XoopsCore/tags/2.5mobile timgno/htdocs/class/xoopsform/formtext.php Added: XoopsCore/tags/2.5mobile timgno/htdocs/class/xoopsform/formtext.php =================================================================== --- XoopsCore/tags/2.5mobile timgno/htdocs/class/xoopsform/formtext.php (rev 0) +++ XoopsCore/tags/2.5mobile timgno/htdocs/class/xoopsform/formtext.php 2012-12-11 23:01:05 UTC (rev 10365) @@ -0,0 +1,127 @@ +<?php +/** + * XOOPS form element + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @subpackage form + * @since 2.0.0 + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/ + * @version $Id: formtext.php 8066 2011-11-06 05:09:33Z beckmi $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * A simple text field + */ +class XoopsFormText extends XoopsFormElement +{ + /** + * Size + * + * @var int + * @access private + */ + var $_size; + + /** + * Maximum length of the text + * + * @var int + * @access private + */ + var $_maxlength; + + /** + * Initial text + * + * @var string + * @access private + */ + var $_value; + + /** + * Constructor + * + * @param string $caption Caption + * @param string $name "name" attribute + * @param int $size Size + * @param int $maxlength Maximum length of text + * @param string $value Initial text + */ + function XoopsFormText($caption, $name, $size, $maxlength, $value = '') + { + $this->setCaption($caption); + $this->setName($name); + $this->_size = intval($size); + $this->_maxlength = intval($maxlength); + $this->setValue($value); + } + + /** + * Get size + * + * @return int + */ + function getSize() + { + return $this->_size; + } + + /** + * Get maximum text length + * + * @return int + */ + function getMaxlength() + { + return $this->_maxlength; + } + + /** + * Get initial content + * + * @param bool $encode To sanitizer the text? Default value should be "true"; however we have to set "false" for backward compat + * @return string + */ + function getValue($encode = false) + { + return $encode ? htmlspecialchars($this->_value, ENT_QUOTES) : $this->_value; + } + + /** + * Set initial text value + * + * @param $value string + */ + function setValue( |