Пример #1
0
 /**
  * Retrieve class name by class group
  *
  * NOTE: The only addition in this rewrite is the dispatch of an event,
  * which makes it easier to conditionally modify any class paths or
  * rewrites before they are instantiated.
  *
  * @param   string $groupType currently supported model, block, helper
  * @param   string $classId slash separated class identifier, ex. group/class
  * @param   string $groupRootNode optional config path for group config
  * @return  string
  */
 public function getGroupedClassName($groupType, $classId, $groupRootNode = null)
 {
     if (empty($groupRootNode)) {
         $groupRootNode = 'global/' . $groupType . 's';
     }
     $classArr = explode('/', trim($classId));
     $group = $classArr[0];
     $class = !empty($classArr[1]) ? $classArr[1] : null;
     if (isset($this->_classNameCache[$groupRootNode][$group][$class])) {
         return $this->_classNameCache[$groupRootNode][$group][$class];
     }
     $config = $this->_xml->global->{$groupType . 's'}->{$group};
     //iddqd
     // Throw event before rewrite, and verify whether the rewrite should
     // happen, dependent on the context it is being executed in.
     if (isset($config->rewrite->{$class})) {
         $eventData = new Varien_Object(array('instance' => $this, 'group' => $group, 'class' => $class));
         Mage::dispatchEvent('before_configxml_rewrite', array('config' => $eventData));
         // If returns null, or empty string, the rewrite will not happen.
         // Optionally specify another class name. This is only here as a
         // convenience. The proper way to modify this is by accessing the
         // event `instance` data and redefining the rewrite, or removing the
         // rewrite, so that the proceeding rewrite check can evaluate it.
         $class = $eventData->getData('class');
     }
     ///iddqd
     // First - check maybe the entity class was rewritten
     $className = null;
     if (isset($config->rewrite->{$class})) {
         $className = (string) $config->rewrite->{$class};
     } else {
         /**
          * Backwards compatibility for pre-MMDB extensions.
          * In MMDB release resource nodes <..._mysql4> were renamed to <..._resource>. So <deprecatedNode> is left
          * to keep name of previously used nodes, that still may be used by non-updated extensions.
          */
         if (isset($config->deprecatedNode)) {
             $deprecatedNode = $config->deprecatedNode;
             $configOld = $this->_xml->global->{$groupType . 's'}->{$deprecatedNode};
             if (isset($configOld->rewrite->{$class})) {
                 $className = (string) $configOld->rewrite->{$class};
             }
         }
     }
     // Second - if entity is not rewritten then use class prefix to form class name
     if (empty($className)) {
         if (!empty($config)) {
             $className = $config->getClassName();
         }
         if (empty($className)) {
             $className = 'mage_' . $group . '_' . $groupType;
         }
         if (!empty($class)) {
             $className .= '_' . $class;
         }
         $className = uc_words($className);
     }
     $this->_classNameCache[$groupRootNode][$group][$class] = $className;
     return $className;
 }
Пример #2
0
 /**
  * Check is field visible in the form
  *
  * If config model have method like useFieldName,
  * method uses it to check field visibility, otherwise returns true
  *
  * @param string $fieldName
  * @return boolean
  */
 public function isFieldVisible($fieldName)
 {
     if (method_exists($this->getConfig(), 'use' . uc_words($fieldName, ''))) {
         return $this->getConfig()->{'use' . uc_words($fieldName, '')}();
     }
     return true;
 }
Пример #3
0
 public function getModuleDir($type, $moduleName)
 {
     if (strtolower(substr($moduleName, 0, 5)) == 'test_') {
         $dir = BP . DS . 'tests' . DS . 'integration' . DS . 'modules' . DS . uc_words($moduleName, DS);
         switch ($type) {
             case 'etc':
                 $dir .= DS . 'etc';
                 break;
             case 'controllers':
                 $dir .= DS . 'controllers';
                 break;
             case 'sql':
                 $dir .= DS . 'sql';
                 break;
             case 'data':
                 $dir .= DS . 'data';
                 break;
             case 'locale':
                 $dir .= DS . 'locale';
                 break;
         }
         $dir = str_replace('/', DS, $dir);
         return $dir;
     } else {
         return parent::getModuleDir($type, $moduleName);
     }
 }
