/** * Module Logic * * @return void */ public function execute() { $options = $this->options; $options[] = 'doNotSelfQlose'; if (in_array('compress', $options)) { $options[] = 'inlineInner'; } $Tag = new HTML\Tag('style', $this->args, $options); $Tag->open(); $Tag->content(); $Tag->close(); }
/** * Module Logic * * @return void */ public function execute() { if ($this->hasOption('start')) { $this->options[] = 'doNotSelfQlose'; echo new HTML\Tag('script', $this->args, $this->options); return; } $options = $this->options; $options[] = 'doNotSelfQlose'; if (in_array('compressJs', $options)) { $options[] = 'inlineInner'; } $Tag = new HTML\Tag('script', $this->args, $options); $Tag->open(); $Tag->content(); $Tag->close(); }
/** * Module Logic * * @return void */ public function execute() { switch ($this->called) { case 'textarea': $Tag = new HTML\Tag($this->called, array($this->args[0], $this->args[1]), array('generate', 'inlineInner')); break; default: $Tag = new HTML\Tag($this->called, array($this->args[0]), array('generate')); break; } if ($this->called == 'checkbox' && isset($this->args[2]) && ($this->args[2] === true || $this->args[2] === 'on' || $this->args[2] === 1 || $this->args[2] === $Tag->attributes['id'] || is_array($this->args[2]) && in_array($Tag->attributes['id'], $this->args[2]))) { $Tag->setAttrs(array('checked' => null)); } if ($this->_label !== false) { $Label = HTML\Generator::getLabel($this->_label, $Tag); HTML\Generator::appendLabel($Label, $Tag, $this->_label); } else { echo $Tag; } }
/** * Returns the head tag. * * @return Tag */ public function getHead() { $head = new Core\Tag('head', array(isset($this->args[0]) ? $this->args[0] : null), array('generate', 'start')); $head->setAttrs($this->headattrs); return $head; }
/** * Module Logic * * @return void */ public function execute() { /* * Generate the Basic Tag. */ $Select = new HTML\Tag('select', array($this->args[0]), array('generate', 'start')); /* * Set the multiple attribute if multiple selections are active */ if (isset($this->args[2]) && is_array($this->args[2]) && !isset($Select->attributes['multiple'])) { $Select->attributes['multiple'] = ''; $Select->update('attributes'); } /* * Open the Select Tag. */ $r = '' . $Select; if (is_array($this->args[1])) { $i = 1; foreach ($this->args[1] as $k => $v) { if (is_string($v)) { $args = array(); if (!is_int($k)) { $args['value'] = $k; } if (isset($this->args[2]) && $this->isSelected($this->args[2], !is_int($k) ? $k : $v, $i)) { $args['selected'] = ''; } $r .= new HTML\Tag('option', array($v, $args)); } elseif (is_array($v)) { $opts = array('', array()); if (isset($v['inner'])) { $opts[0] = $v['inner']; unset($v['inner']); } if (isset($v['attrs'])) { $opts[1] = HTML\Generator::parseAtts($v['attrs']); unset($v['attrs']); } $opts = array_merge($opts, $v); if (!in_array('selected', $opts[1]) && ($this->isSelected($this->args[2], $opts[0], $i) || $this->isSelected($this->args[2], $k, $i))) { $opts[1]['selected'] = ''; } if (!in_array('value', $opts[1])) { $opts[1]['value'] = $k; } $r .= new HTML\Tag('option', $opts); } elseif (is_object($v) && get_class($v) == 'Xiphe\\HTML\\core\\Tag') { if (isset($this->args[2])) { if (isset($v->attributes['value'])) { $k = $v->attributes['value']; } else { $k = $v->content; } if ($this->isSelected($this->args[2], $k, $i)) { $v->attributes['selected'] = ''; $v->update('attributes'); } } $r .= $v; } $i++; } } $r .= $Select; if (!isset($this->args[3]) || $this->args[3] !== false) { $labelArgs = array(); if (isset($this->args[3])) { $labelArgs = $this->args[3]; } $Label = HTML\Generator::getLabel($labelArgs, $Select); HTML\Generator::appendLabel($Label, $r, $labelArgs); } else { echo $r; } }