當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。