function b_wp_authors_show($options, $wp_num = "") { $with_count = empty($options[0]) ? 0 : $options[0]; $idmode = empty($options[1]) ? '' : $options[1]; $show_rss2_icon = empty($options[2]) ? 0 : $options[2]; global $wpdb, $siteurl, $wp_id, $wp_inblock, $user_cache; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } $optioncount = $with_count == 1; $exclude_admin = false; $show_fullname = false; $hide_empty = true; $feed = $show_rss2_icon == 1 ? 'rss2' : ''; $feed_image = $show_rss2_icon == 1 ? $siteurl . '/wp-images/rss-mini.gif' : ''; ob_start(); block_style_get($wp_num); echo "<ul class='wpBlockList'>\n"; list_authors2($optioncount, $exclude_admin, $idmode, $hide_empty, $feed, $feed_image); echo "</ul>\n"; $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_calendar_show($option, $wp_num = "") { global $wpdb, $siteurl, $wp_id, $wp_inblock, $xoopsConfig, $use_cache, $m, $monthnum, $year, $wp_mod, $wp_base; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; include dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } if (current_wp()) { param('m', 'integer', ''); param('monthnum', 'integer', ''); param('year', 'integer', ''); $m = array_key_exists('m', $_GET) ? $_GET['m'] : ''; $monthnum = array_key_exists('monthnum', $_GET) ? $_GET['monthnum'] : ''; $year = array_key_exists('year', $_GET) ? $_GET['year'] : ''; } ob_start(); block_style_get($wp_num); get_calendar(1); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_archives_monthly_show($options, $wp_num = "") { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] == 0 ? false : true; global $wpdb, $siteurl, $wp_id, $wp_inblock, $use_cache, $wp_mod, $wp_base; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } ob_start(); block_style_get($wp_num); if ($block_style == 0) { // Simple Listing echo "<ul class='wpBlockList'>\n"; get_archives('monthly', '', 'html', '', '', $with_count); echo "</ul>\n"; } else { // Dropdown Listing echo '<form name="archiveform' . $wp_num . '" action="">'; echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> '; echo '<option value="">' . _WP_BY_MONTHLY . '</option>'; get_archives('monthly', '', 'option', '', '', $with_count); echo '</select>'; echo '</form>'; } $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function _b_wp_archives_monthly_show($options, $wp_num = '') { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] == 0 ? false : true; $tpl_file = empty($options[2]) ? 'wp_archives_monthly.html' : $options[2]; $sel_value = ''; if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'm', 'string', ''); init_param('GET', 'year', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); init_param('GET', 'day', 'integer', ''); if (strlen(get_param('m')) == 6) { $sel_value = get_param('m'); } else { if (test_param('year') && test_param('monthnum') && !test_param('day')) { $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2); } } } $block['wp_num'] = $wp_num; $block['divid'] = 'wpArchive' . $wp_num; $block['siteurl'] = wp_siteurl(); $block['style'] = block_style_get(false); $block['block_style'] = $block_style; $block['with_count'] = $with_count; $now = current_time('mysql'); $postHandler =& wp_handler('Post'); $criteria =& new CriteriaCompo(new Criteria('post_date', $now, '<')); $criteria->add(new Criteria('post_status', 'publish')); $criteria->setSort('post_date'); $criteria->setOrder('DESC'); $criteria->setGroupby('YEAR(post_date), MONTH(post_date)'); $postObjects =& $postHandler->getObjects($criteria, false, 'DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts'); $block['records'] = array(); if ($postObjects) { foreach ($postObjects as $postObject) { $this_year = $postObject->getExtraVar('year'); $this_month = $postObject->getExtraVar('month'); $_record['url'] = get_month_link($this_year, $this_month); $_record['text'] = format_month($this_year, $GLOBALS['month'][zeroise($this_month, 2)]); if ($with_count) { $_record['count'] = ' (' . $postObject->getExtraVar('posts') . ')'; } else { $_record['count'] = ''; } $_record['select'] = $sel_value == $this_year . zeroise($this_month, 2) ? 'selected="selected"' : ''; $block['records'][] = $_record; } } $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); if (!$_wpTpl->tpl_exists($tpl_file)) { $tpl_file = 'wp_archives_monthly.html'; } $block['content'] = $_wpTpl->fetch($tpl_file); return $block; }
function _b_wp_calendar_show($option, $wp_num = "") { if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'p', 'integer', ''); init_param('GET', 'm', 'integer', ''); init_param('GET', 'w', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); init_param('GET', 'year', 'integer', ''); if (test_param('p') && !(test_param('m') || test_param('monthnum') || test_param('w'))) { $postHandler =& wp_handler('Post'); $postObject =& $postHandler->get(get_param('p')); if ($postObject) { $GLOBALS['m'] = mysql2date('Ym', $postObject->getVar('post_date')); } } } $block['wp_num'] = $wp_num; $block['divid'] = 'wpCalendar' . $wp_num; $block['style'] = block_style_get(false); $block['calendar'] = get_calendar(1, false); $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); $block['content'] = $_wpTpl->fetch('wp_calendar.html'); return $block; }
function _b_wp_style_show($options, $wp_num = "") { $block['content'] = block_style_get(false); if ($block['content']) { return $block; } else { return ''; } }
function _b_wp_links_show($option, $wp_num = "") { $block['wp_num'] = $wp_num; $block['divid'] = 'wpLink' . $wp_num; $block['style'] = block_style_get(false); $block['links'] = get_links_list('name', '', false); $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); $block['content'] = $_wpTpl->fetch('wp_links.html'); return $block; }
function _b_wp_links_show($option, $wp_num = "") { ob_start(); block_style_get(); echo "<ul class='wpBlockList'>\n"; get_links_list(); echo "</ul>\n"; $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function _b_wp_search_show($option, $wp_num = "") { $block['wp_num'] = $wp_num; $block['divid'] = 'wpSearch' . $wp_num; $block['style'] = block_style_get(false); $block['act_url'] = wp_siteurl() . '/'; $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); $block['content'] = $_wpTpl->fetch('wp_search.html'); return $block; }
function _b_wp_categories_show($options, $wp_num = "") { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] ? $options[1] : 0; $sorting_key = $options[2] ? $options[2] : 'name'; $sorting_order = $options[3] ? $options[3] : 'asc'; if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'cat', 'string', ''); init_param('GET', 'category_name', 'string', ''); if (!empty($GLOBALS['category_name']) && empty($GLOBALS['cat'])) { if (stristr($GLOBALS['category_name'], '/')) { $GLOBALS['category_name'] = explode('/', $GLOBALS['category_name']); if ($GLOBALS['category_name'][count($GLOBALS['category_name']) - 1]) { $GLOBALS['category_name'] = $GLOBALS['category_name'][count($GLOBALS['category_name']) - 1]; // no trailing slash } else { $GLOBALS['category_name'] = $GLOBALS['category_name'][count($GLOBALS['category_name']) - 2]; // there was a trailling slash } } $categoryHandler =& wp_handler('Category'); $categoryObject =& $categoryHandler->getByNiceName($GLOBALS['category_name']); if ($categoryObject) { $GLOBALS['cat'] = $categoryObject->getVar('cat_ID'); } } } else { $GLOBALS['cat'] = ''; } $block['wp_num'] = $wp_num; $block['divid'] = 'wpCategory' . $wp_num; $block['siteurl'] = wp_siteurl(); $block['style'] = block_style_get(false); $block['block_style'] = $block_style; $block['with_count'] = $with_count; if ($block_style == 0) { $cat_block = _b_wp_categories_list($sorting_key, $sorting_order, $with_count, 0, null, true); } else { $cat_block = _b_wp_categories_list($sorting_key, $sorting_order, $with_count, 0, null, false, '–', 0, $GLOBALS['cat']); } $block['records'] = $cat_block['records']; $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); $block['content'] = $_wpTpl->fetch('wp_categories.html'); return $block; }
function _b_wp_calendar_show($option, $wp_num = "") { if (current_wp()) { init_param('GET', 'm', 'integer', ''); init_param('GET', 'w', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); init_param('GET', 'year', 'integer', ''); } ob_start(); block_style_get($wp_num); get_calendar(1); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_recent_posts_show($options, $wp_num = "") { $no_posts = empty($options[0]) ? 10 : $options[0]; $cat_date = empty($options[1]) ? 0 : $options[1]; global $xoopsDB; global $wpdb, $siteurl, $wp_id, $wp_inblock, $use_cache; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } $now = date('Y-m-d H:i:s', time() + $time_difference * 3600); $request = "SELECT * FROM " . $xoopsDB->prefix("wp{$wp_num}_posts") . " WHERE post_status = 'publish' "; $request .= " AND post_date <= '" . $now . "'"; $request .= " ORDER BY post_date DESC LIMIT 0, {$no_posts}"; $lposts = $wpdb->get_results($request); $date = ""; $pdate = ""; ob_start(); block_style_get($wp_num); $output = ob_get_contents(); ob_end_clean(); $output .= '<div id="wpRecentPost">'; if ($lposts) { foreach ($lposts as $lpost) { if ($cat_date) { $date = mysql2date("Y-n-j", $lpost->post_date); if ($date != $pdate) { // if ($pdate) $output .= "</ul>"; $output .= '<label id="postDate">' . $date . '</label><br />'; $pdate = $date; } $output .= ' '; } $post_title = stripslashes($lpost->post_title); $permalink = get_permalink($lpost->ID); $output .= ' <strong><big>·</big></strong> <a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . $post_title . '">' . $post_title . '</a><br>'; } } $output .= '</div>'; $block['content'] = $output; return $block; }
function b_wp_archives_monthly_show($options, $wp_num = "") { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] == 0 ? false : true; $id = 1; $GLOBALS['use_cache'] = 1; if ($wp_num == "") { $GLOBALS['wp_id'] = $wp_num; $GLOBALS['wp_inblock'] = 1; require dirname(__FILE__) . '/../wp-config.php'; $GLOBALS['wp_inblock'] = 0; } $sel_value = ''; if (current_wp()) { init_param('GET', 'm', 'string', ''); init_param('GET', 'year', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); if (strlen(get_param('m')) == 6) { $sel_value = get_param('m'); } else { if (test_param('year') && test_param('monthnum')) { $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2); } } } ob_start(); block_style_get($wp_num); if ($block_style == 0) { // Simple Listing echo "<ul class='wpBlockList'>\n"; get_archives('monthly', '', 'html', '', '', $with_count); echo "</ul>\n"; } else { // Dropdown Listing echo '<form name="archiveform' . $wp_num . '" id="archiveform' . $wp_num . '" action="#">'; echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> '; echo '<option value="">' . _WP_BY_MONTHLY . '</option>'; get_archives('monthly', '', 'option', '', '', $with_count, $sel_value); echo '</select>'; echo '</form>'; } $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function _b_wp_calendar_show($option, $wp_num = "") { if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'm', 'integer', ''); init_param('GET', 'w', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); init_param('GET', 'year', 'integer', ''); } ob_start(); block_style_get($wp_num); get_calendar(1); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_calendar_show($option, $wp_num = "") { global $wpdb, $siteurl, $wp_id, $wp_inblock, $xoopsConfig, $use_cache; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; include dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } ob_start(); block_style_get($wp_num); get_calendar(1); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function _b_wp_authors_show($options, $wp_num = "") { $with_count = empty($options[0]) ? 0 : $options[0]; $idmode = empty($options[1]) ? '' : $options[1]; $show_rss2_icon = empty($options[2]) ? 0 : $options[2]; $optioncount = $with_count == 1; $exclude_admin = false; $show_fullname = false; $hide_empty = true; $feed = $show_rss2_icon == 1 ? 'rss2' : ''; $feed_image = $show_rss2_icon == 1 ? wp_siteurl() . '/wp-images/rss-mini.gif' : ''; $block['wp_num'] = $wp_num; $block['divid'] = 'wpAuthor' . $wp_num; $block['style'] = block_style_get(false); $block['authors'] = list_authors2($optioncount, $exclude_admin, $idmode, $hide_empty, $feed, $feed_image, false); $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); $block['content'] = $_wpTpl->fetch('wp_authors.html'); return $block; }
function _b_wp_authors_show($options, $wp_num = "") { $with_count = empty($options[0]) ? 0 : $options[0]; $idmode = empty($options[1]) ? '' : $options[1]; $show_rss2_icon = empty($options[2]) ? 0 : $options[2]; $optioncount = $with_count == 1; $exclude_admin = false; $show_fullname = false; $hide_empty = true; $feed = $show_rss2_icon == 1 ? 'rss2' : ''; $feed_image = $show_rss2_icon == 1 ? wp_siteurl() . '/wp-images/rss-mini.gif' : ''; ob_start(); block_style_get(); echo "<ul class='wpBlockList'>\n"; list_authors2($optioncount, $exclude_admin, $idmode, $hide_empty, $feed, $feed_image); echo "</ul>\n"; $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_links_show($option, $wp_num = "") { global $wpdb; global $wp_id, $wp_inblock, $use_cache, $wp_mod, $wp_base; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } ob_start(); block_style_get($wp_num); echo "<ul class='wpBlockList'>\n"; get_links_list(); echo "</ul>\n"; $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function _b_wp_archives_monthly_show($options, $wp_num = '') { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] == 0 ? false : true; $sel_value = ''; if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'm', 'string', ''); init_param('GET', 'year', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); if (strlen(get_param('m')) == 6) { $sel_value = get_param('m'); } else { if (test_param('year') && test_param('monthnum')) { $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2); } } } ob_start(); block_style_get($wp_num); if ($block_style == 0) { // Simple Listing echo '<ul class="wpBlockList">' . "\n"; get_archives('monthly', '', 'html', '', '', $with_count); echo '</ul>' . "\n"; } else { // Dropdown Listing echo '<form name="archiveform' . $wp_num . '" id="archiveform' . $wp_num . '" action="#">'; echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> '; echo '<option value="' . wp_siteurl() . '">' . _WP_BY_MONTHLY . '</option>'; get_archives('monthly', '', 'option', '', '', $with_count, $sel_value); echo '</select>'; echo '</form>'; } $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_calendar_show($option, $wp_num = "") { $id = 1; $GLOBALS['use_cache'] = 1; if ($wp_num == "") { $GLOBALS['wp_id'] = $wp_num; $GLOBALS['wp_inblock'] = 1; require dirname(__FILE__) . '/../wp-config.php'; $GLOBALS['wp_inblock'] = 0; } if (current_wp()) { init_param('GET', 'm', 'integer', ''); init_param('GET', 'w', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); init_param('GET', 'year', 'integer', ''); } ob_start(); block_style_get($wp_num); get_calendar(1); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function _b_wp_calendar_show($option, $wp_num = "") { if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'p', 'integer', ''); init_param('GET', 'm', 'integer', ''); init_param('GET', 'w', 'integer', ''); init_param('GET', 'monthnum', 'integer', ''); init_param('GET', 'year', 'integer', ''); if (test_param('p') && !(test_param('m') || test_param('monthnum') || test_param('w'))) { $postHandler =& wp_handler('Post'); $postObject =& $postHandler->get(get_param('p')); $GLOBALS['m'] = mysql2date('Ym', $postObject->getVar('post_date')); } } ob_start(); block_style_get(); get_calendar(1); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_contents_show($options, $wp_num = "") { $no_posts = empty($options[0]) ? 10 : $options[0]; global $wpdb, $siteurl, $post, $use_cache; global $smilies_directory, $wp_smiliessearch, $wp_smiliesreplace; global $wp_bbcode, $wp_gmcode, $wp_htmltrans, $wp_htmltranswinuni; global $wp_id, $wp_inblock, $xoopsConfig, $previousday, $time_difference; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } global $dateformat, $timeformat; $dateformat = stripslashes(get_settings('date_format')); $timeformat = stripslashes(get_settings('time_format')); $now = date('Y-m-d H:i:s', time() + $time_difference * 3600); $request = "SELECT DISTINCT * FROM {$wpdb->posts[$wp_id]} "; $request .= " LEFT JOIN {$wpdb->post2cat[$wp_id]} ON ({$wpdb->posts[$wp_id]}.ID = {$wpdb->post2cat[$wp_id]}.post_id) "; $request .= "WHERE post_status = 'publish' "; $request .= " AND post_date <= '" . $now . "'"; $request .= " GROUP BY {$wpdb->posts[$wp_id]}.ID ORDER BY post_date DESC LIMIT 0, {$no_posts}"; $lposts = $wpdb->get_results($request); $blog = 1; $block = array(); $block['use_theme_template'] = get_xoops_option('wordpress' . $wp_num, 'use_theme_template'); // if (file_exists(XOOPS_ROOT_PATH.'/modules/wordpress'. (($wp_id=='-')?'':$wp_id) .'/themes/'.$xoopsConfig['theme_set'].'/wp-blocks.css.php')) { // $themes = $xoopsConfig['theme_set']; // } else { // $themes = "default"; // } // include_once(XOOPS_ROOT_PATH."/modules/wordpress". (($wp_id=='-')?'':$wp_id) ."/themes/".$themes."/wp-blocks.css.php"); // if (file_exists(XOOPS_ROOT_PATH . '/modules/wordpress' . ($wp_id == '-' ? '' : $wp_id) . '/themes/' . $xoopsConfig['theme_set'] . '/content_block-template.php')) { $themes = $xoopsConfig['theme_set']; } else { $themes = "default"; } $template_fname = XOOPS_ROOT_PATH . "/modules/wordpress" . ($wp_id == '-' ? '' : $wp_id) . "/themes/" . $themes . "/content_block-template.php"; $block['style'] = block_style_get($wp_num, false); $block['divid'] = 'wpBlockContent' . $wp_num; $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(); $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 />Pages: ', '<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; return $block; }
function b_wp_recent_posts_show($options, $wp_num = "") { $no_posts = empty($options[0]) ? 10 : $options[0]; $cat_date = empty($options[1]) ? 0 : $options[1]; $show_rss_icon = empty($options[2]) ? 0 : $options[2]; $show_rdf_icon = empty($options[3]) ? 0 : $options[3]; $show_rss2_icon = empty($options[4]) ? 0 : $options[4]; $show_atom_icon = empty($options[5]) ? 0 : $options[5]; $rss_num = empty($options[6]) ? "" : $options[6]; $category = empty($options[7]) ? "all" : $options[7]; $new_flg = empty($options[8]) ? 0 : $options[8]; // echo "$wp_num:$cat_date"; global $xoopsDB; global $wpdb, $siteurl, $wp_id, $wp_inblock, $use_cache, $wp_mod, $wp_base; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } if (empty($category) || $category == 'all' || $category == '0') { $whichcat = ''; $join = ''; $cat_param = ''; } else { $join = " LEFT JOIN {$wpdb->post2cat[$wp_id]} ON ({$wpdb->posts[$wp_id]}.ID = {$wpdb->post2cat[$wp_id]}.post_id) "; $whichcat = ' AND (category_id = ' . $category . ')'; $cat_param = 'cat=' . $category; } $now = date('Y-m-d H:i:s', time() + get_settings('time_difference') * 3600); $request = "SELECT * FROM " . $xoopsDB->prefix("wp{$wp_num}_posts") . $join . " WHERE post_status = 'publish' "; $request .= " AND post_date <= '" . $now . "'" . $whichcat; $request .= " ORDER BY post_date DESC LIMIT 0, {$no_posts}"; $lposts = $wpdb->get_results($request); $date = ""; $pdate = ""; ob_start(); block_style_get($wp_num); $output = ob_get_contents(); ob_end_clean(); $output .= "<div id='wpRecentPost'>"; if ($lposts) { if (!$cat_date) { $output .= "<ul class='wpBlockList'>\n"; } else { $output .= "<ul class='wpBlockDateList'>\n"; } foreach ($lposts as $lpost) { if ($cat_date) { $date = mysql2date("Y-n-j", $lpost->post_date); if ($date != $pdate) { if ($pdate != "") { $output .= "</ul>\n"; } $output .= "<li><span id=\"postDate\">" . $date . "</span></li>\n<ul class=\"children\">\n"; $pdate = $date; } } $newstr = ""; if ($new_flg) { $m = $lpost->post_date; $elapse = time() + get_settings('time_difference') * 3600 - mktime(substr($m, 11, 2), substr($m, 14, 2), substr($m, 17, 2), substr($m, 5, 2), substr($m, 8, 2), substr($m, 0, 4)); if ($elapse < 1 * 60 * 60 * 24) { $newstr = ' <span class="new1">New!</span>'; } else { if ($elapse < 7 * 60 * 60 * 24) { $newstr = ' <span class="new2">New</span>'; } else { $newstr = ''; } } } $post_title = stripslashes($lpost->post_title); if (trim($post_title) == "") { $post_title = _WP_POST_NOTITLE; } $permalink = get_permalink($lpost->ID); $output .= '<li><span class="post-title"><a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . $post_title . '">' . $post_title . '</a></span>' . $newstr . '<br />'; $output .= "</li>\n"; } $output .= "</ul>\n"; if ($cat_date) { $output .= "</ul>\n"; } } if ($show_rss_icon || $show_rdf_icon || $show_rss2_icon || $show_atom_icon) { $output .= '<hr width="100%" />'; } $feed_param = $rss_num ? "?num=" . $rss_num : ""; /* if ($feed_param != "") { $feed_param .= $cat_param ? "&".$cat_param : ""; } else { $feed_param = $cat_param ? "?".$cat_param : ""; } */ if (empty($category) || $category == 'all' || $category == '0') { if ($show_rss_icon) { $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('rss_url') . $feed_param . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/rss.gif" /></a></div>'; } if ($show_rdf_icon) { $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('rdf_url') . $feed_param . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/rdf.gif" /></a></div>'; } if ($show_rss2_icon) { $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('rss2_url') . $feed_param . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/rss2.gif" /></a></div>'; } if ($show_atom_icon) { $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('atom_url') . $feed_param . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/atom.gif" /></a></div>'; } } else { if ($show_rss_icon) { $output .= '<div style="text-align:right"> <a href="' . get_category_rss_link(false, $category, "", 'rss') . $feed_param . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/rss.gif" /></a></div>'; } if ($show_rdf_icon) { $output .= '<div style="text-align:right"> <a href="' . get_category_rss_link(false, $category, "", 'rdf') . $feed_param . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/rss.gif" /></a></div>'; } if ($show_rss2_icon) { $output .= '<div style="text-align:right"> <a href="' . get_category_rss_link(false, $category, "", 'rss2') . $feed_param . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/rss.gif" /></a></div>'; } if ($show_atom_icon) { $output .= '<div style="text-align:right"> <a href="' . get_category_rss_link(false, $category, "", 'atom') . $feed_param . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/rss.gif" /></a></div>'; } } $output .= "</div>"; $block['content'] = $output; return $block; }
function _b_wp_recent_comments_show($options, $wp_num = "") { $block_style = $options[0] ? $options[0] : 0; $num_of_list = !isset($options[1]) ? 10 : $options[1]; $show_rss_icon = !isset($options[2]) ? 0 : $options[2]; $cat_date = !isset($options[3]) ? $block_style ? 1 : 0 : $options[3]; $show_type = !isset($options[4]) ? 1 : $options[4]; if ($block_style == 0) { $no_comments = $num_of_list; $comment_lenth = 30; $skip_posts = 0; $request = "SELECT ID, comment_ID, comment_content, comment_author,comment_date FROM " . wp_table('posts') . ", " . wp_table('comments') . " WHERE " . wp_table('posts') . ".ID=" . wp_table('comments') . ".comment_post_ID AND post_status = 'publish' AND comment_approved = '1' "; if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 1) { $request .= "AND (comment_content like '<trackback />%' OR comment_content like '<pingkback />%') "; } $request .= "ORDER BY " . wp_table('comments') . ".comment_date DESC LIMIT {$no_comments}"; $lcomments = $GLOBALS['wpdb']->get_results($request); $output = ''; $pdate = ""; if ($lcomments) { if (!$cat_date) { $output .= '<ul class="wpBlockList">'; } else { $output .= '<ul class="wpBlockDateList">'; } foreach ($lcomments as $lcomment) { if ($cat_date) { $date = mysql2date("Y-n-j", $lcomment->comment_date); if ($date != $pdate) { if ($pdate != "") { $output .= '</ul></li>'; } $output .= '<li><span class="postDate">' . $date . '</span><ul class="children">'; $pdate = $date; } } if (preg_match('|<trackback />|', $lcomment->comment_content)) { $type = '[TrackBack]'; } elseif (preg_match('|<pingback />|', $lcomment->comment_content)) { $type = '[PingBack]'; } else { $type = '[Comment]'; } $comment_author = stripslashes($lcomment->comment_author); $comment_content = strip_tags($lcomment->comment_content); $comment_content = stripslashes($comment_content); if (function_exists('mb_substr')) { $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth); } else { $comment_excerpt = substr($comment_content, 0, $comment_lenth); } $permalink = get_permalink($lcomment->ID) . '#comment-' . $lcomment->comment_ID; $output .= '<li><span class="comment-author">' . $comment_author . ':</span> <a href="' . $permalink; $output .= '" title="View the entire comment by ' . $comment_author . '" style="display: inline;">' . $comment_excerpt . '...</a>'; if ($show_type) { $output .= '<span style="font-size:70%">- ' . $type . '</span>'; } $output .= '</li>'; } } $output .= '</ul>'; if ($cat_date) { $output .= '</li></ul>'; } } else { $output = tkzy_get_recent_comments($num_of_list, $cat_date, $show_type); } if ($show_rss_icon) { $output .= '<hr width="100%" />'; $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('comments_rss2_url') . '"><img src="' . wp_siteurl() . '/wp-images/rss_comment.gif" /></a></div>'; } ob_start(); block_style_get(); echo $output; $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function _b_wp_recent_comments_show($options, $wp_num = "") { $block_style = $options[0] ? $options[0] : 0; $num_of_list = !isset($options[1]) ? 10 : $options[1]; $show_rss_icon = !isset($options[2]) ? 0 : $options[2]; $cat_date = !isset($options[3]) ? $block_style ? 1 : 0 : $options[3]; $show_type = !isset($options[4]) ? 1 : $options[4]; $tpl_file = empty($options[5]) ? 'wp_recent_comments.html' : $options[5]; $block['style'] = block_style_get(false); $block['divid'] = 'wpRecentComment' . $wp_num; $block['block_style'] = $block_style; $block['cat_date'] = $cat_date; $block['show_type'] = $show_type; $comment_lenth = 30; if ($block_style == 0) { $skip_posts = 0; $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, comment_date, comment_type\n\t\t\t\t\t\tFROM " . wp_table('posts') . ", " . wp_table('comments') . "\n\t\t\t\t\t\tWHERE " . wp_table('posts') . ".ID=" . wp_table('comments') . ".comment_post_ID\n\t\t\t\t\t\tAND post_status = 'publish' AND comment_approved = '1' "; if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 1) { $request .= "AND (comment_content like '<trackback />%' \n\t\t\t\t OR comment_content like '<pingkback />%'\n\t\t\t\t OR comment_type = 'trackback'\n\t\t\t\t OR comment_type = 'pingback'\n\t\t\t\t ) "; } $request .= "ORDER BY " . wp_table('comments') . ".comment_date DESC LIMIT {$num_of_list}"; $lcomments = $GLOBALS['wpdb']->get_results($request); $output = ''; $pdate = ""; $block['records'] = array(); if ($lcomments) { foreach ($lcomments as $lcomment) { if ($cat_date) { $date = mysql2date("Y-n-j", $lcomment->comment_date); if ($date != $pdate) { $_record['date'] = $date; $_record['pdate'] = $pdate; $pdate = $date; } else { $_record['date'] = ''; } } if (empty($lcomment->comment_type)) { if (preg_match('|<trackback />|', $lcomment->comment_content)) { $type = '[TrackBack]'; } elseif (preg_match('|<pingback />|', $lcomment->comment_content)) { $type = '[PingBack]'; } else { $type = '[Comment]'; } } else { if ($lcomment->comment_type == 'trackback') { $type = '[TrackBack]'; } elseif ($lcomment->comment_type == 'pingback') { $type = '[PingBack]'; } else { $type = '[Comment]'; } } $_record['comment_author'] = apply_filters('comment_author', $lcomment->comment_author); $_record['comment_author_link'] = _get_comment_author_link($lcomment, 25); $_record['comment_content'] = strip_tags($lcomment->comment_content); if (function_exists('mb_substr')) { $_record['comment_excerpt'] = mb_substr($_record['comment_content'], 0, $comment_lenth); } else { $_record['comment_excerpt'] = substr($_record['comment_content'], 0, $comment_lenth); } $_record['comment_excerpt'] = preg_replace('/([a-zA-Z0-9\\.\\/\\:\\%\\?\\-\\+\\&\\;]{15})/ms', '\\1​', $_record['comment_excerpt']); $_record['permalink'] = get_permalink($lcomment->ID) . '#comment-' . $lcomment->comment_ID; if ($show_type) { $_record['type'] = $type; } $block['records'][] = $_record; } } } else { $request = 'SELECT ID, post_title, post_date, comment_ID, comment_author, comment_author_url, comment_date, comment_content, comment_type FROM ' . wp_table('posts') . ', ' . wp_table('comments') . ' WHERE ' . wp_table('posts') . '.ID=' . wp_table('comments') . '.comment_post_ID AND ' . wp_table('comments') . '.comment_approved=\'1\''; if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 1) { $request .= "AND (comment_content like '<trackback />%' \n\t\t\t\t OR comment_content like '<pingkback />%'\n\t\t\t\t OR comment_type = 'trackback'\n\t\t\t\t OR comment_type = 'pingback'\n\t\t\t\t ) "; } $request .= ' ORDER BY ' . wp_table('comments') . '.comment_date DESC LIMIT ' . $num_of_list; $lcomments = $GLOBALS['wpdb']->get_results($request); $output = ''; if ($lcomments) { usort($lcomments, 'sort_comment_by_date'); } $new_post_ID = -1; $block['records'] = array(); if ($lcomments) { foreach ($lcomments as $lcomment) { $_record['new_post_ID'] = $new_post_ID; $_record['ID'] = $lcomment->ID; if ($lcomment->ID != $new_post_ID) { // next post $_record['post_title'] = $lcomment->post_title; if (trim($_record['post_title']) == "") { $_record['post_title'] = _WP_POST_NOTITLE; } $_record['comment_content'] = strip_tags($lcomment->comment_content); if (function_exists('mb_substr')) { $_record['comment_excerpt'] = mb_substr($_record['comment_content'], 0, $comment_lenth); } else { $_record['comment_excerpt'] = substr($_record['comment_content'], 0, $comment_lenth); } $_record['comment_excerpt'] = preg_replace('/([a-zA-Z0-9\\.\\/\\:\\?\\-\\+%&;]{15})/ms', '\\1​', $_record['comment_excerpt']); $_record['permalink'] = wp_siteurl() . '/index.php?p=' . $lcomment->ID . '&c=1'; $new_post_ID = $lcomment->ID; } if ($cat_date) { $comment_date = $lcomment->comment_date; if (time() - mysql2date('U', $comment_date) < 60 * 60 * 24) { # within 24 hours $_record['comment_date'] = mysql2date('H:i', $comment_date); } else { $_record['comment_date'] = mysql2date('m/d', $comment_date); } } $_record['comment_author'] = apply_filters('comment_author', $lcomment->comment_author); $_record['comment_author_link'] = _get_comment_author_link($lcomment, 25); if (empty($lcomment->comment_type)) { if (preg_match('|<trackback />|', $lcomment->comment_content)) { $type = '[TrackBack]'; } elseif (preg_match('|<pingback />|', $lcomment->comment_content)) { $type = '[PingBack]'; } else { $type = '[Comment]'; } } else { if ($lcomment->comment_type == 'trackback') { $type = '[TrackBack]'; } elseif ($lcomment->comment_type == 'pingback') { $type = '[PingBack]'; } else { $type = '[Comment]'; } } if ($show_type) { $_record['type'] = $type; } $block['records'][] = $_record; } } } if ($show_rss_icon) { $block['feed_icon'] = array('url' => get_bloginfo('comments_rss2_url'), 'icon' => wp_siteurl() . '/wp-images/rss_comment.gif', 'alt' => 'Comment RSS'); } else { $block['feed_icon'] = array(); } $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); if (!$_wpTpl->tpl_exists($tpl_file)) { $tpl_file = 'wp_recent_comments.html'; } $block['content'] = $_wpTpl->fetch($tpl_file); return $block; }
<?php $GLOBALS['blog'] = 1; require dirname(__FILE__) . '/wp-config.php'; error_reporting(E_ERROR); header("Content-type: text/css; charset=EUC-JP"); if (wp_id() == "-") { echo block_style_get('', false, false); } else { echo block_style_get(wp_id(), false, false); }
function _b_wp_recent_posts_show($options, $wp_num = "") { $no_posts = empty($options[0]) ? 10 : $options[0]; $cat_date = empty($options[1]) ? 0 : $options[1]; $show_rss_icon = empty($options[2]) ? 0 : $options[2]; $show_rdf_icon = empty($options[3]) ? 0 : $options[3]; $show_rss2_icon = empty($options[4]) ? 0 : $options[4]; $show_atom_icon = empty($options[5]) ? 0 : $options[5]; $rss_num = empty($options[6]) ? "" : $options[6]; $category = intval(empty($options[7]) ? "all" : $options[7]); $new_flg = empty($options[8]) ? 0 : $options[8]; $tpl_file = empty($options[9]) ? 'wp_recent_posts.html' : $options[9]; $new1_span = 1 * 60 * 60 * 24; $new2_span = 7 * 60 * 60 * 24; if (empty($category) || $category == 'all' || $category == '0') { $whichcat = ''; $join = ''; $cat_param = ''; } else { $join = ' LEFT JOIN ' . wp_table('post2cat') . ' ON (' . wp_table('posts') . '.ID = ' . wp_table('post2cat') . '.post_id) '; $whichcat = ' AND (category_id = ' . $category . ')'; $cat_param = 'cat=' . $category; } $now = current_time('mysql'); $request = 'SELECT * FROM ' . wp_table('posts') . $join . ' WHERE post_status = \'publish\''; $request .= ' AND post_date <= \'' . $now . '\'' . $whichcat; $request .= ' ORDER BY post_date DESC LIMIT 0, ' . $no_posts; $lposts = $GLOBALS['wpdb']->get_results($request); $date = ""; $pdate = ""; $block['style'] = block_style_get(false); $block['divid'] = 'wpRecentPost' . $wp_num . '_' . $category; $block['cat_date'] = $cat_date; $block['records'] = array(); if ($lposts) { foreach ($lposts as $lpost) { if ($cat_date) { $date = mysql2date('Y-n-j', $lpost->post_date); if ($date != $pdate) { $_record['date'] = $date; $_record['pdate'] = $pdate; $pdate = $date; } else { $_record['date'] = ''; } } $_record['new'] = 0; $_record['newstr'] = ''; if ($new_flg) { $m = $lpost->post_date; $elapse = current_time('timestamp') - mktime(substr($m, 11, 2), substr($m, 14, 2), substr($m, 17, 2), substr($m, 5, 2), substr($m, 8, 2), substr($m, 0, 4)); if ($elapse < $new1_span) { $_record['new'] = 1; $_record['newstr'] = ' <span class="new1">New!</span>'; } else { if ($elapse < $new2_span) { $_record['new'] = 2; $_record['newstr'] = ' <span class="new2">New</span>'; } else { $_record['new'] = 0; $_record['newstr'] = ''; } } } $_record['post_title'] = htmlspecialchars($lpost->post_title); $_record['post_author'] = htmlspecialchars(get_author_name($lpost->post_author)); if (trim($_record['post_title']) == '') { $_record['post_title'] = _WP_POST_NOTITLE; } $_record['permalink'] = get_permalink($lpost->ID); $block['records'][] = $_record; } } $feed_param = $rss_num ? "?num=" . $rss_num : ""; $block['feed_icons'] = array(); if (empty($category) || $category == 'all' || $category == '0') { if ($show_rss_icon) { $block['feed_icons'][] = array('url' => get_bloginfo('rss_url') . $feed_param, 'icon' => wp_siteurl() . '/wp-images/rss.gif', 'alt' => 'rss'); } if ($show_rdf_icon) { $block['feed_icons'][] = array('url' => get_bloginfo('rdf_url') . $feed_param, 'icon' => wp_siteurl() . '/wp-images/rdf.gif', 'alt' => 'rdf'); } if ($show_rss2_icon) { $block['feed_icons'][] = array('url' => get_bloginfo('rss2_url') . $feed_param, 'icon' => wp_siteurl() . '/wp-images/rss2.gif', 'alt' => 'rss2'); } if ($show_atom_icon) { $block['feed_icons'][] = array('url' => get_bloginfo('atom_url') . $feed_param, 'icon' => wp_siteurl() . '/wp-images/atom.gif', 'alt' => 'atom'); } } else { if ($show_rss_icon) { $block['feed_icons'][] = array('url' => get_category_rss_link(false, $category, "", 'rss') . $feed_param, 'icon' => wp_siteurl() . '/wp-images/rss.gif', 'alt' => 'rss'); } if ($show_rdf_icon) { $block['feed_icons'][] = array('url' => get_category_rss_link(false, $category, "", 'rdf') . $feed_param, 'icon' => wp_siteurl() . '/wp-images/rdf.gif', 'alt' => 'rdf'); } if ($show_rss2_icon) { $block['feed_icons'][] = array('url' => get_category_rss_link(false, $category, "", 'rss2') . $feed_param, 'icon' => wp_siteurl() . '/wp-images/rss2.gif', 'alt' => 'rss2'); } if ($show_atom_icon) { $block['feed_icons'][] = array('url' => get_category_rss_link(false, $category, "", 'atom') . $feed_param, 'icon' => wp_siteurl() . '/wp-images/atom.gif', 'alt' => 'atom'); } } $_wpTpl =& new WordPresTpl('theme'); $_wpTpl->assign('block', $block); if (!$_wpTpl->tpl_exists($tpl_file)) { $tpl_file = 'wp_recent_posts.html'; } $block['content'] = $_wpTpl->fetch($tpl_file); return $block; }
function _b_wp_categories_show($options, $wp_num = "") { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] ? $options[1] : 0; $sorting_key = $options[2] ? $options[2] : 'name'; $sorting_order = $options[3] ? $options[3] : 'asc'; if (current_wp()) { if (!empty($_SERVER['PATH_INFO'])) { permlink_to_param(); } init_param('GET', 'cat', 'string', ''); init_param('GET', 'category_name', 'string', ''); if (!empty($GLOBALS['category_name']) && empty($GLOBALS['cat'])) { if (stristr($GLOBALS['category_name'], '/')) { $GLOBALS['category_name'] = explode('/', $GLOBALS['category_name']); if ($GLOBALS['category_name'][count($GLOBALS['category_name']) - 1]) { $GLOBALS['category_name'] = $GLOBALS['category_name'][count($GLOBALS['category_name']) - 1]; // no trailing slash } else { $GLOBALS['category_name'] = $GLOBALS['category_name'][count($GLOBALS['category_name']) - 2]; // there was a trailling slash } } $categoryHandler =& wp_handler('Category'); $categoryObject =& $categoryHandler->getByNiceName($GLOBALS['category_name']); $GLOBALS['cat'] = $categoryObject->getVar('cat_ID'); } } if ($block_style == 0) { // Simple Listing ob_start(); block_style_get($wp_num); echo '<ul class="wpBlockList">' . "\n"; wp_list_cats("hide_empty=0&sort_column={$sorting_key}&sorting_order={$sorting_order}&optioncount={$with_count}"); echo '</ul>' . "\n"; $block['content'] = ob_get_contents(); ob_end_clean(); } else { // Dropdown Listing $file = wp_siteurl() . '/index.php'; $link = $file . '?cat='; ob_start(); block_style_get($wp_num); echo '<form name="listcatform' . $wp_num . '" id="listcatform' . $wp_num . '" action="#">'; $select_str = '<select name="cat" onchange="window.location = (document.forms.listcatform' . $wp_num . '.cat[document.forms.listcatform' . $wp_num . '.cat.selectedIndex].value);"> '; dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count, 0, false, 0, 0, true, 0, true, 0); echo '</form>'; $block_str = ob_get_contents(); ob_end_clean(); $block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str); } return $block; }
function b_wp_contents_show($options, $wp_num = "") { $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, $wp_filter; global $wp_id, $wp_mod, $wp_base, $wp_inblock, $xoopsConfig, $previousday, $time_difference, $day; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 2; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } 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[$wp_id]} "; $request .= " LEFT JOIN {$wpdb->post2cat[$wp_id]} ON ({$wpdb->posts[$wp_id]}.ID = {$wpdb->post2cat[$wp_id]}.post_id) "; $request .= "WHERE post_status = 'publish' "; $request .= " AND post_date <= '" . $now . "'"; $request .= " GROUP BY {$wpdb->posts[$wp_id]}.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; $category_cache[$wp_id][$post->ID] = array(); } $post_id_list = implode(',', $post_id_list); $dogs = $wpdb->get_results("SELECT DISTINCT\n\t\t\t\tID, category_id, cat_name, category_nicename, category_description, category_parent\n\t\t\t\tFROM {$wpdb->categories[$wp_id]}, {$wpdb->post2cat[$wp_id]}, {$wpdb->posts[$wp_id]}\n\t\t\t\tWHERE category_id = cat_ID AND post_id = ID AND post_id IN ({$post_id_list})"); foreach ($dogs as $catt) { $category_cache[$wp_id][$catt->ID][] = $catt; } // Do the same for comment numbers $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount\n\t\t\t\tFROM {$wpdb->posts[$wp_id]}\n\t\t\t\tLEFT JOIN {$wpdb->comments[$wp_id]} ON ( comment_post_ID = ID AND comment_approved = '1')\n\t\t\t\tWHERE post_status = 'publish' AND ID IN ({$post_id_list})\n\t\t\t\tGROUP BY ID"); foreach ($comment_counts as $comment_count) { $comment_count_cache[$wp_id]["{$comment_count->ID}"] = $comment_count->ccount; } } $blog = 1; $block = array(); $block['use_theme_template'] = get_xoops_option('wordpress' . $wp_num, 'use_theme_template'); $block['style'] = block_style_get($wp_num, false); $block['divid'] = 'wpBlockContent' . $wp_num; $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 />Pages: ', '<br />', 'number'); $content['linkpage'] = ob_get_contents(); ob_end_clean(); // ob_start(); if (get_xoops_option($wp_mod[$wp_id], 'wp_use_xoops_comments') == 0) { comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS); } else { xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS); echo " | "; comments_popup_link(_WP_TPL_TRACKBACK0, _WP_TPL_TRACKBACK1, _WP_TPL_TRACKBACKS); } // 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 get_custom_path('content_block-template.php'); $block['template_content'] .= ob_get_contents(); ob_end_clean(); } } $previousday = 0; $day = 0; $comment_count_cache[$wp_id] = array(); return $block; }
function _b_wp_recent_posts_show($options, $wp_num = "") { $no_posts = empty($options[0]) ? 10 : $options[0]; $cat_date = empty($options[1]) ? 0 : $options[1]; $show_rss_icon = empty($options[2]) ? 0 : $options[2]; $show_rdf_icon = empty($options[3]) ? 0 : $options[3]; $show_rss2_icon = empty($options[4]) ? 0 : $options[4]; $show_atom_icon = empty($options[5]) ? 0 : $options[5]; $rss_num = empty($options[6]) ? "" : $options[6]; $category = intval(empty($options[7]) ? "all" : $options[7]); $new_flg = empty($options[8]) ? 0 : $options[8]; global $wpdb; if (empty($category) || $category == 'all' || $category == '0') { $whichcat = ''; $join = ''; $cat_param = ''; } else { $join = ' LEFT JOIN ' . wp_table('post2cat') . ' ON (' . wp_table('posts') . '.ID = ' . wp_table('post2cat') . '.post_id) '; $whichcat = ' AND (category_id = ' . $category . ')'; $cat_param = 'cat=' . $category; } $now = date('Y-m-d H:i:s', time() + get_settings('time_difference') * 3600); $request = 'SELECT * FROM ' . wp_table('posts') . $join . ' WHERE post_status = \'publish\''; $request .= ' AND post_date <= \'' . $now . '\'' . $whichcat; $request .= ' ORDER BY post_date DESC LIMIT 0, ' . $no_posts; $lposts = $wpdb->get_results($request); $date = ""; $pdate = ""; ob_start(); block_style_get(); $output = ob_get_contents(); ob_end_clean(); $output .= '<div class="wpRecentPost">'; if ($lposts) { if (!$cat_date) { $output .= '<ul class="wpBlockList">' . "\n"; } else { $output .= '<ul class="wpBlockDateList">' . "\n"; } foreach ($lposts as $lpost) { if ($cat_date) { $date = mysql2date('Y-n-j', $lpost->post_date); if ($date != $pdate) { if ($pdate != "") { $output .= '</ul></li>' . "\n"; } $output .= '<li><span class="postDate">' . $date . '</span>' . "\n" . '<ul class="children">' . "\n"; $pdate = $date; } } $newstr = ""; if ($new_flg) { $m = $lpost->post_date; $elapse = time() + get_settings('time_difference') * 3600 - mktime(substr($m, 11, 2), substr($m, 14, 2), substr($m, 17, 2), substr($m, 5, 2), substr($m, 8, 2), substr($m, 0, 4)); if ($elapse < 1 * 60 * 60 * 24) { $newstr = ' <span class="new1">New!</span>'; } else { if ($elapse < 7 * 60 * 60 * 24) { $newstr = ' <span class="new2">New</span>'; } else { $newstr = ''; } } } $post_title = stripslashes($lpost->post_title); if (trim($post_title) == "") { $post_title = _WP_POST_NOTITLE; } $permalink = get_permalink($lpost->ID); $output .= '<li><span class="post-title"><a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . $post_title . '">' . $post_title . '</a></span>' . $newstr . '<br />'; $output .= '</li>' . "\n"; } $output .= '</ul>' . "\n"; if ($cat_date) { $output .= '</li></ul>' . "\n"; } } if ($show_rss_icon || $show_rdf_icon || $show_rss2_icon || $show_atom_icon) { $output .= '<hr width="100%" />'; } $feed_param = $rss_num ? "?num=" . $rss_num : ""; if (empty($category) || $category == 'all' || $category == '0') { if ($show_rss_icon) { $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('rss_url') . $feed_param . '"><img src="' . wp_siteurl() . '/wp-images/rss.gif" alt="rss" /></a></div>'; } if ($show_rdf_icon) { $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('rdf_url') . $feed_param . '"><img src="' . wp_siteurl() . '/wp-images/rdf.gif" alt="rdf" /></a></div>'; } if ($show_rss2_icon) { $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('rss2_url') . $feed_param . '"><img src="' . wp_siteurl() . '/wp-images/rss2.gif" alt="rss2" /></a></div>'; } if ($show_atom_icon) { $output .= '<div style="text-align:right"> <a href="' . get_bloginfo('atom_url') . $feed_param . '"><img src="' . wp_siteurl() . '/wp-images/atom.gif" alt="atom" /></a></div>'; } } else { if ($show_rss_icon) { $output .= '<div style="text-align:right"> <a href="' . get_category_rss_link(false, $category, "", 'rss') . $feed_param . '"><img src="' . wp_siteurl() . '/wp-images/rss.gif" alt="rss" /></a></div>'; } if ($show_rdf_icon) { $output .= '<div style="text-align:right"> <a href="' . get_category_rss_link(false, $category, "", 'rdf') . $feed_param . '"><img src="' . wp_siteurl() . '/wp-images/rdf.gif" alt="rdf" /></a></div>'; } if ($show_rss2_icon) { $output .= '<div style="text-align:right"> <a href="' . get_category_rss_link(false, $category, "", 'rss2') . $feed_param . '"><img src="' . wp_siteurl() . '/wp-images/rss2.gif" alt="rss2" /></a></div>'; } if ($show_atom_icon) { $output .= '<div style="text-align:right"> <a href="' . get_category_rss_link(false, $category, "", 'atom') . $feed_param . '"><img src="' . wp_siteurl() . '/wp-images/atom.gif" alt="atom" /></a></div>'; } } $output .= "</div>"; $block['content'] = $output; return $block; }