Index: trunk/block_refresh.php
===================================================================
--- trunk/block_refresh.php	(revision 96)
+++ trunk/block_refresh.php	(revision 96)
@@ -0,0 +1,4 @@
+<?php
+include('./wp-load.php');
+block_cache_refresh();
+?>
Index: trunk/include/notification.inc.sub.php.delete
===================================================================
--- trunk/include/notification.inc.sub.php.delete	(revision 95)
+++ 	(revision )
@@ -1,153 +1,0 @@
-<?php
-function Notification_triggerEvent($category, $item_id, $event, $extra_tags=array(), $user_list=array(), $omit_user_id=null)
-{
-	if( ! is_object($GLOBALS["xoopsModule"]) ) return false ;
-	$module_id = $GLOBALS["xoopsModule"]->getVar('mid') ;
-	$notification_handler =& xoops_gethandler( 'notification' ) ;
-	$notification_handler->triggerEvent($category, $item_id, $event, $extra_tags, $user_list, $module_id, $omit_user_id)
-}
-function do_CommentNotifications($commentID, $comment_post_ID)
-{
-	$xpress_prefix = $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-	if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
-	$db =& Database::getInstance() ;
-	$myts =& MyTextsanitizer::getInstance() ;
-
-	$table_term_relationships = $db->prefix($xpress_prefix."_term_relationships");
-	$table_term_taxonomy = $db->prefix($xpress_prefix."_term_taxonomy");
-	$table_terms = $db->prefix($xpress_prefix."_terms");
-	$table_categories = $db->prefix($xpress_prefix."_categories");
-	$wp_post = $db->prefix($xpress_prefix."_posts");
-	$wp_options = $db->prefix($xpress_prefix."_options");
-	$wp_users  = $db->prefix($xpress_prefix."_users");
-	$wp_comments  = $db->prefix($xpress_prefix."_comments");
-	$post_id = $comment_post_ID;
-
-	$post_title = get_the_title($post_id);
-	$post_url = get_permalink($post_id). '#comment';
-	$blog_name = get_bloginfo('name');
-
-	/*
-	$sql = "SELECT option_value  FROM $wp_options WHERE option_name ='blogname'";
-	$blog_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $blog_row ) ) return false;
-	$blog_name = $blog_row['option_value'];
-	*/								
-	// query
-	$sql = "SELECT * FROM ".$wp_post." WHERE ID=$comment_post_ID ";
-	$post_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $post_row ) ) return false;
-	//			$post_title = $post_row['post_title'];
-	$post_author = $post_row['post_author'];
-
-	$sql = "SELECT display_name  FROM $wp_users WHERE ID ='$post_author'";
-	$blog_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $blog_row ) ) return false;
-	$user_name = $blog_row['display_name'];
-
-	require_once XOOPS_ROOT_PATH . '/include/notification_functions.php' ;
-	// non-module integration returns false quickly
-	
-	if( ! is_object($GLOBALS["xoopsModule"]) ) return false ;
-	$not_modid = $GLOBALS["xoopsModule"]->getVar('mid') ;
-
-	$comment_tags = array( 'XPRESS_AUTH_NAME' =>$user_name,'XPRESS_BLOG_NAME' =>$blog_name,'XPRESS_POST_TITLE' => $post_title , 'XPRESS_POST_URL' => $post_url ) ;
-	$notification_handler =& xoops_gethandler( 'notification' ) ;
-	$notification_handler->triggerEvent( 'global' , 0 , 'comment' , $comment_tags , false , $not_modid ) ;
-	$notification_handler->triggerEvent( 'author' , $post_author , 'comment' , $comment_tags , false , $not_modid ) ;
-	$notification_handler->triggerEvent( 'post' , $comment_post_ID , 'comment' , $comment_tags , false , $not_modid ) ;
-
-	// categorie notification
-	include(XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/wp-includes/version.php');
-	if ($wp_db_version < 6124){
-		$sql2 = "SELECT c.cat_ID, c.cat_name FROM ".$table_categories." c, ".$table_post2cat." p2c WHERE c.cat_ID = p2c.category_id AND p2c.post_id=".$comment_post_ID;
-	} else {
-		$sql2  = "SELECT $table_term_relationships.object_id, $table_terms.term_id AS cat_ID, $table_terms.name AS cat_name ";
-		$sql2 .= "FROM $table_term_relationships INNER JOIN ($table_term_taxonomy INNER JOIN $table_terms ON $table_term_taxonomy.term_id = $table_terms.term_id) ON $table_term_relationships.term_taxonomy_id = $table_term_taxonomy.term_taxonomy_id ";
-		$sql2 .= "WHERE ($table_term_relationships.object_id =" . $comment_post_ID.") AND ($table_term_taxonomy.taxonomy='category')";		
-	}
-	$res2 = $db->query($sql2);
-	while($row2 = $db->fetchArray($res2)){
-		$cat_id = $row2['cat_ID'];
-		$cat_name = $row2['cat_name'];
-		$comment_tags = array( 'XPRESS_AUTH_NAME' =>$user_name,'XPRESS_BLOG_NAME' =>$blog_name,'XPRESS_CAT_TITLE' => $cat_name,'XPRESS_POST_TITLE' => $post_title , 'XPRESS_POST_URL' => $post_url ) ;
-		$notification_handler->triggerEvent( 'category' , $cat_id , 'comment' , $comment_tags , false , $not_modid ) ;
-	}
-}
-
-function do_PostNotifications($post_id,$not_event)
-{
-	 // $not_event:		newpost,editpost ; $commentID, $comment_post_ID)
-	 
-	$xpress_prefix = $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-	if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
-	$db =& Database::getInstance() ;
-	$myts =& MyTextsanitizer::getInstance() ;
-
-	$table_term_relationships = $db->prefix($xpress_prefix."_term_relationships");
-	$table_term_taxonomy = $db->prefix($xpress_prefix."_term_taxonomy");
-	$table_terms = $db->prefix($xpress_prefix."_terms");
-	$table_categories = $db->prefix($xpress_prefix."_categories");
-	$wp_post = $db->prefix($xpress_prefix."_posts");
-	$wp_options = $db->prefix($xpress_prefix."_options");
-	$wp_users  = $db->prefix($xpress_prefix."_users");
-	$wp_comments  = $db->prefix($xpress_prefix."_comments");
-
-	$post_title = get_the_title($post_id);
-	$post_url = get_permalink($post_id). '#comment';
-	$blog_name = get_bloginfo('name');
-
-	// query
-	$sql = "SELECT * FROM ".$wp_post." WHERE ID=$post_id ";
-	$post_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $post_row ) ) return false;
-	//			$post_title = $post_row['post_title'];
-	$post_author = $post_row['post_author'];
-
-	$sql = "SELECT display_name  FROM $wp_users WHERE ID ='$post_author'";
-	$blog_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $blog_row ) ) return false;
-	$user_name = $blog_row['display_name'];
-
-	require_once XOOPS_ROOT_PATH . '/include/notification_functions.php' ;
-	// non-module integration returns false quickly
-	
-	if( ! is_object($GLOBALS["xoopsModule"]) ) return false ;
-	$not_modid = $GLOBALS["xoopsModule"]->getVar('mid') ;
-	
-	$posts_tags = array( 'XPRESS_AUTH_NAME' =>$user_name,'XPRESS_BLOG_NAME' =>$blog_name,'XPRESS_POST_TITLE' => $post_title , 'XPRESS_POST_URL' => $post_url ) ;
-
-	$notification_handler =& xoops_gethandler( 'notification' ) ;	
-	switch ($not_event) {
-		case 'newpost' :
-			$notification_handler->triggerEvent( 'global' , 0 , 'newpost' , $posts_tags , false , $not_modid ) ;
-			$notification_handler->triggerEvent( 'author' , $post_author , 'newpost' , $posts_tags , false , $not_modid ) ;
-
-			// categorie notification
-			include(XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/wp-includes/version.php');
-			if ($wp_db_version < 6124){
-				$sql2 = "SELECT c.cat_ID, c.cat_name FROM ".$table_categories." c, ".$table_post2cat." p2c WHERE c.cat_ID = p2c.category_id AND p2c.post_id=".$post_id;
-			} else {
-				$sql2  = "SELECT $table_term_relationships.object_id, $table_terms.term_id AS cat_ID, $table_terms.name AS cat_name ";
-				$sql2 .= "FROM $table_term_relationships INNER JOIN ($table_term_taxonomy INNER JOIN $table_terms ON $table_term_taxonomy.term_id = $table_terms.term_id) ON $table_term_relationships.term_taxonomy_id = $table_term_taxonomy.term_taxonomy_id ";
-				$sql2 .= "WHERE ($table_term_relationships.object_id =" . $post_id.") AND ($table_term_taxonomy.taxonomy='category')";		
-			}
-			$res2 = $db->query($sql2);
-			while($row2 = $db->fetchArray($res2)){
-				$cat_id = $row2['cat_ID'];
-				$cat_name = $row2['cat_name'];
-				$posts_tags = array( 'XPRESS_AUTH_NAME' =>$user_name,'XPRESS_BLOG_NAME' =>$blog_name,'XPRESS_CAT_TITLE' => $cat_name,'XPRESS_POST_TITLE' => $post_title , 'XPRESS_POST_URL' => $post_url ) ;
-				$notification_handler->triggerEvent( 'category' , $cat_id , 'newpost' , $posts_tags , false , $not_modid ) ;
-			}
-			break;
-		case 'editpost' :
-			$notification_handler->triggerEvent( 'post' , $post_id , 'editpost' , $posts_tags , false , $not_modid ) ;
-			break;
-		default :
-	}
-}		
-
-
-
-	
-?>
Index: trunk/include/oninstall.php
===================================================================
--- trunk/include/oninstall.php	(revision 95)
+++ trunk/include/oninstall.php	(revision 96)
@@ -51,4 +51,5 @@
 	wp_cache_flush();
 	make_db_current_silent();
