if (!file_exists("{$old}.txt")) { echo "Cannot move undefined configuration directive {$old}\n"; exit(1); } if ($old === $new) { echo "Attempting to move to self, aborting\n"; exit(1); } if (file_exists("{$new}.txt")) { echo "Cannot move to already defined directive {$new}\n"; exit(1); } $file = "{$old}.txt"; $builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder(); $interchange = new HTMLPurifier_ConfigSchema_Interchange(); $builder->buildFile($interchange, $file); $contents = file_get_contents($file); if (strpos($contents, "\r\n") !== false) { $nl = "\r\n"; } elseif (strpos($contents, "\r") !== false) { $nl = "\r"; } else { $nl = "\n"; } // replace name with new name $contents = str_replace($old, $new, $contents); if ($interchange->directives[$old]->aliases) { $pos_alias = strpos($contents, 'ALIASES:'); $pos_ins = strpos($contents, $nl, $pos_alias); if ($pos_ins === false) { $pos_ins = strlen($contents);