Hoa central
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Hoa\Xyl\Interpreter\Html\Input Class Reference
Inheritance diagram for Hoa\Xyl\Interpreter\Html\Input:

Public Member Functions

 getForm ()
 
 isValid ($revalid=false, &$value)
 
 setValue ($value)
 
- Public Member Functions inherited from Hoa\File\Generic
 getBasename ()
 
 getDirname ()
 
 getSize ()
 
 getStatistic ()
 
 getATime ()
 
 getCTime ()
 
 getMTime ()
 
 getGroup ()
 
 getOwner ()
 
 getPermissions ()
 
 getReadablePermissions ()
 
 isReadable ()
 
 isWritable ()
 
 isExecutable ()
 
 clearStatisticCache ()
 
 touch ($time=-1, $atime=-1)
 
 copy ($to, $force=Stream\IStream\Touchable::DO_NOT_OVERWRITE)
 
 move ($name, $force=Stream\IStream\Touchable::DO_NOT_OVERWRITE, $mkdir=Stream\IStream\Touchable::DO_NOT_MAKE_DIRECTORY)
 
 delete ()
 
 changeGroup ($group)
 
 changeMode ($mode)
 
 changeOwner ($user)
 
 isFile ()
 
 isLink ()
 
 isDirectory ()
 
 isSocket ()
 
 isFIFOPipe ()
 
 isCharacterSpecial ()
 
 isBlockSpecial ()
 
 isUnknown ()
 
 getMode ()
 
 getINode ()
 
 getRealPath ()
 
 getExtension ()
 
 getFilename ()
 
- Public Member Functions inherited from Hoa\Stream\Stream
 __construct ($streamName, $context=null, $wait=false)
 
 open ()
 
 close ()
 
 getStreamName ()
 
 getStreamContext ()
 
 _setStream ($stream)
 
 isOpened ()
 
 setStreamTimeout ($seconds, $microseconds=0)
 
 setStreamBlocking ($mode)
 
 setStreamBuffer ($buffer)
 
 disableStreamBuffer ()
 
 getStreamBufferSize ()
 
 getStreamWrapperName ()
 
 getStreamMetaData ()
 
 isBorrowing ()
 
 on ($listenerId, $callable)
 
 _notify ($ncode, $severity, $message, $code, $transferred, $max)
 
 __toString ()
 
 __destruct ()
 

Protected Member Functions

 getStep ()
 
- Protected Member Functions inherited from Hoa\File\Generic
 setMode ($mode)
 
- Protected Member Functions inherited from Hoa\Stream\Stream
_open ($streamName, Context $context=null)
 
 _close ()
 
 getStream ()
 

Protected Attributes

 $_contentFlow = 0
 
 $_validity = null
 
- Protected Attributes inherited from Hoa\File\Generic
 $_mode = null
 
- Protected Attributes inherited from Hoa\Stream\Stream
 $_bucket = []
 
 $_bufferSize = 8192
 
 $_streamName = null
 
 $_context = null
 
 $_hasBeenDiffered = false
 
 $_on = null
 
 $_borrowed = false
 

Static Protected Attributes

static $_attributes
 
static $_attributesMapping
 

Additional Inherited Members

- Static Public Member Functions inherited from Hoa\File\Generic
static clearAllStatisticCaches ()
 
static umask ($umask=null)
 
static isCaseSensitive ()
 
- Static Public Member Functions inherited from Hoa\Stream\Stream
static getStreamHandler ($streamName)
 
static _Hoa_Stream ()
 
- Public Attributes inherited from Hoa\Stream\Stream
const NAME = 0
 
const HANDLER = 1
 
const RESOURCE = 2
 
const CONTEXT = 3
 
- Public Attributes inherited from Hoa\Stream\IStream\Statable
const SIZE_UNDEFINED = -1
 
- Public Attributes inherited from Hoa\Stream\IStream\Touchable
const OVERWRITE = true
 
const DO_NOT_OVERWRITE = false
 
const MAKE_DIRECTORY = true
 
const DO_NOT_MAKE_DIRECTORY = false
 

Detailed Description

Class .

The <input> component.

Definition at line 49 of file Input.php.

Member Function Documentation

Hoa\Xyl\Interpreter\Html\Input::getForm ( )

Get form.

Returns

Definition at line 153 of file Input.php.

154  {
155  return Form::getMe($this);
156  }
static getMe(Concrete $element)
Definition: Form.php:592

Here is the call graph for this function:

Hoa\Xyl\Interpreter\Html\Input::getStep ( )
protected

Get step.

Returns
mixed

Definition at line 385 of file Input.php.

386  {
387  if (false === $this->attributeExists('step')) {
388  return true;
389  }
390 
391  $step = $this->readAttribute('step');
392 
393  if ('any' === strtolower($step)) {
394  return true;
395  }
396 
397  $step = floatval($step);
398 
399  if (0 >= $step) {
400  return false;
401  }
402 
403  return $step;
404  }

Here is the caller graph for this function:

Hoa\Xyl\Interpreter\Html\Input::isValid (   $revalid = false,
$value 
)

Whether the input is valid or not.

Parameters
bool$revalidRe-valid or not.
mixed$valueValue to test.
Returns
bool

Definition at line 165 of file Input.php.

