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


PHP AgaviToolkit::normalizePath方法代码示例

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


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

示例1: testNormalizePath

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

示例2: testCheckConfig

 public function testCheckConfig()
 {
     $config = AgaviConfig::get('core.config_dir') . DIRECTORY_SEPARATOR . 'autoload.xml';
     $config = AgaviToolkit::normalizePath($config);
     $expected = AgaviConfigCache::getCacheName($config);
     if (file_exists($expected)) {
         unlink($expected);
     }
     $cacheName = AgaviConfigCache::checkConfig($config);
     $this->assertEquals($expected, $cacheName);
     $this->assertFileExists($cacheName);
 }
开发者ID:horros,项目名称:agavi,代码行数:12,代码来源:AgaviConfigCacheTest.php

示例3: testConfigHandlersConfigHandler

 public function testConfigHandlersConfigHandler()
 {
     $hf = AgaviToolkit::normalizePath(AgaviConfig::get('core.config_dir') . '/routing.xml');
     $CHCH = new AgaviConfigHandlersConfigHandler();
     $document = $this->parseConfiguration(AgaviConfig::get('core.config_dir') . '/tests/config_handlers.xml', AgaviConfig::get('core.agavi_dir') . '/config/xsl/config_handlers.xsl');
     $file = $this->getIncludeFile($CHCH->execute($document));
     $handlers = (include $file);
     unlink($file);
     $this->assertCount(1, $handlers);
     $this->assertTrue(isset($handlers[$hf]));
     $this->assertSame('CHCHTestHandler', $handlers[$hf]['class']);
     $this->assertSame(AgaviConfig::get('core.agavi_dir') . '/config/xsd/routing.xsd', $handlers[$hf]['validations']['single']['transformations_after']['xml_schema'][0]);
     $this->assertSame(array('foo' => 'bar', 'dir' => AgaviConfig::get('core.agavi_dir')), $handlers[$hf]['parameters']);
 }
开发者ID:horros,项目名称:agavi,代码行数:14,代码来源:AgaviConfigHandlersConfigHandlerTest.php

