You are here

function taxonomy_xml_sub_placeholders_into_pattern in Taxonomy import/export via XML 7

Same name and namespace in other branches
  1. 6.2 taxonomy_xml.module \taxonomy_xml_sub_placeholders_into_pattern()
  2. 6 taxonomy_xml.module \taxonomy_xml_sub_placeholders_into_pattern()

Replace URL patterns containing placeholders for data values.

Used when invoking GET URL services

Given a pattern like http://example.com/lookup?id=!id&rank=!rank and array ('rank' => 'Genus', 'id' => 55596) those values will be placed into the URL. Note that we add '!' before doing the sub, to avoid incorrect placements, otherwise we'd just use strtr()

2 calls to taxonomy_xml_sub_placeholders_into_pattern()
taxonomy_xml_add_all_children_to_queue in ./taxonomy_xml.process.inc
Queue up an import action.
taxonomy_xml_invoke_service_request in ./taxonomy_xml.process.inc
Make a request on a remote taxonomy server and process the response

File

./taxonomy_xml.process.inc, line 1155
The workhorse processes for importing taxonomies.

Code

function taxonomy_xml_sub_placeholders_into_pattern($pattern, $values) {
  $subs = array();
  foreach ($values as $var => $val) {
    $subs['!' . $var] = $val;
  }
  return strtr($pattern, $subs);
}