本文整理汇总了PHP中ZendT_Lib::formatNameObject方法的典型用法代码示例。如果您正苦于以下问题:PHP ZendT_Lib::formatNameObject方法的具体用法?PHP ZendT_Lib::formatNameObject怎么用?PHP ZendT_Lib::formatNameObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZendT_Lib
的用法示例。
在下文中一共展示了ZendT_Lib::formatNameObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderLayout
/**
* Renderiza a visão
*
* @return bool
*/
public function renderLayout()
{
ob_start();
$this->_renderView();
if (!$this->_noRenderLayout) {
$filename = $this->_layoutDirectory . '/' . ZendT_Lib::formatNameObject($this->_layout) . '.phtml';
$result = (require $filename);
if (!$result) {
throw new ZendT_Exception('Invalid Layout in "' . $filename . '" ');
}
$reponse = ob_get_clean();
} else {
$reponse = ob_get_clean();
}
return $reponse;
}
示例2: dispatch
/**
* Providencia o roteamento
*
* @throws ZendT_Exception
*/
public function dispatch()
{
try {
/**
* Detecta os parâmetros de url rewrite
*/
$pathInfo = $this->getRequest()->getPathInfo();
$_paramRewrite = explode('/', $pathInfo);
$uriModule = $_paramRewrite[1];
$uriController = $_paramRewrite[2];
$uriAction = $_paramRewrite[3];
unset($_paramRewrite[0]);
unset($_paramRewrite[1]);
unset($_paramRewrite[2]);
unset($_paramRewrite[3]);
$module = ZendT_Lib::formatNameObject($uriModule);
$controller = ZendT_Lib::formatNameObject($uriController);
$action = ZendT_Lib::formatNameObject($uriAction, true);
if (!is_dir($this->_moduleDirectory . '/' . $module)) {
$module = ucfirst($this->_moduleNameDefault);
$uriModule = $this->_moduleNameDefault;
}
if (!file_exists($this->_moduleDirectory . '/' . $module . '/Controller/' . $controller . '.php')) {
$controller = ucfirst($this->_controllerNameDefault);
$uriController = $this->_controllerNameDefault;
}
$className = $module . '_Controller_' . $controller;
$options = array();
$options['module'] = $uriModule;
$options['controller'] = $uriController;
$options['action'] = $uriAction;
$options['moduleDirectory'] = $this->_moduleDirectory;
$options['layoutDirectory'] = $this->_layoutDirectory;
$_controller = new $className($this->getRequest(), $this->getResponse(), $options);
$action .= 'Action';
if (!method_exists($_controller, $action)) {
$action = $this->_actionNameDefault . 'Action';
if (!method_exists($_controller, $action . 'Action')) {
throw new ZendT_Exception('Action invalid!');
} else {
$uriAction = $this->_actionNameDefault;
}
}
$this->getRequest()->setParam('module', $uriModule);
$this->getRequest()->setParam('controller', $uriController);
$this->getRequest()->setParam('action', $uriAction);
$_controller->_init();
$result = call_user_method($action, $_controller);
if (is_array($result)) {
foreach ($result as $key => $value) {
$_controller->view->{$key} = $value;
}
}
$this->getResponse()->setBody($_controller->view->render());
foreach ($this->_headers as $name => $value) {
$this->getResponse()->setHeader($name, $value);
}
echo $this->getResponse()->sendResponse();
} catch (Exception $ex) {
echo $ex->getMessage();
}
}