public function __construct($opts, $form = null) { parent::__construct($opts, $form); $cur_year = date('Y'); // months if (!isset($this->months)) { //$this->months[0] = $this->placeholder['month']; foreach (range(1, 12) as $m) { $this->months[$m] = date($this->month_format, strtotime($cur_year . '-' . $m . '-1')); } } // days // $this->days = array_merge([$this->placeholder['day']], range(1,31)); $this->days = range(1, 31); // years if (!isset($this->years)) { $this->min_year = isset($this->min_year) ? $this->min_year : $cur_year - 100; $this->max_year = isset($this->max_year) ? $this->max_year : $cur_year; foreach (range($this->min_year, $this->max_year) as $y) { $this->years[$y] = $y; } if ($this->year_order == 'DESC') { $this->years = array_reverse($this->years, true); } } return $this; }
public function __construct($sender, $recipient, $messageID, $createdDate, $mediaID, $thumbnailMediaID, $shortVideo = false) { parent::__construct($sender, $recipient, $messageID, $createdDate); $this->sight = $shortVideo; $this->mediaID = $mediaID; $this->thumbnailMediaID = $thumbnailMediaID; }
public function __construct($sender, $recipient, $messageID, $createdDate, $url, $title, $description) { parent::__construct($sender, $recipient, $messageID, $createdDate); $this->url = $url; $this->title = $title; $this->description = $description; }
public function __construct($sender, $recipient, $messageID, $createdDate, array $coordinates, $scale, $label) { parent::__construct($sender, $recipient, $messageID, $createdDate); $this->coordinates = $coordinates; $this->scale = $scale; $this->name = $label; }
/** * @param OutputInterface $output * @throws RuntimeException */ public function __construct(OutputInterface $output) { if (!function_exists('readline')) { throw new RuntimeException('You must activate the readline extension'); } parent::__construct($output); }
public function __construct($sender, $recipient, $messageID, $createdDate, $mediaID, $format, $recognizedSpeech) { parent::__construct($sender, $recipient, $messageID, $createdDate); $this->recognition = $recognizedSpeech; $this->format = $format; $this->mediaID = $mediaID; }
/** * construct Input * @param string $name * @param string $week */ function __construct($name, $week = null) { parent::__construct($name, $week); // create week and year dropdown objects $this->year = new Dropdown($this->name . '-year'); $this->year->setValues(range(date('Y') - 3, date('Y') + 1))->setLabels(range(date('Y') - 3, date('Y') + 1))->setSelected(date('Y'))->setWidth(65); // create array with week numbers from 01 to 53 $weeks = range(1, 53); array_walk($weeks, function (&$nr) { $nr = str_pad($nr, 2, '0', STR_PAD_LEFT); }); $this->week = new Dropdown($this->name . '-week'); $this->week->setValues($weeks)->setLabels($weeks)->setSelected(date('W'))->setWidth(52); $this->attachObserver($this->year); $this->attachObserver($this->week); $this->addClass('week-dropdown'); // this will be the field we will actually fetch when posted, because that's easier. ;) // we need javascript to fill it when the dropdowns change, tho. $this->hiddenInput = new HiddenInput($name, date('Y-W')); if (!empty($week)) { $this->setSelected($week); } // store posted as selected $this->setPosted(); }
/** * Class constructor. * pass in alternate to $_REQUEST */ public function __construct($data = NULL) { if ($data === NULL) { $data = $_REQUEST; } parent::__construct($data); $trim_chars = "/\n\r\t\v "; $this->uri = isset($_SERVER['REQUEST_URI']) ? '/' . trim($_SERVER['REQUEST_URI'], $trim_chars) : '/'; if (isset($this->{'_'})) { $action = $this->{'_'}; } else { if (isset($_SERVER['PATH_INFO'])) { $action = $_SERVER['PATH_INFO']; } else { $pos = strpos($this->uri, '?'); $action = $pos === FALSE ? $this->uri : substr($this->uri, 0, $pos); } } $script_name = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : ''; $action = str_replace(array($script_name, $script_name . '?_='), '', $action); $action = trim($action, $trim_chars); $this->action = '/' . $action; if (strpos($this->uri, $script_name) === 0) { $this->base = $script_name; } else { $this->base = ''; } }
public function __construct($fieldName, $fieldInfo, $value) { if (empty($value)) { $value = 0; } parent::__construct($fieldName, $fieldInfo, $value); }
public function __construct($name = null, $owner = null, $src = "здесь будет адрес рисунка", $alt = "текст вместо рисунка", $title = "комментарий о рисунке") { parent::__construct($name, $owner); $this->type = "image"; $this->title = $title; $this->alt = $alt; $this->src = $src; }
public function __construct($name = null, $owner = null, $value = null) { parent::__construct($name, $owner, $value); $this->type = "text"; if ($value == "") { $this->value = "Писать сюда и сидя"; } }
function __construct() { parent::__construct(); //add checked as a valid attribute $this->addValidAttribute('checked'); $this->setAttribute('type', 'checkbox'); //type to checkbox }
public function __construct($field) { parent::__construct($field); $this->attributes['maxsize'] = 'maxsize'; //set the encoding type for the parent form $field->getForm()->setEncType('multipart/form-data'); $this->type = 'file'; }
public function __construct($array, $splat_) { $splat = []; while (!empty($splat_)) { $key = array_pop($splat_); $splat[$key] = array_pop($splat_); } parent::__construct($array, $splat); }
/** * ArgvInput constructor. */ public function __construct(array $args = null) { if (null === $args) { $args = $_SERVER['argv']; } array_shift($args); $this->arguments = $args; parent::__construct(); }
public function __construct(array $argv = null, InputDefinition $definition = null) { if (null === $argv) { $argv = $_SERVER['argv']; } array_shift($argv); $this->tokens = $argv; parent::__construct($definition); }
/** * construct WeekRange object * * @param string $name * @param string $from week in iyyy-iw format * @param string $to week in iyyy-iw format */ function __construct($name, $from = null, $to = null) { parent::__construct($name); $this->setWeekFrom(new WeekInput($name . '-from', $from)); $this->setWeekTo(new WeekInput($name . '-to', $to)); $this->attachObserver($this->weekFrom); $this->attachObserver($this->weekTo); // set default labels $this->setLabels(array('Between', 'and')); }
/** * Input construct. * * @param array $name * @param mixed $value * @param array|null $inputConfig * @throws InvalidArgumentException */ public function __construct($name, $value, $inputConfig) { if (is_object($value) && in_array("__toString", get_class_methods($value))) { $value = strval($value->__toString()); } else { $value = strval($value); } $value = trim($value); parent::__construct($name, $value, $inputConfig); }
public function __construct($opts, $form = null) { parent::__construct($opts, $form); if (isset($this->value) && is_string($this->value)) { preg_match(self::$regex, $this->value, $this->value); } elseif (isset($this->value['digits'])) { preg_match(self::$regex, $this->value['digits'], $tmp); $this->value = array_merge($this->value, $tmp); } }
/** * Constructor. * * @param array $argv An array of parameters from the CLI (in the argv format) * @param Definition $definition A Definition instance */ public function __construct(array $argv = null, Definition $definition = null) { if (null === $argv) { $argv = $_SERVER['argv']; } // strip the program name array_shift($argv); $this->tokens = $argv; parent::__construct($definition); }
public function __construct($opts, $form) { parent::__construct($opts, $form); $this->max_file_size = sscanf(ini_get('upload_max_filesize'), "%dM"); $this->max_file_size = array_pop($this->max_file_size); $this->max_file_size = $this->max_file_size * 1024 * 1024; if (!isset($this->upload_path)) { throw new \Exception('Upload path not set for ' . get_class($this) . ' ' . $this->name); } }
/** * construct DateRange object * * @param string $name * @param string $from date in d-m-Y format * @param string $to date in d-m-Y format */ function __construct($name, $from = null, $to = null) { parent::__construct($name); // create the two date input fields $this->setDateFrom(new DateInput($this->name . '-from', $from)); $this->setDateTo(new DateInput($this->name . '-to', $to)); $this->attachObserver($this->dateFrom); $this->attachObserver($this->dateTo); // set default labels $this->setLabels(array('Between', 'and')); }
function __construct($name = null, $value = null) { parent::__construct($name, $value); $this->attributes['type'] = 'checkbox'; // Try this request first if (\Forma\Helpers::input($this->attributes['name']) == $value) { $this->checked(); } // Old input if (\Forma\Helpers::inputOld($this->attributes['name']) == $value) { $this->checked(); } // Add pre-render $this->preRenders[] = 'preRenderCheckboxHidden'; }
public function __construct($opts, $form = null) { parent::__construct($opts, $form); // hours if (!isset($this->hours)) { foreach (range(1, 12) as $h) { $this->hours[$h] = $h; } } // minutes if (!isset($this->minutes)) { $this->minutes = range(00, 60); } // am/pm $this->ampm = ['AM', 'PM']; return $this; }
/** * construct MonthInput object * * @param string $name * @param yyyy-mm $value */ function __construct($name, $value = null) { parent::__construct($name, $value); // create the two dropdowns $this->month = new Dropdown($name . '-month', date('m')); $this->month->setWidth(92); $months = array(1 => 'Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'); foreach ($months as $nr => $label) { $this->month->appendOption($nr, $label); } $this->year = new Dropdown($name . '-year', date('Y')); $this->year->setWidth(65); for ($y = date('Y') - 2; $y < date('Y') + 3; $y++) { $this->year->appendOption($y, $y); } $this->monthyear = new HiddenInput($name, date('Y') . '-' . date('m')); $this->attachObserver($this->month); $this->attachObserver($this->year); if (!empty($value)) { $this->setSelected($value); } }
function __construct($name) { parent::__construct($name); $this->type = 'button'; }
/** * __construct * * @access public * @param string Contains the name of this field. * @return void */ public function __construct($name = '') { parent::__construct('email', $name); }
public function __construct($name = null, $owner = null, $value = "Отправить данные") { parent::__construct($name, $owner, $value); $this->type = "submit"; }
function __construct($name = null, $value = null) { parent::__construct($name, $value); $this->attributes['type'] = 'password'; }
public function __construct($name, $value = 1) { parent::__construct($name); $this->setValue($value); }