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


PHP AgaviToolkit::isPathAbsolute方法代码示例

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


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

示例1: getResourceStreamIdentifier

 /**
  * Get the full, resolved stream location name to the template resource.
  *
  * @return     string A PHP stream resource identifier.
  *
  * @throws     AgaviException If the template could not be found.
  *
  * @author     David Zülke <dz@bitxtender.com>
  * @since      0.11.0
  */
 public function getResourceStreamIdentifier()
 {
     $retval = null;
     $template = $this->getParameter('template');
     if ($template === null) {
         // no template set, we return null so nothing gets rendered
         return null;
     } elseif (AgaviToolkit::isPathAbsolute($template)) {
         // the template is an absolute path, ignore the dir
         $directory = dirname($template);
         $template = basename($template);
     } else {
         $directory = $this->getParameter('directory');
     }
     // treat the directory as sprintf format string and inject module name
     $directory = AgaviToolkit::expandVariables($directory, array_merge(array_filter($this->getParameters(), 'is_scalar'), array_filter($this->getParameters(), 'is_null')));
     $this->setParameter('directory', $directory);
     $this->setParameter('template', $template);
     if (!$this->hasParameter('extension')) {
         $this->setParameter('extension', $this->renderer->getDefaultExtension());
     }
     // everything set up for the parent
     return parent::getResourceStreamIdentifier();
 }
开发者ID:horros,项目名称:agavi,代码行数:34,代码来源:AgaviFileTemplateLayer.class.php

