websvn |
Subversion Repositories: |
Rev 1 | Rev 3 | |
---|---|---|
Line 33... | Line 33... | |
// parseCommand |
// parseCommand | |
// |
// | |
// Parse a special command |
// Parse a special command | |
|
| |
function parseCommand($line, $vars, $handle) { |
function parseCommand($line, $vars, $handle) { | |
global $ignore, $ignorestack, $ignorelevel; |
global $ignore, $ignorestack, $ignorelevel, $config, $listing, $vars; | |
| ||
// process content of included file | ||
if (strncmp(trim($line), "[websvn-include:", 16) == 0) { | ||
if (!$ignore) { | ||
$line = trim($line); | ||
$file = substr($line, 16, -1); | ||
parseTemplate($config->templatePath.$file, $vars, $listing); | ||
} | ||
return true; | ||
} | ||
| ||
|
| |
// Check for test conditions |
// Check for test conditions | |
if (strncmp(trim($line), "[websvn-test:", 13) == 0) { |
if (strncmp(trim($line), "[websvn-test:", 13) == 0) { | |
if (!$ignore) { |
if (!$ignore) { | |
$line = trim($line); |
$line = trim($line); | |
$var = substr($line, 13, -1); |
$var = substr($line, 13, -1); | |
if (empty($vars[$var])) { |
$neg = ($var{0} == '!'); | |
if ($neg) $var = substr($var, 1); | ||
if (empty($vars[$var]) xor $neg) { | ||
array_push($ignorestack, $ignore); |
array_push($ignorestack, $ignore); | |
$ignore = true; |
$ignore = true; | |
} |
} | |
} else { |
} else { | |
$ignorelevel++; |
$ignorelevel++; | |
Line 227... | Line 240... | |
function parseTags($line, $vars) { |
function parseTags($line, $vars) { | |
global $lang; |
global $lang; | |
|
| |
$l = ''; |
$l = ''; | |
// Replace the websvn variables |
// Replace the websvn variables | |
while (ereg("\[websvn:([a-zA-Z0-9_]+)\]", $line, $matches)) { |
while (preg_match('|\[websvn:([a-zA-Z0-9_]+)\]|', $line, $matches)) { | |
// Find beginning |
// Find beginning | |
$p = strpos($line, $matches[0]); |
$p = strpos($line, $matches[0]); | |
|
| |
// add everything up to beginning |
// add everything up to beginning | |
if ($p > 0) { |
if ($p > 0) { | |
Line 247... | Line 260... | |
|
| |
// Rebuild line, add remaining part of line |
// Rebuild line, add remaining part of line | |
$line = $l.$line; |
$line = $l.$line; | |
|
| |
// Replace the language strings |
// Replace the language strings | |
while (ereg("\[lang:([a-zA-Z0-9_]+)\]", $line, $matches)) { |
while (preg_match('|\[lang:([a-zA-Z0-9_]+)\]|', $line, $matches)) { | |
// Make sure that the variable exists |
// Make sure that the variable exists | |
if (!isset($lang[$matches[1]])) { |
if (!isset($lang[$matches[1]])) { | |
$lang[$matches[1]] = "?${matches[1]}?"; |
$lang[$matches[1]] = "?${matches[1]}?"; | |
} |
} | |
|
|