28 $_error_reporting = error_reporting();
29 error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
30 if ($smarty->_file_perms !== null) {
31 $old_umask = umask(0);
34 $_dirpath = dirname($_filepath);
36 if ($_dirpath !==
'.' && !file_exists($_dirpath)) {
37 mkdir($_dirpath, $smarty->_dir_perms === null ? 0777 : $smarty->_dir_perms,
true);
41 $_tmp_file = $_dirpath . DS . uniqid(
'wrt',
true);
42 if (!file_put_contents($_tmp_file, $_contents)) {
43 error_reporting($_error_reporting);
59 $success = @rename($_tmp_file, $_filepath);
62 $success = @rename($_tmp_file, $_filepath);
67 $success = @rename($_tmp_file, $_filepath);
72 error_reporting($_error_reporting);
77 if ($smarty->_file_perms !== null) {
79 @chmod($_filepath, $smarty->_file_perms);
82 error_reporting($_error_reporting);
Smarty plugin to format text blocks.
static $_IS_WINDOWS
Flag denoting if operating system is windows.
static writeFile($_filepath, $_contents, Smarty $smarty)
Writes file in a safe way to disk.