/** * If Integrated search is installed, redirect if enabled * * @return $this */ public function preDispatch() { if (Mage::helper('wordpress')->isAddonInstalled('IntegratedSearch') && Mage::getStoreConfigFlag('wordpress/integratedsearch/blog')) { $this->_forceForwardViaException('index', 'result', 'catalogsearch', array('q' => Mage::helper('wordpress/router')->getTrimmedUri('search'))); } return parent::preDispatch(); }
protected function _init() { if (!$this->_initPostModel()) { return false; } if ($this->isFeedPage()) { $this->_forward('commentFeed'); return false; } $this->_checkForPostedComment(); parent::_init(); if ($post = $this->_getPost()) { $this->_title($post->getPageTitle()); if ($headBlock = $this->getLayout()->getBlock('head')) { $headBlock->setDescription($post->getMetaDescription()); $headBlock->setKeywords($post->getMetaKeywords()); } $this->_addCrumb('post', array('label' => $post->getPostTitle())); $this->_addCanonicalLink($post->getPermalink()); if ($headBlock = $this->_getBlock('head')) { $feedTitle = sprintf('%s » %s Comments Feed', Mage::helper('wordpress')->getCachedWpOption('blogname'), $post->getPostTitle()); $headBlock->addItem('link_rel', $post->getCommentFeedUrl(), 'rel="alternate" type="application/rss+xml" title="' . $feedTitle . '"'); } } }
/** * List all tags with associated posts * */ public function listAction() { parent::_init(); $this->_title($this->__('Tag Archives')); $this->_addCrumb('tags', array('link' => Mage::helper('wordpress/post')->getTagsUrl(), 'label' => $this->__('Tags'))); $this->_addCanonicalLink(Mage::helper('wordpress/post')->getTagsUrl()); $this->renderLayout(); }
/** * Initialise the current category */ protected function _init() { parent::_init(); if ($author = $this->_initAuthor()) { $this->_title($author->getDisplayName())->_addCrumb('author_nolink', array('label' => $this->__('Author')))->_addCrumb('author', array('link' => $author->getUrl(), 'label' => $author->getDisplayName()))->_addCanonicalLink($author->getUrl()); return true; } $this->throwInvalidObjectException('author'); }
/** * Sets a custom root template (if set) * * @return Fishpig_Wordpress_Controller_Abstract */ public function setCustomRootTemplate() { if ($template = Mage::getStoreConfig('wordpress_blog/layout/template_post_list')) { if ($this->_setCustomRootTemplate($template)) { return $this; } } return parent::setCustomRootTemplate(); }
/** * If not feed, display the blog homepage * */ public function indexAction() { if ($this->isFeedPage()) { $this->_forward('index', 'feed'); } else { parent::indexAction(); } }
/** * If a term has been initiated in self_initPostCategory * forward to wordpress/term/view action * * @return $this */ public function preDispatch() { parent::preDispatch(); if (($term = Mage::registry('wordpress_term')) !== null) { $this->_forceForwardViaException('view', 'term'); return false; } return $this; }
/** * If the feed parameter is set, forward to the comments action * * @return $this */ public function preDispatch() { parent::preDispatch(); if ($this->_initPage()->isBlogPage()) { $this->_forceForwardViaException('index', 'index'); return false; } return $this; }
/** * Display appropriate message for posted comment * * @return $this */ public function preDispatch() { parent::preDispatch(); $this->_handlePostedComment(); $post = $this->getEntityObject(); if ($post->isType('page') && (int) $post->getId() === (int) Mage::helper('wordpress/router')->getBlogPageId()) { return $this->_forward('index', 'index', 'wordpress'); } return $this; }
/** * Display appropriate message for posted comment * * @return $this */ public function preDispatch() { parent::preDispatch(); $this->_handlePostedComment(); $post = $this->getEntityObject(); if ($post->isBlogListingPage()) { return $this->_forward('index', 'index', 'wordpress'); } return $this; }
/** * Ensure that the term loaded isn't a default term * Default terms (post_category, tag etc) have their own controller * * @return $this|false */ public function preDispatch() { parent::preDispatch(); $term = $this->_initTerm(); if ($term->isDefaultTerm()) { $this->_forceForwardViaException('noRoute'); return false; } return $this; }
/** * If the feed parameter is set, forward to the comments action * * @return $this */ public function preDispatch() { parent::preDispatch(); $page = $this->_initPage(); if (!Mage::getStoreConfigFlag('wordpress_blog/layout/ignore_custom_homepage')) { if ($page->isBlogPage()) { $this->_forceForwardViaException('index', 'index'); return false; } } return $this; }
/** * If Integrated search is installed, redirect if enabled * * @return $this */ public function preDispatch() { if ($this->getRequest()->getParam('redirect_broken_url')) { $this->getResponse()->setRedirect(Mage::helper('wordpress')->getUrl('search/' . $this->getRequest()->getParam('s') . '/'))->sendResponse(); $this->getRequest()->setDispatched(true); } else { if (Mage::helper('wordpress')->isAddonInstalled('IntegratedSearch') && Mage::getStoreConfigFlag('wordpress/integratedsearch/blog')) { $this->_forceForwardViaException('index', 'result', 'catalogsearch', array('q' => $this->getRequest()->getParam('s'))); } } return parent::preDispatch(); }
/** * Initialise the current category */ protected function _init() { parent::_init(); if ($archive = $this->_initArchive()) { $this->_title($archive->getName()) ->_addCrumb('archive', array('link' => $archive->getUrl(), 'label' => $archive->getName())) ->_addCanonicalLink($archive->getUrl()); } else { $this->throwInvalidObjectException('author'); } }
/** * Initialise the current category */ protected function _init() { parent::_init(); $helper = Mage::helper('wordpress/search'); $routerHelper = $this->getRouterHelper(); if ($searchValue = $routerHelper->getTrimmedUri('search')) { $this->getRequest()->setParam($helper->getQueryVarName(), $searchValue); } $label = $this->__("Search results for: '%s'", $helper->getEscapedSearchString()); $this->_title($label); $this->_addCrumb('blog_search', array('link' => '', 'label' => $label)); return true; }
/** * Iterate through the array and apply the values to page's meta info * * @param array $meta * @return $this */ protected function _applyMeta(array $meta) { if (($headBlock = $this->_getHeadBlock()) !== false) { foreach ($meta as $key => $value) { if (($value = trim($value)) === '') { continue; } if (($value = $this->_rewriteString($value)) !== false) { $headBlock->setData($key, $value); if ($key === 'title') { $this->_action->ignoreAutomaticTitles(); } } } } return $this; }
/** * Ensure that this controller can run * * @return $this */ public function preDispatch() { parent::preDispatch(); if ($this->getRequest()->getActionName() === 'index') { if (!Mage::registry('wordpress_page')) { if (Mage::helper('wordpress')->getWpOption('show_on_front')) { if ($pageId = Mage::helper('wordpress')->getWpOption('page_on_front')) { $page = Mage::getModel('wordpress/page')->load($pageId); if ($page->getId()) { Mage::register('wordpress_page', $page); $this->_forceForwardViaException('view', 'page'); return false; } } } } } return $this; }
/** * Initialise the current category */ protected function _init() { if ($category = $this->_loadCategoryBasedOnUrl()) { if (!Mage::helper('wordpress')->isLegacyMagento()) { $this->_addCustomLayoutHandles(array('wordpress_category_index', 'WORDPRESS_CATEGORY_'.$category->getId())); } // Add base breacrumbs and title parent::_init(); $this->_title($category->getName()); $this->_addCrumb('category', array('link' => $category->getUrl(), 'label' => $category->getName())); $this->_addCanonicalLink($category->getUrl()); return $this; } else { $this->throwInvalidObjectException('category'); } }
/** * Ensure that the term loaded isn't a default term * Default terms (post_category, tag etc) have their own controller * * @return $this|false */ public function preDispatch() { parent::preDispatch(); $term = $this->_initTerm(); return $this; }
/** * Display appropriate message for posted comment * * @return $this */ public function preDispatch() { $this->_handlePostedComment(); return parent::preDispatch(); }