[feature/template-engine] Rename template_compile methods for clarity.

PHPBB3-9726
This commit is contained in:
Oleg Pudeyev 2011-05-01 04:00:24 -04:00
parent d840de560c
commit 48691b53a6
3 changed files with 12 additions and 12 deletions

View file

@ -21,4 +21,4 @@ include($phpbb_root_path . 'includes/template_compile.'.$phpEx);
$file = $argv[1]; $file = $argv[1];
$compile = new phpbb_template_compile(); $compile = new phpbb_template_compile();
echo $compile->compile_gen($file); echo $compile->compile_file($file);

View file

@ -384,7 +384,7 @@ class phpbb_template
$compile = new phpbb_template_compile(); $compile = new phpbb_template_compile();
if ($compile->compile_write($source_file, $this->_compiled_file_for_handle($handle)) === false) if ($compile->compile_file_to_file($source_file, $this->_compiled_file_for_handle($handle)) === false)
{ {
return false; return false;
} }
@ -443,7 +443,7 @@ class phpbb_template
$source_file = $this->_source_file_for_handle($handle); $source_file = $this->_source_file_for_handle($handle);
if (($code = $compile->compile_gen($source_file)) === false) if (($code = $compile->compile_file($source_file)) === false)
{ {
return false; return false;
} }
@ -509,13 +509,13 @@ class phpbb_template
{ {
if ($row['template_filename'] == $this->filename[$handle]) if ($row['template_filename'] == $this->filename[$handle])
{ {
$compile->compile_write($source_file, $this->_compiled_file_for_handle($handle)); $compile->compile_file_to_file($source_file, $this->_compiled_file_for_handle($handle));
} }
else else
{ {
$this->files[$row['template_filename']] = $file; $this->files[$row['template_filename']] = $file;
$this->filename[$row['template_filename']] = $row['template_filename']; $this->filename[$row['template_filename']] = $row['template_filename'];
$compile->compile_write($this->_source_file_for_handle($row['template_filename']), $this->_compiled_file_for_handle($row['template_filename'])); $compile->compile_file_to_file($this->_source_file_for_handle($row['template_filename']), $this->_compiled_file_for_handle($row['template_filename']));
unset($this->compiled_code[$row['template_filename']]); unset($this->compiled_code[$row['template_filename']]);
unset($this->files[$row['template_filename']]); unset($this->files[$row['template_filename']]);
unset($this->filename[$row['template_filename']]); unset($this->filename[$row['template_filename']]);
@ -525,7 +525,7 @@ class phpbb_template
if ($row['template_filename'] == $this->filename[$handle]) if ($row['template_filename'] == $this->filename[$handle])
{ {
$this->compiled_code[$handle] = $compile->compile(trim($row['template_data'])); $this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
$compile->compile_write($handle, $this->compiled_code[$handle]); $compile->compile_file_to_file($handle, $this->compiled_code[$handle]);
} }
else else
{ {
@ -533,7 +533,7 @@ class phpbb_template
if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . $phpEx)) if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . $phpEx))
{ {
$this->filename[$row['template_filename']] = $row['template_filename']; $this->filename[$row['template_filename']] = $row['template_filename'];
$compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data']))); $compile->compile_file_to_file($row['template_filename'], $compile->compile(trim($row['template_data'])));
unset($this->filename[$row['template_filename']]); unset($this->filename[$row['template_filename']]);
} }
} }
@ -551,14 +551,14 @@ class phpbb_template
$this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
} }
// Try to load from filesystem and instruct to insert into the styles table... // Try to load from filesystem and instruct to insert into the styles table...
$compile->compile_write($source_file, $this->_compiled_file_for_handle($handle)); $compile->compile_file_to_file($source_file, $this->_compiled_file_for_handle($handle));
return false; return false;
} }
return false; return false;
} }
$compile->compile_write($source_file, $this->_compiled_file_for_handle($handle)); $compile->compile_file_to_file($source_file, $this->_compiled_file_for_handle($handle));
return false; return false;
} }
@ -838,7 +838,7 @@ class phpbb_template
$compile = new phpbb_template_compile(); $compile = new phpbb_template_compile();
$source_file = $this->_source_file_for_handle($handle); $source_file = $this->_source_file_for_handle($handle);
if (($code = $compile->compile_gen($source_file)) !== false) if (($code = $compile->compile_file($source_file)) !== false)
{ {
$code = ' ?> ' . $code . ' <?php '; $code = ' ?> ' . $code . ' <?php ';
eval($code); eval($code);

View file

@ -871,7 +871,7 @@ class phpbb_template_compile
* @param string $source_file Source template file * @param string $source_file Source template file
* @return bool Return true on success otherwise false * @return bool Return true on success otherwise false
*/ */
public function compile_write($source_file, $compiled_file) public function compile_file_to_file($source_file, $compiled_file)
{ {
$source_handle = @fopen($source_file, 'rb'); $source_handle = @fopen($source_file, 'rb');
$destination_handle = @fopen($compiled_file, 'wb'); $destination_handle = @fopen($compiled_file, 'wb');
@ -903,7 +903,7 @@ class phpbb_template_compile
* @param string $source_file Source template file * @param string $source_file Source template file
* @return string|bool Return compiled code on successful compilation otherwise false * @return string|bool Return compiled code on successful compilation otherwise false
*/ */
public function compile_gen($source_file) public function compile_file($source_file)
{ {
$source_handle = @fopen($source_file, 'rb'); $source_handle = @fopen($source_file, 'rb');
$destination_handle = @fopen('php://temp' ,'r+b'); $destination_handle = @fopen('php://temp' ,'r+b');