166  {
167  if (false === $revalid && null !== $this->_validity) {
168  return $this->_validity;
169  }
170 
171  $this->_validity = true;
172  $type = strtolower($this->readAttribute('type'));
173 
174  if ((null === $value || '' === $value) &&
175  true === $this->attributeExists('required')) {
176  $this->_validity = false;
177 
178  return Form::postValidation($this->_validity, $value, $this);
179  }
180 
181  if (false !== strpos($value, "\n") ||
182  false !== strpos($value, "\r")) {
183  $this->_validity = false;
184 
185  return Form::postValidation($this->_validity, $value, $this);
186  }
187 
188  if (true === $this->attributeExists('pattern')) {
189  $pattern = str_replace('#', '\#', $this->readAttribute('pattern'));
190 
191  if (0 == @preg_match('#^' . $pattern . '$#u', $value, $_)) {
192  $this->_validity = false;
193 
194  return Form::postValidation($this->_validity, $value, $this);
195  }
196  }
197 
198  if (true === $this->attributeExists('maxlength')) {
199  $maxlength = intval($this->readAttribute('maxlength'));
200 
201  if (mb_strlen($value) > $maxlength) {
202  $this->_validity = false;
203 
204  return Form::postValidation($this->_validity, $value, $this);
205  }
206  }
207 
208  if (true === $this->attributeExists('readonly')) {
209  $this->_validity = $value === $this->readAttribute('value');
210 
211  return Form::postValidation($this->_validity, $value, $this);
212  }
213 
214  switch ($type) {
215  case 'hidden':
216  $this->_validity = $value === $this->readAttribute('value');
217 
218  break;
219 
220  case 'color':
221  $this->_validity = 0 !== preg_match(
222  Realdom\Color::REGEX,
223  $value,
224  $ 
225  );
226 
227  break;
228 
229  // @TODO
230  case 'tel':
231  case 'url':
232  case 'datetime':
233  case 'date':
234  case 'month':
235  case 'week':
236  case 'time':
237  case 'datetime-local':
238  case 'file':
239  $this->_validity = true;
240 
241  break;
242 
243  case 'email':
244  $this->_validity = false !== filter_var($value, FILTER_VALIDATE_EMAIL);
245 
246  break;
247 
248  case 'number':
249  $value = floatval($value);
250 
251  if (false === $this->attributeExists('min')) {
252  if (true === $this->attributeExists('max')) {
253  $max = floatval($this->readAttribute('max'));
254 
255  if ($value > $max) {
256  $this->_validity = false;
257 
258  break;
259  }
260  }
261 
262  $this->_validity = true;
263 
264  break;
265  }
266 
267  $min = floatval($this->readAttribute('min'));
268 
269  if ($value < $min) {
270  $this->_validity = false;
271 
272  break;
273  }
274 
275  if (false === $this->attributeExists('max')) {
276  $this->_validity = true;
277 
278  break;
279  }
280 
281  $max = floatval($this->readAttribute('max'));
282 
283  if ($value > $max) {
284  $this->_validity = false;
285 
286  break;
287  }
288 
289  // @TODO step
290  $this->_validity = true;
291 
292  break;
293 
294  case 'range':
295  $value = floatval($value);
296  $min = floatval($this->readAttribute('min') ?: 0);
297  $max = floatval($this->readAttribute('max') ?: 100);
298 
299  if ($value < $min || $value > $max) {
300  $this->_validity = false;
301  }
302 
303  $step = $this->getStep();
304 
305  if (false === $step) {
306  $this->_validity = false;
307 
308  break;
309  } elseif (true !== $step) {
310 
311  // @TODO
312  //$this->_validity = $min % $step === $value % $step;
313  $this->_validity = true;
314  }
315 
316  break;
317 
318  case 'checkbox':
319  if (null === $value) {
320  $this->_validity = true;
321  } elseif (!is_string($value)) {
322  $this->_validity = false;
323  } else {
324  $this->_validity = $value === $this->readAttribute('value');
325  }
326 
327  break;
328 
329  case 'radio':
330  if (!is_string($value)) {
331  $this->_validity = false;
332  } else {
333  $this->_validity = $value === $this->readAttribute('value');
334  }
335 
336  break;
337 
338  case 'submit':
339  case 'image':
340  case 'reset':
341  case 'button':
342  $this->_validity = true;
343 
344  break;
345 
346  case 'text':
347  case 'search':
348  case 'password':
349  default:
350  $this->_validity = true;
351  }
352 
353  return Form::postValidation($this->_validity, $value, $this);
354  }
static postValidation($verdict, &$value, Concrete $element, $postVerification=true)
Definition: Form.php:447

Here is the call graph for this function:

Hoa\Xyl\Interpreter\Html\Input::setValue (   $value)

Set value.

Parameters
mixed$valueValue.
Returns
string

Definition at line 362 of file Input.php.

363  {
364  $type = strtolower($this->readAttribute('type'));
365 
366  switch ($type) {
367  case 'checkbox':
368  case 'radio':
369  $this->writeAttribute('checked', 'checked');
370 
371  break;
372 
373  default:
374  $this->writeAttribute('value', $value);
375  }
376 
377  return;
378  }

Member Data Documentation

Hoa\Xyl\Interpreter\Html\Input::$_attributes
staticprotected
Initial value:
= [
'accept' => parent::ATTRIBUTE_TYPE_NORMAL

Definition at line 56 of file Input.php.

Hoa\Xyl\Interpreter\Html\Input::$_attributesMapping
staticprotected

Definition at line 97 of file Input.php.

Hoa\Xyl\Interpreter\Html\Input::$_contentFlow = 0
protected

Definition at line 137 of file Input.php.

Hoa\Xyl\Interpreter\Html\Input::$_validity = null
protected

Definition at line 144 of file Input.php.


The documentation for this class was generated from the following file: