Template class passes extension manager to template compiler.
Template compiler passes extension manager to template filter.
Template filter will use extension manager to locate hooks
as it is compiling templates.
All extension manager arguments are optional. If an extension
manager is not given, template hooks will not be invoked.
PHPBB3-9550
Changing template classes prefixes from phpbb_template to phpbb_style (for classes that will work with styles) or phpbb_style_template (for classes that are specific to templates)
PHPBB3-10632
This commit adds a template path provider to separate the process of locating
(cached) paths in extensions from the template engine. The locator is supplied
with a list of paths from the path provider.
Admin templates can now be created in ext/<ext>/adm/style/ and regular
templates go into ext/<ext>/styles/<style>/template/. Extension templates
override regular templates. So if an extension supplies a file with a name
used in phpBB, the extension's file will be used.
A side-effect of this commit: Locator and Provider are now able to deal with
arbitrary levels of template inheritance. So we can expose this through
phpbb_template if we choose to, and allow styles to inherit from inherited
styles.
PHPBB3-10323
* develop: (157 commits)
[ticket/10316] Resolve inconsistent move topic behavior
[ticket/9297] Add network to class name of unit tests.
[ticket/9297] Fix typo in localhost.
[ticket/9297] Rename test class to reflect its contents.
[ticket/9297] Adjust comment - IPv6 is needed for IPv6 connections to work.
[ticket/9297] Fix markTestSkipped call in setUpBeforeClass.
[ticket/9608] Remove use of references in topic_review
[ticket/9297] Skip FTP PASV/EPSV test if FTP connection fails.
[ticket/9297] Separate ipv4 and ipv6 tests into separate functions.
[ticket/9297] Update copyright year of unit test file.
[feature/template-engine] Delete _get_locator function.
[feature/template-engine] Clean up template locator usage in bbcode.
[ticket/9297] Make EPSV unit tests work without IPv6.
[ticket/9297] Unit tests for ftp_fsock PASV and EPSV.
[ticket/9297] Add support for Extended Passive Mode (EPSV) in ftp_fsock class.
[ticket/10312] Un-check the shadow option while moving.
[feature/template-engine] Need to call set_template on template.
[feature/template-engine] Update installer for template engine changes.
[feature/template-engine] Dependency inject locator into template.
[feature/template-engine] Delete useless code from set_template.
...
Conflicts:
phpBB/includes/functions.php
Extend the request class with helpers for reading server vars (server())
and HTTP request headers (header()). Refactor the existing code base
to make use of these helpers, make $_SERVER a deactivated super global.
Also introduce an is_ajax() method, which checks the X-Requested-With
header for the value 'XMLHttpRequest', which is sent by JavaScript
libraries, such as jQuery.
PHPBB3-9716
Changed queue locking to cover all queue file operations,
in particular the check for queue file existince and
inclusion of queue file must be done under one lock.
Also refactored queue locking and unlocking into separate
methods.
PHPBB3-9061
This reverts r8025 to includes/functions_messenger.php. That code caused
problems on hosters with email limits less than package_size*2.5. And it isn't
desirable in general to over-ride the admin's configuration options.
PHPBB3-9559
To explain what this is about, first a short phpBB code history lesson: ;-)
r9823 originally introduced the usage of our template class for emails. The
messenger class uses set_custom_template() to initialise the template object
which neither disables storedb nor inheritance. These two values are set in
$user->theme rather than inside a particular template instance (quite a design
failure if I may add). Thus the html page that is displayed to the user also
determines these settings for the email templates. This obviously causes
problems because both emails and other custom templates can quite simply not
be stored in the database because the db table only stores the filename, not
the path and requires a template id.
r9839 then generally disabled storedb and template inheritance for custom
templates to fix Bug #40515. This works for custom templates, but not for
emails where lots of template objects are created. In such a situation the
last call to set(_custom)_template() would now determine the values of storedb
and inheritance in _tpl_load. So any page sending emails would neither load
its template from the database nor use template inheritance. The same revision
also introduced orig_tpl_* variables in set_template() which on their own are
very much pointless, but could allow resetting the storedb and inheritance
values if they were used to reset $user->theme just before template execution
in _tpl_load.
In r10150 these orig_tpl_* variables are correctly used to access information
about the template of the page being displayed - contrary to the last template
used - from within the bbcode, fixing Bug #51285. However r10150 also introduces
a pointless $template_mode parameter for set_custom_template(). $template_mode
is really just a boolean flag (value you can be 'template' or an arbitrary other
value) that if it set circumvents the unsetting of storedb and template
inheritance. The very code that had been added to prevent issues with emails and
custom templates. Fixing the problem introduced by r8839 but at the same time
reintroducing the much greater problem from the original implementation of email
templates.
And now an explanation of what I did:
Based on this I have now changed the set_custom_template method to always
disable storedb. It can now properly use inheritance, you simply tell it the
path where the parent template can be found, by default the path is false which
will turn inheritance off. To make this work the template class now always
overwrites $user->theme storedb and inheritance variabbles with orig_tpl_* just
before rendering a template in _tpl_load. This way they are guaranteed to always
contain the value they had at the time set_template/set_custom_template were
called. This fixes [Bug #54505].
In summary, using global state is simply a horrible idea in object oriented
programming. Always Pass values, that an object depends on, as parameters - never
through magic global variables. Following this principle will safe you from a lot
of headaches.
Please test this patch as much as possible to make sure templates still work
properly for you, focus on multiple languages, missing language files, and
custom templates in systems that make use of the template class outside of
phpBB itself.
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10460 89ea8834-ac86-4346-8a33-228a782c2dd0
Did not check if this influences styles template cache list/purge/etc.
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9823 89ea8834-ac86-4346-8a33-228a782c2dd0