/**
  * Applies htmlspecialchars() on the specified value.
  *
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param \TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $value = $arguments['value'];
     if ($value === null) {
         $value = $renderChildrenClosure();
     }
     if (!is_integer($value) && !is_float($value)) {
         if (is_numeric($value)) {
             $value = (double) $value;
         } else {
             $value = 0;
         }
     }
     return Files::bytesToSizeString($value, $arguments['decimals'], $arguments['decimalSeparator'], $arguments['thousandsSeparator']);
 }
 /**
  * Returns the lowest configured maximum upload file size
  *
  * @return string
  */
 protected function renderMaximumFileUploadSize()
 {
     $maximumFileUploadSizeInBytes = min(Files::sizeStringToBytes(ini_get('post_max_size')), Files::sizeStringToBytes(ini_get('upload_max_filesize')));
     return sprintf('"%d"; // %s, as configured in php.ini', $maximumFileUploadSizeInBytes, Files::bytesToSizeString($maximumFileUploadSizeInBytes));
 }
Example #3
0
 /**
  * @param $bytes
  * @param $decimals
  * @param $decimalSeparator
  * @param $thousandsSeparator
  * @param $expected
  * @test
  * @dataProvider bytesToSizeStringDataProvider
  */
 public function bytesToSizeStringTests($bytes, $decimals, $decimalSeparator, $thousandsSeparator, $expected)
 {
     $actualResult = Files::bytesToSizeString($bytes, $decimals, $decimalSeparator, $thousandsSeparator);
     $this->assertSame($expected, $actualResult);
 }
 /**
  * @param Asset $asset
  * @return void
  */
 public function replaceAssetResourceAction(Asset $asset)
 {
     $maximumFileUploadSize = $this->maximumFileUploadSize();
     $this->view->assignMultiple(array('asset' => $asset, 'maximumFileUploadSize' => $maximumFileUploadSize, 'redirectPackageEnabled' => $this->packageManager->isPackageAvailable('Neos.RedirectHandler'), 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize)));
 }