Chris PeBenito 696b41
Chris PeBenito 696b41
/**
Chris PeBenito 696b41
 * Smarty plugin
Chris PeBenito 696b41
 * @package Smarty
Chris PeBenito 696b41
 * @subpackage plugins
Chris PeBenito 696b41
 */
Chris PeBenito 696b41
Chris PeBenito 696b41
/**
Chris PeBenito 696b41
 * write the compiled resource
Chris PeBenito 696b41
 *
Chris PeBenito 696b41
 * @param string $compile_path
Chris PeBenito 696b41
 * @param string $compiled_content
Chris PeBenito 696b41
 * @return true
Chris PeBenito 696b41
 */
Chris PeBenito 696b41
function smarty_core_write_compiled_resource($params, &$smarty)
Chris PeBenito 696b41
{
Chris PeBenito 696b41
    if(!@is_writable($smarty->compile_dir)) {
Chris PeBenito 696b41
        // compile_dir not writable, see if it exists
Chris PeBenito 696b41
        if(!@is_dir($smarty->compile_dir)) {
Chris PeBenito 696b41
            $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
Chris PeBenito 696b41
            return false;
Chris PeBenito 696b41
        }
Chris PeBenito 696b41
        $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR);
Chris PeBenito 696b41
        return false;
Chris PeBenito 696b41
    }
Chris PeBenito 696b41
Chris PeBenito 696b41
    $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true);
Chris PeBenito 696b41
    require_once(SMARTY_CORE_DIR . 'core.write_file.php');
Chris PeBenito 696b41
    smarty_core_write_file($_params, $smarty);
Chris PeBenito 696b41
    return true;
Chris PeBenito 696b41
}
Chris PeBenito 696b41
Chris PeBenito 696b41
/* vim: set expandtab: */
Chris PeBenito 696b41
Chris PeBenito 696b41
?>