本文整理汇总了PHP中ezcBaseFile::isAbsolutePath方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcBaseFile::isAbsolutePath方法的具体用法?PHP ezcBaseFile::isAbsolutePath怎么用?PHP ezcBaseFile::isAbsolutePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcBaseFile
的用法示例。
在下文中一共展示了ezcBaseFile::isAbsolutePath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Processes the template with the variables added by the send() method.
* The result of this action should be retrievable through the getResult() method.
*
* The $last parameter is set if the view handler is the last one in the
* list of zones for a specific view.
*
* @param bool $last
*/
public function process($last)
{
if (!file_exists($this->templateLocation)) {
$fileName = ezcBaseFile::isAbsolutePath($this->templateLocation) ? $this->templateLocation : getcwd() . DIRECTORY_SEPARATOR . $this->templateLocation;
throw new ezcBaseFileNotFoundException($fileName, 'php template');
}
ob_start();
include $this->templateLocation;
$this->result = ob_get_contents();
ob_end_clean();
}
示例2: getFile
/**
* Check and return file
*
* Check for the files location, and return the absolute path to the file,
* or thorw an exception, if the file could not be found.
*
* @param string $file
* @return string
*/
protected function getFile($file)
{
if (!ezcBaseFile::isAbsolutePath($file)) {
// If path to file is not an absolute path, use the given relative
// path relative to the currently processed document location.
$file = $this->path . $file;
}
// @TODO: docutils performs automatic checks, that no system files
// (like /etc/passwd) are included - do we want to do similar stuff
// here?
// Throw an exception, if we cannot find the referenced file
if (!is_file($file) || !is_readable($file)) {
throw new ezcBaseFileNotFoundException($file);
}
return $file;
}
示例3: testAbsoluteLinux3
public static function testAbsoluteLinux3()
{
if (ezcBaseFeatures::os() === 'Windows') {
self::markTestSkipped('Test is for unix-like systems only');
}
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c://winnt//winnt.sys'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c:/winnt/winnt.sys'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c://winnt'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c://winnt.sys'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c:/winnt.sys'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c://winnt.sys'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c:/table.sys'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c:winnt'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('c//winnt.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('//winnt.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('/winnt.sys'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('winnt.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('//server/share/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('////server/share/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('//tequila/share/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('////tequila/share/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('//tequila/thare/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('////tequila/thare/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('//server//share/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('////server//share/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('//tequila//share/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('////tequila//share/foo.sys'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('/etc/init.d/apache'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('//etc//init.d//apache'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('etc/init.d/apache'));
self::assertEquals(false, ezcBaseFile::isAbsolutePath('etc//init.d//apache'));
}
示例4: testAbsoluteStreamWrapper
public static function testAbsoluteStreamWrapper()
{
self::assertEquals(true, ezcBaseFile::isAbsolutePath('phar://test.phar/foo'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('http://example.com/file'));
}
示例5: locateFile
/**
* Tries to locate a file
*
* Tries to locate a file, referenced in a docbook document. If available
* the document path is used a base for relative paths.
*
* @param string $file
* @return string
*/
public function locateFile($file)
{
if (!ezcBaseFile::isAbsolutePath($file)) {
$file = $this->document->getPath() . $file;
}
if (!is_file($file)) {
throw new ezcBaseFileNotFoundException($file);
}
return $file;
}