1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-27 17:49:27 +02:00

11152 Commits

Author SHA1 Message Date
Oleg Pudeyev
d2ac05aa74 [feature/template-engine] Replaced globals with dependency injection.
PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
581374c9c3 [feature/template-engine] Deleted useless catch.
In tests there is no need to catch unexpected exceptions.

PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
ac9a910c64 [feature/template-engine] Delete obsolete comments pertaining to notices.
PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
345852d240 [feature/template-engine] Clarify cache directory path for set_custom_template
Even if the template may be outside of phpBB, phpBB's cache directory
is still going to be used for storing compiled template code.

PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
d2daaf0317 [feature/template-engine] Try to handle failed template includes.
PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
7638bcb560 [feature/template-engine] Rename $filename to $compiled_path for clarity.
PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
7778771819 [feature/template-engine] Move DEBUG_EXTRA check for $recompile up.
PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
504acaba6b [feature/template-engine] Deleted useless assignment.
PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
d6f75e97d6 [feature/template-engine] Added docblocks to get_*_ref in context.
PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
635460fa6d [feature/template-engine] Fixed reference usage.
Hopefully this is right, I have not checked it against the manual
(assuming the manual even covers these things).

PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
169c4377e9 [feature/template-engine] Disposed of underscores in property names.
PHPBB3-9726
2011-05-12 20:13:31 -04:00
Oleg Pudeyev
97d2a6527e [feature/template-engine] Remove commented out error reporting logic.
PHPBB3-9726
2011-05-12 20:13:30 -04:00
Oleg Pudeyev
0ca7ad66dc [feature/template-engine] Refactor hook logic into a separate function.
PHPBB3-9726
2011-05-12 20:13:30 -04:00
Oleg Pudeyev
df76885b11 [feature/template-engine] Reinstate phpbb_template#destroy function.
PHPBB3-9726
2011-05-12 20:13:30 -04:00
Oleg Pudeyev
0462ab3a4a [feature/template-engine] Add back IN_PHPBB preamble.
PHPBB3-9726
2011-05-12 20:13:30 -04:00
Oleg Pudeyev
49cf28a9c4 [feature/template-engine] Moved template classes to subdirectory.
PHPBB3-9726
2011-05-08 04:06:25 -04:00
Oleg Pudeyev
84bc485ccc [feature/template-engine] Renamed template executor and friends to renderer.
PHPBB3-9726
2011-05-08 04:03:41 -04:00
Oleg Pudeyev
1cba674b9a [feature/template-engine] Added docblocks and boilerplate to new files.
PHPBB3-9726
2011-05-07 17:58:56 -04:00
Oleg Pudeyev
b5444a7d7d [feature/template-engine] Removed more dead code.
PHPBB3-9726
2011-05-07 17:50:48 -04:00
Oleg Pudeyev
0501640d5d [feature/template-engine] Added phpbb_template_context class.
Objects of this class hold variables assigned to templates.

PHPBB3-9726
2011-05-07 17:47:02 -04:00
Oleg Pudeyev
d8122df332 [feature/template-engine] Always call ob_end_clean.
We have to stop output buffering even when rendering fails.

PHPBB3-9726
2011-05-05 19:03:46 -04:00
Oleg Pudeyev
b057d7439e [feature/template-engine] Removed some dead code.
PHPBB3-9726
2011-05-04 01:21:45 -04:00
Oleg Pudeyev
d06e59f63b [feature/template-engine] Split template execution logic into classes.
Template executor interface defines a template executor object.
It is an object which can execute (i.e. display/render) a template.
Currently there are two implementations:

 * phpbb_template_executor_include includes php code from a file.
 * phpbb_template_executor_eval eval's php code.

PHPBB3-9726
2011-05-04 01:21:44 -04:00
Oleg Pudeyev
237deb12ce [feature/template-engine] Removed storedb-related logic.
phpBB 3.1 will not provide the option to store templates in the database.

This commit removes code that handles templates stored in database
from the template engine.

PHPBB3-9726
2011-05-04 00:09:39 -04:00
Oleg Pudeyev
87832d06cc [feature/template-engine] Delete template class, use phpbb_template instead.
PHPBB3-9726
2011-05-04 00:08:20 -04:00
Oleg Pudeyev
48691b53a6 [feature/template-engine] Rename template_compile methods for clarity.
PHPBB3-9726
2011-05-04 00:07:58 -04:00
Oleg Pudeyev
d840de560c [feature/template-engine] Extracted compile_stream_to_stream.
PHPBB3-9726
2011-05-01 03:28:53 -04:00
Oleg Pudeyev
63ca4c2104 [feature/template-engine] Close output stream in compile().
There is no need to leave the stream to the garbage collector,
and the amount of data stuck in it may be substantial.

PHPBB3-9726
2011-05-01 03:25:22 -04:00
Oleg Pudeyev
234b891a4b [feature/template-engine] Fixed description of assign_display().
This function returns false on failure, which can happen if
display() failed. Document the failure return value.

PHPBB3-9726
2011-05-01 03:14:11 -04:00
Oleg Pudeyev
2aec6bb07c [feature/template-engine] Only copy files to cache if they exist.
When testing eval code path, compiled templates may not be written
to the file system, and unconditionally trying to copy them
breaks tests.

