<?php 
 
declare(strict_types=1); 
 
/* 
 * You may not change or alter any portion of this comment or credits 
 * of supporting developers from this source code or any supporting source code 
 * which is considered copyrighted (c) material of the original comment or credit authors. 
 * 
 * This program is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 */ 
 
/** 
 * @copyright    XOOPS Project https://xoops.org/ 
 * @license      GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) 
 * @since 
 * @author       XOOPS Development Team 
 * @param mixed $val 
 */ 
/** 
 * @param $val 
 * @return float|int 
 */ 
function wgtransifexReturnBytes($val) 
{ 
    switch (\mb_substr($val, -1)) { 
        case 'K': 
        case 'k': 
            return (int)$val * 1024; 
        case 'M': 
        case 'm': 
            return (int)$val * 1048576; 
        case 'G': 
        case 'g': 
            return (int)$val * 1073741824; 
        default: 
            return $val; 
    } 
} 
 
 |