Function to precompile template

@static
@return void
199512
public static function PreCompile(){
            $oThis = self::CreateInstanceIfNotExists();
            $oThis->IncludeTemplate();
            $oThis->ReplaceVars();
            $oThis->RemoveUndefinedVars();
            $oThis->CheckConditions();
        }
1182120
protected function compile()
    {
        $this->Template->start = $this->getRelatedStart($this);
        $this->Template->stop = $this->getRelatedStop($this);
        $this->Template->separators = $this->getRelatedSeparators($this);


        $this->Template->start = $this->getRelatedStart($this);
        $this->Template->stop = $this->getRelatedStop($this);
        $this->Template->separators = $this->getRelatedSeparators($this);
        if ($this->getRelatedStart($this) !== null)
        {
            $this->Template->identifier = sprintf(static::$IDENTIFIER, $this->getRelatedStart($this)->id);
        }
    }
102689
public function compile()
	{
		$objModule = \ModuleModel::findByPk($this->module);
	
		if ($objModule === null)
		{
			return;
		}
		
		$strClass = Module::findClass($objModule->type);
		
		if (!class_exists($strClass))
		{
			return;
		}
	
		$objModule->typePrefix = 'ce_';

		/** @var \Module $objModule */
		$objModule = new $strClass($objModule);
		
		$this->writeToTemplate($objModule->generate());
	}
156067
public function beforeCompile(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->config;

		// Handle nette/mail configuration
		if ($this->name === 'mail') {
			return;
		}

		if ($config->mode === self::MODE_STANDALONE) {
			// Disable autowiring of nette.mailer
			if ($builder->hasDefinition('mail.mailer')) {
				$builder->getDefinition('mail.mailer')
					->setAutowired(false);
			}
		} elseif ($config->mode === self::MODE_OVERRIDE) {
			// Remove nette.mailer and replace with our mailer
			$builder->removeDefinition('mail.mailer');
			$builder->addAlias('mail.mailer', $this->prefix('mailer'));
		}
	}
854664
protected function buildStatic()
    {
        $innerhtml = \htmlspecialchars($this->props['attribs']['value']);
        $this->props['attribs'] = \array_diff_key($this->props['attribs'], \array_flip(array('name','type','value')));
        $attribStrings = $this->buildAttribStrings($this->props);
        $props = \array_merge($this->props, $attribStrings);
        if (empty($props['input'])) {
            $props['input'] = Html::buildTag(
                $props['tagname'],
                $props['attribs'],  // already a string
                $innerhtml
            );
            // we don't call $this->buildInputGroup() for static
        }
        return $props['tagOnly']
            ? $props['input']
            : Str::quickTemp($props['template'], $props);
    }
1321194
function View_preloadTemplates(dir) {
            var list, name;
            if (this.isDir(dir)) {
                list = this.readDir(dir);
                while (true) {
                    name = list.shift();
                    if (!name) {
                        break;
                    }
                    this.preloadTemplates(di.normalizePath(dir + '/' + name));
                }

            } else if (this.isFile(dir) && this.suffix.test(dir)) {
                process.nextTick(function compileTemplateAsync() {
                    this.setPreloaded(dir, this.swig.compileFile(dir));
                }.bind(this));
            }
        }
1077413
public static function end_compile($template)
    {
        $key = self::get_key($template);
        self::$template_data[$key]['compile_time'] += microtime(true) - self::$template_data[$key]['start_time'];
    }
169911
function compile(template, context) {
        for (var name in context) {
            template = template.replace('{{' + name + '}}', context[name])
        }
        return template
    }
