Ejemplo n.º 1
0
 /**
  * Initialize the static routes used by WordPress
  *
  * @return $this
  */
 protected function _beforeMatch($uri)
 {
     parent::_beforeMatch($uri);
     if (!$uri) {
         $this->addRouteCallback(array($this, '_getHomepageRoutes'));
     }
     $this->addRouteCallback(array($this, '_getSimpleRoutes'));
     $this->addRouteCallback(array($this, '_getPostCategoryRoutes'));
     $this->addRouteCallback(array($this, '_getPageRoutes'));
     $this->addRouteCallback(array($this, '_getPostRoutes'));
     $this->addRouteCallback(array($this, '_getCustomTaxonomyUris'));
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Initialize the static routes used by WordPress
  *
  * @return $this
  */
 protected function _initStaticRoutes()
 {
     $helper = Mage::helper('wordpress/router');
     if (!Mage::helper('wordpress/post')->getPostId() && !$helper->getPageId()) {
         $this->addStaticRoute('/^$/');
     }
     if ($helper->categoryUrlHasBase()) {
         $this->addStaticRoute('/^' . $helper->getCategoryBase() . '\\/.*$/i', 'view', 'post_category');
     }
     $tagBase = $helper->getTagBase();
     $this->addStaticRoute('/^' . $tagBase . '\\/.*$/', 'view', 'post_tag');
     $this->addStaticRoute('/^author\\/.*$/', 'view', 'author');
     // Archive static routes
     $year = '[1-2]{1}[0-9]{3}';
     $month = '[0-1]{1}[0-9]{1}';
     $day = '[0-3]{1}[0-9]{1}';
     $this->addStaticRoute('/^' . $year . '\\/' . $month . '[\\/]{0,1}$/', 'view', 'archive');
     $this->addStaticRoute('/^' . $year . '\\/' . $month . '\\/' . $day . '[\\/]{0,1}$/', 'view', 'archive');
     // Search static route
     $this->addStaticRoute('/^search/', 'index', 'search');
     // Forward certain request directly to WP
     $this->addStaticRoute('/^index.php/i', 'forward');
     $this->addStaticRoute('/^wp-content\\/(.*)/i', 'forwardFile');
     $this->addStaticRoute('/^wp-includes\\/(.*)/i', 'forwardFile');
     $this->addStaticRoute('/^wp-cron.php.*/', 'forwardFile');
     $this->addStaticRoute('/^wp-admin[\\/]{0,1}$/', 'wpAdmin');
     $this->addStaticRoute('/^wp-pass.php.*/', 'applyPostPassword');
     $this->addStaticRoute('/^robots.txt$/i', 'robots');
     $this->addStaticRoute('/^sitemap.xml$/', 'sitemap');
     // Yoast Sitemap - Deprecated. Use Google XML Sitemaps instead
     $this->addStaticRoute('/^[^\\/]{0,}sitemap[^\\/]{0,}.xml$/', 'legacySitemap');
     // Add comments feed
     $this->addStaticRoute('/^comments$/', 'commentsFeed');
     return parent::_initStaticRoutes();
 }
Ejemplo n.º 3
0
 /**
  * Initialize the static routes used by WordPress
  *
  * @return $this
  */
 protected function _initStaticRoutes()
 {
     if (!Mage::helper('wordpress/post')->getPostId()) {
         $this->addStaticRoute('/^$/');
     }
     $helper = Mage::helper('wordpress/router');
     if ($helper->categoryUrlHasBase()) {
         $this->addStaticRoute('/^' . $helper->getCategoryBase() . '\\/.*$/i', 'view', 'post_category');
     }
     $tagBase = $helper->getTagBase();
     $this->addStaticRoute('/^' . $tagBase . '\\/.*$/', 'view', 'post_tag');
     $this->addStaticRoute('/^author\\/.*$/', 'view', 'author');
     // Archive static routes
     $year = '[1-2]{1}[0-9]{3}';
     $month = '[0-1]{1}[0-9]{1}';
     $day = '[0-3]{1}[0-9]{1}';
     $this->addStaticRoute('/^' . $year . '\\/' . $month . '[\\/]{0,1}$/', 'view', 'archive');
     $this->addStaticRoute('/^' . $year . '\\/' . $month . '\\/' . $day . '[\\/]{0,1}$/', 'view', 'archive');
     if (Mage::helper('wordpress/search')->isEnabled()) {
         $searchBase = Mage::helper('wordpress/search')->getSearchRoute();
         $this->addStaticRoute('/^' . $searchBase . '/', 'index', 'search');
     }
     // Forward certain request directly to WP
     $this->addStaticRoute('/^index.php/i', 'forward');
     $this->addStaticRoute('/^wp-content\\/(.*)/i', 'forwardFile');
     $this->addStaticRoute('/^wp-includes\\/(.*)/i', 'forwardFile');
     $this->addStaticRoute('/^wp-cron.php.*/', 'forwardFile');
     $this->addStaticRoute('/^wp-admin[\\/]{0,1}$/', 'wpAdmin');
     $this->addStaticRoute('/^wp-pass.php.*/', 'applyPostPassword');
     $this->addStaticRoute('/^robots.txt$/i', 'robots');
     $this->addStaticRoute('/^sitemap.xml$/', 'magentoXmlSitemap');
     return parent::_initStaticRoutes();
 }