@@ -21,45 +21,44 @@
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
class tx_fbmagento_cache {



/**
* Cache Handler
*
* @var ArrayObject
*/
protected $_handler = null;
protected $_handler = null;

/**
* Singleton instance
*
* @var tx_fbmagento_cache
*/
protected static $_instance = null;
/**
* Setter/Getter underscore transformation cache
*
* @var array
*/
protected static $_underscoreCache = array();

/**
* Setter/Getter underscore transformation cache
*
* @var array
*/
protected static $_underscoreCache = array();

/**
* Singleton pattern implementation makes "new" unavailable
*
* @return void
*/
private function __construct() {
}

/**
* Singleton pattern implementation makes "clone" unavailable
*
* @return void
*/
private function __clone() {
}

/**
* Returns an instance of tx_fbmagento_cache
*
@@ -71,10 +70,10 @@ private function __clone() {
*/
public static function getInstance($type) {
if (null === self::$_instance) {
self::$_instance = new self ( );
self::$_instance->init ( $type );
self::$_instance = new self();
self::$_instance->init($type);
}

return self::$_instance;
}

@@ -84,18 +83,16 @@ public static function getInstance($type) {
* @param string $type
*/
protected function init($type) {

switch ($type) {

case "memory":
case 'memory':
$config = tx_fbmagento_tools::getExtConfig();
require_once ($config['path'] . 'lib/Zend/Registry.php');
require_once($config['path'] . 'lib/Zend/Registry.php');
$this->_handler = Zend_Registry::getInstance();
break;

}
}
}

/**
* return Handler
*
@@ -104,100 +101,100 @@ protected function init($type) {
private function getHandler(){
return $this->_handler;
}

/**
* Set/Get attribute wrapper
*
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, $args)
{
switch (substr($method, 0, 3)) {
case 'get' :
$key = $this->_underscore(substr($method,3));
return $this->getData($key);

case 'set' :
$key = $this->_underscore(substr($method,3));
return $this->setData($key, $args[0]);

case 'uns' :
$key = $this->_underscore(substr($method,3));
return $this->unsData($key);

case 'has' :
$key = $this->_underscore(substr($method,3));
return $this->hasData($key);
}

tx_fbmagento_tools::throwException("Invalid method ".get_class($this)."::".$method."(".print_r($args,1).")");
}

/**
* get Data
*
* @param string $key
* @return unknown
*/
public function getData($key){
return $this->getHandler()->{$key};
}

/**
* set Data
*
* @param string $key
* @param unknown_type $value
* @return unknown
*/
public function setData($key, $value){
return $this->getHandler()->{$key} = isset($value) ? $value : null;
}

/**
* isset Data
*
* @param string $key
* @return unknown
*/
public function hasData($key){
return isset($this->getHandler()->{$key});
}

/**
* unset Data
*
* @param string $key
* @return unknown
*/
public function unsData($key){
unset($this->getHandler()->{$key});
return true;
}

/**
* Converts field names for setters and geters
* Uses cache to eliminate unneccessary preg_replace
*
* @param string $name
* @return string
*/
protected function _underscore($name)
{
if (isset(self::$_underscoreCache[$name])) {
return self::$_underscoreCache[$name];
}

$result = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $name));
self::$_underscoreCache[$name] = $result;
return $result;
}


/**
* Set/Get attribute wrapper
*
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, $args) {
switch (substr($method, 0, 3)) {
case 'get' :
$key = $this->_underscore(substr($method,3));
return $this->getData($key);

case 'set' :
$key = $this->_underscore(substr($method,3));
return $this->setData($key, $args[0]);

case 'uns' :
$key = $this->_underscore(substr($method,3));
return $this->unsData($key);

case 'has' :
$key = $this->_underscore(substr($method,3));
return $this->hasData($key);
}

tx_fbmagento_tools::throwException("Invalid method " . get_class($this) . "::" . $method . "(" . print_r($args, 1) . ")");
}

/**
* get Data
*
* @param string $key
* @return unknown
*/
public function getData($key) {
return $this->getHandler()->{$key};
}

/**
* set Data
*
* @param string $key
* @param unknown_type $value
* @return unknown
*/
public function setData($key, $value) {
return $this->getHandler()->{$key} = isset($value) ? $value : null;
}

/**
* isset Data
*
* @param string $key
* @return unknown
*/
public function hasData($key) {
return isset($this->getHandler()->{$key});
}

/**
* unset Data
*
* @param string $key
* @return unknown
*/
public function unsData($key) {
unset($this->getHandler()->{$key});

return true;
}

/**
* Converts field names for setters and geters
* Uses cache to eliminate unneccessary preg_replace
*
* @param string $name
* @return string
*/
protected function _underscore($name) {
if (isset(self::$_underscoreCache[$name])) {
return self::$_underscoreCache[$name];
}

$result = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $name));
self::$_underscoreCache[$name] = $result;
return $result;
}

}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_cache.php']) {
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_cache.php']);
}

?>
@@ -13,40 +13,42 @@
* */

require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_tools.php');
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_interface.php');#
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_interface.php');

/**
* TypoGento hookobserver
*
* @version $Id: class.tx_fbmagento_interface.php 25 2009-01-21 16:43:16Z vinai $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
class tx_fbmagento_hookobserver {

/**
* logoff Hook
*
* @param array $params
* @param t3lib_userAuth $pObj
*/
public function logoff($params, &$pObj){
if(t3lib_div::GPvar('logintype') != 'logout'

if (t3lib_div::GPvar('logintype') != 'logout'
or $pObj->loginType != 'FE'){

return;
}

// get Extension Config
$this->emConf = tx_fbmagento_tools::getExtConfig();
// get an Magento Instance
$this->mage = tx_fbmagento_interface::getInstance( $this->emConf );

// get some Magento Instance
$this->mage = tx_fbmagento_interface::getInstance( $this->emConf );
$this->mage->connector->logout();

}

}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_hookobserver.php']) {
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_hookobserver.php']);
}

