Everyday Pieces ::
  • Webサービス
  • ブログパーツ
  1. ホーム
  2. WordPress

Counterize II を3.0に更新

2011年5月26日 WordPress

更新できるよ、
ってなってたんでやってみました。
メジャー番号が2から3になりましたね。

Windows7などのOS名やChromeなどのブラウザ名を
ちゃんと認識できるようになったみたい。

んで、以前やったようにカスタマイズ。
・昨日のぶんのアクセス数を表示させるための関数を追加
・管理画面でIPやホスト名を表示させるように調整

counterize.php と counterize_install.php に手を加えました。
個人的な忘備のために差分を書いておきます。

$ diff counterize_org.php counterize.php
166a167,176
> // Returns amount of hits yesterday
> function counterize_gethitsyesterday()
> {
> 	global $wpdb;
> 	$today = date("Y-m-d");
> 	$yesterday = date("Y-m-d",strtotime("-1 day"));
> 	$sql = "SELECT COUNT(1) FROM ".counterize_logTable()." WHERE timestamp >= '$yesterday' AND timestamp < '$today'";
> 	return $wpdb->get_var($sql);
> }
> 
498a509,517
> // Returns amount of unique hits yesterday
> function counterize_getuniquehitsyesterday()
> {
> 	global $wpdb;
> 	$today = date("Y-m-d");
> 	$yesterday = date("Y-m-d",strtotime("-1 day"));
> 	$sql = "SELECT count(DISTINCT ip) FROM ".counterize_logTable()." WHERE timestamp >= '$yesterday' AND timestamp < '$today'";
> 	return $wpdb->get_var($sql);
> }
781c800
< 		$sql .= "'" . substr( md5($wpdb->escape( $remoteaddr ) ), 1, 16) . "',";
---
> 		$sql .= "'" . $wpdb->escape( $remoteaddr ) . "',";
1154a1174
> 			
1171a1192
> 			ip, '
', @gethostbyaddr($entry->ip); ?>
$ diff counterize_install_org.php counterize_install.php
184c184
< 
---
> 		/*
190c190
< 
---
> 		*/
関連記事
Counterize II をカスタマイズ Counterize II を導入

コメントする キャンセル

アドレスが公開されることはありません。が付いている欄は必須項目です。

投稿ナビゲーション

WordPressのプラグインをいろいろ追加
あんずボー

カテゴリー

WordPress つぶやき トピック プログラミング

タグ

AS3 enchant.js FamilyTreeVis Flash Geolocation gif.js kinect Linux MMD MoneyTrackNote notifier.js OpenCV PDFカレンダー RISC-V three.js セキュリティ テーマ自作 ブログパーツ 動物 動画 麻雀

アーカイブ

© Everyday Pieces ::