Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/*
3
  +----------------------------------------------------------------------+
4
  | PHP Version 4                                                        |
5
  +----------------------------------------------------------------------+
6
  | Copyright (c) 1997-2008 The PHP Group                                |
7
  +----------------------------------------------------------------------+
8
  | This source file is subject to version 3.0 of the PHP license,       |
9
  | that is bundled with this package in the file LICENSE, and is        |
10
  | available through the world-wide-web at the following url:           |
11
  | http://www.php.net/license/3_0.txt.                                  |
12
  | If you did not receive a copy of the PHP license and are unable to   |
13
  | obtain it through the world-wide-web, please send a note to          |
14
  | license@php.net so we can mail you a copy immediately.               |
15
  +----------------------------------------------------------------------+
16
  | Authors:    Gabor Hojtsy <goba@php.net>                              |
17
  +----------------------------------------------------------------------+
18
 
19
  $Id: phpweb-entities.php,v 1.1 2008/02/02 15:09:40 farell Exp $
20
*/
21
 
22
set_time_limit(0);
23
 
24
// Too few or too many parameters
25
if ($argc != 3) { die("ERROR in " . __FILE__ . ": Too few or too many parameters"); }
26
 
27
// Workdir is the first param
28
$workdir = $argv[1];
29
 
30
// Whether we are in phpweb mode
31
$phpweb_mode = ($argv[2] == "phpweb");
32
 
33
// Entity file for phpweb entities
34
$phpweb_ent = "$workdir/entities/phpweb.ent";
35
 
36
// Automatically generated file note
37
$autonote = "<!-- This file is autogenerated - don't touch it by hand! -->\n";
38
 
39
// Replace current phpweb.ent with a 0 byte file
40
if (!$phpweb_mode) {
41
    $pe = fopen($phpweb_ent, "w");
42
    fwrite($pe, $autonote);
43
    fclose($pe);
44
    echo "$phpweb_ent should be empty now...\n";
45
    exit;
46
}
47
 
48
echo "creating $phpweb_ent...\n";
49
 
50
// Read in global.ent from the source dir
51
$lines = file("@SRCDIR@/entities/global.ent");
52
 
53
// Collect all phpweb entities
54
$phpweb_entities = array($autonote);
55
foreach ($lines as $line) {
56
    if (strpos($line, "http://www.php.net") !== FALSE) {
57
        $phpweb_entities[] = str_replace("http://www.php.net", "", $line);
58
    }
59
}
60
 
61
// Write out entity file
62
$pe = fopen($phpweb_ent, "w");
63
fwrite($pe, join("", $phpweb_entities));
64
fclose($pe);