Render the modules

@param object $modules   The module object
@param array  $attribs   Module attributes
@return string  The rendered modules
509399
public function _renderModules($modules, $attribs = array())
    {
        $html  = '';
        $count = 1;
        foreach($modules as $module)
        {
            //Set the chrome styles
            if(isset($attribs['style'])) {
                $module->chrome  = explode(' ', $attribs['style']);
            }

            //Set the module attributes
            if($count == 1) {
                $attribs['rel']['first'] = 'first';
            }

            if($count == count($modules)) {
                $attribs['rel']['last'] = 'last';
            }

            if(!isset($module->attribs)) {
                $module->attribs = $attribs;
            } else {
                $module->attribs = array_merge($module->attribs, $attribs);
            }

            //Render the module
            $content = ComKoowaModuleHelper::renderModule($module, $attribs);

            //Prepend or append the module
            if(isset($module->attribs['prepend']) && $module->attribs['prepend']) {
                $html = $content.$html;
            } else {
                $html = $html.$content;
            }

            $count++;
        }

        return $html;
    }
1372876
static public function linkify($text, array $attribs = array()) {
        return self::linkUrls(self::linkEmailAddresses($text, $attribs), $attribs);
    }
1314697
protected function _renderScript($script, $link, $attribs = array())
    {
        if ($link) {
            $script = pick($this->getService('com:base.template.asset')->getURL($script), $script);
        }

        //if ajax try to get the content of the file
        if (AnRequest::type() == 'AJAX') {
            if ($link) {
                $file = $this->getService('com:base.template.asset')->getFilePath($script);
                if ($file) {
                    $script = file_get_contents($file);
                    $link = false;
                }
            }

            return parent::_renderScript($script, $link, $attribs);
        }

        $document = AnService::get('anahita:document');

        if($link) {
            return $document->addScript($script, 'text/javascript');
        } else {
            return $document->addScriptDeclaration($script);
        }
    }
1311299
protected function _renderPart($items, $options, $attrs)
    {
        if (is_object($items) && method_exists($items, 'toArray')) {
            $arrayItems = $items->toArray();
        } else {
            $arrayItems = (array)$items;
        }

        $chunkOut = '';
        $size = round(count($arrayItems) / intval($this->config('split')));
        $chunk = array_chunk($arrayItems, $size);
        $i = 1;

        foreach ($chunk as $menu) {
            $chunkOut .= $this->formatTemplate('parent', [
                'attrs' => $this->templater()->formatAttributes(['class' => "menu-part part-{$i}"]),
                'content' => $this->_render($menu, $this->config('formatter'))
            ]);
            $i++;
        }

        return $this->formatTemplate('div', [
            'attrs' => $this->templater()->formatAttributes($attrs),
            'content' => $chunkOut,
        ]);
    }
1258356
private function parse_attribs($attribs)
	{
		$ret     = array('default' => null);
		$attribs = trim($attribs);

		if($attribs == '')
			return $ret;

		// if this tag only has one = then there is only one attribute
		// so add it all to default
		if($attribs[0] == '=' && strrpos($attribs, '=') === 0)
			$ret['default'] = htmlentities(substr($attribs, 1), ENT_QUOTES | ENT_IGNORE, "UTF-8");
		else
		{
			preg_match_all('/(\S+)=((?:(?:(["\'])(?:\\\3|[^\3])*?\3))|(?:[^\'"\s]+))/',
				$attribs,
				$matches,
				PREG_SET_ORDER);

			foreach($matches as $match)
				$ret[$match[1]] = htmlentities($match[2], ENT_QUOTES | ENT_IGNORE, "UTF-8");
		}

		return $ret;
	}
