Index: /trunk/xpressme_integration_kit/admin/index.php
===================================================================
--- /trunk/xpressme_integration_kit/admin/index.php	(revision 582)
+++ /trunk/xpressme_integration_kit/admin/index.php	(revision 583)
@@ -36,6 +36,5 @@
 	$mydirname = basename(dirname(dirname(__FILE__)));
 	$my_dirpath = dirname(dirname(__FILE__));
-	$wp_prefix_only = $mydirname;
-	if ($wp_prefix_only == 'wordpress') $wp_prefix_only ='wp';
+	$wp_prefix_only = preg_replace('/wordpress/','wp',$mydirname);
 	$db_prefix = $xoopsDB->prefix($wp_prefix_only);
 
@@ -120,6 +119,5 @@
 	$mydirname = basename(dirname(dirname(__FILE__)));
 	$my_dirpath = dirname(dirname(__FILE__));
-	$prefix = $mydirname;
-	if ($prefix == 'wordpress') $prefix ='wp';
+	$prefix = preg_replace('/wordpress/','wp',$mydirname);
 	$wp_prefix = $xoopsDB->prefix($prefix);
 
@@ -540,7 +538,5 @@
 	
 	$xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
-	if ($xp_prefix == 'wordpress'){
-	 	$xp_prefix = 'wp';
-	}
+	$xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix);
 
 	$prefix = $xoopsDB->prefix($xp_prefix . '_');
@@ -614,7 +610,5 @@
 	$xoopsDB =& Database::getInstance();
 	$xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
-	if ($xp_prefix == 'wordpress'){
-	 	$xp_prefix = 'wp';
-	}
+	$xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix);
 	$prefix = $xoopsDB->prefix($xp_prefix . '_');
 	$group_role_tables = $prefix.'group_role';
Index: /trunk/xpressme_integration_kit/blocks/block_common.php
===================================================================
--- /trunk/xpressme_integration_kit/blocks/block_common.php	(revision 582)
+++ /trunk/xpressme_integration_kit/blocks/block_common.php	(revision 583)
@@ -23,9 +23,5 @@
     $mydirpath = dirname(dirname(__FILE__));
 	$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-	if ($mydirname == 'wordpress'){
-		$wp_prefix = 'wp_';
-	} else {
-		$wp_prefix = $mydirname . '_';
-	}
+	$wp_prefix = preg_replace('/wordpress/','wp',$mydirname) . '_';
 	$xoopsDB =& Database::getInstance();
 	$myts =& MyTextSanitizer::getInstance();
Index: /trunk/xpressme_integration_kit/blocks/widget_block.php
===================================================================
--- /trunk/xpressme_integration_kit/blocks/widget_block.php	(revision 582)
+++ /trunk/xpressme_integration_kit/blocks/widget_block.php	(revision 583)
@@ -23,10 +23,5 @@
 
 		$selected = explode(',' , $widget_select);
-
-		if ($mydirname == 'wordpress'){
-			$wp_prefix = 'wp_';
-		} else {
-			$wp_prefix = $mydirname . '_';
-		}
+		$wp_prefix = preg_replace('/wordpress/','wp',$mydirname) . '_';
 		$xoopsDB =& Database::getInstance();
 		$myts =& MyTextSanitizer::getInstance();
Index: /trunk/xpressme_integration_kit/class/config_from_xoops.class.php
===================================================================
--- /trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 582)
+++ /trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 583)
@@ -93,9 +93,5 @@
 		$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 . '_';
+		$this->module_db_prefix = $this->xoops_db_prefix  . '_' . preg_replace('/wordpress/','wp',$this->module_name) . '_';
 		
 		$this->set_module_version();
Index: /trunk/xpressme_integration_kit/class/xpressD3commentContent.class.php
===================================================================
--- /trunk/xpressme_integration_kit/class/xpressD3commentContent.class.php	(revision 582)
+++ /trunk/xpressme_integration_kit/class/xpressD3commentContent.class.php	(revision 583)
@@ -22,6 +22,5 @@
 			if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
 			
-			$xpress_prefix = $mydirname;
-			if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
+			$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
 
 			// query
@@ -74,6 +73,5 @@
 					if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
 					
-					$xpress_prefix = $mydirname;
-					if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
+					$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
 
 					// query
@@ -160,6 +158,5 @@
 			$post_id = intval( $link_id ) ;
 			$mydirname = $this->mydirname ;
-			$xpress_prefix = $mydirname;
-			if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
+			$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
 			
 			$db =& Database::getInstance() ;
@@ -199,6 +196,5 @@
 			if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
 			
-			$xpress_prefix = $mydirname;
-			if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
+			$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
 			
 			$table_term_relationships = $db->prefix($xpress_prefix."_term_relationships");
@@ -273,6 +269,5 @@
 
 			$mydirname = $this->mydirname ;