667859
public function compile()
	{
		if ($this->multiArticle)
		{
			$objArticles = \ArticleModel::findMultipleByIds(\StringUtil::deserialize($this->data->multiArticle));

			// Return if there are no pages
			if ($objArticles === null)
			{
				return;
			}

			$arrArticles = array();

			// Sort the array keys according to the given order
			if ($this->data->orderArticle != '')
			{
				$tmp = \StringUtil::deserialize($this->data->orderArticle);

				if (!empty($tmp) && is_array($tmp))
				{
					$arrArticles = array_map(function () {}, array_flip($tmp));
				}
			}

			// Add the items to the pre-sorted array
			while ($objArticles->next())
			{
				$arrArticles[$objArticles->id] = $objArticles->row();
			}

			$arrArticles = array_values(array_filter($arrArticles));
			
			$this->writeToTemplate($arrArticles);

			}
		else
		{
			if (($objArticle = \ArticleModel::findById($this->data->singleArticle)) !== null)
			{
				$this->writeToTemplate($objArticle->row());
			}
		}
	}
945557
public function beforeCompile(): void
	{
		$config = $this->validateConfig($this->defaults);

		if ($config['autoload'] === true) {
			if ($config['lazy'] === true) {
				$this->doBeforeCompileLaziness();
			} else {
				$this->doBeforeCompile();
			}
		}
	}
299509
public function preCompileHeaders()
    {
        if (is_windows()) {
            // TODO: Add Windows support
            return;
        }

        $phpIncludes = $this->getPhpIncludeDirs();

        foreach (new \DirectoryIterator('ext/kernel') as $file) {
            if ($file->isDir()) {
                continue;
            }

            if (preg_match('/\.h$/', $file)) {
                $path = $file->getRealPath();

                $command = sprintf(
                    'cd ext && gcc -c kernel/%s  -I. %s  -o kernel/%s.gch',
                    $file->getBaseName(),
                    $phpIncludes,
                    $file->getBaseName()
                );

                if (!file_exists($path.'.gch') || filemtime($path) > filemtime($path.'.gch')) {
                    $this->filesystem->system($command, 'stdout', 'compile-header');
                }
            }
        }
    }
292385
protected function compile()
    {
        $this->Template->start = $this->getRelatedStart($this);
        $this->Template->stop = $this->getRelatedStop($this);
        $this->Template->separators = $this->getRelatedSeparators($this);
        if ($this->getRelatedStart($this) !== null)
        {
            $this->Template->identifier = sprintf(self::$IDENTIFIER, $this->getRelatedStart($this)->id);
        }

        // Labels
        $this->Template->carouselPrevious = $GLOBALS['TL_LANG']['MSC']['carouselPrev'];
        $this->Template->carouselNext = $GLOBALS['TL_LANG']['MSC']['carouselNext'];

    }
26567
public function beforeCompile(): void
	{
		// Skip if it's not CLI mode
		if (!$this->cliMode) {
			return;
		}

		$builder = $this->getContainerBuilder();

		// Lookup for Symfony Console Application
		$application = $builder->getDefinitionByType(Application::class);

		// Register helpers
		$entityManagerHelper = $this->prefix('@entityManagerHelper');
		$application->addSetup(new Statement('$service->getHelperSet()->set(?,?)', [$entityManagerHelper, 'em']));
	}
