Data Structures | |
| class | PGTStorageFile |
| The PGTStorageFile class is a class for PGT file storage. More... | |
Functions | |
| PGTStorageFile::getPath () | |
| This method returns the name of the directory where PGT's should be stored on the filesystem. | |
| PGTStorageFile::getFormat () | |
| This method returns the format to use when storing PGT's on the filesystem. | |
| PGTStorageFile::getStorageType () | |
| This method returns an informational string giving the type of storage used by the object (used for debugging purposes). | |
| PGTStorageFile::getStorageInfo () | |
| This method returns an informational string giving informations on the parameters of the storage. | |
| PGTStorageFile::PGTStorageFile ($cas_parent, $format, $path) | |
| The class constructor, called by CASClient::SetPGTStorageFile(). | |
| PGTStorageFile::init () | |
| This method is used to initialize the storage. | |
| PGTStorageFile::getPGTIouFilename ($pgt_iou) | |
| This method returns the filename corresponding to a PGT Iou. | |
| PGTStorageFile::write ($pgt, $pgt_iou) | |
| This method stores a PGT and its corresponding PGT Iou into a file. | |
| PGTStorageFile::read ($pgt_iou) | |
| This method reads a PGT corresponding to a PGT Iou and deletes the corresponding file. | |
Variables | |
| PGTStorageFile::$_path | |
| a string telling where PGT's should be stored on the filesystem. | |
| PGTStorageFile::$_format | |
| a string telling the format to use to store PGT's (plain or xml). | |
| PGTStorageFile::getFormat | ( | ) | [private, inherited] |
This method returns the format to use when storing PGT's on the filesystem.
Definition at line 61 of file pgt-file.php.
Referenced by PGTStorageFile::getPGTIouFilename().
{
return $this->_format;
}
Here is the caller graph for this function:| PGTStorageFile::getPath | ( | ) | [private, inherited] |
This method returns the name of the directory where PGT's should be stored on the filesystem.
Definition at line 41 of file pgt-file.php.
Referenced by PGTStorageFile::getPGTIouFilename().
{
return $this->_path;
}
Here is the caller graph for this function:| PGTStorageFile::getPGTIouFilename | ( | $ | pgt_iou | ) | [private, inherited] |
This method returns the filename corresponding to a PGT Iou.
| $pgt_iou | the PGT iou. |
Definition at line 170 of file pgt-file.php.
References PGTStorageFile::getFormat(), and PGTStorageFile::getPath().
Referenced by PGTStorageFile::read(), and PGTStorageFile::write().
{
phpCAS::traceBegin();
return $this->getPath().$pgt_iou.'.'.$this->getFormat();
phpCAS::traceEnd();
}
Here is the call graph for this function:
Here is the caller graph for this function:| PGTStorageFile::getStorageInfo | ( | ) | [inherited] |
This method returns an informational string giving informations on the parameters of the storage.
(used for debugging purposes).
Reimplemented from PGTStorage.
Definition at line 89 of file pgt-file.php.
{
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
}
| PGTStorageFile::getStorageType | ( | ) | [inherited] |
This method returns an informational string giving the type of storage used by the object (used for debugging purposes).
Reimplemented from PGTStorage.
Definition at line 77 of file pgt-file.php.
{
return "file";
}
| PGTStorageFile::init | ( | ) | [inherited] |
This method is used to initialize the storage.
Halts on error.
Reimplemented from PGTStorage.
Definition at line 147 of file pgt-file.php.
References PGTStorage::isInitialized().
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ( $this->isInitialized() )
return;
// call the ancestor's method (mark as initialized)
parent::init();
phpCAS::traceEnd();
}
Here is the call graph for this function:| PGTStorageFile::PGTStorageFile | ( | $ | cas_parent, | |
| $ | format, | |||
| $ | path | |||
| ) | [inherited] |
The class constructor, called by CASClient::SetPGTStorageFile().
| $cas_parent | the CASClient instance that creates the object. | |
| $format | the format used to store the PGT's (`plain' and `xml' allowed). | |
| $path | the path where the PGT's should be stored |
Definition at line 107 of file pgt-file.php.
References PGTStorage::PGTStorage().
{
phpCAS::traceBegin();
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
// check that the path is an absolute path
if ( $path[0] != '/' ) {
phpCAS::error('an absolute path is needed for PGT storage to file');
}
// store the path (with a leading and trailing '/')
$path = preg_replace('|[/]*$|','/',$path);
$path = preg_replace('|^[/]*|','/',$path);
$this->_path = $path;
// check the format and store it
switch ($format) {
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
$this->_format = $format;
break;
default:
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
}
phpCAS::traceEnd();
}
Here is the call graph for this function:| PGTStorageFile::read | ( | $ | pgt_iou | ) | [inherited] |
This method reads a PGT corresponding to a PGT Iou and deletes the corresponding file.
| $pgt_iou | the PGT iou |
Reimplemented from PGTStorage.
Definition at line 211 of file pgt-file.php.
References PGTStorageFile::getPGTIouFilename().
{
phpCAS::traceBegin();
$pgt = FALSE;
$fname = $this->getPGTIouFilename($pgt_iou);
if ( !($f=fopen($fname,"r")) ) {
phpCAS::trace('could not open `'.$fname.'\'');
} else {
if ( ($pgt=fgets($f)) === FALSE ) {
phpCAS::trace('could not read PGT from `'.$fname.'\'');
}
fclose($f);
}
// delete the PGT file
@unlink($fname);
phpCAS::traceEnd($pgt);
return $pgt;
}
Here is the call graph for this function:| PGTStorageFile::write | ( | $ | pgt, | |
| $ | pgt_iou | |||
| ) | [inherited] |
This method stores a PGT and its corresponding PGT Iou into a file.
Echoes a warning on error.
| $pgt | the PGT | |
| $pgt_iou | the PGT iou |
Reimplemented from PGTStorage.
Definition at line 186 of file pgt-file.php.
References PGTStorageFile::getPGTIouFilename().
{
phpCAS::traceBegin();
$fname = $this->getPGTIouFilename($pgt_iou);
if ( $f=fopen($fname,"w") ) {
if ( fputs($f,$pgt) === FALSE ) {
phpCAS::error('could not write PGT to `'.$fname.'\'');
}
fclose($f);
} else {
phpCAS::error('could not open `'.$fname.'\'');
}
phpCAS::traceEnd();
}
Here is the call graph for this function:PGTStorageFile::$_format [private, inherited] |
a string telling the format to use to store PGT's (plain or xml).
Written by PGTStorageFile::PGTStorageFile(), read by getFormat().
Definition at line 52 of file pgt-file.php.
PGTStorageFile::$_path [private, inherited] |
a string telling where PGT's should be stored on the filesystem.
Written by PGTStorageFile::PGTStorageFile(), read by getPath().
Definition at line 31 of file pgt-file.php.
1.7.1