|
Author:Eric.Wang Plugin URL:http://wordpress.org/extend/plugins/wp-codebox/ Tags: syntax highlighting, syntax, highlight, code, formatting Requires at least: 2.0 Tested up to: 2.5.1 Stable tag: 1.3.1 Download |
Donate for this plugin development, Thanks! |
== Description ==
WP-CODEBOX代码高亮插件,支持多种语言、代码下载、复制到剪贴板、代码框收放及后台默认属性设置。本插件还在持续开发中,欢迎使用及报告bugs.
Wp-CodeBox provides clean syntax highlighting and advanced feature for embedding source code within pages or posts. It support a wide range of popular languages highlighting with line numbers, code download, Copy to clipboard, collapse codebox, automatic keywords link to API manual and maintains formatting while copying snippets of code from the browser.
It’s provide simple background configuration for highlighter style/formatting customization.
Since the plugin is developing, in the future it will support more options.(CSS option,Keyword display style,Auto Caps/Nocaps,Case Sensitivity etc. )
== Basic Usage ==
Wrap code blocks with `<pre lang=”LANGUAGE” line=”1″ file=”download.txt” colla=”+”>` and `</pre>`
Possible Parameters:
`LANGUAGE` is a [GeSHi] supported language syntax;
`file` will create a code downloading attribute.;
`line=”n”` will hide the single codebox;
`colla=”+/-”` will expand/collapse the codebox.
`line,file,colla` is optional.
== Installation ==
1. Upload WP-CodeBox.zip to your Wordpress plugins directory, usually `wp-content/plugins/` and unzip the file. It will create a `wp-content/plugins/WP-CodeBox/` directory.
2. Activate the plugin through the ‘Plugins’ menu in WordPress.
3. Go to Option->Wp-CodeBox set default setting.
4. Create a post/page that contains a code snippet following the [proper usage syntax]
== Frequently Asked Questions ==
When activate the plugin, popup the error: “Fatal error: Cannot redeclare class GeSHi in ##/wp-content/plugins/wp-codebox/geshi/geshi.php on line 158″?
Answer:disactivate other Gashi based syntax highlighter plugin first.
== Screenshots ==
1. PHP, no line numbers.
<div id="foo"> <?php function foo() { echo "Hello World!\\n"; } for (\$i = 0; \$i < 10 $i++) { foo(); } ?> </div> |
2. Java, with line numbers, collapse codebox.
1 2 3 4 5 | public class Hello { public static void main(String[] args) { System.out.println("Hello World!"); } } |
3. Ruby, with line numbers starting at 18,downloading feature.
18 19 20 21 22 | class Example def example(arg1) return "Hello: " + arg1.to_s end end |
4. Administration interface in WordPress 2.
== Usage ==
**Example 1: PHP, no line numbers**
<pre lang=”php” line=”n”>
<div id=”foo”>
<?php
function foo() {
echo “Hello World!\\n”;
}
for (\$i = 0; \$i < 10 $i++) {
foo();
}
?>
</div>
</pre>
**Example 2: Java, with line numbers, collapse codebox**
<pre lang=”java” colla=”-”>
public class Hello {
public static void main(String[] args) {
System.out.println(“Hello World!”);
}
}
</pre>
**Example 3: Ruby, with line numbers starting at 18, code downloading(ruby.txt)**
<pre lang=”ruby” line=”18″ file=”ruby.txt”>
class Example
def example(arg1)
return “Hello: ” + arg1.to_s
end
end
</pre>
== Supported Languages ==
The following languages are supported in the `lang` attribute:
Actionscript,ADA,Apache Log,AppleScript,ASM,ASP,AutoIT,Backus-Naur form,Bash,BlitzBasic,C,C for Macs,C#,C++,CAD DCL,CadLisp,CFDG,CFDG,ColdFusion,CSS,Delphi,DIV,DOS,Eiffel,Fortran,Fortran,FreeBasic,GML,Groovy,HTML,Inno,IO,Java,Java 5,Javascript,LaTeX,Lisp,Lua,Microprocessor ASM,mIRC,MySQL,NSIS,Objective C,OCaml,OpenOffice BASIC,Oracle 8 SQL,Pascal,Perl,PHP,PL/SQL,Python,Q(uick)BASIC,robots.txt,Ruby,SAS,Scheme,SDLBasic,Smalltalk,Smarty,SQL,T-SQL,TCL,thinBasic,Uno IDL,VB.NET,Visual BASIC,Visual Fox Pro,Winbatch,X++,XML,Z80 ASM
==Release Notes==
**1.0** : First internal release; Uses GeSHi v1.0.7.20;
**1.0.1** : Add View Code AJAX feature;
**1.1** : Add simple background configuration for highlighter style/formatting customization;
**1.2** : css tuning and option i18n compatible;
**1.2.1** : Uses GeSHi v1.0.7.21;
**1.2.2** : WP 2.5 compatible;
**1.2.2.1** : Correct small bugs;Improve the css layout to stick the code header; Contributor:YiXia.
**1.2.3** : Uses GeSHi v1.0.7.22, add the keywords link to API manual option.
== Donate ==
== Future Feature==
It will provide backgroud option for highlighter style customization(CSS option,keyword display style,Auto Caps/Nocaps,Case Sensitivity etc.) in the future version.



