Returns a UML Diagramm of the Class as HTML Code.
@access		public
@param		bool		$showPrivate		Flag: show private Variables & Functions in UML
@param		string		$template			Template URI to use
@return		string
196376
public function toUML( $showPrivate = FALSE, $template = FALSE )
	{
		if( !$template )
			$template = dirname( __FILE__ )."/ClassParserUML.tpl";
		$data = $this->getClassData();
		$vars = $methods = $props = array();
		
		if( count( $data['class']['desc']))
			$props['class']['desc']		= implode( "<br/>", $data['class']['desc'] );
		if( $data['class']['package'])
			$props['class']['package']	= $data['class']['package'][0];
		if( $data['subpackage'])
			$props['class']['subpackage']	= $data['class']['subpackage'][0];
		if( $data['class']['extends'])
			$props['class']['extends']	= implode( ", ", $data['class']['extends'] );
		if( count( $data['class']['uses']))
			$props['class']['uses']		= implode( ", ", $data['class']['uses'] );
		if( count( $data['imports']))
			$props['imports']			= implode( ", ", array_keys($data['imports'] ) );
		if( $data['class']['author'])
			$props['class']['author']		= implode( ", ", $data['class']['author'] );
		if( $data['class']['since'])
			$props['class']['author']		= $data['class']['since'][0];
		if( $data['class']['version'])
			$props['class']['version']		= $data['class']['version'][0];
		if( count($data['class']['todo']))
			$props['class']['todo']		= implode( ", ", $data['class']['todo'] );
//		$props = implode ("\n\t  ", $props);

		foreach( $data['methods'] as $methodName => $methodData )
		{
			if( count( $methodData['param'] ) )
			{
				$params = array();
				foreach( $methodData['param'] as $param => $p_data )
					$params[] = $p_data['type']." ".( $p_data['desc'] ? "<acronym title='".$p_data['desc']."'>".$param."</acronym>" : $param);
				$params =  implode( ", ", $params );
			}
			if( count( $methodData['desc'] ) )
				$methodName	= "<acronym title='".implode( " ", $methodData['desc'] )."'>".$methodName."</acronym>";
			if( $methodData['access'] != "private" || ( $methodData['access'] == "private" && $showPrivate ) )
				$methods[] = "<tr><td>".$methodData['access']."</td><td>".$methodData['return']."</td><td>".$methodName."( ".$params.")</td></tr>";
		}
		$methods = implode( "\n\t  ", $methods );

		
		foreach( $data['vars'] as $varName => $varData )
		{
			if( count( $varData['desc'] ) )
				$protected = "<acronym title='".implode( " ", $varData['desc'] )."'>".$var."</acronym>";
			if( $varData['access'] != "private" || ( $varData['access'] == "private" && $showPrivate ) )
				$vars[] = "<tr><td>".$varData['access']."</td><td>".$varData['type']."</td><td>".$varName."</td></tr>";
		}
		$vars = implode( "\n\t  ", $vars );
		require_once( $template );
		return $code;	
	}
