Location: PHPKode > scripts > Avatar Tools > helpers/controller.php
<?php
/**
 * @version		$Id: coolfeed.php 100 2012-04-14 17:42:51Z hide@address.com $
 * @copyright	JoomAvatar.com
 * @author		Nguyen Quang Trung
 * @link		http://joomavatar.com
 * @license		License GNU General Public License version 2 or later http://www.gnu.org/licenses/gpl-2.0.html
 * @package		Avatar Dream Framework Template
 * @facebook 	http://www.facebook.com/pages/JoomAvatar/120705031368683
 * @twitter	    https://twitter.com/#!/JoomAvatar
 * @support 	http://joomavatar.com/forum/
 */

// no direct access
defined('_JEXEC') or die;

class PlgAvatarController {
	
	public static function combine() 
	{
		/**
		 * JCH Optimize - Joomla! plugin to aggregate and minify external resources for 
		 *   optmized downloads
		 * @author Samuel Marshall <hide@address.com>
		 * @copyright Copyright (c) 2010 Samuel Marshall. All rights reserved.
		 * @license GNU/GPLv3, See LICENSE file 
		 * This program is free software: you can redistribute it and/or modify
		 * it under the terms of the GNU General Public License as published by
		 * the Free Software Foundation, either version 3 of the License, or
		 * (at your option) any later version.
		 * 
		 * This program is distributed in the hope that it will be useful,
		 * but WITHOUT ANY WARRANTY; without even the implied warranty of
		 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
		 * GNU General Public License for more details.
		 * 
		 * If LICENSE file missing, see <http://www.gnu.org/licenses/>. 
		 * 
		 * This plugin, inspired by CssJsCompress <http://www.joomlatags.org>, was
		 * created in March 2010 and includes other copyrighted works. See individual 
		 * files for details.
		 */
		/**
		 * Modified for Joomla 1.6 by Branislav Maksin - www.maksin.ms
		 */
		 /**
		  * Modified by Chameron - http://joomavatar.com
		  */
		
		$file = base64_decode($_REQUEST['f']);
		$path = JPATH_CACHE.DS.'plg_avatar_tool'.DS.$file.'.php';
		
		if (file_exists($path)) 
		{
		    $data = @file_get_contents($path);
		    
		    if ($data) {
		        $data = unserialize(trim(str_replace('<?php die("Access Denied"); ?>#x#', '', $data)));
				$data = $data['result'];
			}
			
		} else {
			return;
		}
		
		if ($_REQUEST['type'] == 'css') {
		    header('Content-type: text/css; charset=UTF-8');
		} elseif ($_REQUEST['type'] == 'js') {
		    header('Content-type: text/javascript; charset=UTF-8');
		}
		
		$expireHeader = (int) $_REQUEST['expire'] * 24 * 60 * 60;
		header('Expires: ' . gmdate('D, d M Y H:i:s', filemtime($path) + $expireHeader) . ' GMT');
		header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($path)) . ' GMT');
		header('Cache-Control: Public');
		header('Vary: Accept-Encoding');
		
		if (extension_loaded('zlib') && !ini_get('zlib.output_compression')) 
		{
			if (isset($_REQUEST['gzip']) && (boolean) $_REQUEST['gzip']) {
				header("Content-Encoding: gzip");
				$data = gzencode($data);	
			} 
		}
		
		return $data;
				
	}

	public static function callController($controller, $task)
	{
		if ($controller) 
		{
			$path = dirname(dirname(__FILE__)).DS.'controllers'.DS.$controller.'.php';
			
			if (file_exists($path)) {
				require_once $path;	
				$controller = 'AvatarToolController'.$controller;
				$controller = new $controller;
				
				ob_start();
					$result = $controller->$task();
				ob_end_clean();
				
				return $result;
			}
		}
		
		return '';
	}
}
Return current item: Avatar Tools