本文整理汇总了PHP中Mage_Core_Model_Config::getNode方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Config::getNode方法的具体用法?PHP Mage_Core_Model_Config::getNode怎么用?PHP Mage_Core_Model_Config::getNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Config
的用法示例。
在下文中一共展示了Mage_Core_Model_Config::getNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Get renderer for Mime-Type specified in Accept header of request.
*
* @return Mage_Webapi_Controller_Response_Rest_RendererInterface
* @throws Mage_Webapi_Exception
* @throws LogicException
*/
public function get()
{
$acceptTypes = $this->_request->getAcceptTypes();
$availableRenderers = (array) $this->_applicationConfig->getNode(self::XML_PATH_WEBAPI_RESPONSE_RENDERS);
if (!is_array($acceptTypes)) {
$acceptTypes = array($acceptTypes);
}
foreach ($acceptTypes as $acceptType) {
foreach ($availableRenderers as $rendererConfig) {
$rendererType = (string) $rendererConfig->type;
if ($acceptType == $rendererType || $acceptType == current(explode('/', $rendererType)) . '/*' || $acceptType == '*/*') {
$rendererClass = (string) $rendererConfig->model;
break 2;
}
}
}
if (!isset($rendererClass)) {
/** If server does not have renderer for any of the accepted types it SHOULD send 406 (not acceptable). */
throw new Mage_Webapi_Exception($this->_helper->__('Server cannot understand Accept HTTP header media type.'), Mage_Webapi_Exception::HTTP_NOT_ACCEPTABLE);
}
$renderer = $this->_objectManager->get($rendererClass);
if (!$renderer instanceof Mage_Webapi_Controller_Response_Rest_RendererInterface) {
throw new LogicException('The renderer must implement "Mage_Webapi_Controller_Response_Rest_RendererInterface".');
}
return $renderer;
}
示例2: toOptionArray
/**
* Redirect type options
*
* @return array
*/
public function toOptionArray()
{
$values = (array) $this->_config->getNode('redirect_type', 'default');
if (isset($values['@attributes'])) {
unset($values['@attributes']);
}
return $values;
}
示例3: enableCodePool
/**
* Search a code pool for modules and enable them
*
* @param string $codePool
* @param OutputInterface $output
*
* @return int|void
*/
protected function enableCodePool($codePool, OutputInterface $output)
{
$modules = $this->config->getNode('modules')->asArray();
foreach ($modules as $module => $data) {
if (isset($data['codePool']) && $data['codePool'] == $codePool) {
$this->enableModule($module, $output);
}
}
}
示例4: _prepareLayout
/**
* Prepares "edit" block.
*
* @return Mage_Core_Block_Abstract
*/
protected function _prepareLayout()
{
$type = $this->getRequest()->getParam('type');
if (!empty($type)) {
$blockClassName = (string) $this->_config->getNode(self::XML_PATH_REDIRECT_TYPE_BLOCK . $type);
if (!empty($blockClassName)) {
$editBlock = $this->getLayout()->createBlock($blockClassName);
$this->setChild('edit', $editBlock);
}
}
return parent::_prepareLayout();
}
示例5: getAreaFrontName
/**
* Return Backend area front name
*
* @return string
*/
public function getAreaFrontName()
{
if (null === $this->_areaFrontName) {
$this->_areaFrontName = (bool) (string) $this->_config->getNode(self::XML_PATH_USE_CUSTOM_ADMIN_PATH) ? (string) $this->_config->getNode(self::XML_PATH_CUSTOM_ADMIN_PATH) : (string) $this->_config->getNode(self::XML_PATH_BACKEND_FRONTNAME);
}
return $this->_areaFrontName;
}
示例6: addStreamLog
/**
* Add a logger by specified key
*
* Second argument is a file name (relative to log directory) or a PHP "wrapper"
*
* @param string $loggerKey
* @param string $fileOrWrapper
* @return Mage_Core_Model_Logger
* @link http://php.net/wrappers
*/
public function addStreamLog($loggerKey, $fileOrWrapper = '')
{
$file = $fileOrWrapper ?: "{$loggerKey}.log";
if (!preg_match('#^[a-z][a-z0-9+.-]*\\://#i', $file)) {
$file = $this->_config->getOptions()->getLogDir() . DIRECTORY_SEPARATOR . $file;
}
$writerClass = (string) $this->_config->getNode('global/log/core/writer_model');
if (!$writerClass || !is_subclass_of($writerClass, 'Zend_Log_Writer_Stream')) {
$writerClass = 'Zend_Log_Writer_Stream';
}
/** @var $writer Zend_Log_Writer_Stream */
$writer = $writerClass::factory(array('stream' => $file));
$writer->setFormatter(new Zend_Log_Formatter_Simple('%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL));
$this->_loggers[$loggerKey] = new Zend_Log($writer);
return $this;
}
示例7: getNode
/**
* Disable modules updates (reindex issue)
*
* @param null $path
* @param string $scope
* @param null $scopeCode
* @return bool|Mage_Core_Model_Config_Element
*/
public function getNode($path = null, $scope = '', $scopeCode = null)
{
if ($path == Mage_Core_Model_App::XML_PATH_SKIP_PROCESS_MODULES_UPDATES) {
return true;
}
return parent::getNode($path, $scope, $scopeCode);
}
示例8: _overrideConfiguration
/**
* Override frontend configuration with VDE area data
*/
protected function _overrideConfiguration()
{
$vdeNode = $this->_configuration->getNode(Mage_DesignEditor_Model_Area::AREA_VDE);
if ($vdeNode) {
$this->_configuration->getNode(Mage_Core_Model_App_Area::AREA_FRONTEND)->extend($vdeNode, true);
}
}
示例9: getDirectoryScanner
/**
* Get current directory scanner. Initialize if it was not initialized previously.
*
* @return Zend\Code\Scanner\DirectoryScanner
*/
public function getDirectoryScanner()
{
if (!$this->_directoryScanner) {
$this->_directoryScanner = new Zend\Code\Scanner\DirectoryScanner();
/** @var Mage_Core_Model_Config_Element $module */
foreach ($this->_applicationConfig->getNode('modules')->children() as $moduleName => $module) {
if ($module->is('active')) {
/** Invalid type is specified to retrieve path to module directory. */
$moduleDir = $this->_applicationConfig->getModuleDir('invalid_type', $moduleName);
$directory = $moduleDir . DS . 'Controller' . DS . 'Webapi';
if (is_dir($directory)) {
$this->_directoryScanner->addDirectory($directory);
}
}
}
}
return $this->_directoryScanner;
}
示例10: initFromConfig
/**
* Init router from config
*
* @param Mage_Core_Model_Config $config Config
* @return void
*/
public function initFromConfig(Mage_Core_Model_Config $config)
{
$routerConfig = $config->getNode('global/messenger/publish_router');
if (!$routerConfig) {
return;
}
foreach ($routerConfig->children() as $_route) {
$this->addMap(new Varien_Object($_route->criterion->asArray()), $_route->queue);
}
}
示例11: init
/**
* @param PugMoRe_Mageploy_Model_Io_RecordingInterface $io
* @param Mage_Core_Model_Config $config
* @return PugMoRe_Mageploy_Model_Request_Funnel $this
*/
public function init($io, $config)
{
$this->_io = $io;
$this->_config = $config;
Mage::dispatchEvent('mageploy_funnel_collect_actions_before', array('funnel' => $this));
$actionsInfo = $this->_config->getNode(self::XML_ACTIONS_PATH)->asArray();
Varien_Profiler::start('mageploy::funnel::collect_actions');
foreach ($actionsInfo as $actionCode => $actionInfo) {
if (isset($actionInfo['disabled']) && $actionInfo['disabled']) {
continue;
}
if (isset($actionInfo['class'])) {
$action = new $actionInfo['class']();
$this->addAction($actionCode, $action);
}
}
Varien_Profiler::stop('mageploy::funnel::collect_actions');
Mage::dispatchEvent('mageploy_funnel_collect_actions_after', array('funnel' => $this));
return $this;
}
示例12: isModuleIgnored
public function isModuleIgnored($observer)
{
$ignores = $this->_config->getNode('global/ignoredModules/entities')->asArray();
if (is_array($ignores) && $observer) {
$curModule = $observer->getEvent()->getControllerAction()->getRequest()->getRouteName();
if (isset($ignores[$curModule])) {
return true;
}
}
return false;
}
示例13: getTypes
/**
* Get information about all declared cache types
*
* @return array
*/
public function getTypes()
{
$types = array();
$config = $this->_config->getNode(self::XML_PATH_TYPES);
if ($config) {
foreach ($config->children() as $type => $node) {
$types[$type] = new Varien_Object(array('id' => $type, 'cache_type' => $this->_helper->__((string) $node->label), 'description' => $this->_helper->__((string) $node->description), 'tags' => strtoupper((string) $node->tags), 'status' => (int) $this->canUse($type)));
}
}
return $types;
}
示例14: getFonts
/**
* Get list of available fonts.
*
* Return format:
* [['arial'] => ['label' => 'Arial', 'path' => '/www/magento/fonts/arial.ttf']]
*
* @return array
*/
public function getFonts()
{
$node = $this->_config->getNode(Mage_Captcha_Helper_Data::XML_PATH_CAPTCHA_FONTS);
$fonts = array();
if ($node) {
foreach ($node->children() as $fontName => $fontNode) {
$fonts[$fontName] = array('label' => (string) $fontNode->label, 'path' => $this->_config->getOptions()->getDir('base') . DIRECTORY_SEPARATOR . $fontNode->path);
}
}
return $fonts;
}
示例15: initFromConfig
/**
* Init observers from Magento config
*
* @param Mage_Core_Model_Config $config Config
* @return Oggetto_Messenger_Model_Event_Observer
*/
public function initFromConfig(Mage_Core_Model_Config $config)
{
$configNodes = $config->getNode()->xpath('global/messenger/event_observers/*');
if (!$configNodes) {
return $this;
}
$observers = [];
foreach ($configNodes as $_observer) {
$observers[$_observer->getName()] = Mage::getSingleton('messenger/di')->get((string) $_observer->class);
}
$this->setObservers($observers);
return $this;
}