4 chdir(dirname(__FILE__));
5 require_once
'common.php';
6 require_once
'../library/HTMLPurifier.auto.php';
18 if (count(
$argv) < 3) {
19 echo
"Usage: {$argv[0]} OldName NewName\n";
23 chdir(
'../library/HTMLPurifier/ConfigSchema/schema');
28 if (!file_exists(
"$old.txt")) {
29 echo
"Cannot move undefined configuration directive $old\n";
34 echo
"Attempting to move to self, aborting\n";
38 if (file_exists(
"$new.txt")) {
39 echo
"Cannot move to already defined directive $new\n";
49 if (strpos(
$contents,
"\r\n") !==
false) {
51 } elseif (strpos(
$contents,
"\r") !==
false) {
61 $pos_alias = strpos(
$contents,
'ALIASES:');
62 $pos_ins = strpos(
$contents, $nl, $pos_alias);
63 if ($pos_ins ===
false) $pos_ins = strlen(
$contents);
70 foreach ($lines as
$n => $line) {
71 if (strncmp($line,
'--', 2) === 0) {
77 $lines[] =
"ALIASES: $old";
79 array_splice($lines,
$insert, 0,
"ALIASES: $old");
81 file_put_contents(
$file, implode($nl, $lines));
84 rename(
"$old.txt",
"$new.txt") ||
exit(1);
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
Generic schema interchange format that can be converted to a runtime representation (HTMLPurifier_Con...
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file