|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
cavo Smarty n00b
Joined: 01 Aug 2013 Posts: 1
|
Posted: Fri Aug 02, 2013 12:31 pm Post subject: Minor source code issues (mostly coding style) |
|
|
I needed to put Smarty to separate namespace so I wrote a litle script that adds 'namespace Smarty;\n' to each Smarty file. While doing this I found some inconsistencies that are not bugs but I think it would be fine to fix it. I don't want to say what coding style should Smarty follows but while digging down the source code I think I found what style Smarty actually follows and where it violates it's own style. Here are my findings for latest stable (3.1.14):
[extra CRNL at the end of file] => Array
[0] => sysplugins/smarty_internal_function_call_handler.php
[1] => sysplugins/smarty_internal_nocache_insert.php
[extra NL at the end of file] => Array
[0] => Smarty.class.php
[1] => plugins/outputfilter.trimwhitespace.php
[2] => plugins/shared.make_timestamp.php
[3] => sysplugins/smarty_internal_compile_ldelim.php
[php close tag N/A] => Array
[0] => plugins/modifiercompiler.strip_tags.php
[1] => plugins/shared.literal_compiler_param.php
[2] => sysplugins/smarty_internal_resource_stream.php
[3] => sysplugins/smarty_internal_templatelexer.php
[4] => sysplugins/smarty_internal_templateparser.php
[uses \t ?] => Array
[0] => sysplugins/smarty_internal_configfilelexer.php
[1] => sysplugins/smarty_internal_configfileparser.php
[2] => sysplugins/smarty_internal_templatelexer.php
[3] => sysplugins/smarty_internal_templateparser.php
[uses \r\n ?] => Array
[0] => SmartyBC.class.php
[1] => plugins/modifiercompiler.cat.php
[2] => plugins/modifiercompiler.count_characters.php
[3] => plugins/modifiercompiler.count_paragraphs.php
[4] => plugins/modifiercompiler.count_sentences.php
[5] => plugins/modifiercompiler.count_words.php
[6] => plugins/modifiercompiler.default.php
[7] => plugins/modifiercompiler.escape.php
[8] => plugins/modifiercompiler.from_charset.php
[9] => plugins/modifiercompiler.indent.php
[10] => plugins/modifiercompiler.lower.php
[11] => plugins/modifiercompiler.noprint.php
[12] => plugins/modifiercompiler.string_format.php
[13] => plugins/modifiercompiler.strip.php
[14] => plugins/modifiercompiler.strip_tags.php
[15] => plugins/modifiercompiler.to_charset.php
[16] => plugins/modifiercompiler.unescape.php
[17] => plugins/modifiercompiler.upper.php
[18] => plugins/modifiercompiler.wordwrap.php
[19] => sysplugins/smarty_internal_compile_break.php
[20] => sysplugins/smarty_internal_compile_continue.php
[21] => sysplugins/smarty_internal_compile_private_modifier.php
[22] => sysplugins/smarty_internal_compile_private_registered_block.php
[23] => sysplugins/smarty_internal_compile_private_registered_function.php
[24] => sysplugins/smarty_internal_compile_setfilter.php
[25] => sysplugins/smarty_internal_function_call_handler.php
[26] => sysplugins/smarty_internal_get_include_path.php
[27] => sysplugins/smarty_internal_nocache_insert.php
[28] => sysplugins/smarty_internal_parsetree.php
[29] => sysplugins/smarty_internal_resource_eval.php
[30] => sysplugins/smarty_internal_templatebase.php
[31] => sysplugins/smarty_internal_templatecompilerbase.php
[comment bad format] => Array
[0] => SmartyBC.class.php
[1] => plugins/modifier.truncate.php
[2] => plugins/shared.mb_str_replace.php
[3] => sysplugins/smarty_cacheresource.php
[4] => sysplugins/smarty_internal_cacheresource_file.php
[5] => sysplugins/smarty_internal_compile_block.php
[6] => sysplugins/smarty_internal_compile_break.php
[7] => sysplugins/smarty_internal_compile_extends.php
[8] => sysplugins/smarty_internal_compile_if.php
[9] => sysplugins/smarty_internal_compile_include.php
[10] => sysplugins/smarty_internal_compile_insert.php
[11] => sysplugins/smarty_internal_compile_private_modifier.php
[12] => sysplugins/smarty_internal_compile_private_print_expression.php
[13] => sysplugins/smarty_internal_configfilelexer.php
[14] => sysplugins/smarty_internal_configfileparser.php
[15] => sysplugins/smarty_internal_resource_extends.php
[16] => sysplugins/smarty_internal_resource_php.php
[17] => sysplugins/smarty_internal_resource_stream.php
[18] => sysplugins/smarty_internal_templatecompilerbase.php
[19] => sysplugins/smarty_internal_templatelexer.php
[20] => sysplugins/smarty_internal_templateparser.php
[21] => sysplugins/smarty_security.php
Legend:
php close tag N/A or error
- these files are not closed with php ending tag (in fact I think that all the Smarty files should omit ending tags: http://goo.gl/o00tFr).
uses \t ?
- most of the Smarty source code files use multiple spaces as indentation but these use \t (or \t present in file)
uses \r\n ?
- most of the Smarty source code files use \n as newline but these use \r\n
comment bad format
- file doesn't start with: opening tag - newline - phpdoc (each line but first: space - * - space - ... - newline) - 2 newlines
I am willing to take current development version of Smarty and fix these issues and send you back if you don't mind.
Thanks. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Aug 02, 2013 1:02 pm Post subject: |
|
|
Version 3.2 is already going through a major overhaul, including file renaming and relocation, as wells as code PSR-2 compliance. It will also be moving to github, so code pull requests will be easy submit for anyone. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Aug 02, 2013 1:28 pm Post subject: |
|
|
The SVN trunk does also already contain PSR-2 compliance updates which will be later be included in 3.1.15 |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|