(65 votes, average: 4.66 out of 5)


老大,能帮我看一下吗?为什么我的显示不正常!
Reply代码太长会导致横行滚动栏代码不能完全显示的问题,
看一下这个http://www.freeopens.com/2010_01_31.html
麻烦进行一下指导!
谢谢
ie6、7下如果代码太长会导致横行滚动栏挡住代码的问题,麻烦进行下修正
Reply以下详细信息以及我个人的临时修正方法,请指教:
http://www.jhdxr.com/blog/html/tech/fix-wp-codebox-show-bug-for-ie6-and-ie7.html
希望老大能解决这个问题!太痛苦了!
Reply我在同一篇文章里放了2个代码
Reply结果后面那个显示不正常了。。。。
Chrome下
恩 又有一个问题是这个插件不知道Wrap属性?如果代码太长。我不想出现横向滚动条要怎么办?
Reply此插件在2.91下无法使用?我启用后用无高亮。选项设置是有的但是无论设置什么都不会改变。。看文件头也没有显示有插入WP-CODEBOX的相关文件。
Reply我找到为什么了 因为我的footer文件没有插入 看别的插件说明知道这个是用来加载JS用的
Reply晕 忘记标签。是因为footer文件没有加入
Replythanks , very useful .
ReplyThx for sharing
Reply非常感谢,问题解决!
Reply你好,使用这个插件很不错,不过现在有一个小毛病,
Replyhttp://www.clang.cn/blog/?p=603
边上的line行数效果有些变形,能帮忙分析一下原因吗?
Hi,
is it possible to hide the header/function bar of the Code-Box by parameter/attribute in the pre-Tag?
If not, this would be a good feature for future versions.
Reply.line_numbers pre {padding-left: 10px;}
Reply改成:.line_numbers pre {padding: 0px;}
I’ve added a custom CSS so that CodeBox doesn’t go too big for large codes:
.wp_codebox{
Replymax-height: 800px;
overflow: auto !important;
}
Hi,
i updated the italian translation.
You can find it here:
http://gringo.netsons.org/blog/download/200/
Can you please add it to the sources?
Thanks,
ReplyDiego
WP-CodeBox在WordPress2.8.6显示有问题。试了好多次。无法使用
http://stackoverflow.com/questions/1853590/anyone-using-wp-codebox-1-4-with-wordpress-2-8-6
Reply额。。。几分钟前提示跟新了。。问题解决。。
Replyvery nice thanks
Replytanx for this post :d i love this web
Replyoh great features..
ReplyHow to removal language type title next to ‘view code’ on functionality bar?
Reply请教
file=”Download ruby.txt”:创建一个可下载的保存名称
这个ruby.txt文件应放在哪个路径??
Reply//全部选中全部取消处理
function CheckTrue(obj)
{
$("input[type=checkbox][name=checkItem]").attr("checked",$(obj).attr("checked"));
}
//收集被选中的项
function CollectCheckItems()
{
var allcheckboxs=$("input[type=checkbox][name=checkItem][checked]");
var ids=new StringBuilder();
for(var i=0;i<allcheckboxs.length;i++)
{
var id=$(allcheckboxs[i]).attr("id").split("_")[1];
ids.Append(id)
ids.Append(",");
}
var strIds=ids.ToString();
return strIds.substr(0,strIds.length-1);
}
本文来自CSDN博客,转载请标明出处:http://www.cnblogs.com/xuezhizhang/archive/2009/10/28/1591639.html
Replythanks for this poste
Replyvery good! tanks;
Replyvery helped me !
Eric,
ReplyVery nice plugin! One question: When I try to include a html statement in the codeBox the html chars are converted ie > becomes > I’ve tried everything I can think of – in both normal and html code view. Any hints would be gratefully appreciated. Thanking you in advance…
Hi..
thanks for this plugin
but, I have a simple question.
Can this plugin used in wordpress theme? How can use it?
Sorry for my english..
Reply很不错的插件,为何不更新了?
ReplyHi Eric!
I created the Hungarian translation of your script.
ReplyDownload link: http://vrnagy.ath.cx/stuff/wp-codebox-hu_HU.mo
Thanks for the excellent Plugin.
I found one small problem with the Plugin. You are directly including the JavaScript files instead of using wp_enqueue_script function http://codex.wordpress.org/Function_Reference/wp_enqueue_script
The advantage of using this function is that, this will not include jQuery again, if it is already included by some other Plugin or by theme.
Replymain.php中,引用admin.js的时候,不符合新的XHTML规范,应该为script type=”text/javascript”,而不是script language=”javascript”
ReplyFigured out what my problem was! It’s the freaking double quotes used in this blog. I copy/pasted the code but didn’t work correctly. Type your own double quotes otherwise it won’t work!
http://wordpress.org/support/topic/282918?replies=2#post-1115173
Replyi have a problem with html entities like &_lt; and &_gt; (_ just added to show the entities).
i have to use html entities in pre tags to keep my site (x)html valid and wordpress converts all < to &_lt; as it’s supposed to do. The problem i have is related to wp-codebox because when i have the plugin enabled the entities are shown instead of decoded!
when i disable the plugin the normal pre is used and the entities get decoded and shown as < or >
can anyone track the problem down in wp-codebox?
Replyi had a look at the code but couldn’t find a solution
Even I have the same problem. The hml entities are not decoded properly by the Plugin.
Does anyone know how to fix it? I am even ready to sponsor someone who can fix this.
ReplyI have already installed WP-Codebox. And How to use that? Please explain me details and I want to show the HTML code in the post with this code box.
ReplyHi, i translate this plug-in to turkish but i dont know how i can use with my translation. Is there any option for this? or where can i edit for set it?
ReplyOn FF works fine.Anyway, I like too much your plugin, it’ the best I have seen on syntax highlighting.
Replyrn本文来自:www.EricBess.com 详细出处参考:http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/
You need to add “text-align:left;” to “.wp_codebox pre” otherwise in some circumstances all of the code will be centered.
ReplyI would like to know how to display something like:
<?php
//…
echo ”;
echo ‘';
?>
Can't find anything over here -.-
I know this is creepy stuff, but at the moment i'm using " //sorry" and that would be ok.
Cheers!
Replywow … i’m such an idiot XD
it’s :
and atm. i’m using <\/pre>
Replyhell …..
i give up, just del this ….
ReplyWorks great, thank you
Reply非常支持!做的很棒。
ReplyThe last version of the HTML spec now defines a way to specify the programming language in the markup.
Example:
<pre><code class=”language-pascal”>var i: Integer;
begin
i := 1;
end.</code></pre>
Source:
http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-code-element
Can a new version of the plugin be updated to use this syntax?
Reply请问如何高亮html语句啊?
Replynot working with wp 2.7
ReplyThis blog is working in WP 2.7
ReplyI can not get the C# code to work. I have to use pre lang = “C” to get a close representation of C#. Can you help with this. Check out my site to see the post I am having trouble with.
Replylang = “csharp”
Replythank you, I really need it.
ReplyIs there a way to enable/disable the function bar in a code block via the pre switches to override the default behavior of hiding the function bar? Something like bar=”+/-” similar to the colla=”+/-”? Thanks again for a wonderful plugin!
Reply暈~~ 下面那個帖,看不圖,我把地址發上來了。下圖的英文選項,都是什麽意思? h ttp://test.35sun.com/temp/wp-codebox-1.gif
Reply↓↓這個選項,我試了,無論是否勾選,都沒看到什麽變化。h ttp://test.35sun.com/temp/wp-codebox-2.gif
你好,請問兩個後台設置的問題,1。下圖的英文選項,都是什麽意思? 2。↓↓這個選項,我試了,無論是否勾選,都沒看到什麽變化。
ReplyHai,
Any ideas how?
ReplyOn the wordpress plugins page, it says you get a button in your TinyMCE editor.
Looks like I don’t get this button
Wordpress version: 2.7
Thanks,
Me
File download problem after install 1.3.31, fixed by alter line 38 in wp-codebox.php to,
Replyif (preg_match(“/\s*<pre(.*file=[\"']“.$download.”[\"'])[^>]+>(.*)<\/pre>\s*/siU”, $content, $match)) {
If anyone has the same problem, try this fix.
It seems, that there’s a Bug! ^^
ReplyI can’t highlight AutoIT-Code with this Plugin – try it – u will got something like:
span style=”color: #0080FF; font-style: italic; font-weight: bold;”> =”color: #0080FF; font-style: italic; font-weight: bold;”>=”color: #0080FF; font-style: italic; font-weight: bold;”>/=”color: #0080FF; font-style: italic; font-weight: bold;”>/www.autoitscript.com/autoit3/docs/functions/MsgBox.htm”>/3/=”color: #0080FF; font-style: italic; font-weight: bold;”>>msgbox<=”color: #0080FF; font-style: italic; font-weight: bold;”>/a>(=”color: #0080FF; font-style: italic; font-weight: bold;”>=”color: #AC00A9; font-style: italic; font-weight: bold;”=”color: #0080FF; font-style: italic; font-weight: bold;”>>0,=”color: #0080FF; font-style: italic; font-weight: bold;”> =”color: #0080FF; font-style: italic; font-weight: bold;”>”Warum?”span style=”color: #0080FF; font-style: italic; font-weight: bold;”> =”color: #0080FF; font-style: italic; font-weight: bold;”>,=”color: #0080FF; font-style: italic; font-weight: bold;”> =”color: #0080FF; font-style: italic; font-weight: bold;”>”Weil ichs kann !”span style=”color: #0080FF; font-style: italic; font-weight: bold;”> =”color: #0080FF; font-style: italic; font-weight: bold;”>)=”color: #0080FF; font-style: italic; font-weight: bold;”>
不错,顶一个
ReplyThanks..
ReplyHi,

ReplyMe, again
I use some knowledge on this blog post: ‘Styling code samples par deux‘ and it seems to get me to a point there I can go further, I hope
Regards
Hi,
ReplyI have install your PlugIn wp-codebox. I have WordPress 2.3.3 and a own styled template. (With two big css-style-files)
The only result I get is the same has I use the ‘<pre>-tag, stand alone.
I suspect that there is some css-issue.
You can look at a sample post on this link:http://blogg.ngn.nu/index.php/2009/01/14/testar-syntax-highligt-wp-codebox/The blog is in Swedish but I think you can understand the post anyway
Can you (any) give me some idea?
Is there additional information you (any) need to help me out?
Regards
Hi Eric,
Replynice plugin!
I translated it in italian and put the file here:
http://gringo.netsons.org/blog/download/200/
I hope this can be usefull for you and that will be soon integrated in the next release.
Bye.
Hello.
ReplyI have wordpress 2.7 and I have a problem with your plugin. When I click for download source code in txt, load this page: …/wp-content/plugins/wp-codebox/wp-codebox.php?p=1&download=download.txt but the page is in white. I have been studying the source code and it have an error in wp-codebox.php line 39: the regular expression do not match and never send the content.
How can I resolve this? Many thanks.
Regards.
My codes are not spacing out
ReplyWhy is this?
您好,安裝plugin後,無意間要export出blog資料時發生了一些錯誤,如下
ReplyWarning: include_once(../../../wp-config.php) [function.include-once]: failed to open stream: No such file or directory in /plugins/wp-codebox/wp-codebox.php on line 32 Warning: include_once() [function.include]: Failed opening ‘../../../wp-config.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /plugins/wp-codebox/wp-codebox.php on line 32 Warning: include_once(../../../wp-settings.php) [function.include-once]: failed to open stream: No such file or directory in /plugins/wp-codebox/wp-codebox.php on line 33 Warning: include_once() [function.include]: Failed opening ‘../../../wp-settings.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /plugins/wp-codebox/wp-codebox.php on line 33
可否煩請您查看一下,感謝
When I try to write bare HTML my attributes are delete after I save. I’m using wordpress mu. I guess thats the reason it does not trigger the box.BTW, your site encoding is broken badly. It looks like asians encoding errors although your wordpress anounces UTF8. I even can’t read the button texts. Just guessing…
Reply你好,感谢你的插件,我今天比较了好几个code的插件,你这个是最好的。但是。提一个小问题:
Replyfile=”Hello.java”却显示的文件名是hello.java。这样存下来的java文件是不能编译的,请想办法解决一下,java大小写敏感。
改了下,没有改版本号,你重新下载安装一下,
Reply在ff和opera里不能显示“Copy to Clipboard”
Reply恭喜你答对了,你可以参与改进。
Reply好了,原来是option.php的问题
Reply升级之后到1.3.3之后,不能改main.php里的View Code和Copy to Clipboard为中文了,改成中文后,页面就乱七八糟的了,原来的版本没有这个问题
ReplyI am have a bit of trouble getting this line to work correctly once I have changed it. I want to support both <code> and <pre> statements. I can make it support one or the other but I want it to support both. Any suggestion on the regex of how to make this work without breaking it?
Replyfunction wp_codebox_before_filter($content)
{
return preg_replace_callback(
”/\s*<(code|pre)}(?:lang=[\"']([\w-]*)[\"']|file=[\"']([\w-]*\.?[\w-]*)[\"']|colla=[\"']([\+\-])[\"']|line=[\"'](\d*|n)[\"']|\s)+>(.*)<\/(code|pre)>\s*/siU”,
”wp_codebox_substitute”,
$content
);
}
Just had the following error while clicking on ruby.txt :
Replyhttp://www.ericbess.com/ericblog/wp-content/plugins/wp-codebox/wp-codebox.php?p=134&download=ruby.txt
fixed
ReplyHi,
ReplyThanks for your plugin but it have 2 bugs :
1) the numbers of lines are shifted over the code :s
And 2) at the admin dashboard, for edit settings of you plugin, I get this :
You are not a LEVEL 8 or above USER & hence you cannot configure WP-CodeBox. If you are a LEVEL 8 or above USER, then please Logout & Login again.
Thanks by advance for your reply and if need, correct theses bugs…
fixed in new version.
Reply刚才说的有误,第二步中应该像Werbeagentur-Wissen说的那样,只注释’&’ => ‘&’就行了,如果都注释了,别的地方就有问题了。第三步对于javascript来说是必须的,其它语言视情况而定。暂时没有发现其它问题。
Reply终于找到解决办法了。一是发布的时候必须写到源代码里,代码中如果有<,其后必须是空格,不能是其它任何字符,否则返回可视化编辑器修改时会被认为非法html标签,其后内容会被删除。二是修改wp-codebox/geshi/geshi.php,将function hsc里的’&’ => ‘&’,'”‘ => ‘"’,'<’ => ‘<’, ‘>’ => ‘>’,注释掉,前面留言的Werbeagentur-Wissen已经提到了。三是修改wp-codebox/geshi/geshi/javascript.php,将’SYMBOLS’ => array中的&去掉或者改成&&,这根据你要发布的语言种类不同而不同
Reply又研究了一下,发现如果直接粘贴到源代码里,紧挨着<后边有字符的话,返回可视化编辑器时,可视化编辑器就认为这是html标签,而这个标签不是有效的话,后边的内容就会被删除。如果直接粘贴到可视化编辑器里,可视化编辑器会对粘贴的代码重新进行编排,加些<br>之类的标签,再从wp-codebox输出时,就肯定不正确了。所以只能粘贴到源代码里,且不能有被可视化编辑器认为是html标签的字符串。这样粘贴之后,从源代码返回可视化编辑器时,可视化编辑器不会对代码重新进行编排,只是将特殊字符<>”&等变成<>"&。按说这样就应该可以了,可是我的wp-codebox不能把这些特殊字符变回原样,还是显示<>"&,不知道什么原因。请帮帮忙,给点提示。
Reply郁闷啊,折腾半天了,<和>问题还是搞不定。一碰到<或者>,返回可视化编辑器里就被截断了,<>后边啥都没有了。除非发布出来不修改了,否则回来修改又啥都没了。要是直接在可视化编辑器里粘贴代码,发布出来就全是html代码。我用的是javascript,里边有个<号就不行了,到底该咋办啊?看了半天也没看明白后边评论里有啥有效的好办法
ReplyFatal error: Cannot redeclare class geshi in /home/content/h/i/g/hightfly/html/blog/wp-content/plugins/wp-codebox/geshi/geshi.php on line 243
Reply@kyle:
ReplyI had the same problem: I just comment the line out – it seems to work here.
Sincerly,
DaB.
for everyone with problems like EcApS – just open /wp-codebox/geshi/geshi.php, look where the function hsc is defined and outcomment the first escape- array element(“&”). different wp users, different usages
ReplyI have just insttaled it.. the html code doesn’t get colored unfortunately, but it’s quite great thank you!
ReplyHi,Is there a way to set the “height” of the codebox? For example, I would like to set the height to 15 lines, and if my code is longer, it just adds a vertical scrollbar.Thanks!
Reply> ; 的意思是说pre标签中出现><号必须使用> ;和< ;。本来在pre标签中使用> ;和< ;是能正确显示的,但加上GESHI之后就不能正确解析。这个问题是GESHI的问题,不是插件的问题。但的确希望作者能尽量修正。在pre标签中直接使用><可以解决这个问题,并且在ie67和ff中都正确。但造成的后果是不能通过xhtml1.0验证。我想这虽然可行,但不是件好事。
ReplyExcellent plugin – I need to override some CSS to tidy things up, but excellent – thanks!
ReplyI finnaly get it worked in my WP blog.We are supposed to edit the code in “Code” view, not in “Visual”, then everything works fine.Nice work, pal.
Reply$hHead .= “<!–[if IE]>\n<style type\”text/css\”>\n”; $hHead .= “.wp_codebox { overflow-x: auto; overflow-y: hidden; padding-bottom: expression(this.scrollWidth > this.offsetWidth ? \”15px\” : 0); width: 100%; }\n”; $hHead .= “</style>\n<![endif]–>”;
Reply把这个加到
function codebox_header()
并删掉css中的/*ie hack*/部分来通过css校验
再来,如果在后台settings-writing中开启了WordPress should correct invalidly nested XHTML automatically
Reply那么像<?php 就会变成< ?php多了一个空格,<!-会变成< !-能不能自动把这个filter跳过去
重新修改了一点点代码,为了精简输出的html,去掉不需要的id地址还是在http://www.e-xia.com/2008/05/wp-codebox-122-bug-fix/不过不理解的就是为什么要放cookie呢?是不是以后想保持开关的状态?做的时候碰到一点点小问题,真是哭笑不得,平时都是onclick=”javascript:function()”,然后在function里就可以直接用this来获得调用这个function的object,我首页的achive list前面的[+]也是这么做的,基本上是一样的javascript,一样的html,但是在wpcd_toggle_collapse里调用this就是不对,最后只能把this当一个参数传进来了,相当郁闷,你知道是为什么吗?上次压缩包里面的js好像放错folder了,这次的也改正了,有兴趣的话就再下一次吧。还有你说的”n”不能copy没试出来,反正用你给的3个例子,都能成功copy,可能是我理解有误,也有可能是js放错的关系。
Reply不知道为什么这个插件在我的blog上就是不起作用,在active插件时不报错,更改设置也不报错,在html源文件里能看到引用了codebox的js和css
Reply我在html编辑状态下添加的<pre…,在可见即可得模式下也试过,都失败了,我还禁用了所有插件,同样不起作用。我直接copy了这里的示例代码,也没用
怎样才能确切知道这个插件是不是起作用了呢,在html源文件会有什么变化?
原因找到,是因为下载的版本不正确引起的
http://downloads.wordpress.org/plugin/wp-codebox.zip
这里下载的,没敢用迅雷,右键直接下载的
另外,报告bug一个:在main.php里的get_settings(‘home’)请改成get_settings(’siteurl’),因为我的index.php不在安装目录,如果用home的话引用js和css会报错。
另一个bug是<和>都显示<和>这个不知道是不是和别的插件冲突,明天继续测试。
谢谢提供那么好的插件
Reply把我前面写得留言都删掉吧,谢谢,自己都觉得太罗嗦了
Reply不过今天又继续抓虫,因为真的很喜欢这个插件。
主要是copy to clipboard这个方法,因为只能在ie而且是在expand的时候才能用,所以在php代码里面加了如果不是ie隐藏这个链接,在javascript里面加了如果显示[-]的时候隐藏这个链接
还有,现在的view和download都把代码第一行最前面的空格去掉了,不是很舒服,所以把trim都去掉了,download的正则表达式加了<pre….>.*\n(来去掉最前面的一个空行。
发在http://www.e-xia.com/?p=58,如果有兴趣的话可以看一下。
另外我找到了http://www.jeffothy.com/weblog/clipboard-copy/这个写了如何在firefox下实现copy to clipboard,不过因为当中要引用了一个swf,不知道怎么把这个的地址放到js里,能想到的只能是参数传递,不太舒服,所以也就没有用了。
感想您对WPCD的支持, 你所做的修改正是WPCD所欠缺的。我正在逐个把你做的修改做测试并加到发布版,在changlog日志中加上了贡献人信息。
Reply同时也向你报告你的修改文件的一个bug. line=”n” 时 copy to clipboard无作用。
<,>问题是wordpress editor hooks 在捣鬼,应该是可以解决的。
没想到你真的会看哦,很感动的说,其实我从来都不用copy to clipboard也就没有好好测试,我用firefox的,对ie的测试做得不好 :redface:
ReplyVery nice plugin, thank you.
ReplyThis is another vote to keep the [Copy to Clipboard][+] visible at all times (with either word wrap or cleverer use of CSS)
Thanks, I’m finding it very useful.
Wonderful plugin ! but 1 more thing.
ReplyHow can I make word-wrap(no auto scrollbar) ?
can’t work with wordpress 2.5
Reply不能在2.5版下使用哦..
希望早日更新
Try it again!
ReplyWhen I wrap (without the spaces) around basic html, it breaks and doesn’t work.
ReplyYou need to move the ‘copy to clipboard’ to the left sign. I use this for SQL scripts. When they are too long (and most are), you can’t see the ‘copy to clipboard’ unless you go to the bottom of the script and then use the scrollbar to scroll to the right. Most users don’t even realize it’s there as a result.
Great plugin otherwise.
ReplyOopss.. I meant left “side” obviously. Thx!
ReplyNice plugin but it breaks the Lightbox-2 plugin (http://wordpress.org/extend/plugins/lightbox-2/). If your WP-CODEBOX plugin is enabled at the same time as Lightbox-2, Lightbox-2 doesn’t work (it just shows the images in the browser window, i.e. the Ajax calls fail).
FYI …
ReplyHi there,
Thanks for an awesome plugin.
I’ve got it working by writing my posts in ‘code’ view in wordpress. However, when I edit the article, it goes back to the ‘visual’ view on wordpress. When I switch back to the ‘code’ view, the following happens:
For php:
1. becomes ?>
3. ‘ becomes \’ and each time I edit the article, another \ (slash) is added
Do you have any idea why this might be happening or am I doing something wrong?
Cheers and thanks for the plugin!
ReplyOops! Looks like my comment didn’t come through properly. I’ll try again.
1. <?php disappears
2. ?> becomes ?& gt; (without the space between & and gt; – I just can’t post that in this comment)
3. ‘ becomes \’ and each time I edit the article, another \ (slash) is added
Thanks again
ReplyDoes no work with “>”
exemple:
shown:
ReplyIf Prototype or LightBox or ProtoBox or whatever does not work with WP CodeBox, you will have to do the following:
Open /wp-content/plugins/wp-codebox/js/codebox.js and find these lines:
function $(id) {
return document.getElementById(id);
}
Then replace it with
if (‘undefined’ == typeof $) {
function $(id)
{
return document.getElementById(id);
}
}
Since Prototype’s $ function is extented with respect to CodeBox’s one, the code should work fine.
ReplyHope this helps.
That is not working on IE7
ReplyI’am Ie 7, no problem!
ReplyI mean, the workaround vladimir posted (and you integrated on wp-codebox). I’m using wp-codebox with lightbox-2 and codebox breaks the lightbox-2 script. On FF works fine.Anyway, I like too much your plugin, it’ the best I have seen on syntax highlighting.
ReplyEric, there is one more bug in the code: when creating a download link, you are using htmlspecialchars() function to screen special characters. However, by default, htmspecialchars() assumes iso-8859-1 charset, which is wrong for the most of blogs. So it would be more correct to use wp_specialchars() instead.
ReplyI get:
ReplyWarning: Invalid argument supplied for foreach() in /home/xxx/public_html/wp-content/plugins/wp-codebox/geshi/geshi.php on line 2281 Warning: Invalid argument supplied for foreach() in /home/xxx/public_html/wp-content/plugins/wp-codebox/geshi/geshi.php on line 2281 Warning: Invalid argument supplied for foreach() in /home/xxx/public_html/wp-content/plugins/wp-codebox/geshi/geshi.php on line 2281 Warning: Invalid argument supplied for foreach() in /home/xxx/public_html/wp-content/plugins/wp-codebox/geshi/geshi.php on line 2281
Any ideas?
还是楼上说的 < > 问题
Reply我发现当在源代码模式写时,比如 <pre lang=”C”> p->q …… 如果立刻发布就没有问题
可一旦我切回可视模式后,就会被转成 <pre lang=”C”> p->q …… 而这时发布就只能看到错误的形式了
而且我试了其他几个代码高亮插件,同一个编辑器下,虽然编辑时显示的是 p->q 但发布后没有问题,可以看到 p->q
所以应该不是编辑器的问题,希望老大解决
还有一个就是行号这一栏有时莫名其妙的非常宽,包括您这里的几个例子也是,应该不是我浏览器的问题吧(我用的是firefox)
贴个图给您看看 http://i264.photobucket.com/albums/ii169/coffeecat10/code.jpg
Reply