⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 code.php

📁 1.增加了近40项后台核心设置
💻 PHP
字号:
<?php
function codedisp($code) {
	global $codecount, $xydw_codecount, $codehtml,$tablecolor,$bcolor;
	$xydw_codecount++;
	$code = htmlspecialchars(str_replace('\\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $code)));
	$codehtml[$xydw_codecount] = "<br><br><center><table border=\"0\" width=\"90%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><b>&nbsp;代码</b>:<br><br></td></tr><tr><td><table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"10\" bgcolor=\"{$tablecolor}\"><tr><td width=\"100%\" bgcolor=\"{$bcolor}\" style=\"word-break:break-all\">$code</td></tr></table></td></tr></table></center><br>";
	$codecount++;
	return "[\tXYDW_CODE_$xydw_codecount\t]";
}

function parseurl($xydw) {
	return preg_match("/\[code\].+?\[\/code\]/is", $xydw) ? $xydw :
		preg_replace(	array(
					"/(?<=[^\]a-z0-9-=\"'\\/])((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/i",
					"/(?<=[^\]a-z0-9\/\-_.~?=:.])([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/i"
				), array(
					"[url]\\1\\3[/url]",
					"[email]\\0[/email]"
				), ' '.$xydw);
}
function cuturl($url) {
	$length = 65;
	$urllink = "<a href=\"".(substr(strtolower($url), 0, 4) == 'www.' ? "http://$url" : $url).'" target="_blank">';
	if(strlen($url) > $length) {
		$url = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
	}
	$urllink .= $url.'</a>';
	return $urllink;
}

function bbcodeurl($url, $tags) {
	if(!preg_match("/<.+?>/s",$url)) {
		if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'ftp://', 'rtsp:/', 'mms://'))) {
			$url = 'http://'.$url;
		}
		return str_replace('submit', '', sprintf($tags, $url, $url));
	} else {
		return '&nbsp;'.$url;
	}
}
function readxydw($xydw,$html,$ubb) {
    global $bcolor, $tablecolor, $codehtml, $xydw_codecount, $searcharray, $replacearray,$rootindex;
    unset($searcharray,$replacearray);
    if(!$html || !$rootindex['usehtml']){
        $xydw = htmlspecialchars(str_replace('\\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $xydw)));
    }
    if($ubb && $rootindex['useubb']){
      $xydw = preg_replace("/\s*\[code\](.+?)\[\/code\]\s*/ies", "codedisp('\\1')", $xydw);
      $xydw = parseurl($xydw);
      if(empty($searcharray) || empty($replacearray)) {
		    $searcharray['bbcode_regexp'] = array(
				"/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is",
				"/(\[box=(#[0-9A-F]{6}|[a-z]+)\])[\n\r]*(.+?)[\n\r]*(\[\/box\])/is",
				"/\[url\]\s*(www.|https?:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|telnet:\/\/|rtsp:\/\/|mms:\/\/){1}([^\[\"']+?)\s*\[\/url\]/ie",
				"/\[url=www.([^\[\"']+?)\](.+?)\[\/url\]/is",
				"/\[url=(https?|ftp|gopher|news|telnet|rtsp|mms){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/is",
				"/\[email\]\s*([A-Za-z0-9\-_.]+)@([A-Za-z0-9\-_]+[.][A-Za-z0-9\-_.]+)\s*\[\/email\]/i",
				"/\[email=([A-Za-z0-9\-_.]+)@([A-Za-z0-9\-_]+[.][A-Za-z0-9\-_.]+)\](.+?)\[\/email\]/is",
				"/\[color=([^\[]+?)\]/i",
				"/\[size=([^\[]+?)\]/i",
				"/\[font=([^\[]+?)\]/i",
				"/\[align=([^\[]+?)\]/i",
				"/\[center\]/i",
                "/(\[fly\])(.+?)(\[\/fly\])/is",
                "/(\[move\])(.+?)(\[\/move\])/is",
                "/(\[glow=)(\S+?)(\,)(.+?)(\,)(.+?)(\])(.+?)(\[\/glow\])/is",
				"/\[img\]\s*([^\[]+?)\s*\[\/img\]/ies",
				"/\[img=(\d{1,3})[x|\,](\d{1,3})\]\s*([^\[]+?)\s*\[\/img\]/ies",
			);
	      $replacearray['bbcode_regexp'] = array(
				"<br><br><center><table border=\"0\" width=\"90%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><b>&nbsp;引用</b>:<br><br></td></tr><tr><td><table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"10\" bgcolor=\"{$tablecolor}\"><tr><td width=\"100%\" bgcolor=\"{$bcolor}\" style=\"word-break:break-all\">\\1</td></tr></table></td></tr></table></center><br>",
				"<blockquote style=\"background-color: \\2 ;\"><span class=\"bold\">$title</span>\\3</blockquote>",
				"cuturl('\\1\\2')",
				"<a href=\"http://www.\\1\" target=\"_blank\">\\2</a>",
				"<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>",
				"<a href=\"mailto:\\1@\\2\">\\1@\\2</a>",
				"<a href=\"mailto:\\1@\\2\">\\3</a>",
				"<font color=\"\\1\">",
				"<font size=\"\\1\">",
				"<font face=\"\\1\">",
				"<p align=\"\\1\">",
				"<p align=\"center\">",
                "<marquee width=90% behavior=alternate scrollamount=3>\\2</marquee>",
                "<MARQUEE scrollamount=3>\\2</MARQUEE>",
                "<table width=\\2 style=\"filter:glow(color=\\4, strength=\\6)\">\\8</table>",
				"bbcodeurl('\\1', '<img src=\"%s\" border=\"0\" onload=\"if(this.width>399) {this.resized=true; this.width=399; this.alt=\'点这里新窗口查看原图\';}\" onmouseover=\"if(this.resized) this.style.cursor=\'hand\';\" onclick=\"if(this.resized) {window.open(\'%s\');}\" onmousewheel=\"return bbimg(this)\">')",
				"bbcodeurl('\\3', '<img width=\"\\1\" height=\"\\2\" src=\"%s\" border=\"0\">')"
			);
           $searcharray['bbcode_str'] = array(
				'[/color]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]',
				'[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]',
				'[list=A]', '[*]', '[/list]','[/center]'
			);

			$replacearray['bbcode_str'] = array(
				'</font>', '</font>', '</font>', '</p>', '<b>', '</b>', '<i>',
				'</i>', '<u>', '</u>', '<ul>', '<ol type=1>', '<ol type=a>',
				'<ol type=A>', '<li>', '</ul></ol>','</p>'
			);
            @$xydw = str_replace($searcharray['bbcode_str'], $replacearray['bbcode_str'],
				preg_replace($searcharray['bbcode_regexp'], $replacearray['bbcode_regexp'], $xydw));
         }
    $allowimg = $rootindex['usefla']; //allow img
 	if($allowimg) {
		if(empty($searcharray['imgcode']) || empty($replacearray['imgcode'])) {
			$searcharray['imgcode'] = array(
                "/(\[flash=)(\S+?)(\,)(\S+?)(\])(\S+?)(\[\/flash\])/is",   
                "/\[wmv\]\s*(\S+?)\s*\[\/wmv\]/is",
                "/\[rm\]\s*(\S+?)\s*\[\/rm\]/is"
			);
			$replacearray['imgcode'] = array(
                "<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" WIDTH=\\2 HEIGHT=\\4><PARAM NAME=MOVIE VALUE=\\6><PARAM NAME=PLAY VALUE=TRUE><PARAM NAME=LOOP VALUE=TRUE><PARAM NAME=QUALITY VALUE=HIGH><EMBED SRC=\\6 WIDTH=\\2 HEIGHT=\\4 PLAY=TRUE LOOP=TRUE QUALITY=HIGH></EMBED></OBJECT><br />[<a target=_blank href=\\6>Full Screen</a>]",
                "<EMBED src=\\1 HEIGHT=\"256\" WIDTH=\"314\" AutoStart=1></EMBED>",
                "<object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=241 id=Player width=316 VIEWASTEXT><param name=\"_ExtentX\" value=\"12726\"><param name=\"_ExtentY\" value=\"8520\"><param name=\"AUTOSTART\" value=\"0\"><param name=\"SHUFFLE\" value=\"0\"><param name=\"PREFETCH\" value=\"0\"><param name=\"NOLABELS\" value=\"0\"><param name=\"CONTROLS\" value=\"ImageWindow\"><param name=\"CONSOLE\" value=\"_master\"><param name=\"LOOP\" value=\"0\"><param name=\"NUMLOOP\" value=\"0\"><param name=\"CENTER\" value=\"0\"><param name=\"MAINTAINASPECT\" value=\"\\1\"><param name=\"BACKGROUNDCOLOR\" value=\"#000000\"></object><br><object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=32 id=Player width=316 VIEWASTEXT><param name=\"_ExtentX\" value=\"18256\"><param name=\"_ExtentY\" value=\"794\"><param name=\"AUTOSTART\" value=\"1\"><param name=\"SHUFFLE\" value=\"0\"><param name=\"PREFETCH\" value=\"0\"><param name=\"NOLABELS\" value=\"0\"><param name=\"CONTROLS\" value=\"controlpanel\"><param name=\"CONSOLE\" value=\"_master\"><param name=\"LOOP\" value=\"0\"><param name=\"NUMLOOP\" value=\"0\"><param name=\"CENTER\" value=\"0\"><param name=\"MAINTAINASPECT\" value=\"0\"><param name=\"BACKGROUNDCOLOR\" value=\"#000000\"><param name=\"SRC\" value=\"\\1\"></object>"
			);
		}
		$xydw = preg_replace($searcharray['imgcode'], $replacearray['imgcode'], $xydw);
	}
	for($i = 0; $i <= $xydw_codecount; $i++) {
        $codehtml[$i] = str_replace("&amp;","&",$codehtml[$i]);
		$xydw = str_replace("[\tXYDW_CODE_$i\t]", $codehtml[$i], $xydw);
	}
    $xydw = str_replace("\t", '&nbsp; &nbsp; &nbsp; &nbsp; ', $xydw);
	$xydw = str_replace('   ', '&nbsp; &nbsp;', $xydw);
	$xydw = str_replace('  ', '&nbsp;&nbsp;', $xydw);
    $xydw = str_replace('&amp;ensp;', '', $xydw);
    $xydw = str_replace('&amp;#8194;', '', $xydw);
    $xydw = nl2br($xydw);
  }
  if(!$html && !$ubb) $xydw = nl2br($xydw);
  unset($searcharray,$replacearray);
  return $xydw;
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -