<?php
 class vB_Xml_Export_Route extends vB_Xml_Export { public function getXml(?vB_XML_Builder &$xml = null) { if (empty($xml)) { $xml = new vB_XML_Builder(); $returnString = true; } else { $returnString = false; } $xml->add_group('routes'); $routeTable = $this->db->fetchTableStructure('routenew'); $routeTableColumns = array_diff($routeTable['structure'], ['guid', 'contentid', $routeTable['key']]); $routes = $this->db->assertQuery('routenew', ['product' => $this->productid]); if (!empty($routes)) { foreach ($routes AS $route) { $routeClass = (!empty($route['class']) AND class_exists($route['class'])) ? $route['class'] : vB5_Route::DEFAULT_CLASS; $isempty = (trim($route['arguments']) == ''); if($isempty) { $arguments = []; } else { $arguments = vb_unserialize($route['arguments']); if($arguments === false) { $arguments = []; } } $newarguments = [$routeClass, 'exportArguments']($arguments); if(!$isempty OR count($newarguments)) { $route['arguments'] = serialize($newarguments); } $xml->add_group('route', ['guid' => $route['guid']]); foreach ($routeTableColumns AS $column) { if ($route[$column] != NULL) { $xml->add_tag($column, $route[$column]); } } $xml->close_group(); } } $xml->close_group(); if ($returnString) { return $xml->fetch_xml(); } } } 