当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Simplexml_Config::getXpath方法代码示例

本文整理汇总了PHP中Varien_Simplexml_Config::getXpath方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Simplexml_Config::getXpath方法的具体用法?PHP Varien_Simplexml_Config::getXpath怎么用?PHP Varien_Simplexml_Config::getXpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Simplexml_Config的用法示例。


在下文中一共展示了Varien_Simplexml_Config::getXpath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDataSlide

 public function getDataSlide($num)
 {
     $slide = 'slide' . $num;
     $xml = new Varien_Simplexml_Config(Mage::getBaseDir() . '/app/code/local/Etheme/Evoqueparallax/Model/data_slides.xml');
     $slides = $xml->getXpath('slides');
     $slides = $slides[0];
     return (string) $slides->{$slide};
 }
开发者ID:jacobfire,项目名称:robotics,代码行数:8,代码来源:Data.php

示例2: getRewritesList

 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;
 }
开发者ID:guohuadeng,项目名称:stampApp,代码行数:55,代码来源:Data.php

示例3: _getNodesByFullActionName

 /**
  * Lookup configuration nodes by full action name
  *
  * @param string $fullActionName
  * @return array
  */
 protected function _getNodesByFullActionName($fullActionName)
 {
     if (!$fullActionName) {
         return array();
     }
     $actionNodes = $this->_xmlConfig->getXpath("/logging/*/actions/{$fullActionName}[1]");
     if ($actionNodes) {
         return $actionNodes;
     }
     return array();
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:17,代码来源:Config.php

示例4: getConflictList

 /**
  * Retrive possible conflicts list
  *
  * @return array
  */
 public function getConflictList()
 {
     $moduleFiles = glob($this->_etcDir . 'modules' . DIRECTORY_SEPARATOR . '*.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();
     $_finalResultAbstract = array();
     foreach ($sortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
         $codePool = (string) $moduleNode->codePool;
         $configPath = $this->_codeDir . $codePool . DIRECTORY_SEPARATOR . uc_words($moduleName, DS) . DIRECTORY_SEPARATOR . '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();
                         foreach ($moduleItems->rewrite as $rewriteLine) {
                             foreach ($rewriteLine as $key => $value) {
                                 $moduleItemsArray['rewrite'][$key] = (string) $value;
                             }
                             #$moduleItemsArray['rewrite'] += $rewriteLine->asArray();
                             #echo "<pre>".print_r($moduleItemsArray['rewrite'],1)."</pre>";
                         }
                         if ($moduleItems->rewrite) {
                             //                                $_finalResult[$param] = array_merge_recursive($_finalResult[$param], array($moduleKey => $moduleItems->asArray()));
                             $_finalResult[$param] = array_merge_recursive($_finalResult[$param], array($moduleKey => $moduleItemsArray));
                         }
                     }
                 }
             }
             #echo "<pre>".print_r($_finalResult,1)."</pre>";
             if ($rewrites = $fileConfig->getXpath('global/' . $param . '/*/rewriteabstract')) {
                 foreach ($rewrites as $rewrite) {
                     $parentElement = $rewrite->xpath('../..');
                     foreach ($parentElement[0] as $moduleKey => $moduleItems) {
                         if ($moduleItems->rewriteabstract) {
                             //                                $_finalResultAbstract[$param] = array_merge_recursive($_finalResultAbstract[$param], array($moduleKey => $moduleItems->asArray()));
                             $list = array();
                             foreach ($moduleItems->rewriteabstract->children() as $key => $value) {
                                 $list[$key] = (string) $value;
                             }
                             #echo "<pre>--".print_r($list,1)."</pre>";
                             #echo "<pre>++".print_r($moduleItems->asArray(),1)."</pre>";
                             $_finalResultAbstract[$param] = array($moduleKey => array('rewriteabstract' => $list));
                         }
                     }
                 }
             }
         }
     }
     foreach (array_keys($_finalResult) as $groupType) {
         foreach (array_keys($_finalResult[$groupType]) as $key) {
             // remove some repeating elements after merging all parents
             foreach ($_finalResult[$groupType][$key]['rewrite'] as $key1 => $value) {
                 if (is_array($value)) {
                     $_finalResult[$groupType][$key]['rewrite'][$key1] = array_unique($value);
                 }
                 // if rewrites count < 2 - no conflicts - remove
                 if (gettype($_finalResult[$groupType][$key]['rewrite'][$key1]) == 'array' && count($_finalResult[$groupType][$key]['rewrite'][$key1]) < 2 || gettype($_finalResult[$groupType][$key]['rewrite'][$key1]) == 'string') {
                     unset($_finalResult[$groupType][$key]['rewrite'][$key1]);
                 }
             }
             // clear empty elements
             if (count($_finalResult[$groupType][$key]['rewrite']) < 1) {
                 unset($_finalResult[$groupType][$key]);
             }
         }
         // clear empty elements
         if (count($_finalResult[$groupType]) < 1) {
             unset($_finalResult[$groupType]);
         }
     }
