为wordpress添加coolcode插件的quicktag

转载时请标明文章原始出处和作者信息, 作者: lostsnow.
http://www.lsproc.com/blog/add_coolcode_quicktag_for_wordpress/

修改 wp-includes/js/quicktags.js 文件

1. 找到

edButtons[edButtons.length] =
new edButton('ed_code'
,'code'
,'<code>'
,'</code>'
,'c'
);

在后面添加

edButtons[edButtons.length] =
new edButton('ed_coolcode'
,'coolcode'
,''
,'</coolcode>'
,'x'
);

2. 找到

	else if (button.id == 'ed_link') {
		document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />');
	}

在后面添加

    else if (button.id == 'ed_coolcode') {
		document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertCoolcode(edCanvas, ' + i + ');" value="' + button.display + '" />');
	}

3. 在文件末尾添加

function edInsertCoolcode(myField, i, defaultLang, defaultLine) {
    if (!defaultLang) {
		defaultLang = 'php';
	}
    if (!defaultLine) {
		defaultLine = 'off';
	}
    if (!edCheckOpenTags(i)) {
        var codeLang = prompt('输入需要加亮的程序语言', defaultLang);
        var codeLine = prompt('是否显示行号(on, off)', defaultLine);
        edButtons[i].tagStart = '<' + 'coolcode';
        if (codeLang) {
            edButtons[i].tagStart = edButtons[i].tagStart + ' lang="'
                                    + codeLang + '"'
        }
        if (codeLine) {
            edButtons[i].tagStart = edButtons[i].tagStart + ' linenum="'
                                    + codeLine + '"';
        }
        edButtons[i].tagStart = edButtons[i].tagStart + '>';
        edInsertTag(myField, i);
    }
    else {
		edInsertTag(myField, i);
	}
}

-- EOF --

WordPress 2.2 final

转载时请标明文章原始出处和作者信息, 作者: lostsnow.
http://www.lsproc.com/blog/wordpress_22_final/

WordPress 2.2 终于正式发布了,想要的 Tag 特性将被延后到2.3中才会出现,反而多了 Widgets ......
点击下载

http://wordpress.org/development/2007/05/wordpress-22/

Goodies:

  • WordPress Widgets allow you to easily rearrange and customize areas of your weblog (usually sidebars) with drag-and-drop simplicity. This functionality was originally available as a plugin Widgets are now included by default in the core code, significantly cleaned up, and enabled for the default themes.
  • Full Atom support, including updating our Atom feeds to use the 1.0 standard spec and including an implementation of the Atom Publishing API to complement our XML-RPC interface.
  • A new Blogger importer that is able to handle the latest version of Google’s Blogger product and seamlessly import posts and comments without any user interaction beyond entering your login.
  • Infinite comment stream, meaning that on your Edit Comments page when you delete or spam a comment using the AJAX links under each comment it will bring in another comment in the background so you always have 20 items on the page. (I know it sounds geeky, but try it!)
  • We now protect you from activating a plugin or editing a file that will break your blog.
  • Core plugin and filter speed optimizations should make everything feel a bit more snappy and lighter on your server.
  • We’ve added a hook for WYSIWYG support in a future version of Safari.

Developer Features:

  • A new set of WordPress-specific XML-RPC APIs that allow for editing pages, setting categories, and much more.
  • We now use jQuery for a number of internal functions, and hope to transition all of our JS to use it. (We still need volunteers for this.)
  • Comment feeds now support multiple formats, including Atom.
  • Our internal mail functions now use phpMailer, which allows for things like SMTP support.
  • You can now set database collation and character set in your config file.
  • You can also hardcode your site and WP URL in the config file, overriding the values in the DB.
  • Finally we’ve increased the inline documentation of a number of functions inside of WP, which should help you navigate those parts of the code.

新特性:

  • 加入 Widgets 支持,WordPress Widgets 让您可以只需要鼠标简单拖放操作便可重新安排和自定义您的 Blog (通常是侧边栏)。此功能最初是 Widgets 插件引入的,现在成为了 WordPress 的默认核心代码,做了大量的优化,并且默认主题启用了这个功能。
  • 完整的 Atom 支持,包括更新我们的 Atom 聚合以符合 1.0 标准,并实现了 Atom 发布 API 以和原有 XML-RPC 接口互补。
  • 全新 Blogger 导入程序可以让您导入新版 Google Blogger,只要输入登录信息,便可全自动无需人工干预无缝的导入文章和评论。
  • 无限评论流,意思是在编辑评论页面,当您使用 AJAX 链接删除评论或将评论标记为垃圾评论时,系统会自动从后台调取较早的评论显示出来,补充刚才删除的评论,这样能够保证评论管理页面总是显示 20 条评论。
  • 插件激活保护,现在可能导致 Blog 无法工作的插件将被自动禁用。
  • 核心插件和过滤器进行了速度优化,您应该能感觉到进行任何操作时速度上的提升。
  • 未来版本的 Safari 浏览器的所见即所得支持提供了一个钩子。