Пример #4
0
 /**
  * @return string
  */
 function getMarkup()
 {
     $output = "";
     switch ($this->filterType) {
         case 'bw':
             $name = $this->name;
             foreach ($this->bwValues as $key => $val) {
                 $config = array('name' => 'filter[' . $name . '][' . $key . ']');
                 $output .= "<div class='form-group'>";
                 $output .= "<label for='" . $config['name'] . "'>" . uc_words($key . " " . $name) . "</label>";
                 $this->val = $this->bwValues[$key];
                 $output .= $this->getInputMarkup($config);
                 $output .= "</div>";
             }
             break;
         case 'eq':
         case 'lt':
         case 'gt':
         default:
             $config = array('name' => 'filter[' . $this->name . ']');
             $output .= "<div class='form-group'>";
             $output .= "<label for='" . $config['name'] . "'>" . uc_words($this->name) . "</label>";
             $output .= $this->getInputMarkup($config);
             $output .= "</div>";
             break;
     }
     return $output;
 }
Пример #5
0
 /**
  * @param Mage_Catalog_Model_Product        $product
  * @param Mage_Catalog_Model_Product | null $parentProduct
  *
  * @return array
  */
 public function generateData($product, $parentProduct = null)
 {
     $this->_parentProduct = $parentProduct;
     foreach (array_keys($this->_defaultRow) as $key) {
         /* clear values */
         $this->_defaultRow[$key] = null;
         $action = "_set" . uc_words($key, '', '_');
         if (empty($this->_actionCache[$action])) {
             $this->_actionCache[$action] = true;
         }
     }
     foreach (array_keys($this->_actionCache) as $_action) {
         if (method_exists($this, $_action)) {
             $this->{$_action}($product);
         }
     }
     $this->_setOptions($product);
     $this->_setAttributes($product);
     $this->_setBundleOptions($product);
     if ($this->_getConfigHelper()->getEdition() === Shopgate_Framework_Helper_Config::ENTERPRISE_EDITION && version_compare(Mage::getVersion(), '1.10', '>=')) {
         //$this->_setGiftWrapping();
     }
     $this->_parentProduct = null;
     return $this->_defaultRow;
 }
 /**
  * @return array
  */
 public function toOptionArray()
 {
     $options = array();
     foreach ($this->_justifications as $val) {
         $options[] = array('value' => $val, 'label' => uc_words(str_replace('_', ' ', $val)));
     }
     return $options;
 }
Пример #7
0
 protected function _getClassName($type, $group, $class)
 {
     $config = Mage::getConfig()->getNode()->global->{$type . 's'}->{$group};
     $class_name = !empty($config) ? $config->getClassName() : "";
     $class_name = empty($class_name) ? 'mage_' . $group . '_' . $type : $class_name;
     $class_name .= !empty($class) ? '_' . $class : $class_name;
     return uc_words($class_name);
 }
Пример #8
0
/**
 * Class autoload
 *
 * @param string $class
 * @return object instance
 */
function __autoload($class)
{
    if (strpos($class, '/') !== false) {
        return;
    }
    $classFile = uc_words($class, DS) . '.php';
    include_once $classFile;
}
 /**
  * @param string $type
  * @return array|null
  */
 public function getValue($type)
 {
     $method = 'get' . uc_words($type, '');
     if (method_exists($this, $method)) {
         return $this->{$method}();
     }
     return null;
 }
 /**
  * @return array
  */
 public function toOptionArray()
 {
     $options = array();
     foreach ($this->_locations as $loc) {
         $options[] = array('value' => $loc, 'label' => uc_words(str_replace('_', ' ', $loc)));
     }
     return $options;
 }
