annotate Smarty/internals/core.write_compiled_resource.php @ 1:f5a9f0eb4858

deleted: LICENSE.ja
author Sushi-k <epgrec@park.mda.or.jp>
date Wed, 08 Jul 2009 11:44:50 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
1 <?php
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
2 /**
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
3 * Smarty plugin
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
4 * @package Smarty
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
5 * @subpackage plugins
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
6 */
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
7
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
8 /**
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
9 * write the compiled resource
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
10 *
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
11 * @param string $compile_path
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
12 * @param string $compiled_content
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
13 * @return true
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
14 */
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
15 function smarty_core_write_compiled_resource($params, &$smarty)
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
16 {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
17 if(!@is_writable($smarty->compile_dir)) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
18 // compile_dir not writable, see if it exists
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
19 if(!@is_dir($smarty->compile_dir)) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
20 $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
21 return false;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
22 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
23 $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);
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
24 return false;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
25 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
26
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
27 $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true);
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
28 require_once(SMARTY_CORE_DIR . 'core.write_file.php');
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
29 smarty_core_write_file($_params, $smarty);
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
30 return true;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
31 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
32
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
33 /* vim: set expandtab: */
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
34
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
35 ?>