示例4: execute

 /**
  * Execute this configuration handler.
  *
  * @param      AgaviXmlConfigDomDocument The document to handle.
  *
  * @return     string Data to be written to a cache file.
  *
  * @throws     <b>AgaviUnreadableException</b> If a requested configuration
  *                                             file does not exist or is not
  *                                             readable.
  * @throws     <b>AgaviParseException</b> If a requested configuration file is
  *                                        improperly formatted.
  *
  * @author     Dominik del Bondio <ddb@bitxtender.com>
  * @author     Noah Fontes <noah.fontes@bitextender.com>
  * @author     David Zülke <david.zuelke@bitextender.com>
  * @since      0.11.0
  */
 public function execute(AgaviXmlConfigDomDocument $document)
 {
     // set up our default namespace
     $document->setDefaultNamespace(self::XML_NAMESPACE, 'config_handlers');
     // init our data arrays
     $handlers = array();
     foreach ($document->getConfigurationElements() as $configuration) {
         if (!$configuration->has('handlers')) {
             continue;
         }
         // let's do our fancy work
         foreach ($configuration->get('handlers') as $handler) {
             $pattern = $handler->getAttribute('pattern');
             $category = AgaviToolkit::normalizePath(AgaviToolkit::expandDirectives($pattern));
             $class = $handler->getAttribute('class');
             $transformations = array(AgaviXmlConfigParser::STAGE_SINGLE => array(), AgaviXmlConfigParser::STAGE_COMPILATION => array());
             if ($handler->has('transformations')) {
                 foreach ($handler->get('transformations') as $transformation) {
                     $path = AgaviToolkit::literalize($transformation->getValue());
                     $for = $transformation->getAttribute('for', AgaviXmlConfigParser::STAGE_SINGLE);
                     $transformations[$for][] = $path;
                 }
             }
             $validations = array(AgaviXmlConfigParser::STAGE_SINGLE => array(AgaviXmlConfigParser::STEP_TRANSFORMATIONS_BEFORE => array(AgaviXmlConfigParser::VALIDATION_TYPE_RELAXNG => array(), AgaviXmlConfigParser::VALIDATION_TYPE_SCHEMATRON => array(), AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA => array()), AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER => array(AgaviXmlConfigParser::VALIDATION_TYPE_RELAXNG => array(), AgaviXmlConfigParser::VALIDATION_TYPE_SCHEMATRON => array(), AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA => array())), AgaviXmlConfigParser::STAGE_COMPILATION => array(AgaviXmlConfigParser::STEP_TRANSFORMATIONS_BEFORE => array(AgaviXmlConfigParser::VALIDATION_TYPE_RELAXNG => array(), AgaviXmlConfigParser::VALIDATION_TYPE_SCHEMATRON => array(), AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA => array()), AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER => array(AgaviXmlConfigParser::VALIDATION_TYPE_RELAXNG => array(), AgaviXmlConfigParser::VALIDATION_TYPE_SCHEMATRON => array(), AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA => array())));
             if ($handler->has('validations')) {
                 foreach ($handler->get('validations') as $validation) {
                     $path = AgaviToolkit::literalize($validation->getValue());
                     $type = null;
                     if (!$validation->hasAttribute('type')) {
                         $type = $this->guessValidationType($path);
                     } else {
                         $type = $validation->getAttribute('type');
                     }
                     $for = $validation->getAttribute('for', AgaviXmlConfigParser::STAGE_SINGLE);
                     $step = $validation->getAttribute('step', AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER);
                     $validations[$for][$step][$type][] = $path;
                 }
             }
             $handlers[$category] = isset($handlers[$category]) ? $handlers[$category] : array('parameters' => array());
             $handlers[$category] = array('class' => $class, 'parameters' => $handler->getAgaviParameters($handlers[$category]['parameters']), 'transformations' => $transformations, 'validations' => $validations);
         }
     }
     $data = array('return ' . var_export($handlers, true));
     return $this->generate($data, $document->documentURI);
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:63,代码来源:AgaviConfigHandlersConfigHandler.class.php

示例5: getValidatorXMLForAction

 /**
  * Fetches the Validation xml for the action/module combination and returns it as
  * an DOMDocument
  *
  * @param    string  The module name
  * @param    string  The action to get the validation xml for
  * @return   AgaviXmlConfigDomDocument
  *
  * @author   Jannis Moßhammer<jannis.mosshammer@netways.de>
  * @throws   AgaviConfigurationException     when module or action does not exist
  */
 protected function getValidatorXMLForAction($module, $action)
 {
     // get Module path
     $path = AgaviToolkit::literalize('%core.module_dir%') . "/" . $module;
     if (!file_exists(AgaviToolkit::normalizePath($path))) {
         throw new AgaviConfigurationException("Couldn't find module " . $module);
     }
     // get Validation file
     $actionPath = str_replace(".", "/", $action);
     $xml = $path . "/validate/" . $actionPath . ".xml";
     if (!file_exists(AgaviToolkit::normalizePath($path))) {
         throw new AgaviConfigurationException("Couldn't find validation file for " . $action);
     }
     $dom = new AgaviXmlConfigDomDocument();
     $dom->load(AgaviToolKit::normalizePath($xml));
     //TODO: Validate xml
     return $dom;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:29,代码来源:AppKitApiProviderParser.class.php

示例6: checkConfig

 /**
  * Check to see if a configuration file has been modified and if so
  * recompile the cache file associated with it.
  *
  * If the configuration file path is relative, the path itself is relative
  * to the Agavi "core.app_dir" application setting.
  *
  * @param      string A filesystem path to a configuration file.
  * @param      string An optional context name for which the config should be
  *                    read.
  *
  * @return     string An absolute filesystem path to the cache filename
  *                    associated with this specified configuration file.
  *
  * @throws     <b>AgaviUnreadableException</b> If a requested configuration
  *                                             file does not exist.
  *
  * @author     Sean Kerr <skerr@mojavi.org>
  * @since      0.9.0
  */
 public static function checkConfig($config, $context = null)
 {
     $config = AgaviToolkit::normalizePath($config);
     // the full filename path to the config, which might not be what we were given.
     $filename = AgaviToolkit::isPathAbsolute($config) ? $config : AgaviToolkit::normalizePath(AgaviConfig::get('core.app_dir')) . '/' . $config;
     if (!is_readable($filename)) {
         throw new AgaviUnreadableException('Configuration file "' . $filename . '" does not exist or is unreadable.');
     }
     // the cache filename we'll be using
     $cache = self::getCacheName($config, $context);
     if (self::isModified($filename, $cache)) {
         // configuration file has changed so we need to reparse it
         self::callHandler($config, $filename, $cache, $context);
     }
     return $cache;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:36,代码来源:AgaviConfigCache.class.php


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