//.........这里部分代码省略.........
开发者ID:CherylMuniz,项目名称:fashion,代码行数:101,代码来源:Conflict.php

示例5: _getPossibleConflictsList

 /**
  * Retrive possible conflicts list
  *
  * @return array
  */
 protected function _getPossibleConflictsList()
 {
     $moduleFiles = glob($this->_etcDir . 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 = $this->_codeDir . 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) {
                         if ($moduleItems->rewrite) {
                             $_finalResult[$param] = array_merge_recursive($_finalResult[$param], array($moduleKey => $moduleItems->asArray()));
                         }
                     }
                 }
             }
         }
     }
     foreach (array_keys($_finalResult) as $groupType) {
         foreach (array_keys($_finalResult[$groupType]) as $key) {
             // remove some repeating elements after merging all parents
             foreach ($_finalResult[$groupType][$key]['rewrite'] as $key1 => $value) {
                 if (is_array($value)) {
                     $_finalResult[$groupType][$key]['rewrite'][$key1] = array_unique($value);
                 }
                 // if rewrites count < 2 - no conflicts - remove
                 if (gettype($_finalResult[$groupType][$key]['rewrite'][$key1]) == 'array' && count($_finalResult[$groupType][$key]['rewrite'][$key1]) < 2 || gettype($_finalResult[$groupType][$key]['rewrite'][$key1]) == 'string') {
                     unset($_finalResult[$groupType][$key]['rewrite'][$key1]);
                 }
             }
             // clear empty elements
             if (count($_finalResult[$groupType][$key]['rewrite']) < 1) {
                 unset($_finalResult[$groupType][$key]);
             }
         }
         // clear empty elements
         if (count($_finalResult[$groupType]) < 1) {
             unset($_finalResult[$groupType]);
         }
     }
     return $_finalResult;
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:74,代码来源:aitoc-test.php

