Example #1
0
error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
$app->initialise();
//disable buffer:
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
define('JPATH_COMPONENT', JPATH_SITE . DS . 'components' . DS . 'com_onepage');
require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'compatibility.php';
JRequest::setVar('view', 'xmlexport');
JRequest::setVar('option', 'com_onepage');
JRequest::setVar('format', 'opchtml');
JRequest::setVar('tmpl', 'component');
JRequest::setVar('template', 'system');
//ini_set('memory_limit','256Mb');
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'xmlexport.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'controllers' . DS . 'xmlexport.php';
$livesite = OPCconfig::getValue('xmlexport_config', 'xml_live_site', 0, '');
$livesite = substr($livesite, strpos($livesite, '//') + 2, -1);
$_SERVER['HTTP_HOST'] = $livesite;
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'xmlexport.php';
$VirtueMartControllerXmlexport = new VirtueMartControllerXmlexport();
$VirtueMartControllerXmlexport->createXml();
echo "\n";
$app->close();
die(0);
Example #2
0
 function xmlexportData()
 {
     $entity = JRequest::getVar('entity', '');
     $ref_id = JRequest::getVar('asset', 'virtuemart_category_id');
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $entity = JFile::makeSafe($entity);
     $cache_dir = JPATH_CACHE . DS . 'com_onepage' . DS;
     $cache_file = $cache_dir . 'xmlcache_' . $entity . '.php';
     if (!file_exists($cache_dir)) {
         JFolder::create($cache_dir);
     }
     if (file_exists($cache_file)) {
         include $cache_file;
         if (isset($return)) {
             return $return;
         }
     }
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'controllers' . DS . 'xmlexport.php';
     $xc = new VirtueMartControllerXmlexport();
     $class = $xc->createXml($entity);
     if (empty($class)) {
         return;
     }
     if (method_exists($class, 'getPairingUrl')) {
         $url = $class->getPairingUrl();
     } else {
         if (isset($class->xml->category_pairing_url)) {
             $url = (string) $class->xml->category_pairing_url;
         } else {
             return;
         }
     }
     if (method_exists($class, 'getPairingName')) {
         $name = $class->getPairingName();
     } else {
         if (isset($class->xml->category_pairing_name)) {
             $name = (string) $class->xml->category_pairing_name;
         } else {
             $name = $entity;
         }
     }
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'loader.php';
     $res = OPCloader::fetchUrl($url);
     if (empty($res)) {
         return;
     }
     $converted = array();
     if (method_exists($class, 'processPairingData')) {
         $data = $class->processPairingData($res, $converted);
     } else {
         return;
     }
     if (empty($converted)) {
         foreach ($data->children as $topcat) {
             $converted[$topcat->id] = $topcat->txt;
             if (!empty($topcat->children)) {
                 $this->recurseCat($topcat->children, $converted[$topcat->id], $converted);
             }
         }
     }
     $data = '<?php defined( \'_JEXEC\' ) or die( \'Restricted access\' );' . "\n";
     $data .= ' $return = ' . var_export($converted, true);
     $data .= '; ' . "\n";
     JFile::write($cache_file, $data);
     return $converted;
 }