/**
 * Class autoload
 *
 * @todo change to spl_autoload_register
 * @deprecated
 * @param string $class
 */
function __autoload($class)
{
    if (defined('COMPILER_INCLUDE_PATH')) {
        $classFile = $class . '.php';
    } else {
        $classFile = uc_words($class, DIRECTORY_SEPARATOR) . '.php';
    }
    include $classFile;
}
Пример #12
0
 function getRewritesList()
 {
     $moduleFiles = glob(Mage::getBaseDir('etc') . DS . 'modules' . DS . '*.xml');
     if (!$moduleFiles) {
         return false;
     }
     // load file contents
     $unsortedConfig = new Varien_Simplexml_Config();
     $unsortedConfig->loadString('<config/>');
     $fileConfig = new Varien_Simplexml_Config();
     foreach ($moduleFiles as $filePath) {
         $fileConfig->loadFile($filePath);
         $unsortedConfig->extend($fileConfig);
     }
     // create sorted config [only active modules]
     $sortedConfig = new Varien_Simplexml_Config();
     $sortedConfig->loadString('<config><modules/></config>');
     foreach ($unsortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
         if ('true' === (string) $moduleNode->active) {
             $sortedConfig->getNode('modules')->appendChild($moduleNode);
         }
     }
     $fileConfig = new Varien_Simplexml_Config();
     $_finalResult = array();
     foreach ($sortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
         $codePool = (string) $moduleNode->codePool;
         $configPath = BP . DS . 'app' . DS . 'code' . DS . $codePool . DS . uc_words($moduleName, DS) . DS . 'etc' . DS . 'config.xml';
         $fileConfig->loadFile($configPath);
         $rewriteBlocks = array('blocks', 'models', 'helpers');
         foreach ($rewriteBlocks as $param) {
             if (!isset($_finalResult[$param])) {
                 $_finalResult[$param] = array();
             }
             if ($rewrites = $fileConfig->getXpath('global/' . $param . '/*/rewrite')) {
                 foreach ($rewrites as $rewrite) {
                     $parentElement = $rewrite->xpath('../..');
                     foreach ($parentElement[0] as $moduleKey => $moduleItems) {
                         $moduleItemsArray['rewrite'] = array();
                         $moduleItemsArray['codePool'] = array();
                         foreach ($moduleItems->rewrite as $rewriteLine) {
                             foreach ($rewriteLine as $key => $value) {
                                 $moduleItemsArray['rewrite'][$key] = (string) $value;
                                 $moduleItemsArray['codePool'][$key] = $codePool;
                             }
                         }
                         if ($moduleItems->rewrite) {
                             $_finalResult[$param] = array_merge_recursive($_finalResult[$param], array($moduleKey => $moduleItemsArray));
                         }
                     }
                 }
             }
         }
     }
     return $_finalResult;
 }
Пример #13
0
 /**
  * Evaluates class alias is mapped to expected class name
  *
  * @param Varien_Simplexml_Element $other
  * @return boolean
  */
 protected function evaluateClassAlias($other)
 {
     $classPrefix = $other->class;
     if (isset($other->rewrite->{$this->_classAliasName})) {
         $className = (string) $other->rewrite->{$this->_classAliasName};
     } else {
         $className = $classPrefix . '_' . uc_words($this->_classAliasName);
     }
     $this->setActualValue($className);
     return $this->_actualValue === $this->_expectedValue;
 }
