Changeset 483775
- Timestamp:
- 01/03/2012 08:30:36 AM (14 years ago)
- Location:
- wp2baiduzone/trunk
- Files:
-
- 1 added
- 4 edited
-
Screenshots1.png (added)
-
php/baiduzone.php (modified) (1 diff)
-
php/iconv.php (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
-
wp2baiduzone.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp2baiduzone/trunk/php/baiduzone.php
r401318 r483775 1 1 <?php 2 /* Copyright 2011 Carey Zhou (email : [email protected]) 2 /* 3 Copyright 2011 Carey Zhou (email : [email protected]) 4 3 5 This program is free software; you can redistribute it and/or modify 4 6 it under the terms of the GNU General Public License as published by 5 7 the Free Software Foundation; either version 2 of the License, or 6 8 (at your option) any later version. 9 7 10 This program is distributed in the hope that it will be useful, 8 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 13 GNU General Public License for more details. 14 11 15 You should have received a copy of the GNU General Public License 12 16 along with this program; if not, write to the Free Software -
wp2baiduzone/trunk/php/iconv.php
r401318 r483775 1 1 <?php 2 2 /* Copyright 2011 Carey Zhou (email : [email protected]) 3 3 4 This program is free software; you can redistribute it and/or modify 4 5 it under the terms of the GNU General Public License as published by 5 6 the Free Software Foundation; either version 2 of the License, or 6 7 (at your option) any later version. 8 7 9 This program is distributed in the hope that it will be useful, 8 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 12 GNU General Public License for more details. 13 11 14 You should have received a copy of the GNU General Public License 12 15 along with this program; if not, write to the Free Software -
wp2baiduzone/trunk/readme.txt
r401318 r483775 2 2 3 3 Contributors: Carey Zhou 4 Donate link: http:// zhourunsheng.com/4 Donate link: http://blog.zhourunsheng.com/ 5 5 Tags: baidu, wp2baiduzone,百度空间,文章同步 6 6 Requires at least: 2.7 7 Tested up to: 3. 1.38 Stable tag: 1. 07 Tested up to: 3.3 8 Stable tag: 1.1 9 9 10 10 == Description == 11 11 12 12 同步发布 WordPress 博文到 百度空间. 13 14 Version 1.1 支持功能 15 16 1. 支持独立博客文章的设定同步,即发布博文的时候可进行同步选项的单独设定。 13 17 14 18 Version 1.0 支持功能 … … 37 41 1. 软件配置界面 Screenshots.png 38 42 43 2. 独立博客文章配置界面 Screenshots1.png 44 39 45 40 46 == Frequently Asked Questions == … … 43 49 == Changelog == 44 50 51 = 1.1 = 52 * 加入独立博文配置页面 53 45 54 = 1.0 = 46 55 * 初级版本 … … 48 57 == Upgrade Notice == 49 58 59 = 1.1 = 60 * 加入独立博文配置页面 61 50 62 = 1.0 = 51 63 * 初级版本 -
wp2baiduzone/trunk/wp2baiduzone.php
r401318 r483775 5 5 Version: 1.0 6 6 Author: Carey Zhou 7 Author URI: http:// www.zhourunsheng.com7 Author URI: http://blog.zhourunsheng.com 8 8 Description: 同步发表 WordPress 博客日志到 百度空间 9 9 */ 10 10 11 11 /* Copyright 2011 Carey Zhou (email : [email protected]) 12 12 13 This program is free software; you can redistribute it and/or modify 13 14 it under the terms of the GNU General Public License as published by 14 15 the Free Software Foundation; either version 2 of the License, or 15 16 (at your option) any later version. 17 16 18 This program is distributed in the hope that it will be useful, 17 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 21 GNU General Public License for more details. 22 20 23 You should have received a copy of the GNU General Public License 21 24 along with this program; if not, write to the Free Software … … 43 46 register_setting( 'WP2BaiduZone-Settings', 'wp2baiduzone_sharenotallow' ); 44 47 register_setting( 'WP2BaiduZone-Settings', 'wp2baiduzone_isaddlink' ); 48 register_setting( 'WP2BaiduZone-Settings', 'wp2baiduzone_issync' ); 45 49 } 46 50 … … 147 151 function publish_article_to_baiduzone($post_ID) 148 152 { 149 $post = get_post($post_ID); 153 if (get_option('wp2baiduzone_issync') != 'yes') { //该文章不同步 154 return $post_ID; 155 } 156 157 $post = get_post($post_ID); 150 158 151 159 //new article 152 if( $post->post_type == "post"&& ($post->post_date == $post->post_modified))160 if(($post->post_type == "post") && ($post->post_date == $post->post_modified)) 153 161 { 154 162 //get title … … 175 183 } 176 184 //<pre> content </pre> 177 $content = "<pre>" . $content . "</pre>";185 //$content = "<pre>" . $content . "</pre>"; 178 186 179 187 $blogpower = get_option('wp2baiduzone_blogpower'); … … 224 232 } 225 233 ?> 234 <?php 235 add_action('add_meta_boxes', 'wp2bz_add_custom_box'); 236 237 function wp2bz_add_custom_box(){ 238 add_meta_box( 'wp2bz-meta_box','百度空间博文同步','wp2bz_box_set_sync', 'post', 'side', 'high'); 239 } 240 241 function wp2bz_box_set_sync(){ 242 global $post; 243 244 $username = get_option('wp2baiduzone_user'); 245 $password = get_option('wp2baiduzone_password'); 246 if(strlen($username) < 3 || strlen($password) < 3) { 247 echo '<div class="misc-pub-section" style="line-height:18px;">'; 248 echo '<b>配置信息: </b><br/>'; 249 echo '您还未配置百度空间的帐号信息,如果要同步文章,请首先到 <a href="'.site_url('/wp-admin/options-general.php?page=wp2baiduzone').'">wp2baiduzone</a> 进行配置。'; 250 echo '</div>'; 251 return false; 252 } else { 253 echo '<div class="misc-pub-section" style="line-height:18px;">'; 254 echo '<b>配置信息: </b><br/>'; 255 echo '您百度空间的同步帐号为 <b>'.$username.'</b>'; 256 echo '</div>'; 257 } 258 259 $synced = get_option( 'wp2baiduzone_issync', 'yes'); 260 $post_status = get_post_status($post->ID); 261 switch($post_status){ 262 case 'publish': 263 $status_info='这篇文章已经发布,默认不会同步。';$synced='no'; 264 break; 265 case 'private': 266 $status_info='这篇文章是私密文章,默认不会同步。';$synced='no'; 267 break; 268 case 'future': 269 $status_info='这篇文章是定时发布,将在设定的时间同步。'; 270 break; 271 case 'auto-draft': 272 $status_info='这篇文章是您新建的,点击“发布”将会同步到您的百度空间。';$synced='yes'; 273 break; 274 case 'draft': 275 $status_info='这篇文章是您之前保存的草稿,点击“发布”将会同步到您的百度空间。'; 276 break; 277 case 'pending': 278 $status_info='这篇文章等待复审,通过后将会根据选择情况进行同步'; 279 break; 280 default: 281 $synced='yes'; 282 break; 283 } 284 285 if($status_info) { 286 echo '<div class="misc-pub-section" style="line-height:18px;"><b>温馨提示: </b><br/>'.$status_info.'</div>'; 287 } 288 289 echo '<div class="misc-pub-section" style="background:#EAF2FA;line-height:18px;">'; 290 echo '<b>同步到百度空间: </b><br/>'; 291 292 echo '<input type="radio" name="wp2baiduzone_issync" value="no"'; 293 if($synced == 'no') { 294 echo ' checked="checked"'; 295 } 296 echo '/><label>不同步</label> <br/>'; 297 298 echo '<input type="radio" name="wp2baiduzone_issync" value="yes"'; 299 if($synced == 'yes') { 300 echo ' checked="checked"'; 301 } 302 echo '/><label>同步</label> <br/>'; 303 echo '</div>'; 304 echo '<div class="clear"></div>'; 305 } 306 307 /* Use the save_post action to do something with the data entered */ 308 add_action('save_post', 'wp2bz_save_custom_box_data'); 309 310 /* When the post is saved, saves our custom data */ 311 function wp2bz_save_custom_box_data( $post_id ) { 312 if (isset($_POST['wp2baiduzone_issync'])) { 313 update_option( 'wp2baiduzone_issync', $_POST['wp2baiduzone_issync'] ); 314 } 315 } 316 317 ?>
Note: See TracChangeset
for help on using the changeset viewer.