Esempio n. 1
0
 public function __construct($options = null)
 {
     $default = array('id' => 'form-contacts', 'action' => Zend_Controller_Front::getInstance()->getBaseUrl() . Axis_Locale::getLanguageUrl() . '/contacts');
     if (is_array($options)) {
         $default = array_merge($default, $options);
     }
     parent::__construct($default);
 }
Esempio n. 2
0
 public function __construct($options = array())
 {
     $default = array('id' => 'form-info', 'action' => Zend_Controller_Front::getInstance()->getBaseUrl() . Axis_Locale::getLanguageUrl() . '/account/info/change');
     if (null !== $options || !count($options)) {
         $default = array_merge($default, $options);
     }
     parent::__construct($default);
 }
Esempio n. 3
0
 /**
  * @param array $options[productId => int]
  */
 function __construct($options = null)
 {
     $product = $options['productId'];
     $default = array('id' => 'form-review', 'action' => Zend_Controller_Front::getInstance()->getBaseUrl() . Axis_Locale::getLanguageUrl() . '/review/add/product/' . $product);
     if (is_array($options)) {
         $default = array_merge($default, $options);
     }
     parent::__construct($default);
 }
Esempio n. 4
0
 /**
  * Redirect to another URL
  *
  * @param string $url [optional]
  * @param bool $addLanguage [optional]
  * @param array $options Options to be used when redirecting
  * @return void
  */
 protected function _redirect($url, array $options = array(), $addLanguage = true)
 {
     $httpReferer = $this->getRequest()->getServer('HTTP_REFERER');
     if ($httpReferer && $url == $httpReferer || !$addLanguage) {
         parent::_redirect($url, $options);
         return;
     }
     parent::_redirect(rtrim(Axis_Locale::getLanguageUrl(), '/') . '/' . ltrim($url, '/'), $options);
 }
Esempio n. 5
0
 public function __construct($options = null)
 {
     $page = $options['pageId'];
     $default = array('id' => 'form-page-comment', 'action' => Zend_Controller_Front::getInstance()->getBaseUrl() . Axis_Locale::getLanguageUrl() . '/cms/comment/add/page/' . $page . '#form-page-comment');
     if (is_array($options)) {
         $default = array_merge($default, $options);
     }
     parent::__construct($default);
 }
Esempio n. 6
0
 public function hurl(array $options = array(), $ssl = false, $reset = false)
 {
     $baseUrl = $ssl && $this->_enabledSsl ? $this->view->secureUrl : $this->view->baseUrl;
     $locale = isset($options['locale']) ? $options['locale'] : Axis_Locale::getLanguageUrl();
     if (!empty($locale)) {
         $locale = '/' . $locale;
     }
     return $baseUrl . $locale . '/' . Axis::config('catalog/main/route') . $this->_hurl->url($options, $reset);
 }
Esempio n. 7
0
 /**
  * Generates an url given the name of a route.
  *
  * @access public
  *
  * @param  array $urlOptions Options passed to the assemble method of the Route object.
  * @param  mixed $name The name of a Route to use. If null it will use the current Route
  * @param  bool $reset Whether or not to reset the route defaults with those provided
  * @return string Url for the link href attribute.
  */
 public function url(array $urlOptions = array(), $name = null, $reset = false, $encode = true)
 {
     $locale = trim(Axis_Locale::getLanguageUrl(), '/ ');
     if (!empty($locale)) {
         $urlOptions = array_merge(array('locale' => $locale), $urlOptions);
     }
     $urlOptions = array_merge($_GET, $urlOptions);
     return parent::url($urlOptions, $name, $reset, $encode);
 }
Esempio n. 8
0
 /**
  *
  * @param string $href
  * @param bool $ssl [optional]
  * @return string
  */
 public function href($href = '', $ssl = false)
 {
     $baseUrl = $ssl && $this->_enabledSsl ? $this->view->secureUrl : $this->view->baseUrl;
     $locale = isset($options['locale']) ? $options['locale'] : Axis_Locale::getLanguageUrl();
     $href = trim($href, '/');
     if (!empty($href)) {
         $href = '/' . $href;
     }
     return $baseUrl . $locale . $href;
 }
