예제 #1
0
 public function getXml(vB_XML_Builder &$xml = NULL)
 {
     if (empty($xml)) {
         $xml = new vB_XML_Builder();
         $returnString = TRUE;
     } else {
         $returnString = FALSE;
     }
     $xml->add_group('pages');
     $pageTable = $this->db->fetchTableStructure('page');
     $pageTableColumns = array_diff($pageTable['structure'], array('guid', 'routeid', 'pagetemplateid', 'parentid', $pageTable['key']));
     $pages = $this->db->assertQuery('getPageInfoExport', array('productid' => $this->productid));
     if (!empty($pages)) {
         foreach ($pages as $page) {
             $xml->add_group('page', array('guid' => $page['guid']));
             foreach ($pageTableColumns as $column) {
                 if ($page[$column] != NULL) {
                     $xml->add_tag($column, $page[$column]);
                 }
             }
             $xml->add_tag('parentGuid', $page['parentGuid']);
             $xml->add_tag('pageTemplateGuid', $page['pageTemplateGuid']);
             $xml->add_tag('routeGuid', $page['routeGuid']);
             $xml->close_group();
         }
     }
     $xml->close_group();
     if ($returnString) {
         return $xml->fetch_xml();
     }
 }
예제 #2
0
 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'], array('guid', 'contentid', $routeTable['key']));
     $routes = $this->db->assertQuery('routenew', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::CONDITIONS_KEY => array('product' => $this->productid)));
     if (!empty($routes)) {
         foreach ($routes as $route) {
             $routeClass = (isset($route['class']) and !empty($route['class']) and class_exists($route['class'])) ? $route['class'] : vB5_Route::DEFAULT_CLASS;
             $route['arguments'] = call_user_func(array($routeClass, 'exportArguments'), $route['arguments']);
             $xml->add_group('route', array('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();
     }
 }
예제 #3
0
 protected function buildOutputFromItems($items, $options)
 {
     $xml = new vB_XML_Builder();
     $xml->add_group('source');
     $xml->add_tag('url', vB::getDatastore()->getOption('frontendurl') . '/');
     $items = $this->formatItems($items, $options);
     foreach ($items as $id => $item) {
         $item = $item['content'];
         $xml->add_group('thread', array('id' => $item['external_nodeid']));
         $xml->add_tag('title', $item['external_prefix_plain'] . vB_String::unHtmlSpecialChars($item['external_title']));
         $xml->add_tag('author', vB_String::unHtmlSpecialChars($item['authorname']));
         $xml->add_tag('date', $this->callvBDate(vB::getDatastore()->getOption('dateformat'), $item['publishdate']));
         $xml->add_tag('time', $this->callvBDate(vB::getDatastore()->getOption('timeformat'), $item['publishdate']));
         $xml->close_group('thread');
     }
     $xml->close_group('source');
     return $xml->fetch_xml();
 }
예제 #4
0
 public function getXml(vB_XML_Builder &$xml = NULL)
 {
     if (empty($xml)) {
         $xml = new vB_XML_Builder();
         $returnString = TRUE;
     } else {
         $returnString = FALSE;
     }
     $xml->add_group('channels');
     $channelTable = $this->db->fetchTableStructure('vbforum:channel');
     $channelTableColumns = array_diff($channelTable['structure'], array('guid', $channelTable['key']));
     $nodeTable = $this->db->fetchTableStructure('vbforum:node');
     $nodeTableColumns = array_diff($nodeTable['structure'], array($nodeTable['key']), $this->nonExportableFields);
     $channels = $this->db->assertQuery('vbforum:getChannelInfoExport', array('productid' => $this->productid));
     if (!empty($channels)) {
         foreach ($channels as $channel) {
             $xml->add_group('channel', array('guid' => $channel['guid']));
             foreach ($channelTableColumns as $column) {
                 if ($channel[$column] != NULL) {
                     $xml->add_tag($column, $channel[$column]);
                 }
             }
             $xml->add_group('node');
             foreach ($nodeTableColumns as $column) {
                 if ($channel[$column] != NULL) {
                     $xml->add_tag($column, $channel[$column]);
                 }
             }
             $xml->add_tag('routeguid', $channel['routeguid']);
             $xml->add_tag('parentguid', $channel['parentguid']);
             $xml->close_group();
             $xml->close_group();
         }
     }
     $xml->close_group();
     if ($returnString) {
         return $xml->fetch_xml();
     }
 }
예제 #5
0
 public function getXml(vB_XML_Builder &$xml = NULL)
 {
     if (empty($xml)) {
         $xml = new vB_XML_Builder();
         $returnString = TRUE;
     } else {
         $returnString = FALSE;
     }
     $xml->add_group('widgets');
     $widgetTable = $this->db->fetchTableStructure('widget');
     $widgetTableColumns = array_diff($widgetTable['structure'], array('guid', $widgetTable['key']));
     $widgets = $this->db->assertQuery('widget', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::CONDITIONS_KEY => array('product' => $this->productid)));
     // parent widget guid lookup table
     $widgetGuidInfo = $this->db->assertQuery('widget', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::COLUMNS_KEY => array('widgetid', 'guid')));
     $widgetIdToGuid = array();
     foreach ($widgetGuidInfo as $one) {
         $widgetIdToGuid[$one['widgetid']] = $one['guid'];
     }
     unset($widgetGuidInfo, $one);
     if (!empty($widgets)) {
         foreach ($widgets as $widget) {
             unset($widget['title']);
             $widgetInfo[$widget[$widgetTable['key']]] = $widget;
         }
         if (!empty($widgetInfo)) {
             $widgetDefinitions = $this->db->assertQuery('widgetdefinition', array('widgetid' => array_keys($widgetInfo)));
             if (!empty($widgetDefinitions)) {
                 $definitionTable = $this->db->fetchTableStructure('widgetdefinition');
                 $definitionTableColumns = array_diff($definitionTable['structure'], array('guid', $widgetTable['key'], $definitionTable['key']));
                 foreach ($widgetDefinitions as $widgetDefinition) {
                     unset($widgetDefinition['label']);
                     $widgetInfo[$widgetDefinition[$widgetTable['key']]]['definitions'][] = $widgetDefinition;
                 }
             }
             foreach ($widgetInfo as $widget) {
                 $xml->add_group('widget', array('guid' => $widget['guid']));
                 foreach ($widgetTableColumns as $column) {
                     if ($widget[$column] != NULL) {
                         // special case parentid and change it to parentguid
                         if ($column == 'parentid') {
                             if ($widget[$column] > 0 and !empty($widgetIdToGuid[$widget[$column]])) {
                                 $xml->add_tag('parentguid', $widgetIdToGuid[$widget[$column]]);
                             }
                         } else {
                             $xml->add_tag($column, $widget[$column]);
                         }
                     }
                 }
                 if (isset($widget['definitions']) and !empty($widget['definitions'])) {
                     $xml->add_group('definitions');
                     foreach ($widget['definitions'] as $definition) {
                         $xml->add_group('definition');
                         foreach ($definitionTableColumns as $column) {
                             if ($definition[$column] != NULL) {
                                 $xml->add_tag($column, $definition[$column]);
                             }
                         }
                         $xml->close_group();
                     }
                     $xml->close_group();
                 }
                 $xml->close_group();
             }
         }
     }
     $xml->close_group();
     if ($returnString) {
         return $xml->fetch_xml();
     }
 }
 protected function get_product_template_xml($templates)
 {
     uksort($templates, "strnatcasecmp");
     $xml = new vB_XML_Builder(null, 'ISO-8859-1');
     $xml->add_group('temp');
     $xml->add_group('templates');
     foreach ($templates as $name => $template) {
         $xml->add_tag('template', $template['value'], array('name' => htmlspecialchars($name), 'templatetype' => 'template', 'date' => $template['lastupdated'], 'username' => $template['username'], 'version' => htmlspecialchars_uni($template['version'])), true);
     }
     $xml->close_group();
     $xml->close_group();
     $text = $xml->fetch_xml();
     unset($xml);
     return substr($text, strpos($text, '<temp>') + strlen("<temp>"), -1 * strlen('</temp>\\n'));
 }
