You are here

public static function FeedImport::processXMLChunkedValidate in Feed Import 7.2

Callback for validating processXMLChunked settings

File

./feed_import.inc.php, line 1165
Feed import class for parsing and processing content.

Class

FeedImport
@file Feed import class for parsing and processing content.

Code

public static function processXMLChunkedValidate($field, $value, $default = NULL) {
  switch ($field) {
    case 'xml_properties':
      $value = trim($value);
      if (!preg_match("/^\\<\\?xml (.*)\\?\\>\$/", $value)) {
        return $default;
      }
      break;
    case 'chunk_size':
      $value = (int) $value;
      if ($value <= 0) {
        return $default;
      }
      break;
    case 'substr_function':
      if (!in_array($value, array(
        'substr',
        'mb_substr',
        'drupal_substr',
      ))) {
        return $default;
      }
      break;
  }
  return $value;
}