+	$ret[] = "The data base of wordpress was made by prefix $table_prefix.";
 	
 	$option_desc = __('WordPress web address');
@@ -67,12 +68,43 @@
 	update_option("home", $site_url);
 	update_option("siteurl", $site_url);
+	update_option("what_to_show", "posts");
+	update_option('default_pingback_flag', 0);
+	$ret[] = 'The initial data was written in the data base of wordpress.';
+	
 	update_option("template", "xpress_default");
 	update_option("stylesheet", "xpress_default");
-	update_option("what_to_show", "posts");
-
+	$ret[] = 'The default theme of wordpress was set to xpress_default.';
 	/* add new option for uploads */
 //	update_option('uploads_use_yearmonth_folders', 1);
 //	update_option('upload_path', $module->getVar("dirname"));
 	
+		
+// Admin User Data write
+	// Change uid field
+	$wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'");
+	$user_name = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uname"):'admin';
+	$email = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("email"):'foo@exsample.com';
+	$pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):'';
+	
+	$user_id = username_exists($user_name);
+	if ( !$user_id ) {
+		$random_password = 'admin';
+		$user_id = wp_create_user($user_name, $random_password, $email);
+	} else {
+		$random_password = __('User already exists.  Password inherited.');
+	}
+
+	$user = new WP_User($user_id);
+	$user->set_role('administrator');
+	'User ' . $user_name . ' of the administrator was made.';
+	// over write xoops md5 password 
+	$sql = "UPDATE $wpdb->users SET user_pass ='$pass_md5' WHERE ID = $user_id";
+	$wpdb->query($sql);
+	$ret[] = 'The password of XOOPS was copied.';
+	// Set Default data
+	wp_install_defaults($user_id);
+	$ret[] = 'The first sample post & comment was written.';
+//	    generate_page_uri_index();
+
 	/* activate the XPressME plugin */
 	$plugin_current = "xpressme/xpressme.php";
