You are here

public static function FeedImport::prepareFilters in Feed Import 7.2

Prepares a filter

Parameters

array $filters: An array of filters

string $param: Param placeholder

1 call to FeedImport::prepareFilters()
FeedImport::processFeed in ./feed_import.inc.php
This function is choosing process function and executes it

File

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

Class

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

Code

public static function prepareFilters(&$filters, $param) {
  foreach ($filters as $name => &$f) {
    if (strpos($f['#function'], '::') !== FALSE) {
      $f['#function'] = explode('::', $f['#function'], 2);
      if (!$f['#function'][0]) {
        $f['#function'][0] = 'FeedImportFilter';
      }
      if (!method_exists($f['#function'][0], $f['#function'][1])) {
        unset($filters[$name]);
        continue;
      }
    }
    elseif (!function_exists($f['#function'])) {
      unset($filters[$name]);
      continue;
    }
    $f['#pvhold'] = NULL;
    $f['#params'] = array_values($f['#params']);
    for ($i = 0, $m = count($f['#params']); $i < $m; $i++) {
      if ($f['#params'][$i] == $param) {
        $f['#params'][$i] =& $f['#pvhold'];
      }
    }
  }
  if (!$filters) {
    $filters = FALSE;
  }
}