Importing bits and pieces

This is the initial import based on a few files I had around.
This commit is contained in:
Emmanuel BENOîT 2012-02-05 12:56:54 +01:00
commit 871d28cd16
20 changed files with 1994 additions and 0 deletions
includes/form

View file

@ -0,0 +1,26 @@
<?php
class Modifier_TrimString
implements FieldModifier
{
private $removeDuplicateSpaces;
public function __construct( $removeDuplicateSpaces = true )
{
$this->removeDuplicateSpaces = $removeDuplicateSpaces;
}
public function replace( $value )
{
if ( $value === null ) {
return '';
}
$value = trim( $value );
if ( $this->removeDuplicateSpaces ) {
$value = preg_replace( '/\s\s+/' , ' ' , $value );
}
return $value;
}
}