You are here

function apachesolr_confgen_load_xml_file in Apache Solr Config Generator 7

Same name and namespace in other branches
  1. 6 apachesolr_confgen.module \apachesolr_confgen_load_xml_file()

Loads raw xml file and resolves xi:includes

1 call to apachesolr_confgen_load_xml_file()
apachesolr_confgen_get_original_qp in ./apachesolr_confgen.module

File

./apachesolr_confgen.module, line 110
Generator for Apache Solr Configuration Files.

Code

function apachesolr_confgen_load_xml_file($file) {
  $xml = apachesolr_confgen_load_config_file($file);
  if (preg_match_all('@<xi:include[^>]+?href="([^"]+?)".*?</xi:include>@s', $xml, $matches)) {
    $dirname = dirname($file);
    foreach ($matches[0] as $key => $xi_include) {
      $xml = str_replace($xi_include, apachesolr_confgen_load_xml_file($dirname . '/' . $matches[1][$key]), $xml);
    }
  }
  return $xml;
}