diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-06-24 13:32:31 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-06-24 13:32:31 -0500 |
commit | 1a0819bdc40fd6b40b556ba1739ae71214719b43 (patch) | |
tree | 45e0bb5382bbd8ecaa25d2683ec9fb4de2348687 | |
parent | 63143a1a576b9707dfc997038a5aaf804d5f8d8e (diff) | |
download | forums-1a0819bdc40fd6b40b556ba1739ae71214719b43.tar forums-1a0819bdc40fd6b40b556ba1739ae71214719b43.tar.gz forums-1a0819bdc40fd6b40b556ba1739ae71214719b43.tar.bz2 forums-1a0819bdc40fd6b40b556ba1739ae71214719b43.tar.xz forums-1a0819bdc40fd6b40b556ba1739ae71214719b43.zip |
[feature/twig] Changing INCLUDEJS behavior
Was:
<!-- INCLUDEJS template/foo.js -->
Now:
<!-- INCLUDEJS T_TEMPLATE_PATH ~ '/foo.js' -->
Reasons for this:
1. INCLUDEJS is 3.1-dev only
2. INCLUDEJS has odd behavior to begin with (arbitrary setting root path
to styles/name/ directory)
3. INCLUDEJS could not include files from outside directories or anywhere
else
4. It was easier to change INCLUDEJS behavior to something more flexible
and useful than hack around it to make it work as it was with Twig.
PHPBB3-11598
10 files changed, 15 insertions, 14 deletions
diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index ea161bf730..b2828c9e25 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -32,15 +32,15 @@ class phpbb_template_twig_lexer extends Twig_Lexer 'UNDEFINE', 'ENDDEFINE', /*'INCLUDE', - 'INCLUDEPHP', - 'INCLUDEJS',*/ + 'INCLUDEPHP',*/ + 'INCLUDEJS', 'PHP', 'ENDPHP', 'EVENT', ); // Replace <!-- INCLUDE blah.html --> with {% include 'blah.html' %} - $code = preg_replace('#<!-- INCLUDE(PHP|JS)? (.*?) -->#', "{% INCLUDE$1 '$2' %}", $code); + $code = preg_replace('#<!-- INCLUDE(PHP)? (.*?) -->#', "{% INCLUDE$1 '$2' %}", $code); // This strips the $ inside of a tag directly after the token, which was used in <!-- DEFINE $NAME $code = preg_replace('#<!-- DEFINE \$(.*)-->#', '<!-- DEFINE $1-->', $code); diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index 6fe8e155b7..881636a326 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -24,8 +24,9 @@ class phpbb_template_twig_node_includejs extends Twig_Node $compiler->addDebugInfo($this); $compiler - ->write("\$context['SCRIPTS'] .= '<script type=\"text/javascript\" src=") + ->write("\$context['SCRIPTS'] .= '<script type=\"text/javascript\" src=\"' . ") ->subcompile($this->getNode('expr')) - ->raw(">';\n\n"); + ->raw(" . '\">';\n\n") + ; } } diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html index 61bfd630ff..2b826497da 100644 --- a/phpBB/styles/prosilver/template/memberlist_search.html +++ b/phpBB/styles/prosilver/template/memberlist_search.html @@ -38,7 +38,7 @@ function insert_single(user) // ]]> </script> <!-- ENDIF --> -<!-- INCLUDEJS template/forum_fn.js --> +<!-- INCLUDEJS T_TEMPLATE_PATH ~ '/forum_fn.js' --> <h2 class="solo">{L_FIND_USERNAME}</h2> <form method="post" action="{S_MODE_ACTION}" id="search_memberlist"> diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index ba0412ddd3..01fc3f83da 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -55,7 +55,7 @@ <!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF --> <script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js?assets_version={T_ASSETS_VERSION}"></script> <script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script> -<!-- INCLUDEJS template/ajax.js --> +<!-- INCLUDEJS T_TEMPLATE_PATH ~ '/ajax.js' --> {SCRIPTS} <!-- EVENT overall_footer_after --> diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index fadbc9b3ca..b3e2b85492 100644 --- a/phpBB/styles/prosilver/template/posting_buttons.html +++ b/phpBB/styles/prosilver/template/posting_buttons.html @@ -39,7 +39,7 @@ { dE('colour_palette'); e = document.getElementById('colour_palette'); - + if (e.style.display == 'block') { document.getElementById('bbpalette').value = '{LA_FONT_COLOR_HIDE}'; @@ -52,7 +52,7 @@ // ]]> </script> -<!-- INCLUDEJS template/editor.js --> +<!-- INCLUDEJS T_TEMPLATE_PATH ~ '/editor.js' --> <!-- IF S_BBCODE_ALLOWED --> <div id="colour_palette" style="display: none;"> diff --git a/phpBB/styles/prosilver/template/timezone_option.html b/phpBB/styles/prosilver/template/timezone_option.html index a77e82f9a1..95b30dbcd1 100644 --- a/phpBB/styles/prosilver/template/timezone_option.html +++ b/phpBB/styles/prosilver/template/timezone_option.html @@ -15,6 +15,6 @@ {S_TZ_OPTIONS} </select> - <!-- INCLUDEJS template/timezone.js --> + <!-- INCLUDEJS T_TEMPLATE_PATH ~ '/timezone.js' --> </dd> </dl> diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html index e7f4a48e11..4f4aef3ff9 100644 --- a/phpBB/styles/prosilver/template/ucp_avatar_options.html +++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html @@ -47,4 +47,4 @@ </div> </div> -<!-- INCLUDEJS template/avatars.js --> +<!-- INCLUDEJS T_TEMPLATE_PATH ~ '/avatars.js' --> diff --git a/phpBB/styles/subsilver2/template/timezone_option.html b/phpBB/styles/subsilver2/template/timezone_option.html index 26ba2388c9..d71166f517 100644 --- a/phpBB/styles/subsilver2/template/timezone_option.html +++ b/phpBB/styles/subsilver2/template/timezone_option.html @@ -15,6 +15,6 @@ {S_TZ_OPTIONS} </select> - <!-- INCLUDEJS template/timezone.js --> + <!-- INCLUDEJS T_TEMPLATE_PATH ~ '/timezone.js' --> </td> </tr> diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html index 8064e1e6e9..5595d19b9e 100644 --- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html +++ b/phpBB/styles/subsilver2/template/ucp_groups_manage.html @@ -95,7 +95,7 @@ </tr> </table> -<!-- INCLUDEJS template/avatars.js --> +<!-- INCLUDEJS T_TEMPLATE_PATH ~ '/avatars.js' --> <!-- ELSEIF S_LIST --> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html index 697cceabb9..58ef499c41 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html @@ -48,6 +48,6 @@ </tr> </table> -<!-- INCLUDEJS template/avatars.js --> +<!-- INCLUDEJS T_TEMPLATE_PATH ~ '/avatars.js' --> <!-- INCLUDE ucp_footer.html --> |