410551
protected function compile()
  {

    global $objPage;


		if (FE_USER_LOGGED_IN)
    {
      $this->import('FrontendUser', 'User');
    }

    switch ($this->strType)
    {
      case "track":
        $objData = $this->Database->prepare("SELECT * FROM tl_c4g_tracking_tracks WHERE id=? AND member=?")
                               ->execute($this->intTrackId, $this->User->id);
        break;
      case "poi":
        $objData = $this->Database->prepare("SELECT * FROM tl_c4g_tracking_pois WHERE id=? AND member=?")
                               ->execute($this->intPoiId, $this->User->id);
        break;
    }

		if ($objData->numRows == 0)
		{
			// Do not index or cache the page
			$objPage->noSearch = 1;
			$objPage->cache = 0;

			// Send a 404 header
			header('HTTP/1.1 404 Not Found');
			$this->Template->error = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
			return;
		}


		if (!$this->editWithoutFilter && (FE_USER_LOGGED_IN && $this->User->id!=$objData->member))
		{
			// Do not index or cache the page
			$objPage->noSearch = 1;
			$objPage->cache = 0;

			// Send a 404 header
			header('HTTP/1.1 404 Not Found');
			$this->Template->error = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
			return;
		}

		$arrFields = $this->getFields($objData);
		$arrFieldsForTemplate = array();

		foreach ($arrFields as $arrField)
    {

      $strClass = $GLOBALS['TL_FFL'][$arrField['inputType']];
      if (!$this->classFileExists($strClass))
      {
          continue;
      }

      $arrField['mandatory'] = $arrField['eval']['mandatory'];
      $arrField['tableless'] = true;

      $objWidget = new $strClass($arrField);

      if ($arrField['eval']['rgxp'])
      {
        $objWidget->rgxp = $arrField['eval']['rgxp'];
      }

      if ($arrField['eval']['maxlength'])
      {
        $objWidget->maxlength = $arrField['eval']['maxlength'];
      }

      if (!$arrField['id'] && $arrField['name'])
      {
        $objWidget->id = $arrField['name'];
      }

      if ($arrField['eval']['toggleFields'])
      {
        $objWidget->class = $objWidget->class ? ($objWidget->class . " toggle") : "toggle";
      }

      if ($arrField['eval']['toggleBy'])
      {
        $strToggleByClass = "toggleBy" . ucfirst($arrField['eval']['toggleBy']);

        $blnIsVisible = false;

        $arrToggleField = $this->arrFields[$arrField['eval']['toggleBy']];

        if ($arrToggleField['inputType'] == "checkbox")
        {
          if (\Input::post($arrToggleField['name']))
          {
            $blnIsVisible = true;

            if (!$arrField['eval']['mandatory'] && $arrField['eval']['toggleMandatory'])
            {
              $objWidget->mandatory = true;
            }
          }
        }

        if (!$blnIsVisible)
        {
          $strToggleByClass .= " toggleInvisible";
        }
        else
        {
          $strToggleByClass .= " toggleVisible";
        }

        $objWidget->class = $objWidget->class ? ($objWidget->class . " " . $strToggleByClass) : $strToggleByClass;
      }

      if ($this->Input->post('FORM_SUBMIT') == 'formTrackEdit')
      {
          $objWidget->validate();
          if ($objWidget->hasErrors())
          {
            $this->doNotSubmit = true;
          }
      }

      if ($arrField['eval']['toggleMandatory'] && !$objWidget->mandatory)
      {
        $objWidget->label = '<span class="invisible">Pflichtfeld</span>' . $arrField['label'] . '<span class="mandatory">*</span>';
      }

      $this->Template->fields .= $objWidget->parse();
      $arrFieldsForTemplate[$arrField['name']] = $objWidget->parse();
    }

    if ($this->Input->post('FORM_SUBMIT') == 'formTrackEdit' && !$this->doNotSubmit)
    {
      // Check whether there is a jumpTo page

      $arrForDatabaseUpdate = array();
      $arrForDatabaseUpdate['name'] = \Input::post('name');
      $arrForDatabaseUpdate['visibility'] = \Input::post('visibility');
      $arrForDatabaseUpdate['comment'] = \Input::post('comment');
      if ($arrForDatabaseUpdate['visibility'] == "membergroups")
      {
        $arrForDatabaseUpdate['groups'] = serialize(\Input::post('visibilityGroups'));
      }
      else
      {
        $arrForDatabaseUpdate['groups'] = null;
      }

      if (\Input::post('deleteEntry') == 'delete')
      {
        $arrForDatabaseUpdate['forDelete'] = true;
      }
      else
      {
        $arrForDatabaseUpdate['forDelete'] = false;
      }

      switch ($this->strType)
      {
        case "track":
          $this->Database->prepare("UPDATE tl_c4g_tracking_tracks %s WHERE id=?")
                     ->set($arrForDatabaseUpdate)
                     ->execute($this->intTrackId);
          break;
        case "poi":
          $this->Database->prepare("UPDATE tl_c4g_tracking_pois %s WHERE id=?")
                     ->set($arrForDatabaseUpdate)
                     ->execute($this->intPoiId);
          break;
      }



    	if (($objJumpTo = $this->objModel->getRelated('jumpTo')) !== null)
    	{
    		$this->jumpToOrReload($objJumpTo->row());
    	}

    	$this->reload();
    }

    $this->Template->fieldData = $arrFieldsForTemplate;
    $this->Template->action = "";
    $this->Template->formId = "formTrackEdit";
    $this->Template->method = "post";
    $this->Template->enctype = "";
    $this->Template->attributes = "";
    //$this->Template->novalidate = "novalidate";
    $this->Template->formSubmit = "formTrackEdit";

    $this->Template->submitTitle = "Speichern";


  }