319393
public function render($renderer, $curx = 0, $attrib = true)
    {
        // Set up the style
        if ($renderer->getCurrentStyle() != $this->styleName) {
            $renderer->setCurrentStyle($this->styleName);
        }
        $temptext = str_replace('#PAGENUM#', (string) $renderer->pageNo(), $this->text);
        // underline «title» part of Source item
        $temptext = str_replace([
            '«',
            '»',
        ], [
            '<u>',
            '</u>',
        ], $temptext);

        // If any text at all
        if (!empty($temptext)) {
            // If called by an other element
            if (!$attrib) {
                $renderer->write($temptext, $this->color);
            } else {
                // Save the start positions
                $startX = $renderer->getX();
                $startY = $renderer->getY();
                $width  = $renderer->getRemainingWidth();
                // If text is wider then page width then wrap it
                if ($renderer->getStringWidth($temptext) > $width) {
                    $lines = explode("\n", $temptext);
                    foreach ($lines as $line) {
                        echo '<div style="position:absolute;top:', $startY, 'pt;', $renderer->alignRTL, ':', $startX, 'pt;width:', $width, 'pt;">';
                        $line = $renderer->textWrap($line, $width);
                        $startY += $renderer->getTextCellHeight($line);
                        $renderer->setY($startY);
                        $renderer->write($line, $this->color);
                        echo "</div>\n";
                    }
                } else {
                    echo '<div style="position:absolute;top:', $startY, 'pt;', $renderer->alignRTL, ':', $startX, 'pt;width:', $width, 'pt;">';
                    $renderer->write($temptext, $this->color);
                    echo "</div>\n";
                    $renderer->setX($startX + $renderer->getStringWidth($temptext));
                    if ($renderer->countLines($temptext) != 1) {
                        $renderer->setXy(0, $startY + $renderer->getTextCellHeight($temptext));
                    }
                }
            }
        }
    }
253274
protected function _renderTag($attribs = array(), $content = null)
    {
        if($this->getTemplate()->decorator() == 'joomla')
        {
            $link      = isset($attribs['href']) ? $attribs['href'] : false;
            $relType  = 'rel';
            $relValue = $attribs['rel'];
            unset($attribs['rel']);
            unset($attribs['href']);

            JFactory::getDocument()->addHeadLink($link, $relValue, $relType, $attribs);
        }
        else return parent::_renderTag($attribs, $content);
    }
81947
protected function _renderAttributes(array $attributes = [])
    {
        $attributeStrings = [];
        foreach ($attributes as $attribute => $value) {
            $attributeStrings[] = $attribute . '="' . htmlentities($value) . '"';
        }

        if (empty($attributeStrings)) {
            return '';
        }

        return ' ' . join(' ', $attributeStrings);
    }
1301613
public function render(array $dbRows = null, $module = null)
    {
        // Rows HTML
        $rows = '';

        // if no rows data is passed - perform db request
        if (!isset($dbRows)) {
            $this->query->exec($dbRows);
        }

        // If we have table rows data
        if (is_array($dbRows)) {

            // Save quantity of rendering rows
            $this->last_render_count = sizeof($dbRows);

            // Iterate db data and perform rendering
            foreach ($dbRows as & $dbRow) {

                $rows .= $this->row($dbRow, $this->pager);
            }

        } // No data found after query, external render specified
        else $rows .= $this->emptyrow($this->query, $this->pager);

        // Columns headers HTML
        $thHTML = '';


        /** @var \samson\cms\CMSField $field Table structure fields */
        foreach ($this->headerFields as $field) {

            $description = $field->Description;

            // If its not localized field then show prefix on the name of field
            if ($field->local == 0) {
                $description .= " [".t('Общие', true)."]";
            }

            $thHTML .= $this->renderModule->view('table/thView')->set($description, 'fieldName')->output();
        }

        // Get all table materials
        //$defaultMaterialQuery = dbQuery('material')
        //    ->cond('parent_id', $this->material->id)
        //    ->cond('type', 3)
        //    ->cond('Active', 2)
        //    ->join('materialfield');
        // With specified fields if they exist
        //if (!empty($this->fields)) {
        //    $defaultMaterialQuery->cond('materialfield.FieldID', array_keys($this->fields));
        //}
        //if ($defaultMaterialQuery->first($defaultMaterial)) {
        //    $rows .= $this->row($defaultMaterial, $this->pager);
        //}


        // If there is some data in table
        if ($rows != '') {
            // Render table view
            return $this->renderModule
                ->view($this->table_tmpl)
                ->set($thHTML, 'thView')
                ->set($this->pager)
                ->set($rows, 'rows')
                ->output();
        } else {
            return '';
        }
    }
