本文整理汇总了PHP中rex_path::absolute方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_path::absolute方法的具体用法?PHP rex_path::absolute怎么用?PHP rex_path::absolute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_path
的用法示例。
在下文中一共展示了rex_path::absolute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAbsoluteConversion
public function testAbsoluteConversion()
{
$path = rex_path::absolute('c:/abc/../def/./xy');
$this->assertEquals($this->path('c:/def/xy'), $path, 'resolves .. and .');
$path = rex_path::absolute('c:\\abc\\..\\def\\.\\xy');
$this->assertEquals($this->path('c:\\def\\xy'), $path, 'resolves .. and .');
}
示例2: importFiles
/**
* Importiert das Tar-Archiv $filename in den Ordner /files.
*
* @param string $filename Pfad + Dateinamen zum Tar-Archiv
*
* @return array Gibt ein Assoc. Array zurück.
* 'state' => boolean (Status ob fehler aufgetreten sind)
* 'message' => Evtl. Status/Fehlermeldung
*/
public static function importFiles($filename)
{
$return = [];
$return['state'] = false;
if ($filename == '' || substr($filename, -7, 7) != '.tar.gz') {
$return['message'] = rex_i18n::msg('backup_no_import_file_chosen') . '<br />';
return $return;
}
// Ordner /files komplett leeren
rex_dir::deleteFiles(rex_path::media());
$tar = new rex_backup_tar();
// ----- EXTENSION POINT
$tar = rex_extension::registerPoint(new rex_extension_point('BACKUP_BEFORE_FILE_IMPORT', $tar));
// require import skript to do some userside-magic
self::importScript(str_replace('.tar.gz', '.php', $filename), self::IMPORT_ARCHIVE, self::IMPORT_EVENT_PRE);
$tar->openTAR($filename);
if (!$tar->extractTar()) {
$msg = rex_i18n::msg('backup_problem_when_extracting') . '<br />';
if (count($tar->getMessages()) > 0) {
$msg .= rex_i18n::msg('backup_create_dirs_manually') . '<br />';
foreach ($tar->getMessages() as $_message) {
$msg .= rex_path::absolute($_message) . '<br />';
}
}
} else {
$msg = rex_i18n::msg('backup_file_imported') . '<br />';
}
// ----- EXTENSION POINT
$tar = rex_extension::registerPoint(new rex_extension_point('BACKUP_AFTER_FILE_IMPORT', $tar));
// require import skript to do some userside-magic
self::importScript(str_replace('.tar.gz', '.php', $filename), self::IMPORT_ARCHIVE, self::IMPORT_EVENT_POST);
$return['state'] = true;
$return['message'] = $msg;
return $return;
}