Index: trunk/blocks/recent_comments_block.php
===================================================================
--- trunk/blocks/recent_comments_block.php	(revision 44)
+++ trunk/blocks/recent_comments_block.php	(revision 44)
@@ -0,0 +1,100 @@
+<?php
+if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
+$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
+
+eval( '
+function b_'.$mydirname.'_comments_show($options){
+	return _b_comments_show($options) ;
+}
+function b_'.$mydirname.'_comments_edit($options){
+	return _b_comments_edit($options) ;
+}
+' ) ;
+
+
+if( ! defined( 'XPRESS_COMMENTS_BLOCK_INCLUDED' ) ) {
+	define( 'XPRESS_COMMENTS_BLOCK_INCLUDED' , 1 ) ;
+	function _b_comments_edit($options)
+	{
+		$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
+		$disp_count = empty( $options[1] ) ? '10' : $options[1] ;
+		$disp_length = empty( $options[2] ) ? '30' : $options[2] ;
+	    $selected = array_slice($options,3); // get allowed cats
+		$this_template = empty( $options[4] ) ? 'db:'.$mydirname.'_block_comments.html' : trim( $options[4] );
+		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+
+		require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
+		
+		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
+		$form .= _MB_XPRESS_COUNT .": <input type='text' name='options[1]' value='" . $disp_count . "' /><br />";
+		$form .= _MB_XPRESS_LENGTH .": <input type='text' name='options[2]' value='" . $disp_length . "' />";
+	    $form .= "<br /><br />" . _MB_XPRESS_COM_TYPE ;
+	    $isAll = (count($selected)==0||empty($selected[0]))?true:false;
+	    $form .= "<br />&nbsp;&nbsp;<select name=\"options[]\" multiple=\"multiple\">";
+		    $form .= "<option value=\"0\" ";
+		    if ($isAll) $form .= " selected=\"selected\"";
+		    $form .= ">"._MB_XPRESS_ALL ."</option>";
+
+		    $form .= "<option value=\"1\" ";
+		    if (in_array(1, $selected))
+				$form .= " selected=\"selected\"";
+		    $form .= ">"._MB_XPRESS_COMMENT ."</option>";
+
+		    $form .= "<option value=\"2\" ";
+		    if (in_array(2, $selected))
+				$form .= " selected=\"selected\"";
+		    $form .= ">"._MB_XPRESS_TRUCKBACK ."</option>";
+
+		    $form .= "<option value=\"3\" ";
+		    if (in_array(3, $selected))
+				$form .= " selected=\"selected\"";
+		    $form .= ">"._MB_XPRESS_PINGBACK ."</option>";
+		$form .= "</select><br />";
+		//	    $form .="<br /><input type='text' size='60' name='options[5]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
+
+
+		return $form;
+	}
+	
+	function _b_comments_show($options)
+	{
+		global $wpdb;
+		$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
+		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+		$block_function_name = basename( __FILE__ );
+		
+		require_once $mydirpath.'/include/xpress_block_render.php';
+		return xpress_block_render($mydirname,$block_function_name,$options);
+/*
+
+		$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
+		$disp_count = empty( $options[1] ) ? '10' : $options[1] ;
+		$disp_length = empty( $options[2] ) ? '30' : $options[2] ;
+		$selected = array_slice($options,3); // get allowed cats
+		
+		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+		global $wpdb;
+		
+		if (!is_null($wpdb)){
+			require_once $mydirpath.'/include/xpress_block_theme.php';
+			xpress_block_css_set($mydirname);
+			
+			$block_theme_file = get_block_file_path($mydirname,'recent_comments_block');
+			require_once $block_theme_file;
+			$block = recent_comments_block($options);
+			
+			require_once $mydirpath.'/include/xoops_block_cache.php';
+			$my_name = basename( __FILE__ );
+			$blockID =get_block_id($mydirname,$my_name,$options);			
+			xpress_block_cache_write($mydirname,'recent_comments_block'. $blockID, $block);
+		} else {
+			require_once $mydirpath.'/include/xoops_block_cache.php';
+			$my_name = basename( __FILE__ );
+			$blockID =get_block_id($mydirname,$my_name,$options);			
+			$block = xpress_block_cache_read($mydirname,'recent_comments_block'. $blockID);
+		}
+		return 	$block;
+*/
+	}
+}
+?>
Index: trunk/blocks/xpress_block_recent_comments.php
===================================================================
--- trunk/blocks/xpress_block_recent_comments.php	(revision 43)
+++ 	(revision )
@@ -1,97 +1,0 @@
-<?php
-if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
-$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-
-eval( '
-function b_'.$mydirname.'_comments_show($options){
-	return _b_comments_show($options) ;
-}
-function b_'.$mydirname.'_comments_edit($options){
-	return _b_comments_edit($options) ;
-}
-' ) ;
-
-
-if( ! defined( 'XPRESS_COMMENTS_BLOCK_INCLUDED' ) ) {
-	define( 'XPRESS_COMMENTS_BLOCK_INCLUDED' , 1 ) ;
-	function _b_comments_edit($options)
-	{
-		$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
-		$disp_count = empty( $options[1] ) ? '10' : $options[1] ;
-		$disp_length = empty( $options[2] ) ? '30' : $options[2] ;
-	    $selected = array_slice($options,3); // get allowed cats
-		$this_template = empty( $options[4] ) ? 'db:'.$mydirname.'_block_comments.html' : trim( $options[4] );
-		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
-
-		require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
-		
-		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-		$form .= _MB_XPRESS_COUNT .": <input type='text' name='options[1]' value='" . $disp_count . "' /><br />";
-		$form .= _MB_XPRESS_LENGTH .": <input type='text' name='options[2]' value='" . $disp_length . "' />";
-	    $form .= "<br /><br />" . _MB_XPRESS_COM_TYPE ;
-	    $isAll = (count($selected)==0||empty($selected[0]))?true:false;
-	    $form .= "<br />&nbsp;&nbsp;<select name=\"options[]\" multiple=\"multiple\">";
-		    $form .= "<option value=\"0\" ";
-		    if ($isAll) $form .= " selected=\"selected\"";
-		    $form .= ">"._MB_XPRESS_ALL ."</option>";
-
-		    $form .= "<option value=\"1\" ";
-		    if (in_array(1, $selected))
-				$form .= " selected=\"selected\"";
-		    $form .= ">"._MB_XPRESS_COMMENT ."</option>";
-
-		    $form .= "<option value=\"2\" ";
-		    if (in_array(2, $selected))
-				$form .= " selected=\"selected\"";
-		    $form .= ">"._MB_XPRESS_TRUCKBACK ."</option>";
-
-		    $form .= "<option value=\"3\" ";
-		    if (in_array(3, $selected))
-				$form .= " selected=\"selected\"";
-		    $form .= ">"._MB_XPRESS_PINGBACK ."</option>";
-		$form .= "</select><br />";
-		//	    $form .="<br /><input type='text' size='60' name='options[5]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
-
-
-		return $form;
-	}
-	
-	function _b_comments_show($options)
-	{
-		$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
-		$disp_count = empty( $options[1] ) ? '10' : $options[1] ;
-		$disp_length = empty( $options[2] ) ? '30' : $options[2] ;
-		$selected = array_slice($options,3); // get allowed cats
-		
-		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
-		
-		$Identification = '-' . $disp_count . '-' . $disp_length ;
-		foreach ($selected as $item){
-			$Identification .= '-' . $item ;
-		}
-
-
-		global $wpdb;
-		
-		if (!is_null($wpdb)){
-			require_once $mydirpath.'/include/xpress_block_theme.php';
-			xpress_block_css_set($mydirname);
-			
-			$block_theme_file = get_block_file_path($mydirname,'recent_comments_block');
-			require_once $block_theme_file;
-			$block = recent_comments_block($options);
-			
-			require_once $mydirpath.'/include/xoops_block_cache.php';
-			$my_name = basename( __FILE__ );
-			$blockID =get_block_id($mydirname,$my_name,$options);			
-			xpress_block_cache_write($mydirname,'recent_comments_block'. $blockID, $block);
-		} else {
-			require_once $mydirpath.'/include/xoops_block_cache.php';
-			$my_name = basename( __FILE__ );
-			$blockID =get_block_id($mydirname,$my_name,$options);			
-			$block = xpress_block_cache_read($mydirname,'recent_comments_block'. $blockID);
-		}
-		return 	$block;
-	}
-}
-?>
Index: trunk/include/xoops_block_cache.php
===================================================================
--- trunk/include/xoops_block_cache.php	(revision 43)
+++ 	(revision )
@@ -1,48 +1,0 @@
-<?php
-	require_once dirname( __FILE__ ) .'/xml.php' ;
-	require_once dirname( __FILE__ ) .'/xpress_cache.php' ;
-	
-	function xpress_block_cache_write($mydirname,$block_name,$block)
-	{
-			$xml = xpress_XML_serialize($block);
-			$xml_name = $block_name . '.xml';
-			xpress_cache_write($mydirname,$xml_name,$xml);
-	}
-	function xpress_block_cache_read($mydirname,$block_name)
-	{
-			$xml_name = $block_name . '.xml';
-			$xml_data = xpress_cache_read($mydirname,$xml_name);
-			return @xpress_XML_unserialize($xml_data);
-	}
-	
-	function get_block_id($mydirname,$func_file,$options)
-	{
-		$options_string = '';
-		foreach ($options as $val){
-			if (!empty($options_string)) $options_string .='|';
-			$options_string .= $val;
-		}
-			$xoopsDB =& Database::getInstance();
-			$block_tbl = $xoopsDB->prefix('newblocks');	
-			$module_dir = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
-
-			$sql = "SELECT bid FROM $block_tbl WHERE (func_file LIKE '$func_file') AND (options LIKE '$options_string')";
-			$result =  $xoopsDB->query($sql, 0, 0);
-			if ($xoopsDB->getRowsNum($result)  > 0){
-				$row = $xoopsDB->fetchArray($result);
-				$block_id = $row['bid'];
-			}
-			return $block_id;
-	}
-	
-	function block_render($mydirname)
-	{		$block_theme_file = get_block_file_path($mydirname,$block_render_file_name);
-			require_once $block_theme_file;
-			$block = recent_comments_block($options);
-			
-			require_once $mydirpath.'/include/xoops_block_cache.php';
-			$my_name = basename( __FILE__ );
-			$blockID =get_block_id($mydirname,$my_name,$options);			
-			xpress_block_cache_write($mydirname,$block_render_file_name. $blockID, $block);
-	}
-?>
Index: trunk/include/xpress_block_render.php
===================================================================
--- trunk/include/xpress_block_render.php	(revision 44)
+++ trunk/include/xpress_block_render.php	(revision 44)
@@ -0,0 +1,116 @@
+<?php
+	require_once dirname( __FILE__ ) .'/xml.php' ;
+	require_once dirname( __FILE__ ) .'/xpress_cache.php' ;
+	
+	function xpress_block_cache_write($mydirname,$block_name,$block)
+	{
+			$xml = xpress_XML_serialize($block);
+			$xml_name = $block_name . '.xml';
+			xpress_cache_write($mydirname,$xml_name,$xml);
+	}
+	function xpress_block_cache_read($mydirname,$block_name)
+	{
+			$xml_name = $block_name . '.xml';
+			$xml_data = xpress_cache_read($mydirname,$xml_name);
+			return @xpress_XML_unserialize($xml_data);
+	}
+	
+	function get_block_id($mydirname,$func_file,$options)
+	{
+		$options_string = '';
+		foreach ($options as $val){
+			if (!empty($options_string)) $options_string .='|';
+			$options_string .= $val;
+		}
+			$xoopsDB =& Database::getInstance();
+			$block_tbl = $xoopsDB->prefix('newblocks');	
+			$module_dir = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+
+			$sql = "SELECT bid FROM $block_tbl WHERE (func_file LIKE '$func_file') AND (options LIKE '$options_string')";
+			$result =  $xoopsDB->query($sql, 0, 0);
+			if ($xoopsDB->getRowsNum($result)  > 0){
+				$row = $xoopsDB->fetchArray($result);
+				$block_id = $row['bid'];
+			}
+			return $block_id;
+	}
+
+	function get_xpress_theme_name($mydirname)
+	{
+		$xoopsDB =& Database::getInstance();
+		$wp_prefix = $mydirname;
+		if ($wp_prefix == 'wordpress') $wp_prefix = 'wp';
+
+		$module_tbl = $xoopsDB->prefix($wp_prefix).'_options';	
+		$theme_name = '';	
+
+		$sql = "SELECT option_value FROM $module_tbl WHERE option_name LIKE 'template'";
+		$result =  $xoopsDB->query($sql, 0, 0);
+		if ($xoopsDB->getRowsNum($result)  > 0){
+			$row = $xoopsDB->fetchArray($result);
+			$theme_name = $row['option_value'];
+		}
+		return $theme_name;
+	}
+
+	function get_block_stylesheet_url($mydirname)
+	{
+		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+		$select_theme = get_xpress_theme_name($mydirname);
+		$style_file = $mydirpath . '/wp-content/themes/' . $select_theme . '/blocks/style.css';
+		if (file_exists($style_file))
+			return XOOPS_URL . '/modules/' .$mydirname . '/wp-content/themes/' . $select_theme . '/blocks/style.css';
+		else	
+			return XOOPS_URL . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/style.css';
+	}
+
+	function xpress_block_css_set($mydirname = '')
+	{
+		$style_url =  get_block_stylesheet_url($mydirname);
+		  
+		$tplVars =& $GLOBALS['xoopsTpl']->get_template_vars();
+		$csslink = "\n".'<link rel="stylesheet" type="text/css" media="screen" href="'. $style_url .'" />';
+			if(array_key_exists('xoops_block_header', $tplVars)) {
+				if (!strstr($tplVars['xoops_block_header'],$csslink)) {
+					$GLOBALS['xoopsTpl']->assign('xoops_block_header',$tplVars['xoops_block_header'].$csslink);
+				}
+			} else {
+				$GLOBALS['xoopsTpl']->assign('xoops_block_header',$csslink);
+			}
+	}
+	
+	function get_block_file_path($mydirname,$file_name)
+	{
+		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+		$select_theme = get_xpress_theme_name($mydirname);
+		$block_file = $mydirpath . '/wp-content/themes/' . $select_theme . '/blocks/' . $file_name;
+
+		if (!file_exists($block_file))
+			$block_file =  XOOPS_ROOT_PATH . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/' . $file_name;
+		return $block_file;
+	}
+	
+	function xpress_block_render($mydirname,$block_function_name,$options)
+	{
+		global $wpdb;
+		$func_file = $block_function_name;
+		$call_theme_function_name = str_replace(".php", "", $block_function_name);
+		$inc_theme_file_name = $call_theme_function_name . '_theme.php';
+		$cache_title = str_replace(".php", "", $block_function_name);
+		$blockID =get_block_id($mydirname,$func_file,$options);			
+					
+		if (!is_null($wpdb)){
+			xpress_block_css_set($mydirname);
+			
+			$block_theme_file = get_block_file_path($mydirname,$inc_theme_file_name);
+			require_once $block_theme_file;
+			$block = $call_theme_function_name($options);		//The block name and the called function name should be assumed to be the same name. 
+			
+			xpress_block_cache_write($mydirname,$cache_title. $blockID, $block);
+		} else {
+			$block = xpress_block_cache_read($mydirname,$cache_title. $blockID);
+		}
+		return 	$block;
+	}
+	
+?>
Index: trunk/include/xpress_block_theme.php
===================================================================
--- trunk/include/xpress_block_theme.php	(revision 43)
+++ 	(revision )
@@ -1,57 +1,0 @@
-<?php
-function get_xpress_theme_name($mydirname)
-{
-	$xoopsDB =& Database::getInstance();
-	$wp_prefix = $mydirname;
-	if ($wp_prefix == 'wordpress') $wp_prefix = 'wp';
-
-	$module_tbl = $xoopsDB->prefix($wp_prefix).'_options';	
-	$theme_name = '';	
-
-	$sql = "SELECT option_value FROM $module_tbl WHERE option_name LIKE 'template'";
-	$result =  $xoopsDB->query($sql, 0, 0);
-	if ($xoopsDB->getRowsNum($result)  > 0){
-		$row = $xoopsDB->fetchArray($result);
-		$theme_name = $row['option_value'];
-	}
-	return $theme_name;
-}
-
-function get_block_stylesheet_url($mydirname)
-{
-	$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
-	$select_theme = get_xpress_theme_name($mydirname);
-	$style_file = $mydirpath . '/wp-content/themes/' . $select_theme . '/blocks/style.css';
-	if (file_exists($style_file))
-		return XOOPS_URL . '/modules/' .$mydirname . '/wp-content/themes/' . $select_theme . '/blocks/style.css';
-	else	
-		return XOOPS_URL . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/style.css';
-}
-
-function xpress_block_css_set($mydirname = '')
-{
-	if (empty($mydirname)) $mydirname = $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-
-	$style_url =  get_block_stylesheet_url($mydirname);
-	  
-	$tplVars =& $GLOBALS['xoopsTpl']->get_template_vars();
-	$csslink = "\n".'<link rel="stylesheet" type="text/css" media="screen" href="'. $style_url .'" />';
-		if(array_key_exists('xoops_block_header', $tplVars)) {
-			if (!strstr($tplVars['xoops_block_header'],$csslink)) {
-				$GLOBALS['xoopsTpl']->assign('xoops_block_header',$tplVars['xoops_block_header'].$csslink);
-			}
-		} else {
-			$GLOBALS['xoopsTpl']->assign('xoops_block_header',$csslink);
-		}
-}
-function get_block_file_path($mydirname,$block_name)
-{
-	$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
-	$select_theme = get_xpress_theme_name($mydirname);
-	$block_file = $mydirpath . '/wp-content/themes/' . $select_theme . '/blocks/' . $block_name.'.php';
-
-	if (!file_exists($block_file))
-		$block_file =  XOOPS_ROOT_PATH . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/' . $block_name .'.php';
-	return $block_file;
-}
-?>
Index: trunk/templates/blocks/recent_comments_block.html
===================================================================
--- trunk/templates/blocks/recent_comments_block.html	(revision 44)
+++ trunk/templates/blocks/recent_comments_block.html	(revision 44)
@@ -0,0 +1,29 @@
+<ul class="xpress_recent_comments">
+	<!-- The template tag of the following list can be used. 
+			<{$content.from_auther_to_post}>
+			<{$content.comment_ID}>
+			<{$content.comment_post_ID}>
+			<{$content.comment_date}>
+			<{$content.comment_date_time}>
+			<{$content.comment_content}>
+			<{$content.comment_excerpt}>
+			<{$content.comment_link}>
+			<{$content.comment_title}>
+			<{$content.comment_title_link}>
+			<{$content.post_link}>
+			<{$content.post_title}>
+			<{$content.post_title_link}>
+			<{$content.author_link}>
+			<{$content.author_name}>
+			<{$content.author_name_link}>
+			<{$content.comment_type}>
+	-->
+
+	<{foreach from=$block.contents item=content}>
+		<li>
+			<{$content.from_auther_to_post}><br />
+			<{$content.comment_excerpt}><br />
+			<{$content.comment_date_time}><br />
+		</li>
+	<{/foreach}>
+</ul>
Index: trunk/templates/blocks/xpress_block_recent_comments.html
===================================================================
--- trunk/templates/blocks/xpress_block_recent_comments.html	(revision 43)
+++ 	(revision )
@@ -1,29 +1,0 @@
-<ul class="xpress_recent_comments">
-	<!-- The template tag of the following list can be used. 
-			<{$content.from_auther_to_post}>
-			<{$content.comment_ID}>
-			<{$content.comment_post_ID}>
-			<{$content.comment_date}>
-			<{$content.comment_date_time}>
-			<{$content.comment_content}>
-			<{$content.comment_excerpt}>
-			<{$content.comment_link}>
-			<{$content.comment_title}>
-			<{$content.comment_title_link}>
-			<{$content.post_link}>
-			<{$content.post_title}>
-			<{$content.post_title_link}>
-			<{$content.author_link}>
-			<{$content.author_name}>
-			<{$content.author_name_link}>
-			<{$content.comment_type}>
-	-->
-
-	<{foreach from=$block.contents item=content}>
-		<li>
-			<{$content.from_auther_to_post}><br />
-			<{$content.comment_excerpt}><br />
-			<{$content.comment_date_time}><br />
-		</li>
-	<{/foreach}>
-</ul>
Index: trunk/wp-content/themes/xpress_default/blocks/recent_comments_block.php
===================================================================
--- trunk/wp-content/themes/xpress_default/blocks/recent_comments_block.php	(revision 43)
+++ 	(revision )
@@ -1,102 +1,0 @@
-<?php
-if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
-
-function recent_comments_block($options)
-{
-	$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
-	$disp_count = empty( $options[1] ) ? '10' : $options[1] ;
-	$disp_length = empty( $options[2] ) ? '30' : $options[2] ;
-	$selected = array_slice($options,3); // get allowed cats
-	$this_template = empty( $options[4] ) ? 'db:'.$mydirname.'_block_comments.html' : trim( $options[4] );
-	$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
-	
-	$myts =& MyTextSanitizer::getInstance();
-
-	$this_url = '/modules/'. $mydirname;
-	$call_url = $_SERVER['REQUEST_URI'];
-	
-	$disp_all = in_array('0',$selected);
-	$disp_comment = in_array('1',$selected);
-	$disp_trackback = in_array('2',$selected);
-	$disp_pingback = in_array('3',$selected);
-	
-	$type_select = '';
-	if (!$disp_all){			
-		if ($disp_comment){
-			$in_where =  "''";
-		}
-		if ($disp_trackback){
-			if (empty($in_where)) $in_where =  "'trackback' "; else $in_where .=  ",'trackback'";
-		}
-				
-		if ($disp_pingback){
-			if (empty($in_where)) $in_where =  "'pingback' "; else $in_where .=  ",'pingback'";
-		}
-		
-		if (! empty($in_where)){
-			$type_select = " AND comment_type IN($in_where) ";				
-		}
-	}
-	
-	global $wpdb;
-	$block = array();
-		
-	if (!is_null($wpdb)){
-		$comment_sql  = "SELECT comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_content, comment_type,UNIX_TIMESTAMP(comment_date) as comment_unix_time ";
-		$comment_sql .= "FROM $wpdb->comments LEFT JOIN $wpdb->posts ON  $wpdb->posts.ID = $wpdb->comments.comment_post_ID ";
-		$comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post'  AND post_status = 'publish' $type_select ";
-		$comment_sql .= "ORDER BY comment_date_gmt DESC LIMIT $disp_count";
-
-		$comments = $wpdb->get_results($comment_sql);
-		$format = get_settings('date_format') . ' ' . get_settings('time_format');				
-		
-		if ( $comments ) {
-			$output .= '<ul>';
-			$item_no = 0;
-			foreach ($comments as $comment){
-				$comment_content = $comment->comment_content;
-				$comment_excerpt = ($disp_length>0 ? xoops_substr($comment_content, 0, $disp_length): $comment->comment_content);
-
-				$comment_link = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID ;
-				$comment_title = $comment_excerpt;
-				$comment_title_link = "<a href='$comment_link' rel='external nofollow' class='url'>$comment_title</a>";
-
-				$post_link = get_comment_link($comment->comment_ID);
-				$post_title = get_the_title($comment->comment_post_ID);
-				$post_title_link = '<a href="'. $post_link . '">' . $post_title . '</a>';
-				
-				$author_link = $comment->comment_author_url;
-				$author_name = $comment->comment_author;
-				$author_name_link = (( empty( $author_link ) || 'http://' == $author_link ) ? $author_name : "<a href='$author_link' rel='external nofollow' class='url'>$author_name</a>");
-
-				$comment_type = (empty($comment->comment_type) ? 'comment': $comment->comment_type);
-				$from_auther_to_post = sprintf(__('%1$s on %2$s'), $author_name_link , $post_title_link );
-
-				$row_data = array(
-					'comment_ID' 		=> $comment->comment_ID ,
-					'comment_post_ID'	=> $comment->comment_post_ID ,
-					'comment_date' 		=> date(get_settings('date_format'),$comment->comment_unix_time) ,
-					'comment_date_time' => date(get_settings('date_format') . ' ' . get_settings('time_format'),$comment->comment_unix_time) ,
-					'comment_content' 	=> $comment_content ,
-					'comment_excerpt' 	=> $comment_excerpt ,	
-					'comment_link' 		=> $comment_link,
-					'comment_title' 	=> $comment_title ,
-					'comment_title_link' => $comment_title_link ,
-					'post_link' 		=> $post_link,
-					'post_title' 		=> $post_title,
-					'post_title_link' 	=> $post_title_link,
-					'author_link' 		=> $author_link,
-					'author_name' 		=> $author_name,
-					'author_name_link' 	=> $author_name_link,		
-					'comment_type' 		=> $comment_type,																																		
-					'from_auther_to_post' => $from_auther_to_post
-				);
-				
-				$block['contents']['item'.$item_no] = $row_data;
-				$item_no++;
-			}
-		}
-	}
-	return $block ;
-}
-?>
Index: trunk/wp-content/themes/xpress_default/blocks/recent_comments_block_theme.php
===================================================================
--- trunk/wp-content/themes/xpress_default/blocks/recent_comments_block_theme.php	(revision 44)
+++ trunk/wp-content/themes/xpress_default/blocks/recent_comments_block_theme.php	(revision 44)
@@ -0,0 +1,102 @@
+<?php
+if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
+
+function recent_comments_block($options)
+{
+	$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
+	$disp_count = empty( $options[1] ) ? '10' : $options[1] ;
+	$disp_length = empty( $options[2] ) ? '30' : $options[2] ;
+	$selected = array_slice($options,3); // get allowed cats
+	$this_template = empty( $options[4] ) ? 'db:'.$mydirname.'_block_comments.html' : trim( $options[4] );
+	$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+	
+	$myts =& MyTextSanitizer::getInstance();
+
+	$this_url = '/modules/'. $mydirname;
+	$call_url = $_SERVER['REQUEST_URI'];
+	
+	$disp_all = in_array('0',$selected);
+	$disp_comment = in_array('1',$selected);
+	$disp_trackback = in_array('2',$selected);
+	$disp_pingback = in_array('3',$selected);
+	
+	$type_select = '';
+	if (!$disp_all){			
+		if ($disp_comment){
+			$in_where =  "''";
+		}
+		if ($disp_trackback){
+			if (empty($in_where)) $in_where =  "'trackback' "; else $in_where .=  ",'trackback'";
+		}
+				
+		if ($disp_pingback){
+			if (empty($in_where)) $in_where =  "'pingback' "; else $in_where .=  ",'pingback'";
+		}
+		
+		if (! empty($in_where)){
+			$type_select = " AND comment_type IN($in_where) ";				
+		}
+	}
+	
+	global $wpdb;
+	$block = array();
+		
+	if (!is_null($wpdb)){
+		$comment_sql  = "SELECT comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_content, comment_type,UNIX_TIMESTAMP(comment_date) as comment_unix_time ";
+		$comment_sql .= "FROM $wpdb->comments LEFT JOIN $wpdb->posts ON  $wpdb->posts.ID = $wpdb->comments.comment_post_ID ";
+		$comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post'  AND post_status = 'publish' $type_select ";
+		$comment_sql .= "ORDER BY comment_date_gmt DESC LIMIT $disp_count";
+
+		$comments = $wpdb->get_results($comment_sql);
+		$format = get_settings('date_format') . ' ' . get_settings('time_format');				
+		
+		if ( $comments ) {
+			$output .= '<ul>';
+			$item_no = 0;
+			foreach ($comments as $comment){
+				$comment_content = $comment->comment_content;
+				$comment_excerpt = ($disp_length>0 ? xpress_substr($comment_content, 0, $disp_length): $comment->comment_content);
+
+				$comment_link = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID ;
+				$comment_title = $comment_excerpt;
+				$comment_title_link = "<a href='$comment_link' rel='external nofollow' class='url'>$comment_title</a>";
+
+				$post_link = get_comment_link($comment->comment_ID);
+				$post_title = get_the_title($comment->comment_post_ID);
+				$post_title_link = '<a href="'. $post_link . '">' . $post_title . '</a>';
+				
+				$author_link = $comment->comment_author_url;
+				$author_name = $comment->comment_author;
+				$author_name_link = (( empty( $author_link ) || 'http://' == $author_link ) ? $author_name : "<a href='$author_link' rel='external nofollow' class='url'>$author_name</a>");
+
+				$comment_type = (empty($comment->comment_type) ? 'comment': $comment->comment_type);
+				$from_auther_to_post = sprintf(__('%1$s on %2$s'), $author_name_link , $post_title_link );
+
+				$row_data = array(
+					'comment_ID' 		=> $comment->comment_ID ,
+					'comment_post_ID'	=> $comment->comment_post_ID ,
+					'comment_date' 		=> date(get_settings('date_format'),$comment->comment_unix_time) ,
+					'comment_date_time' => date(get_settings('date_format') . ' ' . get_settings('time_format'),$comment->comment_unix_time) ,
+					'comment_content' 	=> $comment_content ,
+					'comment_excerpt' 	=> $comment_excerpt ,	
+					'comment_link' 		=> $comment_link,
+					'comment_title' 	=> $comment_title ,
+					'comment_title_link' => $comment_title_link ,
+					'post_link' 		=> $post_link,
+					'post_title' 		=> $post_title,
+					'post_title_link' 	=> $post_title_link,
+					'author_link' 		=> $author_link,
+					'author_name' 		=> $author_name,
+					'author_name_link' 	=> $author_name_link,		
+					'comment_type' 		=> $comment_type,																																		
+					'from_auther_to_post' => $from_auther_to_post
+				);
+				
+				$block['contents']['item'.$item_no] = $row_data;
+				$item_no++;
+			}
+		}
+	}
+	return $block ;
+}
+?>
