Index: /trunk/wp-content/plugins/xpressme/include/custom_functions.php
===================================================================
--- /trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 50)
+++ /trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 51)
@@ -80,5 +80,5 @@
 		return $ret;
 	else
-		echo $ret;	
+		echo $ret;
 }
 
@@ -133,4 +133,10 @@
 		echo $ret;	
 }
+
+function xpress_is_author_view_count(){
+	$config = new XPressME_Class();
+	return $config->is_author_view_count;
+}
+
 function xpress_substr($str, $start, $length, $trimmarker = '...')
 {
@@ -208,3 +214,85 @@
 }
 
+// views count
+// 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) {
+	global $table_prefix;
+
+	static $post_cache_views;
+
+	if ( empty($post_id) ) {
+		if ( isset($GLOBALS['post']) )
+			$post_id = $GLOBALS['post']->ID;
+	}
+
+	$post_id = intval($post_id);
+	if($post_id==0) return null;
+	if(!isset($post_cache_views[$post_id])){
+        $sql = "SELECT post_views FROM " . $table_prefix . "views" . " WHERE post_id=$post_id";
+        if (!$result = $GLOBALS["xoopsDB"]->query($sql)) {
+	        $post_cache_views[$post_id] = 0;
+        }else{
+	        $row = $GLOBALS["xoopsDB"]->fetchArray($result);
+	        $post_cache_views[$post_id] = $row["post_views"];
+        }
+	}
+	$v_count = intval($post_cache_views[$post_id]);
+	
+	if (empty($format)) $format = __('views :%d','xpressme');
+	
+	$ret = sprintf($format,$v_count);
+
+	if ($show) echo $ret; else return $ret;
+}
+
+function set_post_views_count(&$content) {
+	if ( empty($_GET["feed"]) &&  empty($GLOBALS["feed"]) && empty($GLOBALS["doing_trackback"]) && empty($GLOBALS["doing_rss"]) && empty($_POST) && is_single() ){
+		post_views_counting();
+	}
+	return $content;
+}
+
+// Set post views given a post ID or post object. 
+function post_views_counting($post_id = 0) {
+	global $table_prefix;
+	static $views;
+	
+	$post_id = intval($post_id);
+	if ( empty($post_id) && isset($GLOBALS['post']) ){
+		$post_id = $GLOBALS['post']->ID;
+	}
+
+
+	$views_db = $table_prefix . "views";
+
+	if($post_id==0 || !empty($views[$post_id])) return null;
+	
+	if(!xpress_is_author_view_count()){
+		$current_user_id = $GLOBALS['current_user']->ID;
+		$post_author_id = $GLOBALS['post']->post_author;
+		if ($current_user_id ==$post_author_id) return null;
+	}
+
+    $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){
+        $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;
+    }
+    
+	return true;
+}
+
+
 ?>
Index: /trunk/wp-content/plugins/xpressme/language/xpressme-ja.po
===================================================================
--- /trunk/wp-content/plugins/xpressme/language/xpressme-ja.po	(revision 50)
+++ /trunk/wp-content/plugins/xpressme/language/xpressme-ja.po	(revision 51)
@@ -3,5 +3,5 @@
 "Project-Id-Version: fckeditor for xpress\n"
 "POT-Creation-Date: \n"
-"PO-Revision-Date: 2008-12-17 09:50+0900\n"
+"PO-Revision-Date: 2008-12-27 17:37+0900\n"
 "Last-Translator: toemon <toychee@toemon.com>\n"
 "Language-Team: \n"
@@ -12,95 +12,106 @@
 "X-Poedit-Country: JAPAN\n"
 "X-Poedit-KeywordsList: _e;__\n"
-"X-Poedit-Basepath: C:\\xampp\\htdocs\\cube\\modules\\xpress2\\wp-content\\plugins\\xpressme\n"
+"X-Poedit-Basepath: C:\\xampp\\htdocs\\cube\\modules\\xpress2x\\wp-content\\plugins\\xpressme\n"
 "X-Poedit-SearchPath-0: .\n"
 