@@ -80,18 +112,6 @@
 	include_once(dirname(__FILE__) . '/../wp-content/plugins/'.$plugin_current);
 	do_action('activate_'.$plugin_current);
-		
-// Admin User Data write
-	// Change uid field
-	$wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'");
-	$ID = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uid"):1;
-//   	require_once($mydirpath . '/include/user_sync.php');
-	$sync_messg = '';
-//	user_sync_to_wordpress($ID,$sync_messg);		//this function in XPressME plugin 
-
-	// Set Default data
-		wp_install_defaults($ID);
-//	    generate_page_uri_index();
-
-	        
+	$ret[] = 'The xpressme plug-in was activated.';
+	
 	// create views table
 	$xp_prefix = $mydirname;
@@ -115,4 +135,6 @@
 
 	dbDelta($views_queries);
+	$ret[] = "$views_table table of XPressME was made.";
+
 	
 	$d3forum_link = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_d3forum_link' ;
@@ -124,4 +146,5 @@
 		)$charset_collate;";
 	dbDelta($views_queries);
+	$ret[] = "$d3forum_link table of XPressME was made.";
 	
 	$group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_group_role' ;
@@ -136,4 +159,6 @@
 		)$charset_collate;";
 	dbDelta($views_queries);
+	$ret[] = "$group_role table of XPressME was made.";
+
 	$sql = "INSERT INTO $group_role (groupid, role) VALUES (1, 'administrator')";
 	$wpdb->query($sql);
Index: trunk/include/onupdate.php
===================================================================
--- trunk/include/onupdate.php	(revision 95)
+++ trunk/include/onupdate.php	(revision 96)
@@ -46,4 +46,5 @@
 		}				
 	}
+
 	/* activate the tag plugin */
 	$plugin_current = "xpressme/xpressme.php";
Index: trunk/include/request_url.php
===================================================================
--- trunk/include/request_url.php	(revision 95)
+++ trunk/include/request_url.php	(revision 96)
@@ -13,7 +13,7 @@
  */
 function check_page_call($check_file =''){
-	global $xoops_config;
+	global $xoops_config;	// not object at install
 	if (empty($check_file)) return false;
-	$xpress_page = 	$xoops_config->module_name . '/' . $check_file;
+	$xpress_page = 	basename(dirname(dirname(__FILE__))) . '/' . $check_file;
 	$php_script_name = $_SERVER['SCRIPT_NAME'];
 	$php_query_string = $_SERVER['QUERY_STRING'];
@@ -49,3 +49,11 @@
 	return $ret;
 }
+
+function is_xpress_install_call(){
+	$action = 'action=ModuleInstall&dirname=';
+	$php_script_name = $_SERVER['SCRIPT_NAME'];
+	$php_query_string = $_SERVER['QUERY_STRING'];
+	if (strstr($php_query_string,$action) !== false) return true;
+	return false;
+}
 ?>
Index: trunk/include/xpress_block_render.php
===================================================================
--- trunk/include/xpress_block_render.php	(revision 95)
+++ trunk/include/xpress_block_render.php	(revision 96)
@@ -99,4 +99,24 @@
 	}
 	