PHPBB3-9726
2011-05-01 03:12:23 -04:00
Oleg Pudeyev
b884573c1d [feature/template-engine] Relax missing file exception check.
As long as the exception message has the correct description and
file name we should not care which function raised the exception.

PHPBB3-9726
2011-05-01 03:11:13 -04:00
Oleg Pudeyev
c844a277b2 [feature/template-engine] Check return value of display() in assign_display().
If display() failed, propagate the failure out of assign_display().

PHPBB3-9726
2011-05-01 03:09:49 -04:00
Oleg Pudeyev
909ee59871 [feature/template-engine] Removed $this from new phpbb_template_compile calls.
The compile class no longer takes template as a parameter.

PHPBB3-9726
2011-04-26 22:19:04 -04:00
Igor Wiedler
427a5122d5 [feature/template-engine] Fix negative variable expressions
compile_tag_if had the flawed approach of adding an isset statement for
all variables to the beginning of the if. This fails for negative
expressions, and checking those takes a considerable effort.

The easier solution is to make the variable expression itself
conditional, defaulting to null if it is not set.

Thanks to naderman for the solution.

PHPBB3-9726
2011-04-25 23:19:36 -04:00
Oleg Pudeyev
f0b97cfdcf [feature/template-engine] Added a test for reuse of loop identifiers.
This currently does not pass, thus it is commented out.

The reuse appears implausible in the same file, however it may be
also done across template files where it is much harder to detect.

PHPBB3-9726
2011-04-25 23:19:32 -04:00
Oleg Pudeyev
f97411b911 [feature/template-engine] Corrected miscompilation of loop size constructs.
PHPBB3-9726
2011-04-25 23:19:25 -04:00
Oleg Pudeyev
8d5e468eb4 [feature/template-engine] Created a script to compile templates.
Script takes path to template as the only argument and outputs
the compiled template to standard output.

PHPBB3-9726
2011-04-24 23:13:44 -04:00
Oleg Pudeyev
5afc0b9b90 [feature/template-engine] Corrected an off-by-one error in nested namespaces.
This error resulted in a dot from the namespace being placed into
variable reference in compiled template code, thus creating bogus
compiled template code.

PHPBB3-9726
2011-04-24 23:13:13 -04:00
Oleg Pudeyev
e10d62badc [feature/template-engine] Added a test for multilevel references in loops.
This currently fails.

This test is a reduced version of permission_mask template in acp, which
is not correctly compiled by the current template engine code.

PHPBB3-9726
2011-04-24 21:56:26 -04:00
Oleg Pudeyev
5c3ebb3465 [feature/template-engine] Deleted silencing of notices.
The code is now supposed to be notice-free, therefore there is no need
to have the notices silenced.

PHPBB3-9726
2011-04-24 21:22:43 -04:00
Oleg Pudeyev
a2c75f6053 [feature/template-engine] Deleted $template from phpbb_template_compile class.
phpbb_template_compile is now much simpler. It takes complete file paths
as inputs, either source template path or source template path and output
compiled template path. The number of methods also went down to two -
compile template and returned compiled text or compile and write to file.

phpbb_compile class is responsible for determining source and compiled
paths. It already had all the data necessary for this, now the code is
in the same place as the data it uses.

PHPBB3-9726
2011-04-24 21:18:18 -04:00
Igor Wiedler
81962d1d8f [ticket/9924] Pass template instance into $template->display hook
This is a cherry-pick of 053cf790a93e9cfb521f484901d79c72783f868f
which appears to have been partially reverted here.

PHPBB3-9924
2011-04-24 11:23:46 -04:00
Oleg Pudeyev
c8db531fcb [feature/template-engine] Removed a useless space.
PHPBB3-9726
2011-04-24 01:59:40 -04:00
Oleg Pudeyev
321ecf4273 [feature/template-engine] Delete class_exists checks, rely on autoloading.
PHPBB3-9726
2011-04-24 01:18:58 -04:00
Oleg Pudeyev
f29f32e0d6 [feature/template-engine] Allow leading underscores in variable names.
Subsilver uses ._file in overall_header.

PHPBB3-9726
2011-04-24 01:08:48 -04:00
Oleg Pudeyev
203187a841 [feature/template-engine] Fix recompilation logic.
Do not change $recompile from true to false - any recompilation
condition alone is sufficient to force recompilation.

Also uncomment the nonexistent file test which passes with this fix.

PHPBB3-9726
2011-04-24 01:08:48 -04:00
Oleg Pudeyev
4dfe4c7f13 [feature/template-engine] Adjust path in includephp template.
Now that tests are run from top level the '..' is wrong.

PHPBB3-9726
2011-04-24 01:08:30 -04:00
Oleg Pudeyev
4f3e966fdc [feature/template-engine] Delete ?>, add newline at EOF.
PHPBB3-9726
2011-04-23 22:49:08 -04:00
Marek A. Ruszczynski
2d11e1c095 [feature/template-engine] Improved template engine.
PHPBB3-9726
2011-04-23 22:49:02 -04:00
Marek A. Ruszczynski
4b646c6c80 [feature/template-engine] Update tests.
PHPBB3-9726
2011-04-23 22:48:50 -04:00