# Output page, used for reporting errors
# FALSE means discard output
- function &setOutputPage( &$out ) { return wfSetRef( $this->mOut, $out ); }
+ function &setOutputPage( &$out ) { $this->mOut =& $out; }
# Boolean, controls output of large amounts of debug information
function setDebug( $debug ) { return wfSetVar( $this->mDebug, $debug ); }
# Output page, used for reporting errors
# FALSE means discard output
- function &setOutputPage( &$out ) { return wfSetRef( $this->mOut, $out ); }
+ function &setOutputPage( &$out ) { $this->mOut =& $out; }
# Boolean, controls output of large amounts of debug information
function setDebug( $debug ) { return wfSetVar( $this->mDebug, $debug ); }
return "&#$codepoint;";
}
+# Converts numeric character entities to UTF-8
function wfMungeToUtf8($string) {
global $wgInputEncoding; # This is debatable
#$string = iconv($wgInputEncoding, "UTF-8", $string);
}
# Sets dest to a reference to source and returns the original dest
+# Pity that doesn't work in PHP
function &wfSetRef( &$dest, &$source )
{
- $temp =& $dest;
- $dest =& $source;
- return $temp;
+ die( "You can't rebind a variable in the caller's scope" );
}
# This function takes two arrays as input, and returns a CGI-style string, e.g.
$first = false;
}
- if (substr(php_uname(), 0, 7) == 'Windows') {
+ if ( isWindows() ) {
$retVal .= '"' . str_replace( '"','\"', $arg ) . '"';
} else {
$retVal .= escapeshellarg( $arg );
return array_flip( array_intersect( array_flip( $a ), array_keys( $b ) ) );
}
+# Since Windows is so different to any of the other popular OSes, it seems appropriate
+# to have a simple way to test for its presence
+function wfIsWindows() {
+ if (substr(php_uname(), 0, 7) == 'Windows') {
+ return true;
+ } else {
+ return false;
+ }
+}
+
?>