-#: xpressme_class.php:25
+#: xpressme_class.php:26
 msgid "XPressME Settings"
 msgstr "XPressME設定"
 
-#: xpressme_class.php:42
-#: xpressme_class.php:81
+#: xpressme_class.php:43
+#: xpressme_class.php:89
 msgid "to Old Post"
 msgstr "前の投稿へ"
 
-#: xpressme_class.php:43
-#: xpressme_class.php:83
+#: xpressme_class.php:44
+#: xpressme_class.php:91
 msgid "to Newer Post"
 msgstr "次の投稿へ"
 
-#: xpressme_class.php:88
-#: xpressme_class.php:148
-#: xpressme_class.php:153
+#: xpressme_class.php:97
+#: xpressme_class.php:157
+#: xpressme_class.php:162
+#: xpressme_class.php:183
 msgid "YES"
 msgstr "はい"
 
-#: xpressme_class.php:89
-#: xpressme_class.php:149
-#: xpressme_class.php:154
+#: xpressme_class.php:98
+#: xpressme_class.php:158
+#: xpressme_class.php:163
+#: xpressme_class.php:184
 msgid "NO"
 msgstr "いいえ"
 
-#: xpressme_class.php:138
+#: xpressme_class.php:147
 msgid "XPressME Configuration Page"
 msgstr "XPressMEの設定ページ"
 
-#: xpressme_class.php:142
+#: xpressme_class.php:151
 msgid "Media Upload Base Path"
 msgstr "メディアアップロードのベースパス設定"
 
-#: xpressme_class.php:143
+#: xpressme_class.php:152
 msgid "Use XOOPS UPLOAD PATH"
 msgstr "XOOPSのアップロードパスを使用する。"
 
-#: xpressme_class.php:144
+#: xpressme_class.php:153
 msgid "USE WordPress BASE_PATH"
 msgstr "WordPressのベースパスを使用する。"
 
-#: xpressme_class.php:147
+#: xpressme_class.php:156
 msgid "Thema Sidebar Display"
 msgstr "テーマ表示時にサイドバー表示する。"
 
-#: xpressme_class.php:152
+#: xpressme_class.php:161
 msgid "The change tracking of the post is preserved"
 msgstr "投稿の変更履歴を有効にする。"
 
-#: xpressme_class.php:157
+#: xpressme_class.php:166
 msgid "Select Display name of PostNavi Link"
 msgstr "投稿記事リンクナビのタイトル設定"
 
-#: xpressme_class.php:158
+#: xpressme_class.php:167
 msgid "Title of post"
 msgstr "投稿記事のタイトルを表示"
 
-#: xpressme_class.php:159
+#: xpressme_class.php:168
 msgid "Next and Previous"
 msgstr "[次の投稿へ]、[前の投稿]へを表示"
 
-#: xpressme_class.php:162
+#: xpressme_class.php:171
 msgid "Adjustment of Navi link display position"
 msgstr "投稿記事ナビリンクの表示位置設定"
 
-#: xpressme_class.php:163
+#: xpressme_class.php:172
 msgid "'Old Post Link' is displayed in the left, and 'Newer Post Link' is displayed in the right"
 msgstr "古い記事へのリンクを左に、より新しい記事へのリンクを右に表示"
 
-#: xpressme_class.php:164
+#: xpressme_class.php:173
 msgid "'Newer Post Link' is displayed in the left, and 'Old Post Link' is displayed in the right"
 msgstr "より新しい記事へのリンクを左に、古い記事へのリンクを右に表示"
 
-#: xpressme_class.php:167
+#: xpressme_class.php:176
 msgid "Display Title of Old Post Link"
 msgstr "古い記事へのリンクタイトルを設定"
 
-#: xpressme_class.php:170
+#: xpressme_class.php:179
 msgid "Display Title of Newer Post Link"
 msgstr "より新しい記事へのリンクタイトルを設定"
 
-#: xpressme_class.php:178
+#: xpressme_class.php:182
+msgid "Is the posts author views counted?"
+msgstr "投稿者自身の閲覧をカウントしますか？"
+
+#: xpressme_class.php:190
 msgid "Update Config"
 msgstr "更新"
 
