[摘要]"); str .= " <fieldset> ...
");
$str .= "
<fieldset>
<legend align='left' color=black>".(empty($message)?$record[vote_title]:$message)."</legend>
<form name='poll' action='poll_manage.php?method=vote' method='post'>
<table width='90%' align='center'>";
$vote_list = split("::",$record[vote_list]);
$vote_count = split("::",$record[vote_count]);
$vote_users = count(split("\n", $record[vote_user])) - 1;
$vote_sum = array_sum($vote_count);
$str .= "
<tr><td colspan='2'> 目前共有 <font color='red'>{$vote_users}</font> 人参与了本投票 </td></tr>";
if($vote_sum==0) $vote_sum = 1;
for($i=0; $i<count($vote_list); $i++) {
$str .= "
<tr><td>".($if_vote?"► ":"<input type='hidden' value='".$vote_count[$i]."' name='vote_count[]'><input type='".($record[vote_multi]=='Y'?"checkbox":"radio")."' name='vote[]' value='{$i}'>").htmlspecialchars($vote_list[$i])."</td><td width='400'><img src='images/bars/bar".($i+1).".gif' width='".ceil($vote_count[$i]*300/$vote_sum)."' height='10'> 占总票数的 <font color='#990000'>".ceil((int)$vote_count[$i]*100/$vote_sum)."%</font></td></tr>\n";
}
$str .= "<tr><td colspan='2' align='center'><br>".($if_vote?"<b>您已经投过票了!</b>":"<input type='hidden' value='{$record[id]}' name='id'><input type='Submit' value=' 确 定 ' name='Submit'> <input type='reset' value=' 重 置 ' name='reset'>")."</td></tr>";
$str .= "
</table>
</form>
</fieldset>";
}
return $str;
}
function get_code_html($str) {
$str = str_replace("\\\"","\"",$str);
return "
<table align='center' width='550'>
<tr><td><textarea cols='80' rows='10' name=Code>".htmlspecialchars($str)."</textarea><br>
<input type='button' value='运行代码' onClick=\"str=this.parentNode.firstChild.value;code_win=window.open('about:blank');doc=code_win.document;doc.open();doc.write(str);doc.close();code_win.focus();\">
<input type='button' value='复制代码' onclick=\"try{window.clipboardData.setData('text',this.parentNode.firstChild.value);alert('Save Codez To The Clipboard !');}catch(e){alert('Please Copy The Selected Codez !');this.parentNode.firstChild.select();}\">
<input type='button' value='保存代码' onClick=\"str=this.parentNode.firstChild.value;code_win=window.open('about:blank','_blank','top=10000');code_win.document.writeln(str);code_win.document.execCommand('saveas','','code.html');code_win.close();\">
(提示:可以先修改部分代码)
</td></tr>
</table>";
}
function get_list_html($content, $type = "") {
$content = preg_replace("/(<br \/>)?[\r\n]+/", "\n", $content);
$content = preg_replace("/[\r\n]+/", "\n", $content);
$content = preg_replace("/^[\n]*(.*)[\n]*$/m", "\\1", $content);
$content = str_replace("\n", "</li><li>", $content);
$content = "<ul type='$type'><li>$content</li></ul>\n";
return $content;
}
function html_trans($str) {
$search = array("&", "'", "\"", "<", ">", " ", "\t");
$replace = array("&", "'", """, "<", ">", " ", " ");
return nl2br(str_replace($search, $replace, $str));
}
function link_url($str) {
$str = preg_replace("/((http
关键词:PHP - Html Transfer Code