Inject the module

@param  string $name
@param  array  $attributes
@param  string $content
505156
protected function _injectModule($name, $attributes = array(), $content = null)
    {
        //Create module object
        $module            = new stdClass();
        $module->content   = $content;
        $module->id        = uniqid();
        $module->position  = $attributes['position'];
        $module->params    = $attributes['params'];
        $module->showtitle = !empty($attributes['title']);
        $module->title     = $attributes['title'];
        $module->attribs   = $attributes;
        $module->user      = 0;
        $module->name      = $name;
        $module->module    = 'mod_'.$name;

        $modules = &ComKoowaModuleHelper::getModules(null);

        if($module->attribs['prepend']) {
            array_push($modules, $module);
        } else {
            array_unshift($modules, $module);
        }
    }
542175
public function addTextarea($name, $attributes = array()) {
	
		$control = new FormControlTextarea($name, $attributes);
		$this->addControl($control);
	
		return $control;
	
	}
377774
final public function tag(string $name, array $attributes = [])
    {
        if ('' === $name) {
            throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.');
        }

        foreach ($attributes as $attribute => $value) {
            if (null !== $value && !is_scalar($value)) {
                throw new InvalidArgumentException(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type.', $name, $attribute));
            }
        }

        $this->definition->addTag($name, $attributes);

        return $this;
    }
468061
public static function replaceTag($tag, $replacement, $content, $attributes = null)
        {
            $content = preg_replace("/<{$tag}.*?>/", "<{$replacement} {$attributes}>", $content);
            $content = preg_replace("/<\/{$tag}>/", "</{$replacement}>", $content);
            return $content;
        }
747841
public function addCell($content, $attributes = array())
	{
		$currentRow = $this->getCurrentRow();
		//If we have been given a Cell then just add it, else create a new cell
		if ( $content instanceof Cell )
		{
			$currentRow[] = $content;
		}
		else
		{
			$currentRow[] = $this->constructCell($content, $attributes);
		}

		return $this;
	}
493852
public function startTag($name, $attributes = array(), $selfClosing = false) {
        // fprintf(STDOUT, $name);
        $lname = $this->normalizeTagName($name);

        // Make sure we have an html element.
        if (!$this->doc->documentElement && $name !== 'html' && !$this->frag) {
            $this->startTag('html');
        }

        // Set quirks mode if we're at IM_INITIAL with no doctype.
        if ($this->insertMode == static::IM_INITIAL) {
            $this->quirks = true;
            $this->parseError("No DOCTYPE specified.");
        }

        // SPECIAL TAG HANDLING:
        // Spec says do this, and "don't ask."
        if ($name == 'image') {
            $name = 'img';
        }

        // Autoclose p tags where appropriate.
        if ($this->insertMode >= static::IM_IN_BODY && HTML5_Elements::isA($name, HTML5_Elements::AUTOCLOSE_P)) {
            $this->autoclose('p');
        }

        // Set insert mode:
        switch ($name) {
            case 'html':
                $this->insertMode = static::IM_BEFORE_HEAD;
                break;
            case 'head':
                if ($this->insertMode > static::IM_BEFORE_HEAD) {
                    $this->parseError("Unexpected head tag outside of head context.");
                } else {
                    $this->insertMode = static::IM_IN_HEAD;
                }
                break;
            case 'body':
                $this->insertMode = static::IM_IN_BODY;
                break;
            case 'svg':
                $this->insertMode = static::IM_IN_SVG;
                break;
            case 'math':
                $this->insertMode = static::IM_IN_MATHML;
                break;
            case 'noscript':
                if ($this->insertMode == static::IM_IN_HEAD) {
                    $this->insertMode = static::IM_IN_HEAD_NOSCRIPT;
                }
                break;
        }

        // Special case handling for SVG.
        if ($this->insertMode == static::IM_IN_SVG) {
            $lname = HTML5_Elements::normalizeSvgElement($lname);
        }

        $pushes = 0;
        // when we found a tag thats appears inside $nsRoots, we have to switch the defalut namespace
        if (isset($this->nsRoots[$lname]) && $this->nsStack[0][''] !== $this->nsRoots[$lname]) {
            array_unshift($this->nsStack, array(
                '' => $this->nsRoots[$lname]
                    ) + $this->nsStack[0]);
            $pushes ++;
        }
        $needsWorkaround = false;
        if (isset($this->options["xmlNamespaces"]) && $this->options["xmlNamespaces"]) {
            // when xmlNamespaces is true a and we found a 'xmlns' or 'xmlns:*' attribute, we should add a new item to the $nsStack
            foreach ($attributes as $aName => $aVal) {
                if ($aName === 'xmlns') {
                    $needsWorkaround = $aVal;
                    array_unshift($this->nsStack, array(
                        '' => $aVal
                            ) + $this->nsStack[0]);
                    $pushes ++;
                } elseif ((($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : '') === 'xmlns') {
                    array_unshift($this->nsStack, array(
                        substr($aName, $pos + 1) => $aVal
                            ) + $this->nsStack[0]);
                    $pushes ++;
                }
            }
        }

        try {
            $prefix = ($pos = strpos($lname, ':')) ? substr($lname, 0, $pos) : '';


            if ($needsWorkaround !== false) {

                $xml = "<$lname xmlns=\"$needsWorkaround\" " . (strlen($prefix) && isset($this->nsStack[0][$prefix]) ? ("xmlns:$prefix=\"" . $this->nsStack[0][$prefix] . "\"") : "") . "/>";

                $frag = new \DOMDocument('1.0', 'UTF-8');
                $frag->loadXML($xml);

                $ele = $this->doc->importNode($frag->documentElement, true);
            } else {
                if (!isset($this->nsStack[0][$prefix]) || ($prefix === "" && isset($this->options['disableHtmlNsInDom']) && $this->options['disableHtmlNsInDom'])) {
                    $ele = $this->doc->createElement($lname);
                } else {
                    $ele = $this->doc->createElementNS($this->nsStack[0][$prefix], $lname);
                }
            }
        } catch (\DOMException $e) {
            $this->parseError("Illegal tag name: <$lname>. Replaced with <invalid>.");
            $ele = $this->doc->createElement('invalid');
        }

        // When we add some namespacess, we have to track them. Later, when "endElement" is invoked, we have to remove them.
        // When we are on a void tag, we do not need to care about namesapce nesting.
        if ($pushes > 0 && !HTML5_Elements::isA($name, HTML5_Elements::VOID_TAG)) {
            // PHP tends to free the memory used by DOM,
            // to avoid spl_object_hash collisions whe have to avoid garbage collection of $ele storing it into $pushes
            // see https://bugs.php.net/bug.php?id=67459
            $this->pushes[spl_object_hash($ele)] = array($pushes, $ele);

            // SEE https://github.com/facebook/hhvm/issues/2962
            if (defined('HHVM_VERSION')) {
                $ele->setAttribute('html5-php-fake-id-attribute', spl_object_hash($ele));
            }
        }

        foreach ($attributes as $aName => $aVal) {
            // xmlns attributes can't be set
            if ($aName === 'xmlns') {
                continue;
            }

            if ($this->insertMode == static::IM_IN_SVG) {
                $aName = HTML5_Elements::normalizeSvgAttribute($aName);
            } elseif ($this->insertMode == static::IM_IN_MATHML) {
                $aName = HTML5_Elements::normalizeMathMlAttribute($aName);
            }

            try {
                $prefix = ($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : false;

                if ($prefix === 'xmlns') {
                    $ele->setAttributeNs(self::NAMESPACE_XMLNS, $aName, $aVal);
                } elseif ($prefix !== false && isset($this->nsStack[0][$prefix])) {
                    $ele->setAttributeNs($this->nsStack[0][$prefix], $aName, $aVal);
                } else {
                    $ele->setAttribute($aName, $aVal);
                }
            } catch (\DOMException $e) {
                $this->parseError("Illegal attribute name for tag $name. Ignoring: $aName");
                continue;
            }

            // This is necessary on a non-DTD schema, like HTML5.
            if ($aName == 'id') {
                $ele->setIdAttribute('id', true);
            }
        }

        // Some elements have special processing rules. Handle those separately.
        if ($this->rules->hasRules($name) && $this->frag !== $this->current) {
            $this->current = $this->rules->evaluate($ele, $this->current);
        }         // Otherwise, it's a standard element.
        else {
            $this->current->appendChild($ele);

            // XXX: Need to handle self-closing tags and unary tags.
            if (!HTML5_Elements::isA($name, HTML5_Elements::VOID_TAG)) {
                $this->current = $ele;
            }
        }

        // This is sort of a last-ditch attempt to correct for cases where no head/body
        // elements are provided.
        if ($this->insertMode <= static::IM_BEFORE_HEAD && $name != 'head' && $name != 'html') {
            $this->insertMode = static::IM_IN_BODY;
        }

        // When we are on a void tag, we do not need to care about namesapce nesting,
        // but we have to remove the namespaces pushed to $nsStack.
        if ($pushes > 0 && HTML5_Elements::isA($name, HTML5_Elements::VOID_TAG)) {
            // remove the namespaced definded by current node
            for ($i = 0; $i < $pushes; $i ++) {
                array_shift($this->nsStack);
            }
        }
        // Return the element mask, which the tokenizer can then use to set
        // various processing rules.
        return HTML5_Elements::element($name);
    }
251311
public function addFilter($name, $attributes = array())
    {
        // name is "filtername:method:alias".
        $names = explode(':', $name);
        $filter = array_shift($names);
        $method = array_shift($names);
        $alias = array_shift($names);
        if (! $alias) $alias = $filter;
        if (! is_array($attributes)) $attributes = [];

        // method miss match, when return.
        if ($method && strtoupper($method) !== $this->Request->getMethod()) return;

        // register.
        if (isset($this->filters[$alias])) {
            $this->filters[$alias]['attributes'] = $this->arrayUtil->merge($this->filters[$alias]['attributes'], $attributes);
        } else {
            $this->filter_names[] = $alias;
            $this->filters[$alias] = array('name' => $filter, 'attributes' => (array)$attributes);
        }

        // if action filter.
        if (strtolower($filter) === 'action') {
            $this->has_action_filter = true;
        }
    }
122033
public function addRss($name, $attributes = [])
    {
        $rssPath = $this->getAssetPath($name);

        if (isset($this->controller)) {
            $this->controller->addRss($rssPath, $attributes);
        }

        if (is_string($attributes)) {
            $attributes = ['build' => $attributes];
        }

        $rssPath = $this->getAssetScheme($rssPath);

        if (!in_array($rssPath, $this->assets['rss'])) {
            $this->assets['rss'][] = ['path' => $rssPath, 'attributes' => $attributes];
        }
    }
1216072
public static function create($name, $content = '', $attribs = [], $forcePair = false)
    {
        $paired = $forcePair ?: !in_array(strtolower($name), static::$unpairedElements);

        return parent::create($name, $content, $attribs, $paired);
    }
389757
protected function htmlInput($name, $value, $attributes)
    {
        return Form::radio($name, $value, in_array($value, (array) $this->value, true), $attributes);
    }
936903
public function appendBody($content, $name = null)
    {
        if ((null === $name) || !is_string($name)) {
            if (isset($this->_body['default'])) {
                $this->_body['default'] .= (string) $content;
            } else {
                return $this->append('default', $content);
            }
        } elseif (isset($this->_body[$name])) {
            $this->_body[$name] .= (string) $content;
        } else {
            return $this->append($name, $content);
        }

        return $this;
    }
47057
public function SetAttribute($Name, $Value = '') {
      if (!is_array($Name))
         $Name = array($Name => $Value);

      foreach($Name as $Key => $Val) {
         if ($Val === NULL)
            unset($this->_Attributes[$Key]);
         $this->_Attributes[$Key] = $Val;
      }
   }
203018
private function render($content, array $attributes = []): string
    {
        $template = $attributes[$this->attributeName] ?? '';

        return $this->engine->render($template, ['content' => $content]);
    }
577828
public static function tag($name, $content = NULL, Array $attributes = NULL) {
    return \Psc\UI\HTML::tag($name, $content, $attributes);
  }
104853
public function contentTag($name, $content, array $options = array(), $escape = false)
    {
        if ($content instanceof \Closure) {
            ob_start();
            $tmpContent = $content();
            $content = ob_get_clean();
            if ($tmpContent !== null) {
                $content = $tmpContent;
                unset($tmpContent);
            }
        }
        return $this->_content_tag_string($name, $content, $options, $escape);
    }
162583
public static function tbody(
        string $content = null, 
        array $attributes = []
    ) : string
    {
        return self::tag("tbody", $content, $attributes);
    }
386910
function &addItem($content, $name = null) {
        if (!$name) {
            $name = uniqid(microtime(true), true);
        }
        $this->items[$name] = new Li($content);
        return $this->items[$name];
    }