欢迎来 起落博客 加入收藏 设为主页

wordpress教程:wordpress中防止英文符号替换成中文符合的方法



wordpress会自作聪明的将你输入的某些引文字符替换成对应的中文字符。以至于我们在拷贝里面的程序或命令代码时每次都要进行全局替换,真的是很麻烦!直接更改WP安装目录下wp-includes/formatting.php更改里面的过滤参数就可以避免这种情况了。具体如下:

文件:wp-includes/formatting.php,将以下代码

$static_characters = array_merge(array(‘—‘, ‘ — ‘, ‘–‘, ‘xn–’, ‘…’, ‘“’, ‘\’s’, ‘\’\”, ‘ ™’), $cockney);
$static_replacements = array_merge(array(‘—’, ‘ — ‘, ‘–’, ‘xn--‘, ‘…’, ‘“’, ‘’s’, ‘”’, ‘ ™’), $cockneyreplace);
$dynamic_characters = array(‘/\'(\d\d(?:’|\’)?s)/’, ‘/(\s|\A|”)\’/’, ‘/(\d+)”/’, ‘/(\d+)\’/’, ‘/(\S)\'([^\’\s])/’, ‘/(\s|\A)”(?!\s)/’, ‘/”(\s|\S|\Z)/’, ‘/\'([\s.]|\Z)/’, ‘/(\d+)x(\d+)/’);
$dynamic_replacements = array(‘’$1′,’$1‘’, ‘$1″’, ‘$1′’, ‘$1’$2’, ‘$1“$2’, ‘”$1’, ‘’$1’, ‘$1×$2’);

替换成

$static_characters = array_merge(array(), $cockney);
$static_replacements = array_merge(array(), $cockneyreplace);
$dynamic_characters = array('/(\d+)x(\d+)/');
$dynamic_replacements = array('$1×$2');



 

原创文章,转载请注明:起落SEO博客
本文链接地址: http://76tui.net/archives/883.html

5 个评论:

  1. 很深奥啊!留着慢慢研究!

    [回复]

    uknow 回复:

    嘿嘿 一起研究

    [回复]

    xarl120@126.com said on: 21/07/2011 18:09 | Windows XP | Firefox 5.0
  2. 看到代码就头晕…只是说支持…

    [回复]

    uknow 回复:

    需要的话按照步骤添加就行 不用关注代码本身

    [回复]

    诺客家园博客 said on: 21/07/2011 18:16 | Windows XP | Internet Explorer 6.0
  3. 我的研究还差很多呢

    [回复]

    uknow 回复:

    呵呵 加油~

    [回复]

    微故事 said on: 21/07/2011 19:05 | Windows XP | Chrome 12.0.742.12
  4. 来看看,说不准以后吧ZBLOG转成wordpress

    [回复]

    uknow 回复:

    呵呵 欢迎常来 换了的话一起交流呀

    [回复]

    大鹏博客 said on: 22/07/2011 09:36 | Windows 7 | Internet Explorer 8.0
  5. 很好

    [回复]

    caine said on: 25/07/2011 14:16 | Windows XP | Chrome 11.0.696.77

发表评论

Your email is never published nor shared. Required fields are marked *

*

*

=9190*

输入您的评论:


评论