/** * @param stdClass $queryParameters * @param $id * @return mixed */ public function getOrderProducts(stdClass $queryParameters, $id) { if (!$id || !is_numeric($id)) { header('HTTP/1.0 404 Not Found'); return false; } $query = $this->config->getOrderProducts($id); $article = array(); $i = 0; while ($row = tep_db_fetch_array($query)) { $arrayAttr = $this->config->getAttributesOrder($id, $row['orders_products_id']); $article[$i]['ModelOwn'] = $row['products_id']; foreach ($arrayAttr as $key) { $article[$i]['ModelOwn'] .= '_' . $key; } $article[$i]['Quantity'] = $row['products_quantity']; $article[$i]['BasePrice'] = round($row['products_price'] * $row['currency_value'], 2); $article[$i]['Currency'] = $row['currency']; $i++; } return $article; }
function __construct($config = null) { if ($config != null) { parent::__construct($config); } }
<?php require "includes/configure.php"; require DIR_WS_INCLUDES . "application_top.php"; require DIR_WS_INCLUDES . "template_top.php"; $dataFeedPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "datafeed" . DIRECTORY_SEPARATOR; require $dataFeedPath . "datafeed.php"; $dataFeedConfig = new DataFeed(); $data = $dataFeedConfig->getData(); $zones = $dataFeedConfig->getZones(); $zoneId = $dataFeedConfig->getZoneId(); $dataFeedConfig->getOptionsForForm($_SESSION['languages_id']); $dataFeedConfig->initCountries(); $dataFeedConfig->initTablesColumns(); $dataFeedConfig->initShipping(); $dataFeedConfig->initZones(); $dataFeedConfig->defaultValues['condition'] = array(CONDITION_NEW => CONDITION_NEW, CONDITION_USED => CONDITION_USED); $dataFeedConfig->defaultValues['ModelOwn'] = $dataFeedConfig->pluginFields; if (isset($_GET['action']) && $_GET['action'] == 'saveForm') { $data = $_POST; $dataFeedConfig->setData($data); $zoneId = $dataFeedConfig->getZoneId(); $dataFeedConfig->remove(); $dataFeedConfig->install(); $sPath = $dataFeedPath . "sdk" . DIRECTORY_SEPARATOR . "feed.php"; if (!file_exists($sPath)) { echo "<p>SDK NOT FOUND</p>"; return false; } require_once $sPath; $sPluginName = "osdatafeed";
/** * Constructor sets configuration and instantiates HttpSocket * * @param array config Optional. * @see http://www.vimeo.com/api/docs/simple-api */ function __construct($config = null) { parent::__construct($config); $this->Http =& new HttpSocket(); }
function GetPage($settings) { $page = null; switch ($settings['filename']) { case 'robots.txt': // robots $page = new Page($settings['keyword'], true); $page->content = "Sitemap: sitemap.xml"; break; case 'sitemap.xml': $loc = ''; $page = new Page($settings['keyword'], true); foreach (glob('data/content/*', GLOB_NOSORT) as $filename) { // ... $p = Page::GetCache(base64_decode(str_replace('data/content/', '', $filename))); $loc .= sprintf('<loc><url>%s%s</url></loc>', OpenBHConf::get('domain'), $p->filename); } $page->content = sprintf(' <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> %s </urlset>', $loc); break; case 'rss': $rss = ''; $time = array(); $page = new Page($settings['keyword'], true); foreach (glob('data/content/*') as $filename) { $time[$filename] = filemtime($filename); } if (count($time) == 0) { break; } arsort($time); $newest = array_slice($time, 0, 10); foreach ($newest as $key => $val) { $p = Page::GetCache(base64_decode(str_replace('data/content/', '', $key))); $rss .= sprintf('<item> <title>%s</title> <link>%s%s</link> <description>%s</description> <author>admin</author> <pubDate>%s</pubDate> </item>', $p->keyword, OpenBHConf::get('domain'), $p->filename, $p->h1, date("F d Y H:i:s.", $val)); } $page->content = sprintf(' <?xml version="1.0" encoding="ISO-8859-1"?> <rss version="2.0"> <channel> <title>%s</title> <description>%s</description> <link>%s</link> <lastBuildDate></lastBuildDate> <generator>RSS</generator> %s </channel> </rss>', '', '', OpenBHConf::get('domain'), $rss); break; case 'index': // homepage - bloglike $pages = array(); $df = new DataFeed(); foreach ($df->ReturnFirstKeywords(OpenBHConf::get('startpage')) as $kw) { // check if we already cached this page otherwise open dummy for filename $page = null; $page = Page::GetCache($kw); if ($page == null) { $page = new Page($kw, false, null, true); // create empty page .. will generate filename } array_push($pages, $page); } // first hit ? if (empty($pages[0]->content)) { $datafeed = new DataFeed(); $pages[0]->advertisment = $datafeed->ParseFeed($pages[0]->keyword); $pages[0]->Init(); // this page isnt built yet because its only a skeleton holding the fake filename for navigation use } $pages[0]->SkinIndex($pages); $page = $pages[0]; break; default: $page = null; // is this page already built/cached ? if (!empty($settings['keyword'])) { $page = Page::GetCache($settings['keyword']); } else { // no keyword no page $page = new Page('', true); $page->responsecode = 404; $page->content = OpenBHConf::get('404'); break; } if ($page == null) { // check datafeed $datafeed = new DataFeed(); $feedData = $datafeed->ParseFeed($settings['keyword']); if (!is_array($feedData)) { $page = new Page('', true); $page->responsecode = 404; $page->content = OpenBHConf::get('404'); break; } // build page $page = new Page($settings['keyword'], false, $feedData); /* we could do cloaking here this way ;) - this only works for datafeeds including an url */ if (array_key_exists('url', $feedData) && OpenBHConf::get('cloak') == true) { $cloak = new Cloaker($_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_REFERER']); if ($cloak->IsBot() == false) { $page->responsecode = 301; $page->redirlink = $feedData['url']; } } } // only a skeleton ? if (empty($page->content)) { $datafeed = new DataFeed(); $page->advertisment = $datafeed->ParseFeed($settings['keyword']); $page->Init(); // this page isnt built yet because its only a skeleton holding the fake filename for navigation use } break; } return $page; }
private function BuildNav() { /* !!! */ $datafeed = new DataFeed(); $filenames = array(); $keywords = $datafeed->ReturnRandomEntries(rand(OpenBHConf::get('navlinks_min'), OpenBHConf::get('navlinks_max'))); foreach ($keywords as $keyword) { if ($keyword == '') { continue; } /* we need to check if we already generated this page (because of the randomized filename..) */ $tmpPage = Page::GetCache($keyword); if (is_null($tmpPage)) { /* we didnt already created it we need to assign a random filename now !! and store it as empty page..) */ $p = new Page($keyword, false, null, true); // create empty page .. will generate filename array_push($filenames, array('kw' => $keyword, 'filename' => $p->filename)); $p = null; continue; } array_push($filenames, array('kw' => $keyword, 'filename' => $tmpPage->filename)); } $this->navlinks = $filenames; $this->last_kw = $datafeed->ReturnPrevKw($this->keyword); $prevPage = Page::GetCache($this->last_kw); if (is_null($prevPage)) { $prevPage = new Page($this->last_kw, false, null, true); $this->last = $prevPage->filename; } else { $this->last = $prevPage->filename; } $this->next_kw = $datafeed->ReturnNextKw($this->keyword); $nextPage = Page::GetCache($this->next_kw); if (is_null($nextPage)) { $nextPage = new Page($this->next_kw, false, null, true); $this->next = $nextPage->filename; } else { $this->next = $nextPage->filename; } }
<?php require_once DIR_FS_CATALOG . "datafeed/datafeed.php"; require_once DIR_FS_CATALOG . "includes/classes/order.php"; $config = new DataFeed(); if ($config->getTrackpixel() == null) { exit; } $orderId = $orders['orders_id']; $order = new order($orderId); $pluginConfig = new DataFeed(); $order_string = ''; $lang = $_SESSION['languages_id']; foreach ($order as $key => $row) { switch ($key) { case 'info': $orderSum = substr($row['total'], 1); $orderCurrency = $row['currency']; break; case 'products': foreach ($row as $index => $rowProduct) { $modelOwn = $rowProduct['id']; $arrayAttr = $pluginConfig->getAttributesOrder($orderId, $rowProduct['id']); foreach ($arrayAttr as $value) { $modelOwn .= "_" . $value; } $products_id = $pluginConfig->getTrackableID($modelOwn, $lang, $orderCurrency); $order_string .= $products_id . '=' . $rowProduct['final_price'] . '=' . $rowProduct['qty'] . ';'; } break; }