📄 demounit.dfm
字号:
'// | that is bundled with this package in the file LICENSE, and ' +
'is |'
'// | available at through the world-wide-web at ' +
' |'
'// | http://www.php.net/license/2_02.txt. ' +
' |'
'// | If you did not receive a copy of the PHP license and are un' +
'able to |'
'// | obtain it through the world-wide-web, please send a note to' +
' |'
'// | license@php.net so we can mail you a copy immediately. ' +
' |'
'// +------------------------------------------------------------' +
'----------+'
'// | Authors: Mark Nottingham <mnot@pobox.com> ' +
' |'
'// | Chuck Hagenbuch <chuck@horde.org> ' +
' |'
'// +------------------------------------------------------------' +
'----------+'
'//'
'// $Id: Compress.php,v 1.4 2001/12/11 15:31:28 sebastian Exp $'
'//'
''
'/**'
' * HTTP_Compress:: provides a wrapper around php'#39's output buffer' +
'ing'
' * mechanisms and also does compression, generates headers - ETa' +
'g,'
' * Content-Length, etc. - which may be beneficial to bandwidth'
' * usage and performance.'
' *'
' * @author Mark Nottingham <mnot@pobox.com>'
' * @author Chuck Hagenbuch <chuck@horde.org>'
' * @version $Revision: 1.4 $'
' * @package HTTP'
' */'
'class HTTP_Compress {'
' '
' /**'
' * Start the output buffer, and make sure that implicit flus' +
'h is'
' * off so that data is always buffered.'
' * @access public'
' */'
' function start()'
' {'
' ob_start();'
' ob_implicit_flush(0);'
' }'
' '
' /**'
' * Output the contents of the output buffer, compressed if'
' * desired, along with any relevant headers.'
' *'
' * @param boolean $compress (optional) Use gzip compression,' +
' if the browser supports '
'it.'
' * @param boolean $use_etag Generate an ETag, and don'#39't send' +
' the body if the browser '
'has the same object cached.'
' * @param boolean $send_body Send the body of the request? M' +
'ight be false for HEAD '
'requests.'
' * @access public'
' */'
' function output($compress = true, $use_etag = true, $send_bo' +
'dy = true)'
' {'
' $min_gz_size = 1024;'
' $page = ob_get_contents();'
' $length = strlen($page);'
' ob_end_clean();'
' '
' if ($compress && extension_loaded('#39'zlib'#39') && (strlen($pa' +
'ge) > $min_gz_size) && '
'isset($GLOBALS['#39'HTTP_SERVER_VARS'#39']['#39'HTTP_ACCEPT_ENCODING'#39'])) {'
' $ae = explode('#39','#39', str_replace('#39' '#39', '#39#39', $GLOBALS['#39'HT' +
'TP_SERVER_VARS'#39']'
'['#39'HTTP_ACCEPT_ENCODING'#39']));'
' $enc = false;'
' if (in_array('#39'gzip'#39', $ae)) {'
' $enc = '#39'gzip'#39';'
' } else if (in_array('#39'x-gzip'#39', $ae)) {'
' $enc = '#39'x-gzip'#39';'
' }'
' '
' if ($enc) {'
' $page = gzencode($page);'
' $length = strlen($page);'
' header('#39'Content-Encoding: '#39' . $enc);'
' header('#39'Vary: Accept-Encoding'#39');'
' } else {'
' $compress = false;'
' }'
' } else {'
' $compress = false;'
' }'
' '
' if ($use_etag) {'
' $etag = '#39'"'#39' . md5($page) . '#39'"'#39';'
' header('#39'ETag: '#39' . $etag);'
' if (isset($GLOBALS['#39'HTTP_SERVER_VARS'#39']['#39'HTTP_IF_NONE' +
'_MATCH'#39'])) {'
' $inm = explode('#39','#39', $GLOBALS['#39'HTTP_SERVER_VARS'#39']' +
'['#39'HTTP_IF_NONE_MATCH'#39']);'
' foreach ($inm as $i) {'
' if (trim($i) == $etag) {'
' header('#39'HTTP/1.0 304 Not Modified'#39');'
' $send_body = false;'
' break;'
' }'
' }'
' }'
' }'
' '
' if ($send_body) {'
' header('#39'Content-Length: '#39' . $length);'
' echo $page;'
' }'
' }'
' '
'}'
'?>')
ParentFont = False
ScrollBars = ssBoth
TabOrder = 0
end
end
object tsVBScript: TTabSheet
Caption = 'VBScript'
ImageIndex = 4
object edVBScript: TRichEdit
Left = 0
Top = 0
Width = 735
Height = 570
Align = alClient
Lines.Strings = (
#39' Hardlinks.vbs'
#39' Demonstrates hard links on NTFS volumes '
#39' --------------------------------------------------------'
''
'Option Explicit'
''
#39' Some constants'
'Const L_NoHardLinkCreated = "Unable to create hard link"'
'Const L_EnterTarget = "Enter the file name to hard-link to"'
'Const L_HardLinks = "Creating hard link"'
'Const L_EnterHardLink = "Name of the hard link you want to creat' +
'e"'
'Const L_CannotCreate = "Make sure that both files are on the sam' +
'e volume and the volume is NTFS"'
'Const L_NotExist = "Sorry, the file doesn'#39't exist"'
'Const L_SameName = "Target file and hard link cannot have the sa' +
'me name"'
''
#39' Determine the existing file to (hard) link to'
'dim sTargetFile '
'if WScript.Arguments.Count >0 then'
#9'sTargetFile = WScript.Arguments(0)'
'else'
#9'sTargetFile = InputBox(L_EnterTarget, L_HardLinks, "")'
#9'if sTargetFile = "" then WScript.Quit'
'end if'
''
#39' Does the file exist?'
'dim fso'
'set fso = CreateObject("Scripting.FileSystemObject")'#9
'if Not fso.FileExists(sTargetFile) then'
#9'MsgBox L_NotExist'
#9'WScript.Quit'
'end if'
''
#39' Main loop'
'while true'
#9'QueryForHardLink sTargetFile'
'wend'
''
''
#39' Close up'
'WScript.Quit'
''
''
''
''
''
''
#39' /////////////////////////////////////////////////////////////'
#39' // Helper Functions'
''
''
''
#39' Create the hard link'
#39'------------------------------------------------------------'
'function QueryForHardLink(sTargetFile)'
#9#39' Extract the hard link name if specified on the command line'
#9'dim sHardLinkName'
#9'if WScript.Arguments.Count >1 then'
#9#9'sHardLinkName = WScript.Arguments(1)'
#9'else'
#9#9'dim buf'
#9#9'buf = L_EnterHardLink & " for" & vbCrLf & sTargetFile'
#9#9'sHardLinkName = InputBox(buf, L_HardLinks, sTargetFile)'
#9#9'if sHardLinkName = "" then WScript.Quit'#9
#9#9'if sHardLinkName = sTargetFile then '
#9#9#9'MsgBox L_SameName'
#9#9#9'exit function'
#9#9'end if'
#9'end if '
''
#9#39' Verify that both files are on the same volume and the '
#9#39' volume is NTFS'
#9'if Not CanCreateHardLinks(sTargetFile, sHardLinkName) then '
#9#9'MsgBox L_CannotCreate'
#9#9'exit function'
#9'end if'
#9
#9#39' Creates the hard link'
#9'dim oHL'
#9'set oHL = CreateObject("HardLink.Object.1")'
#9'oHL.CreateNewHardLink sHardLinkName, sTargetFile'
'end function'
''
''
#39' Verify that both files are on the same NTFS disk'
#39'------------------------------------------------------------'
'function CanCreateHardLinks(sTargetFile, sHardLinkName)'
#9'CanCreateHardLinks = false'
#9
#9'dim fso'
#9'set fso = CreateObject("Scripting.FileSystemObject")'
#9
#9#39' same drive?'
#9'dim d1, d2'
#9'd1 = fso.GetDriveName(sTargetFile)'
#9'd2 = fso.GetDriveName(sHardLinkName)'
#9'if d1 <> d2 then exit function'
''
#9#39' NTFS drive?'
#9'CanCreateHardLinks = IsNTFS(sTargetFile)'
'end function'
''
''
#39' IsNTFS() - Verifies whether the file'#39's volume is NTFS'
#39' --------------------------------------------------------'
'function IsNTFS(sFileName)'
#9'dim fso, drv'
#9
#9'IsNTFS = False'
#9'set fso = CreateObject("Scripting.FileSystemObject")'#9
#9'set drv = fso.GetDrive(fso.GetDriveName(sFileName)) '
#9'set fso = Nothing'
#9
#9'if drv.FileSystem = "NTFS" then IsNTFS = True'
'end function')
ScrollBars = ssBoth
TabOrder = 0
end
end
object tsJScript: TTabSheet
Caption = 'JScript'
ImageIndex = 5
object edJScript: TRichEdit
Left = 0
Top = 0
Width = 735
Height = 570
Align = alClient
Lines.Strings = (
'//This script detects the following:'
'//Flash'
'//Windows Media Player'
'//Java'
'//Shockwave'
'//RealPlayer'
'//QuickTime'
'//Acrobat Reader'
'//SVG Viewer'
''
''
'var agt=navigator.userAgent.toLowerCase();'
'var ie = (agt.indexOf("msie") != -1);'
'var ns = (navigator.appName.indexOf("Netscape") != -1);'
'var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1' +
'));'
'var mac = (agt.indexOf("mac")!=-1);'
''
'if (ie && win) {'#9'pluginlist = detectIE("Adobe.SVGCtl","SVG Viewe' +
'r") + detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE'
'("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + detectIE' +
'("rmocx.RealPlayer G2 Control.1","RealPlayer") + detectIE'
'("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + detectIE' +
'("MediaPlayer.MediaPlayer.1","Windows Media Player") + detectIE'
'("PDF.PdfCtrl.5","Acrobat Reader"); }'
'if (ns || !win) {'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -