ILIAS  Release_4_0_x_branch Revision 61816
 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.

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(), and PHPExcel_Reader_Serialized\fileSupportsUnserializePHPExcel().

{
// 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.

Referenced by PHPExcel_Reader_Excel2007\load().

{
// Returnvalue
$returnValue = '';
// Try using realpath()
$returnValue = realpath($pFilename);
// Found something?
if ($returnValue == '' || is_null($returnValue)) {
$pathArray = split('/' , $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 caller graph for this function:


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