?>

Large diffs are not rendered by default.

@@ -12,65 +12,61 @@
* Public License for more details. *
* */

require_once (t3lib_extmgm::extPath ( 'fb_magento' ) . 'lib/class.tx_fbmagento_tools.php');
require_once (t3lib_extmgm::extPath ( 'fb_magento' ) . 'lib/class.tx_fbmagento_interface.php');

/**
* TypoGento navigation
*
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
require_once (t3lib_extmgm::extPath ( 'fb_magento' ) . 'lib/class.tx_fbmagento_tools.php');
require_once (t3lib_extmgm::extPath ( 'fb_magento' ) . 'lib/class.tx_fbmagento_interface.php');

class user_tx_fbmagento_navigation extends tx_fbmagento_navigation {

}

class tx_fbmagento_navigation {

protected $_categoryTree = array();

protected $_get = null;



public function __construct() {
if (! is_array($this->_get)) {
if(!is_array($this->_get)) {
$this->_get = t3lib_div :: _GET('tx_fbmagento');
}
}



/**
* Enter description here...
* Returns current Category if available
*
* @return Mage_Catalog_Model_Category
*/
public function getCurrentCategory() {
if (Mage::getSingleton ( 'catalog/layer' )) {
return Mage::getSingleton ( 'catalog/layer' )->getCurrentCategory ();
if (Mage::getSingleton('catalog/layer')) {
return Mage::getSingleton('catalog/layer')->getCurrentCategory();
}
return false;
}

/**
* Checkin activity of category
* Checking activity of category
*
* @param Varien_Object $category
* @return bool
* @param Varien_Object $category
* @return boolean
*/
public function isCategoryActive($category) {
if ($this->getCurrentCategory ()) {
return in_array ( $category->getId (), $this->getCurrentCategory ()->getPathIds () );
if ($this->getCurrentCategory()) {
return in_array($category->getId(), $this->getCurrentCategory()->getPathIds());
}
return false;
}

protected function _getCategoryInstance() {
if (is_null ( $this->_categoryInstance )) {
$this->_categoryInstance = Mage::getModel ( 'catalog/category' );
if (is_null($this->_categoryInstance)) {
$this->_categoryInstance = Mage::getModel('catalog/category');
}
return $this->_categoryInstance;
}

/**
* Get url for category data
*
@@ -79,29 +75,29 @@ protected function _getCategoryInstance() {
*/
public function getCategoryUrl($category) {
if ($category instanceof Mage_Catalog_Model_Category) {
$url = $category->getUrl ();
$url = $category->getUrl();
} else {
$url = $this->_getCategoryInstance ()->setData ( $category->getData () )->getUrl ();
$url = $this->_getCategoryInstance()->setData($category->getData())->getUrl();
}
return $url;
}

/**
* Function clears all subelements. This is needed for clear error with mix up pages and categories
*
* @param array $menuArr: Array with menu item
* @param array $conf: TSconfig, not used
* @return array return the cleaned menu item
* @param array $menuArr: Array with menu item
* @param array $conf: TSconfig, not used
* @return array return the cleaned menu item
*/
function clear($menuArr, $conf) {
while ( list ( , $item ) = each ( $menuArr ) ) {
if ($item ['DO_NOT_RENDER'] == '1') {
$menuArr = array ();
while (list(, $item) = each($menuArr)) {
if ($item['DO_NOT_RENDER'] == '1') {
$menuArr = array();
}
}
return $menuArr;
}

/**
* creates HMENU Items Array
*
@@ -112,46 +108,45 @@ function clear($menuArr, $conf) {
*/
protected function createMenuArrayItem($category, $level = 0, $last = false, $parent = null) {
$menuArray = array ();
if (! $category->getIsActive ()) {

if (!$category->getIsActive()) {
return;
}
$children = $category->getChildren ();
$hasChildren = $children && $children->count ();
$menuArray ['title'] = $category->getName ();

$children = $category->getChildren();
$hasChildren = $children && $children->count();

$menuArray['title'] = $category->getName();

$params = array(
'id' => $category->getId(),
'route' => 'catalog',
'controller' => 'category',
'action' =>'view'
);
$menuArray ['_OVERRIDE_HREF'] = $GLOBALS['TSFE']->cObj->getTypoLink_URL($this->conf['pid'], array('tx_fbmagento' => array('shop' => $params)));;
if($category->getAct ()) {
$menuArray ['ITEM_STATE'] = 'ACT';

$menuArray['_OVERRIDE_HREF'] = $GLOBALS['TSFE']->cObj->getTypoLink_URL($this->conf['pid'], array('tx_fbmagento' => array('shop' => $params)));;

if ($category->getAct()) {
$menuArray['ITEM_STATE'] = 'ACT';

if ($hasChildren) {
$j = 0;
foreach ( $children as $child ) {
if ($child->getIsActive ()) {
$menuArray ['_SUB_MENU'] [] = $this->createMenuArrayItem ( $child, $level + 1, ++ $j >= 0 );
foreach ($children as $child) {
if ($child->getIsActive()) {
$menuArray['_SUB_MENU'][] = $this->createMenuArrayItem($child, $level + 1, ++ $j >= 0);
}
}
}
else {
$menuArray ['_SUB_MENU'] [] = array ('DO_NOT_RENDER' => 1 );
} else {
$menuArray ['_SUB_MENU'][] = array ('DO_NOT_RENDER' => 1);
}
} else {
$menuArray ['_SUB_MENU'] [] = array ('DO_NOT_RENDER' => 1 );
$menuArray['_SUB_MENU'][] = array('DO_NOT_RENDER' => 1);
}

return $menuArray;
}

/**
* generates HMENU Array
*
@@ -160,85 +155,88 @@ protected function createMenuArrayItem($category, $level = 0, $last = false, $pa
* @return array
*/
public function categories($content, $conf) {
$this->emConf = tx_fbmagento_tools::getExtConfig ();

$this->emConf = tx_fbmagento_tools::getExtConfig();
$this->conf = $conf;
$mage = tx_fbmagento_interface::getInstance ( $this->emConf );
$categories = $this->getStoreCategories ($this->conf['startcategory']);
$menu = array ();
foreach ( $categories as $category ) {
$item = $this->createMenuArrayItem ( $category );
if (! $item)
$mage = tx_fbmagento_interface::getInstance($this->emConf);

$categories = $this->getStoreCategories($this->conf['startcategory']);

$menu = array();
foreach ($categories as $category) {
$item = $this->createMenuArrayItem($category);
if (!$item) {
continue;
$menu [] = $item;
}

$menu[] = $item;
}

return $menu;

}


/**
* Retrieve current store categories
*
* @param boolean|string $sorted
* @param boolean $asCollection
* @return Varien_Data_Tree_Node_Collection|Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection|array
*/
public function getStoreCategories($parent=null)
{
if(!$parent) $parent = Mage::app()->getStore()->getRootCategoryId();
/**
* Check if parent node of the store still exists
*/
$category = Mage::getModel('catalog/category');
/* @var $category Mage_Catalog_Model_Category */
if (!$category->checkId($parent)) {
return array();
}

$recursionLevel = max(0, (int) Mage::app()->getStore()->getConfig('catalog/navigation/max_depth'));

$tree = $category->getTreeModel();
/* @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */

$nodes = $tree->loadNode($parent)
->loadChildren($recursionLevel)
->getChildren();

$tree->addCollectionData(null, false, $parent, true, true);

$this->_parseNodes($nodes);
return $nodes;
}


/**
* Simple parse function that is thought for menu status changes
*
* @param array $nodes array with all menu item nodes
* @return boolean True if current category is active
*/
protected function _parseNodes($nodes) {
foreach($nodes as $node) {
if(isset($this->_get['shop']['category'])){
if ($node->getId() == intval($this->_get['shop']['category']) || ($node->getChildren() && $this->_parseNodes($node->getChildren()))) {
$node->setAct(true);
return true;
}
}else{
if ($node->getId() == intval($this->_get['shop']['id']) || ($node->getChildren() && $this->_parseNodes($node->getChildren()))) {
$node->setAct(true);
return true;
}
}
}
}

/**
* Retrieve current store categories
*
* @param boolean|string $sorted
* @param boolean $asCollection
* @return Varien_Data_Tree_Node_Collection|Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection|array
*/
public function getStoreCategories($parent=null) {
if (!$parent) {
$parent = Mage::app()->getStore()->getRootCategoryId();
}

// Check if parent node of the store still exists
$category = Mage::getModel('catalog/category');

/*@var $category Mage_Catalog_Model_Category*/
if (!$category->checkId($parent)) {
return array();
}

$recursionLevel = max(0, (int) Mage::app()->getStore()->getConfig('catalog/navigation/max_depth'));

$tree = $category->getTreeModel();
/*@var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree*/

$nodes = $tree->loadNode($parent)
->loadChildren($recursionLevel)
->getChildren();

$tree->addCollectionData(null, false, $parent, true, true);

$this->_parseNodes($nodes);
return $nodes;
}

/**
* Simple parse function that is thought for menu status changes
*
* @param array $nodes array with all menu item nodes
* @return boolean True if current category is active
*/
protected function _parseNodes($nodes) {
foreach($nodes as $node) {
if(isset($this->_get['shop']['category'])){
if($node->getId() == intval($this->_get['shop']['category'])
|| ($node->getChildren() && $this->_parseNodes($node->getChildren()))) {
$node->setAct(true);
return true;
}
} else {
if($node->getId() == intval($this->_get['shop']['id'])
|| ($node->getChildren() && $this->_parseNodes($node->getChildren()))) {
$node->setAct(true);
return true;
}
}
}
}
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_navigation.php']) {
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_navigation.php']);
}

?>

Large diffs are not rendered by default.

@@ -27,78 +27,78 @@ class tx_fbmagento_soapinterface {
private $urlPostfix = 'api/soap/?wsdl';
private $resource = null;
private $cache = false;

/**
* Constructor which needs Soap Connection Details
*
* @param string $url
* @param string $username
* @param string $password
*/
public function __construct($url, $username, $password){
public function __construct($url, $username, $password) {

$this->connection = new SoapClient($url.$this->urlPostfix);
$this->sessionId = $this->getClient()->login($username, $password);
}
}

/**
* Magic function which enables SOAP Calls like: resource()->action();
*
* @param string $name
* @param array $params
* @return unknown
*/
public function __call($name, $params){
if($this->resource){
public function __call($name, $params) {

if ($this->resource) {
$resource = $this->resource;
$this->resource = null;
$result = $this->call($resource.'.'.$name, $params);

return $result;
}else{
} else {
$this->resource = $name;
return $this;
}
}

/**
* enable Cache
*
* @param string $type
* @return $this
*/
public function enableCache($type = 'memory'){
public function enableCache($type = 'memory') {

$this->cache = $type;
return $this;
}

/**
* call Soap Interface
*
* @param string $resource
* @param array $params
* @return unknown
*/
public function call($resource, $params=array()){
if($this->cache){
public function call($resource, $params=array()) {

if ($this->cache) {
$cacheId = md5($resource.serialize($params));
if($this->getCache()->hasData($cacheId)){
if ($this->getCache()->hasData($cacheId)) {
return $this->getCache()->getData($cacheId);
}
}

$result = $this->getClient()->call($this->sessionId, $resource, $params);

if($this->cache){
if ($this->cache) {
$this->getCache()->setData($cacheId, $result);
}

return $result;
}

/**
* get Cachehandler
*
@@ -107,7 +107,7 @@ public function call($resource, $params=array()){
protected function getCache(){
return tx_fbmagento_cache::getInstance($this->cache);
}

/**
* get SoapCleint
*
@@ -116,9 +116,11 @@ protected function getCache(){
public function getClient(){
return $this->connection;
}

}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_soapinterface.php']) {
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_soapinterface.php']);
}
}

?>
@@ -29,21 +29,21 @@ class tx_fbmagento_tcafields {
* @param array $params
* @param object $pObj
*/
public function itemsProcFunc_products(&$params,&$pObj){
public function itemsProcFunc_products(&$params,&$pObj) {

$conf = tx_fbmagento_tools::getExtConfig();

try {

$soapClient = new tx_fbmagento_soapinterface($conf['url'], $conf['username'], $conf['password']);
$products = $soapClient->catalog_product()->list();
}catch (Exception $e){
tx_fbmagento_tools::displayError('SOAP API Error: '.$e->getMessage());
}
foreach ((array) $products as $product){
$params['items'][]=Array($product['name'].' - '.$product['sku'], $product['product_id']);

} catch (Exception $e) {
tx_fbmagento_tools::displayError('SOAP API Error: ' . $e->getMessage());
}

foreach ((array) $products as $product) {
$params['items'][]=Array($product['name'] . ' - ' . $product['sku'], $product['product_id']);
}
}

@@ -53,20 +53,20 @@ public function itemsProcFunc_products(&$params,&$pObj){
* @param array $params
* @param object $pObj
*/
public function itemsProcFunc_usergroups(&$params,&$pObj){
public function itemsProcFunc_usergroups(&$params,&$pObj) {

$conf = tx_fbmagento_tools::getExtConfig();

try {

$soapClient = new tx_fbmagento_soapinterface($conf['url'], $conf['username'], $conf['password']);
$roles = $soapClient->typo3connect_admin_roles()->list();
}catch (Exception $e){
tx_fbmagento_tools::displayError('SOAP API Error: '.$e->getMessage());
}
foreach ((array) $roles as $role){

} catch (Exception $e) {
tx_fbmagento_tools::displayError('SOAP API Error: ' . $e->getMessage());
}

foreach ((array) $roles as $role) {
$params['items'][]=Array($role['label'], $role['value']);
}
}
@@ -77,20 +77,20 @@ public function itemsProcFunc_usergroups(&$params,&$pObj){
* @param array $params
* @param object $pObj
*/
public function itemsProcFunc_feusergroups(&$params,&$pObj){
public function itemsProcFunc_feusergroups(&$params,&$pObj) {

$conf = tx_fbmagento_tools::getExtConfig();

try {

$soapClient = new tx_fbmagento_soapinterface($conf['url'], $conf['username'], $conf['password']);
$roles = $soapClient->customer_group()->list();

}catch (Exception $e){
tx_fbmagento_tools::displayError('SOAP API Error: '.$e->getMessage());
}
foreach ((array) $roles as $role){
} catch (Exception $e) {
tx_fbmagento_tools::displayError('SOAP API Error: ' . $e->getMessage());
}

foreach ((array) $roles as $role) {
$params['items'][]=Array($role['customer_group_code'], $role['customer_group_id']);
}
}
@@ -101,20 +101,20 @@ public function itemsProcFunc_feusergroups(&$params,&$pObj){
* @param array $params
* @param object $pObj
*/
public function itemsProcFunc_modules(&$params,&$pObj){
#print_r($pObj);
public function itemsProcFunc_modules(&$params,&$pObj) {

$conf = tx_fbmagento_tools::getExtConfig();

try {

$soapClient = new tx_fbmagento_soapinterface($conf['url'], $conf['username'], $conf['password']);
$modules = $soapClient->typo3connect_modules()->list();
}catch (Exception $e){
tx_fbmagento_tools::displayError('SOAP API Error: '.$e->getMessage());
}
foreach ((array) $modules as $module){

} catch (Exception $e) {
tx_fbmagento_tools::displayError('SOAP API Error: ' . $e->getMessage());
}

foreach ((array) $modules as $module) {
$params['items'][]=Array(ucfirst($module), $module);
}
}
@@ -125,24 +125,24 @@ public function itemsProcFunc_modules(&$params,&$pObj){
* @param array $params
* @param object $pObj
*/
public function itemsProcFunc_controllers(&$params,&$pObj){
public function itemsProcFunc_controllers(&$params,&$pObj) {

$module = $this->getFlexformData($pObj, 'route', 'main');
if(!$module) return;

if (!$module) return;

$conf = tx_fbmagento_tools::getExtConfig();

try {

$soapClient = new tx_fbmagento_soapinterface($conf['url'], $conf['username'], $conf['password']);
$controllers = $soapClient->typo3connect_modules()->controllers($module);

}catch (Exception $e){
tx_fbmagento_tools::displayError('SOAP API Error: '.$e->getMessage());
} catch (Exception $e) {
tx_fbmagento_tools::displayError('SOAP API Error: ' . $e->getMessage());
}
foreach ((array) $controllers as $controller){

foreach ((array) $controllers as $controller) {
$params['items'][]=Array(ucfirst($controller), $controller);
}
}
@@ -153,30 +153,30 @@ public function itemsProcFunc_controllers(&$params,&$pObj){
* @param array $params
* @param object $pObj
*/
public function itemsProcFunc_actions(&$params,&$pObj){
public function itemsProcFunc_actions(&$params,&$pObj) {

$module = $this->getFlexformData($pObj, 'route', 'main');
if(!$module) return;
if (!$module) return;

$controller = $this->getFlexformData($pObj, 'controller', 'main');
if(!$controller) return;
if (!$controller) return;

$conf = tx_fbmagento_tools::getExtConfig();

try {

$soapClient = new tx_fbmagento_soapinterface($conf['url'], $conf['username'], $conf['password']);
$actions = $soapClient->typo3connect_modules()->actions($module, $controller);

}catch (Exception $e){
tx_fbmagento_tools::displayError('SOAP API Error: '.$e->getMessage());
}
} catch (Exception $e) {
tx_fbmagento_tools::displayError('SOAP API Error: ' . $e->getMessage());
}

foreach ((array) $actions as $action){
$params['items'][]=Array($action, $action);
}
}

/**
* returns the Value of an Flexform Field from TCEforms
*
@@ -187,21 +187,20 @@ public function itemsProcFunc_actions(&$params,&$pObj){
* @param string $value
* @return unknown
*/
protected function getFlexformData(t3lib_TCEforms &$TCEforms, $fieldName, $sheet='sDEF',$lang='lDEF',$value='vDEF'){
protected function getFlexformData(t3lib_TCEforms &$TCEforms, $fieldName, $sheet='sDEF',$lang='lDEF',$value='vDEF') {

try {
$data = current($TCEforms->cachedTSconfig);
$flexform = $data['_THIS_ROW']['pi_flexform'];
$flexformArray = t3lib_div::xml2array($flexform);

return $this->getFFvalue($flexformArray, $fieldName, $sheet, $lang, $value);
}catch (Exception $e){

} catch (Exception $e) {
return null;
}
}



/**
* Return value from somewhere inside a FlexForm structure
*
@@ -212,9 +211,9 @@ protected function getFlexformData(t3lib_TCEforms &$TCEforms, $fieldName, $sheet
* @param string Value pointer, eg. "vDEF"
* @return string The content.
*/
protected function getFFvalue($T3FlexForm_array,$fieldName,$sheet='sDEF',$lang='lDEF',$value='vDEF') {
protected function getFFvalue($T3FlexForm_array,$fieldName,$sheet='sDEF',$lang='lDEF',$value='vDEF') {
$sheetArray = is_array($T3FlexForm_array) ? $T3FlexForm_array['data'][$sheet][$lang] : '';
if (is_array($sheetArray)) {
if (is_array($sheetArray)) {
return $this->getFFvalueFromSheetArray($sheetArray,explode('/',$fieldName),$value);
}
}
@@ -229,18 +228,21 @@ protected function getFFvalue($T3FlexForm_array,$fieldName,$sheet='sDEF',$lang='
* @access private
* @see pi_getFFvalue()
*/
protected function getFFvalueFromSheetArray($sheetArray,$fieldNameArr,$value) {

$tempArr=$sheetArray;
foreach($fieldNameArr as $k => $v) {
if (t3lib_div::testInt($v)) {
if (is_array($tempArr)) {
$c=0;
foreach($tempArr as $values) {
if ($c==$v) {
$tempArr=$values;
protected function getFFvalueFromSheetArray($sheetArray,$fieldNameArr,$value) {

$tempArr = $sheetArray;

foreach ($fieldNameArr as $k => $v) {
if (t3lib_div::testInt($v)) {
if (is_array($tempArr)) {
$c = 0;

foreach ($tempArr as $values) {
if ($c == $v) {
$tempArr = $values;
break;
}

$c++;
}
}
@@ -249,74 +251,73 @@ protected function getFFvalueFromSheetArray($sheetArray,$fieldNameArr,$value) {
}
}
return $tempArr[$value];
}
}

/**
* generates an Storeviewlist as Array for TCA Select fields
*
* @param array $params
* @param object $pObj
*/
public function itemsProcFunc_languages(&$params,&$pObj){
public function itemsProcFunc_languages(&$params,&$pObj) {

$conf = tx_fbmagento_tools::getExtConfig();

try {

$soapClient = new tx_fbmagento_soapinterface($conf['url'], $conf['username'], $conf['password']);
$storeviews = $soapClient->typo3connect_storeviews()->list();
}catch (Exception $e){
tx_fbmagento_tools::displayError('SOAP API Error: '.$e->getMessage());
}
foreach ((array) $storeviews as $storeview){

} catch (Exception $e) {
tx_fbmagento_tools::displayError('SOAP API Error: ' . $e->getMessage());
}

foreach ((array) $storeviews as $storeview) {
$params['items'][]=Array($storeview['label'], $storeview['value']);
}
}

}

/**
* generates an Category as Array for TCA Select fields
*
* @param array $params
* @param object $pObj
*/
public function itemsProcFunc_categories(&$params,&$pObj){
public function itemsProcFunc_categories(&$params,&$pObj) {

$conf = tx_fbmagento_tools::getExtConfig();

try {

$soapClient = new tx_fbmagento_soapinterface($conf['url'], $conf['username'], $conf['password']);
$categories = $soapClient->catalog_category()->tree();
}catch (Exception $e){
tx_fbmagento_tools::displayError('SOAP API Error: '.$e->getMessage());

} catch (Exception $e) {
tx_fbmagento_tools::displayError('SOAP API Error: ' . $e->getMessage());
}

$this->getCategoryItems($params['items'], array($categories));
}

/**
* generates an recursive list of Categories
*
* @param array $items
* @param array $categories
*/
protected function getCategoryItems(&$items, $categories){
foreach ($categories as $category){
$items[] = array(str_repeat('-',$category['level']*2).$category['name'], $category['category_id']);
if(is_array($category['children'])){
protected function getCategoryItems(&$items, $categories) {

foreach ($categories as $category) {
$items[] = array(str_repeat('-', $category['level']*2) . $category['name'], $category['category_id']);
if (is_array($category['children'])) {
$this->getCategoryItems($items, $category['children'], $category['level']);
}
}

}

}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_tcafields.php']) {
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_tcafields.php']);
}
}

?>
@@ -19,78 +19,78 @@
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
class tx_fbmagento_tools {

/**
* returns the ExtConfig as Array
*
* @return array
*/
public static function getExtConfig(){
public static function getExtConfig() {
return unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['fb_magento']);
}

/**
* throws an Exeption
*
* @param string $message
*/
public static function throwException($message){

throw new Exception($message);
}

/**
* displays an Error Message
*
* @param string $warning
* @return unknown
*/
public static function displayError($warning, $stop=true){

if(class_exists('t3lib_exception')){
throw new t3lib_exception($warning);
}

$warning = '<h3>TYPOGENTO</h3>'.$warning;

t3lib_BEfunc::typo3PrintError('', $warning, '', $stop ? 0 : 1);

if($stop) {
public static function throwException($message) {

throw new Exception($message);
}

/**
* displays an Error Message
*
* @param string $warning
* @return unknown
*/
public static function displayError($warning, $stop=true) {
if (class_exists('t3lib_exception')) {
throw new t3lib_exception($warning);
}

$warning = '<h3>TYPOGENTO</h3>' . $warning;

t3lib_BEfunc::typo3PrintError('', $warning, '', $stop ? 0 : 1);

if ($stop) {
die();
}
}
}

/**
* get Frontend Languagecode
*
* @return string
*/
public static function getFELangStoreCode(){
//$GLOBALS['TYPO3_DB']->debugOutput = true;
public static function getFELangStoreCode() {

if(empty($GLOBALS['TSFE']->config['config']['sys_language_uid'])){
if (empty($GLOBALS['TSFE']->config['config']['sys_language_uid'])) {
if ($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_fbmagento_pi1.']['storeName']) {
return $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_fbmagento_pi1.']['storeName'];
}
return 'default';
}

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_fbmagento_store', 'sys_language', sprintf('uid = %d', $GLOBALS['TSFE']->config['config']['sys_language_uid']));


$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_fbmagento_store', 'sys_language', sprintf('uid = %d', $GLOBALS['TSFE']->config['config']['sys_language_uid'])
);

$res = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
if (! ($store = $res['tx_fbmagento_store'])) {
if (!($store = $res['tx_fbmagento_store'])) {
if ($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_fbmagento_pi1.']['storeName']) {
$store = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_fbmagento_pi1.']['storeName'];
}
else {
} else {
$store = 'default';
}
}
return $store;
}

}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_tools.php']) {
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/lib/class.tx_fbmagento_tools.php']);
}
}

?>
@@ -12,15 +12,6 @@
* Public License for more details. *
* */

/**
* TYPO3 Backend Module tx_fbmagento_modadmin
*
* @version $Id: class.tx_fbmagento_pi1.php 19 2008-11-25 17:50:44Z weller $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/



unset($MCONF);
require ('conf.php');
require ($BACK_PATH.'init.php');
@@ -31,52 +22,58 @@
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_tools.php');
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_interface.php');

/**
* TYPO3 Backend Module tx_fbmagento_modadmin
*
* @version $Id: class.tx_fbmagento_pi1.php 19 2008-11-25 17:50:44Z weller $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/

class tx_fbmagento_modadmin {

/**
* Configuration for the module
* @var Array
* @var Array
*/
var $MCONF = array();

/**
* The backend document
* @var Object
* @var Object
*/
var $doc;

/**
* The main method of the Plugin
*
* @return Mixed Either returns an error or sends a redirect header
* @return Mixed Either returns an error or sends a redirect header
*/
function main() {

// Declare globals
global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;

if(empty($BE_USER->user['tx_fbmagento_group'])){
if (empty($BE_USER->user['tx_fbmagento_group'])) {
$this->accessDenied();
}

// get Extension Config
$this->emConf = tx_fbmagento_tools::getExtConfig();
// get an Magento Instance
$this->mage = tx_fbmagento_interface::getInstance( $this->emConf );

// get some Magento Instance
$this->mage = tx_fbmagento_interface::getInstance($this->emConf);

/*@var $mageUser Mage_Admin_Model_User */
$mageUser = Mage::getSingleton('admin/user');

$mageUser->loadByUsername($BE_USER->user['username']);

if($mageUser->getId()){
if($mageUser->getRole()->getId() != $BE_USER->user['tx_fbmagento_group']){


if ($mageUser->getId()) {
if ($mageUser->getRole()->getId() != $BE_USER->user['tx_fbmagento_group']) {
$this->accessDenied('different Roles are set!');
}
}else{
}
} else {

$mageUser->setData(array(
'username' => $BE_USER->user['username'],
'password' => $BE_USER->user['password'],
@@ -86,91 +83,82 @@ function main() {
'is_active' => true
));

$mageUser->save();
$mageUser->setRoleIds( array($BE_USER->user['tx_fbmagento_group']) )->setRoleUserId( $mageUser->getUserId() )->saveRelations();
$mageUser->save();
$mageUser->setRoleIds(array($BE_USER->user['tx_fbmagento_group']))->setRoleUserId($mageUser->getUserId())->saveRelations();
}



/*@var $mageSession Mage_Admin_Model_Session */
$mageSession = Mage::getSingleton('admin/session');

// login User
$this->loginMageUser($BE_USER->user['username']);
}

/**
* login Magento Backenduser
*
* @param string $username
*/
protected function loginMageUser($username){
try {
$session = Mage::getSingleton('admin/session');
if($session->isLoggedIn()){
$requestUri = Mage::getSingleton('adminhtml/url')->addSessionParam()->getUrl('adminhtml/dashboard/*', array('_current' => true));

try {

$session = Mage::getSingleton('admin/session');

if ($session->isLoggedIn()) {
$requestUri = Mage::getSingleton('adminhtml/url')->addSessionParam()->getUrl('adminhtml/dashboard/*', array('_current' => true));
header('Location: ' . $requestUri);
die();
}

/* @var $user Mage_Admin_Model_User */
$user = Mage::getModel('admin/user');
$user->loadByUsername($username);


if ($user->getId()) {

Mage::dispatchEvent('admin_user_authenticate_after', array(
'username' => $user->getUsername(),
'password' => $user->getPassword(),
'user' => $user,
'result' => true,
));

$user->getRole();
$user->getResource()->recordLogin($user);

if (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
Mage::getSingleton('adminhtml/url')->renewSecretUrls();
}

$session->setIsFirstVisit(true);
$session->setUser($user);
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());

$requestUri = Mage::getSingleton('adminhtml/url')->addSessionParam()->getUrl('adminhtml/dashboard/*', array('_current' => true));

die();
}

/* @var $user Mage_Admin_Model_User */
$user = Mage::getModel('admin/user');
$user->loadByUsername($username);

if ($user->getId()) {

Mage::dispatchEvent('admin_user_authenticate_after', array(
'username' => $user->getUsername(),
'password' => $user->getPassword(),
'user' => $user,
'result' => true,
));

$user->getRole();
$user->getResource()->recordLogin($user);

if (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
Mage::getSingleton('adminhtml/url')->renewSecretUrls();
}

$session->setIsFirstVisit(true);
$session->setUser($user);
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());

$requestUri = Mage::getSingleton('adminhtml/url')->addSessionParam()->getUrl('adminhtml/dashboard/*', array('_current' => true));

header('Location: ' . $requestUri);

}
else {
$this->accessDenied('Magento Backend Login failt!');
}
}
catch (Mage_Core_Exception $e) {
$this->accessDenied('Magento Backend Login failt!');
}


} else {
$this->accessDenied('Magento Backend Login failed!');
}
} catch (Mage_Core_Exception $e) {
$this->accessDenied('Magento Backend Login failed!');
}
}

/**
* access Denied
*
* @param string $msg
*/
public function accessDenied($msg = null){

if($msg === null){
$msg = 'Access denied!';
}

tx_fbmagento_tools::displayError($msg, true);
}


}

// Make instance:
@@ -12,23 +12,25 @@
* Public License for more details. *
* */

require_once (PATH_tslib . 'class.tslib_pibase.php');
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_tools.php');
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_interface.php');

/**
* TypoGento pi1
*
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
require_once (PATH_tslib . 'class.tslib_pibase.php');
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_tools.php');
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_interface.php');

class tx_fbmagento_pi1 extends tslib_pibase {

var $prefixId = 'tx_fbmagento'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_fbmagento_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'fb_magento'; // The extension key.
var $emConf = null;
var $pi_checkCHash = true;

/**
* The main method of the PlugIn
*
@@ -38,143 +40,156 @@ class tx_fbmagento_pi1 extends tslib_pibase {
*/
public function main($content, $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults ();
$this->pi_loadLL ();
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pi_USER_INT_obj=1;

// Flexform
$this->pi_initPIflexForm ();
$this->pi_initPIflexForm();

// get Extension Config
$this->emConf = tx_fbmagento_tools::getExtConfig();
// route throw piVars

// route through piVars
if ($this->piVars ['shop'] ['route']) {
$params = $this->piVars ['shop'];
$params = $this->piVars ['shop'];

// route throw Typoscript
} elseif (isset($this->conf['params.']['route'])){
// route through Typoscript
} elseif (isset($this->conf['params.']['route'])) {
$params = $this->conf['params.'];

// route throw Flexform
} else{
// route through Flexform
} else {
$params = array();
if(!$this->view){
$this->getRoutingDataFromPage();
if (!$this->view) {
$this->getRoutingDataFromPage();
}

switch ($this->view) {
case "SINGLEPRODUCT" :
$product_id = $this->pi_getFFvalue ( $this->cObj->data ["pi_flexform"], 'product_id', 'main' );
$params = array ('route' => 'catalog', 'controller' => 'product', 'action' => 'view', 'id' => $product_id );
case "SINGLEPRODUCT":
$product_id = $this->pi_getFFvalue($this->cObj->data ["pi_flexform"], 'product_id', 'main');
$params = array(
'route' => 'catalog',
'controller' => 'product',
'action' => 'view',
'id' => $product_id
);
break;

case "PRODUCTLIST":
$category_id = $this->pi_getFFvalue($this->cObj->data ["pi_flexform"], 'category_id', 'main');
$params = array(
'route' => 'catalog',
'controller' => 'category',
'action' => 'view',
'id' => $category_id
);
break;

case "PRODUCTLIST" :
$category_id = $this->pi_getFFvalue ( $this->cObj->data ["pi_flexform"], 'category_id', 'main' );
$params = array ('route' => 'catalog', 'controller' => 'category', 'action' => 'view', 'id' => $category_id );

case "USER":
$route = $this->pi_getFFvalue($this->cObj->data ["pi_flexform"], 'route', 'main');
$controller = $this->pi_getFFvalue($this->cObj->data ["pi_flexform"], 'controller', 'main');
$action = $this->pi_getFFvalue($this->cObj->data ["pi_flexform"], 'action', 'main');
$params = array (
'route' => $route,
'controller' => $controller,
'action' => $action
);
break;

case "USER" :
$route = $this->pi_getFFvalue ( $this->cObj->data ["pi_flexform"], 'route', 'main' );
$controller = $this->pi_getFFvalue ( $this->cObj->data ["pi_flexform"], 'controller', 'main' );
$action = $this->pi_getFFvalue ( $this->cObj->data ["pi_flexform"], 'action', 'main' );
$params = array ('route' => $route, 'controller' => $controller, 'action' => $action);
break;
}

$params = t3lib_div::array_merge_recursive_overrule($params, (array) $this->piVars ['shop']);
$params = t3lib_div::array_merge_recursive_overrule($params, (array) $this->piVars['shop']);

}

// get an Magento Instance
$this->mage = tx_fbmagento_interface::getInstance( $this->emConf );
// get some Magento Instance
$this->mage = tx_fbmagento_interface::getInstance($this->emConf);
$this->mage->setTsConfig($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_fbmagento_pi1.']);

$this->mage->dispatch($params);
$this->mage->dispatch($params);

// if Magento reports 404 error -> use TYPO3 page not found behavior
if (isset($this->conf['useTYPO3pageNotFound'])
&& $this->conf['useTYPO3pageNotFound']
&& strpos(serialize((array) Mage::app()->getResponse()->getHeaders()), '404 File not found')
) {
$GLOBALS['TSFE']->pageNotFoundAndExit();
}

// set Page Title
$objHead = $this->mage->getBlock( 'head' );
if($objHead instanceof Mage_Page_Block_Html_Head){
$objHead = $this->mage->getBlock('head');
if ($objHead instanceof Mage_Page_Block_Html_Head) {
$GLOBALS['TSFE']->page['title'] = $objHead->getTitle();
}
// render Block specified by Typoscript
if(isset($this->conf['block'])){
if($this->conf['block'] == 'typo3header'){

// render Block - specified by Typoscript
if (isset($this->conf['block'])) {

if ($this->conf['block'] == 'typo3header') {
return $this->mage->getHeaderData();
}elseif($this->conf['block'] == 'pagetitle'){

} elseif ($this->conf['block'] == 'pagetitle') {
return $objHead->getTitle();

}
elseif($this->conf['block'] == '__responseBody'){

} elseif ($this->conf['block'] == '__responseBody') {
$content .= $this->mage->getBodyData();
}
elseif($this->mage->getBlock( $this->conf['block'] ) !== null){
} elseif ($this->mage->getBlock( $this->conf['block'] ) !== null) {
$block = $this->mage->getBlock( $this->conf['block'] );

// if Mage_Core_Block_Text
if ($block instanceof Mage_Core_Block_Text) {
$block->setText('');
}
$content .= $block->toHtml ();

$content .= $block->toHtml();
}


// render default Blocks
}else{


// render default Blocks
} else {

// header
if($this->emConf['auto_header'] && $this->mage->getBlock( 'head' ) !== null){
$GLOBALS['TSFE']->additionalHeaderData [] = $this->mage->getHeaderData();
$GLOBALS['TSFE']->page['title'] = $this->mage->getBlock( 'head' )->getTitle();
if ($this->emConf['auto_header'] && $this->mage->getBlock('head') !== null) {
$GLOBALS['TSFE']->additionalHeaderData[]= $this->mage->getHeaderData();
$GLOBALS['TSFE']->page['title'] = $this->mage->getBlock('head')->getTitle();
}

// get Content
if($this->mage->getBlock( 'content' ) !== null){
$content .= $this->mage->getBlock( 'content' )->toHtml ();
if ($this->mage->getBlock('content') !== null) {
$content .= $this->mage->getBlock('content')->toHtml();
}
}
return isset($this->conf['nowrap']) && $this->conf['nowrap'] ? $content : $this->pi_wrapInBaseClass ( $content );

return isset($this->conf['nowrap']) && $this->conf['nowrap'] ? $content : $this->pi_wrapInBaseClass($content);
}


/**
* gets routing Data from the current Page an the included Plugins
* gets routing Data from the current Page and the included Plugins
*
* @return boolan
* @return boolean
*/
protected function getRoutingDataFromPage(){

$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pi_flexform', 'tt_content', 'pid=\''.$GLOBALS ['TSFE']->id.'\' AND list_type=\'fb_magento_pi1\' '.$this->cObj->enableFields('tt_content'), 'sorting');
foreach ((array) $rows as $row){
if(!$row['pi_flexform']) continue;
protected function getRoutingDataFromPage() {

$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'pi_flexform',
'tt_content',
'pid=\'' . $GLOBALS['TSFE']->id.'\' AND list_type=\'fb_magento_pi1\' ' . $this->cObj->enableFields('tt_content'),
'sorting'
);

foreach ((array) $rows as $row) {
if (!$row['pi_flexform']) continue;
$this->cObj->data['pi_flexform'] = t3lib_div::xml2array($row['pi_flexform']);
$this->view = $this->pi_getFFvalue ( $this->cObj->data ["pi_flexform"], 'show', 'main' );
if($this->view){
$this->view = $this->pi_getFFvalue($this->cObj->data ["pi_flexform"], 'show', 'main');
if ($this->view) {
return true;
}
}
return false;
return false;
}


}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/pi1/class.tx_fbmagento_pi1.php']) {
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/pi1/class.tx_fbmagento_pi1.php']);
}


?>
@@ -22,9 +22,6 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/




/**
* Class that adds the wizard icon.
*
@@ -34,43 +31,41 @@
*/
class tx_fbmagento_pi1_wizicon {

/**
* Processing the wizard items array
*
* @param array $wizardItems: The wizard items
* @return Modified array with wizard items
*/
function proc($wizardItems) {
global $LANG;
/**
* Processing the wizard items array
*
* @param array $wizardItems: The wizard items
* @return Modified array with wizard items
*/
function proc($wizardItems) {
global $LANG;

$LL = $this->includeLocalLang();
$LL = $this->includeLocalLang();

$wizardItems['plugins_tx_fbmagento_pi1'] = array(
'icon'=>t3lib_extMgm::extRelPath('fb_magento').'pi1/ce_wiz.gif',
'title'=>$LANG->getLLL('pi1_title',$LL),
'description'=>$LANG->getLLL('pi1_plus_wiz_description',$LL),
'params'=>'&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=fb_magento_pi1'
);

return $wizardItems;
}

/**
* Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
*
* @return The array with language labels
*/
function includeLocalLang() {
$llFile = t3lib_extMgm::extPath('fb_magento').'locallang.xml';
$LOCAL_LANG = t3lib_div::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);

return $LOCAL_LANG;
}
}
$wizardItems['plugins_tx_fbmagento_pi1'] = array(
'icon'=>t3lib_extMgm::extRelPath('fb_magento').'pi1/ce_wiz.gif',
'title'=>$LANG->getLLL('pi1_title',$LL),
'description'=>$LANG->getLLL('pi1_plus_wiz_description',$LL),
'params'=>'&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=fb_magento_pi1'
);

return $wizardItems;
}

/**
* Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
*
* @return The array with language labels
*/
function includeLocalLang() {
$llFile = t3lib_extMgm::extPath('fb_magento').'locallang.xml';
$LOCAL_LANG = t3lib_div::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);

return $LOCAL_LANG;
}
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/pi1/class.tx_fbmagento_pi1_wizicon.php']) {
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/pi1/class.tx_fbmagento_pi1_wizicon.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/fb_magento/pi1/class.tx_fbmagento_pi1_wizicon.php']);
}