static function isUtf8( $value, $disableMbstring = false ) {
if ( preg_match( '/[\x80-\xff]/', $value ) === 0 ) {
- # no high bit set, this is pure ASCII which is defacto
+ # no high bit set, this is pure ASCII which is de facto
# valid UTF-8
return true;
}
| [\xf8-\xfb][\x80-\xbf]{4}
| \xfc[\x84-\xbf][\x80-\xbf]{4}
)+$/x', $value );
- return ($hasUtf8 > 0 );
+ return ( $hasUtf8 > 0 );
}
}
// Explode, then put the replaced separators back in
$items = explode( $separator, $cleaned );
- foreach( $items as $i => $str ) {
+ foreach ( $items as $i => $str ) {
$items[$i] = str_replace( $placeholder, $separator, $str );
}
/**
* Set an element of the replacement array
* @param $from string
- * @param $to stromg
+ * @param $to string
*/
function setPair( $from, $to ) {
$this->data[$from] = $to;
* @param $data array
*/
function removeArray( $data ) {
- foreach( $data as $from => $to ) {
+ foreach ( $data as $from => $to ) {
$this->removePair( $from );
}
$this->fss = false;
*/
function replace( $subject ) {
if ( function_exists( 'fss_prep_replace' ) ) {
- wfProfileIn( __METHOD__.'-fss' );
+ wfProfileIn( __METHOD__ . '-fss' );
if ( $this->fss === false ) {
$this->fss = fss_prep_replace( $this->data );
}
$result = fss_exec_replace( $this->fss, $subject );
- wfProfileOut( __METHOD__.'-fss' );
+ wfProfileOut( __METHOD__ . '-fss' );
} else {
- wfProfileIn( __METHOD__.'-strtr' );
+ wfProfileIn( __METHOD__ . '-strtr' );
$result = strtr( $subject, $this->data );
- wfProfileOut( __METHOD__.'-strtr' );
+ wfProfileOut( __METHOD__ . '-strtr' );
}
return $result;
}