|
PHP原始碼美化效果演示 |
|
|
|
|
|
SourceFormatX 使用強大的PHP詞法解析引擎全面地分析您的原始碼並根據用戶自定義的PHP原始碼風格重構和美化PHP原始碼檔案,因此它能精細地根據不同的原始碼風格美化多種原始碼,甚至是下面這些極度混亂的原始碼:
|
這是一個非常極端的 PHP 原始碼美化的範例,其目的是為了展示 SourceFormatX PHP程式碼美化工具詞法解析引擎的威力。這份混亂的無法閱讀的 PHP 原始碼檔案在1秒種內即可被 SourceFormatX 美化和縮排成整潔且可讀性強的美觀風格樣式。
<?php
function os(){$os="";$Agent=$GLOBALS["HTTP_USER_AGENT"];if(eregi('win',$Agent)
&&strpos($Agent,'95')){$os="Windows 95";}elseif(eregi('win 9x',$Agent)&&strpos(
$Agent,'4.90')){$os="Windows ME";}elseif(eregi('win',$Agent)&&ereg('98',$Agent)
){$os="Windows 98";}elseif(eregi('win',$Agent)&&eregi('nt 5\.0',$Agent)){$os=
"Windows 2000";}elseif(eregi('win',$Agent)&&eregi('nt 5\.1',$Agent)){$os=
"Windows xp";}elseif(eregi('win',$Agent)&&eregi('nt 5.1',$Agent)){$os=
"Windows xp";}elseif(eregi('win',$Agent)&&eregi('nt',$Agent)){$os="Windows NT";
}elseif(eregi('win',$Agent)&&ereg('32',$Agent)){$os="Windows 32";}elseif(eregi(
'linux',$Agent)){$os="Linux";}elseif(eregi('unix',$Agent)){$os="Unix";}elseif(
eregi('sun',$Agent)&&eregi('os',$Agent)){$os="SunOS";}elseif(eregi('ibm',$Agent
)&&eregi('os',$Agent)){$os="IBM OS/2";}elseif(eregi('Mac',$Agent)&&eregi('PC',
$Agent)){$os="Macintosh";}elseif(eregi('PowerPC',$Agent)){$os="PowerPC";}elseif
(eregi('AIX',$Agent)){$os="AIX";}elseif(eregi('HPUX',$Agent)){$os="HPUX";}
elseif(eregi('NetBSD',$Agent)){$os="NetBSD";}elseif(eregi('BSD',$Agent)){$os=
"BSD";}elseif(ereg('OSF1',$Agent)){$os="OSF1";}elseif(ereg('IRIX',$Agent)){$os=
"IRIX";}elseif(eregi('FreeBSD',$Agent)){$os="FreeBSD";}if($os=='')$os="Unknown"
;return $os;}function add_on(){global $timetemp,$ip,$online_limit,$online_data;
$osinfo=os();$time=date("h:i a");$file=@file($online_data);$ison='no';for($i=0;
$i<count($file);$i++){$ta=@explode("|",$file[$i]);if($ta[0]!=$ip)$ison='no';
else $ison='yes';}if($ison=='no'){$fp=@fopen($online_data,"a+");@flock($fp,2);
@fwrite($fp,$ip."|".$timetemp."|".$osinfo."|".$time."|||\n");@fclose($fp);unset
($fp);}$file=@file($online_data);$fp=@fopen($online_data,"w+");@flock($fp,2);
for($i=0;$i<count($file);$i++){$ts=@explode("|",$file[$i]);if(($timetemp-$ts[1]
)<=$online_limit)@fwrite($fp,$file[$i]);}@fclose($fp);unset($fp);}
?>
<?php
function os()
{
$os = "";
$Agent = $GLOBALS["HTTP_USER_AGENT"];
if (eregi('win', $Agent) && strpos($Agent, '95'))
{
$os = "Windows 95";
}
elseif (eregi('win 9x', $Agent) && strpos($Agent, '4.90'))
{
$os = "Windows ME";
}
elseif (eregi('win', $Agent) && ereg('98', $Agent))
{
$os = "Windows 98";
}
elseif (eregi('win', $Agent) && eregi('nt 5\.0', $Agent))
{
$os = "Windows 2000";
}
elseif (eregi('win', $Agent) && eregi('nt 5\.1', $Agent))
{
$os = "Windows xp";
}
elseif (eregi('win', $Agent) && eregi('nt 5.1', $Agent))
{
$os = "Windows xp";
}
elseif (eregi('win', $Agent) && eregi('nt', $Agent))
{
$os = "Windows NT";
}
elseif (eregi('win', $Agent) && ereg('32', $Agent))
{
$os = "Windows 32";
}
elseif (eregi('linux', $Agent))
{
$os = "Linux";
}
elseif (eregi('unix', $Agent))
{
$os = "Unix";
}
elseif (eregi('sun', $Agent) && eregi('os', $Agent))
{
$os = "SunOS";
}
elseif (eregi('ibm', $Agent) && eregi('os', $Agent))
{
$os = "IBM OS/2";
}
elseif (eregi('Mac', $Agent) && eregi('PC', $Agent))
{
$os = "Macintosh";
}
elseif (eregi('PowerPC', $Agent))
{
$os = "PowerPC";
}
elseif (eregi('AIX', $Agent))
{
$os = "AIX";
}
elseif (eregi('HPUX', $Agent))
{
$os = "HPUX";
}
elseif (eregi('NetBSD', $Agent))
{
$os = "NetBSD";
}
elseif (eregi('BSD', $Agent))
{
$os = "BSD";
}
elseif (ereg('OSF1', $Agent))
{
$os = "OSF1";
}
elseif (ereg('IRIX', $Agent))
{
$os = "IRIX";
}
elseif (eregi('FreeBSD', $Agent))
{
$os = "FreeBSD";
}
if ($os == '')
$os = "Unknown"
;
return $os;
}
function add_on()
{
global $timetemp, $ip, $online_limit, $online_data;
$osinfo = os();
$time = date("h:i a");
$file = @file($online_data);
$ison = 'no';
for ($i = 0; $i < count($file); $i++)
{
$ta = @explode("|", $file[$i]);
if ($ta[0] != $ip)
$ison = 'no';
else
$ison = 'yes';
}
if ($ison == 'no')
{
$fp = @fopen($online_data, "a+");
@flock($fp, 2);
@fwrite($fp, $ip."|".$timetemp."|".$osinfo."|".$time."|||\n");
@fclose($fp);
unset($fp);
}
$file = @file($online_data);
$fp = @fopen($online_data, "w+");
@flock($fp, 2);
for ($i = 0; $i < count($file); $i++)
{
$ts = @explode("|", $file[$i]);
if (($timetemp - $ts[1]) <= $online_limit)
@fwrite($fp, $file[$i]);
}
@fclose($fp);
unset($fp);
}
?>
不要再浪費寶貴的時間手動整理美化PHP語言原始碼了! 現在就下載SourceFormatX原始碼美化工具!
|