You are here

function _scanner_get_selected_tables_map in Search and Replace Scanner 5.2

Same name and namespace in other branches
  1. 6 scanner.module \_scanner_get_selected_tables_map()
  2. 7 scanner.module \_scanner_get_selected_tables_map()

Get the fields that have been selected for scanning.

Return value

map of selected fields and tables.

2 calls to _scanner_get_selected_tables_map()
scanner_admin_form in ./scanner.module
Search and Replace Settings form.
scanner_execute in ./scanner.module
Handles the actual search and replace.

File

./scanner.module, line 1075
Search and Replace Scanner - works on all nodes text content.

Code

function _scanner_get_selected_tables_map() {
  $tables_map = _scanner_get_all_tables_map();
  foreach ($tables_map as $i => $item) {
    $key = 'scanner_' . $item['field'] . '_' . $item['table'] . '_' . $item['type'];
    if (!variable_get($key, FALSE)) {
      unset($tables_map[$i]);
    }
  }
  $custom = variable_get('scanner_custom', NULL);
  preg_match_all('/(.*) in (.*) of type (.*) on (.*)/', $custom, $matches, PREG_SET_ORDER);
  foreach ($matches as $match) {
    $tables_map[] = array(
      'type' => trim($match[3]),
      'field' => trim($match[1]),
      'table' => trim($match[2]),
      'on' => trim($match[4]),
    );
  }
  return $tables_map;
}