Пример #14
0
 /**
  * 
  * @return string
  */
 public function getTitle()
 {
     $moduleName = $this->helper('erpplus')->getCurrentModuleName();
     if ($moduleName == 'Mage') {
         $moduleKey = $this->helper('erpplus')->getCurrentSectionConfig();
         $moduleName = uc_words($moduleKey);
     }
     if (strtolower($moduleName) == 'erpplus') {
         return 'ERP Plus';
     }
     return 'ERP Plus | ' . $moduleName;
 }
 /**
  * @throws Exception
  * @param string $entity
  * @param string $type
  * @param string $name
  * @param array $params
  * @return Ess_M2ePro_Model_Connector_M2ePro_Abstract
  */
 public function getConnector($entity, $type, $name, array $params = array())
 {
     $entity = uc_words(trim($entity));
     $type = uc_words(trim($type));
     $name = uc_words(trim($name));
     $className = 'Ess_M2ePro_Model_Connector_M2ePro';
     $entity != '' && ($className .= '_' . $entity);
     $type != '' && ($className .= '_' . $type);
     $name != '' && ($className .= '_' . $name);
     $object = new $className($params);
     return $object;
 }
Пример #16
0
 protected function _prepareColumns()
 {
     $results = $this->_getSqlQueryResults();
     if (!empty($results)) {
         $cols = array_keys($results[0]);
         foreach ($cols as $col) {
             $header = uc_words($col, ' ');
             $this->addColumn($col, array('header' => Mage::helper('bubble_qgrid')->__($header), 'index' => $col, 'type' => 'text', 'sortable' => false));
         }
     }
     return parent::_prepareColumns();
 }
Пример #17
0
 protected function _getVariable($value, $default = '{no_value_defined}')
 {
     Varien_Profiler::start("email_template_proccessing_variables");
     $tokenizer = new Varien_Filter_Template_Tokenizer_Variable();
     $tokenizer->setString($value);
     $stackVars = $tokenizer->tokenize();
     $result = $default;
     $last = 0;
     for ($i = 0; $i < count($stackVars); $i++) {
         if ($i == 0 && isset($this->_templateVars[$stackVars[$i]['name']])) {
             // Getting of template value
             $stackVars[$i]['variable'] =& $this->_templateVars[$stackVars[$i]['name']];
         } elseif (isset($stackVars[$i - 1]['variable']) && $stackVars[$i - 1]['variable'] instanceof Varien_Object) {
             // If object calling methods or getting properties
             if ($stackVars[$i]['type'] == 'property') {
                 $caller = "get" . uc_words($stackVars[$i]['name'], '');
                 if (is_callable(array($stackVars[$i - 1]['variable'], $caller))) {
                     // If specified getter for this property
                     $stackVars[$i]['variable'] = $stackVars[$i - 1]['variable']->{$caller}();
                 } else {
                     $stackVars[$i]['variable'] = $stackVars[$i - 1]['variable']->getData($stackVars[$i]['name']);
                 }
             } else {
                 if ($stackVars[$i]['type'] == 'method') {
                     // Calling of object method
                     if (is_callable(array($stackVars[$i - 1]['variable'], $stackVars[$i]['name'])) || substr($stackVars[$i]['name'], 0, 3) == 'get') {
                         $stackVars[$i]['variable'] = call_user_func_array(array($stackVars[$i - 1]['variable'], $stackVars[$i]['name']), $stackVars[$i]['args']);
                     }
                 }
             }
             $last = $i;
         } elseif (isset($stackVars[$i - 1]['variable']) && is_object($stackVars[$i - 1]['variable'])) {
             if ($stackVars[$i]['type'] == 'property' && isset($stackVars[$i - 1]['variable']->{$stackVars[$i]['name']})) {
                 $stackVars[$i]['variable'] = $stackVars[$i - 1]['variable']->{$stackVars[$i]['name']};
             } else {
                 if ($stackVars[$i]['type'] == 'method') {
                     // Calling of object method
                     if (is_callable(array($stackVars[$i - 1]['variable'], $stackVars[$i]['name']))) {
                         $stackVars[$i]['variable'] = call_user_func_array(array($stackVars[$i - 1]['variable'], $stackVars[$i]['name']), $stackVars[$i]['args']);
                     }
                 }
             }
             $last = $i;
         }
     }
     if (isset($stackVars[$last]['variable'])) {
         // If value for construction exists set it
         $result = $stackVars[$last]['variable'];
     }
     Varien_Profiler::stop("email_template_proccessing_variables");
     return $result;
 }
