[ Index ] |
PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 function auto_link($str) { 24 # don't use target if tail is follow 25 $regex['file'] = "gz|tgz|tar|gzip|zip|rar|mpeg|mpg|exe|rpm|dep|rm|ram|asf|ace|viv|avi|mid|gif|jpg|png|bmp|eps|mov"; 26 $regex['file'] = "(\.($regex[file])\") TARGET=\"_blank\""; 27 28 # define URL ( include korean character set ) 29 $regex['http'] = "(http|https|ftp|telnet|news|mms):\/\/(([\xA1-\xFEa-z0-9:_\-]+\.[\xA1-\xFEa-z0-9:;&#=_~%\[\]\?\/\.\,\+\-]+)([\.]*[\/a-z0-9\[\]]|=[\xA1-\xFE]+))"; 30 31 # define E-mail address ( include korean character set ) 32 $regex['mail'] = "([\xA1-\xFEa-z0-9_\.\-]+)@([\xA1-\xFEa-z0-9_\-]+\.[\xA1-\xFEa-z0-9\-\._\-]+[\.]*[a-z0-9]\??[\xA1-\xFEa-z0-9=]*)"; 33 34 # If use "wrap=hard" option in TEXTAREA tag, 35 # connected link tag that devided sevral lines 36 $src[] = "/<([^<>\n]*)\n([^<>\n]+)\n([^<>\n]*)>/i"; 37 $tar[] = "<\\1\\2\\3>"; 38 $src[] = "/<([^<>\n]*)\n([^\n<>]*)>/i"; 39 $tar[] = "<\\1\\2>"; 40 $src[] = "/<(A|IMG)[^>]*(HREF|SRC)[^=]*=[ '\"\n]*($regex[http]|mailto:$regex[mail])[^>]*>/i"; 41 $tar[] = "<\\1 \\2=\"\\3\">"; 42 43 # replaceed @ charactor include email form in URL 44 $src[] = "/(http|https|ftp|telnet|news|mms):\/\/([^ \n@]+)@/i"; 45 $tar[] = "\\1://\\2_HTTPAT_\\3"; 46 47 # replaced special char and delete target 48 # and protected link when use html link code 49 $src[] = "/&(quot|gt|lt)/i"; 50 $tar[] = "!\\1"; 51 $src[] = "/<a([^>]*)href=[\"' ]*($regex[http])[\"']*[^>]*>/i"; 52 $tar[] = "<A\\1HREF=\"\\3_orig://\\4\" TARGET=\"_blank\">"; 53 $src[] = "/href=[\"' ]*mailto:($regex[mail])[\"']*>/i"; 54 $tar[] = "HREF=\"mailto:\\2#-#\\3\">"; 55 $src[] = "/<([^>]*)(background|codebase|src)[ \n]*=[\n\"' ]*($regex[http])[\"']*/i"; 56 $tar[] = "<\\1\\2=\"\\4_orig://\\5\""; 57 58 # auto linked url and email address that unlinked 59 $src[] = "/((SRC|HREF|BASE|GROUND)[ ]*=[ ]*|[^=]|^)($regex[http])/i"; 60 $tar[] = "\\1<A HREF=\"\\3\" TARGET=\"_blank\">\\3</a>"; 61 $src[] = "/($regex[mail])/i"; 62 $tar[] = "<A HREF=\"mailto:\\1\">\\1</a>"; 63 $src[] = "/<A HREF=[^>]+>(<A HREF=[^>]+>)/i"; 64 $tar[] = "\\1"; 65 $src[] = "/<\/A><\/A>/i"; 66 $tar[] = "</A>"; 67 68 # restored code that replaced for protection 69 $src[] = "/!(quot|gt|lt)/i"; 70 $tar[] = "&\\1"; 71 $src[] = "/(http|https|ftp|telnet|news|mms)_orig/i"; 72 $tar[] = "\\1"; 73 $src[] = "'#-#'"; 74 $tar[] = "@"; 75 $src[] = "/$regex[file]/i"; 76 $tar[] = "\\1"; 77 78 # restored @ charactor include Email form in URL 79 $src[] = "/_HTTPAT_/"; 80 $tar[] = "@"; 81 82 # put border value 0 in IMG tag 83 $src[] = "/<(IMG SRC=\"[^\"]+\")>/i"; 84 $tar[] = "<\\1 BORDER=0>"; 85 86 # If not MSIE, disable embed tag 87 if(!ereg("MSIE", $_SERVER['HTTP_USER_AGENT'])) { 88 $src[] = "/<embed/i"; 89 $tar[] = "<embed"; 90 } 91 92 $str = preg_replace($src,$tar,$str); 93 return $str; 94 } 95 96 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 30 05:55:15 2009 | Cross-referenced by PHPXref 0.7 |