You are here

function customfilter_xml_filter in Custom filter 5

1 call to customfilter_xml_filter()
customfilter_xml_filterset in ./customfilter.module

File

./customfilter.module, line 1073

Code

function customfilter_xml_filter($filter, $level = 0) {
  $indent = str_repeat('  ', $level + 3);
  $xml = $indent . "<filter name=\"{$filter['name']}\" matches=\"{$filter['matches']}\" func=\"{$filter['func']}\" weight=\"{$filter['weight']}\">\n";
  $xml .= $indent . "  <description><![CDATA[{$filter['description']}]]></description>\n";
  $xml .= $indent . "  <pattern><![CDATA[{$filter['pattern']}]]></pattern>\n";
  $xml .= $indent . "  <replacement><![CDATA[{$filter['replacement']}]]></replacement>\n";
  $subfilters = $filter['sub'];
  if (is_array($subfilters) && count($subfilters) > 0) {
    $xml .= $indent . "  <subfilters>\n";
    foreach ($subfilters as $subfilter) {
      $xml .= customfilter_xml_filter($subfilter, $level + 2);
    }
    $xml .= $indent . "  </subfilters>\n";
  }
  $xml .= $indent . "</filter>\n";
  return $xml;
}