Chinaunix首页 | 论坛 | 博客
  • 博客访问: 18681082
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类:

2008-04-18 09:24:53


if (!empty($type)) {
    if ($type == "path") {
        if (!empty($path)) {
            if (file_exists($path) && is_file($path)) {
                $file = file($path);
                if (substr($file[0],0,9) != "                    $file = join(, $file);
                } else {
                    die ("no such file.");
                }
            } else {
                die ("no file specified.");
            }
        } elseif ($type == "file") {
            if (!empty($file)) {

            } else {
                die ("no file specified.");
            }
    } else {
        die ("no file specified.");
    }

# specify html file, check for doctype
//$file = file("file.html");
//if (substr($file[0],0,9) != "//$file = join(, $file);

# make tags and properties lower case, close empty elements, quote all properties
$search  = array ("(<\/?)(\w+)([^>]*>)e",
                   "(<\/?)(br|input|meta|link|img)([^>]*)( />)ie",
                   "(<\/?)(br|input|meta|link|img)([^>]*)(/>)ie",
                   "(<\/?)(br|input|meta|link|img)([^>]*)(>)ie",
                   "(\w+=)(\w+)ie",
                   "(\w+=)(.+?)ie");
$replace = array ("\\1.strtolower(\\2).\\3",
                   "\\1\\2\\3>",
                   "\\1\\2\\3>",
                   "\\1\\2\\3 /\\4",
                   "strtolower(\\1).\"\\2\"",
                   "strtolower(\\1).\\2");
$file = preg_replace($search, $replace, $file);

# return xhtml-compliant document
echo "";

} else {
?>

html -> xhtml convertor






file path:



or





file contents:









}
?>

阅读(1944) | 评论(0) | 转发(0) |
0

上一篇:一个获取随机颜色生成在