记录日常点点滴滴,欢迎来到我的小站。

0%

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!-- facebook -->
<iframe src="//www.facebook.com/plugins/like.php?href=<?php the_permalink() ?>&amp;width=450&amp;height=21&amp;colorscheme=light&amp;layout=button_count&amp;action=like&amp;show_faces=false&amp;send=false&amp;appId=1405102389709799" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>

<!-- twitter -->
<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink() ?>" data-via="" data-lang="en">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

<!-- Google -->

<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share" data-annotation="bubble"></div>

<!-- Place this tag after the last share tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>

<!-- Pinterest -->

<a href="//pinterest.com/pin/create/button/?url=<?php the_permalink() ?>&media=&description=<?php the_title(); ?>" data-pin-do="buttonPin" data-pin-config="beside"><img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" /></a>
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>

<!-- StumbleUpon -->
<!-- Place this tag where you want the su badge to render -->
<su:badge layout="1" location="<?php the_permalink() ?>"></su:badge>

<!-- Place this snippet wherever appropriate -->
<script type="text/javascript">
(function() {
var li = document.createElement('script'); li.type = 'text/javascript'; li.async = true;
li.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + '//platform.stumbleupon.com/1/widgets.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(li, s);
})();
</script>

<!-- tumblr -->
<script src="http://platform.tumblr.com/v1/share.js"></script>
<a href="http://www.tumblr.com/share" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:61px; height:20px; background:url('http://platform.tumblr.com/v1/share_2.png') top left no-repeat transparent;">Share on Tumblr</a>

<!-- In -->
<script src="//platform.linkedin.com/in.js" type="text/javascript">
lang: en_US
</script>
<script type="IN/Share" data-url="<?php the_permalink() ?>" data-counter="right"></script>

Facebook上週推出了一項全新的功能,幫助使用者分享自己的興趣。Facebook將把「Like」按鈕部署到全球各大網站中去,只要點擊一下這個按鈕,即可與好友分享當前網頁的內容。除此之外,每點擊一次「Like」按鈕,Facebook及其合作夥伴都可以更好地瞭解使用者的喜好,從而提供更具個性化的體驗。

Facebook 創辦人薩克柏(Mark Zuckerberg)表示這個新功能「把人擺在網路世界的中心」,但專家卻憂心,個人隱私將遭侵害。目前有近70個網站與 Facebook 合作,在它們的網頁增設原本僅出現在 Facebook 頁面上的小按鈕「讚」(Like),Facebook 使用者若喜歡特定網站的某篇文章或某段音樂,只要點一下「讚」,就能知道在 Facebook 社群中,有哪些朋友和自己擁有相同的喜好。

阅读全文 »

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32


RewriteRule ^(.*)/topic-(.+)\.html\?*(.*)$ $1/portal\.php\?mod=topic&topic=$2&$3
RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/portal\.php\?mod=view&aid=$2&page=$3&$4
RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=group&fid=$2&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/home\.php\?mod=space&$2=$3&$4
RewriteRule ^(.*)/([a-z]+)-(.+)\.html\?*(.*)$ $1/$2\.php\?rewrite=$3&$4

RewriteRule /wordpress/sitemap.xml /wordpress/sitemap.xml [L]
RewriteRule /wordpress/favicon.ico /wordpress/favicon.ico [L]
# For tag
RewriteRule /wordpress/tag/(.*)/page/(\d+)$ /wordpress/index\.php\?tag=$1&paged=$2
RewriteRule /wordpress/tag/(.+)$ /wordpress/index\.php\?tag=$1
# For category
RewriteRule /wordpress/category/(.*)/page/(\d+)$ /wordpress/index\.php\?category_name=$1&paged=$2
RewriteRule /wordpress/category/(.*) /wordpress/index\.php\?category_name=$1
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wordpress/wp-(.*) /wordpress/wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/wordpress/$ /wordpress/index.php [L]
RewriteRule /wordpress/(.*) /wordpress/index.php/$1 [L]
#For page
RewriteRule /wordpress/page/(.*)/?s=(.*) /wordpress/index\.php\?s=$2&paged=$1
RewriteRule /wordpress/page/(.*) /wordpress/index\.php\?paged=$1

