├── .gitignore ├── 404.php ├── LICENSE ├── README.md ├── archive.php ├── author.php ├── category.php ├── comments.php ├── css ├── font-awesome.css ├── font-awesome.min.css └── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ └── fontawesome-webfont.woff ├── date.php ├── footer.php ├── functions.php ├── functions ├── articles.php ├── clear.php ├── comments.php ├── misc.php ├── shortcodes.php ├── tags.php ├── themes.php ├── themeset.php ├── thumbnail.php ├── widget.php └── widgets │ ├── author.php │ ├── bookmarks.php │ ├── comments.php │ ├── post.php │ ├── readers.php │ ├── search.php │ └── tags.php ├── header.php ├── images ├── attention.png ├── bag.png ├── bg.jpg ├── bg.png ├── bg_small.jpg ├── bonus.png ├── calendar.png ├── check.png ├── delete.png ├── edit.png ├── flag.png ├── help.png ├── iconfont-bofang.png ├── iconfont-musicpause.png ├── information.png ├── loading.gif ├── love.png ├── nextlabel.gif ├── prevlabel.gif ├── quote-post.png ├── random │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── 5.jpg │ ├── 6.jpg │ └── 7.jpg └── tag.png ├── inc └── post-format │ ├── content-audio.php │ ├── content-gallery.php │ ├── content-image.php │ ├── content-status.php │ ├── content.php │ ├── relatedpost.php │ ├── single-gallery.php │ └── single.php ├── index.php ├── js ├── Jplayer.swf ├── ajax.js ├── ajax.min.js ├── autospace.min.js ├── global.js ├── global.min.js ├── jquery-1.12.4.min.js ├── jquery-migrate-1.2.1.js ├── jquery.fitvids.js ├── jquery.flexslider-min.js ├── jquery.jplayer.js ├── jquery.jplayer.min.js ├── jquery.lazyload.min.js └── slimbox2.min.js ├── languages ├── zh_CN.mo └── zh_CN.po ├── loading.gif ├── page-archives.php ├── page-sitemap.php ├── page-tags.php ├── page.php ├── search.php ├── sidebar.php ├── single.php ├── style.css ├── style.min.css ├── tag.php └── timthumb.php /.gitignore: -------------------------------------------------------------------------------- 1 | cache/ -------------------------------------------------------------------------------- /404.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | get_header(); ?> 10 | 11 |
12 |

13 |
14 | 15 | 16 | 17 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2015 Javis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WordPress Theme Quench 2 | ====== 3 | 4 | 注意事项 5 | ---- 6 | 7 | 1. 本主题自带 slimbox 图片灯箱 和 lazyload 图片延迟载功能,使用前请先关闭同类插件,避免冲突。 8 | 2. 适合本主题的多说 CSS 在本说明页面的最下方。 9 | 3. 音乐文章使用的是虾米的链接,可直接使用短代码`[xiami]id[/xiami]`插入。 10 | 4. 文章中支持的短代码有:attention,bag,bonus,calendar,check,delete,edit,flag,help,information,love,tag,样式基本一致,只是引用的背景图片不同,可参考 \quench\images 目录下的图片。 11 | 12 | 更多内容可查看[主题页面](https://lophita.com/wordpress-theme-quench.html) 13 | 14 | 更新日志 15 | ---- 16 | update 2016-08-26 17 | 18 | - 多语言支持 19 | 20 | update 2016-07-20 21 | 22 | - 修复标题不能正确换行 23 | 24 | update 2016-05-31 25 | 26 | - 添加了侧栏友链模块,并支持网站图标自动获取 (使用了[冰翼博客](https://icewing.cc/)提供的 [BYI_API](https://api.byi.pw/favicon) ) 27 | - 修复了移动样式下的自适应问题 28 | 29 | update 2016-05-28 30 | 31 | - 添加了是否开启 lazyload 图片延迟加载的选项 32 | 33 | update 2016-05-26 34 | 35 | - 增加了全局 AJAX 模式下对 Hermit 播放器的支持 36 | - 升级 jQuery 版本到最新的 1.12.4 37 | - 将图片延迟加载插件 unveil 更换为 lazyload 38 | - 修复自动添加空格功能在 AJAX 加载页面后没有自动触发的错误 39 | - 更换二维码 API ,使用支持 https 的 [Liwanglin12的API](https://blog.lwl12.com/read/lwl-api-qrcode.html) 40 | - 修改了说明页面 41 | - 修改了网站标题下简介的显示动画 42 | 43 | update 2016-05-11 44 | 45 | - 支持多说 AJAX 46 | - 优化背景遮罩,解决闪动 bug 47 | 48 | update 2016-05-03 49 | 50 | - 优化 评论框记住用户信息 51 | 52 | update 2016-02-20 53 | 54 | - 修复关闭评论仍显示评论框的错误 55 | 56 | update 2016-02-20 57 | 58 | - 压缩 CSS/JS 代码 59 | - 移除 JSON API 支持 60 | 61 | update 2016-01-20 62 | 63 | - 更新 Gravatar 源,使用七牛云存储 64 | 65 | update 2016-01-11 66 | 67 | - 修复 WordPress 4.4 的评论分页的错误 68 | 69 | update 2015-10-16 70 | 71 | - 优化网页背景显示效果 72 | - 修改 AJAX 加载动画 73 | 74 | update 2015-06-29 75 | 76 | - 添加 WordPress 4.2 支持 77 | - 移除了头像缓存功能 78 | 79 | update 2014-12-22 80 | 81 | - 修复虾米音乐链接错误的 Bug 82 | - 后台添加“使用同一侧边栏”功能 83 | 84 | update 2014-10-04 85 | 86 | - 添加多语言支持 87 | 88 | update 2014-08-11 89 | 90 | - 修复分页显示不正确的 Bug 91 | 92 | update 2014-08-06 93 | 94 | - 添加短代码 95 | 96 | update 2014-07-30 97 | 98 | - 调整字体 99 | - 修复全站 AJAX 时的跳转错误 100 | 101 | 主要功能及特点 102 | ------- 103 | 1. 响应式设计,PC、平板、手机等均可正常浏览 104 | 2. 内置多种小工具,最新/随机/热门文章、最新评论、活跃读者、标签云、日历等等 105 | 3. 内置图片灯箱 106 | 4. 内置图片延迟加载,可加快多图页面的加载速度 107 | 5. 内置头像缓存 108 | 6. 内置Ajax评论提交,可基本解决垃圾评论问题 109 | 7. 内置Ajax评论翻页 110 | 8. 全站Ajax功能,可开启/关闭 111 | 9. 汉字与拉丁字符间自动添加空白间隙,优化排版 112 | 10. 5 种文章格式 113 | 11. 顶部公告栏 114 | 12. 侧边栏滚动,可自由设置 115 | 13. 支持3种侧边栏 116 | 14. 内置文章存档、标签云和网站地图3种页面模板 117 | 15. 文章二维码 118 | 16. 文章喜欢功能 119 | 17. Gravatar 头像加速(七牛代理) 120 | 121 | 友情链接使用指南 122 | ---- 123 | 1. 先打开后台,在左侧的“链接”选项中点击“链接分类目录”,添加一个链接分类,保存 124 | 2. 添加新链接,请注意在添加时勾选刚刚添加的分类 125 | 3. 点击“外观”选项中的“小工具”设置,添加“友情链接”侧栏模块,模块设置中的“分类”即为第一步设置的分类 126 | 127 | 多说样式优化 128 | ------ 129 | 请打开多说的个性化设置页面,在自定义CSS的选项中加入以下代码: 130 | ``` 131 | #ds-thread { 132 | background: #ffffff; 133 | padding: 20px 26px; 134 | margin-bottom:2rem; 135 | } 136 | #ds-thread:before { 137 | content: ""; 138 | position: absolute; 139 | top: 0; 140 | right: 0; 141 | z-index: 10; 142 | border-width: 0 16px 16px 0; 143 | border-style: solid; 144 | border-color: #FFF #47c2dc #FFF #FFF; 145 | background: none repeat scroll 0 0 #658e15; 146 | box-shadow: 0 1px 1px rgba(0,0,0,0.08),-1px 1px 1px rgba(0,0,0,0.08); 147 | display: block; 148 | width: 0; 149 | } 150 | ``` 151 | 152 | 如果需要隐藏不和谐的 Like 按钮,可以再添加以下代码: 153 | ``` 154 | .ds-meta { 155 | display:none; 156 | } 157 | ``` 158 | 159 | 完成后效果如图(已隐藏 Like 按钮,部分文字已自定义) 160 | ![enter image description here](https://github.com/fly3949/imgs/blob/master/demo/quench/duoshuo.png?raw=true) 161 | 162 | 163 | Thanks to [@fly3949](https://github.com/fly3949), [@h2y](https://github.com/h2y). 164 | -------------------------------------------------------------------------------- /archive.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | get_header(); ?> 10 | 11 |
12 |

13 |
14 | 22 | 23 | max_num_pages > 1 ) { ?> 24 | 27 | 28 | 29 | 30 | 31 | 35 | -------------------------------------------------------------------------------- /author.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | ?> 9 | 10 | get_queried_object(); 14 | ?> 15 | 16 |
17 |

display_name; _e("'s Posts", 'quench'); ?>

18 | description ) echo '
'.$curauth->description.'
'; ?> 19 |
20 | 21 | 29 | 30 | max_num_pages > 1 ) { ?> 31 | 34 | 35 | 36 | 37 | 38 | 42 | -------------------------------------------------------------------------------- /category.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | get_header(); ?> 10 | 11 | 12 |
13 |

14 | '.category_description().'
'; ?> 15 | 16 | 17 | 25 | 26 | max_num_pages > 1 ) { ?> 27 | 30 | 31 | 32 | 33 | 34 | 38 | -------------------------------------------------------------------------------- /comments.php: -------------------------------------------------------------------------------- 1 | 9 | * @license MIT 10 | */ 11 | 12 | if(comments_open()) { 13 | ?> 14 |
15 | ID.'&status=approve');?> 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 | ID); ?> 42 | 43 |

44 | 45 | 46 |
47 |
48 | 49 |
50 | 53 | -------------------------------------------------------------------------------- /css/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/css/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /css/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/css/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /css/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/css/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /css/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/css/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /date.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | get_header(); ?> 10 | 11 |
12 |

13 | 的存档 18 |

