Generate HTML

@param $data
@return string
180689
public function generate($data){
		if($data->result){
			$bRouter=BRouter::getInstance();
			$url=$bRouter->generateURL('users',array('view'=>'registerdone'),array('usehostname'=>true));
			$this->setLocation($url,0);
			return '';
			}
		$this->email=$data->email;
		$this->name=$data->name;
		$this->errors=$data->errors;
		$this->socLoginList=BSocialFabric::getSocialList();
		$this->setTitle(BLang::_('USERS_REGISTRATION_TITLE'));
		return $this->templateLoad();
		}
1070869
public function xml($data)
    {
        if ($data instanceof SimpleXMLElement) {
            $data = $data->saveXML();
        }
        $dom = new DOMDocument();
        $dom->loadXml($data);
        $dom->formatOutput = true;
        return $dom->saveXML();
    }
1352219
public function encodeArray($data) {
        $d = array();
        foreach ($data as $key => $value) {
            if (is_string($key))
                $key = htmlspecialchars($key);
            if (is_string($value))
                $value = htmlspecialchars($value);
            elseif (is_array($value))
                $value = self::encodeArray($value);
            $d[$key] = $value;
        }
        return $d;
    }
681101
public function parse($data)
    {
        $this->table();
        $this->images();
        $this->text();
        $this->html();

        // Replace everything that has been found
        foreach ($this->matches as $key => $val) {
            $data = preg_replace_callback($key, $val, $data);
        }

        // Replace line-breaks
        return preg_replace_callback("/\n\r?/", function () {
            return '<br />';
        }, $data
        );
    }
739151
public function generate(array $data): string
    {
        // Nothing checked by default
        $value = 0;
        // If there is more than one option, set the second one checked
        if (isset($data['fieldConfig']['config']['items'])
            && is_array($data['fieldConfig']['config']['items'])
            && count($data['fieldConfig']['config']['items']) > 1
        ) {
            $value = 2;
        }
        return (string)$value;
    }
819404
public function output_html($data, $query='') {
        global $OUTPUT;

        $default = $this->get_defaultsetting();
        $defaultinfo = $default;
        if (!is_null($default) and $default !== '') {
            $defaultinfo = "\n".$default;
        }

        $context = (object) [
            'cols' => $this->cols,
            'rows' => $this->rows,
            'id' => $this->get_id(),
            'name' => $this->get_full_name(),
            'value' => $data,
            'forceltr' => $this->get_force_ltr(),
        ];
        $element = $OUTPUT->render_from_template('core_admin/setting_configtextarea', $context);

        return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $defaultinfo, $query);
    }
1187379
public function output_html($data, $query='') {
        global $CFG, $OUTPUT;
        $return = '';

        $formats = core_plugin_manager::instance()->get_plugins_of_type('dataformat');

        $txt = get_strings(array('settings', 'name', 'enable', 'disable', 'up', 'down', 'default'));
        $txt->uninstall = get_string('uninstallplugin', 'core_admin');
        $txt->updown = "$txt->up/$txt->down";

        $table = new html_table();
        $table->head  = array($txt->name, $txt->enable, $txt->updown, $txt->uninstall, $txt->settings);
        $table->align = array('left', 'center', 'center', 'center', 'center');
        $table->attributes['class'] = 'manageformattable generaltable admintable';
        $table->data  = array();

        $cnt = 0;
        $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'iconsmall'));
        $totalenabled = 0;
        foreach ($formats as $format) {
            if ($format->is_enabled() && $format->is_installed_and_upgraded()) {
                $totalenabled++;
            }
        }
        foreach ($formats as $format) {
            $status = $format->get_status();
            $url = new moodle_url('/admin/dataformats.php',
                    array('sesskey' => sesskey(), 'name' => $format->name));

            $class = '';
            if ($format->is_enabled()) {
                $strformatname = $format->displayname;
                if ($totalenabled == 1&& $format->is_enabled()) {
                    $hideshow = '';
                } else {
                    $hideshow = html_writer::link($url->out(false, array('action' => 'disable')),
                        $OUTPUT->pix_icon('t/hide', $txt->disable, 'moodle', array('class' => 'iconsmall')));
                }
            } else {
                $class = 'dimmed_text';
                $strformatname = $format->displayname;
                $hideshow = html_writer::link($url->out(false, array('action' => 'enable')),
                    $OUTPUT->pix_icon('t/show', $txt->enable, 'moodle', array('class' => 'iconsmall')));
            }

            $updown = '';
            if ($cnt) {
                $updown .= html_writer::link($url->out(false, array('action' => 'up')),
                    $OUTPUT->pix_icon('t/up', $txt->up, 'moodle', array('class' => 'iconsmall'))). '';
            } else {
                $updown .= $spacer;
            }
            if ($cnt < count($formats) - 1) {
                $updown .= '&nbsp;'.html_writer::link($url->out(false, array('action' => 'down')),
                    $OUTPUT->pix_icon('t/down', $txt->down, 'moodle', array('class' => 'iconsmall')));
            } else {
                $updown .= $spacer;
            }

            $uninstall = '';
            if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
                $uninstall = get_string('status_missing', 'core_plugin');
            } else if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
                $uninstall = get_string('status_new', 'core_plugin');
            } else if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('dataformat_'.$format->name, 'manage')) {
                if ($totalenabled != 1 || !$format->is_enabled()) {
                    $uninstall = html_writer::link($uninstallurl, $txt->uninstall);
                }
            }

            $settings = '';
            if ($format->get_settings_url()) {
                $settings = html_writer::link($format->get_settings_url(), $txt->settings);
            }

            $row = new html_table_row(array($strformatname, $hideshow, $updown, $uninstall, $settings));
            if ($class) {
                $row->attributes['class'] = $class;
            }
            $table->data[] = $row;
            $cnt++;
        }
        $return .= html_writer::table($table);
        return highlight($query, $return);
    }
