本文整理汇总了PHP中Zend_Filter_Inflector::setThrowTargetExceptionsOn方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Filter_Inflector::setThrowTargetExceptionsOn方法的具体用法?PHP Zend_Filter_Inflector::setThrowTargetExceptionsOn怎么用?PHP Zend_Filter_Inflector::setThrowTargetExceptionsOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Filter_Inflector
的用法示例。
在下文中一共展示了Zend_Filter_Inflector::setThrowTargetExceptionsOn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extendsAction
public function extendsAction()
{
$request = $this->Request();
$moduleName = 'backend';
$controllerName = $this->Request()->getParam('baseController');
$inflector = new Zend_Filter_Inflector(':module/:controller/:file:suffix');
$inflector->setRules(array(
':module' => array('Word_CamelCaseToUnderscore', 'StringToLower'),
':controller' => array('Word_CamelCaseToUnderscore', 'StringToLower'),
':file' => array('Word_CamelCaseToUnderscore', 'StringToLower'),
'suffix' => '.js'
));
$inflector->setThrowTargetExceptionsOn(false);
$fileNames = (array) $request->getParam('file');
if(empty($fileNames)) {
return;
}
$this->Response()->setHeader('Content-Type', 'application/javascript; charset=utf-8', true);
$template = 'snippet:string:';
$this->View()->Engine()->setCompileId($this->View()->Engine()->getCompileId() . '_' . $this->Request()->getControllerName());
foreach($fileNames as $fileName) {
$fileName = ltrim(dirname($fileName) . '/' . basename($fileName, '.js'), '/.');
if (empty($fileName)) {
continue;
}
$templateBase = $inflector->filter(array(
'module' => $moduleName,
'controller' => $controllerName,
'file' => $fileName)
);
$templateExtend = $inflector->filter(array(
'module' => $moduleName,
'controller' => $this->Request()->getControllerName(),
'file' => $fileName)
);
if($this->View()->templateExists($templateBase)) {
$template .= '{include file="' . $templateBase. '"}' . "\n";
}
if($this->View()->templateExists($templateExtend)) {
$template .= '{include file="' . $templateExtend. '"}' . "\n";
}
}
$toFind = $this->Request()->getParam('find');
$toReplace = $this->Request()->getParam('replace');
$toFind = rtrim($toFind, '.') . '.';
$toReplace = rtrim($toReplace, '.') . '.';
$this->View()->setTemplate();
$template = $this->View()->fetch($template);
$template = str_replace($toFind, $toReplace, $template);
echo $template;
}
示例2: getTemplateName
/**
* Returns the template name.
*
* @return string
*/
public function getTemplateName()
{
$request = $this->viewRenderer->Action()->Request();
$dispatcher = $this->viewRenderer->Front()->Dispatcher();
$moduleName = $dispatcher->formatModuleName($request->getModuleName());
$controllerName = $dispatcher->formatControllerName($request->getControllerName());
$inflector = new Zend_Filter_Inflector($this->target);
$inflector->setRules($this->filterRules);
$inflector->setThrowTargetExceptionsOn(false);
$fileNames = (array) $request->getParam('file', $this->defaultFile);
$templateNames = array();
foreach ($fileNames as $fileName) {
$fileName = ltrim(dirname($fileName) . '/' . basename($fileName, '.js'), '/.');
if (empty($fileName)) {
continue;
}
$templateNames[] = $inflector->filter(array('module' => $moduleName, 'controller' => $controllerName, 'file' => $fileName));
}
$count = count($templateNames);
if ($count === 0) {
return null;
} elseif ($count === 1) {
return $templateNames[0];
} else {
return 'snippet:string:{include file="' . implode("\"}\n{include file=\"", $templateNames) . '"}';
}
}
示例3: getTemplateName
/**
* Returns the template name.
*
* @return string
*/
public function getTemplateName()
{
$request = $this->viewRenderer->Action()->Request();
$dispatcher = $this->viewRenderer->Front()->Dispatcher();
$moduleName = $dispatcher->formatModuleName($request->getModuleName());
$controllerName = $dispatcher->formatControllerName($request->getControllerName());
$inflector = new Zend_Filter_Inflector($this->target);
$inflector->setRules($this->filterRules);
$inflector->setThrowTargetExceptionsOn(false);
$fileName = $request->getParam('file', $this->defaultFile);
$fileName = ltrim(dirname($fileName) . '/' . basename($fileName, '.js'), '/.');
if (empty($fileName)) {
return null;
}
$templateName = $inflector->filter(array('module' => $moduleName, 'controller' => $controllerName, 'file' => $fileName));
return $templateName;
}