Generate the pattern preview

@return string HTML code
326983
public function preview()
	{
		$objModule = \ModuleModel::findByPk($this->module);
		
		return '<div class="widget"><span style="color:#b3b3b3 ">' . $objModule->name . ' (ID ' . $objModule->id . ')</span></div>';
	}
567155
public function preview()
	{
		$strPreview = '<div class="widget" style="padding-top:10px;"><h3 style="margin: 0;"><label>' . $this->label . '</label></h3><div class="selector_container"><ul>';

		if ($this->multiArticle)
		{
			$strPreview .= '<li><img src="system/themes/flexible/icons/articles.svg" width="18" height="18" alt=""> Articletitle1</li><li><img src="system/themes/flexible/icons/articles.svg" width="18" height="18" alt=""> Articletitle2</li><li><img src="system/themes/flexible/icons/articles.svg" width="18" height="18" alt=""> Articletitle3</li>';				
		}
		else
		{
			$strPreview .= '<li><img src="system/themes/flexible/icons/articles.svg" width="18" height="18" alt=""> Articletitle</li>';				
		}

		$strPreview .= '</ul><p><a href="javascript:void(0);" class="tl_submit">Change selection</a></p></div><p title="" class="tl_help tl_tip">' . $this->description . '</p></div>';

		return $strPreview;

	}
564539
public function previewHTML($html)
    {
        $html = $this->parsingHtml->prepareHtml($html);

        $html = preg_replace('/<page([^>]*)>/isU', '<hr>Page : $1<hr><div$1>', $html);
        $html = preg_replace('/<page_header([^>]*)>/isU', '<hr>Page Header : $1<hr><div$1>', $html);
        $html = preg_replace('/<page_footer([^>]*)>/isU', '<hr>Page Footer : $1<hr><div$1>', $html);
        $html = preg_replace('/<\/page([^>]*)>/isU', '</div><hr>', $html);
        $html = preg_replace('/<\/page_header([^>]*)>/isU', '</div><hr>', $html);
        $html = preg_replace('/<\/page_footer([^>]*)>/isU', '</div><hr>', $html);

        $html = preg_replace('/<bookmark([^>]*)>/isU', '<hr>bookmark : $1<hr>', $html);
        $html = preg_replace('/<\/bookmark([^>]*)>/isU', '', $html);

        $html = preg_replace('/<barcode([^>]*)>/isU', '<hr>barcode : $1<hr>', $html);
        $html = preg_replace('/<\/barcode([^>]*)>/isU', '', $html);

        $html = preg_replace('/<qrcode([^>]*)>/isU', '<hr>qrcode : $1<hr>', $html);
        $html = preg_replace('/<\/qrcode([^>]*)>/isU', '', $html);

        echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>HTML View</title>
        <meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'" >
    </head>
    <body style="padding: 10px; font-size: 10pt;font-family:    Verdana;">
    '.$html.'
    </body>
</html>';
    }
234927
public function generate(): string
    {
        $fieldId = $this->controllData['field-id'];
        $label = $this->controllData['label'];
        $label = $label != Tags::NBSP ? $label.':' : $label;
        $icons = '';
        $class = ['controll'];
        $ret = [];

        if ($this->controllData['required'] == 1) {
            $class[] = 'is-required';
        }
        if ($this->controllData['help'] != '') {
            $icons .= Tags::i($this->controllData['help'], ['class' => 'icon-help']);
            $class[] = 'has-help';
        }
        if ($this->controllData['error'] != '') {
            $icons .= Tags::i($this->controllData['error'], ['class' => 'icon-error']);
            $class[] = 'has-error';
        }

        $ctrl = Tags::div($label, ['class' => 'label']);
        $ctrl .= Tags::div($this->controllData['controll'], ['class' => 'html-controll']);
        $ctrl .= Tags::div($icons, ['class' => 'icons']);
        $ret[] = Tags::div($ctrl, ['class' => \implode(' ', $class), 'data-field-id' => $fieldId]);

        if ($this->controllData['script'] != '') {
            $ret[] = Tags::script(\str_replace(Tags::CRLF, ' ', $this->controllData['script']));
        }

        return \implode(Tags::CRLF, $ret);
    }
