Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

how to submit a plugin ?? [mb_trim trim modifiefor Japanese]

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
BenFromTokyo
Smarty Rookie


Joined: 15 Oct 2004
Posts: 12
Location: Japan

PostPosted: Fri Dec 17, 2004 4:57 am    Post subject: how to submit a plugin ?? [mb_trim trim modifiefor Japanese] Reply with quote

Hi all,
I would like to submit this modifier into the wiki plugins .
I did not have time to find out how to do that...
cheers,
Ben
Code:

<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty plugin
 *
 * Type:     modifier<br>
 * Name:     mb_trim<br>
 * Date:     Dec 17, 2004
 * Purpose:  does the same as trim() but also delete zenkaku space ' '
 * Input:<br>
 *         - str = str to replace
 * Example:  {$text|mb_trim}
 * @link http://www.php.net/manual/en/function.trim.php
 *          trim php function (mb_trim does not exists for now)
 * @version  1.0
 * @author   Benjamin layet <benjamin@moonfactory.co.jp>
 * @param string
 * @return string
 */
function smarty_modifier_mb_trim($str)
{   
     if(!is_string($str))
     {
         return $str;
     }
     $str = trim($str);
     $zenspace = mb_convert_kana(' ', 'S');
     if($zenspace == substr($str,-2))
     {
         $str = substr($str, 0 , -2);
         $str = smarty_modifier_mb_trim($str);
     }
     if($zenspace == substr($str,0,2))
     {
         $str = substr($str, 2);
         $str = smarty_modifier_mb_trim($str);
     }
     return $str;
}
?>
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Sat Dec 18, 2004 10:16 pm    Post subject: Reply with quote

http://www.phpinsider.com/smarty-forum/viewtopic.php?t=3952
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins 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