Ejemplo n.º 1
0
 /**
  * @magentoConfigFixture current_store web/unsecure/base_link_url http://example.com/
  */
 public function testStoreDirective()
 {
     $url = $this->_model->storeDirective(array('{{store direct_url="arbitrary_url/"}}', 'store', ' direct_url="arbitrary_url/"'));
     $this->assertStringMatchesFormat('http://example.com/%sarbitrary_url/', $url);
     $url = $this->_model->storeDirective(array('{{store url="core/ajax/translate"}}', 'store', ' url="core/ajax/translate"'));
     $this->assertStringMatchesFormat('http://example.com/%score/ajax/translate/', $url);
 }
Ejemplo n.º 2
0
 public function storeDirective($construction)
 {
     // Get the bridge URLs
     $bridge = Mage::getSingleton('magebridge/core');
     $joomla_url = $bridge->getMageBridgeUrl();
     $joomla_sef_url = $bridge->getMageBridgeSefUrl();
     // Remove the .html suffix from the URL
     if (preg_match('/\\.html$/', $joomla_sef_url)) {
         $url_suffix = true;
         $joomla_sef_url = preg_replace('/\\.html$/', '', $joomla_sef_url);
     } else {
         $url_suffix = false;
     }
     // Call the parent function
     $url = parent::storeDirective($construction);
     $store_code = Mage::app()->getStore(Mage::getDesign()->getStore())->getCode();
     $url = str_replace($joomla_url, $joomla_sef_url, $url);
     $url = preg_replace('/___store=' . $store_code . '/', '', $url);
     $url = preg_replace('/SID=([a-zA-Z0-9]+)/', '', $url);
     $url = preg_replace('/\\?$/', '', $url);
     $url = preg_replace('/\\&$/', '', $url);
     // Return the URL
     return $url;
 }