本文整理匯總了PHP中VQMod::_realpath方法的典型用法代碼示例。如果您正苦於以下問題:PHP VQMod::_realpath方法的具體用法?PHP VQMod::_realpath怎麽用?PHP VQMod::_realpath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類VQMod
的用法示例。
在下文中一共展示了VQMod::_realpath方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _parseMods
/**
* VQModObject::_parseMods()
*
* @param DOMNode $node <modification> node to be parsed
* @return null
* @description Parses modifications in preparation for the applyMod method to work
*/
private function _parseMods(DOMNode $node)
{
$files = $node->getElementsByTagName('file');
$replaces = VQMod::$replaces;
foreach ($files as $file) {
$path = $file->getAttribute('path') ? $file->getAttribute('path') : '';
$filesToMod = explode(',', $file->getAttribute('name'));
foreach ($filesToMod as $filename) {
$fileToMod = $path . $filename;
if (!empty($replaces)) {
foreach ($replaces as $r) {
if (count($r) == 2) {
$fileToMod = preg_replace($r[0], $r[1], $fileToMod);
}
}
}
$error = $file->hasAttribute('error') ? $file->getAttribute('error') : 'log';
$fullPath = VQMod::_realpath($fileToMod);
if (!$fullPath || !file_exists($fullPath)) {
if (strpos($fileToMod, '*') !== false) {
$fullPath = VQMod::getCwd() . $fileToMod;
} else {
if ($error == 'log' || $error == 'abort') {
$skip = $error == 'log' ? ' (SKIPPED)' : ' (ABORTING MOD)';
VQMod::$log->write('VQModObject::parseMods - Could not resolve path for [' . $fileToMod . ']' . $skip, $this);
}
if ($error == 'log' || $error == 'skip') {
continue;
} elseif ($error == 'abort') {
return false;
}
}
}
$operations = $file->getElementsByTagName('operation');
foreach ($operations as $opIndex => $operation) {
VQMod::$fileModding = $fileToMod . '(' . $opIndex . ')';
$skipOperation = false;
$error = $operation->hasAttribute('error') ? $operation->getAttribute('error') : 'abort';
$ignoreif = $operation->getElementsByTagName('ignoreif')->item(0);
if ($ignoreif) {
$ignoreif = new VQSearchNode($ignoreif);
} else {
$ignoreif = false;
}
$search = $operation->getElementsByTagName('search')->item(0);
$add = $operation->getElementsByTagName('add')->item(0);
if (!$search) {
VQMod::$log->write('Operation <search> tag missing', $this);
$skipOperation = true;
}
if (!$add) {
VQMod::$log->write('Operation <add> tag missing', $this);
$skipOperation = true;
}
if (!$skipOperation) {
$this->mods[$fullPath][] = array('search' => new VQSearchNode($search), 'add' => new VQAddNode($add), 'ignoreif' => $ignoreif, 'error' => $error, 'fileToMod' => $fileToMod, 'opIndex' => $opIndex);
}
}
VQMod::$fileModding = false;
}
}
}