You are here

function taxonomy_xml_sub_placeholders_into_pattern in Taxonomy import/export via XML 6

Same name and namespace in other branches
  1. 6.2 taxonomy_xml.module \taxonomy_xml_sub_placeholders_into_pattern()
  2. 7 taxonomy_xml.process.inc \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.module
If the currently processing term refers to other terms by URI, set up a process to retrieve them recursively later.
taxonomy_xml_import_form_submit in ./taxonomy_xml.module
Imports the actual XML.

File

./taxonomy_xml.module, line 1385
taxonomy_xml.module This module makes it possible to import and export taxonomies as XML documents.

Code

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