Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php	(revision 262)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php	(revision 272)
@@ -1,5 +1,12 @@
 <?php
-function xpress_the_title($show = true)
-{
+function xpress_the_title($args = '')
+{
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+
 	$output = '<div class ="xpress-post-header">' . "\n";
 	
@@ -34,8 +41,8 @@
 	$output .= '</div>' . "\n";
 	
-	if (empty($show))
-		return $output;
-	else
-		echo $output;
+	if ($echo)
+		echo $output;
+	else
+		return $output;
 
 }
@@ -53,5 +60,12 @@
 }
 
-function xpress_selected_author($show=true ) {
+function xpress_selected_author($args ='' ) {
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+
 	$output = '';
   	$author_cookie = get_xpress_dir_name() . "_select_author" ;
@@ -61,11 +75,17 @@
   		$output = $user_info->display_name;
   	}
-	if (empty($show))
-		return $output;
-	else
-		echo $output;
+	if ($echo)
+		echo $output;
+	else
+		return $output;
 		
 }
-function xpress_selected_author_id($show=true ) {
+function xpress_selected_author_id($args ='' ) {
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
 	$output = '';
   	$author_cookie = get_xpress_dir_name() . "_select_author" ;
@@ -75,28 +95,29 @@
   		$output = '';
   	}
-	if (empty($show))
-		return $output;
-	else
-		echo $output;
-		
-}
-
-function xpress_now_user_level($show=true ) {
+	if ($echo)
+		echo $output;
+	else
+		return $output;		
+}
+
+function xpress_now_user_level($args ='' ) {
 	global $current_user;
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+	
 	$output = @$current_user->user_level;
-	if (empty($show))
-		return $output;
-	else
-		echo $output;		
-}
-
-
-function xpress_list_pings($trackback, $args, $depth) {
-       $GLOBALS['comment'] = $trackback;
-        echo '<li id="comment-<?php comment_ID(); ?>">';
-        comment_author_link();
-}
-	
-function xpress_credit($show = true)
+	if ($echo)
+		echo $output;
+	else
+		return $output;
+}
+
+
+	
+function xpress_credit($args ='')
 {
 	global $wp_version , $xoops_config;
@@ -105,29 +126,44 @@
 	}
 	
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+	
 	$xpress_version = $xoops_config->module_version;
 	$xpress_codename = $xoops_config->module_codename;
-	$ret = '<a href="http://ja.xpressme.info"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>';
+	$output = '<a href="http://ja.xpressme.info"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>';
 	if ($xoops_config->is_wpmu) {
-		$ret .= '(included <a href="http://mu.wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress MU ' . $wpmu_version . '</a>)';
+		$output .= '(included <a href="http://mu.wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress MU ' . $wpmu_version . '</a>)';
 	} else {
 		if (strstr($wp_version,'ME')){
-			$ret .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';
+			$output .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';
 		} else {
-			$ret .= '(included <a href="http://wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';
+			$output .= '(included <a href="http://wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';
 		}
 	}
-	if (empty($show))
-		return $ret;
-	else
-		echo $ret;
-}
-
-function xpress_convert_time($show = true)
-{
-	$ret =  timer_stop(0) .'sec. ';
-	if (empty($show))
-		return $ret;
-	else
-		echo $ret;
+	if ($echo)
+		echo $output;
+	else
+		return $output;
+}
+
+function xpress_convert_time($args ='')
+{
+	$defaults = array(
+		'echo' => 1,
+		'format' => '(%.3f sec.)'		
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+	
+	$output =  sprintf($format,timer_stop(0));
+	if ($echo)
+		echo $output;
+	else
+		return $output;
 }
 
@@ -138,7 +174,14 @@
 }	
 
-function xpress_left_arrow_post_link($show = true)
+function xpress_left_arrow_post_link($args ='')
 {
 	global $xpress_config;
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+	
 	$ret = '';
 		
@@ -191,15 +234,22 @@
 		$on_mouse_show = $body_matches[1];
 	}
-	$ret = str_replace('">','" title="'.$on_mouse_show . '">' , $ret);
-
-	if (empty($show))
-		return $ret;
-	else
-		echo $ret;
-}
-
-function xpress_right_arrow_post_link($show = true)
+	$output = str_replace('">','" title="'.$on_mouse_show . '">' , $ret);
+
+	if ($echo)
+		echo $output;
+	else
+		return $output;
+}
+
+function xpress_right_arrow_post_link($args ='')
 {
 	global $xpress_config;
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+
 	$ret = '';		
 	
@@ -252,16 +302,23 @@
 		$on_mouse_show = $body_matches[1];
 	}
-	$ret = str_replace('">','" title="'.$on_mouse_show . '">' , $ret);
-
-	if (empty($show))
-		return $ret;
-	else
-		echo $ret;	
+	$output = str_replace('">','" title="'.$on_mouse_show . '">' , $ret);
+
+	if ($echo)
+		echo $output;
+	else
+		return $output;
 }
 // page link