示例6: getModulesList

 protected function getModulesList()
 {
     $ret = array();
     $moduleFiles = glob($this->_etcDir . DS . 'modules' . DS . '*.xml');
     if ($moduleFiles) {
         // 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();
         foreach ($sortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
             if (strpos($moduleName, "Mage_") === FALSE) {
                 $codePool = (string) $moduleNode->codePool;
                 $configPath = $this->_codeDir . DS . $codePool . DS . uc_words($moduleName, DS) . DS . 'etc' . DS . 'config.xml';
                 $fileConfig->loadFile($configPath);
                 $version = $fileConfig->getXpath('modules/' . $moduleName . '/version');
                 $ret[] = array('version' => $version && $version[0] ? (string) $version[0] : NULL, 'key' => $moduleName);
             }
         }
     }
     return $ret;
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:34,代码来源:amasty.php

示例7: generatePriceArr

 protected function generatePriceArr($xmlResponse, &$costArr, &$priceArr)
 {
     if (strlen(trim($xmlResponse)) > 0) {
         $xml = new Varien_Simplexml_Config();
         $xml->loadString($xmlResponse);
         $arr = $xml->getXpath("//RatingServiceSelectionResponse/Response/ResponseStatusCode/text()");
         $success = (int) $arr[0];
         if ($success === 1) {
             $arr = $xml->getXpath("//RatingServiceSelectionResponse/RatedShipment");
             // WSA change for Dropship
             if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Dropcommon', 'carriers/dropship/active') || Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Dropship', 'carriers/dropship/active')) {
                 $allowedMethods = $this->_request->getUpsAllowedMethods();
                 if ($allowedMethods == null) {
                     $allowedMethods = explode(",", $this->getConfigData('allowed_methods'));
                 }
             } else {
                 $allowedMethods = explode(",", $this->getConfigData('allowed_methods'));
             }
             // Negotiated rates
             $negotiatedArr = $xml->getXpath("//RatingServiceSelectionResponse/RatedShipment/NegotiatedRates");
             $negotiatedActive = $this->getConfigFlag('negotiated_active') && $this->getConfigData('shipper_number') && !empty($negotiatedArr);
             foreach ($arr as $shipElement) {
                 $code = (string) $shipElement->Service->Code;
                 if (in_array($code, $allowedMethods)) {
                     if ($negotiatedActive) {
                         $cost = $shipElement->NegotiatedRates->NetSummaryCharges->GrandTotal->MonetaryValue;
                     } else {
                         $cost = $shipElement->TotalCharges->MonetaryValue;
                     }
                     //convert price with Origin country currency code to base currency code
                     $successConversion = true;
                     $responseCurrencyCode = (string) $shipElement->TotalCharges->CurrencyCode;
                     if ($responseCurrencyCode) {
                         $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
                         if (in_array($responseCurrencyCode, $allowedCurrencies) && $this->_getBaseCurrencyRate($responseCurrencyCode) > 0) {
                             $cost = (double) $cost * $this->_getBaseCurrencyRate($responseCurrencyCode);
                         } else {
                             $errorTitle = Mage::helper('directory')->__('Can\'t convert rate from "%s-%s".', $responseCurrencyCode, $this->_request->getPackageCurrency()->getCode());
                             $error = Mage::getModel('shipping/rate_result_error');
                             $error->setCarrier('ups');
                             $error->setCarrierTitle($this->getConfigData('title'));
                             $error->setErrorMessage($errorTitle);
                             $successConversion = false;
                         }
                     }
                     if ($successConversion) {
                         $costArr[$code] = $cost;
                         $priceArr[$code] = $this->getMethodPrice(floatval($cost), $code);
                     }
                 }
             }
         } else {
             $arr = $xml->getXpath("//RatingServiceSelectionResponse/Response/Error/ErrorDescription/text()");
             $errorTitle = (string) $arr[0][0];
             $error = Mage::getModel('shipping/rate_result_error');
             $error->setCarrier('ups');
             $error->setCarrierTitle($this->getConfigData('title'));
             //$error->setErrorMessage($errorTitle);
             $error->setErrorMessage($this->getConfigData('specificerrmsg'));
             if ($this->getDebugFlag()) {
                 Mage::helper('wsalogger/log')->postWarning('usashipping', 'UPS Error Raised', '');
             }
         }
     }
     return $priceArr;
 }
开发者ID:audiblePi,项目名称:devOdyssey,代码行数:66,代码来源:Ups.php

示例8: getConflictList

 /**
  * Retrive possible conflicts list
  *
  * @return array
  */
 public function getConflictList()
 {
     $moduleFiles = glob($this->_etcDir . 'modules' . DIRECTORY_SEPARATOR . '*.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 = $this->_codeDir . $codePool . DIRECTORY_SEPARATOR . uc_words($moduleName, DS) . DIRECTORY_SEPARATOR . '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();
                         foreach ($moduleItems->rewrite as $rewriteLine) {
                             foreach ($rewriteLine as $key => $value) {
                                 $moduleItemsArray['rewrite'][$key] = (string) $value;
                             }
                             #echo "<pre>".print_r($moduleItemsArray['rewrite'],1)."</pre>";
                         }
                         if ($moduleItems->rewrite) {
                             $_finalResult[$param] = array_merge_recursive($_finalResult[$param], array($moduleKey => $moduleItemsArray));
                         }
                     }
                 }
             }
         }
     }
     $_finalResult = $this->_fillAllClassesToRewrite($_finalResult);
     $_finalResult = $this->_clearEmptyRows($_finalResult);
     $_finalResult = $this->_recoverDeletedClassRewrites($_finalResult);
     // filter aitoc modules
     foreach ($_finalResult as $type => $data) {
         foreach ($data as $module => $data) {
             foreach ($data['rewrite'] as $model => $classes) {
                 $remove = true;
                 foreach ($classes as $class) {
                     if (strstr($class, 'Aitoc') || strstr($class, 'AdjustWare')) {
                         $remove = false;
                         break;
                     }
                 }
                 if ($remove) {
                     unset($_finalResult[$type][$module]['rewrite'][$model]);
                 }
             }
             if (!$_finalResult[$type][$module]['rewrite']) {
                 unset($_finalResult[$type][$module]);
             }
         }
     }
     return $_finalResult;
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:82,代码来源:Conflict.php


注:本文中的Varien_Simplexml_Config::getXpath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。