Пример #18
0
 public function getColumnHeaderName($key)
 {
     // Beautify column key
     $key = trim(str_replace('_', ' ', strtolower($key)));
     // Play on words case for translation
     // Try three of the whole possibilities, which should represent most of the successfull ones
     $helper = Mage::helper('adminhtml');
     if ($key === ($result = $helper->__($key)) && ucfirst($key) === ($result = $helper->__(ucfirst($key))) && uc_words($key, ' ', ' ') === ($result = $helper->__(uc_words($key, ' ', ' ')))) {
         // Use basic key if no translation succeeded
         $result = uc_words($key, ' ', ' ');
     }
     return $result;
 }
Пример #19
0
 /**
  * @return array
  */
 public function generateData()
 {
     foreach (array_keys($this->_defaultRow) as $key) {
         $action = "_set" . uc_words($key, '', '_');
         if (empty($this->_actionCache[$action])) {
             $this->_actionCache[$action] = true;
         }
     }
     foreach (array_keys($this->_actionCache) as $_action) {
         $this->{$_action}($this->item);
     }
     return $this->_defaultRow;
 }
 /**
  * Creates a new export line instance.
  *
  * @param \SixBySix_RealTimeDespatch_Model_Export            $export
  * @param \SixBySix\RealtimeDespatch\Report\ImportReportLine $reportLine
  *
  * @return SixBySix_RealTimeDespatch_Model_Export
  */
 protected function _createExportLine($export, $reportLine)
 {
     $exportLine = Mage::getModel('realtimedespatch/export_line');
     $exportLine->setExport($export);
     $exportLine->setType($reportLine->getResult());
     $exportLine->setReference($reportLine->getExternalReference());
     $exportLine->setOperation(uc_words($reportLine->getOperation()));
     $exportLine->setEntity($export->getEntity());
     $exportLine->setMessage($reportLine->getMessage());
     $exportLine->setDetail($reportLine->getDetail());
     $exportLine->setProcessed($reportLine->getTimestamp());
     return $exportLine;
 }
Пример #21
0
 /**
  * @throws Exception
  * @param string $entity
  * @param string $type
  * @param string $name
  * @param array $params
  * @param null|Ess_M2ePro_Model_Account $accountModel
  * @param null|string $ormPrefixToConnector
  * @return Ess_M2ePro_Model_Connector_Translation_Requester|Ess_M2ePro_Model_Connector_Translation_Abstract
  */
 public function getConnector($entity, $type, $name, array $params = array(), Ess_M2ePro_Model_Account $accountModel = NULL, $ormPrefixToConnector = NULL)
 {
     $className = empty($ormPrefixToConnector) ? 'Ess_M2ePro_Model_Connector_Translation' : $ormPrefixToConnector;
     $entity = uc_words(trim($entity));
     $type = uc_words(trim($type));
     $name = uc_words(trim($name));
     $entity != '' && ($className .= '_' . $entity);
     $type != '' && ($className .= '_' . $type);
     if ($name != '') {
         $className .= '_' . $name;
     }
     $object = new $className($params, $accountModel);
     return $object;
 }
 /**
  * Creates a new import instance.
  *
  * @param \SixBySix_RealTimeDespatch_Model_Import            $import
  * @param \SixBySix\RealtimeDespatch\Report\ImportReportLine $reportLine
  *
  * @return SixBySix_RealTimeDespatch_Model_Import
  */
 protected function _createImportLine($import, $reportLine)
 {
     $importLine = Mage::getModel('realtimedespatch/import_line');
     $importLine->setImport($import);
     $importLine->setType($reportLine->getResult());
     $importLine->setSequenceId($reportLine['sequenceId']);
     $importLine->setReference($reportLine->getReference());
     $importLine->setOperation(uc_words($reportLine->getOperation()));
     $importLine->setEntity($import->getEntity());
     $importLine->setMessage($reportLine->getMessage());
     $importLine->setDetail($reportLine->getDetail());
     $importLine->setProcessed($reportLine->getTimestamp());
     return $importLine;
 }
 /**
  * @throws Exception
  * @param string $entity
  * @param string $type
  * @param string $name
  * @param array $params
  * @param null|int|Ess_M2ePro_Model_Account $account
  * @param null|string $ormPrefixToConnector
  * @return Ess_M2ePro_Model_Connector_Translation_Requester|Ess_M2ePro_Model_Connector_Translation_Abstract
  */
 public function getConnector($entity, $type, $name, array $params = array(), $account = NULL, $ormPrefixToConnector = NULL)
 {
     $className = empty($ormPrefixToConnector) ? 'Ess_M2ePro_Model_Connector_Translation' : $ormPrefixToConnector;
     $entity = uc_words(trim($entity));
     $type = uc_words(trim($type));
     $name = uc_words(trim($name));
     $entity != '' && ($className .= '_' . $entity);
     $type != '' && ($className .= '_' . $type);
     $name != '' && ($className .= '_' . $name);
     if (is_int($account) || is_string($account)) {
         $account = Mage::helper('M2ePro/Component_Ebay')->getCachedObject('Account', (int) $account);
     }
     $object = new $className($params, $account);
     return $object;
 }
