Update for humanReadableByteFormat, update edit.jq.js
edit.jq.js: remove deprecated function decodeHtmlEntities, use utils.js instead update for humanReadableByteFormat to return non numeric first and then proceed with the convert
This commit is contained in:
@@ -1602,6 +1602,7 @@ function createNavMenu(nav_menu, header_id = 'mainHeader') // eslint-disable-lin
|
|||||||
* HTML decode &something; entrie
|
* HTML decode &something; entrie
|
||||||
* @param {string} str
|
* @param {string} str
|
||||||
* @returns string
|
* @returns string
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function decodeHtmlEntities(str) // eslint-disable-line no-unused-vars
|
function decodeHtmlEntities(str) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ class Byte
|
|||||||
public static function humanReadableByteFormat(string|int|float $bytes, int $flags = 0): string
|
public static function humanReadableByteFormat(string|int|float $bytes, int $flags = 0): string
|
||||||
{
|
{
|
||||||
// if not numeric, return as is
|
// if not numeric, return as is
|
||||||
if (is_numeric($bytes)) {
|
if (!is_numeric($bytes)) {
|
||||||
|
// if anything other return as string
|
||||||
|
return (string)$bytes;
|
||||||
|
}
|
||||||
// flags bit wise check
|
// flags bit wise check
|
||||||
// remove space between number and suffix
|
// remove space between number and suffix
|
||||||
if ($flags & self::BYTE_FORMAT_NOSPACE) {
|
if ($flags & self::BYTE_FORMAT_NOSPACE) {
|
||||||
@@ -104,10 +107,6 @@ class Byte
|
|||||||
} else {
|
} else {
|
||||||
return round($bytes_calc, 2) . $pre;
|
return round($bytes_calc, 2) . $pre;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// if anything other return as string
|
|
||||||
return (string)$bytes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user