当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Filter_Inflector::setThrowTargetExceptionsOn方法代码示例

本文整理汇总了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;
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:57,代码来源:ExtJs.php

示例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) . '"}';
     }
 }
开发者ID:nhp,项目名称:shopware-4,代码行数:32,代码来源:Bootstrap.php

示例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;
 }
开发者ID:nvdnkpr,项目名称:Enlight,代码行数:22,代码来源:Bootstrap.php


注:本文中的Zend_Filter_Inflector::setThrowTargetExceptionsOn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。