CoreFiles by mySites.guru
PdfLatex.php65 lines, 1,346 bytes, from Joomla_1.5.3-Stable-Full_Package.zip
Raw History Compare with 1.5.2
md5
a29b57413491392bb589e29d167d673b
sha1
a0ae79da038dd13c6572131a41c7b0593c99dedb
sha256
1bb0657064f30b58d7ae5de2e1cc2fb73889a26ebcdaf2977223fa1d50766cdb
<?PHP
/**
 * patTemplate output filter that creates PDF files from latex
 *
 * $Id: PdfLatex.php 8287 2007-08-01 08:38:59Z eddieajau $
 *
 * @package		patTemplate
 * @subpackage	Filters
 * @author		Stephan Schmidt <[email protected]>
 */

// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();

/**
 * patTemplate output filter that creates PDF files from latex
 *
 * $Id: PdfLatex.php 8287 2007-08-01 08:38:59Z eddieajau $
 *
 * @package		patTemplate
 * @subpackage	Filters
 * @author		Stephan Schmidt <[email protected]>
 */
class patTemplate_OutputFilter_PdfLatex extends patTemplate_OutputFilter
{
	/**
	* filter name
	*
	* This has to be set in the final
	* filter classes.
	*
	* @var	string
	*/
	var	$_name	=	'PdfLatex';

	var $_params = array(
						   'cacheFolder' => './'
					   );

	/**
	* tidy the data
	*
	* @access	public
	* @param	string		data
	* @return	string		compressed data
	*/
	function apply( $data )
	{
		$cacheFolder = $this->getParam('cacheFolder');
		$texFile	 = tempnam($cacheFolder, 'pt_tex_');
		$fp = fopen($texFile, 'w');
		fwrite($fp, $data);
		fclose($fp);

		$command = 'pdflatex '.$texFile;
		exec($command);
		exec($command);

		$pdf = $texFile . '.pdf';
		$pdf = file_get_contents($pdf);

		return $pdf;
	}
}
?>

The same content is in 4 releases, Joomla 1.5.0 to 1.5.3. See them all, or every version of this file.