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


PHP AgaviToolkit::canonicalName方法代码示例

本文整理汇总了PHP中AgaviToolkit::canonicalName方法的典型用法代码示例。如果您正苦于以下问题:PHP AgaviToolkit::canonicalName方法的具体用法?PHP AgaviToolkit::canonicalName怎么用?PHP AgaviToolkit::canonicalName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AgaviToolkit的用法示例。


在下文中一共展示了AgaviToolkit::canonicalName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

 /**
  * Executes the task.
  */
 public function main()
 {
     if ($this->property === null) {
         throw new BuildException('The property attribute must be specified');
     }
     if ($this->string === null) {
         throw new BuildException('The string attribute must be specified');
     }
     $result = str_replace('/', '_', AgaviToolkit::canonicalName($this->string));
     $this->project->setUserProperty($this->property, $result);
 }
开发者ID:horros,项目名称:agavi,代码行数:14,代码来源:AgaviTransformviewclassbaseTask.php

示例2: getActionClass

 private function getActionClass($moduleName, $actionName)
 {
     $actionName = AgaviToolkit::canonicalName($actionName);
     $longActionName = str_replace('/', '_', $actionName);
     $class = $moduleName . '_' . $longActionName . 'Action';
     if (!class_exists($class)) {
         if (false !== ($file = AppKitAgaviUtil::getAgaviControllerInstance()->checkActionFile($moduleName, $actionName))) {
             require $file;
         } else {
             throw new AgaviException('Could not find file for Action "' . $actionName . '" in module "' . $moduleName . '"');
         }
         if (!class_exists($class, false)) {
             throw new AgaviException('Could not find Action "' . $longActionName . '" for module "' . $moduleName . '"');
         }
     }
     return $class;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:17,代码来源:AppKitApiProviderParser.class.php

示例3: assertViewForwards

 /**
  * assert that the view forwards to the given module/action
  * 
  * @param      string the expected module name
  * @param      string the expected action name
  * @param      string the message to emit on failure
  *
  * @author     Felix Gilcher <felix.gilcher@bitextender.com>
  * @since      1.0.0
  */
 protected function assertViewForwards($expectedModule, $expectedAction, $message = 'Failed asserting that the view forwards to "%1$s" "%2$s".')
 {
     if (!$this->viewResult instanceof AgaviExecutionContainer) {
         $this->fail(sprintf($message, $expectedModule, $expectedAction));
     }
     $this->assertEquals($expectedModule, $this->viewResult->getModuleName());
     $this->assertEquals(AgaviToolkit::canonicalName($expectedAction), $this->viewResult->getActionName());
 }
开发者ID:horros,项目名称:agavi,代码行数:18,代码来源:AgaviViewTestCase.class.php

示例4: normalizeViewName

 /**
  * normalizes a viewname according to the configured rules
  * 
  * Please do not use this method, it exists only for internal 
  * purposes and will be removed ASAP. You have been warned
  * 
  * @param      string the short view name
  * 
  * @return     string the full view name
  * 
  * @author     Felix Gilcher <felix.gilcher@bitextender.com>
  * @since      1.0.0
  */
 protected function normalizeViewName($shortName)
 {
     if ($shortName !== AgaviView::NONE) {
         $shortName = AgaviToolkit::evaluateModuleDirective($this->moduleName, 'agavi.view.name', array('actionName' => $this->actionName, 'viewName' => $shortName));
         $shortName = AgaviToolkit::canonicalName($shortName);
     }
     return $shortName;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:21,代码来源:AgaviFragmentTestCase.class.php

示例5: getParametersForActionAndModule

 /**
  * Get validation information from agavi for the given action and module
  * name for the request method 'read'.
  *
  * @author Jan Schütze <jans@dracoblue.de>
  *
  * @param string $action name of action
  * @param string $module name of module
  *
  * @return array of parameters for all registered validators
  */
 protected function getParametersForActionAndModule($action, $module, $method = 'read')
 {
     /*
      * Agavi uses different coding standard, so we ignore the following...
      *
      * @codingStandardsIgnoreStart
      */
     $parameters = array();
     $this->getContext()->getController()->initializeModule($module);
     $validationManager = $this->getContext()->createInstanceFor('validation_manager');
     $validationConfig = \AgaviToolkit::evaluateModuleDirective($module, 'agavi.validate.path', array('moduleName' => $module, 'actionName' => \AgaviToolkit::canonicalName($action)));
     if (is_readable($validationConfig)) {
         require \AgaviConfigCache::checkConfig($validationConfig, $this->getContext()->getName());
     }
     foreach ($validationManager->getChilds() as $validator) {
         $property = new \ReflectionProperty(get_class($validator), 'arguments');
         $property->setAccessible(true);
         $arguments = $property->getValue($validator);
         $parameters[] = array('name' => implode(', ', $arguments), 'class' => $validator->getParameter('class'), 'required' => $validator->getParameter('required', 'true'), 'description' => $validator->getParameter('description', null), 'base' => $validator->getParameter('base', null));
     }
     /*
      * @codingStandardsIgnoreEnd
      */
     return $parameters;
 }
开发者ID:honeybee,项目名称:honeybee-agavi-cmf-vendor,代码行数:36,代码来源:Error404SuccessView.class.php

示例6: getModel

 /**
  * Retrieve a Model implementation instance.
  *
  * @param      string A model name.
  * @param      string A module name, if the requested model is a module model,
  *                    or null for global models.
  * @param      array  An array of parameters to be passed to initialize() or
  *                    the constructor.
  *
  * @return     AgaviModel A Model implementation instance.
  *
  * @throws     AgaviAutloadException if class is ultimately not found.
  *
  * @author     David Zülke <dz@bitxtender.com>
  * @since      0.11.0
  */
 public function getModel($modelName, $moduleName = null, array $parameters = null)
 {
     $origModelName = $modelName;
     $modelName = AgaviToolkit::canonicalName($modelName);
     $class = str_replace('/', '_', $modelName) . 'Model';
     $file = null;
     $rc = null;
     if ($moduleName === null) {
         // global model
         // let's try to autoload that baby
         if (!class_exists($class)) {
             // it's not there. the hunt is on
             $file = AgaviConfig::get('core.model_dir') . '/' . $modelName . 'Model.class.php';
         }
     } else {
         try {
             $this->controller->initializeModule($moduleName);
         } catch (AgaviDisabledModuleException $e) {
             // swallow, this will load the modules autoload but throw an exception
             // if the module is disabled.
         }
         // module model
         // alternative name
         $class = $moduleName . '_' . $class;
         // let's try to autoload the baby
         if (!class_exists($class)) {
             // it's not there. the hunt is on
             $file = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/models/' . $modelName . 'Model.class.php';
         }
     }
     if (null !== $file && is_readable($file)) {
         require $file;
     }
     if (!class_exists($class)) {
         // it's not there.
         throw new AgaviAutoloadException(sprintf("Couldn't find class for Model %s", $origModelName));
     }
     // so if we're here, we found something, right? good.
     $rc = new ReflectionClass($class);
     if ($rc->implementsInterface('AgaviISingletonModel')) {
         // it's a singleton
         if (!isset($this->singletonModelInstances[$class])) {
             // no instance yet, so we create one
             if ($parameters === null || $rc->getConstructor() === null) {
                 // it has an initialize() method, or no parameters were given, so we don't hand arguments to the constructor
                 $this->singletonModelInstances[$class] = new $class();
             } else {
                 // we use this approach so we can pass constructor params or if it doesn't have an initialize() method
                 $this->singletonModelInstances[$class] = $rc->newInstanceArgs($parameters);
             }
         }
         $model = $this->singletonModelInstances[$class];
     } else {
         // create an instance
         if ($parameters === null || $rc->getConstructor() === null) {
             // it has an initialize() method, or no parameters were given, so we don't hand arguments to the constructor
             $model = new $class();
         } else {
             // we use this approach so we can pass constructor params or if it doesn't have an initialize() method
             $model = $rc->newInstanceArgs($parameters);
         }
     }
     if (is_callable(array($model, 'initialize'))) {
         // pass the constructor params again. dual use for the win
         $model->initialize($this, (array) $parameters);
     }
     return $model;
 }
开发者ID:horros,项目名称:agavi,代码行数:84,代码来源:AgaviContext.class.php

示例7: testCanonicalName

 public function testCanonicalName()
 {
     $this->assertEquals('path', AgaviToolkit::canonicalName("path"));
     $this->assertEquals('/path/warm/hot/unbearable', AgaviToolkit::canonicalName("/path/warm/hot/unbearable"));
     $this->assertEquals('path/warm/hot/unbearable', AgaviToolkit::canonicalName("path.warm.hot.unbearable"));
     $this->assertEquals('/path//warm/hot///unbearable', AgaviToolkit::canonicalName(".path..warm.hot...unbearable"));
 }
开发者ID:horros,项目名称:agavi,代码行数:7,代码来源:AgaviToolkitTest.php

示例8: setViewName

 /**
  * Set the module name for this container.
  *
  * @param      string A view name.
  *
  * @author     David Zülke <dz@bitxtender.com>
  * @since      0.11.0
  */
 public function setViewName($viewName)
 {
     if (null === $viewName) {
         $this->viewName = null;
     } elseif (preg_match(self::SANE_VIEW_NAME, $viewName)) {
         $viewName = AgaviToolkit::canonicalName($viewName);
         $this->viewName = $viewName;
     } else {
         throw new AgaviException(sprintf('Invalid view name "%1$s"', $viewName));
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:19,代码来源:AgaviExecutionContainer.class.php

示例9: modelExists

 /**
  * Indicates whether or not a module has a specific model.
  *
  * @param      string A module name.
  * @param      string A model name.
  *
  * @return     bool true, if the model exists, otherwise false.
  *
  * @author     Sean Kerr <skerr@mojavi.org>
  * @since      0.9.0
  */
 public function modelExists($moduleName, $modelName)
 {
     $modelName = AgaviToolkit::canonicalName($modelName);
     $file = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/models/' . $modelName . 'Model.class.php';
     return is_readable($file);
 }
开发者ID:horros,项目名称:agavi,代码行数:17,代码来源:AgaviController.class.php


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