public function storeDirective($construction) { $params = $this->_getIncludeParameters($construction[2]); $params['_absolute'] = $this->_useAbsoluteLinks; $path = $params['url']; unset($params['url']); if (!self::$_urlInstance) { self::$_urlInstance = Mage::getModel('core/url'); } $url = self::$_urlInstance->getUrl($path, $params); return $url; }
/** * Retrieve store URL directive * Support url and direct_url properties * * @param array $construction * @return string */ public function storeDirective($construction) { $params = $this->_getIncludeParameters($construction[2]); if (!isset($params['_query'])) { $params['_query'] = array(); } foreach ($params as $k => $v) { if (strpos($k, '_query_') === 0) { $params['_query'][substr($k, 7)] = $v; unset($params[$k]); } } $params['_absolute'] = $this->_useAbsoluteLinks; if ($this->_useSessionInUrl === false) { $params['_nosid'] = true; } if (isset($params['direct_url'])) { $path = ''; $params['_direct'] = $params['direct_url']; unset($params['direct_url']); } else { $path = $params['url']; unset($params['url']); } if (!self::$_urlInstance) { self::$_urlInstance = Mage::getModel('core/url')->setStore(Mage::app()->getStore(Mage::getDesign()->getStore())->getId()); } $_urlInstanceOldStore = null; if (!empty($path) && !Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL) && !Mage::app()->isSingleStoreMode()) { $params['_query']['___store'] = Mage::app()->getStore(Mage::getDesign()->getStore())->getCode(); } elseif (!empty($path) && Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL) && !Mage::app()->isSingleStoreMode()) { $_urlInstanceOldStore = self::$_urlInstance->getStore(); self::$_urlInstance->setStore(Mage::app()->getStore(Mage::getDesign()->getStore())->getCode()); } $url = self::$_urlInstance->getUrl($path, $params); if (null == !$_urlInstanceOldStore) { self::$_urlInstance->setStore($_urlInstanceOldStore); } return $url; }