Пример #24
0
 public function _prepareLayout()
 {
     /* @var $collection Flagbit_FilterUrls_Model_Resource_Mysql4_Url_Collection */
     $collection = Mage::getModel('filterurls/url')->getCollection();
     $collection->addFieldToFilter('store_id', Mage::app()->getStore()->getId());
     foreach ($collection as $item) {
         $name = str_replace('/', ' ', $item->getRequestPath());
         $name = str_replace('_', ' ', $name);
         $name = str_replace('-', ' ', $name);
         $name = str_replace(Mage::helper('filterurls')->getUrlSuffix(), '', $name);
         $item->setName(uc_words($name));
     }
     $this->setCollection($collection);
     return parent::_prepareLayout();
 }
Пример #25
0
 /**
  *
  * @param $template
  * @param $data
  *
  * @throws \Exception
  */
 public function exec($template, $data)
 {
     // Every template has its own config data for each backend
     foreach ($this->_getAvailableTemplateHooks($template) as $hook => $config) {
         // Backend class name
         $class_name = '\\LandingPages\\Hook\\' . uc_words($hook, '_', '');
         if (class_exists($class_name)) {
             // Instance backend & exec
             new $class_name($config, $data);
         } else {
             // Backend not found
             throw new \Exception('Hook backend not implemented: ' . $hook);
         }
     }
 }
Пример #26
0
 /**
  * @param Mage_Review_Model_Review $review
  * @return array
  */
 public function generateData($review)
 {
     foreach (array_keys($this->_defaultRow) as $key) {
         $action = "_set" . uc_words($key, '', '_');
         if (empty($this->_actionCache[$action])) {
             $this->_actionCache[$action] = true;
         }
     }
     foreach (array_keys($this->_actionCache) as $_action) {
         if (method_exists($this, $_action)) {
             $this->{$_action}($review);
         }
     }
     return $this->_defaultRow;
 }
Пример #27
0
 /**
  * Register the middleware.
  *
  * @return void
  */
 protected function registerMiddleware()
 {
     $middlewares = $this->app['config']['middlewares'];
     if ($middlewares) {
         foreach ($middlewares as $key => $binding) {
             $this->app->bind($key, function ($app) use($binding) {
                 if (strpos($binding, '/') !== false) {
                     $models = $app['config']['prefixs'];
                     $bindings = explode('/', $binding);
                     $baseClass = $models[$bindings[0]];
                     $binding = "{$baseClass}_" . uc_words($bindings[1]);
                 }
                 return $app->make($binding);
             });
         }
     }
 }