Esempio n. 9
0
 public function changeAction()
 {
     $locale = $this->_getParam('lang');
     $redirectUrl = $lastUrl = $this->_getBackUrl();
     if ($locale) {
         $langUrl = Axis_Locale::getLanguageUrl();
         if (0 === strpos($redirectUrl, $this->view->secureUrl)) {
             $urlPrefix = $this->view->secureUrl . $langUrl;
         } else {
             $urlPrefix = $this->view->baseUrl . $langUrl;
         }
         $redirectUrl = substr($lastUrl, strpos($lastUrl, $urlPrefix) + strlen($urlPrefix));
         Axis_Locale::setLocale($locale);
     }
     $this->_redirect($redirectUrl);
 }
Esempio n. 10
0
 public function createAction()
 {
     $this->_helper->layout->disableLayout();
     $filename = $this->_getParam('filename');
     $alpha = new Zend_Filter_Alnum();
     $filename = $alpha->filter($filename);
     $filename .= '.xml';
     $siteId = $this->_getParam('site_id');
     $menu = new Zend_Navigation();
     $gmDate = gmdate('Y-m-d');
     $locales = Axis::single('locale/language')->select(array('id', 'locale'))->fetchPairs();
     foreach ($locales as $languageId => &$_locale) {
         $_locale = Axis_Locale::getLanguageUrl($_locale);
     }
     $categories = Axis::single('catalog/category')->select('*')->addName()->addKeyWord()->order('cc.lft')->addSiteFilter($siteId)->addDisabledFilter()->fetchAll();
     $config = Axis::config()->sitemap;
     $changefreq = $config->categories->frequency;
     $priority = $config->categories->priority;
     $_container = $menu;
     $lvl = 0;
     foreach ($categories as $_category) {
         if (!isset($locales[$_category['language_id']])) {
             continue;
         }
         $uri = $this->view->hurl(array('cat' => array('value' => $_category['id'], 'seo' => $_category['key_word']), 'locale' => $locales[$_category['language_id']], 'controller' => 'catalog', 'action' => 'view'), false, true);
         $page = new Zend_Navigation_Page_Uri(array('label' => $_category['name'], 'title' => $_category['name'], 'uri' => $uri, 'order' => $_category['lft'], 'visible' => 'enabled' === $_category['status'] ? true : false, 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority, 'id' => $_category['id'] . $_category['language_id']));
         $lvl = $lvl - $_category['lvl'] + 1;
         for ($i = 0; $i < $lvl; $i++) {
             $_container = $_container->getParent();
         }
         $lvl = $_category['lvl'];
         $_container->addPage($page);
         $_container = $page;
     }
     $products = Axis::single('catalog/product_category')->select()->distinct()->from('catalog_product_category', array())->joinLeft('catalog_product', 'cp.id = cpc.product_id', array('id'))->addName()->addKeyWord()->addActiveFilter()->addDateAvailableFilter()->addSiteFilter($siteId)->columns(array('category_id' => 'cc.id'))->fetchAll();
     $changefreq = $config->products->frequency;
     $priority = $config->products->priority;
     foreach ($products as $_product) {
         if (!isset($locales[$_product['language_id']])) {
             continue;
         }
         $uri = $this->view->hurl(array('cat' => array('value' => $_product['id'], 'seo' => $_product['key_word']), 'locale' => $locales[$_product['language_id']], 'controller' => 'catalog', 'action' => 'view'), false, true);
         $page = new Zend_Navigation_Page_Uri(array('label' => $_product['name'], 'title' => $_product['name'], 'uri' => $uri, 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
         $_container = $menu->findBy('id', $_product['category_id'] . $_product['language_id']);
         if (null !== $_container) {
             $_container->addPage($page);
         }
     }
     $categories = Axis::single('cms/category')->select(array('id', 'parent_id'))->addCategoryContentTable()->columns(array('ccc.link', 'ccc.title', 'ccc.language_id'))->addActiveFilter()->addSiteFilter($siteId)->where('ccc.link IS NOT NULL')->fetchAll();
     $changefreq = $config->cms->frequency;
     $priority = $config->cms->priority;
     foreach ($categories as $_category) {
         if (!isset($locales[$_category['language_id']])) {
             continue;
         }
         $title = empty($_category['title']) ? $_category['link'] : $_category['title'];
         $page = new Zend_Navigation_Page_Mvc(array('label' => $title, 'title' => $title, 'route' => 'cms_category', 'params' => array('cat' => $_category['link'], 'locale' => $locales[$_category['language_id']]), 'id' => 'cms' . $_category['id'] . $_category['language_id'], 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
         $_container = $menu->findBy('id', 'cms' . $_category['parent_id'] . $_category['language_id']);
         if (null === $_container) {
             $_container = $menu;
         }
         $_container->addPage($page);
     }
     $pages = array();
     if ($config->cms->showPages && !empty($categories)) {
         $pages = Axis::single('cms/page')->select(array('id', 'name'))->join(array('cpca' => 'cms_page_category'), 'cp.id = cpca.cms_page_id', 'cms_category_id')->join('cms_page_content', 'cp.id = cpc.cms_page_id', array('link', 'title', 'language_id'))->where('cp.is_active = 1')->where('cpca.cms_category_id IN (?)', array_keys($categories))->fetchAll();
         foreach ($pages as $_page) {
             $title = empty($_page['title']) ? $_page['link'] : $_page['title'];
             $page = new Zend_Navigation_Page_Mvc(array('label' => $title, 'title' => $title, 'route' => 'cms_page', 'params' => array('page' => $_page['link'], 'locale' => $locales[$_page['language_id']]), 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
             $_container = $menu->findBy('id', 'cms' . $_page['cms_category_id'] . $_page['language_id']);
             if (null !== $_container) {
                 $_container->addPage($page);
             }
         }
     }
     $content = $this->view->navigation()->sitemap($menu)->setFormatOutput(true)->setUseSitemapValidators(false)->render();
     $this->getResponse()->clearAllHeaders()->setHeader('Content-Description', 'File Transfer', true)->setHeader('Content-Type', 'application/octet-stream', true)->setHeader('Content-Disposition', 'attachment; filename=' . $filename, true)->setHeader('Content-Transfer-Encoding', 'binary', true)->setHeader('Expires', '0', true)->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)->setHeader('Pragma', 'public', true);
     $this->getResponse()->setBody($content);
 }
Esempio n. 11
0
 public function __construct($options = array())
 {
     $default = array('id' => 'form-signup', 'action' => Zend_Controller_Front::getInstance()->getBaseUrl() . Axis_Locale::getLanguageUrl() . '/account/auth/register');
     $default = array_merge($default, $options);
     parent::__construct($default);
 }
Esempio n. 12
0
 public function __construct()
 {
     $this->_hurl = Axis_HumanUri::getInstance();
     $this->_enabledSsl = Axis::config('core/frontend/ssl');
     $this->_languageUrl = Axis_Locale::getLanguageUrl();
 }
Esempio n. 13
0
 /**
  * Redirect to another URL
  *
  * @param string $url [optional]
  * @param bool $addLanguage [optional]
  * @param array $options Options to be used when redirecting
  * @return void
  */
 protected function _redirect($url, array $options = array(), $addLanguage = true)
 {
     if (0 === strpos($url, 'http://') || 0 === strpos($url, 'https://') || !$addLanguage) {
         parent::_redirect($url, $options);
         return;
     }
     if ($url && $url !== '/') {
         $url = '/' . trim($url, '/');
     } else {
         $url = '';
     }
     parent::_redirect(Axis_Locale::getLanguageUrl() . $url, $options);
 }
Esempio n. 14
0
 /**
  * Assembles user submitted parameters forming a URL path defined by this route
  *
  * @param  array $data An array of variable and value pairs used as parameters
  * @param  boolean $reset Whether or not to set route defaults with those provided in $data
  * @return string Route path with user submitted parameters
  */
 public function assemble($data = array(), $reset = false, $encode = false, $partial = false)
 {
     $locale = null;
     if (!empty($data['locale'])) {
         // This locale is always valid. It's a developer filtered input
         $locale = trim($data['locale'], '/ ');
     } else {
         $locale = trim(Axis_Locale::getLanguageUrl(), '/ ');
     }
     unset($data['locale']);
     $assemble = parent::assemble($data, $reset, $encode, $partial);
     if (empty($locale)) {
         return $assemble;
     }
     $isValidLocale = false;
     foreach (self::$_locales as $_locale) {
         if (strpos($_locale, $locale) === 0) {
             $isValidLocale = true;
             break;
         }
     }
     if ($isValidLocale) {
         if (isset($this->_defaults['locale'])) {
             $defaultLocale = $this->_defaults['locale'];
         } else {
             $defaultLocale = self::$_defaultLocale;
         }
         if ($locale != $defaultLocale) {
             if (empty($assemble)) {
                 // preventing urlDelimiter at the end of the url for the homepage
                 $assemble = $locale;
             } else {
                 $assemble = implode($this->_urlDelimiter, array($locale, $assemble));
             }
         }
     }
     return $assemble;
 }