private static function getLatestContentVersion() { if (is_null(self::$latestVersion)) { $filename = Zend_Registry::get("contentdir") . '/latest'; if (!file_exists($filename) && !is_link($filename)) { self::$latestVersion = 'Unavailable'; } self::$latestVersion = basename(readlink($filename)); } return self::$latestVersion; }
public function getAction() { $regex = $this->getInvokeArg('bootstrap')->getOption('paramregex'); //if (preg_match($regex['contentid'], $this->_getParam('id')) === 0) // throw new Exception('Illegal Content Id.'); if (preg_match("^(latest|[0-9]+)\$", $this->_getParam('id')) === 0) { throw new Exception('Illegal Content Id.'); } $version = $this->_getParam('id'); $data = $this->getEmptyResult(); $data['results'] = Application_Model_ContentPeer::getContentForVersion($version); $this->getResponse()->setBody(json_encode($data)); $this->getResponse()->setHttpResponseCode(200); }