830265
private function htmlEncode($data)
    {
        if (empty($data)) {
            return null;
        }

        $safeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890._-";

        $result = "";
        for ($i = 0; $i < strlen($data); $i++) {
            if (strstr($safeChars, $data[$i])) {
                $result .= $data[$i];
            } else if ("7F" >= $var = bin2hex(substr($data, $i, 1))) {
                $result .= "&#x" . $var . ";";
            } else {
                $result .= $data[$i];
            }
        }

        return $result;
    }
105379
private static function wringer($data)
    {
        if (is_object($data)) {
            if ($data instanceof \BootPress\Blog\Twig\Object) {
                $data = $data->properties + $data->methods;
            } elseif ($data instanceof \BootPress\Blog\Twig\Page) {
                $data = $data->html + $data->methods;
            } else {
                $data = get_class($data).' Object';
            }
        }
        if (is_array($data)) {
            $cloner = array();
            foreach ($data as $key => $value) {
                $cloner[$key] = self::wringer($value);
            }

            return $cloner;
        }
        if (is_string($data)) {
            $data = str_replace(array("\r", "\n", "\t"), array('\\r', '\\n', '\\t'), $data);
        }

        return $data;
    }
1130624
public function htmlEncode($data)
    {
        switch (gettype($data)) {
            case 'array':
                foreach ($data as $key => $value) {
                    $data[$key] = $this->htmlEncode($value);
                }

                break;
            case 'object':
                $data = clone $data;

                foreach ($data as $key => $value) {
                    $data->$key = $this->htmlEncode($value);
                }

                break;
            case 'string':
            default:
                $data = htmlentities($data, ENT_QUOTES, 'UTF-8');

                break;
        }

        return $data;
    }
1056087
public function encode($data): string
    {
        $headerVar = $this->getHeaderField();
        $bodyVar = $this->getBodyField();

        $header = isset($data[$headerVar]) ? (array) $data[$headerVar] : [];
        $body = isset($data[$bodyVar]) ? (string) $data[$bodyVar] : '';

        // Create Markdown file with YAML header.
        $encoded = '';
        if ($header) {
            $encoded = "---\n" . trim($this->getHeaderFormatter()->encode($data['header'])) . "\n---\n\n";
        }
        $encoded .= $body;

        // Normalize line endings to Unix style.
        $encoded = preg_replace("/(\r\n|\r)/", "\n", $encoded);

        return $encoded;
    }
856092
public function html()
    {
        if (!$this->hasContent() && !$this->isEditable()) {
            return '';
        }

        $content = $this->hasContent() ? $this->show() : $this->showDefault();

        // If the return data is a View then assign any parameters to it.
        if ($content instanceof View && !empty($this->viewParams)) {
            $content->with($this->viewParams);
        }

        return (string) $content;
    }
111767
public function showHtmlFormGroup($data = [])
    {
        $html = '<div class="form-group">
                                <label class="col-md-3 control-label">' . $data['label'] . '</label>
                                <div class="col-md-' . $data['col'] . '">
                                    <input name="' . $data['name'] . '" value="' . $data['value'] . '" placeholder="' . $data['placeholder'] . '" type="' . $data['type'] . '" class="form-control">
                                    <p class="help-block">' . $data['help-block'] . '</p>
                                </div>
                            </div>';

        return $html;
    }
760825
public function __toHtml()
    {
        try {
            $this->parse();
            $str = \Library\Helper\Html::writeHtmlTag(
                'script', null, array(
                    'src'=>$this->transformed_data['src'],
                    'type'=>$this->transformed_data['type']
                ), true
            );
        } catch (\Exception $e) {
            $str = $e->getMessage();
        }
        return $str;
    }
766795
public function generateAndRender($content, $data)
    {
        $filename = $this->generateViewFile($content);
        try {
            $rendered = $this->render($filename, $data);
        } catch (\Exception $e) {
            $this->remove($filename);
            throw $e;
        }

        $this->remove($filename);

        return $rendered;
    }
1129533
final public function render($data = array())
    {
        $context = $this->getContext();
        $context->data = array_merge($this->getData(), $data);

        if ($this->invokeCommand('before.render', $context) !== false)
        {
            //Render the view
            $context->result = $this->_actionRender($context);
            $this->invokeCommand('after.render', $context);
        }

        //Set the content
        $this->setContent($context->result);

        return $context->result;
    }
1117827
public function renderRawData($data = '')
    {
        $layoutPath = null;
        if ($this->layout && (!$layoutPath = $this->getLayoutFile((new KernelInjector)->build()->getAppDir(),
                $this->module))
        ) {
            (new LoggerInjector)->build()->send('error', 'Layout `'.$this->layout.'` not found');
        }

        if ($layoutPath) {
            $data = $this->insertStyleScripts($this->renderFile($layoutPath, ['content' => $data]));
        }

        return $data;
    }