561360
public function setTableAttributes($attribs = [], $replace = false)
    {
        if ($replace) {
            $this->attribs = $attribs;
        } else {
            $this->attribs = array_merge($this->attribs, $attribs);
        }

        return $this;
    }
214970
protected function _addHtmlAttributes(string $html, array $attribs): string {
        $dom = new DOMDocument();
        $fragment = $dom->createDocumentFragment();
        $fragment->appendXML($html);
        $dom->appendChild($fragment);
        foreach ($attribs as $attrib => $value) {
            $dom->firstChild->setAttribute($attrib, $value);
        }
        return $dom->saveXML($dom->firstChild);
    }
644284
public function renderRaw($module, $theme, $template, array $vars = array())
    {
        // Save initial values before overriding theme
        $initialLayout = $this->layout;
        $initialModule = $this->module;
        $initialTheme = $this->theme;

        // Configure view with new values
        $this->setModule($module)
             ->setTheme($theme)
             ->disableLayout();

        $response = $this->render($template, $vars);

        // Restore initial values now
        $this->layout = $initialLayout;
        $this->module = $initialModule;
        $this->theme = $initialTheme;

        return $response;
    }
863820
protected function _renderButton($label, $attrbs)
    {
        $attrbs = new AnConfig($attrbs);

        $attrbs->append(array(
            'class' => '',
        ));

        $attrbs->class .= 'btn small';

        if (isset($attrbs->type)) {
            $attrbs->class .= ' btn-'.$attrbs->type;

            unset($attrbs->type);
        }

        $attrbs = AnConfig::unbox($attrbs);

        foreach ($attrbs as $key => $value) {
            $attrbs[$key] = $key.'="'.$value.'"';
        }

        $attrbs = implode(' ', $attrbs);

        return '<a '.$attrbs.'>'.$label.'</a>';
    }
213776
public function render($name = '', $content = '', array $attrs = array(), $type = 'submit')
    {
        $attrs = array_merge(array('text' => null, 'name' => $name), $attrs);

        $attrs = $this->_getBtnClasses($attrs);
        $attrs['type'] = $type;

        if (Arr::key('icon', $attrs)) {
            $content = '<i class="' . $this->_icon . '-' . $attrs['icon'] . '"></i> ' . $this->_translate($content);
            unset($attrs['icon']);
        }

        return '<button ' . $this->buildAttrs($attrs) . '>' . $content . '</button>';
    }
1009426
protected function _renderTag($attribs = array(), $content = null)
    {
        unset($attribs['content']);
        unset($attribs['separator']);

        $attribs = $this->buildAttributes($attribs);

        if($this->getConfig()->escape) {
            $content = $this->getTemplate()->escape($content);
        }

        $html = '<title '.$attribs.'>'.$content.'</title>'."\n";
        return $html;
    }
1371036
public function setCustomHtmlAttribs(array $attribs)
        {
            foreach ($attribs as $key => $value) {
                $this->setCustomHtmlAttrib($key, $value);
            }
            return $this;
        }
1329734
static public function renderTag($args){
        $attr = $args['@attrib'];
        $tmp = Template::instance();
        foreach($attr as &$att)
            $att = $tmp->token($att);
        $pn_code = '$pn = new Pagination('.$attr['items'].');';
        if(array_key_exists('limit',$attr))
            $pn_code .= '$pn->setLimit('.$attr['limit'].');';
        if(array_key_exists('range',$attr))
            $pn_code .= '$pn->setRange('.$attr['range'].');';
        if(array_key_exists('src',$attr))
            $pn_code .= '$pn->setTemplate("'.$attr['src'].'");';
        if(array_key_exists('token',$attr))
            $pn_code .= '$pn->setRouteKey("'.$attr['token'].'");';
        if(array_key_exists('link-path',$attr))
            $pn_code .= '$pn->setLinkPath("'.$attr['link-path'].'");';
        if(array_key_exists('token-prefix',$attr))
            $pn_code .= '$pn->setRouteKeyPrefix("'.$attr['token-prefix'].'");';
        $pn_code .= 'echo $pn->serve();';
        return '<?php '.$pn_code.' ?>';
    }