blockphp

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 插件 discuz
查看: 3110|回复: 2

代码高亮插件效果

[复制链接]

19

主题

34

帖子

1028

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1028
关注我 催更
发表于 2023-2-10 21:54:28 | 显示全部楼层 |阅读模式
html
<div class="bphpCode-lang">
        <ul>
                {loop $pConfig['langs'] $lang}
                <li>{$lang}</li>
                <li>{$lang}</li>
                {/loop}
        </ul>
</div>

php
function post_middle(){
        global $_G;
        $pConfig = $_G['cache']['plugin']['bphp_code'];
        $pConfig['block'] = unserialize($pConfig['block']);
}

js
//添加编辑器样式
addStyle = function(){
        bphpJQ(".area iframe").contents().find("head").append('<style>.bphp_code_area:before{content:""; border-radius:3px 3px 0 0; background:#F7F7F7; padding:2px 5px; height:5px; color:#999; line-height:12px;font-size:11px; position:absolute; border:1px solid #ddd; border-bottom:none; top:-10px;right:5px;} .bphp_code_area{display:block; position:relative; height:auto;  margin:10px 0; text-decoration:none; color:#666; background:#F7F7F7; padding:10px !important; border-radius:3px;border:1px solid #ddd;}</style>');
        bphpJQ(".area iframe").contents().find('a').each(function(key,val){
                var href = bphpJQ(val).attr('href');
                var pat = /^bphpcodelang-/;
                if(pat.test(href)){
                        bphpJQ(val).addClass('bphp_code_area');
                        bphpJQ(val).addClass('bphp_code_area_'+key);
                        
                        //语言小标签
                        var lang = href.split('bphpcodelang-');
                        bphpJQ(".area iframe").contents().find("head").append('<style>.bphp_code_area_'+key+'::before{content:"'+lang[1]+'";}</style>');

                        var code = bphpJQ(val).html();
                        code=code.slice(0,-4); //去掉多出来的<br>
                        bphpJQ(val).html('<div  style="min-height:18px;">'+code+'</div>');
                }
        });
}