273432
public function render_model($template)
    {
        if ($this->options['image_uploads'] || $this->options['file_uploads']) {
            if ($this->options['image_uploads']) {
                $this->modelReplacements[':uses'][] = UploadImageInterface::class;
                $this->modelReplacements[':implementations'][] = class_basename(UploadImageInterface::class);
                $this->modelReplacements[':uses'][] = AdminImage::class;
                $this->modelReplacements[':traits'][] = class_basename(AdminImage::class);
            }

            if ($this->options['file_uploads']) {
                $this->modelReplacements[':uses'][] = UploadFileInterface::class;
                $this->modelReplacements[':implementations'][] = class_basename(UploadFileInterface::class);
                $this->modelReplacements[':uses'][] = AdminFile::class;
                $this->modelReplacements[':traits'][] = class_basename(AdminFile::class);
            }
        }

        $this->modelReplacements[':app_namespace'] = $this->getAppNamespace();
        $this->modelReplacements[':table_name'] = str_plural($this->identifier);
        $this->modelReplacements[':model_name'] = $this->command->model_name($this->identifier);
        $this->modelReplacements[':identifier'] = $this->identifier;

        $this->prepareReplacements();

        // Check to see if route is not already used
        if (\Route::has($this->identifier.'.index')) {
            // Check if admin is also free
            if (\Route::has('admin.'.$this->identifier.'.index')) {
                throw new \Exception('Resource `'.$this->identifier.'` already exists');
            }

            // We need to append admin
            foreach ($this->routeActions as $action) {
                $this->routeNames[$action] = 'admin.'.$this->identifier.'.'.$action;
            }
        }

        $route = "Route::resource('$this->identifier', 'Admin\\".$this->command->controller_name($this->identifier)."'";
        if (! empty($this->routeNames)) {
            // create the resource names
            $route .= ',['.PHP_EOL."'names' => [".PHP_EOL;
            foreach ($this->routeNames as $action => $name) {
                $route .= "'$action' => '$name',".PHP_EOL;
            }

            $route .= ']'.PHP_EOL.']);'.PHP_EOL;
        } else {
            // Close the Route resource
            $route .= ');'.PHP_EOL;
        }

        if ($this->options['file_uploads']) {
            $route .= "Route::get('$this->identifier/delete/{fileFieldName}', 'Admin\\".$this->command->controller_name($this->identifier)."@deleteFile');".PHP_EOL;
        }

        $this->appendToFile(base_path('routes/resources.php'), $route);

        $template = strtr($template, $this->modelReplacements);

        return $template;
    }
585207
function display( $template = false, $extraParameters = false )
    {
        $output = $this->fetch( $template, $extraParameters );
        if ( $this->ShowDetails )
        {
            echo '<h1>Result:</h1>' . "\n";
            echo '<hr/>' . "\n";
        }
        echo "$output";
        if ( $this->ShowDetails )
        {
            echo '<hr/>' . "\n";
        }
        if ( $this->ShowDetails )
        {
            echo "<h1>Template data:</h1>";
            echo "<p class=\"filename\">" . $template . "</p>";
            echo "<pre class=\"example\">" . htmlspecialchars( $this->Text ) . "</pre>";
            reset( $this->IncludeText );
            while ( ( $key = key( $this->IncludeText ) ) !== null )
            {
                $item = $this->IncludeText[$key];
                echo "<p class=\"filename\">" . $key . "</p>";
                echo "<pre class=\"example\">" . htmlspecialchars( $item ) . "</pre>";
                next( $this->IncludeText );
            }
            echo "<h1>Result text:</h1>";
            echo "<p class=\"filename\">" . $template . "</p>";
            echo "<pre class=\"example\">" . htmlspecialchars( $output ) . "</pre>";
            reset( $this->IncludeOutput );
            while ( ( $key = key( $this->IncludeOutput ) ) !== null )
            {
                $item = $this->IncludeOutput[$key];
                echo "<p class=\"filename\">" . $key . "</p>";
                echo "<pre class=\"example\">" . htmlspecialchars( $item ) . "</pre>";
                next( $this->IncludeOutput );
            }
        }
    }
1230500
private function makeTemplate($sub_directories, $pre_model_path, $model, $no_get_id)
    {
        $file = __DIR__ . "/../templates/model/";
        $file .= $no_get_id ? "model.php.dist" : "model-with-get-id.php.dist";

        if (file_exists($file))
        {
            $template = strtr(file_get_contents($file), [
                '{{namespace}}' => get_app_namespace(),
                '{{sub_directories}}' => $sub_directories,
                '{{model}}' => $model
            ]);

            $file_path = "{$pre_model_path}/{$model}.php";

            $file = fopen($file_path, "w");
            fwrite($file, $template);
            fclose($file);

            return file_exists($file_path);
        }

        return false;
    }
