本文整理汇总了PHP中Text::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::__construct方法的具体用法?PHP Text::__construct怎么用?PHP Text::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($name = null, $options = array())
{
if (is_string($options)) {
$options = array('whitelist' => $options);
}
return parent::__construct($name, $options);
}
示例2: __construct
public function __construct($name = null)
{
parent::__construct($name);
$this->addTest('numeric', function ($value) {
return preg_replace('/[^\\d]/', '', $value) == $value;
});
}
示例3: __construct
/**
* @param bool $name
* @param string $label
* @param string $desc
* @param bool $required
* @param int $width
* @param string $default
* @param int $height
* @param int $rows
* @param int $cols
* @param int $lengthMax
* @param int $lengthMin
*/
public function __construct($label = null, $name = null, $desc = null, $required = false, $width = 280, $default = '', $height = 100, $rows = 4, $cols = 30, $lengthMax = false, $lengthMin = false)
{
parent::__construct($label, $name, $desc, $required, $width, $default, $lengthMax, $lengthMin);
$this->_height = intval($height);
$this->_rows = $rows;
$this->_cols = $cols;
}
示例4: __construct
public function __construct($name = null)
{
parent::__construct($name);
$this->addTest('valid', function ($value) {
return strtotime($value);
});
}
示例5: __construct
/**
* __construct
*
* @param string $caption caption
* @param string $name name
* @param integer $size field size
* @param integer $value date as unix timestamp
*/
public function __construct($caption, $name, $size = 2, $value = 0)
{
if ($value !== '') {
$value = $value === 0 ? time() : (int) $value;
}
parent::__construct($caption, $name, $size, 2, $value);
}
示例6: __construct
public function __construct($name = null)
{
parent::__construct($name);
$this->addTest('valid', function ($value) {
return filter_var($value, FILTER_VALIDATE_EMAIL) && preg_match("/.*@.*\\..*/", $value);
});
}
示例7: __construct
/**
* Overload the constdcteur
*
* BooleanSwitch constructor.
* @param $name
* @param string $label
* @param null $function
*/
public function __construct($name, $label = '', $function = null)
{
parent::__construct($name, $label);
if (!is_null($function)) {
$this->setRemoteProcess($function);
}
}
示例8: __construct
/**
* Create instance
*
* @param string $name The name of the field
* @param array $data The data to construct the field
*/
public function __construct($name, array $data)
{
parent::__construct($name, $data);
if (array_key_exists('placeholder', $data)) {
$this->placeholder = $data['placeholder'];
}
$this->type = 'password';
}
示例9: __construct
public function __construct($name = null)
{
parent::__construct($name);
$this->attributes['placeholder'] = 'http://';
$this->addTest('url', function ($value) {
return filter_var($value, FILTER_VALIDATE_URL);
});
}
示例10: __construct
/**
* @param $filePath string Name of the conf file (or full path).
* @throws Exception
*/
public function __construct($filePath)
{
$this->inFilePath = $filePath;
$contents = @file_get_contents($this->inFilePath);
if (false === $contents) {
throw new Exception('Cannot read file "' . $this->inFilePath . '".');
}
parent::__construct($contents);
}
示例11: __construct
/**
* Constructror
*
* @param $name
* @param string $label
* @param array $attr
*/
public function __construct($name, $label = '', $format = null, $attr = [])
{
parent::__construct($name, $label, $attr);
$this->center();
if (is_null($format)) {
$format = configurator()->get('table.column.date.format');
}
$this->addFilter('dateFormat', 'dateFormat', $format);
}
示例12: __construct
public function __construct($label, $attributes)
{
parent::__construct($label, $attributes);
if (!isset($attributes['rows'])) {
$attributes['rows'] = 6;
}
if (!isset($attributes['cols'])) {
$attributes['cols'] = 60;
}
}
示例13: __construct
/**
* __construct
*
* @param string|array $caption caption or array of all attributes
* @param string $name name
* @param integer|\DateTime $value unix timestamp or DateTime object
*/
public function __construct($caption, $name = null, $value = null)
{
if (is_array($caption)) {
parent::__construct($caption);
$this->setIfNotSet('size', 15);
$this->setIfNotSet('value', 0);
$this->set('value', \Xoops\Core\Locale\Time::cleanTime($this->get('value', null)));
} else {
parent::__construct([]);
$this->setCaption($caption);
$this->setName($name);
$this->set('size', 15);
$this->setValue(\Xoops\Core\Locale\Time::cleanTime($value));
}
}
示例14: __construct
/**
* __construct
*
* @param string|array $caption field caption or array of all attributes
* @param string $name field name
* @param string $value field value
*/
public function __construct($caption, $name = null, $value = '#FFFFFF')
{
if (is_array($caption)) {
parent::__construct($caption);
$value = $this->get('value', '');
if (empty($value)) {
$this->set('value', '#FFFFFF');
}
$this->setIfNotSet('size', 10);
$this->setIfNotSet('maxlength', 16);
} else {
parent::__construct([]);
$this->set('caption', $caption);
$this->setWithDefaults('name', $name, 'name_error');
$this->set('size', 10);
$this->set('maxlength', 16);
$this->set('value', $value);
}
$this->setIfNotSet('type', 'text');
}
示例15: __construct
/**
* Constructor
*
* Instantiate the captcha input form element
*
* @param string $name
* @param string $value
* @param string $indent
* @param int $expire
* @param string $captcha
* @return Captcha
*/
public function __construct($name, $value = null, $indent = null, $expire = 300, $captcha = null)
{
// Start a session.
if (session_id() == '') {
session_start();
}
// If token does not exist, create one
if (!isset($_SESSION['pop_captcha'])) {
if (null === $captcha) {
$captcha = $this->generateEquation();
} else {
if (stripos($captcha, '<img') === false) {
$captcha = strtoupper($captcha);
}
}
$this->token = ['captcha' => $captcha, 'value' => null, 'expire' => (int) $expire, 'start' => time()];
$_SESSION['pop_captcha'] = serialize($this->token);
// Else, retrieve existing token
} else {
$this->token = unserialize($_SESSION['pop_captcha']);
// Check to see if the token has expired
if ($this->token['expire'] > 0) {
if ($this->token['expire'] + $this->token['start'] < time()) {
if (null === $captcha) {
$captcha = $this->generateEquation();
} else {
if (stripos($captcha, '<img') === false) {
$captcha = strtoupper($captcha);
}
}
$this->token = ['captcha' => $captcha, 'value' => null, 'expire' => (int) $expire, 'start' => time()];
$_SESSION['pop_captcha'] = serialize($this->token);
}
}
}
parent::__construct($name, strtoupper($value), $indent);
$this->setRequired(true);
$this->setValidator();
}