- md5
- f6c10cbf4abe3c6e292faadd75e692ab
- sha1
- c7afa3073607a257e115b55d98cd3475de618ba6
- sha256
- 98a22ca2ddd7afd55294569817da326bd0c1ca1632e214f66cda1deb1d047802
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
<?PHP
/**
* patTemplate modfifier Wordwrapper
*
* $Id: Wordwrapper.php 8287 2007-08-01 08:38:59Z eddieajau $
*
* @package patTemplate
* @subpackage Modifiers
* @author Stephan Schmidt <[email protected]>
*/
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
/**
* patTemplate modfifier Wordwrapper
*
* Wraps lines of long texts.
*
* Possible attributes are:
* - width (integer)
* - break (string)
* - cut (yes|no)
* - nl2br (yes|no)
*
* See the PHP documentation for wordwrap() for
* more information.
*
* @package patTemplate
* @subpackage Modifiers
* @author Stephan Schmidt <[email protected]>
* @link http://www.php.net/manual/en/function.wordwrap.php
*/
class patTemplate_Modifier_Wordwrapper extends patTemplate_Modifier
{
/**
* modify the value
*
* @access public
* @param string value
* @return string modified value
*/
function modify( $value, $params = array() )
{
/**
* width
*/
if( !isset( $params['width'] ) )
$params['width'] = 72;
settype( $params['width'], 'integer' );
/**
* character used for linebreaks
*/
if( !isset( $params['break'] ) )
$params['break'] = "\n";
/**
* cut at the specified width
*/
if( !isset( $params['cut'] ) )
$params['cut'] = 'no';
$params['cut'] = ($params['cut'] === 'yes') ? true : false;
$value = wordwrap( $value, $params['width'], $params['break'], $params['cut'] );
if( isset( $params['nl2br'] ) && $params['nl2br'] === 'yes' )
$value = nl2br( $value );
return $value;
}
}
?>
The same content is in 4 releases, Joomla 1.5.0 to 1.5.3. See them all, or every version of this file.