226906
public function preview()
    {
        // Enable theme for preview (may be needed for Shortcodes)
        Config::nest();
        Config::modify()->set(SSViewer::class, 'theme_enabled', true);

        $content = $this->customise([
            'Body' => $this->record->getEmailBodyContent(),
            'HideFormData' => (bool) $this->record->HideFormData,
            'Fields' => $this->getPreviewFieldData()
        ])->renderWith($this->record->EmailTemplate);

        Config::unnest();

        return $content;
    }
488310
public function display()
    {
        if ($this->content instanceof Exception) {

            $error = $this->content;
            $layout = $error->getCode();

            if (! $this->getTemplate()->findPath('errors'.DS.$layout.'.php')) {
                $layout = 'default';
            }

            $this->content = $this->getTemplate()->loadTemplate('errors'.DS.$layout, array('error' => $error))->render();

            $settings = $this->getService('com:settings.setting');

            if ($settings->debug) {

                $traces = array();
                $traces[] = '<h4>Exception '.get_class($error).' with message "'.$error->getMessage().'"</h4>';
                $traces[] = $error->getFile().':'.$error->getLine();

                foreach ($error->getTrace() as $trace) {
                    $str = '';

                    if (isset($trace['file'])) {
                        $str = $trace['file'].':';
                    }

                    if (isset($trace['line'])) {
                        $str .= $trace['line'];
                    }

                    if (empty($str)) {
                        continue;
                    }

                    $traces[] = $str;
                }

                $this->content .= '<pre>'.implode('<br />', $traces).'</pre>';
            }
        }

        $this->output = $this->getTemplate()->loadTemplate($this->getLayout(), array('output' => $this->content))->render();

        return $this->output;
    }
149557
public function preview() {
        $auth=$this->request->getVar('auth');
        $token=KapostPreviewToken::get()->filter('Code', Convert::raw2sql($auth))->first();
        
        //Verify the token exists and hasn't expired yet
        if(!empty($token) && $token!==false && $token->exists() && time()-strtotime($token->Created)<self::config()->preview_token_expiry*60 && $token->KapostRefID==$this->urlParams['ID']) {
            $kapostObj=KapostObject::get()->filter('KapostRefID', Convert::raw2sql($this->urlParams['ID']))->sort('"Created" DESC')->first();
            if(!empty($kapostObj) && $kapostObj!==false && $kapostObj->exists()) {
                $previewController=$kapostObj->renderPreview();
                
                $this->extend('updatePreviewDisplay', $kapostObj, $previewController);
                
                return $previewController;
            }
        }
        
        
        //Token expired or object not found
        if(class_exists('ErrorPage')) {
            $response=ErrorPage::response_for(404);
            if(!empty($response)) {
                return parent::httpError(404, $response);
            }
        }
        
        return parent::httpError(404);
    }
1252214
private function generateTemplate()
    {
        $relPath = '/Resources/views/';
        $this->renderFiles(
            $this->skeletonDir . $relPath,
            $this->getTemplateDir($this->bundle),
            array('bundle' => $this->bundle, 'demosite' => $this->demosite, 'shortBundleName' => $this->shortBundleName, 'isV4' => $this->isSymfony4()),
            true
        );

        if (!$this->demosite) {
            // Layout
            $this->removeFile($this->getTemplateDir($this->bundle) . '/Layout/_mobile-nav.html.twig');
            $this->removeFile($this->getTemplateDir($this->bundle) . '/Layout/_demositemessage.html.twig');
        }

        $this->assistant->writeLine('Generating template files : <info>OK</info>');
    }
1073922
public function getPreview(): ?string
    {
        $array = glob($this->getPath() . '/assets/images/preview.{jpg,jpeg,png,gif}', GLOB_BRACE);
        if (isset($array[0])) {
            return sprintf('/themes/%s/images/%s', $this->shortName, (new SplFileInfo($array[0]))->getBasename());
        }

        return null;
    }
1025053
protected function getPattern(): string
    {
        $path = preg_replace_callback('~:([a-z][a-z0-9\_]+)~i', function ($match) {
            return sprintf('(?<%s>%s)', $match[1], '[^\/]*');
        }, $this->getPath());

        return sprintf('~\G(%s)(/|\z)~', $path);
    }
