<commit_before><?php
namespace wcf\system\option;
use wcf\data\option\Option;
use wcf\system\WCF;
use wcf\util\FileUtil;
use wcf\util\StringUtil;

/**
 * Option type implementation for file sizes.
 * 
 * @author	<NAME>
 * @copyright	2011 <NAME>
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	com.woltlab.wcf
 * @subpackage	system.option
 * @category	Community Framework
 */
class FileSizeOptionType extends IntegerOptionType {
	/**
	 * @see	wcf\system\option\IOptionType::getData()
	 */
	public function getData(Option $option, $newValue) {
		$number = StringUtil::replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
		$d = preg_quote(WCF::getLanguage()->get('wcf.global.decimalPoint'), '~');
		if (!preg_match('~^(?:\d*)(?:'.$d.')?\d+~', $number, $matches)) return 0;
		
		$number = $matches[0];
		if (preg_match('/[kmgt]i?b$/i', $newValue, $multiplier)) {
			switch (StringUtil::toLowerCase($multiplier[0])) {
				case 'tb':
					$number *= 1000;
				case 'gb':
					$number *= 1000;
				case 'mb':<commit_msg>Fixed input field<commit_after><?php
namespace wcf\system\option;
use wcf\data\option\Option;
use wcf\system\WCF;
use wcf\util\FileUtil;
use wcf\util\StringUtil;

/**
 * Option type implementation for file sizes.
 * 
 * @author	<NAME>
 * @copyright	2011 <NAME>
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	com.woltlab.wcf
 * @subpackage	system.option
 * @category	Community Framework
 */
class FileSizeOptionType extends TextOptionType {
	/**
	 * @see	wcf\system\option\IOptionType::getData()
	 */
	public function getData(Option $option, $newValue) {
		$number = StringUtil::replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
		$d = preg_quote(WCF::getLanguage()->get('wcf.global.decimalPoint'), '~');
		if (!preg_match('~^(?:\d*)(?:'.$d.')?\d+~', $number, $matches)) return 0;
		
		$number = $matches[0];
		if (preg_match('/[kmgt]i?b$/i', $newValue, $multiplier)) {
			switch (StringUtil::toLowerCase($multiplier[0])) {
				case 'tb':
					$number *= 1000;
				case 'gb':
					$number *= 1000;
				case 'mb':
{'fraction_non_alphanumeric': 0.18758495695514274, 'fraction_numerical': 0.01359311282283643, 'mean_word_length': 4.6183206106870225, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '534151', 'n_tokens_mistral': 855, 'n_tokens_neox': 776, 'n_words': 153}