CoreFiles by mySites.guru
PdfLatex.php65 lines, 1,282 bytes, from Joomla_1.5.21-Stable-Full_Package.zip
Raw History Compare with 1.5.20
md5
b71df653d9a23985288b193c2efa894a
sha1
4e1c668b509f6fb2086955a8d75db0eb4531c3c6
sha256
abd8f104a201a1a5ba98b4401ac5b84958a70ca4aeda951028ef0d9ff00f0816
<?PHP
/**
 * patTemplate output filter that creates PDF files from latex
 *
 * $Id: PdfLatex.php 10381 2008-06-01 03:35:53Z pasamio $
 *
 * @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 10381 2008-06-01 03:35:53Z pasamio $
 *
 * @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 23 releases, Joomla 1.5.4 to 1.5.26. See them all, or every version of this file.