299995
public function compile($template)
    {
        $file = $this->getResolver()->resolve($template);
        $css = $this->getCompiler()->compile($file);
        return "<style>$css</style>";
    }
483548
public function compile() {
		$this->start('Compiling to '. $this->host);

		// fix path
		$this->localProj	= self::path($this->localProj);
		$this->remoteProj	= rtrim($this->remoteProj, DIRECTORY_SEPARATOR);
		
		// Work from project
		if(isset($this->localProj) && is_dir($this->localProj))
			chdir($this->localProj);
		
		// documentation
		if(isset($this->localDoc))
			$this->start('Creating Documentation from ' . $this->localDoc)->makeDoc()->finish();
		
		// twig templates
		if(isset($this->localTpl))
			$this->start('Creating JS Templates from ' . $this->localTpl)->makeTpl()->finish();
		
		
		// static files
		$localStatic = self::path(sys_get_temp_dir()) . 'data' . time() . DIRECTORY_SEPARATOR;
		$this->wipe[] = $localStatic;
		
		foreach($this->remoteStatic as $type => $trash) {
			if(method_exists($this, $type)) {
				$this->tmp[ $type ] = $localStatic . $type . DIRECTORY_SEPARATOR;
				self::readyDir( $this->tmp[ $type ] );

				// process static files
				$this->start('Processing '. $type)->$type()->finish();
				
			} elseif(!empty($this->localStatic[ $type ])) {
					// just moved the folder
					$this->tmp[ $type ] = self::path(current ($this->localStatic[ $type ]));
					
					// remove if not there
					if(!file_exists($this->tmp[ $type ])) 
						unset ($this->remoteStatic[ $type ]);
			}
		}

		// run through static files then upload them
		$this->start('Uploading Static')->uploadStatic()->finish();

		// upload project
		$cmd = [
			'pscp',
			'-p',									// preserve attributes
			'-r',									// copy recursively
			'-q',									// silent
			//'-sftp',								// for use of SFTP protocal
			'-batch',								// non interactive
			'-C',									// enable compression
			'-i', static::safeDir($this->ppk),						// Private key file to access server
		];
		
		// Directory to upload
		foreach($this->localCopy as $name)
			$cmd[] = static::safeDir($this->localProj . $name);
		
		// host:path on server to save data
		$cmd[] = $this->host .':'. $this->remoteProj;
		
		$this->start('Uploading Project')->runLocal($cmd)->finish();

		// config
		if(!isset($this->s3) && !empty($this->remoteStatic)) {
			// reset file permissions
			$cmd = array();
			foreach($this->remoteStatic as $type => $path) {
				$cmd[] = 'chmod 774 -R '. $path;
				// $cmd[] = 'chown mo:www-data -R '. $path;
			}
			
			$this->start('Updating Server Enviroment')->runRemote( $cmd )->finish();
		}

		// clean up
		$this	->start('Cleaning up');
			foreach($this->wipe as $dir)
				self::wipeDir($dir, true);
		$this	->finish();
		
		// finally
		$this->finish();
	}
164083
public function beforeCompile(): void
	{
		// Skip if it's not CLI mode
		if (!$this->cliMode) return;

		$builder = $this->getContainerBuilder();

		// Lookup for Symfony Console Application
		$application = $builder->getDefinitionByType('Symfony\Component\Console\Application');

		// Register helpers
		$connectionHelper = $this->prefix('@connectionHelper');
		$application->addSetup(new Statement('$service->getHelperSet()->set(?, ?)', [$connectionHelper, 'db']));
	}