}
}
+if( !function_exists( 'floatval' ) ) {
+ /**
+ * First defined in PHP 4.2.0
+ * @param mixed $var;
+ * @return float
+ */
+ function floatval( $var ) {
+ return (float)$var;
+ }
+}
+
/**
* Where as we got a random seed
* @var bool $wgTotalViews
function wfMsgHtml( $key ) {
$args = func_get_args();
array_shift( $args );
- return wfMsgReplaceArgs(
- htmlspecialchars( wfMsgGetKey( $key, $args, true ) ),
- $args );
+ return wfMsgReplaceArgs( htmlspecialchars( wfMsgGetKey( $key, true ) ), $args );
}
/**
$pairs = array(
"\\" => "\\\\",
"\"" => "\\\"",
- "\'" => "\\\'",
+ '\'' => '\\\'',
"\n" => "\\n",
"\r" => "\\r",
}
}
+/**
+ * @param mixed $nr The number to format
+ * @param int $acc The number of digits after the decimal point, default 2
+ * @param bool $round Whether or not to round the value, default true
+ * @return float
+ */
+function percent( $nr, $acc = 2, $round = true ) {
+ $ret = sprintf( "%.${acc}f", $nr );
+ return $round ? round( $ret, $acc ) . '%' : "$ret%";
+}
?>