示例2: replacePath

 /**
  * Replace a relative filesystem path with an absolute one.
  *
  * @param      string A relative filesystem path.
  *
  * @return     string The new path.
  *
  * @author     Sean Kerr <skerr@mojavi.org>
  * @since      0.9.0
  */
 public static function replacePath($path)
 {
     if (!AgaviToolkit::isPathAbsolute($path)) {
         // not an absolute path so we'll prepend to it
         $path = AgaviConfig::get('core.app_dir') . '/' . $path;
     }
     return $path;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:18,代码来源:AgaviBaseConfigHandler.class.php

示例3: validateXsi

 /**
  * Validate a given document according to XMLSchema-instance (xsi)
  * declarations.
  *
  * @param      AgaviXmlConfigDomDocument The document to act upon.
  *
  * @author     David Zülke <dz@bitxtender.com>
  * @author     Noah Fontes <noah.fontes@bitextender.com>
  * @since      1.0.0
  */
 public static function validateXsi(AgaviXmlConfigDomDocument $document)
 {
     // next, find (and validate against) XML schema instance declarations
     $sources = array();
     if ($document->documentElement->hasAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')) {
         // find locations. for namespaces, they are space separated pairs of a namespace URI and a schema location
         $locations = preg_split('/\\s+/', $document->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation'));
         for ($i = 1; $i < count($locations); $i = $i + 2) {
             $sources[] = $locations[$i];
         }
     }
     // no namespace? then it's only one schema location in this attribute
     if ($document->documentElement->hasAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'noNamespaceSchemaLocation')) {
         $sources[] = $document->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'noNamespaceSchemaLocation');
     }
     if ($sources) {
         // we have instances to validate against...
         $schemas = array();
         foreach ($sources as &$source) {
             // so for each location, we need to grab the file and validate against this grabbed source code, as libxml often has a hard time retrieving stuff over HTTP
             $source = AgaviToolkit::expandDirectives($source);
             if (parse_url($source, PHP_URL_SCHEME) === null && !AgaviToolkit::isPathAbsolute($source)) {
                 // the schema location is relative to the XML file
                 $source = dirname($document->documentURI) . DIRECTORY_SEPARATOR . $source;
             }
             $schema = @file_get_contents($source);
             if ($schema === false) {
                 throw new AgaviUnreadableException(sprintf('XML Schema validation file "%s" for configuration file "%s" does not exist or is unreadable', $source, $document->documentURI));
             }
             $schemas[] = $schema;
         }
         // now validate them all
         self::validateXmlschemaSource($document, $schemas);
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:45,代码来源:AgaviXmlConfigParser.class.php

示例4: createSuite

 /**
  * Initialize a suite from the given instructions and add registered tests.
  *
  * @param      string Name of the suite
  * @param      array  An array containing information about the suite
  *
  * @return     AgaviTestSuite The initialized test suite object.
  *
  * @author     Felix Gilcher <felix.gilcher@bitextender.com>
  * @since      1.0.0
  * @deprecated 1.1.0 Use AgaviPhpUnitCli
  */
 protected static function createSuite($name, array $suite)
 {
     $base = null == $suite['base'] ? 'tests' : $suite['base'];
     if (!AgaviToolkit::isPathAbsolute($base)) {
         $base = AgaviConfig::get('core.testing_dir') . '/' . $base;
     }
     $s = new $suite['class']($name);
     if (!empty($suite['includes'])) {
         foreach (new RecursiveIteratorIterator(new AgaviRecursiveDirectoryFilterIterator(new RecursiveDirectoryIterator($base), $suite['includes'], $suite['excludes']), RecursiveIteratorIterator::CHILD_FIRST) as $finfo) {
             if ($finfo->isFile()) {
                 $s->addTestFile($finfo->getPathName());
             }
         }
     }
     foreach ($suite['testfiles'] as $file) {
         if (!AgaviToolkit::isPathAbsolute($file)) {
             $file = $base . '/' . $file;
         }
         $s->addTestFile($file);
     }
     return $s;
 }
开发者ID:horros,项目名称:agavi,代码行数:34,代码来源:AgaviTesting.class.php

示例5: testIsPathAbsolute

 /**
  * @dataProvider pathData
  */
 public function testIsPathAbsolute($path, $expected)
 {
     if ($expected) {
         $this->assertTrue(AgaviToolkit::isPathAbsolute($path));
     } else {
         $this->assertFalse(AgaviToolkit::isPathAbsolute($path));
     }
 }
开发者ID:horros,项目名称:agavi,代码行数:11,代码来源:AgaviToolkitTest.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

示例7: createSuite

 /**
  * Initialize a suite from the given instructions and add registered tests.
  *
  * @param      string Name of the suite
  * @param      array  An array containing information about the suite
  *
  * @return     AgaviTestSuite The initialized test suite object.
  *
  * @author     Felix Gilcher <felix.gilcher@bitextender.com>
  * @author     Dominik del Bondio <dominik.del.bondio@bitextender.com>
  * @since      1.1.0
  */
 protected static function createSuite($name, array $suite)
 {
     $base = null == $suite['base'] ? 'tests' : $suite['base'];
     if (!AgaviToolkit::isPathAbsolute($base)) {
         $base = AgaviConfig::get('core.testing_dir') . '/' . $base;
     }
     $s = new $suite['class']($name);
     if (!empty($suite['includes'])) {
         $files = iterator_to_array(new RecursiveIteratorIterator(new AgaviRecursiveDirectoryFilterIterator(new RecursiveDirectoryIterator($base), $suite['includes'], $suite['excludes']), RecursiveIteratorIterator::CHILD_FIRST));
         // ensure that the execution order of the tests is always in deterministic
         // order and doesn't depend on the filesystem order
         usort($files, function ($a, $b) {
             return strcmp($a->getPathName(), $b->getPathName());
         });
         foreach ($files as $finfo) {
             if ($finfo->isFile()) {
                 $s->addTestFile($finfo->getPathName());
             }
         }
     }
     foreach ($suite['testfiles'] as $file) {
         if (!AgaviToolkit::isPathAbsolute($file)) {
             $file = $base . '/' . $file;
         }
         $s->addTestFile($file);
     }
     return $s;
 }
开发者ID:horros,项目名称:agavi,代码行数:40,代码来源:AgaviPhpUnitCli.class.php


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