773657
public function previewElementPattern($arrRow)
	{
		$key = $arrRow['invisible'] ? 'unpublished' : 'published';
		$type = $GLOBALS['TL_LANG']['CTP'][$arrRow['type']][0] ?: '&nbsp;';

		// Prepare option string (alias / replicable)
		switch ($arrRow['type'])
		{
			case 'section':
			case 'explanation':
			case 'protection':
			case 'visibility':
				break;
			
			default:
				$options = '<span style="color: #b3b3b3 ;padding-left: 3px"> (Template alias: $this->' . $arrRow['alias'] . ')</span>';
				break;
		}
		
		// Get pattern model and call view method
		$objPattern = new \PatternModel();
		$objPattern->setRow($arrRow);
		
		$strClass = Agoat\CustomContentElementsBundle\Contao\Pattern::findClass($objPattern->type);
				
		if (!class_exists($strClass))
		{
			static::log('Pattern element class "'.$strClass.'" (pattern element "'.$objPattern->type.'") does not exist', __METHOD__, TL_ERROR);
		}
		else
		{
			$objPatternClass = new $strClass($objPattern);	
			$strPatternView = $objPatternClass->preview();
		}
		
		return '<div class="cte_type ' . $key . '">' . $type . $options . '</div><div style="padding: 5px 0 10px;">' . $strPatternView . '</div>';
	}
1261339
public function getMailingTemplates($isPrivate = true) {
        $data["Envelope"] = array(
            "Body" => array(
                "GetMailingTemplates" => array(
                    "VISIBILITY" => ($isPrivate ? '0' : '1'),
                ),
            ),
        );
        $response = $this->_request($data);
        $result = $response["Envelope"]["Body"]["RESULT"];
        if ($this->_isSuccess($result)) {
            if (isset($result['MAILING_TEMPLATE']))
                return $result['MAILING_TEMPLATE'];
            else {
                return array(); //?
            }
        } else {
            throw new \Exception("GetLists Error: ".$this->_getErrorFromResponse($response));
        }
    }
295448
private function renderTokens($template = '', $context = [])
    {
        if ($context) {
            $this->tokenHelper->addContext($context);
        }

        return $this->tokenHelper->render($template);
    }
878121
private function getRenderer(string $template): string
    {
        if (is_readable($template) === false) {
            throw new View\Exception('Could not open file "' . basename($template) . '"');
        }

        $suffix = strtolower(pathinfo($template, PATHINFO_EXTENSION));

        if (isset($this->renderer[$suffix]) === false) {
            throw new View\Exception('No template engine registered for file extension "' . $suffix . '"');
        }

        return $this->renderer[$suffix];
    }
140032
protected function renderElements($template)
    {
        return preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) {
            $name = $matches[1];
            if (isset($this->elements[$name])) {
                if ($name === 'bulk-actions' && $this->grid !== null) {
                    $id = $this->options['id'];
                    $this->view->registerJs("$('#{$id} #{$this->_bulkActionsId}').change(function() {
                        if (this.value) {
                            var ids = $('#{$this->grid}').yiiGridView('getSelectedRows'),
                                options = this.options[this.selectedIndex],
                                dataConfirm = options.getAttribute('data-confirm'),
                                url = options.getAttribute('url');

                            if (!ids.length) {
                                alert('" . $this->t('widget', 'Please select one or more items from the list.') . "');
                                this.value = '';
                            } else if (dataConfirm && !confirm(dataConfirm)) {
                                this.value = '';
                                return;
                            } else if (url) {
                                var form = $('<form action=' + url + ' method=\"POST\"></form>'),
                                    csrfParam = $('meta[name=csrf-param]').prop('content'),
                                    csrfToken = $('meta[name=csrf-token]').prop('content');

                                if (csrfParam) {
                                    form.append('<input type=\"hidden\" name=' + csrfParam + ' value=' + csrfToken + ' />');
                                }
                                $.each(ids, function(index, id) {
                                    form.append('<input type=\"hidden\" name=\"' + (options.getAttribute('name') ? options.getAttribute('name') : 'ids') + '[]\" value=' + id + ' />');
                                });
                                form.appendTo('body').submit();
                            }
                        }
                    });");
                }

                return $this->elements[$name];
            } else {
                return '';
            }
        }, $template);
    }