-#: xpressme_class.php:179
+#: xpressme_class.php:191
 msgid "Preset Config"
 msgstr "プリセット"
 
+#: include/custom_functions.php:242
+#, php-format
+msgid "views :%d"
+msgstr "閲覧数 :%d"
+
Index: /trunk/wp-content/plugins/xpressme/xpressme.php
===================================================================
--- /trunk/wp-content/plugins/xpressme/xpressme.php	(revision 50)
+++ /trunk/wp-content/plugins/xpressme/xpressme.php	(revision 51)
@@ -35,4 +35,7 @@
 add_action("wp_set_comment_status" , "block_cache_refresh");
 
+add_action("the_content",	"set_post_views_count");
+
+
 //require_once('../include/custom_functions.php');
 ?>
Index: /trunk/wp-content/plugins/xpressme/xpressme_class.php
===================================================================
--- /trunk/wp-content/plugins/xpressme/xpressme_class.php	(revision 50)
+++ /trunk/wp-content/plugins/xpressme/xpressme_class.php	(revision 51)
@@ -12,4 +12,5 @@
 	var $old_post_link_text;
 	var $newer_post_link_text;
+	var $is_author_view_count;
 
 	//constructor
@@ -42,4 +43,5 @@
 		$this->old_post_link_text = __('to Old Post');
 		$this->newer_post_link_text = __('to Newer Post');
+		$this->is_author_view_count = false;
 	}
 	
@@ -67,5 +69,6 @@
 			'is_left_postnavi_old' => $this->is_left_postnavi_old ,
 			'old_post_link_text' => $this->old_post_link_text ,
-			'newer_post_link_text' => $this->newer_post_link_text 
+			'newer_post_link_text' => $this->newer_post_link_text,
+			'is_author_view_count' => $this->is_author_view_count
 		);
 		if ($mode == 'add_new') {
@@ -87,4 +90,5 @@
 		$this->newer_post_link_text = stripslashes($_POST['ch_newer_post_link_text']);
 		if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('to Newer Post');
+		$this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count']));
 		
 	}
@@ -174,7 +178,10 @@
 		echo				$this->text_option('newer_post_link_text',
 												__('Display Title of Newer Post Link','xpressme')
-												);
-		
-			
+												);		
+		echo				$this->yes_no_radio_option('is_author_view_count',
+												__('Is the posts author views counted?','xpressme'),
+												__('YES','xpressme'),
+												__('NO','xpressme')		
+												);				
 //		$this->is_use_xoops_upload_path_html();
 		echo			"</table>\n";
Index: /trunk/wp-content/themes/xpress_default/index.php
===================================================================
--- /trunk/wp-content/themes/xpress_default/index.php	(revision 50)
+++ /trunk/wp-content/themes/xpress_default/index.php	(revision 51)
@@ -3,5 +3,5 @@
        <div id="xpress_wrap">
 	   
-	<?php if(xpress_is_theme_sidebar_disp()) : ?>
+	<?php if(is_sidbar_disp()) : ?>
 	   
 		<div id="xpress_content" class="narrowcolumn">
@@ -30,9 +30,10 @@
 
 				<div class="entry">
-					<?php the_content(__('Read the rest of this entry &raquo;', 'kubrick')); ?>
+					<?php wp_the_content(); ?>
 				</div>
 
 				<p class="postmetadata"><!-- Post author start --><?php/* _e('Posted:', 'kubrick'); echo '&nbsp;'; the_author_posts_link(); echo '<br />' ; */?><!-- Post author end --><?php if(function_exists('the_tags')) : ?><?php the_tags(__('Tags:', 'kubrick') . ' ', ', ', '<br />'); ?><?php endif; ?><?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>  <?php comments_popup_link(__('No Comments &#187;', 'kubrick'), __('1 Comment &#187;', 'kubrick'), __('% Comments &#187;', 'kubrick'), '', __('Comments Closed', 'kubrick') ); ?></p>
-			</div>
+				<?php sprintf('Views: %d',xpress_post_views_count(the_ID()); ?>
+				</div>
 
 		<?php endwhile; ?>