예제 #7
0
 public function getXml(vB_XML_Builder &$xml = NULL)
 {
     if (empty($xml)) {
         $xml = new vB_XML_Builder();
         $returnString = TRUE;
     } else {
         $returnString = FALSE;
     }
     $xml->add_group('pagetemplates');
     $pageTemplateTable = $this->db->fetchTableStructure('pagetemplate');
     $pageTemplateTableColumns = array_diff($pageTemplateTable['structure'], array('guid', $pageTemplateTable['key']));
     $widgetInstanceTable = $this->db->fetchTableStructure('widgetinstance');
     $widgetInstanceTableColumns = array_diff($widgetInstanceTable['structure'], array('guid', 'widgetid', 'pagetemplateid', $widgetInstanceTable['key']));
     $pageTemplates = $this->db->assertQuery('pagetemplate', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::CONDITIONS_KEY => array('product' => $this->productid)));
     if (!empty($pageTemplates)) {
         foreach ($pageTemplates as $pageTemplate) {
             $info[$pageTemplate[$pageTemplateTable['key']]] = $pageTemplate;
         }
         if (!empty($info)) {
             // fetch widget instances
             $widgetsInfo = array();
             $widgetInstances = $this->db->getRows('widgetinstance', array('pagetemplateid' => array_keys($info)));
             foreach ($widgetInstances as $widgetInstance) {
                 $info[$widgetInstance['pagetemplateid']]['widgets'][$widgetInstance['widgetinstanceid']] = $widgetInstance;
                 $widgetsInfo[$widgetInstance['widgetid']] = '';
             }
             // fetch widget titles
             if (!empty($widgetsInfo)) {
                 $widgets = $this->db->getRows('widget', array('widgetid' => array_keys($widgetsInfo)));
                 foreach ($widgets as $widget) {
                     $widgetsInfo[$widget['widgetid']] = $widget['guid'];
                 }
             }
             // create XML
             foreach ($info as $pageTemplate) {
                 $xml->add_group('pagetemplate', array('guid' => $pageTemplate['guid']));
                 // adding pagetemplate elements
                 foreach ($pageTemplateTableColumns as $column) {
                     if ($pageTemplate[$column] != NULL) {
                         $xml->add_tag($column, $pageTemplate[$column]);
                     }
                 }
                 // adding widgetinstances
                 if (isset($pageTemplate['widgets']) and !empty($pageTemplate['widgets'])) {
                     $xml->add_group('widgets');
                     foreach ($pageTemplate['widgets'] as $widgetInstance) {
                         $xml->add_group('widgetinstance');
                         foreach ($widgetInstanceTableColumns as $column) {
                             $xml->add_tag($column, $widgetInstance[$column]);
                         }
                         // add widget title
                         $xml->add_tag('widgetguid', $widgetsInfo[$widgetInstance['widgetid']]);
                         $xml->close_group();
                     }
                     $xml->close_group();
                 }
                 $xml->close_group();
             }
         }
     }
     $xml->close_group();
     if ($returnString) {
         return $xml->fetch_xml();
     }
 }