Пример #28
0
 /**
  * @throws Exception
  * @param string $entity
  * @param string $type
  * @param string $name
  * @param array $params
  * @param null|Ess_M2ePro_Model_Marketplace $marketplaceModel
  * @param null|Ess_M2ePro_Model_Account $accountModel
  * @param null|int $mode
  * @param null|string $ormPrefixToConnector
  * @return Ess_M2ePro_Model_Connector_Server_Ebay_Abstract
  */
 public function getConnector($entity, $type, $name, array $params = array(), Ess_M2ePro_Model_Marketplace $marketplaceModel = NULL, Ess_M2ePro_Model_Account $accountModel = NULL, $mode = NULL, $ormPrefixToConnector = NULL)
 {
     $className = empty($ormPrefixToConnector) ? 'Ess_M2ePro_Model_Connector_Server_Ebay' : $ormPrefixToConnector;
     $entity = uc_words(trim($entity));
     $type = uc_words(trim($type));
     $name = uc_words(trim($name));
     $entity != '' && ($className .= '_' . $entity);
     $type != '' && ($className .= '_' . $type);
     if ($name != '') {
         if (!empty($ormPrefixToConnector)) {
             $name = 'Server' . $name;
         }
         $className .= '_' . $name;
     }
     $object = new $className($params, $marketplaceModel, $accountModel, $mode);
     return $object;
 }
Пример #29
0
 public function gather()
 {
     $config = Mage::getConfig();
     foreach ($config->getNode('modules')->children() as $item) {
         $o = Mage::getModel('pulsestorm_modulelist/configuredmodule');
         $o->setName($item->getName());
         $o->setActive((string) $item->active);
         $o->setCodePool((string) $item->codePool);
         //use same logic from Mage_Core_Model_Config::getModuleDir
         //but recreated here to allow for poorly configued modules
         $codePool = $config->getModuleConfig($item->getName())->codePool;
         $dir = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
         $o->setPath($dir);
         $exists = file_exists($o->getPath());
         $exists = $exists ? 'yes' : 'no';
         $o->setPathExists($exists);
         $exists = file_exists($o->getPath() . '/etc/config.xml');
         $exists = $exists ? 'yes' : 'no';
         $o->setConfigExists($exists);
         $o->setModuleVersion('?');
         if ($exists == 'yes') {
             $xml = simplexml_load_file($o->getPath() . '/etc/config.xml');
             $modules = $xml->modules;
             if (!$modules) {
                 continue;
             }
             $name = $modules->{$item->getName()};
             if (!$name) {
                 continue;
             }
             $version = $name->version;
             if (!$version) {
                 $version = '?';
             }
             $version = (string) $version;
             $o->setModuleVersion($version);
         }
         if (!array_key_exists($o->getCodePool(), $this->_lists)) {
             $this->_lists[$o->getCodePool()] = array();
         }
         $this->_lists[$o->getCodePool()][] = $o;
     }
     return $this;
 }
Пример #30
0
 /**
  * @throws Exception
  * @param string $entity
  * @param string $type
  * @param string $name
  * @param array $params
  * @return Ess_M2ePro_Model_Connectors_M2ePro_Abstract
  */
 public function getConnector($entity, $type, $name, array $params = array())
 {
     $entity = uc_words(trim($entity));
     $type = uc_words(trim($type));
     $name = uc_words(trim($name));
     //$classFilePath = dirname(__FILE__);
     //$entity != '' && $classFilePath .= '/'.$entity;
     //$type != '' && $classFilePath .= '/'.$type;
     //$name != '' && $classFilePath .= '/'.$name;
     //$classFilePath .= '.php';
     //if (!is_file($classFilePath)) {
     //    throw new Exception('Connector command class file not found.');
     //}
     $className = 'Ess_M2ePro_Model_Connectors_M2ePro';
     $entity != '' && ($className .= '_' . $entity);
     $type != '' && ($className .= '_' . $type);
     $name != '' && ($className .= '_' . $name);
     $object = new $className($params);
     return $object;
 }