对于开发者:

  • 增强 XML-RPC API,支持编辑页面,设置分类。
  • 核心 Javascript 开始换用 jQuery。
  • 评论 Feed 支持多种格式,包括 Atom。
  • 引入 phpMailer 组件,支持 SMTP,有望解决邮件乱码。
  • 数码库的编码问题,在 WP 2.2 中只需要修改一下 wp-config.php 文件中的两个变量 DB_CHARSET 和 DB_COLLATE,把它们改成 UTF8 就可以了。这意味着在 WP 2.2 基础上升级的话,不需要每次都要去修改 wp-db.php 了。
  • Blog 地址问题,可以在 wp-config 中把 siteurl 和 home 设置成常量,如果做了这个设置,WP 将会忽略后台 options 中的设置。这个变化的好处是如果以后 Blog 搬家,不再需要像以前那样去数据库中深挖这两个值,再修改成新的。
  • 最后我们增加了 WP 代码中的函数文档,可以帮助您更快理解那些代码。

Blog 地址在 wp-config 中的定义:
define('WP_HOME', 'http://yoursite.com');
define('WP_SITEURL', 'http://yoursite.com');

-- EOF --

博客世界最受欢迎的30个插件

转载时请标明文章原始出处和作者信息, 作者: lostsnow.
http://www.lsproc.com/blog/top_30_wordpress_plugins_in_blogosphere/

From:
http://fairyfish.com/2007/04/02/top-30-wordpress-plugins-in-blogosphere/

翻译于:
http://www.staska.net/2007/03/27/top-30-wordpress-plugins-in-blogosphere/

作者根据Lorelle的Lists of favorite WordPress plugins上的48列表和280个插件,选出最受欢迎的30个插件。

Continue reading

-- EOF --

wordpress 快捷键

转载时请标明文章原始出处和作者信息, 作者: lostsnow.
http://www.lsproc.com/blog/wordpress_shortcut_key/

很多wordpress用户都是通过点击文本撰写区上面的那些菜单按钮来插入链接,图片等等。但使用这个方式比较麻烦,而且更耗时间。如果能直接通过键盘快捷键来操作的话,将会极大地提高blogging的效率。下面就是很多wordpress的一些基本的快捷键:

Alt+B = 字体加粗(bold)
Alt+I = 斜体(italic)
Alt+Q = 引用(Blockquote)
Alt+T = 更多 (Read More tag)
Alt+U = 定义无序列表(Unordered list)
Alt+O = 定义有序列表 (Ordered list)
Alt+S = 文本加下划线(ins)
Alt+L = 列表项 (list item)
Alt+A = 插入链接(link)
Alt+C = 设置文本为代码风格(code)
Alt+D = 文本加删除线(del)
Alt+P = 发表日志(Publish )

注意:

1、苹果机用户可能需要用ctrl来代替alt键,甚至可能要同时按alt和shift才有用。

2、Firefox下要同时按alt和shift。

-- EOF --

再谈WordPress的MySQL乱码问题解决方法

转载时请标明文章原始出处和作者信息, 作者: lostsnow.
http://www.lsproc.com/blog/mysql_encode_error_in_wordpress/

在MySQL4.1下,中文的WP就会产生种种的乱码问题。

一个程序( PHP,CGI 等)与MySQL建立连接后,这个程序发送给MySQL的数据采用的是什么字符集,MySQL 是无从得知的。所以解决乱码问题的根本就是我们在程序中告诉MySQL采用的编码是什么,简单的就是在程序中加入这样的一个语句:

SET NAMES 'utf8';

这个语句的效果等同于同时设定了

SET character_set_client='utf8';
SET character_set_connection='utf8';
SET character_set_results='utf8';

为什么这么做?

我们安装MySQL4.1时按照默认配置,那么default-character-set= utf8。在MySQL Command Line Client下查看到的查看系统的字符集和排序方式的设定为:

Continue reading

-- EOF --