📄 wp_contents.php
字号:
<?phpif( ! defined( 'WP_CONTENTS_INCLUDED' ) ) { define( 'WP_CONTENTS_INCLUDED' , 1 ) ; function b_wp_contents_edit($options) { $form = ""; $form .= "显示的日志数目: "; $form .= "<input type='text' name='options[]' value='".$options[0]."' /><br />"; return $form; } function b_wp_contents_show($options) { $no_posts = (empty($options[0]))? 10 : $options[0]; global $wpdb, $siteurl, $post, $use_cache, $category_cache, $comment_count_cache; global $smilies_directory, $wp_smiliessearch, $wp_smiliesreplace ,$authordata; global $wp_bbcode, $wp_gmcode, $wp_htmltrans, $wp_htmltranswinuni; global $xoopsConfig, $previousday, $time_difference, $day; $id=1; $use_cache = 1; require(dirname(__FILE__).'/../wp-config.php'); global $dateformat,$timeformat; $dateformat = stripslashes(get_settings('date_format')); $timeformat = stripslashes(get_settings('time_format')); $now = date('Y-m-d H:i:s',(time() + (get_settings('time_difference') * 3600))); $request = "SELECT DISTINCT * FROM {$wpdb->posts} "; $request .= " LEFT JOIN {$wpdb->post2cat} ON ({$wpdb->posts}.ID = {$wpdb->post2cat}.post_id) "; $request .= "WHERE post_status = 'publish' "; $request .= " AND post_date <= '".$now."'"; $request .= " GROUP BY {$wpdb->posts}.ID ORDER BY post_date DESC LIMIT 0, $no_posts"; $lposts = $wpdb->get_results($request); if ($lposts) { // Get the categories for all the posts foreach ($lposts as $post) { $post_id_list[] = $post->ID; } $post_id_list = implode(',', $post_id_list); $dogs = $wpdb->get_results("SELECT DISTINCT ID, category_id, cat_name, category_nicename, category_description, category_parent FROM {$wpdb->categories}, {$wpdb->post2cat}, {$wpdb->posts} WHERE category_id = cat_ID AND post_id = ID AND post_id IN ($post_id_list)"); foreach ($dogs as $catt) { $category_cache[$catt->ID][] = $catt; } // Do the same for comment numbers $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount FROM {$wpdb->posts} LEFT JOIN {$wpdb->comments} ON ( comment_post_ID = ID AND comment_approved = '1') WHERE post_status = 'publish' AND ID IN ($post_id_list) GROUP BY ID"); foreach ($comment_counts as $comment_count) { $comment_count_cache["$comment_count->ID"] = $comment_count->ccount; } } $blog = 1; $block = array(); $block['use_theme_template'] = get_xoops_option('wordpress','use_theme_template'); if (file_exists(XOOPS_ROOT_PATH.'/modules/wordpress/themes/'.$xoopsConfig['theme_set'].'/content_block-template.php')) { $themes = $xoopsConfig['theme_set']; } else { $themes = "default"; } $template_fname = XOOPS_ROOT_PATH."/modules/wordpress/themes/".$themes."/content_block-template.php"; $block['style'] =block_style_get(false); $block['divid'] = 'wpBlockContent'; $block['template_content'] = ""; $i = 0; $previousday = 0; foreach ($lposts as $post) { if ($block['use_theme_template'] == 0) { $content = array(); start_wp(); $content['date'] = the_date($dateformat,'','', false); $content['time'] = the_time('', false); $content['title'] = the_title('','', false); $content['permlink'] = get_permalink(); // ob_start(); the_author_posts_link(); $content['author'] = ob_get_contents(); ob_end_clean(); // ob_start(); the_category(); $content['category'] = ob_get_contents(); ob_end_clean(); // ob_start(); the_content(); $content['body'] = ob_get_contents(); ob_end_clean(); // ob_start(); link_pages('<br />页: ', '<br />', 'number'); $content['linkpage'] = ob_get_contents(); ob_end_clean(); // ob_start(); comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS); $content['comments'] = ob_get_contents(); ob_end_clean(); // ob_start(); trackback_rdf(); $content['trackback'] = ob_get_contents(); ob_end_clean(); // $block['contents'][] = $content; } else { ob_start(); include $template_fname; $block['template_content'] .= ob_get_contents(); ob_end_clean(); } } $previousday=0; $day=0; $category_cache=array(); $comment_count_cache=array();// unset(category_cache);// unset(comment_count_cache); return $block; }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -