You are here

function _taxonomy_csv_parse_size in Taxonomy CSV import/export 5

Parses PHP configuration size values into bytes.

Edited from an example at http://php.net/manual/en/function.ini-get.php

1 call to _taxonomy_csv_parse_size()
taxonomy_csv_import in ./taxonomy_csv.module
Generates the CSV import form.

File

./taxonomy_csv.module, line 144
Quick import of lists of terms from a csv file.

Code

function _taxonomy_csv_parse_size($value) {
  $value = trim($value);
  $number = (int) substr($value, 0, -1);
  $suffix = strtoupper(substr($value, -1));
  switch ($suffix) {
    case 'G':
      $number *= 1024;
    case 'M':
      $number *= 1024;
    case 'K':
      $number *= 1024;
  }
  return $number;
}