Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Bugs, issue and performance

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
rocky
Smarty Regular


Joined: 08 Feb 2010
Posts: 35

PostPosted: Mon Feb 06, 2012 5:07 pm    Post subject: Bugs, issue and performance Reply with quote

Hi,

here are a few improvements for Smarty 3.
Maybe a developer of Smarty does this to the next update.

use the method "stream_resolve_include_path" instead of their own:

Code:


if (function_exists('stream_resolve_include_path')) {
   $_filepath = stream_resolve_include_path($_filepath);
} else {
   $_filepath = Smarty_Internal_Get_Include_Path::getIncludePath($_filepath);
}


method templateExists from a selection extends resource always returns true?

Code:

$r = $template->templateExists('extends:/asdf/asd.tpl');
var_dump($r);
bool(true)


modifier unescape is not fully developed yet:

Old:
Code:
switch (trim($params[1], '"\'')) {
    case 'entity':
        return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
    case 'htmlall':
        if (Smarty::$_MBSTRING) {
            return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
        }
        return 'html_entity_decode(' . $params[0] . ', ENT_QUOTES, ' . $params[2] . ')';

    case 'html':
        return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';

    default:
        return $params[0];
}



New
Code:

switch (trim($params[1], '"\'')) {
    case 'entity':
        if (Smarty::$_MBSTRING) {
            return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
        }
        return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
    case 'htmlall':
        if (Smarty::$_MBSTRING) {
            return 'htmlspecialchars_decode(mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\'), ENT_QUOTES)';
        }
        return 'html_entity_decode(' . $params[0] . ', ENT_QUOTES, ' . $params[2] . ')';

    case 'html':
        return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
    case 'url':
        return 'rawurldecode(' . $params[0] . ')';
    default:
        return $params[0];
}


Heiner
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Mon Feb 06, 2012 8:33 pm    Post subject: Reply with quote

proposed changes have been committed to SVN and will be included in Smarty 3.1.8
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
rocky
Smarty Regular


Joined: 08 Feb 2010
Posts: 35

PostPosted: Tue Feb 07, 2012 10:41 am    Post subject: Reply with quote

Hey,

that was fast. Wink

thx

Heiner
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP