盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

PHP - Html Transfer Code

时间:2024/11/24作者:未知来源:盾怪网教程人气:

[摘要]"); 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'>&nbsp; &nbsp;<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("&amp;",        "&#39;",        "&quot;",        "&lt;",        "&gt;",        "&nbsp; ",        "&nbsp; &nbsp; ");
        return nl2br(str_replace($search, $replace, $str));
}


function link_url($str) {
        $str = preg_replace("/((http

关键词:PHP - Html Transfer Code




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版