css
#bphp_code{background:url(source/plugin/bphp_code/static/code.png)no-repeat center center; position:relative;text-decoration:none;overflow:auto;}
#bphp_code:hover{background-color:#fff !important;}
.bphpCode-lang{position:absolute;top:0px;left:0px;background:#fff;width:120px;border: 1px solid rgba(0, 0, 0, 0.1);border-radius: 6px;padding: 5px;box-shadow: 0 3px 4px rgb(0 0 0 / 15%);display:none;}
.bphpCode-lang ul li{cursor:pointer;font-size:14px;padding:1px 5px;border:1px solid #fff;}
.bphpCode-lang ul li:hover{background-color: #fff5d4;border: 1px solid #dcac6c;}

java
Date date = new Date();
SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
System.out.println(dateFormat.format(date));

c
int main()
{
        char *format_time_string[128] = {0};
        long long curr_time = (long long)get_timestamp();
        get_format_time_string((char *)format_time_string);
        printf("timestamp:%lld, format time:%s",curr_time,format_time_string);
        return 0;
}

go
timeUnix:=time.Now().Unix()            //单位s,打印结果:1491888244
timeUnixNano:=time.Now().UnixNano()  //单位纳秒,打印结果:149188824475278446

python
import time
start_time = time.time()
sum = 0
for i in range(1000000):
    sum += i
end_time = time.time()
print("程序执行了%f秒"%(end_time - start_time))





回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2024-8-20 10:08:18 | 显示全部楼层
本帖最后由 domohu 于 2024-8-20 10:09 编辑

int main()
{
return 0;
}


回复

使用道具 举报

0

主题

1

帖子

6

积分

新手上路

Rank: 1

积分
6
发表于 2024-9-25 15:59:50 | 显示全部楼层
我也试试

<!DOCTYPE html>
<html lang="en">
<head>
        <meta name="viewport" content="width=device-width" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>WordPress &#8250; ReadMe</title>
        <link rel="stylesheet" href="wp-admin/css/install.css?ver=20100228" type="text/css" />
</head>
<body>
<h1 id="logo">
        <a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>

<h2>First Things First</h2>
<p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I am proud to be a part of. Thousands of hours have gone into WordPress, and we are dedicated to making it better every day. Thank you for making it part of your world.</p>
<p style="text-align: right">&#8212; Matt Mullenweg</p>

<h2>Installation: Famous 5-minute install</h2>
<ol>
        <li>Unzip the package in an empty directory and upload everything.</li>
        <li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser. It will take you through the process to set up a <code>wp-config.php</code> file with your database connection details.
                <ol>
                        <li>If for some reason this does not work, do not worry. It may not work on all web hosts. Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
                        <li>Save the file as <code>wp-config.php</code> and upload it.</li>
                        <li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser.</li>
                </ol>
        </li>
        <li>Once the configuration file is set up, the installer will set up the tables needed for your site. If there is an error, double check your <code>wp-config.php</code> file, and try again. If it fails again, please go to the <a href="https://wordpress.org/support/forums/">WordPress support forums</a> with as much data as you can gather.</li>
        <li><strong>If you did not enter a password, note the password given to you.</strong> If you did not provide a username, it will be <code>admin</code>.</li>
        <li>The installer should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username and password you chose during the installation. If a password was generated for you, you can then click on &#8220rofile&#8221; to change the password.</li>
</ol>

<h2>Updating</h2>
<h3>Using the Automatic Updater</h3>
<ol>
        <li>Open <span class="file"><a href="wp-admin/update-core.php">wp-admin/update-core.php</a></span> in your browser and follow the instructions.</li>
        <li>You wanted more, perhaps? That&#8217;s it!</li>
</ol>

<h3>Updating Manually</h3>
<ol>
        <li>Before you update anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</li>
        <li>Delete your old WordPress files, saving ones you&#8217;ve modified.</li>
        <li>Upload the new files.</li>
        <li>oint your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
</ol>

<h2>Migrating from other systems</h2>
<p>WordPress can <a href="https://developer.wordpress.org/advanced-administration/wordpress/import/">import from a number of systems</a>. First you need to get WordPress installed and working as described above, before using <a href="wp-admin/import.php">our import tools</a>.</p>

<h2>System Requirements</h2>
<ul>
        <li><a href="https://www.php.net/">HP</a> version <strong>7.2.24</strong> or greater.</li>
        <li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.5.5</strong> or greater.</li>
</ul>

<h3>Recommendations</h3>
<ul>
        <li><a href="https://www.php.net/">HP</a> version <strong>7.4</strong> or greater.</li>
        <li><a href="https://www.mysql.com/">MySQL</a> version <strong>8.0</strong> or greater OR <a href="https://mariadb.org/">MariaDB</a> version <strong>10.5</strong> or greater.</li>
        <li>The <a href="https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> Apache module.</li>
        <li><a href="https://wordpress.org/news/2016/12/moving-toward-ssl/">HTTPS</a> support.</li>
        <li>A link to <a href="https://wordpress.org/">wordpress.org</a> on your site.</li>
</ul>

<h2>Online Resources</h2>
<p>If you have any questions that are not addressed in this document, please take advantage of WordPress&#8217; numerous online resources:</p>
<dl>
        <dt><a href="https://wordpress.org/documentation/">HelpHub</a></dt>
                <dd>HelpHub is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
        <dt><a href="https://wordpress.org/news/">The WordPress Blog</a></dt>
                <dd>This is where you&#8217;ll find the latest updates and news related to WordPress. Recent WordPress news appears in your administrative dashboard by default.</dd>
        <dt><a href="https://planet.wordpress.org/">WordPress Planet</a></dt>
                <dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
        <dt><a href="https://wordpress.org/support/forums/">WordPress Support Forums</a></dt>
                <dd>If you&#8217;ve looked everywhere and still cannot find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
        <dt><a href="https://make.wordpress.org/support/handbook/appendix/other-support-locations/introduction-to-irc/">WordPress <abbr>IRC</abbr> (Internet Relay Chat) Channel</a></dt>
                <dd>There is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="https://web.libera.chat/#wordpress">irc.libera.chat #wordpress</a>)</dd>
</dl>

<h2>Final Notes</h2>
<ul>
        <li>If you have any suggestions, ideas, or comments, or if you (gasp!) found a bug, join us in the <a href="https://wordpress.org/support/forums/">Support Forums</a>.</li>
        <li>WordPress has a robust plugin <abbr>API</abbr> (Application Programming Interface) that makes extending the code easy. If you are a developer interested in utilizing this, see the <a href="https://developer.wordpress.org/plugins/">lugin Developer Handbook</a>. You shouldn&#8217;t modify any of the core code.</li>
</ul>

<h2>Share the Love</h2>
<p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better&#8212;you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgeable than yourself, or writing the author of a media article that overlooks us.</p>

<p>WordPress is the official continuation of <a href="https://cafelog.com/">b2/caf&#233;log</a>, which came from Michel V. The work has been continued by the <a href="https://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="https://wordpress.org/donate/">donating</a>.</p>

<h2>License</h2>
<p>WordPress is free software, and is released under the terms of the <abbr>GPL</abbr> (GNU General Public License) version 2 or (at your option) any later version. See <a href="license.txt">license.txt</a>.</p>

</body>
</html>

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|blockphp ( 粤ICP备2022155990号 )

GMT+8, 2024-10-23 22:22 , Processed in 0.133784 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表