/** * Append some predefined XML to a plugin instance * @param AJXP_Plugin $plugin * @param DOMDocument $manifestDoc * @param String $mixinName */ public function patchPluginWithMixin(&$plugin, &$manifestDoc, $mixinName) { // Load behaviours if not already if (!isset($this->mixinsDoc)) { $this->mixinsDoc = new DOMDocument(); $this->mixinsDoc->load(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/core.ajaxplorer/ajxp_mixins.xml"); $this->mixinsXPath = new DOMXPath($this->mixinsDoc); } // Merge into manifestDoc $nodeList = $this->mixinsXPath->query($mixinName); if (!$nodeList->length) { return; } $mixinNode = $nodeList->item(0); foreach ($mixinNode->childNodes as $child) { if ($child->nodeType != XML_ELEMENT_NODE) { continue; } $uuidAttr = $child->getAttribute("uuidAttr") or "name"; $this->mergeNodes($manifestDoc, $child->nodeName, $uuidAttr, $child->childNodes, true); } // Reload plugin XPath $plugin->reloadXPath(); }