-function xpress_left_arrow_posts_link($show = true)
+function xpress_left_arrow_posts_link($args ='')
 {
 	global $xpress_config;
-	$ret = '';
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+
+	$output = '';
 		
 	if($xpress_config->is_left_page_navi_old){
@@ -269,5 +326,5 @@
 		ob_start();
 		next_posts_link("&laquo; $link_title");
-		$ret = ob_get_contents();
+		$output = ob_get_contents();
 		ob_end_clean();
 	} else {
@@ -275,18 +332,25 @@
 		ob_start();
 		previous_posts_link("&laquo; $link_title");
-		$ret = ob_get_contents();
-		ob_end_clean();
-	}
-
-	if (empty($show))
-		return $ret;
-	else
-		echo $ret;
-}
-
-function xpress_right_arrow_posts_link($show = true)
+		$output = ob_get_contents();
+		ob_end_clean();
+	}
+
+	if ($echo)
+		echo $output;
+	else
+		return $output;
+}
+
+function xpress_right_arrow_posts_link($args ='')
 {
 	global $xpress_config;
-	$ret = '';		
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+
+	$output = '';		
 	
 	if($xpress_config->is_left_page_navi_old){
@@ -294,5 +358,5 @@
 		ob_start();
 		previous_posts_link("$link_title &raquo;");
-		$ret = ob_get_contents();
+		$output = ob_get_contents();
 		ob_end_clean();
 	} else {
@@ -300,12 +364,12 @@
 		ob_start();
 		next_posts_link("$link_title &raquo;");
-		$ret = ob_get_contents();
-		ob_end_clean();
-	}
-
-	if (empty($show))
-		return $ret;
-	else
-		echo $ret;	
+		$output = ob_get_contents();
+		ob_end_clean();
+	}
+
+	if ($echo)
+		echo $output;
+	else
+		return $output;
 }
 
@@ -336,8 +400,17 @@
 // Set and retrieves post views given a post ID or post object. 
 // Retrieves post views given a post ID or post object. 
-function xpress_post_views_count($post_id=0,$format= '',$show = true) {
+function xpress_post_views_count($args ='') {
 	global $xoops_db,$wpdb;
 
 	static $post_cache_views;
+
+	$defaults = array(
+		'post_id' => 0,
+		'format'=> __('views :%d','xpressme'),
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
 
 	if ( empty($post_id) ) {
@@ -361,7 +434,10 @@
 	if (empty($format)) $format = __('views :%d','xpressme');
 	
-	$ret = sprintf($format,$v_count);
-
-	if ($show) echo $ret; else return $ret;
+	$output = sprintf($format,$v_count);
+
+	if ($echo)
+		echo $output;
+	else
+		return $output;
 }
 
@@ -466,7 +542,16 @@
 }
 
-function xpress_post_new_link($link_title = 'Post New',$display = true)
+function xpress_post_new_link($args ='')
 {
 	global $xoops_config;
+	
+	$defaults = array(
+		'link_title'=> 'Post New',
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+
 	
 	if ($xoops_config->wp_db_version  > 5000){
@@ -475,13 +560,20 @@
 		$output = '<a href="'. get_xpress_url() . '/wp-admin/post.php' . '">' . $link_title . '</a>';
 	}	
-	if ($display) 
-		echo $output;
-	else
-		return $output;
-}
-
-function xpress_conditional_title($display = true)
-{
-	$selected_author = xpress_selected_author(false);
+	if ($echo)
+		echo $output;
+	else
+		return $output;
+}
+
+function xpress_conditional_title($args ='')
+{
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+	
+	$selected_author = xpress_selected_author('echo=0');
 	
 	$output = __('Main', 'xpressme');
@@ -507,5 +599,5 @@
 	
 	if (!empty($selected_author)){
-		$selected_id = xpress_selected_author_id(false);
+		$selected_id = xpress_selected_author_id('echo=0');
 //		$output = get_avatar($selected_id,$size = '32') . sprintf(__('Article of %s', 'xpressme'), $selected_author) . ' - ' . $output;
 		if (empty($output))
@@ -514,11 +606,17 @@
 			$output = sprintf(__('Article of %s', 'xpressme'), $selected_author) . ' - ' . $output;
 	}	
-	if ($display) 
-		echo $output;
-	else
-		return $output;
-}
-
-function xpress_pings_list($show = true){
+	if ($echo)
+		echo $output;
+	else
+		return $output;
+}
+
+function xpress_pings_list($args =''){
+	$defaults = array(
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
 	
 	$trackbacks = xpress_get_pings();
@@ -539,8 +637,22 @@
 	}
 	
-	if ($show) echo $output; else return $output;
-}
-
-function xpress_pings_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
+	if ($echo)
+		echo $output;
+	else
+		return $output;
+}
+
+function xpress_pings_number( $args ='' ) {
+	$defaults = array(
+		'zero' => __('No Trackback/Pingback', 'xpressme'),
+		'one' => __('One Trackback/Pingback', 'xpressme'),
+		'more' => __('% TrackBack/Pingback', 'xpressme'),
+		'deprecated' => '',
+		'echo' => 1
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
+
 	$pings = xpress_get_pings();
 	if (empty($pings)){
@@ -550,11 +662,14 @@
 	}
 	if ( $number > 1 )
-		$output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% TrackBack/Pingback', 'xpressme') : $more);
+		$output = str_replace('%', number_format_i18n($number), $more);
 	elseif ( $number == 0 )
-		$output = ( false === $zero ) ? __('No Trackback/Pingback', 'xpressme') : $zero;
+		$output = $zero;
 	else // must be one
-		$output = ( false === $one ) ? __('One Trackback/Pingback', 'xpressme') : $one;
-
-	echo $output;
+		$output = $one;
+
+	if ($echo)
+		echo $output;
+	else
+		return $output;
 }
 
@@ -608,7 +723,15 @@
 }
 
-function xpress_get_calendar($sun_color = '#DB0000' ,$sat_color = '#004D99' ,$initial = true) {
+function xpress_get_calendar($args = '') {
 	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts , $xoops_config;
 
+	$defaults = array(
+		sun_color => '#DB0000',
+		sat_color => '#004D99',
+		initial => true
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	extract( $r );
 	if ($xoops_config->is_wp20){
 		ob_start();