982362
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        $javascript .= sprintf(
            "var %s = new %s(\n" . "%s, %s, %s, %s, %s, %s);\n",
            $this->id,
            $this->getJavaScriptClass(),
            SwatString::quoteJavaScriptString($this->id),
            SwatString::quoteJavaScriptString($this->preview_image),
            intval($this->preview_width),
            intval($this->preview_height),
            $this->show_title ? 'true' : 'false',
            SwatString::quoteJavaScriptString($this->preview_title)
        );

        if ($this->container_width !== null) {
            $javascript .= sprintf(
                "%s.width = %s;",
                $this->id,
                (int) $this->container_width
            );
        }

        if ($this->container_height !== null) {
            $javascript .= sprintf(
                "%s.height = %s;",
                $this->id,
                (int) $this->container_height
            );
        }

        return $javascript;
    }
860396
public function _toHtml()
    {
        $html = '';

        foreach ($this->getChildNames() as $childName) {
            if ($html === '') {
                $renderer = $this->getChildBlock($childName);
                $html = $renderer->render($this->getFilter());
            }
        }

        return $html;
    }
1335414
protected function generateHtml($preview = false)
    {
        if ($this->codeDefinition) {
            if ($preview) {
                return $this->codeDefinition->getPreviewHtml($this);
            }
            return $this->codeDefinition->getHtml($this);
        }

        return "";
    }
948645
protected function _toHtml()
    {
        $html = false;

        if ($this->canRenderFilter()) {
            $html = $this->getLayout()
                ->createBlock($this->block)
                ->setSwatchFilter($this->getFilter())
                ->toHtml();
        }

        return $html;
    }
564847
protected function getScanExcludePattern()
    {
        $pattern = implode('|', array_keys(array_filter((array)$this->settings['scan']['excludePatterns'])));
        if ($pattern !== '') {
            $pattern = '#' . str_replace('#', '\#', $pattern) . '#';
        }
        return $pattern;
    }
859713
public function preview()
	{
		$strPreview = '<div class="' . (($this->classLong) ? 'long' : 'w50') . ((in_array($this->picker, array('datetime', 'color', 'link'))) ? ' wizard' : '') . ' widget" style="padding-top:10px;"><h3><label>' . $this->label . '</label></h3>';

		if ($this->picker == 'unit')
		{
			$strPreview .= '<input class="tl_text_unit" value="' . $this->defaultValue . '" type="text">';
			$strPreview .= ' <select class="tl_select_unit">';

			$units = StringUtil::deserialize($this->units);
			foreach ($units as $unit)
			{
				$strPreview .= '<option value="' . $unit['value'] . '">' . $unit['label'] . '</option>';
			}

			$strPreview .= '</select>';
		}
		
		elseif ($this->multiple)
		{
			$strPreview .= '<div>';
			
			for ($i = 0; $i < $this->multiple; $i++)
			{
				$strPreview .= '<input class="tl_text_' . $this->multiple . '" value="' . $this->defaultValue . '" type="text"> ';
			}

			$strPreview .= '</div>';
		}
		
		else
		{
			$strPreview .= '<input class="tl_text" value="' . $this->defaultValue . '" type="text">';
		}
		
		switch ($this->picker)
		{
			case 'datetime':
				$strPreview .=  ' <img src="assets/datepicker/images/icon.svg" height="20" width="20">';
				break;

			case 'color':
				$strPreview .=  ' <img src="system/themes/flexible/icons/pickcolor.svg" height="16" width="16">';
				break;
			
			case 'link':
				$strPreview .=  ' <img src="system/themes/flexible/icons/pickpage.svg" height="16" width="16">';
				break;
		}
		
		$strPreview .= '<p title="" class="tl_help tl_tip">' . $this->description . '</p></div>';	

		return $strPreview;
	}
1098976
public function getPattern()
    {
        $pattern = null;

        if ($patternNodes = $this->element->getElementsByTagName('pattern')) {
            if ($patternNodes->length > 0) {
                $pattern = $patternNodes->item(0)->getAttribute('value');
            }
        }

        return $pattern;
    }