<?php
/**
 * Smarty plugin
 *
 * @category Smarty
 * @license /_licenses/untermStrich/agb_normal.pdf
 * @author Christian Koller
 * @copyright 2009 untermStrich
 * @package Smarty
 * @subpackage plugins
 * @version $Id$
*/

/**
 * Smarty {image_path} function plugin
 *
 * @param   string  $params     Parameters:
 *                              <ul>
 *                                  <li>path     string  Value to show</li>
 *                              </ul>
 * @param   object  &$smarty    The smarty object
 * @return   string
 */
function smarty_function_image_path($params, US_Smarty &$smarty)
{
    if (!isset($params['path'])) {
        $path = FCPATH.'images/';
    } else {
        $path = FCPATH.'images/'.$params['path'];
    }
    
    if (strpos(FCPATH, '\\')===false) {
        $path = str_replace('\\', '/', $path);
    } else {
        $path = '/'.str_replace('/', '\\', $path);
    }
    
    return 'file://'.$path;
}

/* End of function.image_path.php */