Index: trunk/include/config_from_xoops.class.php
===================================================================
--- trunk/include/config_from_xoops.class.php	(revision 93)
+++ trunk/include/config_from_xoops.class.php	(revision 95)
@@ -26,8 +26,13 @@
 	var $module_path;
 	var $module_url;
+	var $module_db_prefix;
+	var $xoops_upload_path;
+	var $xoops_upload_url;
+	
 	
 	function __constructor()	//for PHP5
     {
         $this->ConfigFromXoops();
+       
     }
 
@@ -89,4 +94,14 @@
 			}
 		}
+		
+		//  define from /settings/definition.inc.php (XCL)  or /include/common.php(2016a-JP)
+		$this->xoops_upload_path = $this->xoops_root_path .'/uploads';
+		$this->xoops_upload_url = $this->xoops_url . '/uploads';
+		
+		if ($this->module_name == 'wordpress')
+			$this->module_db_prefix =  $this->xoops_db_prefix  . '_wp_';
+		else
+			$this->module_db_prefix =  $this->xoops_db_prefix  . '_' . $this->module_name . '_';
+		
     }
     
Index: trunk/include/include_xoops_define.php
===================================================================
--- trunk/include/include_xoops_define.php	(revision 93)
+++ 	(revision )
@@ -1,44 +1,0 @@
-<?php
-/*
- * XPressME - WordPress for XOOPS
- *
- * @copyright	XPressME Project http://www.toemon.com
- * @license		http://www.fsf.org/copyleft/gpl.html GNU public license
- * @author		toemon
- * @package		module::xpress
- */
-
-/* 
- *	The module loads the XOOPS system only at the time of reading to route index.php. 
- *
- *	When "Media up-loading" is executed, WordPress calls the SWFUpload script. 
- *	After completing up-loading
- *	The SWFUpload script executes wp-admin/async-upload.php. 
- *	At this time, session ID is not succeeded to. 
- *	And, admin/async-upload.php becomes an access inhibit when wordpress is under the management of XOOPS. 
- */
-
-require_once dirname( __FILE__ ).'/specfic_on_call_page.php' ;
-
-
-if (is_wp_cron_call() ){
-	$_SERVER['HTTP_REFERER'] = 'http://'. $_SERVER[HTTP_HOST]  . $_SERVER['PHP_SELF'];
-	$_SERVER['REQUEST_METHOD'] = 'POST';
-}
-
-if (is_media_upload_page_call() ){
-	if ( !defined("XOOPS_ROOT_PATH") ) {
-		//Module process will not load any XOOPS Cube classes.
-		define('_LEGACY_PREVENT_EXEC_COMMON_', 1);		// for XCL
-		$xoopsOption['nocommon'] = 1;					// for XOOPS
-		include_once dirname( __FILE__ ).'/../../../mainfile.php';
-	}
-	if (!defined("XOOPS_UPLOAD_PATH"))
-		define("XOOPS_UPLOAD_PATH", XOOPS_ROOT_PATH."/uploads");
-	if (!defined("XOOPS_UPLOAD_URL"))
-		define("XOOPS_UPLOAD_URL", XOOPS_URL."/uploads");
-} else {
-	// index page is load xoops
-	require dirname( __FILE__ ).'/../../../mainfile.php' ;
-}
-?>
Index: trunk/include/notification.inc.php
===================================================================
--- trunk/include/notification.inc.php	(revision 93)
+++ trunk/include/notification.inc.php	(revision 95)
@@ -1,12 +1,6 @@
 <?php
