<?php

$aScripts = array(
    'd3_extsearch_semantic_category.php',
    'd3_extsearch_semantic_categorylink.php',
    'd3_extsearch_semantic_language.php',
    'd3_extsearch_semantic_link_type.php',
    'd3_extsearch_semantic_preftermlink.php',
    'd3_extsearch_semantic_rejectedword.php',
    'd3_extsearch_semantic_section.php',
    'd3_extsearch_semantic_semtype.php',
    'd3_extsearch_semantic_semtypelink.php',
    'd3_extsearch_semantic_source.php',
    'd3_extsearch_semantic_sourcelink.php',
    'd3_extsearch_semantic_synset.php',
    'd3_extsearch_semantic_synsetlink.php',
    'd3_extsearch_semantic_synsetlinksuggestion.php',
    'd3_extsearch_semantic_synsetsuggestion.php',
    'd3_extsearch_semantic_term.php',
    'd3_extsearch_semantic_termlevel.php',
    'd3_extsearch_semantic_termlink.php',
    'd3_extsearch_semantic_termlinktype.php',
    'd3_extsearch_semantic_thesaurusconfigentry.php',
    'd3_extsearch_semantic_wordgrammar.php',
);

foreach ($aScripts as $sScript) {
    unset($this->aESSemanticTables);
    unset($this->aESSemanticFields);
    unset($this->aESSemanticIndizes);
    unset($this->aESSemanticRenameFields);

    require_once($sScript);

    if (isset($this->aESSemanticTables)
        && is_array($this->aESSemanticTables)
        && count($this->aESSemanticTables)
    ) {
        $this->aSemanticTables = array_merge($this->aSemanticTables, $this->aESSemanticTables);
    }

    if (isset($this->aESSemanticFields)
        && is_array($this->aESSemanticFields)
        && count($this->aESSemanticFields)
    ) {
        $this->aFields = array_merge($this->aFields, $this->aESSemanticFields);
    }

    if (isset($this->aESSemanticIndizes)
        && is_array($this->aESSemanticIndizes)
        && count($this->aESSemanticIndizes)
    ) {
        $this->aIndizes = array_merge($this->aIndizes, $this->aESSemanticIndizes);
    }

    if (isset($this->aESSemanticRenameFields)
        && is_array($this->aESSemanticRenameFields)
        && count($this->aESSemanticRenameFields)
    ) {
        $this->aRenameFields = array_merge($this->aRenameFields, $this->aESSemanticRenameFields);
    }
}
