}
function wfUtf8Sequence($codepoint) {
- if($codepoint < 0x80) return chr($codepoint);
- if($codepoint < 0x800) return chr($codepoint >> 6 & 0x3f | 0xc0) .
- chr($codepoint & 0x3f | 0x80);
- if($codepoint < 0x10000) return chr($codepoint >> 12 & 0x0f | 0xe0) .
- chr($codepoint >> 6 & 0x3f | 0x80) .
- chr($codepoint & 0x3f | 0x80);
+ if($codepoint < 0x80) return chr($codepoint);
+ if($codepoint < 0x800) return chr($codepoint >> 6 & 0x3f | 0xc0) .
+ chr($codepoint & 0x3f | 0x80);
+ if($codepoint < 0x10000) return chr($codepoint >> 12 & 0x0f | 0xe0) .
+ chr($codepoint >> 6 & 0x3f | 0x80) .
+ chr($codepoint & 0x3f | 0x80);
if($codepoint < 0x100000) return chr($codepoint >> 18 & 0x07 | 0xf0) . # Double-check this
- chr($codepoint >> 12 & 0x3f | 0x80) .
- chr($codepoint >> 6 & 0x3f | 0x80) .
- chr($codepoint & 0x3f | 0x80);
+ chr($codepoint >> 12 & 0x3f | 0x80) .
+ chr($codepoint >> 6 & 0x3f | 0x80) .
+ chr($codepoint & 0x3f | 0x80);
# Doesn't yet handle outside the BMP
return "&#$codepoint;";
}
}
function wfDebugDieBacktrace( $msg = '' ) {
- $msg .= "\n<p>Backtrace:</p>\n<ul>\n";
- $backtrace = debug_backtrace();
- foreach( $backtrace as $call ) {
- $f = explode( DIRECTORY_SEPARATOR, $call['file'] );
- $file = $f[count($f)-1];
- $msg .= '<li>' . $file . " line " . $call['line'] . ', in ';
- if( !empty( $call['class'] ) ) $msg .= $call['class'] . '::';
- $msg .= $call['function'] . "()</li>\n";
- }
- die( $msg );
+ if ( function_exists( 'debug_backtrace' ) ) {
+ $msg .= "\n<p>Backtrace:</p>\n<ul>\n";
+ $backtrace = debug_backtrace();
+ foreach( $backtrace as $call ) {
+ $f = explode( DIRECTORY_SEPARATOR, $call['file'] );
+ $file = $f[count($f)-1];
+ $msg .= '<li>' . $file . " line " . $call['line'] . ', in ';
+ if( !empty( $call['class'] ) ) $msg .= $call['class'] . '::';
+ $msg .= $call['function'] . "()</li>\n";
+ }
+ }
+ die( $msg );
}
function wfNumberOfArticles()
if ( $wgUseCopyrightUpload )
{
- $textdesc = '== ' . wfMsg ( 'filedesc' ) . " ==\n" . $desc . "\n" .
- '== ' . wfMsg ( 'filestatus' ) . " ==\n" . $copyStatus . "\n" .
- '== ' . wfMsg ( 'filesource' ) . " ==\n" . $source ;
+ $textdesc = '== ' . wfMsg ( 'filedesc' ) . " ==\n" . $desc . "\n" .
+ '== ' . wfMsg ( 'filestatus' ) . " ==\n" . $copyStatus . "\n" .
+ '== ' . wfMsg ( 'filesource' ) . " ==\n" . $source ;
}
else $textdesc = $desc ;
wfStrencode( $name ) . "'";
$res = wfQuery( $sql, DB_READ, $fname );
if ( 0 == wfNumRows( $res ) ) {
- $common =
+ $common =
Namespace::getImage() . ",'" .
wfStrencode( $name ) . "','" .
wfStrencode( $desc ) . "','" . $wgUser->getID() . "','" .
function wfEscapeWikiText( $text )
{
$text = str_replace(
- array( '[', '|', "'", 'ISBN ' , '://' , "\n=" ),
+ array( '[', '|', "'", 'ISBN ' , '://' , "\n=" ),
array( '[', '|', ''', 'ISBN ', '://' , "\n=" ),
htmlspecialchars($text) );
return $text;
fwrite( $yourtextFile, $yours ); fclose( $yourtextFile );
# Check for a conflict
- $cmd = wfEscapeShellArg( $wgDiff3 ) . ' -a --overlap-only ' .
- wfEscapeShellArg( $mytextName ) . ' ' .
- wfEscapeShellArg( $oldtextName ) . ' ' .
- wfEscapeShellArg( $yourtextName );
- $handle = popen( $cmd, 'r' );
+ $cmd = wfEscapeShellArg( $wgDiff3 ) . ' -a --overlap-only ' .
+ wfEscapeShellArg( $mytextName ) . ' ' .
+ wfEscapeShellArg( $oldtextName ) . ' ' .
+ wfEscapeShellArg( $yourtextName );
+ $handle = popen( $cmd, 'r' );
if( fgets( $handle ) ){
$conflict = true;