core-bundle/src/Resources/contao/classes/Theme.php
protected function addTemplatesToArchive(ZipWriter $objArchive, $strFolder)
	{
		// Strip the templates folder name
		$strFolder = preg_replace('@^templates/@', '', $strFolder);

		// Re-add the templates folder name
		if ($strFolder == '')
		{
			$strFolder = 'templates';
		}
		else
		{
			$strFolder = 'templates/' . $strFolder;
		}

		if (Validator::isInsecurePath($strFolder))
		{
			throw new \RuntimeException('Insecure path ' . $strFolder);
		}

		// Return if the folder does not exist
		if (!is_dir($this->strRootDir .'/'. $strFolder))
		{
			return;
		}

		// Add all template files to the archive (see #7048)
		foreach (scan($this->strRootDir .'/'. $strFolder) as $strFile)
		{
			if (preg_match('/\.(html5|sql)$/', $strFile) && strncmp($strFile, 'be_', 3) !== 0 && strncmp($strFile, 'nl_', 3) !== 0)
			{
				$objArchive->addFile($strFolder .'/'. $strFile);
			}
		}
	}
protected function addTemplatesToArchive(ZipWriter $objArchive, $strFolder)
	{
		// Strip the templates folder name
		$strFolder = preg_replace('@^templates/@', '', $strFolder);

		// Re-add the templates folder name
		if ($strFolder == '')
		{
			$strFolder = 'templates';
		}
		else
		{
			$strFolder = 'templates/' . $strFolder;
		}

		if (Validator::isInsecurePath($strFolder))
		{
			throw new \RuntimeException('Insecure path ' . $strFolder);
		}

		// Return if the folder does not exist
		if (!is_dir($this->strRootDir .'/'. $strFolder))
		{
			return;
		}

		// Add all template files to the archive (see #7048)
		foreach (scan($this->strRootDir .'/'. $strFolder) as $strFile)
		{
			if (preg_match('/\.(html5|sql)$/', $strFile) && strncmp($strFile, 'be_', 3) !== 0 && strncmp($strFile, 'nl_', 3) !== 0)
			{
				$objArchive->addFile($strFolder .'/'. $strFile);
			}
		}
	}
protected function addTemplatesToArchive ( ZipWriter $ objArchive , $ strFolder ) { // Strip the templates folder name $ strFolder = preg_replace ( '@^templates/@' , '' , $ strFolder ) ; // Re-add the templates folder name if ( $ strFolder == '' ) { $ strFolder = 'templates' ; } else { $ strFolder = 'templates/' . $ strFolder ; } if ( Validator :: isInsecurePath ( $ strFolder ) ) { throw new \ RuntimeException ( 'Insecure path ' . $ strFolder ) ; } // Return if the folder does not exist if ( ! is_dir ( $ this -> strRootDir . '/' . $ strFolder ) ) { return ; } // Add all template files to the archive (see #7048) foreach ( scan ( $ this -> strRootDir . '/' . $ strFolder ) as $ strFile ) { if ( preg_match ( '/\.(html5|sql)$/' , $ strFile ) && strncmp ( $ strFile , 'be_' , 3 ) !== 0 && strncmp ( $ strFile , 'nl_' , 3 ) !== 0 ) { $ objArchive -> addFile ( $ strFolder . '/' . $ strFile ) ; } } }
Add templates to the archive

@param ZipWriter $objArchive
@param string    $strFolder
Add templates to the archive