本文整理汇总了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;
}
}
}