893889
protected function getAutoBindings(string $template)
    {
        if (is_null($this->variableProvider)) {
            return [];
        }

        $bindings = $this->variableProvider->provideVariables($template);

        return $bindings;
    }
614960
public function outputFrontendTemplateHook($content, $template)
	{
		if (
			!($permissions = static::checkLogin())
			|| !$template
			|| substr($template, 0, 3) !== 'fe_'
		) {
			return $content;
		}

		$data = array(
			'toolbar' => true,
		);

		\System::loadLanguageFile('rocksolid_frontend_helper');

		if (in_array('pages', $permissions)) {
			\System::loadLanguageFile('tl_page');
			$data['links']['page'] = array(
				'url' => static::getBackendURL('page', null, $GLOBALS['objPage']->id),
				'label' => sprintf($GLOBALS['TL_LANG']['tl_page']['edit'][1], $GLOBALS['objPage']->id),
			);
		}

		if (in_array('articles', $permissions)) {
			\System::loadLanguageFile('tl_page');
			$data['links']['article'] = array(
				'url' => static::getBackendURL('article', null, null, null, array(
					'pn' => $GLOBALS['objPage']->id,
				)),
				'label' => sprintf($GLOBALS['TL_LANG']['tl_page']['articles'][1], $GLOBALS['objPage']->id),
			);
		}

		if (in_array('feModules', $permissions)) {
			\System::loadLanguageFile('tl_layout');
			$data['links']['layout'] = array(
				'url' => static::getBackendURL('themes', 'tl_layout', $GLOBALS['objPage']->layout),
				'label' => sprintf($GLOBALS['TL_LANG']['tl_layout']['edit'][1], $GLOBALS['objPage']->layout),
			);
			if ($GLOBALS['objPage']->getRelated('layout') && $GLOBALS['objPage']->getRelated('layout')->pid) {
				if ($GLOBALS['objPage']->getRelated('layout')->name) {
					$data['links']['layout']['label'] .= ' (' . $GLOBALS['objPage']->getRelated('layout')->name . ')';
				}
				\System::loadLanguageFile('tl_theme');
				$data['links']['fe-module'] = array(
					'url' => static::getBackendURL('themes', 'tl_module', $GLOBALS['objPage']->getRelated('layout')->pid, null),
					'label' => sprintf($GLOBALS['TL_LANG']['tl_theme']['modules'][1], $GLOBALS['objPage']->getRelated('layout')->pid),
				);
				$data['links']['image-size'] = array(
					'url' => static::getBackendURL('themes', 'tl_image_size', $GLOBALS['objPage']->getRelated('layout')->pid, null),
					'label' => sprintf($GLOBALS['TL_LANG']['tl_theme']['imageSizes'][1], $GLOBALS['objPage']->getRelated('layout')->pid),
				);
				if (
					$GLOBALS['objPage']->getRelated('layout')->stylesheet &&
					count(\StringUtil::deserialize($GLOBALS['objPage']->getRelated('layout')->stylesheet))
				) {
					// Only show a stylesheets link if stylesheets are used
					$data['links']['stylesheet'] = array(
						'url' => static::getBackendURL('themes', 'tl_style_sheet', $GLOBALS['objPage']->getRelated('layout')->pid, null),
						'label' => sprintf($GLOBALS['TL_LANG']['tl_theme']['css'][1], $GLOBALS['objPage']->getRelated('layout')->pid),
					);
				}
			}
		}

		if (in_array('rstAssistant', $permissions) && $assistantId = static::getThemeAssistantStylesheet()) {
			$data['links']['assistant'] = array(
				'url' => static::getBackendURL('rocksolid_theme_assistant', null, $assistantId),
				'label' => $GLOBALS['TL_LANG']['rocksolid_frontend_helper']['assistantLabel'],
			);
		}

		$data['links']['backend'] = array(
			'url' => static::getBackendURL(null, null, null, null),
			'label' => $GLOBALS['TL_LANG']['MSC']['homeTitle'],
		);

		$data['labels'] = array(
			'activate' => $GLOBALS['TL_LANG']['rocksolid_frontend_helper']['activateLabel'],
			'deactivate' => $GLOBALS['TL_LANG']['rocksolid_frontend_helper']['deactivateLabel'],
			'cancel' => $GLOBALS['TL_LANG']['MSC']['cancelBT'],
		);

		$previewEnabled = \defined('BE_USER_LOGGED_IN') && BE_USER_LOGGED_IN;
		$data['config'] = array(
			'lightbox' => (bool)FrontendHelperUser::getInstance()->rocksolidFrontendHelperLightbox,
			'beSwitch' => array(
				'label' => $GLOBALS['TL_LANG']['MSC']['hiddenElements'] . ': ' . $GLOBALS['TL_LANG']['MSC'][$previewEnabled ? 'hiddenHide' : 'hiddenShow'],
				'url' => \System::getContainer()->get('router')->generate('contao_backend_switch'),
				'data' => array(
					'FORM_SUBMIT' => 'tl_switch',
					'REQUEST_TOKEN' => REQUEST_TOKEN,
					'unpublished' => $previewEnabled ? 'hide' : 'show',
				),
			),
		);

		$assetsDir = 'bundles/rocksolidfrontendhelper';

		$GLOBALS['TL_JAVASCRIPT'][] = $assetsDir . '/js/main.js';
		$GLOBALS['TL_CSS'][] = $assetsDir . '/css/main.css';

		// Remove dummy elements inside script tags and insert them before the script tags
		$content = preg_replace_callback('(<script(?>"[^"]*"|\'[^\']*\'|[^>"\'])*>.*?</script>)is', function($matches) {
			preg_match_all('(<span class="rsfh-dummy[^>]*></span>)is', $matches[0], $dummies);
			if (!count($dummies[0])) {
				return $matches[0];
			}
			return implode('', $dummies[0]) . str_replace($dummies[0], '', $matches[0]);
		}, $content);

		return static::insertData($content, $data);
	}