-			$xpress_prefix = $mydirname;
-			if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
+			$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
 			$d3f_forum_dir  = $this->d3forum_dirname;
 			
@@ -419,7 +414,5 @@
 		function get_wp_comment_ID($d3forum_post_ID){
 			$xp_prefix = $wpdirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-			if ($xp_prefix == 'wordpress'){
-				$xp_prefix = 'wp';
-			}
+			$xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix);
 			
 			$xoopsDB =& Database::getInstance();
Index: /trunk/xpressme_integration_kit/include/data.inc.php
===================================================================
--- /trunk/xpressme_integration_kit/include/data.inc.php	(revision 582)
+++ /trunk/xpressme_integration_kit/include/data.inc.php	(revision 583)
@@ -31,9 +31,5 @@
 	global $xoopsDB;
 
-	if ($mydirname == 'wordpress'){
-		$wp_prefix = 'wp';
-	} else {
-		$wp_prefix = $mydirname;
-	}
+	$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 	require_once (XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/include/general_functions.php');
 	include(XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/wp-includes/version.php');
@@ -163,10 +159,5 @@
 
 	global $xoopsDB;
-
-	if ($mydirname == 'wordpress'){
-		$wp_prefix = 'wp';
-	} else {
-		$wp_prefix = $mydirname;
-	}
+	$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 	require_once (XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/include/general_functions.php');
 	$prefix = $xoopsDB->prefix($wp_prefix);
@@ -208,10 +199,5 @@
 
 	global $xoopsDB;
-
-	if ($mydirname == 'wordpress'){
-		$wp_prefix = 'wp';
-	} else {
-		$wp_prefix = $mydirname;
-	}
+	$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 	
 	require_once (XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/include/general_functions.php');
Index: /trunk/xpressme_integration_kit/include/general_functions.php
===================================================================
--- /trunk/xpressme_integration_kit/include/general_functions.php	(revision 582)
+++ /trunk/xpressme_integration_kit/include/general_functions.php	(revision 583)
@@ -13,10 +13,6 @@
 		if (empty($mydirname))
 			$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-
-		if ($mydirname == 'wordpress'){
-			$wp_prefix = 'wp';
-		} else {
-			$wp_prefix = $mydirname;
-		}
+		
+		$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 
 		if (empty($xoops_db)) { // not load XPressME
@@ -56,9 +52,5 @@
 			$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
 
-		if ($mydirname == 'wordpress'){
-			$wp_prefix = 'wp';
-		} else {
-			$wp_prefix = $mydirname;
-		}
+		$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 
 		if (empty($xoops_db)) { // not load XPressME
Index: /trunk/xpressme_integration_kit/include/oninstall.php
===================================================================
--- /trunk/xpressme_integration_kit/include/oninstall.php	(revision 582)
+++ /trunk/xpressme_integration_kit/include/oninstall.php	(revision 583)
@@ -86,8 +86,5 @@
 	
 // create XPressME table
-	$xp_prefix = $mydirname;
-	if ($xp_prefix == 'wordpress'){
- 		$xp_prefix = 'wp';
-	}
+	$xp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 	$views_table = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_views' ;
 
Index: /trunk/xpressme_integration_kit/include/onuninstall.php
===================================================================
--- /trunk/xpressme_integration_kit/include/onuninstall.php	(revision 582)
+++ /trunk/xpressme_integration_kit/include/onuninstall.php	(revision 583)
@@ -25,8 +25,5 @@
 	$mid = $module->getVar('mid') ;
 	
-	$xp_prefix = $mydirname;
-	if ($xp_prefix == 'wordpress'){
-	 	$xp_prefix = 'wp';
-	}
+	$xp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 	
 	$xoops_prefix = $db->prefix();
Index: /trunk/xpressme_integration_kit/include/onupdate.php
===================================================================
--- /trunk/xpressme_integration_kit/include/onupdate.php	(revision 582)
+++ /trunk/xpressme_integration_kit/include/onupdate.php	(revision 583)
@@ -81,8 +81,5 @@
 function xpress_put_siteurl($mydirname,$url){
 		global $xoopsModule;
-		$wp_prefix = $mydirname;
-		if ($wp_prefix == 'wordpress'){
-			$wp_prefix = 'wp';
-		}
+		$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 		$xoopsDB =& Database::getInstance();
 		$db_xpress_option = $xoopsDB->prefix($wp_prefix . '_options');
@@ -96,8 +93,5 @@
 function xpress_put_home($mydirname,$url){
 		global $xoopsModule;
-		$wp_prefix = $mydirname;
-		if ($wp_prefix == 'wordpress'){
-			$wp_prefix = 'wp';
-		}
+		$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 		$xoopsDB =& Database::getInstance();
 		$db_xpress_option = $xoopsDB->prefix($wp_prefix . '_options');
@@ -111,8 +105,5 @@
 	function get_xpress_option($mydirname,$option_name){
 		global $xoopsModule;
-		$wp_prefix = $mydirname;
-		if ($wp_prefix == 'wordpress'){
-			$wp_prefix = 'wp';
-		}
+		$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 		$xoopsDB =& Database::getInstance();
 		$option_table = $xoopsDB->prefix($wp_prefix . '_options');
@@ -145,8 +136,5 @@
 function get_db_version($mydirname){
 		global $xoopsModule;
-		$wp_prefix = $mydirname;
-		if ($wp_prefix == 'wordpress'){
-			$wp_prefix = 'wp';
-		}
+		$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 		$xoopsDB =& Database::getInstance();
 		$db_xpress_option = $xoopsDB->prefix($wp_prefix . '_options');
@@ -192,16 +180,9 @@
 function xpress_table_make($module, $mydirname)
 {
-	$xp_prefix = $mydirname;
-	if ($xp_prefix == 'wordpress'){
-	 	$xp_prefix = 'wp';
-	}
 	$db =& Database::getInstance() ;
 	$mid = $module->getVar('mid') ;
 
 // XPressME orignal table update
-	$xp_prefix = $mydirname;
-	if ($xp_prefix == 'wordpress'){
-	 	$xp_prefix = 'wp';
-	}
+	$xp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 	$msgs = array();
 
@@ -307,9 +288,5 @@
 		
 		$xoopsDB =& Database::getInstance();
-		if ($mydirname == 'wordpress'){
-			$xpress_prefix=  $xoopsDB->prefix('wp_');
-		} else {
-			$xpress_prefix=  $xoopsDB->prefix($mydirname . '_');
-		}
+		$xpress_prefix = $xoopsDB->prefix(preg_replace('/wordpress/','wp',$mydirname) . '_');
 		$db_enhanced = $xpress_prefix . $table_name;
 
Index: /trunk/xpressme_integration_kit/include/search.php
===================================================================
--- /trunk/xpressme_integration_kit/include/search.php	(revision 582)
+++ /trunk/xpressme_integration_kit/include/search.php	(revision 583)
@@ -20,8 +20,5 @@
 		$myts =& MyTextSanitizer::getInstance();
 		
-		$xp_prefix = $mydirname;
-		if ($xp_prefix == 'wordpress'){
-	 		$xp_prefix = 'wp';
-		}
+		$xp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 		if ($userid) {
 			$wp_uid = xoops_uid_to_wp_uid(intval($userid),$mydirname);
Index: /trunk/xpressme_integration_kit/include/sitemap.plugin.php
===================================================================
--- /trunk/xpressme_integration_kit/include/sitemap.plugin.php	(revision 582)
+++ /trunk/xpressme_integration_kit/include/sitemap.plugin.php	(revision 583)
@@ -30,6 +30,5 @@
 		$disp_sub =@$sitemap_configs["show_subcategoris"];
 		
-		$prefix = $mydirname;
-		if ($prefix == 'wordpress') $prefix ='wp';
+		$prefix = preg_replace('/wordpress/','wp',$mydirname);
 		$prefix = $xoopsDB->prefix($prefix);
 		require_once (XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/include/general_functions.php');
Index: /trunk/xpressme_integration_kit/include/xpress_block_render.php
===================================================================
--- /trunk/xpressme_integration_kit/include/xpress_block_render.php	(revision 582)
+++ /trunk/xpressme_integration_kit/include/xpress_block_render.php	(revision 583)
@@ -84,6 +84,5 @@
 		if (is_null($wpdb)){
 			$xoopsDB =& Database::getInstance();
-			$wp_prefix = $mydirname;
-			if ($wp_prefix == 'wordpress') $wp_prefix = 'wp';
+			$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 
 			$module_tbl = $xoopsDB->prefix($wp_prefix).'_options';	
Index: /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/xpress_common_functions.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/xpress_common_functions.php	(revision 582)
+++ /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/xpress_common_functions.php	(revision 583)
@@ -38,6 +38,5 @@
 {
 	$dir_name = get_xpress_dir_name();
-	$prefix = $dir_name;
-	if ($prefix == 'wordpress') $prefix = 'wp';
+	$prefix = preg_replace('/wordpress/','wp',$dir_name);
 	
 	$prefix = $prefix . '_';
Index: /trunk/xpressme_integration_kit/xoops_version.php
===================================================================
--- /trunk/xpressme_integration_kit/xoops_version.php	(revision 582)
+++ /trunk/xpressme_integration_kit/xoops_version.php	(revision 583)
@@ -88,8 +88,5 @@
 //$modversion['sqlfile']['mysql'] = "sql/mysql.sql";
 
-$db_prefix = $mydirname;
-if ($mydirname == 'wordpress') {
-	$db_prefix = 'wp';
-}
+$db_prefix = preg_replace('/wordpress/','wp',$mydirname);
 
 /*
