Пример #1
0
 protected function newHelper()
 {
     $escaper_factory = new EscaperFactory();
     $escaper = $escaper_factory->newInstance();
     return new Input(array('button' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'checkbox' => function () use($escaper) {
         return new Input\Checkbox($escaper);
     }, 'color' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'date' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'datetime' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'datetime-local' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'email' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'file' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'hidden' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'image' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'month' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'number' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'password' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'radio' => function () use($escaper) {
         return new Input\Radio($escaper);
     }, 'range' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'reset' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'search' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'select' => function () use($escaper) {
         return new Input\Select($escaper);
     }, 'submit' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'tel' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'text' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'textarea' => function () use($escaper) {
         return new Input\Textarea($escaper);
     }, 'time' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'url' => function () use($escaper) {
         return new Input\Generic($escaper);
     }, 'week' => function () use($escaper) {
         return new Input\Generic($escaper);
     }));
 }
Пример #2
0
 /**
  * Creates a factory
  *
  * @param mixed $encoding encoding
  * @param mixed $flags    flags
  *
  * @access public
  */
 public function __construct($encoding = null, $flags = null)
 {
     $factory = new EscaperFactory($encoding, $flags);
     $this->escaper = $factory->newInstance();
 }
 /**
  *
  * Constructor.
  *
  * @param string $encoding The encoding for the escapers.
  *
  * @param int $flags The `htmlspecialchars()` flags for the escapers.
  *
  */
 public function __construct($encoding = null, $flags = null)
 {
     $escaper_factory = new EscaperFactory($encoding, $flags);
     $this->escaper = $escaper_factory->newInstance();
     Escaper::setStatic($this->escaper);
 }
 protected function newHelper()
 {
     $class = substr(get_class($this), 0, -4);
     $escaper_factory = new EscaperFactory();
     return new $class($escaper_factory->newInstance());
 }