19 | 文章存档
'; ?> 20 | 21 | 22 | 30 | 31 | max_num_pages > 1 ) { ?> 32 | 35 | 36 | 37 | 38 | 39 | 43 | -------------------------------------------------------------------------------- /footer.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | ?> 9 | 10 | 14 | 15 | 16 |
17 | 18 |
19 | 20 | 21 | 22 | '.dopt('d_track').''; 24 | if( dopt('d_footcode_b') != '' ) echo dopt('d_footcode'); 25 | 26 | if( is_single() && dopt('d_sideroll_single_b') ){ 27 | $sr_1 = dopt('d_sideroll_single_1'); 28 | $sr_2 = dopt('d_sideroll_single_2'); 29 | }elseif( is_home() && dopt('d_sideroll_index_b') ){ 30 | $sr_1 = dopt('d_sideroll_index_1'); 31 | $sr_2 = dopt('d_sideroll_index_2'); 32 | }elseif(is_page() && dopt('d_sideroll_page_b')){ 33 | $sr_1 = dopt('d_sideroll_page_1'); 34 | $sr_2 = dopt('d_sideroll_page_2'); 35 | }else{ 36 | $sr_1 = 2; 37 | $sr_2 = 4; 38 | } 39 | echo ''; 40 | 41 | wp_footer(); 42 | 43 | ?> 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | include_once('functions/themes.php'); 10 | include_once('functions/articles.php'); 11 | include_once('functions/clear.php'); 12 | include_once('functions/comments.php'); 13 | include_once('functions/misc.php'); 14 | include_once('functions/shortcodes.php'); 15 | include_once('functions/tags.php'); 16 | include_once('functions/widget.php'); 17 | include_once('functions/themeset.php'); 18 | include_once('functions/thumbnail.php'); 19 | ?> 20 | -------------------------------------------------------------------------------- /functions/articles.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | function catch_that_image() { 10 | global $post, $posts; 11 | $first_img = ''; 12 | ob_start(); 13 | ob_end_clean(); 14 | $output = preg_match_all('//i', $post->post_content, $matches); 15 | $first_img = $matches [1][0]; 16 | if(empty($first_img)) { 17 | return false; 18 | } 19 | echo ''; 20 | } 21 | 22 | //删除内容中的图片 23 | function the_content_nopic($more_link_text = null, $stripteaser = false) { 24 | $content = get_the_content($more_link_text, $stripteaser); 25 | $content = apply_filters('the_content', $content); 26 | $content = str_replace(']]>', ']]>', $content); 27 | $content = preg_replace('/<\s*img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', "", $content); 28 | echo $content; 29 | } 30 | 31 | function postformat_gallery(){ 32 | global $post; 33 | ob_start(); 34 | ob_end_clean(); 35 | preg_match_all('//i',$post->post_content,$matches ,PREG_SET_ORDER); 36 | $cnt = count( $matches ); 37 | if($cnt>0){ 38 | $images = ""; 39 | $nav = ""; 40 | for($i=0; $i<$cnt; $i++){ 41 | $src = $matches[$i][1]; 42 | $images .= '
  • '; 43 | } 44 | echo $images; 45 | } else { 46 | return false; 47 | } 48 | } 49 | 50 | if( dopt('d_lazyload_b') != '' ) { 51 | add_filter ('the_content', 'lazyload'); 52 | function lazyload($content) { 53 | $loadimg_url=get_bloginfo('template_directory').'/loading.gif'; 54 | if(!is_feed()||!is_robots) { 55 | $content=preg_replace('//i',"\n",$content); 56 | } 57 | return $content; 58 | } 59 | } 60 | 61 | ?> 62 | -------------------------------------------------------------------------------- /functions/clear.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | function fixed_activity_widget_avatar_style(){ 10 | echo ''; 18 | } 19 | add_action('admin_head', 'fixed_activity_widget_avatar_style' ); 20 | 21 | remove_action('wp_head','wp_generator'); 22 | remove_action('wp_head','rsd_link'); 23 | remove_action('wp_head','wlwmanifest_link'); 24 | remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); 25 | remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 ); 26 | 27 | function hide_admin_bar($flag) { 28 | return false; 29 | } 30 | add_filter('show_admin_bar','hide_admin_bar'); 31 | 32 | remove_filter ('comment_text', 'wpautop'); 33 | 34 | function no_self_ping( &$links ) { 35 | $home = get_option( 'home' ); 36 | foreach ( $links as $l => $link ) 37 | if ( 0 === strpos( $link, $home ) ) 38 | unset($links[$l]); 39 | } 40 | if(dopt('d_nopingback_b')){ 41 | add_action( 'pre_ping', 'no_self_ping' ); 42 | } 43 | 44 | function reset_emojis() { 45 | remove_action('wp_head', 'print_emoji_detection_script', 7); 46 | remove_action('admin_print_scripts', 'print_emoji_detection_script'); 47 | remove_action('wp_print_styles', 'print_emoji_styles'); 48 | remove_action('admin_print_styles', 'print_emoji_styles'); 49 | add_filter('the_content', 'wp_staticize_emoji'); 50 | add_filter('comment_text', 'wp_staticize_emoji',50); 51 | } 52 | add_action('init', 'reset_emojis'); 53 | 54 | add_filter('rest_enabled', '_return_false'); 55 | add_filter('rest_jsonp_enabled', '_return_false'); 56 | 57 | remove_action( 'wp_head', 'rest_output_link_wp_head', 10 ); 58 | remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 ); 59 | function disable_embeds_init() { 60 | /* @var WP $wp */ 61 | global $wp; 62 | 63 | // Remove the embed query var. 64 | $wp->public_query_vars = array_diff( $wp->public_query_vars, array( 65 | 'embed', 66 | ) ); 67 | 68 | // Remove the REST API endpoint. 69 | remove_action( 'rest_api_init', 'wp_oembed_register_route' ); 70 | 71 | // Turn off 72 | add_filter( 'embed_oembed_discover', '__return_false' ); 73 | 74 | // Don't filter oEmbed results. 75 | remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 ); 76 | 77 | // Remove oEmbed discovery links. 78 | remove_action( 'wp_head', 'wp_oembed_add_discovery_links' ); 79 | 80 | // Remove oEmbed-specific JavaScript from the front-end and back-end. 81 | remove_action( 'wp_head', 'wp_oembed_add_host_js' ); 82 | add_filter( 'tiny_mce_plugins', 'disable_embeds_tiny_mce_plugin' ); 83 | 84 | // Remove all embeds rewrite rules. 85 | add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' ); 86 | } 87 | 88 | add_action( 'init', 'disable_embeds_init', 9999 ); 89 | 90 | /** 91 | * Removes the 'wpembed' TinyMCE plugin. 92 | * 93 | * @since 1.0.0 94 | * 95 | * @param array $plugins List of TinyMCE plugins. 96 | * @return array The modified list. 97 | */ 98 | function disable_embeds_tiny_mce_plugin( $plugins ) { 99 | return array_diff( $plugins, array( 'wpembed' ) ); 100 | } 101 | 102 | /** 103 | * Remove all rewrite rules related to embeds. 104 | * 105 | * @since 1.2.0 106 | * 107 | * @param array $rules WordPress rewrite rules. 108 | * @return array Rewrite rules without embeds rules. 109 | */ 110 | function disable_embeds_rewrites( $rules ) { 111 | foreach ( $rules as $rule => $rewrite ) { 112 | if ( false !== strpos( $rewrite, 'embed=true' ) ) { 113 | unset( $rules[ $rule ] ); 114 | } 115 | } 116 | 117 | return $rules; 118 | } 119 | 120 | /** 121 | * Remove embeds rewrite rules on plugin activation. 122 | * 123 | * @since 1.2.0 124 | */ 125 | function disable_embeds_remove_rewrite_rules() { 126 | add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' ); 127 | flush_rewrite_rules(); 128 | } 129 | 130 | register_activation_hook( __FILE__, 'disable_embeds_remove_rewrite_rules' ); 131 | 132 | /** 133 | * Flush rewrite rules on plugin deactivation. 134 | * 135 | * @since 1.2.0 136 | */ 137 | function disable_embeds_flush_rewrite_rules() { 138 | remove_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' ); 139 | flush_rewrite_rules(); 140 | } 141 | 142 | register_deactivation_hook( __FILE__, 'disable_embeds_flush_rewrite_rules' ); 143 | 144 | ?> 145 | -------------------------------------------------------------------------------- /functions/comments.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | function comment($comment, $args, $depth) { 10 | $GLOBALS['comment'] = $comment; 11 | ?> 12 |
  • 2){ echo ' style="margin-left:-50px;"';} ?> id="li-comment-"> 13 |
    14 |
    15 |
    16 | 17 |
    18 | 22 |
    23 | '回复','depth' => $depth, 'max_depth' => $args['max_depth']))); ?> 24 |
    25 |
    26 |
    27 | 28 |
    29 |
    30 | 60*60*24*$day) { 40 | echo date('Y/m/d',get_comment_date('U')), ' ', get_comment_time('H:i'); 41 | }; 42 | } 43 | 44 | function hu_popuplinks($text) { 45 | $text = preg_replace('//i', "", $text); 46 | return $text; 47 | } 48 | add_filter('get_comment_author_link', 'hu_popuplinks', 6); 49 | 50 | function add_nofollow($link, $args, $comment, $post){ 51 | return preg_replace( '/href=\'(.*(\?|&)replytocom=(\d+)#respond)/', 'href=\'#comment-$3', $link ); 52 | } 53 | add_filter('comment_reply_link', 'add_nofollow', 420, 4); 54 | 55 | /*ajax comment submit*/ 56 | add_action('wp_ajax_nopriv_ajax_comment', 'ajax_comment'); 57 | add_action('wp_ajax_ajax_comment', 'ajax_comment'); 58 | function ajax_comment(){ 59 | global $wpdb; 60 | //nocache_headers(); 61 | $comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0; 62 | $post = get_post($comment_post_ID); 63 | $post_author = $post->post_author; 64 | if ( empty($post->comment_status) ) { 65 | do_action('comment_id_not_found', $comment_post_ID); 66 | ajax_comment_err('Invalid comment status.'); 67 | } 68 | $status = get_post_status($post); 69 | $status_obj = get_post_status_object($status); 70 | if ( !comments_open($comment_post_ID) ) { 71 | do_action('comment_closed', $comment_post_ID); 72 | ajax_comment_err('Sorry, comments are closed for this item.'); 73 | } elseif ( 'trash' == $status ) { 74 | do_action('comment_on_trash', $comment_post_ID); 75 | ajax_comment_err('Invalid comment status.'); 76 | } elseif ( !$status_obj->public && !$status_obj->private ) { 77 | do_action('comment_on_draft', $comment_post_ID); 78 | ajax_comment_err('Invalid comment status.'); 79 | } elseif ( post_password_required($comment_post_ID) ) { 80 | do_action('comment_on_password_protected', $comment_post_ID); 81 | ajax_comment_err('Password Protected'); 82 | } else { 83 | do_action('pre_comment_on_post', $comment_post_ID); 84 | } 85 | $comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null; 86 | $comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null; 87 | $comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null; 88 | $comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null; 89 | $edit_id = ( isset($_POST['edit_id']) ) ? $_POST['edit_id'] : null; // 提取 edit_id 90 | $user = wp_get_current_user(); 91 | if ( $user->exists() ) { 92 | if ( empty( $user->display_name ) ) 93 | $user->display_name=$user->user_login; 94 | $comment_author = $wpdb->escape($user->display_name); 95 | $comment_author_email = $wpdb->escape($user->user_email); 96 | $comment_author_url = $wpdb->escape($user->user_url); 97 | $user_ID = $wpdb->escape($user->ID); 98 | if ( current_user_can('unfiltered_html') ) { 99 | if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { 100 | kses_remove_filters(); 101 | kses_init_filters(); 102 | } 103 | } 104 | } else { 105 | if ( get_option('comment_registration') || 'private' == $status ) 106 | ajax_comment_err('Sorry, you must be logged in to post a comment.'); 107 | } 108 | $comment_type = ''; 109 | if ( get_option('require_name_email') && !$user->exists() ) { 110 | if ( 6 > strlen($comment_author_email) || '' == $comment_author ) 111 | ajax_comment_err( 'Error: please fill the required fields (name, email).' ); 112 | elseif ( !is_email($comment_author_email)) 113 | ajax_comment_err( 'Error: please enter a valid email address.' ); 114 | } 115 | if ( '' == $comment_content ) 116 | ajax_comment_err( 'Error: please type a comment.' ); 117 | $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$comment_author' "; 118 | if ( $comment_author_email ) $dupe .= "OR comment_author_email = '$comment_author_email' "; 119 | $dupe .= ") AND comment_content = '$comment_content' LIMIT 1"; 120 | if ( $wpdb->get_var($dupe) ) { 121 | ajax_comment_err('Duplicate comment detected; it looks as though you’ve already said that!'); 122 | } 123 | if ( $lasttime = $wpdb->get_var( $wpdb->prepare("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author = %s ORDER BY comment_date DESC LIMIT 1", $comment_author) ) ) { 124 | $time_lastcomment = mysql2date('U', $lasttime, false); 125 | $time_newcomment = mysql2date('U', current_time('mysql', 1), false); 126 | $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment); 127 | if ( $flood_die ) { 128 | ajax_comment_err('You are posting comments too quickly. Slow down.'); 129 | } 130 | } 131 | $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; 132 | $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); 133 | 134 | if ( $edit_id ) 135 | { 136 | $comment_id = $commentdata['comment_ID'] = $edit_id; 137 | if( ihacklog_user_can_edit_comment($commentdata,$comment_id) ) 138 | { 139 | wp_update_comment( $commentdata ); 140 | } 141 | else 142 | { 143 | ajax_comment_err( 'Cheatin’ uh?' ); 144 | } 145 | 146 | } 147 | else 148 | { 149 | $comment_id = wp_new_comment( $commentdata ); 150 | } 151 | 152 | $comment = get_comment($comment_id); 153 | do_action('set_comment_cookies', $comment, $user); 154 | $comment_depth = 1; 155 | $tmp_c = $comment; 156 | while($tmp_c->comment_parent != 0){ 157 | $comment_depth++; 158 | $tmp_c = get_comment($tmp_c->comment_parent); 159 | } 160 | $GLOBALS['comment'] = $comment; 161 | ?> 162 |
  • id="li-comment-"> 163 |
    164 |
    165 |
    166 | 167 |
    168 | 172 |
    173 | comment_approved ) : ?> 174 |

    您的评论正在排队等待审核,请稍后再来!

    175 | 176 | 177 |
    178 | 179 |
    180 |
    181 | 182 | comment_date); 198 | $new_timestamp = current_time('timestamp'); 199 | // 不用get_comment_author_email($comment_ID) , get_comment_author_IP($comment_ID) 200 | $rs = $comment->comment_author_email === $new_cmt_data['comment_author_email'] 201 | && $comment->comment_author_IP === $_SERVER['REMOTE_ADDR'] 202 | && $new_timestamp - $old_timestamp < 3600; 203 | return $rs; 204 | } 205 | 206 | 207 | add_action('wp_ajax_nopriv_ajax_comment_page_nav', 'ajax_comment_page_nav'); 208 | add_action('wp_ajax_ajax_comment_page_nav', 'ajax_comment_page_nav'); 209 | 210 | function ajax_comment_page_nav(){ 211 | global $post,$wp_query, $wp_rewrite; 212 | $postid = $_POST["um_post"]; 213 | $pageid = $_POST["um_page"]; 214 | $comments = get_comments('post_id='.$postid.'&status=approve'); 215 | $post = get_post($postid); 216 | if( 'desc' != get_option('comment_order') ){ 217 | $comments = array_reverse($comments); 218 | } 219 | $wp_query->is_singular = true; 220 | $baseLink = ''; 221 | if ($wp_rewrite->using_permalinks()) { 222 | $baseLink = '&base=' . user_trailingslashit(get_permalink($postid) . 'comment-page-%#%', 'commentpaged'); 223 | } 224 | echo '
      '; 225 | my_wp_list_comments('type=comment&style=ol&callback=comment&page=' . $pageid . '&per_page=' . get_option('comments_per_page'), $comments); 226 | echo '
    '; 227 | echo ''; 230 | die; 231 | } 232 | 233 | function comment_mail_notify($comment_id) { 234 | $comment = get_comment($comment_id); 235 | $parent_id = $comment->comment_parent ? $comment->comment_parent : ''; 236 | $spam_confirmed = $comment->comment_approved; 237 | if (($parent_id != '') && ($spam_confirmed != 'spam')) { 238 | $wp_email = 'no-reply@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); //e-mail 发出点, no-reply 可改为可用的 e-mail. 239 | $to = trim(get_comment($parent_id)->comment_author_email); 240 | $subject = '您在 [' . get_option("blogname") . '] 的留言有了回复'; 241 | $message = ' 242 |
    '; 252 | $from = "From: \"" . get_option('blogname') . "\" <$wp_email>"; 253 | $headers = "$from\nContent-Type: text/html; charset=" . get_option('blog_charset') . "\n"; 254 | wp_mail( $to, $subject, $message, $headers ); 255 | } 256 | } 257 | add_action('comment_post','comment_mail_notify'); 258 | 259 | function my_wp_list_comments( $args = array(), $comments = null) { 260 | global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop; 261 | $in_comment_loop = true; 262 | $comment_alt = $comment_thread_alt = 0; 263 | $comment_depth = 1; 264 | $defaults = array( 265 | 'walker' => null, 266 | 'max_depth' => '', 267 | 'style' => 'ul', 268 | 'callback' => null, 269 | 'end-callback' => null, 270 | 'type' => 'all', 271 | 'page' => '', 272 | 'per_page' => '', 273 | 'avatar_size' => 32, 274 | 'reverse_top_level' => null, 275 | 'reverse_children' => '', 276 | 'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml', 277 | 'short_ping' => false, 278 | 'echo' => true, 279 | ); 280 | $r = wp_parse_args( $args, $defaults ); 281 | $r = apply_filters( 'wp_list_comments_args', $r ); 282 | if ( null !== $comments ) { 283 | $comments = (array) $comments; 284 | if ( empty($comments) ) 285 | return; 286 | if ( 'all' != $r['type'] ) { 287 | $comments_by_type = separate_comments($comments); 288 | if ( empty($comments_by_type[$r['type']]) ) 289 | return; 290 | $_comments = $comments_by_type[$r['type']]; 291 | } else { 292 | $_comments = $comments; 293 | } 294 | } else { 295 | if ( empty($wp_query->comments) ) 296 | return; 297 | if ( 'all' != $r['type'] ) { 298 | if ( empty($wp_query->comments_by_type) ) 299 | $wp_query->comments_by_type = separate_comments($wp_query->comments); 300 | if ( empty($wp_query->comments_by_type[$r['type']]) ) 301 | return; 302 | $_comments = $wp_query->comments_by_type[$r['type']]; 303 | } else { 304 | $_comments = $wp_query->comments; 305 | } 306 | if ( $wp_query->max_num_comment_pages ) { 307 | $default_comments_page = get_option( 'default_comments_page' ); 308 | $cpage = get_query_var( 'cpage' ); 309 | if ( 'newest' === $default_comments_page ) { 310 | $r['cpage'] = $cpage; 311 | } elseif ( $cpage == 1 ) { 312 | $r['cpage'] = ''; 313 | } else { 314 | $r['cpage'] = $cpage; 315 | } 316 | $r['page'] = 0; 317 | $r['per_page'] = 0; 318 | } 319 | } 320 | if ( '' === $r['per_page'] && get_option( 'page_comments' ) ) { 321 | $r['per_page'] = get_query_var('comments_per_page'); 322 | } 323 | if ( empty($r['per_page']) ) { 324 | $r['per_page'] = 0; 325 | $r['page'] = 0; 326 | } 327 | if ( '' === $r['max_depth'] ) { 328 | if ( get_option('thread_comments') ) 329 | $r['max_depth'] = get_option('thread_comments_depth'); 330 | else 331 | $r['max_depth'] = -1; 332 | } 333 | if ( '' === $r['page'] ) { 334 | if ( empty($overridden_cpage) ) { 335 | $r['page'] = get_query_var('cpage'); 336 | } else { 337 | $threaded = ( -1 != $r['max_depth'] ); 338 | $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1; 339 | set_query_var( 'cpage', $r['page'] ); 340 | } 341 | } 342 | $r['page'] = intval($r['page']); 343 | if ( 0 == $r['page'] && 0 != $r['per_page'] ) 344 | $r['page'] = 1; 345 | if ( null === $r['reverse_top_level'] ) 346 | $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') ); 347 | if ( empty( $r['walker'] ) ) { 348 | $walker = new Walker_Comment; 349 | } else { 350 | $walker = $r['walker']; 351 | } 352 | $output = $walker->paged_walk( $_comments, $r['max_depth'], $r['page'], $r['per_page'], $r ); 353 | $in_comment_loop = false; 354 | if ( $r['echo'] ) { 355 | echo $output; 356 | } else { 357 | return $output; 358 | } 359 | } 360 | 361 | 362 | ?> 363 | -------------------------------------------------------------------------------- /functions/misc.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | function pagenavi($range = 7) { 10 | global $paged, $wp_query; 11 | $max_page = $wp_query->max_num_pages; 12 | if($max_page > 1){if(!$paged){$paged = 1;} 13 | if($paged>1) echo '<'; 14 | if($max_page > $range){ 15 | if($paged < $range){for($i = 1; $i <= ($range + 1); $i++){echo "$i";}} 17 | elseif($paged >= ($max_page - ceil(($range/2)))){ 18 | for($i = $max_page - $range; $i <= $max_page; $i++){echo "$i";}} 20 | elseif($paged >= $range && $paged < ($max_page - ceil(($range/2)))){ 21 | for($i = ($paged - ceil($range/2)); $i <= ($paged + ceil(($range/2))); $i++){echo "$i";}}} 22 | else{for($i = 1; $i <= $max_page; $i++){echo "$i";}} 24 | if($paged<$max_page) echo '>'; 25 | } 26 | } 27 | 28 | function lo_description() { 29 | global $s, $post; 30 | $description = ''; 31 | $blog_name = get_bloginfo('name'); 32 | if ( is_singular() ) { 33 | $ID = $post->ID; 34 | $title = $post->post_title; 35 | $author = $post->post_author; 36 | $user_info = get_userdata($author); 37 | $post_author = $user_info->display_name; 38 | if (!get_post_meta($ID, "meta-description", true)) {$description = $title.' - 作者: '.$post_author.',首发于'.$blog_name;} 39 | else {$description = get_post_meta($ID, "meta-description", true);} 40 | } elseif ( is_home () ) { $description = dopt('d_description'); 41 | } elseif ( is_tag() ) { $description = single_tag_title('', false) . " - ". trim(strip_tags(tag_description())); 42 | } elseif ( is_category() ) { $description = single_cat_title('', false) . " - ". trim(strip_tags(category_description())); 43 | } elseif ( is_archive() ) { $description = $blog_name . "'" . trim( wp_title('', false) ) . "'"; 44 | } elseif ( is_search() ) { $description = $blog_name . ": '" . esc_html( $s, 1 ) . "' 的搜索結果"; 45 | } else { $description = $blog_name . "'" . trim( wp_title('', false) ) . "'"; 46 | } 47 | $description = mb_substr( $description, 0, 220, 'utf-8' ); 48 | echo "\n"; 49 | } 50 | add_action('wp_head','lo_description'); 51 | 52 | 53 | 54 | if ( ! function_exists( 'lo_post_views' ) ) { 55 | function record_visitors() { 56 | if (is_singular()) { 57 | global $post; 58 | $post_ID = $post->ID; 59 | if($post_ID) { 60 | $post_views = (int)get_post_meta($post_ID, 'views', true); 61 | if(!update_post_meta($post_ID, 'views', ($post_views+1))) { 62 | add_post_meta($post_ID, 'views', 1, true); 63 | } 64 | } 65 | } 66 | } 67 | add_action('wp_head', 'record_visitors'); 68 | 69 | function lo_post_views($after='') { 70 | global $post; 71 | $post_ID = $post->ID; 72 | $views = (int)get_post_meta($post_ID, 'views', true); 73 | echo $views, $after; 74 | } 75 | } 76 | 77 | add_action('wp_ajax_nopriv_lo_like', 'lo_like'); 78 | add_action('wp_ajax_lo_like', 'lo_like'); 79 | function lo_like(){ 80 | global $wpdb,$post; 81 | $id = $_POST["um_id"]; 82 | $action = $_POST["um_action"]; 83 | if ( $action == 'ding'){ 84 | $lo_raters = get_post_meta($id,'lo_ding',true); 85 | $expire = time() + 99999999; 86 | $domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false; // make cookies work with localhost 87 | setcookie('lo_ding_'.$id,$id,$expire,'/',$domain,false); 88 | if (!$lo_raters || !is_numeric($lo_raters)) { 89 | update_post_meta($id, 'lo_ding', 1); 90 | } 91 | else { 92 | update_post_meta($id, 'lo_ding', ($lo_raters + 1)); 93 | } 94 | echo get_post_meta($id,'lo_ding',true); 95 | } 96 | die; 97 | } 98 | 99 | function get_ssl_avatar($avatar) { 100 | $avatar = str_replace(array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"), "o0skf43s7.qnssl.com", $avatar); 101 | return $avatar; 102 | } 103 | add_filter('get_avatar', 'get_ssl_avatar'); 104 | 105 | function dimox_breadcrumbs() { 106 | $delimiter = '»'; 107 | $name = 'Home'; 108 | $currentBefore = ''; 109 | $currentAfter = ''; 110 | if ( !is_home() && !is_front_page() || is_paged() ) { 111 | echo '
    '; 112 | global $post; 113 | $home = get_bloginfo('url'); 114 | echo '' . $name . ' ' . $delimiter . ' '; 115 | if ( is_category() ) { 116 | global $wp_query; 117 | $cat_obj = $wp_query->get_queried_object(); 118 | $thisCat = $cat_obj->term_id; 119 | $thisCat = get_category($thisCat); 120 | $parentCat = get_category($thisCat->parent); 121 | if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' ')); 122 | echo $currentBefore . 'Archive by category ''; 123 | single_cat_title(); 124 | echo ''' . $currentAfter; 125 | } elseif ( is_day() ) { 126 | echo '' . get_the_time('Y') . ' ' . $delimiter . ' '; 127 | echo '' . get_the_time('F') . ' ' . $delimiter . ' '; 128 | echo $currentBefore . get_the_time('d') . $currentAfter; 129 | } elseif ( is_month() ) { 130 | echo '' . get_the_time('Y') . ' ' . $delimiter . ' '; 131 | echo $currentBefore . get_the_time('F') . $currentAfter; 132 | } elseif ( is_year() ) { 133 | echo $currentBefore . get_the_time('Y') . $currentAfter; 134 | } elseif ( is_single() ) { 135 | $cat = get_the_category(); $cat = $cat[0]; 136 | echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); 137 | echo $currentBefore; 138 | the_title(); 139 | echo $currentAfter; 140 | } elseif ( is_page() && !$post->post_parent ) { 141 | echo $currentBefore; 142 | the_title(); 143 | echo $currentAfter; 144 | } elseif ( is_page() && $post->post_parent ) { 145 | $parent_id = $post->post_parent; 146 | $breadcrumbs = array(); 147 | while ($parent_id) { 148 | $page = get_page($parent_id); 149 | $breadcrumbs[] = '' . get_the_title($page->ID) . ''; 150 | $parent_id = $page->post_parent; 151 | } 152 | $breadcrumbs = array_reverse($breadcrumbs); 153 | foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' '; 154 | echo $currentBefore; 155 | the_title(); 156 | echo $currentAfter; 157 | } elseif ( is_search() ) { 158 | echo $currentBefore . 'Search results for '' . get_search_query() . ''' . $currentAfter; 159 | } elseif ( is_tag() ) { 160 | echo $currentBefore . 'Posts tagged ''; 161 | single_tag_title(); 162 | echo ''' . $currentAfter; 163 | } elseif ( is_author() ) { 164 | global $author; 165 | $userdata = get_userdata($author); 166 | echo $currentBefore . 'Articles posted by ' . $userdata->display_name . $currentAfter; 167 | } elseif ( is_404() ) { 168 | echo $currentBefore . 'Error 404' . $currentAfter; 169 | } 170 | if ( get_query_var('paged') ) { 171 | if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' ('; 172 | echo __('Page') . ' ' . get_query_var('paged'); 173 | if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')'; 174 | } 175 | echo '
    '; 176 | } 177 | } 178 | 179 | function is_mobile() { 180 | $user_agent = $_SERVER['HTTP_USER_AGENT']; 181 | $mobile_browser = Array( 182 | "mqqbrowser", //手机QQ浏览器 183 | "opera mobi", //手机opera 184 | "juc","iuc",//uc浏览器 185 | "fennec","ios","applewebKit/420","applewebkit/525","applewebkit/532","ipad","iphone","ipaq","ipod", 186 | "iemobile", "windows ce",//windows phone 187 | "240x320","480x640","acer","android","anywhereyougo.com","asus","audio","blackberry","blazer","coolpad" ,"dopod", "etouch", "hitachi","htc","huawei", "jbrowser", "lenovo","lg","lg-","lge-","lge", "mobi","moto","nokia","phone","samsung","sony","symbian","tablet","tianyu","wap","xda","xde","zte" 188 | ); 189 | $is_mobile = false; 190 | foreach ($mobile_browser as $device) { 191 | if (stristr($user_agent, $device)) { 192 | $is_mobile = true; 193 | break; 194 | } 195 | } 196 | return $is_mobile; 197 | } 198 | 199 | function bookmarks_cate() { 200 | global $wpdb; 201 | $all_link_cats = array(); 202 | $linkcats = $wpdb->get_results("SELECT T1.name AS name, T1.term_id AS ID FROM $wpdb->terms T1, $wpdb->term_taxonomy T2 WHERE T1.term_id = T2.term_id AND T2.taxonomy = 'link_category'"); 203 | if($linkcats) { 204 | foreach($linkcats as $linkcat) { 205 | $all_link_cats[$linkcat->ID] = $linkcat->name; 206 | } 207 | } 208 | return $all_link_cats; 209 | } 210 | ?> 211 | -------------------------------------------------------------------------------- /functions/shortcodes.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | function xmmusic($atts, $content=null, $code=""){ 10 | return '
    --:--
    '; 11 | } 12 | add_shortcode('xiami','xmmusic'); 13 | 14 | add_filter('the_content', 'addhighslideclass_replace'); 15 | function addhighslideclass_replace ($content) { 16 | global $post; 17 | $pattern = "/]*).(bmp|gif|jpeg|jpg|png|swf)('|\")(.*?)>(.*?)<\/a>/i"; 18 | $replacement = '$7'; 19 | $content = preg_replace($pattern, $replacement, $content); 20 | return $content; 21 | } 22 | 23 | add_filter('pre_get_posts','search_filter'); 24 | function search_filter($query) { 25 | if ($query->is_search) { 26 | $query->set('post_type', 'post'); 27 | } 28 | return $query; 29 | } 30 | 31 | function boxattention($atts, $content=null, $code="") { 32 | $return = '
    '; 33 | $return .= $content; 34 | $return .= '
    '; 35 | return $return; 36 | } 37 | add_shortcode('attention' , 'boxattention' ); 38 | 39 | function boxbag($atts, $content=null, $code="") { 40 | $return = '
    '; 41 | $return .= $content; 42 | $return .= '
    '; 43 | return $return; 44 | } 45 | add_shortcode('bag' , 'boxbag' ); 46 | 47 | function boxbonus($atts, $content=null, $code="") { 48 | $return = '
    '; 49 | $return .= $content; 50 | $return .= '
    '; 51 | return $return; 52 | } 53 | add_shortcode('bonus' , 'boxbonus' ); 54 | 55 | function boxcalendar($atts, $content=null, $code="") { 56 | $return = '
    '; 57 | $return .= $content; 58 | $return .= '
    '; 59 | return $return; 60 | } 61 | add_shortcode('calendar' , 'boxcalendar' ); 62 | 63 | function boxcheck($atts, $content=null, $code="") { 64 | $return = '
    '; 65 | $return .= $content; 66 | $return .= '
    '; 67 | return $return; 68 | } 69 | add_shortcode('check' , 'boxcheck' ); 70 | 71 | function boxdelete($atts, $content=null, $code="") { 72 | $return = '
    '; 73 | $return .= $content; 74 | $return .= '
    '; 75 | return $return; 76 | } 77 | add_shortcode('delete' , 'boxdelete' ); 78 | 79 | function boxedit($atts, $content=null, $code="") { 80 | $return = '
    '; 81 | $return .= $content; 82 | $return .= '
    '; 83 | return $return; 84 | } 85 | add_shortcode('edit' , 'boxedit' ); 86 | 87 | function boxflag($atts, $content=null, $code="") { 88 | $return = '
    '; 89 | $return .= $content; 90 | $return .= '
    '; 91 | return $return; 92 | } 93 | add_shortcode('flag' , 'boxflag' ); 94 | 95 | function boxhelp($atts, $content=null, $code="") { 96 | $return = '
    '; 97 | $return .= $content; 98 | $return .= '
    '; 99 | return $return; 100 | } 101 | add_shortcode('help' , 'boxhelp' ); 102 | 103 | function boxinformation($atts, $content=null, $code="") { 104 | $return = '
    '; 105 | $return .= $content; 106 | $return .= '
    '; 107 | return $return; 108 | } 109 | add_shortcode('information' , 'boxinformation' ); 110 | 111 | function boxlove($atts, $content=null, $code="") { 112 | $return = '
    '; 113 | $return .= $content; 114 | $return .= '
    '; 115 | return $return; 116 | } 117 | add_shortcode('love' , 'boxlove' ); 118 | 119 | function boxtag($atts, $content=null, $code="") { 120 | $return = '
    '; 121 | $return .= $content; 122 | $return .= '
    '; 123 | return $return; 124 | } 125 | add_shortcode('tag' , 'boxtag' ); 126 | 127 | 128 | ?> 129 | -------------------------------------------------------------------------------- /functions/tags.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | function specs_getfirstchar($s0) { 10 | $fchar = ord($s0{0}); 11 | if($fchar >= ord("A") and $fchar <= ord("z") )return strtoupper($s0{0}); 12 | $s1 = iconv("UTF-8","gb2312", $s0); 13 | $s2 = iconv("gb2312","UTF-8", $s1); 14 | if($s2 == $s0){$s = $s1;}else{$s = $s0;} 15 | $asc = ord($s{0}) * 256 + ord($s{1}) - 65536; 16 | if($asc >= -20319 and $asc <= -20284) return "A"; 17 | if($asc >= -20283 and $asc <= -19776) return "B"; 18 | if($asc >= -19775 and $asc <= -19219) return "C"; 19 | if($asc >= -19218 and $asc <= -18711) return "D"; 20 | if($asc >= -18710 and $asc <= -18527) return "E"; 21 | if($asc >= -18526 and $asc <= -18240) return "F"; 22 | if($asc >= -18239 and $asc <= -17923) return "G"; 23 | if($asc >= -17922 and $asc <= -17418) return "H"; 24 | if($asc >= -17417 and $asc <= -16475) return "J"; 25 | if($asc >= -16474 and $asc <= -16213) return "K"; 26 | if($asc >= -16212 and $asc <= -15641) return "L"; 27 | if($asc >= -15640 and $asc <= -15166) return "M"; 28 | if($asc >= -15165 and $asc <= -14923) return "N"; 29 | if($asc >= -14922 and $asc <= -14915) return "O"; 30 | if($asc >= -14914 and $asc <= -14631) return "P"; 31 | if($asc >= -14630 and $asc <= -14150) return "Q"; 32 | if($asc >= -14149 and $asc <= -14091) return "R"; 33 | if($asc >= -14090 and $asc <= -13319) return "S"; 34 | if($asc >= -13318 and $asc <= -12839) return "T"; 35 | if($asc >= -12838 and $asc <= -12557) return "W"; 36 | if($asc >= -12556 and $asc <= -11848) return "X"; 37 | if($asc >= -11847 and $asc <= -11056) return "Y"; 38 | if($asc >= -11055 and $asc <= -10247) return "Z"; 39 | return null; 40 | } 41 | function specs_pinyin($zh){ 42 | $ret = ""; 43 | $s1 = iconv("UTF-8","gb2312", $zh); 44 | $s2 = iconv("gb2312","UTF-8", $s1); 45 | if($s2 == $zh){$zh = $s1;} 46 | $s1 = substr($zh,$i,1); 47 | $p = ord($s1); 48 | if($p > 160){ 49 | $s2 = substr($zh,$i++,2); 50 | $ret .= specs_getfirstchar($s2); 51 | }else{ 52 | $ret .= $s1; 53 | } 54 | return strtoupper($ret); 55 | } 56 | 57 | function specs_show_tags() { 58 | //if(!$output = get_option('specs_tags_list')){ 59 | $categories = get_terms( 'post_tag', array( 60 | 'orderby' => 'count', 61 | 'hide_empty' => 1 62 | ) ); 63 | foreach($categories as $v){ 64 | for($i = 65; $i <= 90; $i++){ 65 | if(specs_pinyin($v->name) == chr($i)){ 66 | $r[chr($i)][] = $v; 67 | } 68 | } 69 | for($i=48;$i<=57;$i++){ 70 | if(specs_pinyin($v->name) == chr($i)){ 71 | $r[chr($i)][] = $v; 72 | } 73 | } 74 | } 75 | ksort($r); 76 | $output = "
      "; 77 | for($i=65;$i<=90;$i++){ 78 | $tagi = $r[chr($i)]; 79 | if(is_array($tagi)){ 80 | $output .= "
    • ".chr($i)."
    • "; 81 | }else{ 82 | $output .= "
    • ".chr($i)."
    • "; 83 | } 84 | } 85 | for($i=48;$i<=57;$i++){ 86 | $tagi = $r[chr($i)]; 87 | if(is_array($tagi)){ 88 | $output .= "
    • ".chr($i)."
    • "; 89 | }else{ 90 | $output .= "
    • ".chr($i)."
    • "; 91 | } 92 | } 93 | $output .= "
    "; 94 | $output .= ""; 116 | update_option('specs_tags_list', $output); 117 | //} 118 | echo $output; 119 | } 120 | 121 | function clear_tags_cache() { 122 | update_option('specs_tags_list', ''); 123 | } 124 | add_action('save_post', 'clear_tags_cache'); 125 | 126 | function specs_post_count_by_tag ( $arg ,$type = 'include'){ 127 | $args=array( 128 | $type => $arg, 129 | ); 130 | $tags = get_tags($args); 131 | if ($tags) { 132 | foreach ($tags as $tag) { 133 | return $tag->count; 134 | } 135 | } 136 | } 137 | 138 | 139 | ?> 140 | -------------------------------------------------------------------------------- /functions/themes.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | function my_enqueue_scripts_frontpage() { 10 | wp_enqueue_style( 'default', get_template_directory_uri() . '/style.min.css', array(), '3.2.1' ); 11 | wp_enqueue_style( 'fa', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.1.0' ); 12 | //载入jquery库 13 | wp_deregister_script( 'jquery' ); 14 | wp_register_script( 'jquery', get_template_directory_uri() . '/js/jquery-1.12.4.min.js'); 15 | wp_enqueue_script( 'jquery' ); 16 | wp_enqueue_script( 'base', get_template_directory_uri() . '/js/global.min.js', array(), '3.2.1', true); 17 | wp_enqueue_script( 'slider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array(), '1.0', true); 18 | wp_enqueue_script( 'slimbox', get_template_directory_uri() . '/js/slimbox2.min.js', array(), '1.0', true); 19 | wp_enqueue_script( 'jplayer', get_template_directory_uri() . '/js/jquery.jplayer.min.js', array(), '1.0', true); 20 | 21 | if( dopt('d_lazyload_b') != '' ) 22 | wp_enqueue_script( 'lazyload', get_template_directory_uri() . '/js/jquery.lazyload.min.js', array(), '1.0', true); 23 | 24 | if( dopt('d_ajax_b') != '' ) 25 | wp_enqueue_script( 'ajax', get_template_directory_uri() . '/js/ajax.min.js', array(), '1.0.2', true); 26 | if( dopt('d_autospace_b') != '' ) 27 | wp_enqueue_script( 'autospace', get_template_directory_uri() . '/js/autospace.min.js', array(), '1.0', true); 28 | 29 | wp_localize_script('base', 'ajax', array( 30 | 'ajax_url' => admin_url('admin-ajax.php'), 31 | 'home' => home_url(), 32 | 'swf' => get_template_directory_uri() .'/js/' 33 | )); 34 | } 35 | add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts_frontpage' ); 36 | 37 | add_action('after_setup_theme', 'my_theme_setup'); 38 | function my_theme_setup(){ 39 | load_theme_textdomain('quench', get_template_directory() . '/languages'); 40 | } 41 | 42 | register_nav_menus(array('header-menu' => '顶部导航')); 43 | 44 | add_theme_support( 'post-formats', array( 'status', 'image', 'gallery', 'audio' )); 45 | add_theme_support( 'post-thumbnails' ); 46 | 47 | add_filter( 'pre_option_link_manager_enabled', '__return_true' ); 48 | 49 | function dopt($e){ 50 | return stripslashes(get_option($e)); 51 | } 52 | 53 | ?> 54 | -------------------------------------------------------------------------------- /functions/themeset.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | $themename = 'Quench 主题'; 10 | 11 | $options = array ( 12 | 13 | //基本设置 14 | array( "name" => "基本设置","type" => "section","desc" => "主题的基本设置,包括模块是否开启等"), 15 | 16 | array( "name" => "网站描述","type" => "tit"), 17 | array( "id" => "d_description","type" => "text","std" => "输入你的网站描述,一般不超过200个字符"), 18 | 19 | array( "name" => "文章顶部公告","type" => "tit"), 20 | array( "id" => "d_notice","type" => "textarea"), 21 | 22 | array( "name" => "页面底部公告","type" => "tit"), 23 | array( "id" => "d_notice_bottom","type" => "textarea"), 24 | 25 | array( "name" => "禁止站内pingback","type" => "tit"), 26 | array( "id" => "d_nopingback_b","type" => "checkbox" ), 27 | 28 | array( "name" => "中英文间自动添加空格","type" => "tit"), 29 | array( "id" => "d_autospace_b","type" => "checkbox" ), 30 | 31 | array( "name" => "开启全站 Ajax","type" => "tit"), 32 | array( "id" => "d_ajax_b","type" => "checkbox" ), 33 | 34 | array( "name" => "开启图片延迟加载","type" => "tit"), 35 | array( "id" => "d_lazyload_b","type" => "checkbox" ), 36 | 37 | array( "name" => "使用同一个侧边栏","type" => "tit"), 38 | array( "id" => "d_same_sidebar_b","type" => "checkbox" ), 39 | 40 | array( "name" => "首页面滚动时侧栏模块固定","type" => "tit"), 41 | array( "id" => "d_sideroll_index_b","type" => "checkbox" ), 42 | array( "id" => "d_sideroll_index_1","type" => "number","std" => "1","txt" => "滚动时固定侧栏模块"), 43 | array( "id" => "d_sideroll_index_2","type" => "number","std" => "2","txt" => "和模块 "), 44 | 45 | array( "name" => "文章页面滚动时侧栏模块固定","type" => "tit"), 46 | array( "id" => "d_sideroll_single_b","type" => "checkbox" ), 47 | array( "id" => "d_sideroll_single_1","type" => "number","std" => "1","txt" => "滚动时固定侧栏模块"), 48 | array( "id" => "d_sideroll_single_2","type" => "number","std" => "2","txt" => "和模块 "), 49 | 50 | array( "name" => "其他页面滚动时侧栏模块固定","type" => "tit"), 51 | array( "id" => "d_sideroll_page_b","type" => "checkbox" ), 52 | array( "id" => "d_sideroll_page_1","type" => "number","std" => "1","txt" => "滚动时固定侧栏模块"), 53 | array( "id" => "d_sideroll_page_2","type" => "number","std" => "2","txt" => "和模块 "), 54 | 55 | array( "type" => "endtag"), 56 | 57 | 58 | 59 | //SNS设置 60 | array( "name" => "SNS设置","type" => "section" ), 61 | 62 | array( "name" => "开启","type" => "tit"), 63 | array( "id" => "d_sns_open","type" => "checkbox" ), 64 | 65 | array( "name" => "RSS订阅地址","type" => "tit"), 66 | array( "id" => "d_rss_b","type" => "checkbox" ), 67 | array( "id" => "d_rss","type" => "text","class" => "d_inp_short","std" => "http://lostg.com/feed"), 68 | 69 | array( "name" => "邮箱地址","type" => "tit"), 70 | array( "id" => "d_mail_b","type" => "checkbox" ), 71 | array( "id" => "d_mail","type" => "text","class" => "d_inp_short","std" => "mailto://i@lostg.com"), 72 | 73 | array( "name" => "新浪微博","type" => "tit"), 74 | array( "id" => "d_rss_sina_b","type" => "checkbox" ), 75 | array( "id" => "d_rss_sina","type" => "text","class" => "d_inp_short","std" => "http://weibo.com/"), 76 | 77 | array( "name" => "twitter","type" => "tit"), 78 | array( "id" => "d_rss_twitter_b","type" => "checkbox" ), 79 | array( "id" => "d_rss_twitter","type" => "text","class" => "d_inp_short","std" => "http://twitter.com"), 80 | 81 | array( "name" => "Google+","type" => "tit"), 82 | array( "id" => "d_rss_google_b","type" => "checkbox" ), 83 | array( "id" => "d_rss_google","type" => "text","class" => "d_inp_short","std" => "https://plus.google.com "), 84 | 85 | array( "name" => "Github","type" => "tit"), 86 | array( "id" => "d_rss_github_b","type" => "checkbox" ), 87 | array( "id" => "d_rss_github","type" => "text","class" => "d_inp_short","std" => "https://github.com/mastermay"), 88 | 89 | array( "name" => "facebook","type" => "tit"), 90 | array( "id" => "d_rss_facebook_b","type" => "checkbox" ), 91 | array( "id" => "d_rss_facebook","type" => "text","class" => "d_inp_short","std" => "http://facebook.com"), 92 | 93 | array( "name" => "Linkedin","type" => "tit"), 94 | array( "id" => "d_rss_linkedin_b","type" => "checkbox" ), 95 | array( "id" => "d_rss_linkedin","type" => "text","class" => "d_inp_short","std" => "http://linkedin.com"), 96 | 97 | array( "name" => "腾讯微博","type" => "tit"), 98 | array( "id" => "d_rss_tencent_b","type" => "checkbox" ), 99 | array( "id" => "d_rss_tencent","type" => "text","class" => "d_inp_short","std" => "http://t.qq.com"), 100 | 101 | 102 | array( "type" => "endtag"), 103 | 104 | 105 | //首尾代码 106 | array( "name" => "首尾代码","type" => "section" ), 107 | 108 | array( "name" => "流量统计代码","type" => "tit"), 109 | array( "id" => "d_track_b","type" => "checkbox" ), 110 | array( "id" => "d_track","type" => "textarea","std" => "贴入百度统计、CNZZ、51啦、量子统计代码等等"), 111 | 112 | array( "name" => "头部公共代码","type" => "tit"), 113 | array( "id" => "d_headcode_b","type" => "checkbox" ), 114 | array( "id" => "d_headcode","type" => "textarea","std" => "这部分代码显示在head标签内,可以是css,js等代码"), 115 | 116 | array( "name" => "底部公共代码","type" => "tit"), 117 | array( "id" => "d_footcode_b","type" => "checkbox" ), 118 | array( "id" => "d_footcode","type" => "textarea","std" => "这部分代码显示在页面最底部,可以是js等代码"), 119 | 120 | array( "type" => "endtag"), 121 | 122 | ); 123 | 124 | function mytheme_add_admin() { 125 | global $themename, $options; 126 | if ( isset($_GET['page']) && $_GET['page'] == basename(__FILE__) ) { 127 | if ( 'save' == $_REQUEST['action'] ) { 128 | foreach ($options as $value) { 129 | update_option( $value['id'], $_REQUEST[ $value['id'] ] ); 130 | } 131 | /* 132 | foreach ($options as $value) { 133 | if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } 134 | else { delete_option( $value['id'] ); } 135 | } 136 | */ 137 | header("Location: admin.php?page=themeset.php&saved=true"); 138 | die; 139 | } 140 | else if( 'reset' == $_REQUEST['action'] ) { 141 | foreach ($options as $value) {delete_option( $value['id'] ); } 142 | header("Location: admin.php?page=themeset.php&reset=true"); 143 | die; 144 | } 145 | } 146 | add_theme_page($themename." Options", $themename."设置", 'edit_themes', basename(__FILE__), 'mytheme_admin'); 147 | } 148 | 149 | function mytheme_admin() { 150 | global $themename, $options; 151 | $i=0; 152 | if ( $_REQUEST['saved'] ) echo '
    '.$themename.'修改已保存
    '; 153 | if ( $_REQUEST['reset'] ) echo '
    '.$themename.'已恢复设置
    '; 154 | ?> 155 | 156 | 157 | 262 | 263 | 264 | 306 | 307 | 308 | 309 |
    310 | 311 |

    设置 312 | 313 |

    314 | 315 |
    316 |
    317 |
      318 |
    • 基本设置
    • 319 |
    • SNS设置
    • 320 |
    • 首尾代码
    • 321 |
    322 |
    323 | 324 | 325 |
  • 326 |

    327 |
    328 | 329 | 330 | " /> 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 344 | 345 | 346 | 347 | 348 | 349 | 350 |
    351 |
      352 |
    • 353 | 354 | 355 |
    356 |
    357 |
    358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | -------------------------------------------------------------------------------- /functions/thumbnail.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | function post_thumbnail( $width = 180,$height = 180 ,$flag = true) { 10 | global $post; 11 | if( has_post_thumbnail() ){ 12 | $timthumb_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'full'); 13 | if($flag) { 14 | $post_timthumb = ''.$post->post_title.''; 15 | } else { 16 | $post_timthumb = ''.$post->post_title.''; 17 | } 18 | return $post_timthumb; 19 | } else { 20 | $content = $post->post_content; 21 | preg_match_all('//sim', $content, $strResult, PREG_PATTERN_ORDER); 22 | $n = count($strResult[1]); 23 | if($n > 0){ 24 | if($flag) { 25 | return ''.get_the_title().''; 26 | } else { 27 | return ''.get_the_title().''; 28 | } 29 | } else { 30 | if($flag) { 31 | return ''.get_the_title().''; 32 | } else { 33 | return ''.get_the_title().''; 34 | } 35 | } 36 | } 37 | } 38 | 39 | ?> 40 | -------------------------------------------------------------------------------- /functions/widget.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | // 删除wp自带的小工具 10 | function unregister_default_wp_widgets() { 11 | unregister_widget('WP_Widget_Pages'); 12 | //unregister_widget('WP_Widget_Calendar'); 13 | unregister_widget('WP_Widget_Archives'); 14 | unregister_widget('WP_Widget_Links'); 15 | unregister_widget('WP_Widget_Meta'); 16 | unregister_widget('WP_Widget_Search'); 17 | unregister_widget('WP_Widget_Text'); 18 | //unregister_widget('WP_Widget_Categories'); 19 | unregister_widget('WP_Widget_Recent_Posts'); 20 | unregister_widget('WP_Widget_Recent_Comments'); 21 | unregister_widget('WP_Widget_RSS'); 22 | unregister_widget('WP_Widget_Tag_Cloud'); 23 | unregister_widget('WP_Nav_Menu_Widget'); 24 | } 25 | add_action('widgets_init', 'unregister_default_wp_widgets', 1); 26 | 27 | function lo_sidebar(){ 28 | register_sidebar(array( 29 | 'id'=>'index_sidebar', 30 | 'name'=>'首页边栏', 31 | 'before_title' => '

    ', 32 | 'after_title' => '

    ', 33 | 'before_widget' => '', 35 | )); 36 | 37 | if( dopt('d_same_sidebar_b') == '' ) { 38 | register_sidebar(array( 39 | 'id'=>'single_sidebar', 40 | 'name'=>'文章页边栏', 41 | 'before_title' => '

    ', 42 | 'after_title' => '

    ', 43 | 'before_widget' => '', 45 | )); 46 | 47 | register_sidebar(array( 48 | 'id'=>'page_sidebar', 49 | 'name'=>'页面边栏', 50 | 'before_title' => '

    ', 51 | 'after_title' => '

    ', 52 | 'before_widget' => '', 54 | )); 55 | } 56 | } 57 | add_action('widgets_init','lo_sidebar'); 58 | 59 | include (TEMPLATEPATH . '/functions/widgets/author.php'); 60 | include (TEMPLATEPATH . '/functions/widgets/bookmarks.php'); 61 | include (TEMPLATEPATH . '/functions/widgets/comments.php'); 62 | include (TEMPLATEPATH . '/functions/widgets/post.php'); 63 | include (TEMPLATEPATH . '/functions/widgets/readers.php'); 64 | include (TEMPLATEPATH . '/functions/widgets/search.php'); 65 | include (TEMPLATEPATH . '/functions/widgets/tags.php'); 66 | 67 | ?> 68 | -------------------------------------------------------------------------------- /functions/widgets/author.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | add_action( 'widgets_init', create_function('', 'return register_widget("lo_admin");')); 10 | 11 | class lo_admin extends WP_Widget { 12 | function lo_admin() { 13 | $widget_ops = array( 'classname' => 'lo_admin', 'description' => '显示作者的信息机个人简介' ); 14 | $this->__construct( 'lo_admin', '作者信息', $widget_ops ); 15 | } 16 | 17 | function widget( $args, $instance ) { 18 | extract( $args ); 19 | echo $before_widget; 20 | ?> 21 | 22 |
    23 |
    24 | 25 |
    26 |
    27 |

    28 |

    29 |
    30 |
    31 | '; 33 | if( dopt('d_rss_b') ) echo ''; 34 | if( dopt('d_mail_b') ) echo ''; 35 | if( dopt('d_rss_sina_b') ) echo ''; 36 | if( dopt('d_rss_twitter_b') ) echo ''; 37 | if( dopt('d_rss_google_b') ) echo ''; 38 | if( dopt('d_rss_facebook_b') ) echo ''; 39 | if( dopt('d_rss_github_b') ) echo ''; 40 | if( dopt('d_rss_tencent_b') ) echo ''; 41 | if( dopt('d_rss_linkedin_b') ) echo ''; 42 | //if( dopt('d_rss_b') ) echo ''; 43 | echo ''; 44 | } 45 | ?> 46 | 51 |

    52 | 55 |

    56 | 57 | 62 | -------------------------------------------------------------------------------- /functions/widgets/bookmarks.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | add_action( 'widgets_init', create_function('', 'return register_widget("lo_bookmarks");')); 10 | 11 | class lo_bookmarks extends WP_Widget { 12 | function lo_bookmarks() { 13 | $widget_ops = array( 'classname' => 'lo_bookmarks', 'description' => '友情链接' ); 14 | $this->__construct( 'lo_bookmarks', '友情链接', $widget_ops ); 15 | } 16 | 17 | function widget( $args, $instance ) { 18 | extract( $args ); 19 | $title = apply_filters('widget_name', $instance['title']); 20 | $cate = $instance['cate']; 21 | $limit = $instance['limit']; 22 | 23 | echo $before_widget; 24 | echo $before_title.$title.$after_title; 25 | echo '
      '; 26 | echo lo_bookmarks($cate, $limit); 27 | echo '
    '; 28 | echo $after_widget; 29 | } 30 | function form($instance) { 31 | 32 | ?> 33 |

    34 | 38 |

    39 |

    40 | 54 |

    55 |

    56 | 60 |

    61 | 62 | '. $bookmark->link_name .'
  • '; 73 | } 74 | } 75 | return $output; 76 | } 77 | 78 | ?> 79 | -------------------------------------------------------------------------------- /functions/widgets/comments.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | add_action( 'widgets_init', create_function('', 'return register_widget("lo_recent_comment");')); 10 | 11 | class lo_recent_comment extends WP_Widget { 12 | function lo_recent_comment() { 13 | $widget_ops = array( 'classname' => 'lo_recent_comment', 'description' => '显示近期评论' ); 14 | $this->__construct( 'lo_recent_comment', '最近评论', $widget_ops ); 15 | } 16 | 17 | function widget( $args, $instance ) { 18 | extract( $args ); 19 | $title = apply_filters('widget_name', $instance['title']); 20 | $limit = $instance['limit']; 21 | $addlink = !empty($instance['addlink']) ? $instance['addlink'] : 'on'; 22 | 23 | echo $before_widget; 24 | echo $before_title.$title.$after_title; 25 | echo '
      '; 26 | lo_recent_comment_list($limit, $addlink ); 27 | echo '
    '; 28 | echo $after_widget; 29 | } 30 | function form($instance) { 31 | 32 | ?> 33 |

    34 | 38 |

    39 |

    40 | 44 |

    45 |

    46 | 49 |

    50 | 51 | comment_author_email != $my_email) { 61 | $c_url = $count->comment_author_url; 62 | if ($c_url == '') $c_url = 'javascript:;'; 63 | if($addlink == 'on'){ 64 | $c_urllink = ' href="'. $c_url . '"'; 65 | }else{ 66 | $c_urllink = ' href="javascript:;"'; 67 | } 68 | echo '
  • '.get_avatar( $count->comment_author_email, $size = '45' , '' ). 69 | '
    '.$count->comment_author.':
  • '; 72 | if ($i == $lim) break; 73 | $i++; 74 | } 75 | } 76 | } 77 | ?> 78 | -------------------------------------------------------------------------------- /functions/widgets/post.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | add_action('widgets_init', create_function('', 'return register_widget("lo_siderbar_post");')); 10 | 11 | class lo_siderbar_post extends WP_Widget { 12 | function lo_siderbar_post() { 13 | global $prename; 14 | $this->__construct('lo_siderbar_post', $prename.'文章列表', array( 'description' => '多功能文章列表,可按时间、评论、随机排序' )); 15 | } 16 | function widget($args, $instance) { 17 | extract($args, EXTR_SKIP); 18 | echo $before_widget; 19 | $title = apply_filters('widget_name', $instance['title']); 20 | $limit = $instance['limit']; 21 | $cat = $instance['cat']; 22 | $orderby = $instance['orderby']; 23 | 24 | echo $before_title.$title.$after_title; 25 | 26 | echo lo_posts_list( $orderby,$limit,$cat ); 27 | 28 | echo $after_widget; 29 | } 30 | function update($new_instance, $old_instance) { 31 | $instance = $old_instance; 32 | $instance['title'] = strip_tags($new_instance['title']); 33 | $instance['limit'] = strip_tags($new_instance['limit']); 34 | $instance['cat'] = strip_tags($new_instance['cat']); 35 | $instance['orderby'] = strip_tags($new_instance['orderby']); 36 | return $instance; 37 | } 38 | function form($instance) { 39 | $instance = wp_parse_args( (array) $instance, array( 40 | 'title' => '', 41 | 'limit' => '6', 42 | 'cat' => '', 43 | 'orderby' => 'date', 44 | ) 45 | ); 46 | $title = strip_tags($instance['title']); 47 | $limit = strip_tags($instance['limit']); 48 | $cat = strip_tags($instance['cat']); 49 | $orderby = strip_tags($instance['orderby']); 50 | ?> 51 | 52 |

    53 | 57 |

    58 |

    59 | 67 |

    68 |

    69 | 74 |

    75 |

    76 | 80 |

    81 | 'DESC', 89 | 'cat' => $cat, 90 | 'orderby' => $orderby, 91 | 'showposts' => $limit, 92 | 'ignore_sticky_posts' => 1 93 | ); 94 | 95 | query_posts($args); 96 | echo '
      '; 97 | while (have_posts()) : 98 | the_post(); 99 | global $post; 100 | echo '
    • '; 101 | echo '
      '; 102 | echo post_thumbnail(45, 45, false); 103 | echo '
      '; 104 | echo '
      '; 105 | echo '

      '; 106 | the_title(); 107 | echo '

      '; 112 | echo '
    • '; 113 | endwhile; wp_reset_query(); 114 | echo '
    '; 115 | } 116 | ?> 117 | -------------------------------------------------------------------------------- /functions/widgets/readers.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | add_action( 'widgets_init', create_function('', 'return register_widget("lo_reader");')); 10 | 11 | class lo_reader extends WP_Widget { 12 | function lo_reader() { 13 | $widget_ops = array( 'classname' => 'lo_reader', 'description' => '显示近期评论频繁的网友头像等' ); 14 | $this->__construct( 'lo_reader', '活跃读者', $widget_ops ); 15 | } 16 | 17 | function widget( $args, $instance ) { 18 | extract( $args ); 19 | 20 | $title = apply_filters('widget_name', $instance['title']); 21 | $limit = $instance['limit']; 22 | $outer = $instance['outer']; 23 | $timer = $instance['timer']; 24 | $addlink = $instance['addlink']; 25 | 26 | echo $before_widget; 27 | echo $before_title.$title.$after_title; 28 | echo ''; 31 | echo $after_widget; 32 | } 33 | function form($instance) { 34 | 35 | ?> 36 |

    37 | 41 |

    42 |

    43 | 47 |

    48 |

    49 | 53 |

    54 |

    55 | 59 |

    60 |

    61 | 64 |

    65 | 66 | get_results("select count(comment_author) as cnt, comment_author, comment_author_url, comment_author_email from (select * from $wpdb->comments left outer join $wpdb->posts on ($wpdb->posts.id=$wpdb->comments.comment_post_id) where comment_date > date_sub( now(), interval $tim day ) and user_id='0' and comment_author != '".$out."' and post_password='' and comment_approved='1' and comment_type='') as tempcmt group by comment_author order by cnt desc limit $lim"); 73 | foreach ($counts as $count) { 74 | $c_url = $count->comment_author_url; 75 | if ($c_url == '') $c_url = 'javascript:;'; 76 | 77 | if($addlink == 'on'){ 78 | $c_urllink = ' href="'. $c_url . '"'; 79 | }else{ 80 | $c_urllink = ''; 81 | } 82 | $type .= ''.get_avatar( $count->comment_author_email, $size = '36' , '' ) .''; 83 | } 84 | return $type; 85 | } 86 | ?> 87 | -------------------------------------------------------------------------------- /functions/widgets/search.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | add_action( 'widgets_init', create_function('', 'return register_widget("lo_search");')); 10 | 11 | class lo_search extends WP_Widget { 12 | function lo_search() { 13 | $widget_ops = array( 'classname' => 'lo_search', 'description' => '站内搜索' ); 14 | $this->__construct( 'lo_search', '站内搜索', $widget_ops ); 15 | } 16 | 17 | function widget( $args, $instance ) { 18 | extract( $args ); 19 | echo $before_widget; 20 | ?> 21 |
    22 |
    23 | 24 | 25 |
    26 |
    27 | 32 |

    33 | 36 |

    37 | 38 | 44 | -------------------------------------------------------------------------------- /functions/widgets/tags.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | add_action('widgets_init', create_function('', 'return register_widget("lo_siderbar_tags");')); 10 | 11 | class lo_siderbar_tags extends WP_Widget { 12 | function lo_siderbar_tags() { 13 | global $prename; 14 | $this->__construct('lo_siderbar_tags', $prename.'标签云', array( 'description' => '适配主题的标签云' )); 15 | } 16 | function widget($args, $instance) { 17 | extract($args, EXTR_SKIP); 18 | echo $before_widget; 19 | $tag_title = apply_filters('widget_name', $instance['tag_title']); 20 | $tag_limit = $instance['tag_limit']; 21 | 22 | echo $before_title.$tag_title.$after_title; 23 | 24 | $tag_args = array( 25 | 'order' => DESC, 26 | 'orderby' => count, 27 | 'number' => $tag_limit, 28 | ); 29 | $tags_list = get_tags($tag_args); 30 | if ($tags_list) { 31 | echo '
    '; 32 | foreach($tags_list as $tag) { 33 | echo ''. $tag->name .''; 34 | } 35 | echo '
    '; 36 | } 37 | 38 | 39 | echo $after_widget; 40 | } 41 | function update($new_instance, $old_instance) { 42 | $instance = $old_instance; 43 | $instance['tag_title'] = strip_tags($new_instance['tag_title']); 44 | $instance['tag_limit'] = strip_tags($new_instance['tag_limit']); 45 | return $instance; 46 | } 47 | function form($instance) { 48 | $instance = wp_parse_args( (array) $instance, array( 49 | 'tag_title' => '', 50 | 'tag_limit' => '15' 51 | ) 52 | ); 53 | $tag_title = strip_tags($instance['tag_title']); 54 | $tag_limit = strip_tags($instance['tag_limit']); 55 | ?> 56 | 57 |

    58 | 62 |

    63 |

    64 | 68 |

    69 | 70 | 75 | -------------------------------------------------------------------------------- /header.php: -------------------------------------------------------------------------------- 1 | 8 | * @license MIT 9 | */ 10 | ?> 11 | 12 | > 13 | 14 | 15 | <?php 16 | if(is_front_page() || is_home()) { 17 | bloginfo('name'); 18 | } else if(is_single() || is_page()) { 19 | wp_title(''); 20 | } else if(is_category()) { 21 | printf(__('Category Archives: %1$s', 'quench' ), single_cat_title('', false)); 22 | } else if(is_search()) { 23 | printf(__('Search Result: %1$s', 'quench' ), wp_specialchars($s, 1)); 24 | } else if(is_tag()) { 25 | printf(__('Tag Archives: %1$s', 'quench' ), single_tag_title('', false)); 26 | } else if(is_date()) { 27 | $title = ''; 28 | if(is_day()) { 29 | $title = get_the_time('Y年n月j日'); 30 | } else if(is_year()) { 31 | $title = get_the_time('Y年'); 32 | } else { 33 | $title = get_the_time('Y年n月'); 34 | } 35 | printf('%1$s的文章存档', $title); 36 | } else { 37 | bloginfo('name'); 38 | } 39 | ?> 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | '; 52 | if(function_exists('wp_nav_menu')) { 53 | wp_nav_menu(array( 'theme_location' => 'header-menu','container' => 'ul', 'menu_class' => 'nav')); 54 | } 55 | echo ''; 56 | } 57 | ?> 58 |
    59 |
    60 |
    61 | 83 | 84 |
    85 |
    86 |
    > 87 | -------------------------------------------------------------------------------- /images/attention.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/attention.png -------------------------------------------------------------------------------- /images/bag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/bag.png -------------------------------------------------------------------------------- /images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/bg.jpg -------------------------------------------------------------------------------- /images/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/bg.png -------------------------------------------------------------------------------- /images/bg_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/bg_small.jpg -------------------------------------------------------------------------------- /images/bonus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/bonus.png -------------------------------------------------------------------------------- /images/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/calendar.png -------------------------------------------------------------------------------- /images/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/check.png -------------------------------------------------------------------------------- /images/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/delete.png -------------------------------------------------------------------------------- /images/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/edit.png -------------------------------------------------------------------------------- /images/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/flag.png -------------------------------------------------------------------------------- /images/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/help.png -------------------------------------------------------------------------------- /images/iconfont-bofang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/iconfont-bofang.png -------------------------------------------------------------------------------- /images/iconfont-musicpause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/iconfont-musicpause.png -------------------------------------------------------------------------------- /images/information.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/information.png -------------------------------------------------------------------------------- /images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/loading.gif -------------------------------------------------------------------------------- /images/love.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/love.png -------------------------------------------------------------------------------- /images/nextlabel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/nextlabel.gif -------------------------------------------------------------------------------- /images/prevlabel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/prevlabel.gif -------------------------------------------------------------------------------- /images/quote-post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/quote-post.png -------------------------------------------------------------------------------- /images/random/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/random/1.jpg -------------------------------------------------------------------------------- /images/random/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/random/2.jpg -------------------------------------------------------------------------------- /images/random/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/random/3.jpg -------------------------------------------------------------------------------- /images/random/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/random/4.jpg -------------------------------------------------------------------------------- /images/random/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/random/5.jpg -------------------------------------------------------------------------------- /images/random/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/random/6.jpg -------------------------------------------------------------------------------- /images/random/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/random/7.jpg -------------------------------------------------------------------------------- /images/tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/images/tag.png -------------------------------------------------------------------------------- /inc/post-format/content-audio.php: -------------------------------------------------------------------------------- 1 | 8 | * @license MIT 9 | * @since 1.0 10 | * @version 1.0 11 | */ 12 | ?> 13 |
    > 14 |
    15 | 16 |
    17 |
    18 | -------------------------------------------------------------------------------- /inc/post-format/content-gallery.php: -------------------------------------------------------------------------------- 1 | 8 | * @license MIT 9 | */ 10 | ?> 11 |
    > 12 |
    13 |

    14 | 15 |

    16 | 22 |
    23 |
    24 |
      25 | 26 |
    27 |
    28 |
    29 | post_content; 31 | $st=strip_tags(apply_filters('the_content',$pc)); 32 | if(has_excerpt()) 33 | the_excerpt(); 34 | elseif(preg_match('//',$pc) || mb_strwidth($st)<500) 35 | the_content_nopic(''); 36 | elseif(function_exists('mb_strimwidth')) 37 | echo'

    '.mb_strimwidth($st,0,500,' ...').'

    '; 38 | else the_content_nopic(''); 39 | ?> 40 |
    41 | 56 |
    57 | -------------------------------------------------------------------------------- /inc/post-format/content-image.php: -------------------------------------------------------------------------------- 1 | 8 | * @license MIT 9 | */ 10 | ?> 11 |
    > 12 |
    13 |

    14 | 15 |

    16 | 22 |
    23 |
    24 | 25 |
    26 |
    27 | post_content; 29 | $st=strip_tags(apply_filters('the_content',$pc)); 30 | if(has_excerpt()) 31 | the_excerpt(); 32 | elseif(preg_match('//',$pc) || mb_strwidth($st)<500) 33 | the_content_nopic(''); 34 | elseif(function_exists('mb_strimwidth')) 35 | echo'

    '.mb_strimwidth($st,0,500,' ...').'

    '; 36 | else the_content_nopic(''); 37 | ?> 38 |
    39 | 54 |
    55 | -------------------------------------------------------------------------------- /inc/post-format/content-status.php: -------------------------------------------------------------------------------- 1 | 8 | * @license MIT 9 | */ 10 | ?> 11 |
    > 12 |
    13 | post_content)), 0, 400,"……"); ?> 14 |
    15 |
    16 | -------------------------------------------------------------------------------- /inc/post-format/content.php: -------------------------------------------------------------------------------- 1 | 8 | * @license MIT 9 | */ 10 | ?> 11 |
    > 12 |
    13 |

    14 | 15 |

    16 | 22 |
    23 |
    24 | post_content; 26 | $st=strip_tags(apply_filters('the_content',$pc)); 27 | if(has_excerpt()) 28 | the_excerpt(); 29 | elseif(preg_match('//',$pc) || mb_strwidth($st)<500) 30 | the_content(''); 31 | elseif(function_exists('mb_strimwidth')) 32 | echo'

    '.mb_strimwidth($st,0,500,' ...').'

    '; 33 | else the_content(''); 34 | ?> 35 |
    36 | 51 |
    52 | -------------------------------------------------------------------------------- /inc/post-format/relatedpost.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | ?> 9 |
    10 |

    11 |
      12 | ID; 15 | $posttags = get_the_tags(); $i = 0; 16 | if ( $posttags ) { 17 | $tags = ''; foreach ( $posttags as $tag ) $tags .= $tag->term_id . ','; 18 | $args = array( 19 | 'post_status' => 'publish', 20 | 'tag__in' => explode(',', $tags), 21 | 'post__not_in' => explode(',', $exclude_id), 22 | 'ignore_sticky_posts' => 1, 23 | 'orderby' => 'comment_date', 24 | 'posts_per_page' => $post_num 25 | ); 26 | query_posts($args); 27 | while( have_posts() ) { the_post(); ?> 28 |
    • 29 | 30 | 31 |
    • 32 | ID; $i ++; 34 | } wp_reset_query(); 35 | } 36 | if ( $i < $post_num ) { 37 | $cats = ''; foreach ( get_the_category() as $cat ) $cats .= $cat->cat_ID . ','; 38 | $args = array( 39 | 'category__in' => explode(',', $cats), 40 | 'post__not_in' => explode(',', $exclude_id), 41 | 'ignore_sticky_posts' => 1, 42 | 'orderby' => 'comment_date', 43 | 'posts_per_page' => $post_num - $i 44 | ); 45 | query_posts($args); 46 | while( have_posts() ) { the_post(); ?> 47 |
    • 48 | 49 | 50 |
    • 51 | 52 | 没有相关文章!'; 56 | ?> 57 |
    58 |
    59 | -------------------------------------------------------------------------------- /inc/post-format/single-gallery.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | ?> 9 | 58 | 59 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /inc/post-format/single.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | ?> 9 | 53 | 54 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 6 | * @license MIT 7 | */ 8 | 9 | get_header(); ?> 10 | 11 | 19 | 20 | max_num_pages > 1 ) { ?> 21 | 24 | 25 | 26 |
    27 | 28 | 32 | -------------------------------------------------------------------------------- /js/Jplayer.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mastermay/quench/0945b4795783b6bd078c1c683076bfbd296be62a/js/Jplayer.swf -------------------------------------------------------------------------------- /js/ajax.js: -------------------------------------------------------------------------------- 1 | var ajaxcontent = 'content'; 2 | var ajaxsearch_class = 'searchform'; 3 | var ajaxignore_string = new String('#, /wp-, .pdf, .zip, .rar, /share'); 4 | var ajaxignore = ajaxignore_string.split(', '); 5 | 6 | var ajaxtrack_analytics = false 7 | var ajaxscroll_top = true 8 | 9 | var ajaxloading_code = '
    '; 10 | //var ajaxloading_code = '
    '; 11 | var ajaxloading_error_code = '

    出错啦,请刷新当前页面。

    '; 12 | var ajaxreloadDocumentReady = false; 13 | 14 | var ajaxisLoad = false; 15 | var ajaxstarted = false; 16 | var ajaxsearchPath = null; 17 | var ajaxua = jQuery.browser; 18 | 19 | jQuery(document).ready(function() { 20 | ajaxloadPageInit(""); 21 | }); 22 | 23 | window.onpopstate = function(event) { 24 | if (ajaxstarted === true && ajaxcheck_ignore(document.location.toString()) == true) { 25 | ajaxloadPage(document.location.toString(), 1); 26 | } 27 | }; 28 | 29 | function ajaxloadPageInit(scope) { 30 | jQuery(scope + "a").click(function(event) { 31 | if (this.href.indexOf(ajax.home) >= 0 && this.href.indexOf(ajax.home) < 20 && ajaxcheck_ignore(this.href) == true) { 32 | event.preventDefault(); 33 | this.blur(); 34 | var caption = this.title || this.name || ""; 35 | var group = this.rel || false; 36 | try { 37 | ajaxclick_code(this); 38 | } catch (err) {} 39 | ajaxloadPage(this.href); 40 | } 41 | }); 42 | 43 | jQuery('.' + ajaxsearch_class).each(function(index) { 44 | if (jQuery(this).attr("action")) { 45 | ajaxsearchPath = jQuery(this).attr("action");; 46 | jQuery(this).submit(function() { 47 | submitSearch(jQuery(this).serialize()); 48 | return false; 49 | }); 50 | } else {} 51 | }); 52 | 53 | if (jQuery('.' + ajaxsearch_class).attr("action")) {} else {} 54 | } 55 | 56 | function ajaxloadPage(url, push, getData) { 57 | 58 | if (!ajaxisLoad) { 59 | if (ajaxscroll_top == true) { 60 | jQuery('html,body').animate({ 61 | scrollTop: 0 62 | }, 1500); 63 | } 64 | ajaxisLoad = true; 65 | ajaxstarted = true; 66 | nohttp = url.replace("http://", "").replace("https://", ""); 67 | firstsla = nohttp.indexOf("/"); 68 | pathpos = url.indexOf(nohttp); 69 | path = url.substring(pathpos + firstsla); 70 | 71 | if (push != 1) { 72 | if (typeof window.history.pushState == "function") { 73 | var stateObj = { 74 | foo: 1000 + Math.random() * 1001 75 | }; 76 | history.pushState(stateObj, "ajax page loaded...", path); 77 | } else {} 78 | } 79 | if (!jQuery('#' + ajaxcontent)) {} 80 | jQuery('body').append(ajaxloading_code); 81 | jQuery('#' + ajaxcontent).fadeTo("slow", 0.4, function() { 82 | jQuery('#' + ajaxcontent).fadeIn("slow", function() { 83 | jQuery.ajax({ 84 | type: "GET", 85 | url: url, 86 | data: getData, 87 | cache: false, 88 | dataType: "html", 89 | success: function(data) { 90 | ajaxisLoad = false; 91 | 92 | datax = data.split(''); 93 | titlesx = data.split(''); 94 | 95 | if (datax.length == 2 || titlesx.length == 2) { 96 | data = data.split('')[1]; 97 | titles = data.split('')[0]; 98 | jQuery(document).attr('title', (jQuery("
    ").html(titles).text())); 99 | } else { 100 | 101 | } 102 | if (ajaxtrack_analytics == true) { 103 | if (typeof _gaq != "undefined") { 104 | if (typeof getData == "undefined") { 105 | getData = ""; 106 | } else { 107 | getData = "?" + getData; 108 | } 109 | _gaq.push(['_trackPageview', path + getData]); 110 | } else { 111 | 112 | } 113 | } 114 | try { 115 | ajaxdata_code(data); 116 | } catch (err) {} 117 | data = data.split('id="' + ajaxcontent + '"')[1]; 118 | data = data.substring(data.indexOf('>') + 1); 119 | var depth = 1; 120 | var output = ''; 121 | 122 | while (depth > 0) { 123 | temp = data.split('
    ')[0]; 124 | i = 0; 125 | pos = temp.indexOf("')[0] + '
    '; 132 | data = data.substring(data.indexOf('
    ') + 6); 133 | } 134 | document.getElementById(ajaxcontent).innerHTML = output; 135 | jQuery('#' + ajaxcontent).css("position", "absolute"); 136 | jQuery('#' + ajaxcontent).css("left", "20000px"); 137 | jQuery('#' + ajaxcontent).show(); 138 | ajaxloadPageInit("#" + ajaxcontent + " "); 139 | 140 | if (ajaxreloadDocumentReady == true) { 141 | jQuery(document).trigger("ready"); 142 | } 143 | try { 144 | ajaxreload_code(); 145 | } catch (err) {} 146 | jQuery('#' + ajaxcontent).hide(); 147 | jQuery('#' + ajaxcontent).css("position", ""); 148 | jQuery('#' + ajaxcontent).css("left", ""); 149 | jQuery('#' + ajaxcontent).fadeTo("slow", 1, function() {}); 150 | jQuery('.spinner').remove(); 151 | }, 152 | error: function(jqXHR, textStatus, errorThrown) { 153 | ajaxisLoad = false; 154 | document.title = "Error loading requested page!"; 155 | document.getElementById(ajaxcontent).innerHTML = ajaxloading_error_code; 156 | } 157 | }); 158 | }); 159 | }); 160 | } 161 | } 162 | 163 | function submitSearch(param) { 164 | if (!ajaxisLoad) { 165 | ajaxloadPage(ajaxsearchPath, 0, param); 166 | } 167 | } 168 | 169 | function ajaxcheck_ignore(url) { 170 | for (var i in ajaxignore) { 171 | if (url.indexOf(ajaxignore[i]) >= 0) { 172 | return false; 173 | } 174 | } 175 | return true; 176 | } 177 | 178 | function ajaxreload_code() { 179 | loadjplayer(); 180 | initgallary(); 181 | initSlim(); 182 | lazyloadinit(); 183 | try{ 184 | init(); 185 | } catch (e) {} 186 | if (typeof DUOSHUO !== 'undefined') 187 | DUOSHUO.EmbedThread('.ds-thread'); 188 | if( window.hermitjs !== undefined ) 189 | hermitjs.reload(0); //默认方式, 会打断播放状态 190 | } 191 | 192 | function ajaxclick_code(thiss) { 193 | jQuery('ul.nav li').each(function() { 194 | jQuery(this).removeClass('current-menu-item'); 195 | }); 196 | jQuery(thiss).parents('li').addClass('current-menu-item'); 197 | } 198 | 199 | function ajaxdata_code(dataa) {} 200 | -------------------------------------------------------------------------------- /js/ajax.min.js: -------------------------------------------------------------------------------- 1 | var ajaxcontent="content";var ajaxsearch_class="searchform";var ajaxignore_string=new String("#, /wp-, .pdf, .zip, .rar, /share");var ajaxignore=ajaxignore_string.split(", ");var ajaxtrack_analytics=false;var ajaxscroll_top=true;var ajaxloading_code='
    ';var ajaxloading_error_code='

    出错啦,请刷新当前页面。

    ';var ajaxreloadDocumentReady=false;var ajaxisLoad=false;var ajaxstarted=false;var ajaxsearchPath=null;var ajaxua=jQuery.browser;jQuery(document).ready(function(){ajaxloadPageInit("")});window.onpopstate=function(event){if(ajaxstarted===true&&ajaxcheck_ignore(document.location.toString())==true){ajaxloadPage(document.location.toString(),1)}};function ajaxloadPageInit(scope){jQuery(scope+"a").click(function(event){if(this.href.indexOf(ajax.home)>=0&&this.href.indexOf(ajax.home)<20&&ajaxcheck_ignore(this.href)==true){event.preventDefault();this.blur();var caption=this.title||this.name||"";var group=this.rel||false;try{ajaxclick_code(this)}catch(err){}ajaxloadPage(this.href)}});jQuery("."+ajaxsearch_class).each(function(index){if(jQuery(this).attr("action")){ajaxsearchPath=jQuery(this).attr("action");jQuery(this).submit(function(){submitSearch(jQuery(this).serialize());return false})}else{}});if(jQuery("."+ajaxsearch_class).attr("action")){}else{}}function ajaxloadPage(url,push,getData){if(!ajaxisLoad){if(ajaxscroll_top==true){jQuery("html,body").animate({scrollTop:0},1500)}ajaxisLoad=true;ajaxstarted=true;nohttp=url.replace("http://","").replace("https://","");firstsla=nohttp.indexOf("/");pathpos=url.indexOf(nohttp);path=url.substring(pathpos+firstsla);if(push!=1){if(typeof window.history.pushState=="function"){var stateObj={foo:1000+Math.random()*1001};history.pushState(stateObj,"ajax page loaded...",path)}else{}}if(!jQuery("#"+ajaxcontent)){}jQuery("body").append(ajaxloading_code);jQuery("#"+ajaxcontent).fadeTo("slow",0.4,function(){jQuery("#"+ajaxcontent).fadeIn("slow",function(){jQuery.ajax({type:"GET",url:url,data:getData,cache:false,dataType:"html",success:function(data){ajaxisLoad=false;datax=data.split("");titlesx=data.split("");if(datax.length==2||titlesx.length==2){data=data.split("")[1];titles=data.split("")[0];jQuery(document).attr("title",(jQuery("
    ").html(titles).text()))}else{}if(ajaxtrack_analytics==true){if(typeof _gaq!="undefined"){if(typeof getData=="undefined"){getData=""}else{getData="?"+getData}_gaq.push(["_trackPageview",path+getData])}else{}}try{ajaxdata_code(data)}catch(err){}data=data.split('id="'+ajaxcontent+'"')[1];data=data.substring(data.indexOf(">")+1);var depth=1;var output="";while(depth>0){temp=data.split("
    ")[0];i=0;pos=temp.indexOf("")[0]+"";data=data.substring(data.indexOf("")+6)}document.getElementById(ajaxcontent).innerHTML=output;jQuery("#"+ajaxcontent).css("position","absolute");jQuery("#"+ajaxcontent).css("left","20000px");jQuery("#"+ajaxcontent).show();ajaxloadPageInit("#"+ajaxcontent+" ");if(ajaxreloadDocumentReady==true){jQuery(document).trigger("ready")}try{ajaxreload_code()}catch(err){}jQuery("#"+ajaxcontent).hide();jQuery("#"+ajaxcontent).css("position","");jQuery("#"+ajaxcontent).css("left","");jQuery("#"+ajaxcontent).fadeTo("slow",1,function(){});jQuery(".spinner").remove()},error:function(jqXHR,textStatus,errorThrown){ajaxisLoad=false;document.title="Error loading requested page!";document.getElementById(ajaxcontent).innerHTML=ajaxloading_error_code}})})})}}function submitSearch(param){if(!ajaxisLoad){ajaxloadPage(ajaxsearchPath,0,param)}}function ajaxcheck_ignore(url){for(var i in ajaxignore){if(url.indexOf(ajaxignore[i])>=0){return false}}return true}function ajaxreload_code(){loadjplayer();initgallary();initSlim();lazyloadinit();try{init()}catch(e){}if(typeof DUOSHUO!=="undefined"){DUOSHUO.EmbedThread(".ds-thread")}if(window.hermitjs!==undefined){hermitjs.reload(0)}}function ajaxclick_code(thiss){jQuery("ul.nav li").each(function(){jQuery(this).removeClass("current-menu-item")});jQuery(thiss).parents("li").addClass("current-menu-item")}function ajaxdata_code(dataa){}; 2 | -------------------------------------------------------------------------------- /js/autospace.min.js: -------------------------------------------------------------------------------- 1 | (function(window,$){var unicode=[];init=function(){if($("html").hasClass("han-la")){$("body").each(function(){var hanzi=unicode_set("hanzi"),latin=unicode_set("latin")+"|"+unicode["punc"][0],punc=unicode["punc"];patterns=["/("+hanzi+")("+latin+"|"+punc[1]+")/ig","/("+latin+"|"+punc[2]+")("+hanzi+")/ig"];patterns.forEach(function(exp){findAndReplaceDOMText(this,{find:eval(exp),replace:"$1$2"})},this);findAndReplaceDOMText(this,{find:"",replace:function(){return document.createElement("hanla")}});this.normalize();$("* > hanla:first-child").parent().each(function(){if(this.firstChild.nodeType==1){$(this).before($(""));$(this).find("hanla:first-child").remove()}})})}},unicode_set=function(set){var join=(set.match(/[hanzi|latin]/))?true:false,result=(join)?unicode[set].join("|"):unicode[set];return result},findAndReplaceDOMText=function(a,b){var b=b;b.filterElements=function(el){var name=el.nodeName.toLowerCase(),classes=(el.nodeType==1)?el.getAttribute("class"):"",charized=(classes&&classes.match(/han-js-charized/)!=null)?true:false;return name!=="style"&&name!=="script"&&!charized};return window.findAndReplaceDOMText(a,b)};unicode["latin"]=["[A-Za-z0-9\u00C0-\u00FF\u0100-\u017F\u0180-\u024F\u1E00-\u1EFF]"];unicode["punc"]=["[@&=_,.?!$%^*-+/]","[(\\['\"<‘“]","[)\\]'\">”’]"];unicode["hanzi"]=["[\u4E00-\u9FFF]","[\u3400-\u4DB5\u9FA6-\u9FBB\uFA70-\uFAD9\u9FBC-\u9FC3\u3007\u3040-\u309E\u30A1-\u30FA\u30FD\u30FE\uFA0E-\uFA0F\uFA11\uFA13-\uFA14\uFA1F\uFA21\uFA23-\uFA24\uFA27-\uFA29]","[\uD840-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF]","\uD86D[\uDC00-\uDF3F]|[\uD86A-\uD86C][\uDC00-\uDFFF]|\uD869[\uDF00-\uDFFF]","\uD86D[\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1F]","[\u31C0-\u31E3]"];unicode["biaodian"]=["[·・︰、,。:;?!—ー⋯….·/]","[「『(〔【《〈“‘]","[」』)〕】》〉’”]"];unicode["zhuyin"]=[];unicode["zhuyin"][0]="[\u3105-\u312D\u31A0-\u31BA]";unicode["zhuyin"]["shengmu"]="[\u3105-\u3119\u312A-\u312C\u31A0-\u31A3]";unicode["zhuyin"]["jieyin"]="[\u3127-\u3129]";unicode["zhuyin"]["yunmu"]="[\u311A-\u3126\u312D\u31A4-\u31B3\u31B8-\u31BA]";unicode["zhuyin"]["yunjiao"]="[\u31B4-\u31B7]";unicode["zhuyin"]["diao"]="[\u02D9\u02CA\u02C5\u02C7\u02CB\u02EA\u02EB]";$(document).on("ready",function(){init()})})(window,window.jQuery,undefined);window.findAndReplaceDOMText=(function(){var PORTION_MODE_RETAIN="retain";var PORTION_MODE_FIRST="first";var doc=document;var toString={}.toString;function isArray(a){return toString.call(a)=="[object Array]"}function escapeRegExp(s){return String(s).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function exposed(){return deprecated.apply(null,arguments)||findAndReplaceDOMText.apply(null,arguments)}function deprecated(regex,node,replacement,captureGroup,elFilter){if((node&&!node.nodeType)&&arguments.length<=2){return false}var isReplacementFunction=typeof replacement=="function";if(isReplacementFunction){replacement=(function(original){return function(portion,match){return original(portion.text,match.startIndex)}}(replacement))}var instance=findAndReplaceDOMText(node,{find:regex,wrap:isReplacementFunction?null:replacement,replace:isReplacementFunction?replacement:"$"+(captureGroup||"&"),prepMatch:function(m,mi){if(!m[0]){throw"findAndReplaceDOMText cannot handle zero-length matches"}if(captureGroup>0){var cg=m[captureGroup];m.index+=m[0].indexOf(cg);m[0]=cg}m.endIndex=m.index+m[0].length;m.startIndex=m.index;m.index=mi;return m},filterElements:elFilter});exposed.revert=function(){return instance.revert()};return true}function findAndReplaceDOMText(node,options){return new Finder(node,options)}exposed.Finder=Finder;function Finder(node,options){options.portionMode=options.portionMode||PORTION_MODE_RETAIN;this.node=node;this.options=options;this.prepMatch=options.prepMatch||this.prepMatch;this.reverts=[];this.matches=this.search();if(this.matches.length){this.processMatches()}}Finder.prototype={search:function(){var match;var matchIndex=0;var regex=this.options.find;var text=this.getAggregateText();var matches=[];regex=typeof regex==="string"?RegExp(escapeRegExp(regex),"g"):regex;if(regex.global){while(match=regex.exec(text)){matches.push(this.prepMatch(match,matchIndex++))}}else{if(match=text.match(regex)){matches.push(this.prepMatch(match,0))}}return matches},prepMatch:function(match,matchIndex){if(!match[0]){throw new Error("findAndReplaceDOMText cannot handle zero-length matches")}match.endIndex=match.index+match[0].length;match.startIndex=match.index;match.index=matchIndex;return match},getAggregateText:function(){var elementFilter=this.options.filterElements;return getText(this.node);function getText(node){if(node.nodeType===3){return node.data}if(elementFilter&&!elementFilter(node)){return""}var txt="";if(node=node.firstChild){do{txt+=getText(node)}while(node=node.nextSibling)}return txt}},processMatches:function(){var matches=this.matches;var node=this.node;var elementFilter=this.options.filterElements;var startPortion,endPortion,innerPortions=[],curNode=node,match=matches.shift(),atIndex=0,matchIndex=0,portionIndex=0,doAvoidNode; 2 | out:while(true){if(curNode.nodeType===3){if(!endPortion&&curNode.length+atIndex>=match.endIndex){endPortion={node:curNode,index:portionIndex++,text:curNode.data.substring(match.startIndex-atIndex,match.endIndex-atIndex),indexInMatch:atIndex-match.startIndex,indexInNode:match.startIndex-atIndex,endIndexInNode:match.endIndex-atIndex,isEnd:true}}else{if(startPortion){innerPortions.push({node:curNode,index:portionIndex++,text:curNode.data,indexInMatch:atIndex-match.startIndex,indexInNode:0})}}if(!startPortion&&curNode.length+atIndex>match.startIndex){startPortion={node:curNode,index:portionIndex++,indexInMatch:0,indexInNode:match.startIndex-atIndex,endIndexInNode:match.endIndex-atIndex,text:curNode.data.substring(match.startIndex-atIndex,match.endIndex-atIndex)}}atIndex+=curNode.data.length}doAvoidNode=curNode.nodeType===1&&elementFilter&&!elementFilter(curNode);if(startPortion&&endPortion){curNode=this.replaceMatch(match,startPortion,innerPortions,endPortion);atIndex-=(endPortion.node.data.length-endPortion.endIndexInNode);startPortion=null;endPortion=null;innerPortions=[];match=matches.shift();portionIndex=0;matchIndex++;if(!match){break}}else{if(!doAvoidNode&&(curNode.firstChild||curNode.nextSibling)){curNode=curNode.firstChild||curNode.nextSibling;continue}}while(true){if(curNode.nextSibling){curNode=curNode.nextSibling;break}else{if(curNode.parentNode!==node){curNode=curNode.parentNode}else{break out}}}}},revert:function(){for(var l=this.reverts.length;l--;){this.reverts[l]()}this.reverts=[]},prepareReplacementString:function(string,portion,match,matchIndex){var portionMode=this.options.portionMode;if(portionMode===PORTION_MODE_FIRST&&portion.indexInMatch>0){return""}string=string.replace(/\$(\d+|&|`|')/g,function($0,t){var replacement;switch(t){case"&":replacement=match[0];break;case"`":replacement=match.input.substring(0,match.startIndex);break;case"'":replacement=match.input.substring(match.endIndex);break;default:replacement=match[+t]}return replacement});if(portionMode===PORTION_MODE_FIRST){return string}if(portion.isEnd){return string.substring(portion.indexInMatch)}return string.substring(portion.indexInMatch,portion.indexInMatch+portion.text.length)},getPortionReplacementNode:function(portion,match,matchIndex){var replacement=this.options.replace||"$&";var wrapper=this.options.wrap;if(wrapper&&wrapper.nodeType){var clone=doc.createElement("div");clone.innerHTML=wrapper.outerHTML||new XMLSerializer().serializeToString(wrapper);wrapper=clone.firstChild}if(typeof replacement=="function"){replacement=replacement(portion,match,matchIndex);if(replacement&&replacement.nodeType){return replacement}return doc.createTextNode(String(replacement))}var el=typeof wrapper=="string"?doc.createElement(wrapper):wrapper;replacement=doc.createTextNode(this.prepareReplacementString(replacement,portion,match,matchIndex));if(!el){return replacement}el.appendChild(replacement);return el},replaceMatch:function(match,startPortion,innerPortions,endPortion){var matchStartNode=startPortion.node;var matchEndNode=endPortion.node;var preceedingTextNode;var followingTextNode;if(matchStartNode===matchEndNode){var node=matchStartNode;if(startPortion.indexInNode>0){preceedingTextNode=doc.createTextNode(node.data.substring(0,startPortion.indexInNode));node.parentNode.insertBefore(preceedingTextNode,node)}var newNode=this.getPortionReplacementNode(endPortion,match);node.parentNode.insertBefore(newNode,node);if(endPortion.endIndexInNode= (str.length - 1) && options.repeat) { 48 | if (options.flashback) { 49 | direction = -1; 50 | } else { 51 | index = 0; 52 | } 53 | if (options.flicker) { 54 | _this.delay(200).fadeOut(1).delay(400).fadeIn(1).delay(200).fadeOut(1).delay(400).fadeIn(1); 55 | } 56 | setTimeout(init, 2000); 57 | } else if (index >= (str.length - 1) && !options.repeat) { 58 | if (options.flicker) { 59 | _this.delay(200).fadeOut(1).delay(400).fadeIn(1).delay(200).fadeOut(1).delay(400).fadeIn(1); 60 | } 61 | _this.css('border-right', ''); 62 | } else if (index < 0) { 63 | index = 0; 64 | direction = 1; 65 | setTimeout(init, Math.random() * options.range + options.speed); 66 | } else { 67 | setTimeout(init, Math.random() * options.range + options.speed); 68 | } 69 | index += direction; 70 | } 71 | }; 72 | 73 | $(document).ready(function($) { 74 | var $commentform = $('#commentform'), 75 | txt1 = '
    正在提交, 请稍候...
    ', 76 | txt2 = '
    #
    ', 77 | txt3 = '">提交成功', 78 | edt1 = ', 刷新页面之前可以再编辑', 80 | cancel_edit = '取消编辑', 81 | edit, 82 | num = 1, 83 | $comments = $('#comments-title span'), 84 | $cancel = $('#cancel-comment-reply-link'), 85 | cancel_text = $cancel.text(), 86 | $submit = $('#commentform #submit'); 87 | $submit.attr('disabled', false), 88 | $body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body'), 89 | comm_array = []; 90 | comm_array.push(''); 91 | $('#comment').after(txt1 + txt2); 92 | $('#loading').hide(); 93 | $('#error').hide(); 94 | $(document).on("submit", "#commentform", 95 | function() { 96 | if (edit) $('#comment').after(''); 97 | editcode(); 98 | $submit.attr('disabled', true).fadeTo('slow', 0.5); 99 | $('#loading').slideDown(); 100 | $.ajax({ 101 | url: ajax.ajax_url, 102 | data: $(this).serialize() + "&action=ajax_comment", 103 | type: $(this).attr('method'), 104 | error: function(request) { 105 | $('#loading').hide(); 106 | $("#error").slideDown().html(request.responseText); 107 | setTimeout(function() { 108 | $submit.attr('disabled', false).fadeTo('slow', 1); 109 | $('#error').slideUp(); 110 | }, 111 | 3000); 112 | }, 113 | success: function(data) { 114 | $('#loading').hide(); 115 | comm_array.push($('#comment').val()); 116 | $('textarea').each(function() { 117 | this.value = '' 118 | }); 119 | var t = addComment, 120 | cancel = t.I('cancel-comment-reply-link'), 121 | temp = t.I('wp-temp-form-div'), 122 | respond = t.I(t.respondId), 123 | post = t.I('comment_post_ID').value, 124 | parent = t.I('comment_parent').value; 125 | if (!edit && $comments.length) { 126 | n = parseInt($comments.text().match(/\d+/)); 127 | $comments.text($comments.text().replace(n, n + 1)); 128 | } 129 | new_htm = '" id="new_comm_' + num + '">') : ('\n