mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
add wordwrap and indent to repository
This commit is contained in:
16
libs/plugins/modifier.indent.php
Normal file
16
libs/plugins/modifier.indent.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Smarty plugin
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* Type: modifier
|
||||||
|
* Name: indent
|
||||||
|
* Purpose: indent lines of text
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
function smarty_modifier_indent($string,$chars=4,$char=" ")
|
||||||
|
{
|
||||||
|
return preg_replace('!^!m',str_repeat($char,$chars),$string);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
16
libs/plugins/modifier.wordwrap.php
Normal file
16
libs/plugins/modifier.wordwrap.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Smarty plugin
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* Type: modifier
|
||||||
|
* Name: wordwrap
|
||||||
|
* Purpose: wrap a string of text at a given length
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
|
||||||
|
{
|
||||||
|
return wordwrap($string,$length,$break,$cut);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
16
plugins/modifier.indent.php
Normal file
16
plugins/modifier.indent.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Smarty plugin
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* Type: modifier
|
||||||
|
* Name: indent
|
||||||
|
* Purpose: indent lines of text
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
function smarty_modifier_indent($string,$chars=4,$char=" ")
|
||||||
|
{
|
||||||
|
return preg_replace('!^!m',str_repeat($char,$chars),$string);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
16
plugins/modifier.wordwrap.php
Normal file
16
plugins/modifier.wordwrap.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Smarty plugin
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* Type: modifier
|
||||||
|
* Name: wordwrap
|
||||||
|
* Purpose: wrap a string of text at a given length
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
|
||||||
|
{
|
||||||
|
return wordwrap($string,$length,$break,$cut);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Reference in New Issue
Block a user