Beispiel #1
0
    if (isset($GLOBALS['loaded'][$file])) {
        return '';
    }
    $GLOBALS['loaded'][$file] = true;
    return replace_includes(remove_php_tags(file_get_contents($file)));
}
echo 'Generating includes file... ';
shell_exec('php generate-includes.php');
echo "done!\n";
chdir(dirname(__FILE__) . '/../library/');
echo 'Creating full file...';
$contents = replace_includes(file_get_contents('HTMLPurifier.includes.php'));
$contents = str_replace("define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/..'));", "define('HTMLPURIFIER_PREFIX', dirname(__FILE__) . '/standalone');\r\n    set_include_path(HTMLPURIFIER_PREFIX . PATH_SEPARATOR . get_include_path());", $contents);
file_put_contents('HTMLPurifier.standalone.php', $contents);
echo ' done!' . PHP_EOL;
echo 'Creating standalone directory...';
$FS->rmdirr('standalone');
// ensure a clean copy
// data files
$FS->mkdirr('standalone/HTMLPurifier/DefinitionCache/Serializer');
make_file_standalone('HTMLPurifier/EntityLookup/entities.ser');
make_file_standalone('HTMLPurifier/ConfigSchema/schema.ser');
// non-standard inclusion setup
make_dir_standalone('HTMLPurifier/ConfigSchema');
make_dir_standalone('HTMLPurifier/Language');
make_dir_standalone('HTMLPurifier/Filter');
make_dir_standalone('HTMLPurifier/Printer');
make_file_standalone('HTMLPurifier/Printer.php');
make_file_standalone('HTMLPurifier/Lexer/PH5P.php');
echo ' done!' . PHP_EOL;
// vim: et sw=4 sts=4
Beispiel #2
0
    if ($file == 'HTMLPurifier/Lexer/DOMLex.php') {
        return $matches[0];
    }
    if (isset($GLOBALS['loaded'][$file])) {
        return '';
    }
    $GLOBALS['loaded'][$file] = true;
    create_blank($file);
    return replace_includes(remove_php_tags(file_get_contents($file)));
}
chdir(dirname(__FILE__) . '/../library/');
create_blank('HTMLPurifier.php');
echo 'Creating full file...';
$contents = replace_includes(file_get_contents('HTMLPurifier.php'));
$contents = str_replace("define('HTMLPURIFIER_PREFIX', dirname(__FILE__));", "define('HTMLPURIFIER_PREFIX', dirname(__FILE__) . '/standalone');\r\nset_include_path(HTMLPURIFIER_PREFIX . PATH_SEPARATOR . get_include_path());", $contents);
file_put_contents('HTMLPurifier.standalone.php', $contents);
echo ' done!' . PHP_EOL;
echo 'Creating standalone directory...';
rmdirr('standalone');
// ensure a clean copy
mkdir_deep('standalone/HTMLPurifier/DefinitionCache/Serializer');
make_dir_standalone('HTMLPurifier/EntityLookup');
make_dir_standalone('HTMLPurifier/Language');
make_file_standalone('HTMLPurifier/Printer/ConfigForm.js');
make_file_standalone('HTMLPurifier/Printer/ConfigForm.css');
make_dir_standalone('HTMLPurifier/URIScheme');
// PHP 5 only file
mkdir_deep('standalone/HTMLPurifier/Lexer');
make_file_standalone('HTMLPurifier/Lexer/DOMLex.php');
make_file_standalone('HTMLPurifier/TokenFactory.php');
echo ' done!' . PHP_EOL;