core.write_compiled_resource.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Smarty plugin
  4. * @package Smarty
  5. * @subpackage plugins
  6. */
  7. /**
  8. * write the compiled resource
  9. *
  10. * @param string $compile_path
  11. * @param string $compiled_content
  12. * @return true
  13. */
  14. function smarty_core_write_compiled_resource($params, &$smarty)
  15. {
  16. if(!@is_writable($smarty->compile_dir)) {
  17. // compile_dir not writable, see if it exists
  18. if(!@is_dir($smarty->compile_dir)) {
  19. $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
  20. return false;
  21. }
  22. $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);
  23. return false;
  24. }
  25. $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true);
  26. require_once(SMARTY_CORE_DIR . 'core.write_file.php');
  27. smarty_core_write_file($_params, $smarty);
  28. return true;
  29. }
  30. /* vim: set expandtab: */
  31. ?>