_values['title'] = $title; $this->_setSlug($title); } /** * Set the slug, will automatically be normalized * * @param string $slug * @return void */ protected function _setSlug($slug) { $slug = iconv('utf-8', 'ascii//translit', $slug); $slug = strtolower($slug); $slug = preg_replace('#[^a-z0-9\-_]#', '-', $slug); $slug = preg_replace('#-{2,}#', '-', $slug); $this->_values['slug'] = $slug; } /** * Get the perment URL * * @return string */ protected function _getPermanentUrl() { if (!isset($this->_values['permanentUrl'])) { $urlHelper = new Zend_View_Helper_Url(); $this->_values['permanentUrl'] = $urlHelper->url(array( 'year' => $this->datetime->get('yyyy'), 'month' => $this->datetime->get('MM'), 'day' => $this->datetime->get('dd'), 'slug' => $this->slug ), 'blog-article'); } return $this->_values['permanentUrl']; } /** * Get the absolute permanent URL * * @return string */ protected function _getAbsolutePermanentUrl() { $front = Zend_Controller_Front::getInstance(); $request = $front->getRequest(); $baseUri = $request->getScheme() . '://' . $request->getHttpHost(); return $baseUri . $this->permanentUrl; } }