-
-function xpress_notify_info( $category , $item_id )
+function xpress_notify( $category , $item_id )
 {
-	$db =& Database::getInstance() ;
 	$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-
-
-//	$module_handler =& xoops_gethandler( 'module' ) ;
-//	$module =& $module_handler->getByDirname( $mydirname ) ;
 
 	if( $category == 'global' ) {
Index: trunk/include/notification.inc.sub.php
===================================================================
--- trunk/include/notification.inc.sub.php	(revision 93)
+++ 	(revision )
@@ -1,146 +1,0 @@
-<?php
-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/notification.inc.sub.php.delete
===================================================================
--- trunk/include/notification.inc.sub.php.delete	(revision 95)
+++ trunk/include/notification.inc.sub.php.delete	(revision 95)
@@ -0,0 +1,153 @@
+<?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/request_url.php
===================================================================
--- trunk/include/request_url.php	(revision 95)
+++ trunk/include/request_url.php	(revision 95)
@@ -0,0 +1,51 @@
+<?php
+/*
+ * XPressME - WordPress for XOOPS
+ *
+ * @copyright	XPressME Project http://www.toemon.com
+ * @license		http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author		toemon
+ * @package		module::xpress
+ */
+
+/* 
+ * There is a function that detects the kind of the page that the access is here. 
+ */
+function check_page_call($check_file =''){
+	global $xoops_config;
+	if (empty($check_file)) return false;
+	$xpress_page = 	$xoops_config->module_name . '/' . $check_file;
+	$php_script_name = $_SERVER['SCRIPT_NAME'];
+	$php_query_string = $_SERVER['QUERY_STRING'];
+	if (strstr($php_script_name,$xpress_page) === false) return false;
+	if ($check_file !== 'index.php' ) return true;
+	if (strstr($php_query_string,'preview') === false) return true;
+	return false;
+}
+
+function is_xpress_index_page_call(){
+	return check_page_call('index.php');
+}
+
+function is_admin_page_call(){
+	return check_page_call('wp-admin');
+}
+
+function is_media_upload_page_call(){
+	return check_page_call('wp-admin/async-upload.php');
+}
+
+function is_wp_cron_page_call(){
+	return check_page_call('wp-cron.php');
+}
+
+function is_xmlrpc_call(){
+	$ret =  check_page_call('xmlrpc.php');
+
+	$xmlrpc_debug = 0;
+	if ($xmlrpc_debug && $ret) {
+		xpress_debug_message('is_xmlrpc_call()'. "\n" . sprint_r($_SERVER) );
+	}
+	return $ret;
+}
+?>
Index: trunk/include/set_cash_cookie_path.php
===================================================================
--- trunk/include/set_cash_cookie_path.php	(revision 93)
+++ trunk/include/set_cash_cookie_path.php	(revision 95)
@@ -50,5 +50,5 @@
  */
 if ( !defined('COOKIEPATH') )
-	define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', XOOPS_URL . '/' ) );
+	define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', $xoops_config->xoops_url . '/' ) );
 
 /**
@@ -57,5 +57,5 @@
  */
 if ( !defined('SITECOOKIEPATH') )
-	define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', XOOPS_URL . '/' ) );
+	define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', $xoops_config->xoops_url  . '/' ) );
 
 /**
Index: trunk/include/specfic_on_call_page.php
===================================================================
--- trunk/include/specfic_on_call_page.php	(revision 93)
+++ 	(revision )
@@ -1,74 +1,0 @@
-<?php
-/*
- * XPressME - WordPress for XOOPS
- *
- * @copyright	XPressME Project http://www.toemon.com
- * @license		http://www.fsf.org/copyleft/gpl.html GNU public license
- * @author		toemon
- * @package		module::xpress
- */
-
-/* 
- * There is a function that detects the kind of the page that the access is here. 
- */
-
-function is_xpress_index_page_call(){
-	$xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/index.php';
-	$php_script_name = $_SERVER['SCRIPT_NAME'];
-	$php_query_string = $_SERVER['QUERY_STRING'];
-	if (strstr($php_script_name,$xpress_root_index) !== false) {
-		if (strstr($php_query_string,'preview') === false) return true; else return false;;
-	} else  {
-		return false;
-	}
-}
-
-function is_admin_page_call(){
-	$xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/wp-admin';
-	$php_script_name = $_SERVER['SCRIPT_NAME'];
-	if (strstr($php_script_name,$xpress_root_index) !== false) return true; else  return false;
-}
-
-function is_media_upload_page_call(){
-	$xpress_root_indexs[0] = basename(dirname(dirname( __FILE__ ))) . '/wp-admin/async-upload.php';
-	$php_script_name = $_SERVER['SCRIPT_NAME'];
-	foreach ($xpress_root_indexs as $xpress_root_index) {
-		if (strstr($php_script_name,$xpress_root_index) !== false) return true;
-	}
-	return false;
-}
-
-function is_xmlrpc_call(){
-
-	$xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/xmlrpc.php';
-	$php_script_name = $_SERVER['SCRIPT_NAME'];
-	if(strstr($php_script_name,$xpress_root_index) !== false) $ret = true; else  $ret = false;
-	$xmlrpc_debug = 0;
-	
-
-	if ($xmlrpc_debug) {
-		$_debug_file = './wp-content/debug.log';
-		$log_data = '';
-		$log_data .= 'is_xmlrpc_call()***********************************************************************'. "\n";
-		if ($ret) $ret_val = 'true'; else $ret_val = 'false';
-		$log_data .= 'return value = ' . $ret_val . "\n";
-		
-		foreach($_SERVER as $key => $value){
-			$log_data .= $key . ' = ' . $value . "\n";
-		}
-
-		$_fp = fopen($_debug_file, 'a');
-		fwrite($_fp, $log_data);
-		fwrite($_fp, "\n\n");
-		fclose($_fp);		
-	}
-	return $ret;
-}
-
-function is_wp_cron_call(){
-	$xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/wp-cron.php';
-	$php_script_name = $_SERVER['SCRIPT_NAME'];
-	if (strstr($php_script_name,$xpress_root_index) !== false) return true; else  return false;
-}
-
-?>
Index: trunk/include/xpress_block_render.php
===================================================================
--- trunk/include/xpress_block_render.php	(revision 93)
+++ trunk/include/xpress_block_render.php	(revision 95)
@@ -62,11 +62,12 @@
 	function get_block_stylesheet_url($mydirname)
 	{
-		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+		global $xoops_config;
+		$mydirpath = $xoops_config->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';
+			return $xoops_config->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';
+			return $xoops_config->xoops_url . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/style.css';
 	}
 
@@ -88,10 +89,11 @@
 	function get_block_file_path($mydirname,$file_name)
 	{
-		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
+		global $xoops_config;
+		$mydirpath = $xoops_config->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;
+			$block_file =  $xoops_config->xoops_root_path . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/' . $file_name;
 		return $block_file;
 	}
Index: trunk/include/xpress_cache.php
===================================================================
--- trunk/include/xpress_cache.php	(revision 93)
+++ trunk/include/xpress_cache.php	(revision 95)
@@ -4,5 +4,6 @@
     function xpress_cache_read($mydirname,$collation_key)
     {
-		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+    	global $xoops_config;
+		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
 		$cache_time = 0;
         $filename = $cache_dir .$mydirname . '_' . $collation_key;
@@ -19,5 +20,6 @@
     function xpress_cache_write($mydirname,$collation_key,$content)
     {
-		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+		global $xoops_config;
+		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
 		$cache_time = 0;
 
@@ -35,5 +37,6 @@
     function xpress_cache_clear($mydirname)
     {
-		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+		global $xoops_config;
+		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
 		$cache_time = 0;
         if ($dh = opendir($cache_dir)) {
Index: trunk/include/xpress_debug_log.php
===================================================================
--- trunk/include/xpress_debug_log.php	(revision 95)
+++ trunk/include/xpress_debug_log.php	(revision 95)
@@ -0,0 +1,59 @@
+<?php
+if (!function_exists('xpress_debug')) {
+	function xpress_debug($title = '',$ditail_show = false)
+	{
+		$module_dirpath = dirname(dirname(__FILE__));
+		$root_path = dirname(dirname(dirname(dirname(__FILE__))));
+		$_debug_file = $module_dirpath . '/wp-content/xpress_debug.log';
+		$_fp = fopen($_debug_file, 'a');
+		$stamp = date("Y/m/d G:i:s" , time());
+		$backtraces = array_reverse(debug_backtrace());
+		fwrite($_fp, "\n*********************************************************************************************************\n");
+		fwrite($_fp, $title . '(' . $stamp . ")\n");
+		fwrite($_fp, '$_SERVER[]' . "\n");	
+		$srerver = "\t" . str_replace("\n","\n\t",sprint_r($_SERVER));
+		fwrite($_fp, $srerver . "\n\n");
+
+		fwrite($_fp, "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;
+
+		$trace_ditail = "\t" . str_replace("\n","\n\t\t",sprint_r($backtrace));
+		if ($ditail_show)
+			fwrite($_fp, $trace . $trace_ditail . "\n");
+		else
+			fwrite($_fp, $trace . "\n");
+		}
+		fclose($_fp);
+	}
+}
+
+if (!function_exists('xpress_debug_message')) {
+	function xpress_debug_message($message = '')
+	{
+		$module_dirpath = dirname(dirname(__FILE__));
+		$root_path = dirname(dirname(dirname(dirname(__FILE__))));
+		$_debug_file = $module_dirpath . '/wp-content/xpress_debug.log';
+		$_fp = fopen($_debug_file, 'a');
+		$stamp = date("Y/m/d G:i:s" , time());
+		fwrite($_fp, "\n*********************************************************************************************************\n");
+		fwrite($_fp, '(' . $stamp . ")\n");
+		fwrite($_fp, $message . "\n");	
+		fclose($_fp);
+	}
+}
+
+if (!function_exists('sprint_r')) {
+    function sprint_r($var) {
+             ob_start();
+             print_r($var);
+             $ret = ob_get_contents();
+             ob_end_clean();
+      return $ret;
+    }
+}
+?>
