ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Shared_File Class Reference
+ Collaboration diagram for PHPExcel_Shared_File:

Static Public Member Functions

static file_exists ($pFilename)
 Verify if a file exists.
static realpath ($pFilename)
 Returns canonicalized absolute pathname, also for ZIP archives.
static sys_get_temp_dir ()
 Get the systems temporary directory.

Detailed Description

Definition at line 36 of file File.php.

Member Function Documentation

static PHPExcel_Shared_File::file_exists (   $pFilename)
static

Verify if a file exists.

Parameters
string$pFilenameFilename
Returns
bool

Definition at line 44 of file File.php.

Referenced by PHPExcel_Writer_Excel2007_ContentTypes\_getImageMimeType(), realpath(), and sys_get_temp_dir().

{
// Sick construction, but it seems that
// file_exists returns strange values when
// doing the original file_exists on ZIP archives...
if ( strtolower(substr($pFilename, 0, 3)) == 'zip' ) {
// Open ZIP file and verify if the file exists
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
$zip = new ZipArchive();
if ($zip->open($zipFile) === true) {
$returnValue = ($zip->getFromName($archiveFile) !== false);
$zip->close();
return $returnValue;
} else {
return false;
}
} else {
// Regular file_exists
return file_exists($pFilename);
}
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_File::realpath (   $pFilename)
static

Returns canonicalized absolute pathname, also for ZIP archives.

Parameters
string$pFilename
Returns
string

Definition at line 73 of file File.php.

References file_exists().

Referenced by PHPExcel_Reader_Excel2007\_getFromZipArchive(), PHPExcel_Reader_Excel2007\load(), and sys_get_temp_dir().

{
// Returnvalue
$returnValue = '';
// Try using realpath()
if (file_exists($pFilename)) {
$returnValue = realpath($pFilename);
}
// Found something?
if ($returnValue == '' || is_null($returnValue)) {
$pathArray = explode('/' , $pFilename);
while(in_array('..', $pathArray) && $pathArray[0] != '..') {
for ($i = 0; $i < count($pathArray); ++$i) {
if ($pathArray[$i] == '..' && $i > 0) {
unset($pathArray[$i]);
unset($pathArray[$i - 1]);
break;
}
}
}
$returnValue = implode('/', $pathArray);
}
// Return
return $returnValue;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Shared_File::sys_get_temp_dir ( )
static

Get the systems temporary directory.

Returns
string

Definition at line 106 of file File.php.

References file_exists(), and realpath().

Referenced by PHPExcel_Shared_OLE_PPS_Root\__construct(), PHPExcel_CachedObjectStorage_DiscISAM\__construct(), PHPExcel_Writer_PDF\__construct(), PHPExcel_CachedObjectStorage_DiscISAM\copyCellCollection(), and PHPExcel_Shared_ZipArchive\open().

{
// sys_get_temp_dir is only available since PHP 5.2.1
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
if ( !function_exists('sys_get_temp_dir')) {
if ($temp = getenv('TMP') ) {
if (file_exists($temp)) { return realpath($temp); }
}
if ($temp = getenv('TEMP') ) {
if (file_exists($temp)) { return realpath($temp); }
}
if ($temp = getenv('TMPDIR') ) {
if (file_exists($temp)) { return realpath($temp); }
}
// trick for creating a file in system's temporary dir
// without knowing the path of the system's temporary dir
$temp = tempnam(__FILE__, '');
if (file_exists($temp)) {
unlink($temp);
return realpath(dirname($temp));
}
return null;
}
// use ordinary built-in PHP function
// There should be no problem with the 5.2.4 Suhosin realpath() bug, because this line should only
// be called if we're running 5.2.1 or earlier
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: