如果系统不是很干净的话,架设php运行环境,如phpnow,可能会出现问题,查找也会很麻烦,多运行了一些服务恐怕也不那么舒服。
一个可行的很干净的解决办法就是在虚拟机中构建,我实际测试可行。
步骤如下:
1.安装vmware 7.1
2.建立xp虚拟机,网络 选 host-only,briged也行,不过host-only即便在无网络连接,无路由器时仍然很好的通过虚拟网络工作。
3.在xp虚拟机中部署php环境如phpnow
4.搞定,这样一个很干净的xp系统仅有php运行环境,可以通过在主机中访问虚拟机的ip,通过设置共享,也可以直接访问虚拟机的htdocs文件夹。这样就可以需要时才运行虚拟机的php环境。这可以很方便用于测试开发。
2011 March
ABOUT WP Simple Captcha
lots of robot spam commenters,i really get rid of them,hope it will not cost much.so I write this little plugin to do the work,you can just add these lines of code into your theme’s function.php file ,put them before the last:
?>
it will just work.
these are the code you should put into your function.php:>
class zxdRoboCheck{
function zxd_robokiller_fields($fields) {
$rnum1 =rand(1,10);
$rnum2 = rand(2,8);
$rnum = $rnum1 + $rnum2;
$fields['robo'] = '<p class="comment-form-robo"><label for="robo">'.$rnum1.'+'.$rnum2.'=?'.__('(robot check)').'</label> <span class="required">*</span><input id="robo" name="robo" type="text" value="" size="30" aria-required="true" /><input id="rnum" name="rnum" type="hidden" value="'.$rnum.'" size="0" aria-required="true" class="hide" /></p> ';
return $fields;
}
function roboCheck($comment){
$userId = get_current_user_id();
if($userId!=0) return($comment);
if (empty($_POST['robo']) || trim($_POST['robo']) == '' ) {
wp_die( __('Error: you are not robot,are you?do the math,fill the blank '));
}
$robo_num1 = (int)$_POST['robo'];
$robo_num2 = (int)$_POST['rnum'];
if ( $robo_num2 == $robo_num1) {
return($comment);
}
else {
wp_die( __('Error: you are not robot,are you?'));
}
}
}
if (class_exists("zxdRoboCheck")) {
$aRoboCheck = new zxdRoboCheck();
add_action('comment_form_default_fields', array(&$aRoboCheck, 'zxd_robokiller_fields'),1);
add_filter('preprocess_comment', array(&$aRoboCheck, 'roboCheck'), 1);
}
FAQ
it is simple,so it is easy to crack,if spammers want.lets just hope they do not really have to deal with your site.
DOWNLOAD
http://wordpress.org/extend/plugins/wp-simple-captcha/
CHANGE LOG
1.1 fix login user can not comment bug.
1.啥也不显示的标题栏仍然占据相当的高度。
2.仍然顽固的不支持rotate,但是支持圆角了。
3.既然已经学习其他浏览器的好处了,干吗不学全了。
4.开发模式很不错,提供ie7,ie8兼容模式,便于测试。
ABOUT
Simply download WP ajax Collapsing Categories plugin from wordpress plugin panel and enable it is the easy way to add WP ajax Collapsing Categories widget.but not the best way.we can just add some code to theme’s function.php to make it work.i will explain the details here.
WALKTHROUGH
1.download WP ajax Collapsing Categories,unzip it,put “wp-ajax-collapsing-categories.js” into your theme folder
2.add these lines of code into your theme’s function.php (before the last “?>”)
/*a function to check if post_is_in_descendant_category ,which will work with */
/**
* a function to check if post_is_in_descendant_category
* @param $cats the category object to check
* @return true if post_is_in_descendant_category or false if not in
*/
function zxd_post_is_in_descendant_category( $cats, $_post = null ){
foreach ( (array) $cats as $cat ) {
$descendants = get_term_children( (int) $cat, 'category');
if ( $descendants && in_category( $descendants, $_post ) ) return true;
}
return false;
}
/**
* get all top level categories
* @return top level categories objects array
*/
function getTopLevelCats() {
$allCats = get_all_category_ids();
$cats = array();
foreach ($allCats as $id){
$obj = get_category($id);
$name = get_cat_name($id);
if (!$obj -> parent) array_push($cats,$obj);
}
return $cats;
}
/**
* wp ajax collapsing categories class
*/
class ajax_cc_Widget extends WP_Widget{
function ajax_cc_Widget() {
$widget_ops = array('classname' => 'widget_ajax_cc', 'description' => 'WP ajax Collapsing Categories' );
$this->WP_Widget('ajax_cc_widget','ajax_cc_widget',$widget_ops);
}
/**
* implent widget fucntion
*/
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
echo '<ul class="zxd_ajax_cc"' ;
echo ' zid="';
the_ID();
echo '">';
if(!$instance['zxdIncludeCats']) {
$zxdCatArrayPool = getTopLevelCats();
}
else {
$zxdCatArrayPool = array();
$zxdCatTempPool = preg_split('/[,]+/',$instance['zxdIncludeCats']);
sort($zxdCatTempPool);
foreach($zxdCatTempPool as $a) {
if(!get_category_by_slug($a)) {
$zxdCatArrayPool = getTopLevelCats();
break;
}
$obj = get_category_by_slug($a);
array_push($zxdCatArrayPool,$obj);
}
}
$zxdPostId = is_single()?get_the_ID():0;
foreach ($zxdCatArrayPool as $zxdCatObj){
$zxdCatid = $zxdCatObj -> term_id;
$zxdCatdesc = $zxdCatObj->description;
$zxdCatCount = $zxdCatObj->count;
echo '<li class="zxd_ajax_cc_li"><span class="zxd_expand">[+]</span>'.'<a ';
if(in_category( $zxdCatid,$zxdPostId)||zxd_post_is_in_descendant_category($zxdCatid,$zxdPostId)) {
echo 'class="zxd_current_cat" ';
}
echo 'href="'.get_category_link($zxdCatid).'" '.'title="'.$zxdCatdesc.'">'.get_cat_name( $zxdCatid ).'</a>'.'('.$zxdCatCount.')'.'</li>';
}
echo '</ul>' ;
echo $after_widget;
}
/**
* implent widget fucntion
*/
function update($new_instance, $old_instance) {
$instance = $old_instance;
$title = strip_tags($new_instance['title']);
$zxdIncludeCats=$new_instance['zxdIncludeCats'];
$instance = compact('title','zxdIncludeCats');
return $instance;
}
/**
* implent widget fucntion
*/
function form($instance) {
$defaults=array(
'title' => __('ajax Categories', 'WP ajax collapsing categories'),
'zxdIncludeCats' => '',
);
$options = wp_parse_args( $instance,$defaults );
extract($options);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this-/>get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
<p>include these categories (category slugs,separated by commas): </p>
<p><input type="text" name="<?php echo $this-/>get_field_name('zxdIncludeCats'); ?>" value="<?php echo $zxdIncludeCats ?>" id="<?php echo $this->get_field_id('zxdIncludeCats') ?>" </p>
<?php
}
}
/**
* register_widget
*/
function zxd_widgets_init() {
register_widget('ajax_cc_Widget');
}
add_action( 'widgets_init', 'zxd_widgets_init' );
if ( !is_admin() ) {
function zxd_init_method() {
wp_register_script( 'wp-ajax-collapsing-categories', get_template_directory_uri().'/wp-ajax-collapsing-categories.js',array('jquery'),'1.0',true);
wp_enqueue_script( 'wp-ajax-collapsing-categories');
wp_localize_script( 'wp-ajax-collapsing-categories', 'ajaxCC', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )) );
}
add_action('init', 'zxd_init_method');
}
add_action( 'wp_ajax_nopriv_zxd_cc_submit', 'zxd_cc_submit' );
add_action( 'wp_ajax_zxd_cc_submit', 'zxd_cc_submit');
function zxd_cc_submit(){
$zxdCatUrl = $_POST['catZxd'];
$zxdCurrentPostID = (int)$_POST['currentID'];
$items1 = explode('/',$zxdCatUrl);
$zxdCatSlug = $items1[count($items1)-1]?$items1[count($items1)-1]:$items1[count($items1)-2];
$items2 = explode('=',$zxdCatSlug);
if($items2[0] == '?cat') $zxdCatId = (int)$items2[1];
else{
$zxdCatObj = get_category_by_slug($zxdCatSlug);
$zxdCatId = $zxdCatObj->term_id;
}
$zxdArgs = array(
'parent' => $zxdCatId,
'orderby' => 'slug',
'order' => 'ASC',
'hide_empty' => 1,
);
$zxdChildCats = get_categories( $zxdArgs );
echo '<ul class="child_cat hide">' ;
if(!empty($zxdChildCats)){
$zxdChildCatsIdArray =array();
foreach($zxdChildCats as $zxdtemp1){
array_push($zxdChildCatsIdArray, $zxdtemp1->term_id);
}
$zxdArgs2 = array(
'post_type' => 'post',
'category__in' => array($zxdCatId),
'category__not_in' => $zxdChildCatsIdArray,
);
foreach ($zxdChildCats as $zxdEachCatChild){
$zxdCatChildId = $zxdEachCatChild ->term_id;
$zxdCatChildDesc = $zxdEachCatChild->description;
$zxdCatChildCount = $zxdEachCatChild->count;
if ( in_category( $zxdCatChildId,$zxdCurrentPostID )||zxd_post_is_in_descendant_category( $zxdCatChildId,$zxdCurrentPostID )) {
echo '<li class="zxd_ajax_cc_li"><span class="zxd_expand">[+]</span>'.'<a class="zxd_current_cat" href="'.get_category_link($zxdCatChildId).'" '.'title="'.$zxdCatChildDesc.'">'.get_cat_name( $zxdCatChildId ).'</a>'.'('.$zxdCatChildCount.')'.'</li>';
}
else{
echo '<li class="zxd_ajax_cc_li"><span class="zxd_expand">[+]</span>'.'<a href="'.get_category_link($zxdCatChildId).'" '.'title="'.$zxdCatChildDesc.'">'.get_cat_name( $zxdCatChildId ).'</a>'.'('.$zxdCatChildCount.')'.'</li>';
}
};
}
else{
$zxdArgs2 = array(
'post_type' => 'post',
'category__in' => array($zxdCatId),
);
};
$zxdQuery = new WP_Query($zxdArgs2);
if($zxdQuery->have_posts()){
while ($zxdQuery->have_posts()) {
$zxdQuery->the_post();
echo '<li class="zxd_ajax_cc_li"><a';
if ($zxdQuery->post->ID==$zxdCurrentPostID) echo ' class="zxd_current_cat"';
echo ' href="';
echo the_permalink();
echo '" rel="bookmark" title="';
echo the_title_attribute();
echo '">';
echo the_title();
echo '</a></li>';
}
}
echo '</ul>' ;
exit;
}3.done,it should work now.without enable a plugin.
4.if your theme already has a javascript loaded,you can just skip the step1,do step2,then find these lines:
wp_register_script( 'wp-ajax-collapsing-categories', get_template_directory_uri().'/wp-ajax-collapsing-categories.js',array('jquery'),'1.0',true);
wp_enqueue_script( 'wp-ajax-collapsing-categories');
wp_localize_script( 'wp-ajax-collapsing-categories', 'ajaxCC', array( 'ajaxurl' =&gt; admin_url( 'admin-ajax.php' )) );,replace these lines with this one line(replace 'yourloadedjsfilename' with your js file's realname)
wp_localize_script( 'yourloadedjsfilename', 'ajaxCC', array( 'ajaxurl' =&amp;gt; admin_url( 'admin-ajax.php' )) );then,put these lines in your loaded js file:
/*
+----------------------------------------------------------------+
| |
| WordPress Plugin: WP ajax collapsing categories |
| Copyright (c) 2011 ZHAO Xudong |
| |
| File Written By: |
| - ZHAO Xudong |
| - http://html5beta.com |
| |
| File Information: |
| - WP ajax collapsing categories Javascript File |
| - wp-content/plugins/wp-ajax-collapsing-categories/wp-ajax-collapsing-categories.js |
| |
+----------------------------------------------------------------+
*/
jQuery( function($) {
var zxdExpander = function() {
var zxdExpand =$(this);
var exp ='[—]';
var exp2 = '[+]';
if(zxdExpand.html() ==exp){
zxdExpand.parent('.zxd_ajax_cc_li').children('ul').hide("normal");
zxdExpand.html(exp2);
}
else{
zxdExpand.html(exp);
var zxdExpandChild = zxdExpand.parent('.zxd_ajax_cc_li').children('.child_cat');
if(zxdExpandChild.length>0) zxdExpandChild.show("normal");
else{
var zxdIdDiv = $('.zxd_ajax_cc').eq(0).attr("zid");
var zxdID =zxdIdDiv?zxdIdDiv:0;
var zxdCatLink = zxdExpand.parent('.zxd_ajax_cc_li').children('a').attr("href");
$.ajax({
type: 'POST',
url:ajaxCC.ajaxurl,
data: {
action : 'zxd_cc_submit',
catZxd: zxdCatLink,
currentID:zxdID
},
success:function(data) {
zxdExpand.parent('.zxd_ajax_cc_li').append(data).children('.child_cat').show("normal");
} ,
dataType:"html"
});
}
}
};
$(".zxd_expand").live ('click',zxdExpander);
})
应用proxychains和sshcenter免费ssh。我在Ubuntu 10.10自己试的,安装dropbox成功
1.到sshcenter.info注册免费24小时的ssh,到邮箱激活
2.下载dropbox 安装文件安装
3.安装proxychains,
sudo apt-get install proxychains4,设置proxychains
sudo chmod a+w /etc/proxychains.conf
gedit /etc/proxychains.conf添加如下设置
dynamic_chain
socks5 127.0.0.1 70705.开启ssh隧道,用到申请的sshcenter的用户名和密码
ssh -D 7070 yourusername@ssh.sshcenter.info连接后会提示输入密码
6,另开一终端
proxychains dropbox start -i然后就会成功下载了