예제 #8
0
 protected function getCartXml($hash, $cost, $currency, $subinfo)
 {
     $phrases = array('sub' . $subinfo['subscriptionid'] . '_title', 'sub' . $subinfo['subscriptionid'] . '_desc');
     $vbphrase = vB_Api::instanceInternal('phrase')->fetch($phrases);
     $xml = new vB_XML_Builder();
     $xml->add_group('checkout-shopping-cart', array('xmlns' => 'http://checkout.google.com/schema/2'));
     $xml->add_group('shopping-cart');
     $xml->add_group('items');
     $xml->add_group('item');
     $xml->add_tag('merchant-item-id', $hash);
     $xml->add_tag('item-name', $vbphrase['sub' . $subinfo['subscriptionid'] . '_title']);
     $xml->add_tag('item-description', $vbphrase['sub' . $subinfo['subscriptionid'] . '_desc']);
     if (!$subinfo['newoptions']['api']['google']['tax']) {
         $xml->add_tag('tax-table-selector', 'tax_exempt');
     }
     $xml->add_tag('unit-price', $cost, array('currency' => strtoupper($currency)));
     $xml->add_tag('quantity', 1);
     $xml->add_group('digital-content');
     $xml->add_tag('display-disposition', 'PESSIMISTIC');
     $xml->add_tag('description', $subinfo['newoptions']['api']['google']['message']);
     $xml->close_group('digital-content');
     $xml->close_group('item');
     $xml->close_group('items');
     $xml->close_group('shopping-cart');
     $xml->close_group('checkout-shopping-cart');
     return $xml->fetch_xml();
 }