647193
public function previewTemplateWithHTML($template, $email) {
        $data = [ ];
        $data['template'] = $template;
        $data['email'] = $email;

        $result = $this->apiPost('preview', $data);
        return $result;
    }
599459
public static function create_template($template) {
        global $PAGE;

        $params = self::validate_parameters(self::create_template_parameters(), array('template' => $template));
        $params = $params['template'];
        $context = self::get_context_from_params($params);
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        unset($params['contextlevel']);
        unset($params['instanceid']);
        $params = (object) $params;
        $params->contextid = $context->id;

        $result = api::create_template($params);
        $exporter = new template_exporter($result);
        $record = $exporter->export($output);
        return $record;
    }
88896
protected function generateSitemapLinkTemplate($template)
    {
        $ret = null;

        // Set link template for index file
        $linkConf = array(
            'parameter' => $this->sitemapDir . '/' . $template,
        );

        if (strlen($GLOBALS['TSFE']->baseUrl) > 1) {
            $ret = $GLOBALS['TSFE']->baseUrlWrap($GLOBALS['TSFE']->cObj->typoLink_URL($linkConf));
        } elseif (strlen($GLOBALS['TSFE']->absRefPrefix) > 1) {
            $ret = $GLOBALS['TSFE']->absRefPrefix . $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf);
        } else {
            $ret = $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf);
        }

        return $ret;
    }
1011709
private static function getTemplate(string $template, array $params): string
    {
        if (empty($template)) {
            return '';
        }
        $names   = array_keys($params);
        $replace = array_values($params);
        $search  = array_map(function ($v) {
            return sprintf('{%s}', $v);
        }, $names);

        return str_replace($search, $replace, $template);
    }
977605
public function template($template = null)
    {
        if (is_null($template)) {
            return $this->template;
        } else {
            $this->template = $template;
        }
    }
103380
public function showTemplate( $template_name, $code = null ) {

		if ( Pod::$deprecated_notice ) {
			pods_deprecated( 'Pods::showTemplate', '2.0', 'Pods::template' );
		}

		return $this->obj->template( $template_name, $code, true );
	}