+    function xpress_block_cache_found($mydirname,$block_name)
+    {
+    	global $xoops_config;
+    	if(defined('XOOPS_ROOT_PATH')){
+    		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+    	} else {
+    		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+    	}
+    	$xml_name = $block_name . '.xml';
+
+        $filename = $cache_dir .$mydirname . '_' . $xml_name;
+		$cache_time = 0;
+//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
+        if (file_exists($filename)) {
+            return true;
+       } else {
+			return false;
+		}
+    } 
+	
 	function xpress_block_render($mydirname,$block_function_name,$options)
 	{
@@ -108,5 +128,7 @@
 		$blockID =get_block_id($mydirname,$func_file,$options);		
 
-		if (!is_null($wpdb)){
+		$this_url = '/modules/'. $mydirname;
+		$call_url = $_SERVER['REQUEST_URI'];
+		if (strstr($call_url,$this_url)){
 			xpress_block_css_set($mydirname);
 			
@@ -114,10 +136,11 @@
 			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. 
-
-// Not Cache Write Now.  Becose Cache Write On WordPress Event			
-//			xpress_block_cache_write($mydirname,$cache_title. $blockID, $block);  
 		} else {
-			$xml = xpress_block_cache_read($mydirname,$cache_title. $blockID);
-			$block = $xml['block'];
+			if (xpress_block_cache_found($mydirname,$cache_title. $blockID)){
+				$xml = xpress_block_cache_read($mydirname,$cache_title. $blockID);
+				$block = $xml['block'];
+			} else {
+				$block['err_message'] = sprintf(_MB_XPRESS_BLOCK_CACHE_ERR, '<a href="' . XOOPS_URL . '/modules/' . $mydirname . '">' . $mydirname .'</a>');
+			}
 		}
 
Index: trunk/include/xpress_cache.php
===================================================================
--- trunk/include/xpress_cache.php	(revision 95)
+++ trunk/include/xpress_cache.php	(revision 96)
@@ -1,13 +1,28 @@
 <?php
 	
+if(!function_exists("xpress_cache_found")):
+    function xpress_cache_found($filename)
+    {
+		$cache_time = 0;
+//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
+        if (file_exists($filename)) {
+            return true;
+       } else {
+			return false;
+		}
+    } 
+endif;
+
 if(!function_exists("xpress_cache_read")):
     function xpress_cache_read($mydirname,$collation_key)
     {
     	global $xoops_config;
-		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
-		$cache_time = 0;
+    	if(defined('XOOPS_ROOT_PATH')){
+    		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+    	} else {
+    		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+    	}
         $filename = $cache_dir .$mydirname . '_' . $collation_key;
-//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
-        if (file_exists($filename)) {
+        if (xpress_cache_found($filename)) {
             return file_get_contents($filename);
        } else {
Index: trunk/include/xpress_debug_log.php
===================================================================
--- trunk/include/xpress_debug_log.php	(revision 95)
+++ trunk/include/xpress_debug_log.php	(revision 96)
@@ -57,3 +57,71 @@
     }
 }
+
+function xpress_error_handler($errno,$errstr,$errfile,$errline,$errcontext) {
+	$module_dirpath = dirname(dirname(__FILE__));
+	$root_path = dirname(dirname(dirname(dirname(__FILE__))));
+	
+	$show_backtrace = true;
+
+	// Time stamp of error entry
+	$dt = date("Y-m-d H:i:s (T)");
+
+	// define an assoc array of error string
+	// in reality the only entries we should
+	// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
+	// E_USER_WARNING and E_USER_NOTICE
+	$errortype = array (
+		E_ERROR          => "Error",
+		E_WARNING        => "Warning",
+		E_PARSE          => "Parsing Error",
+		E_NOTICE          => "Notice",
+		E_CORE_ERROR      => "Core Error",
+		E_CORE_WARNING    => "Core Warning",
+		E_COMPILE_ERROR  => "Compile Error",
+		E_COMPILE_WARNING => "Compile Warning",
+		E_USER_ERROR      => "User Error",
+		E_USER_WARNING    => "User Warning",
+		E_USER_NOTICE    => "User Notice",
+		E_STRICT          => "Runtime Notice"
+	);
+	if (strstr($errstr, 'Use of undefined constant xpress_debug_message - assumed') !== false) return;
+	// set of errors for which a var trace will be saved
+	$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
+
+	$err = "<errorentry>\n";
+	$err .= "\t<datetime>" . $dt . "</datetime>\n";
+	$err .= "\t<errornum>" . $errno . "</errornum>\n";
+	$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
+	$err .= "\t<errormsg>" . $errstr . "</errormsg>\n";
+	$err .= "\t<scriptname>" . $errfile . "</scriptname>\n";
+	$err .= "\t<scriptlinenum>" . $errline . "</scriptlinenum>\n";
+	$err .= "\t<errcontext>" . $errcontext . "</errcontext>\n";
+
+	if (in_array($errno, $user_errors)) {
+		$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
+	}
+	$err .= "</errorentry>\n\n";
+
+	$err_trace = '';
+	if ($show_backtrace){	
+		$backtraces = array_reverse(debug_backtrace());
+		$err_trace .= "BACK TRACE\n";
+		foreach($backtraces as $backtrace){
+			$trace = @$backtrace['file']. "\tLINE(" . @$backtrace['line'] . ")\t" . @$backtrace['function']  . "()\n";
+			$trace = str_replace($root_path,"",$trace);
+			$trace = str_replace("\\","/",$trace);
+			$trace = str_replace($root_path,"",$trace);
+			$trace = "\t" . $trace;
+			$err_trace .= $trace;
+		}
+	}
+	$head = "\n***** XPressME ERROR LOG ****************************************************************************************************\n";
+	$message = $head . $err . $err_trace;
+	$_debug_file = $module_dirpath . '/wp-content/xpress_error.log';
+	if ($errno != E_STRICT) {
+		$_fp = fopen($_debug_file, 'a');
+		fwrite($_fp, $message);	
+		fclose($_fp);
+	}
+}
 ?>
Index: trunk/include/xpress_render.php
===================================================================
--- trunk/include/xpress_render.php	(revision 95)
+++ trunk/include/xpress_render.php	(revision 96)
@@ -10,5 +10,8 @@
 	$pattern = "<style[^>]*?>(.*)<\/style>";
 	preg_match("/".$pattern."/s",  $head_str, $style_matches);
-	$style = $style_matches[0];
+	if (empty($style_matches[0]))
+		$style = '';
+	else
+		$style = $style_matches[0];
  
 	$pattern = "<link(.*)>";
@@ -95,11 +98,13 @@
 //rendering for the module header and the body
 function xpress_render($contents){
-	global $xoopsTpl;
-	include XOOPS_ROOT_PATH."/header.php";
-	$page_title = $GLOBALS["xoopsModule"]->getVar("name")." ".wp_title('&raquo;', false);	
+	global $xoops_config , $xoopsTpl;
+	include $xoops_config->xoops_root_path ."/header.php";
+	$page_title = $GLOBALS["xoopsModule"]->getVar("name")." ".wp_title('&raquo;', false);
 	$xoopsTpl->assign('xoops_module_header', get_xpress_module_header($contents));
 	$xoopsTpl->assign('xoops_pagetitle', $page_title);
 	$xoopsTpl->assign('xpress_body_contents', get_body($contents));
 	echo get_body($contents);
+	require_once( ABSPATH .'/include/xpress_breadcrumbs.php' );
+	include $xoops_config->xoops_root_path . '/footer.php';
 }
 
Index: trunk/language/ja_utf8/blocks.php
===================================================================
--- trunk/language/ja_utf8/blocks.php	(revision 95)
+++ trunk/language/ja_utf8/blocks.php	(revision 96)
@@ -16,4 +16,6 @@
 	define("_MB_XPRESS_CATS_SELECT","カテゴリー選択");
 	define("_MB_XPRESS_TAGS_SELECT","タグ選択(複数ある場合はカンマ区切りで入力");
+	
+	define("_MB_XPRESS_BLOCK_CACHE_ERR","キャッシュが存在しません。<br />最初に%sモジュールにアクセスしてください。");
 
 }
Index: trunk/templates/source/recent_comments_block.html
===================================================================
--- trunk/templates/source/recent_comments_block.html	(revision 95)
+++ trunk/templates/source/recent_comments_block.html	(revision 96)
@@ -23,4 +23,5 @@
 
 <div id="xpress_recent_comments">
+	<{$block.err_message}>
 	<{$block.data_count}>
 	<{foreach from=$block.contents item=content}>
Index: trunk/templates/source/recent_posts_content_block.html
===================================================================
--- trunk/templates/source/recent_posts_content_block.html	(revision 95)
+++ trunk/templates/source/recent_posts_content_block.html	(revision 96)
@@ -21,4 +21,5 @@
 
 <ul class="xpress_recent_comments">
+	<{$block.err_message}>
 	<{$block.data_count}>
 	<{foreach from=$block.contents item=content}>
Index: trunk/wp-config.php
===================================================================
--- trunk/wp-config.php	(revision 95)
+++ trunk/wp-config.php	(revision 96)
@@ -5,54 +5,83 @@
 require_once dirname( __FILE__ ).'/include/set_cash_cookie_path.php' ;
 
+/**
+ * mb_language() sets language. If language  is omitted, it returns current language as string.
+ * language setting is used for encoding e-mail messages. 
+ * Valid languages are "Japanese", "ja","English","en" and "uni" (UTF-8). 
+ * mb_send_mail() uses this setting to encode e-mail.
+ * Language and its setting is ISO-2022-JP/Base64 for Japanese, UTF-8/Base64 for uni, ISO-8859-1/quoted printable for English. 
+ */
+ if (function_exists("mb_language")) mb_language('uni');
 
-if (function_exists("mb_language")) mb_language('Japanese');
-// The setting of mb_internal_encoding might be unnecessary. 
-// Because mb_internal_encoding setting wp-setting.php line 484
-if (function_exists("mb_internal_encoding")) mb_internal_encoding('UTF-8');
 
-// ** MySQL settings ** //
-define('DB_NAME', $xoops_config->xoops_db_name);    // The name of the database
-define('DB_USER', $xoops_config->xoops_db_user);     // Your MySQL username
-define('DB_PASSWORD', $xoops_config->xoops_db_pass); // ...and password
-define('DB_HOST', $xoops_config->xoops_db_host);    // 99% chance you won't need to change this value
+// ** MySQL settings - You can get this info from your web host ** //
+// Do not change  'DB_NAME','DB_USER','DB_PASSWORD' & 'DB_HOST'
+// because copies a set value of XOOPS. 
+
+/** Do not change. The name of the database for WordPress */
+define('DB_NAME', $xoops_config->xoops_db_name);
+
+/** Do not change. MySQL database username */
+define('DB_USER', $xoops_config->xoops_db_user);
+
+/** Do not change. MySQL database password */
+define('DB_PASSWORD', $xoops_config->xoops_db_pass);
+
+/** Do not change. MySQL hostname */
+define('DB_HOST', $xoops_config->xoops_db_host);
+	
+/** Database Charset to use in creating database tables. */
 define('DB_CHARSET', 'utf8');
+
+/** The Database Collate type. Don't change this if in doubt. */
 define('DB_COLLATE', '');
 
 //define('WP_DEBUG' ,true);
 
-// Change each KEY to a different unique phrase.  You won't have to remember the phrases later,
-// so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/
-// to get keys generated for you, or just make something up.  Each key should have a different phrase.
-define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
-define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
-define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
+/**#@+
+ * Authentication Unique Keys.
+ *
+ * Change these to different unique phrases!
+ * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}
+ *
+ * @since 2.6.0
+ */
+define('AUTH_KEY', 'put your unique phrase here');
+define('SECURE_AUTH_KEY', 'put your unique phrase here');
+define('LOGGED_IN_KEY', 'put your unique phrase here');
+define('NONCE_KEY', 'put your unique phrase here');
 
-// You can have multiple installations in one database if you give each a unique prefix
-$table_prefix  = $xoops_config->module_db_prefix;   // Only numbers, letters, and underscores please!
+/**
+ * WordPress Database Table prefix.
+ *
+ * You can have multiple installations in one database if you give each a unique
+ * prefix. Only numbers, letters, and underscores please!
+ */
+// Do not change. $table_prefix is generated from XOOPS DB Priefix and the module directory name. 
+$table_prefix  = $xoops_config->module_db_prefix;
 
-// Change this to localize WordPress.  A corresponding MO file for the
-// chosen language must be installed to wp-content/languages.
-// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
-// to enable German language support.
-define ('WPLANG', 'ja');
+/**
+ * WordPress Localized Language, defaults to Japanese.
+ *
+ * Change this to localize WordPress.  A corresponding MO file for the chosen
+ * language must be installed to wp-content/languages. For example, install
+ * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
+ * language support.
+ *
+ * Example:
+ * define ('WPLANG', '');		// language support to English
+ */
+define ('WPLANG', 'ja');		// language support to Japanese
 
 /* That's all, stop editing! Happy blogging. */
 
+/** WordPress absolute path to the Wordpress directory. */
 if ( !defined('ABSPATH') )
 	define('ABSPATH', dirname(__FILE__).'/');
 
-require_once dirname( __FILE__ ).'/include/request_url.php' ;
-if (!is_xpress_index_page_call()){
-//	if ( is_wp_cron_page_call()){
-//		if ( !defined("XOOPS_ROOT_PATH") ) {
-//			require_once $xoops_config->xoops_mainfile_path;
-//		}
-//	}
+require_once( ABSPATH .'/include/request_url.php');
+if (is_xpress_index_page_call()){
+	require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php. 
 	require_once(ABSPATH.'wp-settings.php');
-} else {
-	// If $xoops_config->xoops_mainfile_path is not executed before wp-settings.php is executed, log in cannot be done. 
-	require_once $xoops_config->xoops_mainfile_path;
-	require_once(ABSPATH.'wp-settings.php');
-	// The return to wp-blog-header.php is stolen here
 	wp();
 	ob_start();	
@@ -62,7 +91,11 @@
 	require_once( ABSPATH .'/include/xpress_render.php' );
 	xpress_render($wp_output);
-	require_once( ABSPATH .'/include/xpress_breadcrumbs.php' );
-	include $xoops_config->xoops_root_path . '/footer.php';
-	exit();
+	
+	//When there is no block cache, and an optional block is different, cache is refreshed. 
+	//When adding, and changing and deleting Post & Comment, block cache is refreshed by add_action at any time. 
+	// This Function in xpressme plugin
+	if (!is_block_cache_normal()) block_cache_refresh();
+	exit();		// The return to wp-blog-header.php is stolen here
 }
+require_once(ABSPATH.'wp-settings.php');
 ?>
Index: trunk/wp-content/plugins/xpressme/include/common_functions.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/common_functions.php	(revision 95)
+++ 	(revision )
@@ -1,77 +1,0 @@
-<?php
-// xoops db
-function get_xpress_dir_path()
-{
-	return ABSPATH;
-}
-
-function get_xpress_dir_name()
-{
-	return basename(ABSPATH);
-}
-
-function get_wp_prefix_only()
-{
-	$dir_name = get_xpress_dir_name();
-	$prefix = $dir_name;
-	if ($prefix == 'wordpress') $prefix = 'wp';
-	
-	$prefix = $prefix . '_';
-	return $prefix;
-}
-
-function get_xoops_prefix()
-{
-	global $xoops_config;
-	$ret =$xoops_config->xoops_db_prefix . '_';
-	return $ret;
-}
-function get_wp_prefix()
-{
-	$prefix = get_xoops_prefix() . get_wp_prefix_only();
-	return $prefix;
-}
-
-function get_xpress_modid()
-{
-	global $xoops_db;
-	
-	$modulename = get_xpress_dir_name();	
-	$sql = "SELECT mid FROM " . get_xoops_prefix() . "modules WHERE dirname = '$modulename'";
-	$mid = $xoops_db->get_var($sql);
-	return $mid;	
-}
-
-function get_xpress_db_version()
-{
-	include get_xpress_dir_path() . '/wp-includes/version.php';
-	return $wp_db_version;
-}
-
-function block_cache_refresh()
-{
-	global $xoops_db;
-	$mid = get_xpress_modid();
-	$sql = "SELECT bid,options,func_file FROM " . get_xoops_prefix() . "newblocks WHERE mid = $mid";
-	$blocks = $xoops_db->get_results($sql);
-	$mydirname = get_xpress_dir_name();
-	require_once get_xpress_dir_path() . '/include/xpress_block_render.php';
-
-
-	foreach($blocks as $block){
-		$func_file = $block->func_file;
-		$call_theme_function_name = str_replace(".php", "", $func_file);
-		$inc_theme_file_name = str_replace(".php", "", $func_file) . '_theme.php';
-		$cache_title = str_replace(".php", "", $func_file);
-		$blockID = $block->bid;
-		$options = explode("|", $block->options);
-					
-		$block_theme_file = get_block_file_path($mydirname,$inc_theme_file_name);
-		require_once $block_theme_file;
-		$block_render = $call_theme_function_name($options);		//The block name and the called function name should be assumed to be the same name. 			
-		$xml['block'] = $block_render;
-		xpress_block_cache_write($mydirname,$cache_title. $blockID, $xml);
-	}
-}
-
-?>
Index: trunk/wp-content/plugins/xpressme/include/custom_functions.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 95)
+++ trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 96)
@@ -3,7 +3,9 @@
 function xpress_credit($show = false)
 {
-	global $xoopsModule,$wp_version;
-	
-	$ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xoopsModule->getInfo('version'),$xoopsModule->getInfo('codename')) .'</a>';
+	global $wp_version , $modversion;
+	
+	$xpress_version = $modversion['version'];
+	$xpress_codename = $modversion['codename'];
+	$ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>';
 	if (strstr($wp_version,'ME')){
 		$ret .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';
@@ -192,4 +194,5 @@
 // Set post views given a post ID or post object. 
 function post_views_counting($post_id = 0) {
+	global $xoops_db,$wpdb;
 	global $table_prefix;
 	static $views;
@@ -201,5 +204,5 @@
 
 
-	$views_db = $table_prefix . "views";
+	$views_db = get_wp_prefix() . 'views';
 
 	if($post_id==0 || !empty($views[$post_id])) return null;
@@ -212,20 +215,11 @@
 
     $sql = "SELECT post_views FROM " . $views_db . " WHERE post_id=$post_id";
-    $exist = false;
-    if ($result = $GLOBALS["xoopsDB"]->query($sql)) {
-        while($row = $GLOBALS["xoopsDB"]->fetchArray($result)){
-        	$exist = true;
-	        break;
-    	}
-	}
-	if($exist){
+	$post_views_found = $xoops_db->get_var($sql);
+	if($post_views_found){
         $sql = "UPDATE " . $views_db . " SET post_views=post_views+1 WHERE post_id=$post_id";
     }else{
         $sql = "INSERT INTO " . $views_db . " (post_id, post_views) VALUES ($post_id, 1)";
     }
-    if ($result = $GLOBALS["xoopsDB"]->queryF($sql)) {
-    	$views[$post_id] = 1;
-    }
-    
+    $xoops_db->query($sql);
 	return true;
 }
Index: trunk/wp-content/plugins/xpressme/include/notify_functions.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/notify_functions.php	(revision 95)
+++ trunk/wp-content/plugins/xpressme/include/notify_functions.php	(revision 96)
@@ -48,7 +48,6 @@
 		$_SERVER['REQUEST_METHOD'] = 'POST';
 	}
-	
-	include_once $xoops_config->xoops_mainfile_path;	// load XOOPS System
-	include_once $xoops_config->xoops_root_path . '/include/notification_functions.php' ;
+//	set_error_handler("xpress_error_handler");
+	require $xoops_config->xoops_mainfile_path;	// load XOOPS System
 	$module_id = get_xpress_modid() ;
 	$notification_handler =& xoops_gethandler( 'notification' ) ;
@@ -58,7 +57,4 @@
 function do_CommentWaiting($commentID, $comment_post_ID)
 {
-//	global $xoops_config;
-//	require_once $xoops_config->xoops_mainfile_path;
-//	xoops_mainfile_path;
 //	require_once XOOPS_ROOT_PATH . '/include/notification_functions.php' ;
 //	$notification_handler =& xoops_gethandler( 'notification' ) ;
@@ -120,5 +116,4 @@
 {
 	global $xoops_config, $xoops_db;
-	xpress_debug();
 	
 
Index: trunk/wp-content/plugins/xpressme/include/pluggable-override.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/pluggable-override.php	(revision 95)
+++ trunk/wp-content/plugins/xpressme/include/pluggable-override.php	(revision 96)
@@ -56,4 +56,5 @@
 endif;
 
+if ( !function_exists('xpress_login') ) :
 function xpress_login(){
 	global $current_user;
@@ -81,5 +82,7 @@
 	return 0;	
 }
+endif;
 
+if ( !function_exists('check_xpress_auth_cookie') ) :
 function check_xpress_auth_cookie() {		// for wp2.5
 	if ( empty($_COOKIE[AUTH_COOKIE]) ){
@@ -112,4 +115,5 @@
 	return false;
 }
+endif;
 
 if ( !function_exists('wp_check_password') ) :
Index: trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php	(revision 95)
+++ trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php	(revision 96)
@@ -49,4 +49,56 @@
 }
 
+function is_block_cache_found($block_name)
+{
+	global $xoops_config;
+	$mydirname = get_xpress_dir_name();
+
+	if(defined('XOOPS_ROOT_PATH')){
+		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+	} else {
+		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+	}
+	$xml_name = $block_name . '.xml';
+
+    $filename = $cache_dir .$mydirname . '_' . $xml_name;
+	$cache_time = 0;
+//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
+    if (file_exists($filename)) {
+        return true;
+        } else {
+		return false;
+	}
+}
+
+
+//When there is no block cash, and an optional block is different, false is returned.
+function is_block_cache_normal()
+{
+	global $xoops_config;
+	global $xoops_db;
+	$mid = get_xpress_modid();
+	$sql = "SELECT bid,options,func_file FROM " . get_xoops_prefix() . "newblocks WHERE mid = $mid ";
+	$blocks = $xoops_db->get_results($sql);
+	$mydirname = get_xpress_dir_name();
+	require_once get_xpress_dir_path() . '/include/xpress_block_render.php';
+
+	foreach($blocks as $block){
+		$func_file = $block->func_file;
+		$call_theme_function_name = str_replace(".php", "", $func_file);
+		$inc_theme_file_name = str_replace(".php", "", $func_file) . '_theme.php';
+		$cache_title = str_replace(".php", "", $func_file);
+		$blockID = $block->bid;
+		$options = explode("|", $block->options);
+		
+		if (!is_block_cache_found($cache_title . $blockID)) return false;
+		$xml = xpress_block_cache_read($mydirname,$cache_title. $blockID);
+		$options = '';
+		$options = @$xml['block']['options'];
+		if( strcmp($options,$block->options) != 0 ) return false;
+	}
+	return true;
+}
+
+
 function block_cache_refresh()
 {
@@ -71,4 +123,5 @@
 		$block_render = $call_theme_function_name($options);		//The block name and the called function name should be assumed to be the same name. 			
 		$xml['block'] = $block_render;
+		$xml['block']['options'] = $block->options;
 		xpress_block_cache_write($mydirname,$cache_title. $blockID, $xml);
 	}
Index: trunk/wp-content/plugins/xpressme/xpressme.php
===================================================================
--- trunk/wp-content/plugins/xpressme/xpressme.php	(revision 95)
+++ trunk/wp-content/plugins/xpressme/xpressme.php	(revision 96)
@@ -27,12 +27,14 @@
 	remove_action( 'pre_post_update', 'wp_save_post_revision' );			// Not Save Post Revision
 }
+
+//XOOPS Bloack Cache Refresh
 add_action("comment_post",	"block_cache_refresh");
 add_action("edit_comment",	"block_cache_refresh");
-add_action("delete_comment","block_cache_refresh");
-add_action("delete_post",	"block_cache_refresh");
+add_action("wp_set_comment_status","block_cache_refresh"); //wp_delete_comment() at deleted
+add_action("deleted_post",	"block_cache_refresh");
 add_action("publish_post",	"block_cache_refresh");
 add_action("edit_post",		"block_cache_refresh");
 add_action("private_to_published",	"block_cache_refresh");
-add_action("wp_set_comment_status" , "block_cache_refresh");
+add_action("transition_post_status", "block_cache_refresh");
 
 add_action("the_content",	"set_post_views_count");
Index: trunk/wp-content/themes/xpress_default/index.php
===================================================================
--- trunk/wp-content/themes/xpress_default/index.php	(revision 95)
+++ trunk/wp-content/themes/xpress_default/index.php	(revision 96)
@@ -33,6 +33,16 @@
 				</div>
 
-				<p class="postmetadata"><!-- Post author start --><?php/* _e('Posted:', 'xpress'); echo '&nbsp;'; the_author_posts_link(); echo '<br />' ; */?><!-- Post author end --><?php if(function_exists('the_tags')) : ?><?php the_tags(__('Tags:', 'xpress') . ' ', ', ', '<br />'); ?><?php endif; ?><?php printf(__('Posted in %s', 'xpress'), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', 'xpress'), '', ' | '); ?>  <?php comments_popup_link(__('No Comments &#187;', 'xpress'), __('1 Comment &#187;', 'xpress'), __('% Comments &#187;', 'xpress'), '', __('Comments Closed', 'xpress') ); ?></p>
-				<?php xpress_post_views_count($post->id,__('Views :%d', 'xpress'),true) ?>
+				<p class="postmetadata"><!-- Post author start -->
+				<!-- Post author end -->
+				<?php
+					if(function_exists('the_tags'))
+						echo the_tags(__('Tags:', 'xpress') . ' ', ', ', '<br />');
+					printf(__('Posted in %s', 'xpress'), get_the_category_list(', '));
+					echo ' | ';
+					edit_post_link(__('Edit', 'xpress'), '', ' | ');
+					comments_popup_link(__('No Comments &#187;', 'xpress'), __('1 Comment &#187;', 'xpress'), __('% Comments &#187;', 'xpress'), '', __('Comments Closed', 'xpress') );
+				?>
+				</p>
+				<?php xpress_post_views_count($post->ID,__('Views :%d', 'xpress'),true) ?>
 
 				</div>
Index: trunk/wp-content/themes/xpress_default/searchform.php
===================================================================
--- trunk/wp-content/themes/xpress_default/searchform.php	(revision 95)
+++ trunk/wp-content/themes/xpress_default/searchform.php	(revision 96)
@@ -1,5 +1,5 @@
 <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
 <label class="hidden" for="s"><?php _e('Search for:', 'xpress'); ?></label>
-<div><input type="text" value="<?php if(function_exists('the_serch_query')) : ?><?php the_search_query(); ?><?php else : ?><?php echo attribute_escape($s); ?><?php endif; ?>" name="s" id="s" />
+<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
 <input type="submit" id="searchsubmit" value="<?php _e('Search', 'xpress'); ?>" />
 </div>
Index: trunk/xoops_version.php
===================================================================
--- trunk/xoops_version.php	(revision 95)
+++ trunk/xoops_version.php	(revision 96)
@@ -31,5 +31,5 @@
 $modversion['name'] = ucfirst($mydirname) . ' ' . constant('_MI_XPRESS_NAME') ;
 $modversion['description'] = constant( '_MI_XPRESS_DESC');
-$modversion['version'] = "0.04";
+$modversion['version'] = "0.05";
 $modversion['credits'] = "Wordpress DEV (http://wordpress.org/) XPressME DEV Toemon) (http://www.toemon.com) ;";
 $modversion['author'] = "toemon (http://www.toemon.com)";
@@ -40,5 +40,5 @@
 
 // status
-$modversion['codename'] = "r48";
+$modversion['codename'] = "fix notify";
 
 // onInstall, onUpdate, onUninstall