直接放到网站根目录下
此为根目录为Discuz, 根目录\wordpress 的组合。

算起来,我的博客已经开站3个多月了,虽然每天从百度来的流量仍然是那么仅有的几十个,但幸好google大叔的排名还不错,每天能从google获得大约3500-5000IP的流量(可以看出来google确实喜欢wordpress),加上其他杂七杂八的搜索引擎来路,小小的博客每天的流量也突破6000IP了。 随着流量的增长,博客的评论也越来越多,每天光固定访客就有将近2000人,博客原有的评论功能感觉不够用了,于是想再开设一个论坛。

想到就做,论坛系统肯定首选Discuz,花了5分钟时间,安装了Discuz! X2,开始设置论坛时,才发现Discuz并不能直接通过Ucenter管理中心实现与wordpress的用户共享和同步登录。搜遍了百度大婶,翻遍了discuz论坛,所能找到的方法都已经不适合最新版本的wordpress和Discuz! X2。这时候gogole大叔的好就体现出来了,通过gogole搜索,成功在一个国外的个人博客上找到了方法,也就是给wordpress安装一个叫Ucenter的插件就可以实现wordpress与Ucenter管理中心的整合了,下面就把具体步骤给大家分享一下。

阅读全文 »

提示

无法安装这个包。 PCLZIP_ERR_MISSING_FILE (-4) : Missing archive file ‘C:\WINDOWS\TEMP/crayon-syntax-highlighter.tmp’

解决方法如下:
打开wordpress根目录下的wp-config.php文件
找到如下:

1
2
3
/** WordPress 目录的绝对路径。 */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');

在下面增加如下代码即可:
/** 指定WordPress的临时目录 */

1
define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp');

最后再wp-content文件夹下新建个temp文件夹,问题解决了

1
2
3
4
5
<?php
$txt = '1.txt';
$content = file_get_contents($txt);
file_put_contents('2.txt',str_replace('市','',str_replace('省','',$content)));
?>

后台post管理及添加新的插件或是给文章添加新的功能可以修改

edit-form-advanced.php, 它位于wp-admin下,增加自己的管理按钮或是插件是很好的修改位置。

在后台搜索“Page Links To”就能直接安装这款插件,插件安装启用以后,在页面编辑的最下面,就会多出个Page Links To面板。

Page Links To面板的第一项Point to this URL就是输入链接地址的。

第二项Open this link in a new window是设置链接在新窗口打开。

第三项Use a temporary 302 redirect (default is a permanent 301 redirect),是设置链接为临时302跳转,默认不设置此项是永久301重定向。

Page Links To插件不但可以改变页面的链接,还可以改变文章的链接地址,方法一样。

下载地址

数据库接口介绍

WordPress包含一个操作数据库的类——wpdb,该类基于ezSQL(由Justin Vincent维护的数据库操作项目)编写,包含了其基本的功能。

请不要直接调用wpdb类中的方法。WordPress定义了$wpdb的全局变量,所以请直接调用该全局变量$wpdb的实例来操作数据库。(调用之前不要忘了声明引用全局变量$wpdb。参考globalize)

$wpdb对象可以用来操作WordPress数据库中的每一个表,不仅仅是WordPress自动创建的基本表。例如,你有一个自定义的表叫做mytable,那么可以使用如下语句来查询:

$myrows = $wpdb->get_results( “SELECT id, name FROM mytable” );
$wpdb对象可以读取多个表,但是其只针对WordPress的数据库。如果你需要连接其他数据库,那么你应该使用你自己的数据库连接信息,并调用wpdb类来创建一个你自己的数据库操作实例。如果你有多个数据库需要连接,那么你可以考虑使用hyperdb来替代$wpdb。

阅读全文 »