WP-UserOnline - Version 2.62

Version Description

(2010-03-07) = * fix integration with WP-Stats * fix error with get_admin_page_title()

Download this release

Release Info

Developer scribu
Plugin Icon WP-UserOnline
Version 2.62
Comparing to
See all releases

Code changes from version 2.50 to 2.62

Files changed (265) hide show
  1. admin.php +258 -0
  2. images/flags/ad.png +0 -0
  3. images/flags/ae.png +0 -0
  4. images/flags/af.png +0 -0
  5. images/flags/ag.png +0 -0
  6. images/flags/ai.png +0 -0
  7. images/flags/al.png +0 -0
  8. images/flags/am.png +0 -0
  9. images/flags/an.png +0 -0
  10. images/flags/ao.png +0 -0
  11. images/flags/ar.png +0 -0
  12. images/flags/as.png +0 -0
  13. images/flags/at.png +0 -0
  14. images/flags/au.png +0 -0
  15. images/flags/aw.png +0 -0
  16. images/flags/ax.png +0 -0
  17. images/flags/az.png +0 -0
  18. images/flags/ba.png +0 -0
  19. images/flags/bb.png +0 -0
  20. images/flags/bd.png +0 -0
  21. images/flags/be.png +0 -0
  22. images/flags/bf.png +0 -0
  23. images/flags/bg.png +0 -0
  24. images/flags/bh.png +0 -0
  25. images/flags/bi.png +0 -0
  26. images/flags/bj.png +0 -0
  27. images/flags/bm.png +0 -0
  28. images/flags/bn.png +0 -0
  29. images/flags/bo.png +0 -0
  30. images/flags/br.png +0 -0
  31. images/flags/bs.png +0 -0
  32. images/flags/bt.png +0 -0
  33. images/flags/bv.png +0 -0
  34. images/flags/bw.png +0 -0
  35. images/flags/by.png +0 -0
  36. images/flags/bz.png +0 -0
  37. images/flags/ca.png +0 -0
  38. images/flags/catalonia.png +0 -0
  39. images/flags/cc.png +0 -0
  40. images/flags/cd.png +0 -0
  41. images/flags/cf.png +0 -0
  42. images/flags/cg.png +0 -0
  43. images/flags/ch.png +0 -0
  44. images/flags/ci.png +0 -0
  45. images/flags/ck.png +0 -0
  46. images/flags/cl.png +0 -0
  47. images/flags/cm.png +0 -0
  48. images/flags/cn.png +0 -0
  49. images/flags/co.png +0 -0
  50. images/flags/cr.png +0 -0
  51. images/flags/cs.png +0 -0
  52. images/flags/cu.png +0 -0
  53. images/flags/cv.png +0 -0
  54. images/flags/cx.png +0 -0
  55. images/flags/cy.png +0 -0
  56. images/flags/cz.png +0 -0
  57. images/flags/de.png +0 -0
  58. images/flags/dj.png +0 -0
  59. images/flags/dk.png +0 -0
  60. images/flags/dm.png +0 -0
  61. images/flags/do.png +0 -0
  62. images/flags/dz.png +0 -0
  63. images/flags/ec.png +0 -0
  64. images/flags/ee.png +0 -0
  65. images/flags/eg.png +0 -0
  66. images/flags/eh.png +0 -0
  67. images/flags/england.png +0 -0
  68. images/flags/er.png +0 -0
  69. images/flags/es.png +0 -0
  70. images/flags/et.png +0 -0
  71. images/flags/eu.png +0 -0
  72. images/flags/fam.png +0 -0
  73. images/flags/fi.png +0 -0
  74. images/flags/fj.png +0 -0
  75. images/flags/fk.png +0 -0
  76. images/flags/fm.png +0 -0
  77. images/flags/fo.png +0 -0
  78. images/flags/fr.png +0 -0
  79. images/flags/ga.png +0 -0
  80. images/flags/gb.png +0 -0
  81. images/flags/gd.png +0 -0
  82. images/flags/ge.png +0 -0
  83. images/flags/gf.png +0 -0
  84. images/flags/gh.png +0 -0
  85. images/flags/gi.png +0 -0
  86. images/flags/gl.png +0 -0
  87. images/flags/gm.png +0 -0
  88. images/flags/gn.png +0 -0
  89. images/flags/gp.png +0 -0
  90. images/flags/gq.png +0 -0
  91. images/flags/gr.png +0 -0
  92. images/flags/gs.png +0 -0
  93. images/flags/gt.png +0 -0
  94. images/flags/gu.png +0 -0
  95. images/flags/gw.png +0 -0
  96. images/flags/gy.png +0 -0
  97. images/flags/hk.png +0 -0
  98. images/flags/hm.png +0 -0
  99. images/flags/hn.png +0 -0
  100. images/flags/hr.png +0 -0
  101. images/flags/ht.png +0 -0
  102. images/flags/hu.png +0 -0
  103. images/flags/id.png +0 -0
  104. images/flags/ie.png +0 -0
  105. images/flags/il.png +0 -0
  106. images/flags/in.png +0 -0
  107. images/flags/io.png +0 -0
  108. images/flags/iq.png +0 -0
  109. images/flags/ir.png +0 -0
  110. images/flags/is.png +0 -0
  111. images/flags/it.png +0 -0
  112. images/flags/jm.png +0 -0
  113. images/flags/jo.png +0 -0
  114. images/flags/jp.png +0 -0
  115. images/flags/ke.png +0 -0
  116. images/flags/kg.png +0 -0
  117. images/flags/kh.png +0 -0
  118. images/flags/ki.png +0 -0
  119. images/flags/km.png +0 -0
  120. images/flags/kn.png +0 -0
  121. images/flags/kp.png +0 -0
  122. images/flags/kr.png +0 -0
  123. images/flags/kw.png +0 -0
  124. images/flags/ky.png +0 -0
  125. images/flags/kz.png +0 -0
  126. images/flags/la.png +0 -0
  127. images/flags/lb.png +0 -0
  128. images/flags/lc.png +0 -0
  129. images/flags/li.png +0 -0
  130. images/flags/lk.png +0 -0
  131. images/flags/lr.png +0 -0
  132. images/flags/ls.png +0 -0
  133. images/flags/lt.png +0 -0
  134. images/flags/lu.png +0 -0
  135. images/flags/lv.png +0 -0
  136. images/flags/ly.png +0 -0
  137. images/flags/ma.png +0 -0
  138. images/flags/mc.png +0 -0
  139. images/flags/md.png +0 -0
  140. images/flags/me.png +0 -0
  141. images/flags/mg.png +0 -0
  142. images/flags/mh.png +0 -0
  143. images/flags/mk.png +0 -0
  144. images/flags/ml.png +0 -0
  145. images/flags/mm.png +0 -0
  146. images/flags/mn.png +0 -0
  147. images/flags/mo.png +0 -0
  148. images/flags/mp.png +0 -0
  149. images/flags/mq.png +0 -0
  150. images/flags/mr.png +0 -0
  151. images/flags/ms.png +0 -0
  152. images/flags/mt.png +0 -0
  153. images/flags/mu.png +0 -0
  154. images/flags/mv.png +0 -0
  155. images/flags/mw.png +0 -0
  156. images/flags/mx.png +0 -0
  157. images/flags/my.png +0 -0
  158. images/flags/mz.png +0 -0
  159. images/flags/na.png +0 -0
  160. images/flags/nc.png +0 -0
  161. images/flags/ne.png +0 -0
  162. images/flags/nf.png +0 -0
  163. images/flags/ng.png +0 -0
  164. images/flags/ni.png +0 -0
  165. images/flags/nl.png +0 -0
  166. images/flags/no.png +0 -0
  167. images/flags/np.png +0 -0
  168. images/flags/nr.png +0 -0
  169. images/flags/nu.png +0 -0
  170. images/flags/nz.png +0 -0
  171. images/flags/om.png +0 -0
  172. images/flags/pa.png +0 -0
  173. images/flags/pe.png +0 -0
  174. images/flags/pf.png +0 -0
  175. images/flags/pg.png +0 -0
  176. images/flags/ph.png +0 -0
  177. images/flags/pk.png +0 -0
  178. images/flags/pl.png +0 -0
  179. images/flags/pm.png +0 -0
  180. images/flags/pn.png +0 -0
  181. images/flags/pr.png +0 -0
  182. images/flags/ps.png +0 -0
  183. images/flags/pt.png +0 -0
  184. images/flags/pw.png +0 -0
  185. images/flags/py.png +0 -0
  186. images/flags/qa.png +0 -0
  187. images/flags/re.png +0 -0
  188. images/flags/ro.png +0 -0
  189. images/flags/rs.png +0 -0
  190. images/flags/ru.png +0 -0
  191. images/flags/rw.png +0 -0
  192. images/flags/sa.png +0 -0
  193. images/flags/sb.png +0 -0
  194. images/flags/sc.png +0 -0
  195. images/flags/scotland.png +0 -0
  196. images/flags/sd.png +0 -0
  197. images/flags/se.png +0 -0
  198. images/flags/sg.png +0 -0
  199. images/flags/sh.png +0 -0
  200. images/flags/si.png +0 -0
  201. images/flags/sj.png +0 -0
  202. images/flags/sk.png +0 -0
  203. images/flags/sl.png +0 -0
  204. images/flags/sm.png +0 -0
  205. images/flags/sn.png +0 -0
  206. images/flags/so.png +0 -0
  207. images/flags/sr.png +0 -0
  208. images/flags/st.png +0 -0
  209. images/flags/sv.png +0 -0
  210. images/flags/sy.png +0 -0
  211. images/flags/sz.png +0 -0
  212. images/flags/tc.png +0 -0
  213. images/flags/td.png +0 -0
  214. images/flags/tf.png +0 -0
  215. images/flags/tg.png +0 -0
  216. images/flags/th.png +0 -0
  217. images/flags/tj.png +0 -0
  218. images/flags/tk.png +0 -0
  219. images/flags/tl.png +0 -0
  220. images/flags/tm.png +0 -0
  221. images/flags/tn.png +0 -0
  222. images/flags/to.png +0 -0
  223. images/flags/tr.png +0 -0
  224. images/flags/tt.png +0 -0
  225. images/flags/tv.png +0 -0
  226. images/flags/tw.png +0 -0
  227. images/flags/tz.png +0 -0
  228. images/flags/ua.png +0 -0
  229. images/flags/ug.png +0 -0
  230. images/flags/um.png +0 -0
  231. images/flags/us.png +0 -0
  232. images/flags/uy.png +0 -0
  233. images/flags/uz.png +0 -0
  234. images/flags/va.png +0 -0
  235. images/flags/vc.png +0 -0
  236. images/flags/ve.png +0 -0
  237. images/flags/vg.png +0 -0
  238. images/flags/vi.png +0 -0
  239. images/flags/vn.png +0 -0
  240. images/flags/vu.png +0 -0
  241. images/flags/wales.png +0 -0
  242. images/flags/wf.png +0 -0
  243. images/flags/ws.png +0 -0
  244. images/flags/ye.png +0 -0
  245. images/flags/yt.png +0 -0
  246. images/flags/za.png +0 -0
  247. images/flags/zm.png +0 -0
  248. images/flags/zw.png +0 -0
  249. readme.html +0 -626
  250. readme.txt +229 -31
  251. scb/AdminPage.php +375 -0
  252. scb/Forms.php +464 -0
  253. scb/Options.php +143 -0
  254. scb/Table.php +40 -0
  255. scb/Util.php +88 -0
  256. scb/Widget.php +121 -0
  257. scb/load.php +50 -0
  258. useronline-js.dev.js +23 -52
  259. useronline-js.js +1 -1
  260. useronline-options.php +0 -386
  261. widget.php +88 -0
  262. wp-stats.php +48 -0
  263. wp-useronline.mo +0 -0
  264. wp-useronline.php +388 -853
  265. wp-useronline.pot +151 -281
admin.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class UserOnline_Admin_Page extends scbAdminPage {
4
+ function setup() {
5
+ $this->textdomain = 'wp-useronline';
6
+
7
+ $this->args = array(
8
+ 'page_title' => __('Users Online Now', $this->textdomain),
9
+ 'menu_title' => __('WP-UserOnline', $this->textdomain),
10
+ 'parent' => 'index.php',
11
+ 'capability' => 'read',
12
+ 'action_link' => false,
13
+ );
14
+
15
+ add_action('rightnow_end', array($this, 'rightnow'));
16
+ }
17
+
18
+ function rightnow() {
19
+ $total_users = get_useronline_count(false);
20
+
21
+ $str = _n(
22
+ 'There is <strong><a href="%s">%s user</a></strong> online now.',
23
+ 'There are a total of <strong><a href="%s">%s users</a></strong> online now.',
24
+ $total_users, 'wp-useronline'
25
+ );
26
+
27
+ echo '<p>';
28
+ printf($str, add_query_arg('page', $this->args['page_slug'], admin_url('index.php')), number_format_i18n($total_users));
29
+
30
+ echo '<br />';
31
+ get_users_browsing_site();
32
+ echo '.<br />';
33
+ echo UserOnline_Template::format_most_users();
34
+ echo '</p>'."\n";
35
+ }
36
+
37
+ function page_content() {
38
+ echo useronline_page();
39
+ }
40
+ }
41
+
42
+ class UserOnline_Options extends scbAdminPage {
43
+ function setup() {
44
+ $this->textdomain = 'wp-useronline';
45
+
46
+ $this->args = array(
47
+ 'page_title' => __('UserOnline Options', $this->textdomain),
48
+ 'menu_title' => __('UserOnline', $this->textdomain),
49
+ );
50
+ }
51
+
52
+ function page_head() {
53
+ ?>
54
+ <script type="text/javascript">
55
+ function useronline_default_templates(template) {
56
+ var default_template;
57
+ if ( "useronline" == template )
58
+ default_template = "<a href=\"%USERONLINE_PAGE_URL%\" title=\"%USERONLINE_USERS%\"><strong>%USERONLINE_USERS%</strong> <?php _e('Online', 'wp-useronline'); ?></a>";
59
+
60
+ jQuery("#useronline_template_" + template).val(default_template);
61
+ }
62
+
63
+ function useronline_default_naming() {
64
+ jQuery("#useronline_naming_user").val("<?php _e('1 User', 'wp-useronline'); ?>");
65
+ jQuery("#useronline_naming_users").val("<?php _e('%USERONLINE_COUNT% Users', 'wp-useronline'); ?>");
66
+ jQuery("#useronline_naming_member").val("<?php _e('1 Member', 'wp-useronline'); ?>");
67
+ jQuery("#useronline_naming_members").val("<?php _e('%USERONLINE_COUNT% Members', 'wp-useronline'); ?>");
68
+ jQuery("#useronline_naming_guest").val("<?php _e('1 Guest', 'wp-useronline'); ?>");
69
+ jQuery("#useronline_naming_guests").val("<?php _e('%USERONLINE_COUNT% Guests', 'wp-useronline'); ?>");
70
+ jQuery("#useronline_naming_bot").val("<?php _e('1 Bot', 'wp-useronline'); ?>");
71
+ jQuery("#useronline_naming_bots").val("<?php _e('%USERONLINE_COUNT% Bots', 'wp-useronline'); ?>");
72
+ }
73
+ function useronline_default_browsing_site() {
74
+ jQuery("#useronline_separator_browsingsite_members").val("<?php _e(',', 'wp-useronline') ?> ");
75
+ jQuery("#useronline_separator_browsingsite_guests").val("<?php _e(',', 'wp-useronline') ?> ");
76
+ jQuery("#useronline_separator_browsingsite_bots").val("<?php _e(',', 'wp-useronline') ?> ");
77
+ jQuery("#useronline_template_browsingsite").val("<?php echo(_c('Users|Template Element', 'wp-useronline')); ?>: <strong>%USERONLINE_MEMBER_NAMES%%USERONLINE_GUESTS_SEPERATOR%%USERONLINE_GUESTS%%USERONLINE_BOTS_SEPERATOR%%USERONLINE_BOTS%</strong>");
78
+ }
79
+ function useronline_default_browsing_page() {
80
+ jQuery("#useronline_separator_browsingpage_members").val("<?php _e(',', 'wp-useronline') ?> ");
81
+ jQuery("#useronline_separator_browsingpage_guests").val("<?php _e(',', 'wp-useronline') ?> ");
82
+ jQuery("#useronline_separator_browsingpage_bots").val("<?php _e(',', 'wp-useronline') ?> ");
83
+ jQuery("#useronline_template_browsingpage").val("<strong>%USERONLINE_USERS%</strong> <?php _e('Browsing This Page.', 'wp-useronline'); ?><br /><?php echo(_c('Users|Template Element', 'wp-useronline')); ?>: <strong>%USERONLINE_MEMBER_NAMES%%USERONLINE_GUESTS_SEPERATOR%%USERONLINE_GUESTS%%USERONLINE_BOTS_SEPERATOR%%USERONLINE_BOTS%</strong>");
84
+ }
85
+ </script>
86
+ <?php
87
+ }
88
+
89
+ function form_handler() {
90
+ if ( empty($_POST['Submit'] ))
91
+ return;
92
+
93
+ $timeout = intval($_POST['useronline_timeout']);
94
+ $url = trim(stripslashes($_POST['useronline_url']));
95
+
96
+ $bots = array();
97
+ $bots_name = explode("\n", trim(stripslashes($_POST['useronline_bots_name'])));
98
+ $bots_agent = explode("\n", trim(stripslashes($_POST['useronline_bots_agent'])));
99
+
100
+ $bots_keys = array_values((array) $bots_name);
101
+ $bots_vals = array_values((array) $bots_agent);
102
+ $n = max(count($bots_keys), count($bots_vals));
103
+
104
+ for ( $i = 0; $i < $n; $i++ )
105
+ $bots[trim($bots_keys[$i])] = trim($bots_vals[$i]);
106
+
107
+ $naming = array();
108
+ foreach ( array('user', 'users', 'member', 'members', 'guest', 'guests', 'bot', 'bots') as $key )
109
+ $naming[$key] = trim(stripslashes($_POST["useronline_naming_$key"]));
110
+
111
+ $template_useronline = trim(stripslashes($_POST['useronline_template_useronline']));
112
+
113
+ foreach ( array('browsingsite', 'browsingpage') as $key ) {
114
+ $template = array();
115
+ foreach ( array('members', 'guests', 'bots') as $type )
116
+ $template[] = trim(stripslashes($_POST["useronline_separator_{$key}_{$type}"]));
117
+ $template[] = trim(stripslashes($_POST["useronline_template_{$key}"]));
118
+ update_option("useronline_template_{$key}", $template);
119
+ }
120
+
121
+ update_option('useronline_timeout', $timeout);
122
+ update_option('useronline_bots', $bots);
123
+ update_option('useronline_url', $url);
124
+ update_option('useronline_naming', $naming);
125
+ update_option('useronline_template_useronline', $template_useronline);
126
+
127
+ $this->admin_msg(__('Settings updated.', 'wp-useronline'));
128
+ }
129
+
130
+ function page_content() {
131
+ $naming = get_option('useronline_naming');
132
+
133
+ $bots = get_option('useronline_bots');
134
+ $bots_name = implode("\n", array_keys($bots));
135
+ $bots_agent = implode("\n", array_values($bots));
136
+ ?>
137
+ <form method="post" action="">
138
+ <table class="form-table">
139
+ <tr>
140
+ <th scope="row" valign="top"><?php _e('Time Out', 'wp-useronline'); ?></th>
141
+ <td>
142
+ <input type="text" name="useronline_timeout" value="<?php echo esc_attr(get_option('useronline_timeout')); ?>" size="4" /><br /><?php _e('How long till it will remove the user from the database (In seconds).', 'wp-useronline'); ?>
143
+ </td>
144
+ </tr>
145
+ <tr>
146
+ <th scope="row" valign="top"><?php _e('UserOnline URL', 'wp-useronline'); ?></th>
147
+ <td>
148
+ <input type="text" name="useronline_url" value="<?php echo esc_attr(get_option('useronline_url')); ?>" size="50" dir="ltr" /><br /><?php _e('URL To UserOnline Page (leave blank if you do not want to link it to the UserOnline Page)<br />Example: http://www.yoursite.com/blogs/useronline/<br />Example: http://www.yoursite.com/blogs/?page_id=2', 'wp-useronline'); ?>
149
+ </td>
150
+ </tr>
151
+ <tr>
152
+ <th scope="row" valign="top"><?php _e('Bots Name/User Agent', 'wp-useronline'); ?></th>
153
+ <td>
154
+ <?php _e('Here are a list of bots and their partial browser agents.<br />On the left column will be the <strong>Bot\'s Name</strong> and on the right column will be their <strong>Partial Browser Agent</strong>.<br />Start each entry on a new line.', 'wp-useronline'); ?>
155
+ <br /><br />
156
+ <textarea cols="20" rows="30" name="useronline_bots_name" dir="ltr"><?php echo esc_html($bots_name); ?></textarea>
157
+ <textarea cols="20" rows="30" name="useronline_bots_agent" dir="ltr"><?php echo esc_html($bots_agent); ?></textarea>
158
+ </td>
159
+ </tr>
160
+ <tr>
161
+ <td width="30%">
162
+ <strong><?php _e('Naming Conventions:', 'wp-useronline'); ?></strong><br /><br /><br />
163
+ <?php _e('Allowed Variables:', 'wp-useronline'); ?><br />
164
+ - %USERONLINE_COUNT%<br /><br />
165
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-useronline'); ?>" onclick="useronline_default_naming();" class="button" />
166
+ </td>
167
+ <td>
168
+ <table class="form-table">
169
+ <thead>
170
+ <tr>
171
+ <th><?php _e('Singular Form', 'wp-useronline'); ?></th>
172
+ <th><?php _e('Plural Form', 'wp-useronline'); ?></th>
173
+ </tr>
174
+ </thead>
175
+ <tbody>
176
+ <?php foreach ( array('user', 'member', 'guest', 'bot') as $type ) {
177
+ echo
178
+ html('tr',
179
+ html('td', "<input id='useronline_naming_$type' name='useronline_naming_$type' value='"
180
+ .esc_attr($naming[$type]) . "' type='text' size='20' />")
181
+ .html('td', "<input id='useronline_naming_{$type}s' name='useronline_naming_{$type}s' value='"
182
+ .esc_attr($naming[$type . 's']) . "' type='text' size='40' />")
183
+ );
184
+ } ?>
185
+ </tbody>
186
+ </table>
187
+ <br />
188
+ </td>
189
+ </tr>
190
+ </table>
191
+
192
+ <h3><?php _e('Useronline Templates', 'wp-useronline'); ?></h3>
193
+ <table class="form-table">
194
+ <tr>
195
+ <td width="30%">
196
+ <strong><?php _e('User(s) Online:', 'wp-useronline'); ?></strong><br /><br /><br />
197
+ <?php _e('Allowed Variables:', 'wp-useronline'); ?><br />
198
+ - %USERONLINE_USERS%<br />
199
+ - %USERONLINE_PAGE_URL%<br />
200
+ - %USERONLINE_MOSTONLINE_COUNT%<br />
201
+ - %USERONLINE_MOSTONLINE_DATE%<br /><br />
202
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-useronline'); ?>" onclick="useronline_default_templates('useronline');" class="button" />
203
+ </td>
204
+ <td><textarea cols="80" rows="12" id="useronline_template_useronline" name="useronline_template_useronline"><?php echo htmlspecialchars(get_option('useronline_template_useronline')); ?></textarea></td>
205
+ </tr>
206
+ <?php $this->template(__('User(s) Browsing Site:', 'wp-useronline'), 'site'); ?>
207
+ <?php $this->template(__('User(s) Browsing Page:', 'wp-useronline'), 'page'); ?>
208
+ </table>
209
+ <p class="submit">
210
+ <input type="submit" name="Submit" class="button" value="<?php _e('Save Changes', 'wp-useronline'); ?>" />
211
+ </p>
212
+ </form>
213
+ <?php
214
+ }
215
+
216
+ private function template($title, $option) {
217
+ $template = get_option("useronline_template_browsing$option");
218
+ ?>
219
+ <tr>
220
+ <td width="30%">
221
+ <strong><?php echo $title; ?></strong><br /><br /><br />
222
+ <?php _e('Allowed Variables:', 'wp-useronline'); ?><br />
223
+ - %USERONLINE_USERS%<br />
224
+ - %USERONLINE_MEMBERS%<br />
225
+ - %USERONLINE_MEMBER_NAMES%<br />
226
+ - %USERONLINE_GUESTS_SEPERATOR%<br />
227
+ - %USERONLINE_GUESTS%<br />
228
+ - %USERONLINE_BOTS_SEPERATOR%<br />
229
+ - %USERONLINE_BOTS%<br /><br />
230
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-useronline'); ?>" onclick="useronline_default_browsing_<?php echo $option; ?>();" class="button" />
231
+ </td>
232
+ <td>
233
+ <table class="form-table">
234
+ <thead>
235
+ <tr>
236
+ <th><?php _e('Member Names Separator', 'wp-useronline'); ?></th>
237
+ <th><?php _e('Guests Separator', 'wp-useronline'); ?></th>
238
+ <th><?php _e('Bots Separator', 'wp-useronline'); ?></th>
239
+ </tr>
240
+ </thead>
241
+ <tr>
242
+ <?php foreach ( array('members', 'guests', 'bots') as $i => $type ) {
243
+ $name = "useronline_separator_browsing{$option}_{$type}";
244
+ echo
245
+ html('td',
246
+ "<input type='text' id='$name' name='$name' value='" . esc_attr($template[$i]) . "' size='15' />"
247
+ );
248
+ } ?>
249
+ </tr>
250
+ </table>
251
+ <br />
252
+ <textarea cols="80" rows="12" id="useronline_template_browsing<?php echo $option; ?>" name="useronline_template_browsing<?php echo $option; ?>"><?php echo htmlspecialchars($template[3]); ?></textarea>
253
+ </td>
254
+ </tr>
255
+ <?php
256
+ }
257
+ }
258
+
images/flags/ad.png DELETED
Binary file
images/flags/ae.png DELETED
Binary file
images/flags/af.png DELETED
Binary file
images/flags/ag.png DELETED
Binary file
images/flags/ai.png DELETED
Binary file
images/flags/al.png DELETED
Binary file
images/flags/am.png DELETED
Binary file
images/flags/an.png DELETED
Binary file
images/flags/ao.png DELETED
Binary file
images/flags/ar.png DELETED
Binary file
images/flags/as.png DELETED
Binary file
images/flags/at.png DELETED
Binary file
images/flags/au.png DELETED
Binary file
images/flags/aw.png DELETED
Binary file
images/flags/ax.png DELETED
Binary file
images/flags/az.png DELETED
Binary file
images/flags/ba.png DELETED
Binary file
images/flags/bb.png DELETED
Binary file
images/flags/bd.png DELETED
Binary file
images/flags/be.png DELETED
Binary file
images/flags/bf.png DELETED
Binary file
images/flags/bg.png DELETED
Binary file
images/flags/bh.png DELETED
Binary file
images/flags/bi.png DELETED
Binary file
images/flags/bj.png DELETED
Binary file
images/flags/bm.png DELETED
Binary file
images/flags/bn.png DELETED
Binary file
images/flags/bo.png DELETED
Binary file
images/flags/br.png DELETED
Binary file
images/flags/bs.png DELETED
Binary file
images/flags/bt.png DELETED
Binary file
images/flags/bv.png DELETED
Binary file
images/flags/bw.png DELETED
Binary file
images/flags/by.png DELETED
Binary file
images/flags/bz.png DELETED
Binary file
images/flags/ca.png DELETED
Binary file
images/flags/catalonia.png DELETED
Binary file
images/flags/cc.png DELETED
Binary file
images/flags/cd.png DELETED
Binary file
images/flags/cf.png DELETED
Binary file
images/flags/cg.png DELETED
Binary file
images/flags/ch.png DELETED
Binary file
images/flags/ci.png DELETED
Binary file
images/flags/ck.png DELETED
Binary file
images/flags/cl.png DELETED
Binary file
images/flags/cm.png DELETED
Binary file
images/flags/cn.png DELETED
Binary file
images/flags/co.png DELETED
Binary file
images/flags/cr.png DELETED
Binary file
images/flags/cs.png DELETED
Binary file
images/flags/cu.png DELETED
Binary file
images/flags/cv.png DELETED
Binary file
images/flags/cx.png DELETED
Binary file
images/flags/cy.png DELETED
Binary file
images/flags/cz.png DELETED
Binary file
images/flags/de.png DELETED
Binary file
images/flags/dj.png DELETED
Binary file
images/flags/dk.png DELETED
Binary file
images/flags/dm.png DELETED
Binary file
images/flags/do.png DELETED
Binary file
images/flags/dz.png DELETED
Binary file
images/flags/ec.png DELETED
Binary file
images/flags/ee.png DELETED
Binary file
images/flags/eg.png DELETED
Binary file
images/flags/eh.png DELETED
Binary file
images/flags/england.png DELETED
Binary file
images/flags/er.png DELETED
Binary file
images/flags/es.png DELETED
Binary file
images/flags/et.png DELETED
Binary file
images/flags/eu.png DELETED
Binary file
images/flags/fam.png DELETED
Binary file
images/flags/fi.png DELETED
Binary file
images/flags/fj.png DELETED
Binary file
images/flags/fk.png DELETED
Binary file
images/flags/fm.png DELETED
Binary file
images/flags/fo.png DELETED
Binary file
images/flags/fr.png DELETED
Binary file
images/flags/ga.png DELETED
Binary file
images/flags/gb.png DELETED
Binary file
images/flags/gd.png DELETED
Binary file
images/flags/ge.png DELETED
Binary file
images/flags/gf.png DELETED
Binary file
images/flags/gh.png DELETED
Binary file
images/flags/gi.png DELETED
Binary file
images/flags/gl.png DELETED
Binary file
images/flags/gm.png DELETED
Binary file
images/flags/gn.png DELETED
Binary file
images/flags/gp.png DELETED
Binary file
images/flags/gq.png DELETED
Binary file
images/flags/gr.png DELETED
Binary file
images/flags/gs.png DELETED
Binary file
images/flags/gt.png DELETED
Binary file
images/flags/gu.png DELETED
Binary file
images/flags/gw.png DELETED
Binary file
images/flags/gy.png DELETED
Binary file
images/flags/hk.png DELETED
Binary file
images/flags/hm.png DELETED
Binary file
images/flags/hn.png DELETED
Binary file
images/flags/hr.png DELETED
Binary file
images/flags/ht.png DELETED
Binary file
images/flags/hu.png DELETED
Binary file
images/flags/id.png DELETED
Binary file
images/flags/ie.png DELETED
Binary file
images/flags/il.png DELETED
Binary file
images/flags/in.png DELETED
Binary file
images/flags/io.png DELETED
Binary file
images/flags/iq.png DELETED
Binary file
images/flags/ir.png DELETED
Binary file
images/flags/is.png DELETED
Binary file
images/flags/it.png DELETED
Binary file
images/flags/jm.png DELETED
Binary file
images/flags/jo.png DELETED
Binary file
images/flags/jp.png DELETED
Binary file
images/flags/ke.png DELETED
Binary file
images/flags/kg.png DELETED
Binary file
images/flags/kh.png DELETED
Binary file
images/flags/ki.png DELETED
Binary file
images/flags/km.png DELETED
Binary file
images/flags/kn.png DELETED
Binary file
images/flags/kp.png DELETED
Binary file
images/flags/kr.png DELETED
Binary file
images/flags/kw.png DELETED
Binary file
images/flags/ky.png DELETED
Binary file
images/flags/kz.png DELETED
Binary file
images/flags/la.png DELETED
Binary file
images/flags/lb.png DELETED
Binary file
images/flags/lc.png DELETED
Binary file
images/flags/li.png DELETED
Binary file
images/flags/lk.png DELETED
Binary file
images/flags/lr.png DELETED
Binary file
images/flags/ls.png DELETED
Binary file
images/flags/lt.png DELETED
Binary file
images/flags/lu.png DELETED
Binary file
images/flags/lv.png DELETED
Binary file
images/flags/ly.png DELETED
Binary file
images/flags/ma.png DELETED
Binary file
images/flags/mc.png DELETED
Binary file
images/flags/md.png DELETED
Binary file
images/flags/me.png DELETED
Binary file
images/flags/mg.png DELETED
Binary file
images/flags/mh.png DELETED
Binary file
images/flags/mk.png DELETED
Binary file
images/flags/ml.png DELETED
Binary file
images/flags/mm.png DELETED
Binary file
images/flags/mn.png DELETED
Binary file
images/flags/mo.png DELETED
Binary file
images/flags/mp.png DELETED
Binary file
images/flags/mq.png DELETED
Binary file
images/flags/mr.png DELETED
Binary file
images/flags/ms.png DELETED
Binary file
images/flags/mt.png DELETED
Binary file
images/flags/mu.png DELETED
Binary file
images/flags/mv.png DELETED
Binary file
images/flags/mw.png DELETED
Binary file
images/flags/mx.png DELETED
Binary file
images/flags/my.png DELETED
Binary file
images/flags/mz.png DELETED
Binary file
images/flags/na.png DELETED
Binary file
images/flags/nc.png DELETED
Binary file
images/flags/ne.png DELETED
Binary file
images/flags/nf.png DELETED
Binary file
images/flags/ng.png DELETED
Binary file
images/flags/ni.png DELETED
Binary file
images/flags/nl.png DELETED
Binary file
images/flags/no.png DELETED
Binary file
images/flags/np.png DELETED
Binary file
images/flags/nr.png DELETED
Binary file
images/flags/nu.png DELETED
Binary file
images/flags/nz.png DELETED
Binary file
images/flags/om.png DELETED
Binary file
images/flags/pa.png DELETED
Binary file
images/flags/pe.png DELETED
Binary file
images/flags/pf.png DELETED
Binary file
images/flags/pg.png DELETED
Binary file
images/flags/ph.png DELETED
Binary file
images/flags/pk.png DELETED
Binary file
images/flags/pl.png DELETED
Binary file
images/flags/pm.png DELETED
Binary file
images/flags/pn.png DELETED
Binary file
images/flags/pr.png DELETED
Binary file
images/flags/ps.png DELETED
Binary file
images/flags/pt.png DELETED
Binary file
images/flags/pw.png DELETED
Binary file
images/flags/py.png DELETED
Binary file
images/flags/qa.png DELETED
Binary file
images/flags/re.png DELETED
Binary file
images/flags/ro.png DELETED
Binary file
images/flags/rs.png DELETED
Binary file
images/flags/ru.png DELETED
Binary file
images/flags/rw.png DELETED
Binary file
images/flags/sa.png DELETED
Binary file
images/flags/sb.png DELETED
Binary file
images/flags/sc.png DELETED
Binary file
images/flags/scotland.png DELETED
Binary file
images/flags/sd.png DELETED
Binary file
images/flags/se.png DELETED
Binary file
images/flags/sg.png DELETED
Binary file
images/flags/sh.png DELETED
Binary file
images/flags/si.png DELETED
Binary file
images/flags/sj.png DELETED
Binary file
images/flags/sk.png DELETED
Binary file
images/flags/sl.png DELETED
Binary file
images/flags/sm.png DELETED
Binary file
images/flags/sn.png DELETED
Binary file
images/flags/so.png DELETED
Binary file
images/flags/sr.png DELETED
Binary file
images/flags/st.png DELETED
Binary file
images/flags/sv.png DELETED
Binary file
images/flags/sy.png DELETED
Binary file
images/flags/sz.png DELETED
Binary file
images/flags/tc.png DELETED
Binary file
images/flags/td.png DELETED
Binary file
images/flags/tf.png DELETED
Binary file
images/flags/tg.png DELETED
Binary file
images/flags/th.png DELETED
Binary file
images/flags/tj.png DELETED
Binary file
images/flags/tk.png DELETED
Binary file
images/flags/tl.png DELETED
Binary file
images/flags/tm.png DELETED
Binary file
images/flags/tn.png DELETED
Binary file
images/flags/to.png DELETED
Binary file
images/flags/tr.png DELETED
Binary file
images/flags/tt.png DELETED
Binary file
images/flags/tv.png DELETED
Binary file
images/flags/tw.png DELETED
Binary file
images/flags/tz.png DELETED
Binary file
images/flags/ua.png DELETED
Binary file
images/flags/ug.png DELETED
Binary file
images/flags/um.png DELETED
Binary file
images/flags/us.png DELETED
Binary file
images/flags/uy.png DELETED
Binary file
images/flags/uz.png DELETED
Binary file
images/flags/va.png DELETED
Binary file
images/flags/vc.png DELETED
Binary file
images/flags/ve.png DELETED
Binary file
images/flags/vg.png DELETED
Binary file
images/flags/vi.png DELETED
Binary file
images/flags/vn.png DELETED
Binary file
images/flags/vu.png DELETED
Binary file
images/flags/wales.png DELETED
Binary file
images/flags/wf.png DELETED
Binary file
images/flags/ws.png DELETED
Binary file
images/flags/ye.png DELETED
Binary file
images/flags/yt.png DELETED
Binary file
images/flags/za.png DELETED
Binary file
images/flags/zm.png DELETED
Binary file
images/flags/zw.png DELETED
Binary file
readme.html DELETED
@@ -1,626 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
- <head>
4
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
- <title>WP-UserOnline 2.50 Readme</title>
6
- <style type="text/css" media="screen">
7
- /* Default Style */
8
- BODY {
9
- font-family: Verdana, Arial;
10
- font-size: 12px;
11
- color: #000000;
12
- background: #FFFFFF;
13
- }
14
- P {
15
- padding-left: 10px;
16
- }
17
- BLOCKQUOTE {
18
- margin: 10px 20px 0px 20px;
19
- padding: 10px;
20
- border: 1px solid #8d8d8d;
21
- background-color: #f5f5f5;
22
- overflow: auto;
23
- }
24
- LI {
25
- margin-top: 20px;
26
- }
27
- UL LI UL LI {
28
- margin-top: 10px;
29
- }
30
- A, A:active, A:link, A:visited {
31
- color: #2d3a4c;
32
- text-decoration: none;
33
- }
34
- A:hover {
35
- color: #5577a5;
36
- text-decoration: underline;
37
- }
38
- /* Place Holder Style */
39
- #Container {
40
- width: 780px;
41
- margin-left: auto;
42
- margin-right: auto;
43
- }
44
- #Content {
45
- background-color: #fafafa;
46
- border: 1px solid #a2b6cb;
47
- padding: 10px;
48
- margin-top: -13px;
49
- }
50
- /* Title Style */
51
- #Title {
52
- font-family: Verdana, Arial;
53
- font-size: 22px;
54
- font-weight: bold;
55
- color: #389aff;
56
- border-bottom: 1px solid #389aff;
57
- margin-bottom: 10px;
58
- }
59
- .SubTitle {
60
- font-family: Verdana, Arial;
61
- font-size: 18px;
62
- font-weight: bold;
63
- color: #5b87b4;
64
- }
65
- .SubSubTitle {
66
- font-family: Verdana, Arial;
67
- font-size: 14px;
68
- font-weight: bold;
69
- color: #73a4d6;
70
- }
71
- /* Tabs */
72
- UL#Tabs {
73
- font-family: Verdana, Arial;
74
- font-size: 12px;
75
- font-weight: bold;
76
- list-style-type: none;
77
- padding-bottom: 28px;
78
- border-bottom: 1px solid #a2b6cb;
79
- margin-bottom: 12px;
80
- z-index: 1;
81
- }
82
- #Tabs LI.Tab {
83
- float: right;
84
- height: 25px;
85
- background-color: #deedfb;
86
- margin: 2px 0px 0px 5px;
87
- border: 1px solid #a2b6cb;
88
- }
89
- #Tabs LI.Tab A {
90
- float: left;
91
- display: block;
92
- color: #666666;
93
- text-decoration: none;
94
- padding: 5px;
95
- }
96
- #Tabs LI.Tab A:hover {
97
- background-color: #bfe0fe;
98
- border-bottom: 1px solid #bfe0fe;
99
- }
100
- /* Selected Tab */
101
- #Tabs LI.SelectedTab {
102
- float: right;
103
- height: 25px;
104
- background-color: #fafafa;
105
- margin: 2px 0px 0px 5px;
106
- border-top: 1px solid #a2b6cb;
107
- border-right: 1px solid #a2b6cb;
108
- border-bottom: 1px solid #fafafa;
109
- border-left: 1px solid #a2b6cb;
110
- }
111
- #Tabs LI.SelectedTab A {
112
- float: left;
113
- display: block;
114
- color: #666666;
115
- text-decoration: none;
116
- padding: 5px;
117
- cursor: default;
118
- }
119
- /* Copyright */
120
- #Copyright {
121
- text-align: center;
122
- }
123
- </style>
124
- <script type="text/javascript">
125
- /* <![CDATA[*/
126
- // Index Page
127
- function index() {
128
- // Tab
129
- document.getElementById('IndexTab').className = 'SelectedTab';
130
- document.getElementById('ChangelogTab').className = 'Tab';
131
- document.getElementById('InstallTab').className = 'Tab';
132
- document.getElementById('UpgradeTab').className = 'Tab';
133
- document.getElementById('UsageTab').className = 'Tab';
134
- // Page
135
- document.getElementById('Index').style.display= 'block';
136
- document.getElementById('Changelog').style.display = 'none';
137
- document.getElementById('Install').style.display = 'none';
138
- document.getElementById('Upgrade').style.display = 'none';
139
- document.getElementById('Usage').style.display = 'none';
140
- }
141
- // Changelog Page
142
- function changelog() {
143
- // Tab
144
- document.getElementById('IndexTab').className = 'Tab';
145
- document.getElementById('ChangelogTab').className = 'SelectedTab';
146
- document.getElementById('InstallTab').className = 'Tab';
147
- document.getElementById('UpgradeTab').className = 'Tab';
148
- document.getElementById('UsageTab').className = 'Tab';
149
- // Page
150
- document.getElementById('Index').style.display = 'none';
151
- document.getElementById('Changelog').style.display = 'block';
152
- document.getElementById('Install').style.display = 'none';
153
- document.getElementById('Upgrade').style.display = 'none';
154
- document.getElementById('Usage').style.display = 'none';
155
- }
156
- // Installation Page
157
- function install() {
158
- // Tab
159
- document.getElementById('IndexTab').className = 'Tab';
160
- document.getElementById('ChangelogTab').className = 'Tab';
161
- document.getElementById('InstallTab').className = 'SelectedTab';
162
- document.getElementById('UpgradeTab').className = 'Tab';
163
- document.getElementById('UsageTab').className = 'Tab';
164
- // Page
165
- document.getElementById('Index').style.display= 'none';
166
- document.getElementById('Changelog').style.display = 'none';
167
- document.getElementById('Install').style.display = 'block';
168
- document.getElementById('Upgrade').style.display = 'none';
169
- document.getElementById('Usage').style.display = 'none';
170
- }
171
- // Upgrade Page
172
- function upgrade() {
173
- // Tab
174
- document.getElementById('IndexTab').className = 'Tab';
175
- document.getElementById('ChangelogTab').className = 'Tab';
176
- document.getElementById('InstallTab').className = 'Tab';
177
- document.getElementById('UpgradeTab').className = 'SelectedTab';
178
- document.getElementById('UsageTab').className = 'Tab';
179
- // Page
180
- document.getElementById('Index').style.display= 'none';
181
- document.getElementById('Changelog').style.display = 'none';
182
- document.getElementById('Install').style.display = 'none';
183
- document.getElementById('Upgrade').style.display = 'block';
184
- document.getElementById('Usage').style.display = 'none';
185
- }
186
- // Usage Page
187
- function usage() {
188
- // Tab
189
- document.getElementById('IndexTab').className = 'Tab';
190
- document.getElementById('ChangelogTab').className = 'Tab';
191
- document.getElementById('InstallTab').className = 'Tab';
192
- document.getElementById('UpgradeTab').className = 'Tab';
193
- document.getElementById('UsageTab').className = 'SelectedTab';
194
- // Page
195
- document.getElementById('Index').style.display= 'none';
196
- document.getElementById('Changelog').style.display = 'none';
197
- document.getElementById('Install').style.display = 'none';
198
- document.getElementById('Upgrade').style.display = 'none';
199
- document.getElementById('Usage').style.display = 'block';
200
- }
201
- /* ]]> */
202
- </script>
203
- </head>
204
- <body>
205
- <div id="Container">
206
- <!-- Title -->
207
- <div id="Title">WP-UserOnline 2.50&nbsp;&nbsp;&nbsp;<span style="color: #aaaaaa;">Readme</span></div>
208
-
209
- <!-- Tabs -->
210
- <ul id="Tabs">
211
- <li id="UsageTab" class="Tab"><a href="#Usage" onclick="usage(); return false;" title="Usage Instructions">Usage</a></li>
212
- <li id="UpgradeTab" class="Tab"><a href="#Upgrade" onclick="upgrade(); return false;" title="Upgrade Instructions">Upgrade</a></li>
213
- <li id="InstallTab" class="Tab"><a href="#Installation" onclick="install(); return false;" title="Installation Instructions">Installation</a></li>
214
- <li id="ChangelogTab" class="Tab"><a href="#Changelog" onclick="changelog(); return false;" title="Changelog">Changelog</a></li>
215
- <li id="IndexTab" class="SelectedTab"><a href="#Index" onclick="index(); return false;" title="Index">Index</a></li>
216
- </ul>
217
-
218
- <!-- Content -->
219
- <div id="Content">
220
- <!-- Index -->
221
- <div id="Index">
222
- <div class="SubTitle">&raquo; Index</div>
223
- <div class="SubSubTitle">Plugin Information</div>
224
- <p>
225
- <strong>Author:</strong><br />
226
- <strong>&raquo;</strong> Lester 'GaMerZ' Chan
227
- </p>
228
- <p>
229
- <strong>Website:</strong><br />
230
- <strong>&raquo;</strong> <a href="http://lesterchan.net/" title="http://lesterchan.net/">http://lesterchan.net/</a>
231
- </p>
232
- <p>
233
- <strong>Features:</strong><br />
234
- <strong>&raquo;</strong> Enable you to display how many users are online on your Wordpress blog with detailed statistics of where they are and who there are(Members/Guests/Search Bots).
235
- </p>
236
- <p>
237
- <strong>Download:</strong><br />
238
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-useronline.2.50.zip" title="http://downloads.wordpress.org/plugin/wp-useronline.2.50.zip">WP-UserOnline 2.50 For 2.8.x</a><br />
239
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-useronline.2.40.zip" title="http://downloads.wordpress.org/plugin/wp-useronline.2.40.zip">WP-UserOnline 2.40 For 2.7.x</a><br />
240
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-useronline.2.31.zip" title="http://downloads.wordpress.org/plugin/wp-useronline.2.31.zip">WP-UserOnline 2.31 For WordPress 2.5.x And 2.6.x</a><br />
241
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-useronline.2.20.zip" title="http://downloads.wordpress.org/plugin/wp-useronline.2.20.zip">WP-UserOnline 2.20 For WordPress 2.3.x</a><br />
242
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-useronline.2.11.zip" title="http://downloads.wordpress.org/plugin/wp-useronline.2.11.zip">WP-UserOnline 2.11 For WordPress 2.1.x And 2.2.x</a><br />
243
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-useronline.2.06.zip" title="http://downloads.wordpress.org/plugin/wp-useronline.2.06.zip">WP-UserOnline 2.06 For WordPress 2.0.x</a><br />
244
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-useronline.1.00.zip" title="http://downloads.wordpress.org/plugin/wp-useronline.1.00.zip">WP-UserOnline 1.00 For WordPress 1.5.2</a>
245
- </p>
246
- <p>
247
- <strong>Screenshots:</strong><br />
248
- <strong>&raquo;</strong> <a href="http://lesterchan.net/wordpress/screenshots/browse/wp-useronline/" title="http://lesterchan.net/wordpress/screenshots/browse/wp-useronline/">http://lesterchan.net/wordpress/screenshots/browse/wp-useronline/</a>
249
- </p>
250
- <p>
251
- <strong>Demo:</strong><br />
252
- <strong>&raquo;</strong> <a href="http://lesterchan.net/wordpress/useronline/" title="http://lesterchan.net/wordpress/useronline/">http://lesterchan.net/wordpress/useronline/</a>
253
- </p>
254
- <p>
255
- <strong>Development:</strong><br />
256
- <strong>&raquo;</strong> <a href="http://dev.wp-plugins.org/browser/wp-useronline/" title="http://dev.wp-plugins.org/browser/wp-useronline/">http://dev.wp-plugins.org/browser/wp-useronline/</a>
257
- </p>
258
- <p>
259
- <strong>Translations:</strong><br />
260
- <strong>&raquo;</strong> <a href="http://dev.wp-plugins.org/browser/wp-useronline/i18n/" title="http://dev.wp-plugins.org/browser/wp-useronline/i18n/">http://dev.wp-plugins.org/browser/wp-useronline/i18n/</a>
261
- </p>
262
- <p>
263
- <strong>Support Forums:</strong><br />
264
- <strong>&raquo;</strong> <a href="http://forums.lesterchan.net/index.php?board=21.0" title="http://forums.lesterchan.net/index.php?board=21.0">http://forums.lesterchan.net/index.php?board=21.0</a>
265
- </p>
266
- <p>
267
- <strong>Credits:</strong><br />
268
- <strong>&raquo;</strong> __ngetext() by <a href="http://hweia.ru/" title="http://hweia.ru/">Anna Ozeritskaya</a>.<br />
269
- <strong>&raquo;</strong> Right To Left Language Support by <a href="http://persian-programming.com/" title="http://persian-programming.com/">Kambiz R. Khojasteh</a>.
270
- </p>
271
- <p>
272
- <strong>Note:</strong><br />
273
- <strong>&raquo;</strong> The <strong>Changelog</strong>, <strong>Installation</strong>, <strong>Upgrade</strong>, <strong>Usage</strong> Tab at the top of the page.
274
- </p>
275
- <p>
276
- <strong>Donations:</strong><br />
277
- <strong>&raquo;</strong> I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks as my school allowance, I will really appericiate it. If not feel free to use it without any obligations. Thank You. My Paypal account is
278
- <script type="text/javascript">
279
- /* <![CDATA[*/
280
- document.write(' <strong>lesterchan@gmail.com</strong>.');
281
- /* ]]> */
282
- </script>
283
- </p>
284
- </div>
285
-
286
- <!-- Changelog -->
287
- <div id="Changelog" style="display: none;">
288
- <div class="SubTitle">&raquo; Changelog</div>
289
- <ul>
290
- <li>
291
- <strong>Version 2.50 (01-06-2009)</strong>
292
- <ul>
293
- <li>NEW: Works For WordPress 2.8 Only</li>
294
- <li>NEW: Javascript Now Placed At The Footer</li>
295
- <li>NEW: Uses jQuery Instead Of tw-sack</li>
296
- <li>NEW: Minified Javascript Instead Of Packed Javascript</li>
297
- <li>NEW: Renamed useronline-js-packed.js To useronline-js.js</li>
298
- <li>NEW: Renamed useronline-js.js To useronline-js.dev.js</li>
299
- <li>NEW: Translate Javascript Variables Using wp_localize_script()</li>
300
- <li>NEW: Use _n() Instead Of __ngettext() And _n_noop() Instead Of __ngettext_noop()</li>
301
- <li>NEW: Uses New Widget Class From WordPress</li>
302
- <li>NEW: Merge Widget Code To wp-useronline.php And Remove wp-useronline-widget.php</li>
303
- <li>FIXED: Uses $_SERVER['PHP_SELF'] With plugin_basename(__FILE__) Instead Of Just $_SERVER['REQUEST_URI']</li>
304
- <li>FIXED: Pages Without Name, Use Pages Use $_SERVER['REQUEST_URI'] Instead</li>
305
- </ul>
306
- </li>
307
- <li>
308
- <strong>Version 2.40 (12-12-2008)</strong>
309
- <ul>
310
- <li>NEW: Works For WordPress 2.7 Only</li>
311
- <li>NEW: Uses plugins_url() And site_url()</li>
312
- <li>NEW: Cache IPs of ip2nation by <a href="http://persian-programming.com/" title="http://persian-programming.com/">Kambiz R. Khojasteh</a></li>
313
- <li>NEW: Country Flags Images Are Now Included As Part Of The Plugin</li>
314
- <li>NEW: Right To Left Language Support by <a href="http://persian-programming.com/" title="http://persian-programming.com/">Kambiz R. Khojasteh</a></li>
315
- <li>NEW: Better Translation Using __ngetext() by <a href="http://hweia.ru/" title="http://hweia.ru/">Anna Ozeritskaya</a></li>
316
- <li>NEW: Output Of useronline_page() Applied To "useronline_page" Filter by <a href="http://persian-programming.com/" title="http://persian-programming.com/">Kambiz R. Khojasteh</a></li>
317
- <li>NEW: Called useronline_textdomain() In create_useronline_table() by <a href="http://persian-programming.com/" title="http://persian-programming.com/">Kambiz R. Khojasteh</a></li>
318
- <li>FIXED: SSL Support</li>
319
- </ul>
320
- </li>
321
- <li>
322
- <strong>Version 2.31 (16-07-2008)</strong>
323
- <ul>
324
- <li>NEW: Works For WordPress 2.6</li>
325
- <li>FIXED: MYSQL Charset Issue Should Be Solved</li>
326
- <li>FIXED: Do Not Show WP-Stats Link If There Is No WP-Stats</li>
327
- </ul>
328
- </li>
329
- <li>
330
- <strong>Version 2.30 (01-06-2008)</strong>
331
- <ul>
332
- <li>NEW: Works For WordPress 2.5 Only</li>
333
- <li>NEW: Uses Shortcode API</li>
334
- <li>NEW: Uses /wp-useronline/ Folder Instead Of /useronline/</li>
335
- <li>NEW: Uses wp-useronline.php Instead Of useronline.php</li>
336
- <li>NEW: Uses wp-useronline-widget.php Instead Of useronline-widget.php</li>
337
- <li>NEW: Renamed useronline-js.php To useronline-js.js and Move The Dynamic Javascript Variables To The PHP Pages</li>
338
- <li>NEW: Uses useronline-js-packed.js</li>
339
- <li>NEW: Added Users Online To Dashboard "Right Now"</li>
340
- <li>NEW: Use number_format_i18n() Instead</li>
341
- <li>FIXED: Should Use display_name Instead Of user_name If WP-Stats Is Not Installed</li>
342
- <li>FIXED: XSS Vulnerability</li>
343
- </ul>
344
- </li>
345
- <li>
346
- <strong>Version 2.20 (01-10-2007)</strong>
347
- <ul>
348
- <li>NEW: Works For WordPress 2.3 Only</li>
349
- <li>NEW:Templates Options Added</li>
350
- <li>NEW: Ability To Uninstall WP-UserOnline</li>
351
- <li>NEW: Uses WP-Stats Filter To Add Stats Into WP-Stats Page</li>
352
- </ul>
353
- </li>
354
- <li>
355
- <strong>Version 2.11 (01-06-2007)</strong>
356
- <ul>
357
- <li>NEW: Referral Link Is Now Shown On The UserOnline Page</li>
358
- <li>FIXED: Uses WordPress's Default Date And Time Format</li>
359
- <li>FIXED: Able To Leave Blank For 'UserOnline URL' Option To Disable Link To UserOnline Page</li>
360
- </ul>
361
- </li>
362
- <li>
363
- <strong>Version 2.10 (01-02-2007)</strong>
364
- <ul>
365
- <li>NEW: Works For WordPress 2.1 Only</li>
366
- <li>NEW: Renamed useronline-js.js to useronline-js.php To Enable PHP Parsing</li>
367
- </ul>
368
- </li>
369
- <li>
370
- <strong>Version 2.06 (02-01-2007)</strong>
371
- <ul>
372
- <li>NEW: useronline.php Now Handles The AJAX Processing Instead Of index.php</li>
373
- <li>NEW: Localize WP-UserOnline</li>
374
- <li>FIXED: JavaScript onLoad Function Conflict By <a href="http://an-archos.com/anarchy-media-player/">zeug</a></li>
375
- <li>FIXED: AJAX Not Working On Servers Running On PHP CGI</li>
376
- <li>FIXED: IP2Nation Will Now Work Whether Or Not WP-Stats Is Activated</li>
377
- </ul>
378
- </li>
379
- <li>
380
- <strong>Version 2.05 (01-10-2006)</strong>
381
- <ul>
382
- <li>NEW: UserOnline Is Now Embedded Into A Page, And Hence No More Integrating Of UserOnline Page (Removed wp-useronline.php)</li>
383
- <li>NEW: Changed In WP-UserOnline Structure: Members Mean Registered Users and Guests Mean Comment Authors</li>
384
- <li>NEW: get_users_browsing_site(false) And get_users_browsing_page(false) Will Now Return An Array Containing Total Users, Total Members, Total Guests and Total Bots Online</li>
385
- <li>NEW: Added Widget Title Option To WP-UserOnline Widget</li>
386
- <li>FIXED: Invalid IP Error</li>
387
- <li>FIXED: If Site URL Doesn't Match WP Option's Site URL, WP-UserOnline Will Not Work</li>
388
- </ul>
389
- </li>
390
- <li>
391
- <strong>Version 2.04 (01-07-2006)</strong>
392
- <ul>
393
- <li>NEW: AJAX Is Now Used For Updating Users Online Every 1 Minute Without Refreshing The Page</li>
394
- <li>NEW: You Can Now Place Users Online Count And Users Browsing Site Data On The Sidebar As A Widget</li>
395
- <li>NEW: UserOnline Options Panel And The Code That WP-UserOnline Generated Is XHTML 1.0 Transitional</li>
396
- <li>NEW: Added Useronline Options In WP Administration Panel Under 'Options -> Useronline'</li>
397
- <li>NEW: If You Have <a href="http://frenchfragfactory.net/ozh/archives/2004/08/27/ip-to-nation-plugin/">ip2nation Plugin</a> Installed, The User's/Guest's Country Flag Will Be Displayed</li>
398
- </ul>
399
- </li>
400
- <li>
401
- <strong>Version 2.03 (01-04-2006)</strong>
402
- <ul>
403
- <li>NEW: Added get_users_browsing_site(); To Display Users Browsing The Site</li>
404
- <li>FIXED: wp-stats.php Link</li>
405
- <li>FIXED: Some Grammer Errors, Credit To xclouds (http://www.xclouds.com/)</li>
406
- </ul>
407
- </li>
408
- <li>
409
- <strong>Version 2.02 (01-03-2006)</strong>
410
- <ul>
411
- <li>NEW: No More Install/Upgrade File, It Will Install/Upgrade When You Activate The Plugin.</li>
412
- <li>FIXED: IP 'Unknown' Error, Credit To Brian Layman (http://www.knitchat.com/)</li>
413
- <li>FIXED: ON DUPLICATE KEY Error, Credit To Brian Layman (http://www.knitchat.com/)</li>
414
- <li>FIXED: DUPLICATE KEY Error By Using DELETE First, Credit To Jody Cairns (http://steelwhitetable.org/blog/)</li>
415
- </ul>
416
- </li>
417
- <li>
418
- <strong>Version 2.01 (01-02-2006)</strong>
419
- <ul>
420
- <li>NEW: Added Users Browsing Page</li>
421
- <li>NEW: Added Most Users Ever Online</li>
422
- <li>FIXED: Added UNIQUE Key Instead Of Primary Key To Test Whether It Will Solve Duplicate Entry Errors</li>
423
- <li>FIXED: Quotes Issue In Page Title</li>
424
- </ul>
425
- </li>
426
- <li>
427
- <strong>Version 2.00 (01-01-2006)</strong>
428
- <ul>
429
- <li>NEW: Compatible With Only WordPress 2.0</li>
430
- <li>NEW: Better Installer</li>
431
- <li>NEW: GPL License Added</li>
432
- <li>NEW: Page Title Added To wp-useronline.php</li>
433
- <li>NEW: Added Extra Bots, Credit To Greg Perry (http://www.gregrperry.com/)</li>
434
- <li>FIXED: Cleaner Codes</li>
435
- </ul>
436
- </li>
437
- </ul>
438
- </div>
439
-
440
- <!-- Installation Instructions -->
441
- <div id="Install" style="display: none;">
442
- <div class="SubTitle">&raquo; WP-UserOnline Installation Instructions</div>
443
- <ol>
444
- <li>
445
- Open <strong>wp-content/plugins</strong> Folder
446
- </li>
447
- <li>
448
- Put:
449
- <blockquote>Folder: wp-useronline</blockquote>
450
- </li>
451
- <li>
452
- <strong>Activate</strong> WP-UserOnline Plugin
453
- </li>
454
- <li>
455
- Proceed On To <strong>ip2nation Installation Instructions</strong>
456
- </li>
457
- </ol>
458
- <div class="SubTitle">&raquo; ip2nation Installation Instructions</div>
459
- <ol>
460
- <li>
461
- Go to <strong><a href="http://www.ip2nation.com/ip2nation/Download">http://www.ip2nation.com/ip2nation/Download</a></strong>
462
- </li>
463
- <li>
464
- It will prompt you to download a ZIP file called <strong>ip2nation.zip</strong>
465
- </li>
466
- <li>
467
- After you have completed downloading <strong>ip2nation.zip</strong>, extract out <strong>ip2nation.zip</strong>
468
- </li>
469
- <li>
470
- You should see a SQL file called <strong>ip2nation.sql</strong>
471
- </li>
472
- <li>
473
- Go to your domain <strong>phpMyAdmin</strong> webpage
474
- </li>
475
- <li>
476
- Select your <strong>WordPress Database</strong>
477
- </li>
478
- <li>
479
- Click on <strong>Import Tab</strong>
480
- </li>
481
- <li>
482
- Under <strong>File to import</strong> and then under <strong>Location of the text file</strong>, click <strong>Browse</strong>
483
- </li>
484
- <li>
485
- Browse for the SQL file <strong>ip2nation.sql</strong>
486
- </li>
487
- <li>
488
- Click <strong>Go</strong>
489
- </li>
490
- <li>
491
- It should take a few seconds and after that both <strong>ip2nationCountries</strong> and <strong>ip2nation</strong> tables will be created
492
- </li>
493
- <li>
494
- Refer To <strong>Usage</strong> For Further Instructions
495
- </li>
496
- </ol>
497
- </div>
498
-
499
- <!-- Upgrade Instructions -->
500
- <div id="Upgrade" style="display: none;">
501
- <div class="SubTitle">&raquo; Upgrade Instructions</div>
502
- <div class="SubSubTitle">From v2.0x To v2.50</div>
503
- <ol>
504
- <li>
505
- <strong>Deactivate</strong> WP-UserOnline Plugin
506
- </li>
507
- <li>
508
- Open <strong>wp-content/plugins</strong> Folder
509
- </li>
510
- <li>
511
- Put/Overwrite:
512
- <blockquote>Folder: wp-useronline</blockquote>
513
- </li>
514
- <li>
515
- Delete this folder if exists:
516
- <blockquote>
517
- Folder: useronline
518
- </blockquote>
519
- </li>
520
- <li>
521
- <strong>Activate</strong> WP-UserOnline Plugin
522
- </li>
523
- <li>
524
- Refer To <strong>Usage</strong> For Further Instructions
525
- </li>
526
- </ol>
527
- </div>
528
-
529
- <!-- Usage Instructions -->
530
- <div id="Usage" style="display: none;">
531
- <div class="SubTitle">&raquo; Usage Instructions</div>
532
- <div class="SubSubTitle">General Usage (Without Widget)</div>
533
- <ol>
534
- <li>
535
- Open <strong>wp-content/themes/&lt;YOUR THEME NAME&gt;/sidebar.php</strong>
536
- </li>
537
- <li>
538
- Add Anywhere:
539
- <blockquote>
540
- &lt;?php if (function_exists('useronline')): ?&gt;<br />
541
- &nbsp;&nbsp;&nbsp;&lt;li&gt;<br />
542
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2&gt;UserOnline&lt;/h2&gt;<br />
543
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
544
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;div id="useronline-count"&gt;&lt;?php get_useronline(); ?&gt;&lt;/div&gt;&lt;/li&gt;<br />
545
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
546
- &nbsp;&nbsp;&nbsp;&lt;/li&gt;<br />
547
- &lt;?php endif; ?&gt;
548
- </blockquote>
549
- </li>
550
- </ol>
551
- <div class="SubSubTitle">General Usage (With Widget)</div>
552
- <ol>
553
- <li>
554
- Go to '<strong>WP-Admin -> Appearance -> Widgets</strong>'
555
- </li>
556
- <li>
557
- The widget name is <strong>UserOnline</strong>.
558
- </li>
559
- <li>
560
- Scroll down for instructions on how to create a <strong>UserOnline Page</strong>.
561
- </li>
562
- </ol>
563
- <div class="SubSubTitle">UserOnline Page</div>
564
- <ol>
565
- <li>
566
- Go to '<strong>WP-Admin -> Pages -> Add New</strong>'
567
- </li>
568
- <li>
569
- Type any title you like in the post's title area
570
- </li>
571
- <li>
572
- If you <strong>ARE </strong> using nice permalinks, after typing the title, WordPress will generate the permalink to the page. You will see an 'Edit' link just beside the permalink.
573
- </li>
574
- <li>
575
- Click 'Edit' and type in '<strong>useronline</strong>' in the text field (without the quotes) and click 'Save'.
576
- </li>
577
- <li>
578
- Type '<strong>[page_useronline]</strong>' in the post's content area (without the quotes)
579
- </li>
580
- <li>
581
- Click 'Publish'
582
- </li>
583
- <li>If you <strong>ARE NOT</strong> using nice permalinks, you need to go to 'WP-Admin -> Settings -> UserOnline' and under '<strong>UserOnline URL</strong>', you need to fill in the URL to the UserOnline Page you created above.</li>
584
- </ol>
585
- <div class="SubSubTitle">UserOnline Stats (Outside WP Loop)</div>
586
- <ul>
587
- <li>
588
- To Display <strong>Most Number Of Users Online</strong>
589
- </li>
590
- <li>
591
- Use:
592
- <blockquote>
593
- &lt;?php if (function_exists('get_most_useronline')): ?&gt;<br />
594
- &nbsp;&nbsp;&nbsp;&lt;p&gt;Most Users Ever Online Is &lt;?php echo get_most_useronline(); ?&gt; On &lt;?php echo get_most_useronline_date(); ?&gt;&lt;/p&gt;<br />
595
- &lt;?php endif; ?&gt;
596
- </blockquote>
597
- </li>
598
- <li>
599
- To Display <strong>Users Browsing Site</strong>
600
- </li>
601
- <li>
602
- Use:
603
- <blockquote>
604
- &lt;?php if (function_exists('get_users_browsing_site')): ?&gt;<br />
605
- &nbsp;&nbsp;&nbsp;&lt;div id="useronline-browsing-site"&gt;&lt;?php echo get_users_browsing_site(); ?&gt;&lt;/div&gt;<br />
606
- &lt;?php endif; ?&gt;
607
- </blockquote>
608
- </li>
609
- <li>
610
- To Display <strong>Users Browsing A Page</strong>
611
- </li>
612
- <li>
613
- Use:
614
- <blockquote>
615
- &lt;?php if (function_exists('get_users_browsing_page')): ?&gt;<br />
616
- &nbsp;&nbsp;&nbsp;&lt;div id="useronline-browsing-page"&gt;&lt;?php echo get_users_browsing_page(); ?&gt;&lt;/div&gt;<br />
617
- &lt;?php endif; ?&gt;
618
- </blockquote>
619
- </li>
620
- </ul>
621
- </div>
622
- </div>
623
- </div>
624
- <p id="Copyright">WP-UserOnline 2.50<br />Copyright &copy; 2009 Lester 'GaMerZ' Chan. All Rights Reserved.</p>
625
- </body>
626
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,31 +1,229 @@
1
- === WP-UserOnline ===
2
- Contributors: GamerZ
3
- Donate link: http://lesterchan.net/wordpress
4
- Tags: useronline, usersonline, wp-useronline, online, users, user, ajax, widget
5
- Requires at least: 2.8
6
- Stable tag: 2.50
7
-
8
- Enable you to display how many users are online on your Wordpress blog with detailed statistics.
9
-
10
- == Description ==
11
-
12
- Detailed statistics of where they are and who there are(Members/Guests/Search Bots).
13
-
14
- All the information (general, changelog, installation, upgrade, usage) you need about this plugin can be found here: [WP-UserOnline Readme](http://lesterchan.net/wordpress/readme/wp-useronline.html "WP-UserOnline Readme").
15
- It is the exact same readme.html is included in the zip package.
16
-
17
- == Development Blog ==
18
-
19
- [GaMerZ WordPress Plugins Development Blog](http://lesterchan.net/wordpress/ "GaMerZ WordPress Plugins Development Blog")
20
-
21
- == Installation ==
22
-
23
- [WP-UserOnline Readme](http://lesterchan.net/wordpress/readme/wp-useronline.html "WP-UserOnline Readme") (Installation Tab)
24
-
25
- == Screenshots ==
26
-
27
- [WP-UserOnline Screenshots](http://lesterchan.net/wordpress/screenshots/browse/wp-useronline/ "WP-UserOnline Screenshots")
28
-
29
- == Frequently Asked Questions ==
30
-
31
- [WP-UserOnline Support Forums](http://forums.lesterchan.net/index.php?board=21.0 "WP-UserOnline Support Forums")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP-UserOnline ===
2
+ Contributors: GamerZ, scribu
3
+ Donate link: http://lesterchan.net/wordpress
4
+ Tags: useronline, usersonline, wp-useronline, online, users, user, ajax, widget
5
+ Requires at least: 2.8
6
+ Tested up to: 2.9.2
7
+ Stable tag: 2.62
8
+
9
+ Enable you to display how many users are online on your Wordpress blog with detailed statistics.
10
+
11
+ == Description ==
12
+
13
+ **PHP 5 is required since version 2.60.**
14
+
15
+ This plugin enables you to display how many users are online on your Wordpress blog with detailed statistics of where they are and who they are (Members/Guests/Search Bots).
16
+
17
+ [Demo](http://lesterchan.net/wordpress/useronline/) | [Translations](http://dev.wp-plugins.org/browser/wp-useronline/i18n/)
18
+
19
+ = Credits =
20
+
21
+ * __ngetext() by [Anna Ozeritskaya](http://hweia.ru/)
22
+ * Right-To-Left language support by [Kambiz R. Khojasteh](http://persian-programming.com/)
23
+ * Maintained by [scribu](http://scribu.net)
24
+
25
+ == Installation ==
26
+
27
+ You can either install it automatically from the WordPress admin, or do it manually:
28
+
29
+ 1. Unzip the archive and put the `wp-useronline` folder into your plugins folder (/wp-content/plugins/).
30
+ 1. Activate the plugin from the Plugins menu.
31
+
32
+ = Usage =
33
+
34
+ **General Usage (Without Widget)**
35
+
36
+ Open `wp-content/themes/<YOUR THEME NAME>/sidebar.php` and add Anywhere:
37
+
38
+ `
39
+ <?php if (function_exists('get_useronline')): ?>
40
+ <li>
41
+ <h2>UserOnline</h2>
42
+ <ul>
43
+ <li><div id="useronline-count"><?php get_useronline(); ?></div></li>
44
+ </ul>
45
+ </li>
46
+ <?php endif; ?>
47
+ `
48
+
49
+ **General Usage (With Widget)**
50
+
51
+ 1. Go to `WP-Admin -> Appearance -> Widgets`
52
+ 1. The widget name is <strong>UserOnline</strong>.
53
+ 1. Scroll down for instructions on how to create a *UserOnline Page*.
54
+
55
+ **UserOnline Page**
56
+
57
+ 1. Go to `WP-Admin -> Pages -> Add New`
58
+ 1. Type any title you like in the post's title area
59
+ 1. If you **ARE** using nice permalinks, after typing the title, WordPress will generate the permalink to the page. You will see an 'Edit' link just beside the permalink.
60
+ 1. Click 'Edit' and type in `useronline` in the text field and click 'Save'.
61
+ 1. Type `[page_useronline]` in the post's content area
62
+ 1. Click 'Publish'
63
+
64
+ If you **ARE NOT** using nice permalinks, you need to go to `WP-Admin -> Settings -> UserOnline` and under 'UserOnline URL', you need to fill in the URL to the UserOnline Page you created above.
65
+
66
+ **UserOnline Stats (Outside WP Loop)**
67
+
68
+ To Display *Most Number Of Users Online* use:
69
+
70
+ `
71
+ <?php if (function_exists('get_most_useronline')): ?>
72
+ <p>Most Users Ever Online Is <?php echo get_most_useronline(); ?> On <?php echo get_most_useronline_date(); ?></p>
73
+ <?php endif; ?>
74
+ `
75
+
76
+ To Display *Users Browsing Site* use:
77
+
78
+ `
79
+ <?php if (function_exists('get_users_browsing_site')): ?>
80
+ <div id="useronline-browsing-site"><?php echo get_users_browsing_site(); ?></div>
81
+ <?php endif; ?>
82
+ `
83
+
84
+ To Display *Users Browsing A Page* use:
85
+
86
+ `
87
+ <?php if (function_exists('get_users_browsing_page')): ?>
88
+ <div id="useronline-browsing-page"><?php echo get_users_browsing_page(); ?></div>
89
+ <?php endif; ?>
90
+ `
91
+
92
+ == Screenshots ==
93
+
94
+ [WP-UserOnline Screenshots](http://lesterchan.net/wordpress/screenshots/browse/wp-useronline/ "WP-UserOnline Screenshots")
95
+
96
+ == Frequently Asked Questions ==
97
+
98
+ = Error on activation: "Parse error: syntax error, unexpected T_CLASS..." =
99
+
100
+ Make sure your host is running PHP 5. Add this line to wp-config.php to check:
101
+
102
+ `var_dump(PHP_VERSION);`
103
+
104
+ == Upgrade Notice ==
105
+
106
+ **Requires PHP5**
107
+
108
+ == Changelog ==
109
+
110
+ = 2.62 (2010-03-07) =
111
+ * fix integration with WP-Stats
112
+ * fix error with get_admin_page_title()
113
+
114
+ = 2.61 (2010-02-12) =
115
+ * fix fatal error with scbWidget
116
+
117
+ = 2.60 (2010-02-12) =
118
+ * display admin page titles
119
+ * use domaintools.com instead of arin.net
120
+ * removed ip2nation code and flag images
121
+ * simpler uninstallation procedure
122
+ * much cleaner code
123
+ * [more info](http://scribu.net/wordpress/wp-useronline/wu-2-60.html)
124
+
125
+ = 2.50 (2009-06-01) =
126
+ * new: Works For WordPress 2.8 Only
127
+ * new: Javascript Now Placed At The Footer
128
+ * new: Uses jQuery Instead Of tw-sack
129
+ * new: Minified Javascript Instead Of Packed Javascript
130
+ * new: Renamed useronline-js-packed.js To useronline-js.js
131
+ * new: Renamed useronline-js.js To useronline-js.dev.js
132
+ * new: Translate Javascript Variables Using wp_localize_script()
133
+ * new: Use _n() Instead Of __ngettext() And _n_noop() Instead Of __ngettext_noop()
134
+ * new: Uses New Widget Class From WordPress
135
+ * new: Merge Widget Code To wp-useronline.php And Remove wp-useronline-widget.php
136
+ * fixed: Uses $_SERVER['PHP_SELF'] With plugin_basename(__FILE__) Instead Of Just $_SERVER['REQUEST_URI']
137
+ * fixed: Pages Without Name, Use Pages Use $_SERVER['REQUEST_URI'] Instead
138
+
139
+ = 2.40 (2008-12-12) =
140
+ * new: Works For WordPress 2.7 Only
141
+ * new: Uses plugins_url() And site_url()
142
+ * new: Cache IPs of ip2nation by Kambiz R. Khojasteh
143
+ * new: Country Flags Images Are Now Included As Part Of The Plugin
144
+ * new: Right To Left Language Support by Kambiz R. Khojasteh
145
+ * new: Better Translation Using __ngetext() by Anna Ozeritskaya
146
+ * new: Output Of useronline_page() Applied To "useronline_page" Filter by Kambiz R. Khojasteh
147
+ * new: Called useronline_textdomain() In create_useronline_table() by Kambiz R. Khojasteh
148
+ * fixed: SSL Support
149
+
150
+ = 2.31 (2008-07-16) =
151
+ * new: Works For WordPress 2.6
152
+ * fixed: MYSQL Charset Issue Should Be Solved
153
+ * fixed: Do Not Show WP-Stats Link If There Is No WP-Stats
154
+
155
+ = 2.30 (2008-06-01) =
156
+ * new: Works For WordPress 2.5 Only
157
+ * new: Uses Shortcode API
158
+ * new: Uses /wp-useronline/ Folder Instead Of /useronline/
159
+ * new: Uses wp-useronline.php Instead Of useronline.php
160
+ * new: Uses wp-useronline-widget.php Instead Of useronline-widget.php
161
+ * new: Renamed useronline-js.php To useronline-js.js and Move The Dynamic Javascript Variables To The PHP Pages
162
+ * new: Uses useronline-js-packed.js
163
+ * new: Added Users Online To Dashboard "Right Now"
164
+ * new: Use number_format_i18n() Instead
165
+ * fixed: Should Use display_name Instead Of user_name If WP-Stats Is Not Installed
166
+ * fixed: XSS Vulnerability
167
+
168
+ = 2.20 (2007-10-01) =
169
+ * new: Works For WordPress 2.3 Only
170
+ * new: Templates Options Added
171
+ * new: Ability To Uninstall WP-UserOnline
172
+ * new: Uses WP-Stats Filter To Add Stats Into WP-Stats Page
173
+
174
+ = 2.11 (2007-06-01) =
175
+ * new: Referral Link Is Now Shown On The UserOnline Page
176
+ * fixed: Uses WordPress's Default Date And Time Format
177
+ * fixed: Able To Leave Blank For 'UserOnline URL' Option To Disable Link To UserOnline Page
178
+
179
+ = 2.10 (2007-02-01) =
180
+ * new: Works For WordPress 2.1 Only
181
+ * new: Renamed useronline-js.js to useronline-js.php To Enable PHP Parsing
182
+
183
+ = 2.06 (2007-01-02) =
184
+ * new: useronline.php Now Handles The AJAX Processing Instead Of index.php
185
+ * new: Localize WP-UserOnline
186
+ * fixed: JavaScript onLoad Function Conflict By zeug
187
+ * fixed: AJAX Not Working On Servers Running On PHP CGI
188
+ * fixed: IP2Nation Will Now Work Whether Or Not WP-Stats Is Activated
189
+
190
+ = 2.05 (2006-10-01) =
191
+ * new: UserOnline Is Now Embedded Into A Page, And Hence No More Integrating Of UserOnline Page (Removed wp-useronline.php)
192
+ * new: Changed In WP-UserOnline Structure: Members Mean Registered Users and Guests Mean Comment Authors
193
+ * new: get_users_browsing_site(false) And get_users_browsing_page(false) Will Now Return An Array Containing Total Users, Total Members, Total Guests and Total Bots Online
194
+ * new: Added Widget Title Option To WP-UserOnline Widget
195
+ * fixed: Invalid IP Error
196
+ * fixed: If Site URL Doesn't Match WP Option's Site URL, WP-UserOnline Will Not Work
197
+
198
+ = 2.04 (2006-07-01) =
199
+ * new: AJAX Is Now Used For Updating Users Online Every 1 Minute Without Refreshing The Page
200
+ * new: You Can Now Place Users Online Count And Users Browsing Site Data On The Sidebar As A Widget
201
+ * new: UserOnline Options Panel And The Code That WP-UserOnline Generated Is XHTML 1.0 Transitional
202
+ * new: Added Useronline Options In WP Administration Panel Under 'Options -> Useronline'
203
+ * new: If You Have ip2nation Plugin Installed, The User's/Guest's Country Flag Will Be Displayed
204
+
205
+ = 2.03 (2006-04-01) =
206
+ * new: Added get_users_browsing_site(); To Display Users Browsing The Site
207
+ * fixed: wp-stats.php Link
208
+ * fixed: Some Grammer Errors, Credit To xclouds (http://www.xclouds.com/)
209
+
210
+ = 2.02 (2006-03-01) =
211
+ * new: No More Install/Upgrade File, It Will Install/Upgrade When You Activate The Plugin.
212
+ * fixed: IP 'Unknown' Error, Credit To Brian Layman (http://www.knitchat.com/)
213
+ * fixed: ON DUPLICATE KEY Error, Credit To Brian Layman (http://www.knitchat.com/)
214
+ * fixed: DUPLICATE KEY Error By Using DELETE First, Credit To Jody Cairns (http://steelwhitetable.org/blog/)
215
+
216
+ = 2.01 (2006-02-01) =
217
+ * new: Added Users Browsing Page
218
+ * new: Added Most Users Ever Online
219
+ * fixed: Added UNIQUE Key Instead Of Primary Key To Test Whether It Will Solve Duplicate Entry Errors
220
+ * fixed: Quotes Issue In Page Title
221
+
222
+ = 2.00 (2006-01-01) =
223
+ * new: Compatible With Only WordPress 2.0
224
+ * new: Better Installer
225
+ * new: GPL License Added
226
+ * new: Page Title Added To wp-useronline.php
227
+ * new: Added Extra Bots, Credit To Greg Perry (http://www.gregrperry.com/)
228
+ * fixed: Cleaner Codes
229
+
scb/AdminPage.php ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Creates an admin page
5
+
6
+ You must set $this->args and define the page_content() method
7
+ */
8
+
9
+ abstract class scbAdminPage {
10
+ /** Page args
11
+ * string $parent (default: options-general.php)
12
+ * string $page_title (mandatory)
13
+ * string $menu_title
14
+ * string $page_slug
15
+ * string $capability (default: 'manage_options')
16
+ * string $nonce
17
+ * array $action_link (default: 'Settings')
18
+ */
19
+ protected $args;
20
+
21
+ // URL to the current plugin directory.
22
+ // Useful for adding css and js files
23
+ protected $plugin_url;
24
+
25
+ // Created at page init
26
+ protected $pagehook;
27
+
28
+ // scbOptions object holder
29
+ // Normally, it's used for storing formdata
30
+ protected $options;
31
+
32
+ // l10n
33
+ protected $textdomain;
34
+
35
+ // Formdata used for filling the form elements
36
+ protected $formdata = array();
37
+
38
+
39
+ // ____________MAIN METHODS____________
40
+
41
+
42
+ // Constructor
43
+ function __construct($file, $options = NULL) {
44
+ if ( $options !== NULL ) {
45
+ $this->options = $options;
46
+ $this->formdata = $this->options->get();
47
+ }
48
+
49
+ $this->file = $file;
50
+ $this->plugin_url = plugin_dir_url($file);
51
+
52
+ $this->setup();
53
+ $this->check_args();
54
+
55
+ add_action('admin_menu', array($this, 'page_init'));
56
+ add_filter('contextual_help', array($this, '_contextual_help'), 10, 2);
57
+
58
+ if ( $this->args['action_link'] )
59
+ add_filter('plugin_action_links_' . plugin_basename($file), array($this, '_action_link'));
60
+ }
61
+
62
+ // This is where all the page args can be set
63
+ function setup(){}
64
+
65
+ // This is where the css and js go
66
+ // Both wp_enqueue_*() and inline code can be added
67
+ function page_head(){}
68
+
69
+ // This is where the contextual help goes
70
+ // @return string
71
+ function page_help(){}
72
+
73
+ // A generic page header
74
+ function page_header() {
75
+ echo "<div class='wrap'>\n";
76
+ screen_icon();
77
+ echo "<h2>" . $this->args['page_title'] . "</h2>\n";
78
+ }
79
+
80
+ // This is where the page content goes
81
+ abstract function page_content();
82
+
83
+ // A generic page footer
84
+ function page_footer() {
85
+ echo "</div>\n";
86
+ }
87
+
88
+ // This is where the form data should be validated
89
+ function validate($new_data, $old_data) {
90
+ return $new_data;
91
+ }
92
+
93
+ // A generic form handler
94
+ function form_handler() {
95
+ if ( empty($_POST['action']) )
96
+ return false;
97
+
98
+ check_admin_referer($this->nonce);
99
+
100
+ foreach ( $this->formdata as $name => $value )
101
+ $new_data[$name] = @$_POST[$name];
102
+
103
+ $this->formdata = $this->validate($new_data, $this->formdata);
104
+
105
+ if ( isset($this->options) )
106
+ $this->options->update($this->formdata);
107
+
108
+ $this->admin_msg(__('Settings <strong>saved</strong>.', $this->textdomain));
109
+ }
110
+
111
+
112
+ // ____________UTILITIES____________
113
+
114
+
115
+ // Generates a form submit button
116
+ function submit_button($value = '', $action = 'action', $class = "button") {
117
+ if ( is_array($value) ) {
118
+ extract(wp_parse_args($value, array(
119
+ 'value' => __('Save Changes', $this->textdomain),
120
+ 'action' => 'action',
121
+ 'class' => 'button',
122
+ 'ajax' => true
123
+ )));
124
+
125
+ if ( ! $ajax )
126
+ $class .= ' no-ajax';
127
+ }
128
+ else {
129
+ if ( empty($value) )
130
+ $value = __('Save Changes', $this->textdomain);
131
+ }
132
+
133
+ $input_args = array(
134
+ 'type' => 'submit',
135
+ 'names' => $action,
136
+ 'values' => $value,
137
+ 'extra' => '',
138
+ 'desc' => false
139
+ );
140
+
141
+ if ( ! empty($class) )
142
+ $input_args['extra'] = "class='{$class}'";
143
+
144
+ $output = "<p class='submit'>\n" . scbForms::input($input_args) . "</p>\n";
145
+
146
+ return $output;
147
+ }
148
+
149
+ /*
150
+ Mimics scbForms::form_wrap()
151
+
152
+ $this->form_wrap($content); // generates a form with a default submit button
153
+
154
+ $this->form_wrap($content, false); // generates a form with no submit button
155
+
156
+ // the second argument is sent to submit_button()
157
+ $this->form_wrap($content, array(
158
+ 'text' => 'Save changes',
159
+ 'name' => 'action',
160
+ 'ajax' => true,
161
+ ));
162
+ */
163
+ function form_wrap($content, $submit_button = true) {
164
+ if ( is_array($submit_button) ) {
165
+ $content .= call_user_func(array($this, 'submit_button'), $submit_button);
166
+ } elseif ( true === $submit_button ) {
167
+ $content .= $this->submit_button();
168
+ } elseif ( false !== strpos($submit_button, '<input') ) {
169
+ $content .= $submit_button;
170
+ } elseif ( false !== $submit_button ) {
171
+ $button_args = array_slice(func_get_args(), 1);
172
+ $content .= call_user_func_array(array($this, 'submit_button'), $button_args);
173
+ }
174
+
175
+ return scbForms::form_wrap($content, $this->nonce);
176
+ }
177
+
178
+ // See scbForms::input()
179
+ function input($args, $options = NULL) {
180
+ if ( $options === NULL )
181
+ $options = $this->formdata;
182
+
183
+ return scbForms::input($args, $options);
184
+ }
185
+
186
+ // See scbForms::form()
187
+ function form($rows, $options = NULL) {
188
+ if ( $options === NULL )
189
+ $options = $this->formdata;
190
+
191
+ return scbForms::form($rows, $options, $this->nonce);
192
+ }
193
+
194
+ // See scbForms::table()
195
+ function table($rows, $options = NULL) {
196
+ if ( $options === NULL )
197
+ $options = $this->formdata;
198
+
199
+ return scbForms::table($rows, $options);
200
+ }
201
+
202
+ // See scbForms::table_row()
203
+ function table_row($row, $options = NULL) {
204
+ if ( $options === NULL )
205
+ $options = $this->formdata;
206
+
207
+ return scbForms::table_row($row, $options);
208
+ }
209
+
210
+ // Mimics scbForms::form_table()
211
+ function form_table($rows, $options = NULL) {
212
+ $output = $this->table($rows, $options);
213
+
214
+ $args = array_slice(func_get_args(), 2);
215
+ array_unshift($args, $output);
216
+
217
+ return call_user_func_array(array($this, 'form_wrap'), $args);
218
+ }
219
+
220
+ // Mimics scbForms::form_table_wrap()
221
+ function form_table_wrap($content) {
222
+ $output = self::table_wrap($content);
223
+
224
+ $args = array_slice(func_get_args(), 1);
225
+ array_unshift($args, $output);
226
+
227
+ return call_user_func_array(array($this, 'form_wrap'), $args);
228
+ }
229
+
230
+ // Generates a standard admin notice
231
+ function admin_msg($msg, $class = "updated") {
232
+ echo "<div class='$class fade'><p>$msg</p></div>\n";
233
+ }
234
+
235
+ // Wraps a string in a <script> tag
236
+ function js_wrap($string) {
237
+ return "\n<script type='text/javascript'>\n" . $string . "\n</script>\n";
238
+ }
239
+
240
+ // Wraps a string in a <style> tag
241
+ function css_wrap($string) {
242
+ return "\n<style type='text/css'>\n" . $string . "\n</style>\n";
243
+ }
244
+
245
+
246
+ // ____________INTERNAL METHODS____________
247
+
248
+ function __call($method, $args) {
249
+ return call_user_func_array(array('scbForms', $method), $args);
250
+ }
251
+
252
+
253
+ // Registers a page
254
+ function page_init() {
255
+ extract($this->args);
256
+
257
+ if ( ! $toplevel ) {
258
+ $this->pagehook = add_submenu_page($parent, $page_title, $menu_title, $capability, $page_slug, array($this, '_page_content_hook'));
259
+ } else {
260
+ $func = 'add_' . $toplevel . '_page';
261
+ $this->pagehook = $func($page_title, $menu_title, $capability, $page_slug, array($this, '_page_content_hook'), $icon_url);
262
+ }
263
+
264
+ if ( ! $this->pagehook )
265
+ return;
266
+
267
+ $this->ajax_response();
268
+
269
+ add_action('admin_print_styles-' . $this->pagehook, array($this, 'page_head'));
270
+
271
+ add_action('admin_footer', array($this, 'ajax_submit'), 20);
272
+ }
273
+
274
+ private function check_args() {
275
+ if ( empty($this->args['page_title']) )
276
+ trigger_error('Page title cannot be empty', E_USER_WARNING);
277
+
278
+ $this->args = wp_parse_args($this->args, array(
279
+ 'menu_title' => $this->args['page_title'],
280
+ 'page_slug' => '',
281
+ 'toplevel' => '',
282
+ 'icon' => '',
283
+ 'parent' => 'options-general.php',
284
+ 'action_link' => __('Settings', $this->textdomain),
285
+ 'capability' => 'manage_options',
286
+ 'nonce' => ''
287
+ ));
288
+
289
+ if ( empty($this->args['page_slug']) )
290
+ $this->args['page_slug'] = sanitize_title_with_dashes($this->args['menu_title']);
291
+
292
+ if ( empty($this->args['nonce']) )
293
+ $this->nonce = $this->args['page_slug'];
294
+ }
295
+
296
+ function _contextual_help($help, $screen) {
297
+ if ( is_object($screen) )
298
+ $screen = $screen->id;
299
+
300
+ if ( $screen == $this->pagehook && $actual_help = $this->page_help() )
301
+ return $actual_help;
302
+
303
+ return $help;
304
+ }
305
+
306
+ function ajax_response() {
307
+ if ( ! isset($_POST['_ajax_submit']) || $_POST['_ajax_submit'] != $this->pagehook )
308
+ return;
309
+
310
+ $this->form_handler();
311
+ die;
312
+ }
313
+
314
+ function ajax_submit() {
315
+ global $page_hook;
316
+
317
+ if ( $page_hook != $this->pagehook )
318
+ return;
319
+ ?>
320
+ <script type="text/javascript">
321
+ jQuery(document).ready(function($){
322
+ var $spinner = $(new Image()).attr('src', '<?php echo admin_url("images/wpspin_light.gif"); ?>');
323
+
324
+ $(':submit').click(function(ev){
325
+ var $submit = $(this);
326
+ var $form = $submit.parents('form');
327
+
328
+ if ( $submit.hasClass('no-ajax') || $form.attr('method').toLowerCase() != 'post' )
329
+ return true;
330
+
331
+ var $this_spinner = $spinner.clone();
332
+
333
+ $submit.before($this_spinner).hide();
334
+
335
+ var data = $form.serializeArray();
336
+ data.push({name: $submit.attr('name'), value: $submit.val()});
337
+ data.push({name: '_ajax_submit', value: '<?php echo $this->pagehook; ?>'});
338
+
339
+ $.post(location.href, data, function(response){
340
+ var $prev = $('.wrap > .updated, .wrap > .error');
341
+ var $msg = $(response).hide().insertAfter($('.wrap h2'));
342
+ if ( $prev.length > 0 )
343
+ $prev.fadeOut('slow', function(){ $msg.fadeIn('slow'); });
344
+ else
345
+ $msg.fadeIn('slow');
346
+
347
+ $this_spinner.hide();
348
+ $submit.show();
349
+ });
350
+
351
+ ev.stopPropagation();
352
+ ev.preventDefault();
353
+ });
354
+ });
355
+ </script>
356
+ <?php
357
+ $this->page_head();
358
+ }
359
+
360
+ function _page_content_hook() {
361
+ $this->form_handler();
362
+
363
+ $this->page_header();
364
+ $this->page_content();
365
+ $this->page_footer();
366
+ }
367
+
368
+ function _action_link($links) {
369
+ $url = add_query_arg('page', $this->args['page_slug'], admin_url($this->args['parent']));
370
+ $links[] = "<a href='$url'>" . $this->args['action_link'] . "</a>";
371
+
372
+ return $links;
373
+ }
374
+ }
375
+
scb/Forms.php ADDED
@@ -0,0 +1,464 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class scbForms {
4
+ const token = '%input%';
5
+
6
+ /* Generates one or more form elements of the same type,
7
+ including <select>s and <textarea>s.
8
+
9
+ $args = array (
10
+ 'type' => string (mandatory)
11
+ 'name' => string | array (mandatory)
12
+ 'value' => string | array
13
+ 'desc' => string | array | false
14
+ 'desc_pos' => 'before' | 'after' | 'foo %input% bar' (default: after)
15
+ 'extra' => string (default: class="regular-text")
16
+ );
17
+
18
+ $formdata = associative array with the formdata with which to fill the elements
19
+ */
20
+
21
+ protected static $args;
22
+ protected static $formdata = array();
23
+
24
+ static function input($args, $formdata = array()) {
25
+ $args = self::validate_data($args);
26
+
27
+ $error = false;
28
+ foreach ( array('name', 'value') as $key ) {
29
+ $old = $key . 's';
30
+
31
+ if ( isset($args[$old]) ) {
32
+ $args[$key] = $args[$old];
33
+ unset($args[$old]);
34
+ }
35
+ }
36
+
37
+ if ( !isset($args['name']) || empty($args['name']) )
38
+ return trigger_error("Empty name", E_USER_WARNING);
39
+
40
+ self::$args = $args;
41
+ self::$formdata = self::validate_data($formdata);
42
+
43
+ switch ( $args['type'] ) {
44
+ case 'select': return self::_select();
45
+ case 'textarea': return self::_textarea();
46
+ default: return self::_input();
47
+ }
48
+ }
49
+
50
+ // Deprecated
51
+ static function select($args, $options = array()) {
52
+ if ( !empty($options) )
53
+ $args['value'] = $options;
54
+
55
+ self::$args = $args;
56
+
57
+ return self::_select();
58
+ }
59
+
60
+ // Deprecated
61
+ static function textarea($args, $content = '') {
62
+ if ( !empty($content) )
63
+ $args['value'] = $content;
64
+
65
+ self::$args = $args;
66
+
67
+ return self::_textarea();
68
+ }
69
+
70
+
71
+ // ____________UTILITIES____________
72
+
73
+
74
+ // Generates a table wrapped in a form
75
+ static function form_table($rows, $formdata = NULL) {
76
+ $output = '';
77
+ foreach ( $rows as $row )
78
+ $output .= self::table_row($row, $formdata);
79
+
80
+ $output = self::form_table_wrap($output);
81
+
82
+ return $output;
83
+ }
84
+
85
+ // Generates a form
86
+ static function form($inputs, $formdata = NULL, $nonce) {
87
+ $output = '';
88
+ foreach ( $inputs as $input )
89
+ $output .= self::input($input, $formdata);
90
+
91
+ $output = self::form_wrap($output, $nonce);
92
+
93
+ return $output;
94
+ }
95
+
96
+ // Generates a table
97
+ static function table($rows, $formdata = NULL) {
98
+ $output = '';
99
+ foreach ( $rows as $row )
100
+ $output .= self::table_row($row, $formdata);
101
+
102
+ $output = self::table_wrap($output);
103
+
104
+ return $output;
105
+ }
106
+
107
+ // Generates a table row
108
+ static function table_row($args, $formdata = NULL) {
109
+ return self::row_wrap($args['title'], self::input($args, $formdata));
110
+ }
111
+
112
+
113
+ // ____________WRAPPERS____________
114
+
115
+
116
+ // Wraps the given content in a <form><table>
117
+ static function form_table_wrap($content, $nonce = 'update_options') {
118
+ $output = self::table_wrap($content);
119
+ $output = self::form_wrap($output, $nonce);
120
+
121
+ return $output;
122
+ }
123
+
124
+ // Wraps the given content in a <form>
125
+ static function form_wrap($content, $nonce = 'update_options') {
126
+ $output = "\n<form method='post' action=''>\n";
127
+ $output .= $content;
128
+ $output .= wp_nonce_field($action = $nonce, $name = "_wpnonce", $referer = true , $echo = false);
129
+ $output .= "\n</form>\n";
130
+
131
+ return $output;
132
+ }
133
+
134
+ // Wraps the given content in a <table>
135
+ static function table_wrap($content) {
136
+ $output = "\n<table class='form-table'>\n" . $content . "\n</table>\n";
137
+
138
+ return $output;
139
+ }
140
+
141
+ // Wraps the given content in a <tr><td>
142
+ static function row_wrap($title, $content) {
143
+ return "\n<tr>\n\t<th scope='row'>" . $title . "</th>\n\t<td>\n\t\t" . $content . "\t</td>\n\n</tr>";
144
+ }
145
+
146
+
147
+ // ____________PRIVATE METHODS____________
148
+
149
+
150
+ // Recursivly transform empty arrays to ''
151
+ private static function validate_data($data) {
152
+ if ( ! is_array($data) )
153
+ return $data;
154
+
155
+ if ( empty($data) )
156
+ return '';
157
+
158
+ foreach ( $data as $key => &$value )
159
+ $value = self::validate_data($value);
160
+
161
+ return $data;
162
+ }
163
+
164
+ // From multiple inputs to single inputs
165
+ private static function _input() {
166
+ extract(wp_parse_args(self::$args, array(
167
+ 'name' => NULL,
168
+ 'value' => NULL,
169
+ 'desc' => NULL,
170
+ 'checked' => NULL,
171
+ )));
172
+
173
+ $m_name = is_array($name);
174
+ $m_value = is_array($value);
175
+ $m_desc = is_array($desc);
176
+
177
+ // Correct name
178
+ if ( !$m_name && $m_value
179
+ && 'checkbox' == $type
180
+ && false === strpos($name, '[')
181
+ )
182
+ $args['name'] = $name = $name . '[]';
183
+
184
+ // Expand names or values
185
+ if ( !$m_name && !$m_value ) {
186
+ $a = array($name => $value);
187
+ }
188
+ elseif ( $m_name && !$m_value ) {
189
+ $a = array_fill_keys($name, $value);
190
+ }
191
+ elseif ( !$m_name && $m_value ) {
192
+ $a = array_fill_keys($value, $name);
193
+ }
194
+ else {
195
+ $a = array_combine($name, $value);
196
+ }
197
+
198
+ // Correct descriptions
199
+ $_after = '';
200
+ if ( isset($desc) && !$m_desc && false === strpos($desc, self::token) ) {
201
+ if ( $m_value ) {
202
+ $_after = $desc;
203
+ $args['desc'] = $desc = $value;
204
+ }
205
+ elseif ( $m_name ) {
206
+ $_after = $desc;
207
+ $args['desc'] = $desc = $name;
208
+ }
209
+ }
210
+
211
+ // Determine what goes where
212
+ if ( !$m_name && $m_value ) {
213
+ $i1 = 'val';
214
+ $i2 = 'name';
215
+ } else {
216
+ $i1 = 'name';
217
+ $i2 = 'val';
218
+ }
219
+
220
+ $func = in_array($type, array('checkbox', 'radio')) ? '_checkbox_single' : '_input_single';
221
+
222
+ // Set constant args
223
+ $const_args = self::array_extract(self::$args, array('type', 'desc_pos', 'checked'));
224
+ if ( isset($extra) )
225
+ $const_args['extra'] = explode(' ', $extra);
226
+
227
+ $i = 0;
228
+ foreach ( $a as $name => $val ) {
229
+ $cur_args = $const_args;
230
+
231
+ if ( $$i1 !== NULL )
232
+ $cur_args['name'] = $$i1;
233
+
234
+ if ( $$i2 !== NULL )
235
+ $cur_args['value'] = $$i2;
236
+
237
+ // Set desc
238
+ if ( is_array($desc) )
239
+ $cur_args['desc'] = $desc[$i];
240
+ elseif ( isset($desc) )
241
+ $cur_args['desc'] = $desc;
242
+
243
+ // Find relevant formdata
244
+ $match = NULL;
245
+ if ( $checked === NULL ) {
246
+ $match = @self::$formdata[str_replace('[]', '', $$i1)];
247
+ if ( is_array($match) ) {
248
+ $match = $match[$i];
249
+ }
250
+ } else if ( is_array($checked) ) {
251
+ $cur_args['checked'] = isset($checked[$i]) && $checked[$i];
252
+ }
253
+
254
+ $output[] = self::$func($cur_args, $match);
255
+
256
+ $i++;
257
+ }
258
+
259
+ return implode("\n", $output) . $_after;
260
+ }
261
+
262
+ // Handle args for checkboxes and radio inputs
263
+ private static function _checkbox_single($args, $data) {
264
+ $args = wp_parse_args($args, array(
265
+ 'name' => NULL,
266
+ 'value' => true,
267
+ 'desc_pos' => 'after',
268
+ 'desc' => NULL,
269
+ 'checked' => NULL,
270
+ 'extra' => array(),
271
+ ));
272
+
273
+ foreach ( $args as $key => &$val )
274
+ $$key = &$val;
275
+ unset($val);
276
+
277
+ if ( $checked === NULL && $value == $data )
278
+ $checked = true;
279
+
280
+ if ( $checked )
281
+ $extra[] = 'checked="checked"';
282
+
283
+ if ( $desc === NULL && !is_bool($value) )
284
+ $desc = str_replace('[]', '', $value);
285
+
286
+ return self::_input_gen($args);
287
+ }
288
+
289
+ // Handle args for text inputs
290
+ private static function _input_single($args, $data) {
291
+ $args = wp_parse_args($args, array(
292
+ 'value' => stripslashes($data),
293
+ 'desc_pos' => 'after',
294
+ 'extra' => array('class="regular-text"'),
295
+ ));
296
+
297
+ foreach ( $args as $key => &$val )
298
+ $$key = &$val;
299
+ unset($val);
300
+
301
+ if ( FALSE === strpos($name, '[') )
302
+ $extra[] = "id='{$name}'";
303
+
304
+ return self::_input_gen($args);
305
+ }
306
+
307
+ // Generate html with the final args
308
+ private static function _input_gen($args) {
309
+ extract(wp_parse_args($args, array(
310
+ 'name' => NULL,
311
+ 'value' => NULL,
312
+ 'desc' => NULL,
313
+ 'extra' => array()
314
+ )));
315
+
316
+ $extra = self::validate_extra($extra, $name);
317
+
318
+ $value = esc_attr($value);
319
+
320
+ $input = "<input name='{$name}' value='{$value}' type='{$type}'{$extra} /> ";
321
+
322
+ return self::add_label($input, $desc, $desc_pos);
323
+ }
324
+
325
+ private static function _select() {
326
+ extract(wp_parse_args(self::$args, array(
327
+ 'name' => '',
328
+ 'value' => array(),
329
+ 'text' => '',
330
+ 'selected' => array('foo'), // hack to make default blank
331
+ 'extra' => '',
332
+ 'numeric' => false, // use numeric array instead of associative
333
+ 'desc' => '',
334
+ 'desc_pos' => '',
335
+ )), EXTR_SKIP);
336
+
337
+ if ( empty($value) )
338
+ $value = array('' => '');
339
+
340
+ if ( !is_array($value) )
341
+ return trigger_error("'value' argument is expected to be an array", E_USER_WARNING);
342
+
343
+ if ( !self::is_associative($value) && !$numeric )
344
+ $value = array_combine($value, $value);
345
+
346
+ if ( isset(self::$formdata[$name]) )
347
+ $cur_val = self::$formdata[$name];
348
+ else
349
+ $cur_val = $selected;
350
+
351
+ if ( false === $text ) {
352
+ $opts = '';
353
+ } else {
354
+ $opts = "\t<option value=''";
355
+ if ( $cur_val === array('foo') )
356
+ $opts .= " selected='selected'";
357
+ $opts .= ">{$text}</option>\n";
358
+ }
359
+
360
+ foreach ( $value as $key => $value ) {
361
+ if ( empty($key) || empty($value) )
362
+ continue;
363
+
364
+ $cur_extra = array();
365
+ if ( (string) $key == (string) $cur_val )
366
+ $cur_extra[] = "selected='selected'";
367
+
368
+ $cur_extra = self::validate_extra($cur_extra, $key);
369
+
370
+ $opts .= "\t<option value='{$key}'{$cur_extra}>{$value}</option>\n";
371
+ }
372
+
373
+ $extra = self::validate_extra($extra, $name);
374
+
375
+ $input = "<select name='{$name}'$extra>\n{$opts}</select>";
376
+
377
+ return self::add_label($input, $desc, $desc_pos);
378
+ }
379
+
380
+ private static function _textarea() {
381
+ extract(wp_parse_args(self::$args, array(
382
+ 'name' => '',
383
+ 'extra' => 'class="widefat"',
384
+ 'value' => '',
385
+ 'escaped' => false,
386
+ )), EXTR_SKIP);
387
+
388
+ if ( !$escaped )
389
+ $value = wp_htmledit_pre(stripslashes($value));
390
+
391
+ $extra = self::validate_extra($extra, $name);
392
+
393
+ return "<textarea name='{$name}'{$extra}>\n{$value}\n</textarea>\n";
394
+ }
395
+
396
+ private static function add_label($input, $desc, $desc_pos) {
397
+ if ( empty($desc_pos) )
398
+ $desc_pos = 'after';
399
+
400
+ $label = '';
401
+ if ( false === strpos($desc, self::token) ) {
402
+ switch ($desc_pos) {
403
+ case 'before': $label = $desc . ' ' . self::token; break;
404
+ case 'after': $label = self::token . ' ' . $desc;
405
+ }
406
+ } else {
407
+ $label = $desc;
408
+ }
409
+
410
+ $label = trim(str_replace(self::token, $input, $label));
411
+
412
+ if ( empty($desc) )
413
+ $output = $input . "\n";
414
+ else
415
+ $output = "<label>{$label}</label>\n";
416
+
417
+ return $output;
418
+ }
419
+
420
+ private static function validate_extra($extra, $name, $implode = true) {
421
+ if ( !is_array($extra) )
422
+ $extra = explode(' ', $extra);
423
+
424
+ if ( empty($extra) )
425
+ return '';
426
+
427
+ return ' ' . ltrim(implode(' ', $extra));
428
+ }
429
+
430
+ // Utilities
431
+
432
+ private static function is_associative($array) {
433
+ if ( !is_array($array) || empty($array) )
434
+ return false;
435
+
436
+ $keys = array_keys($array);
437
+
438
+ return array_keys($keys) !== $keys;
439
+ }
440
+
441
+ private static function array_extract($array, $keys) {
442
+ $r = array();
443
+ foreach ( $keys as $key )
444
+ if ( isset($array[$key]) )
445
+ $r[$key] = $array[$key];
446
+
447
+ return $r;
448
+ }
449
+ }
450
+
451
+ // PHP < 5.2
452
+ if ( !function_exists('array_fill_keys') ) :
453
+ function array_fill_keys($keys, $value) {
454
+ if ( !is_array($keys) )
455
+ trigger_error('First argument is expected to be an array.' . gettype($keys) . 'given', E_USER_WARNING);
456
+
457
+ $r = array();
458
+ foreach ( $keys as $key )
459
+ $r[$key] = $value;
460
+
461
+ return $r;
462
+ }
463
+ endif;
464
+
scb/Options.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Usage: http://scribu.net/wordpress/scb-framework/scb-options.html
4
+
5
+ class scbOptions {
6
+ protected $defaults; // the default value(s)
7
+
8
+ protected $key; // the option name
9
+ protected $data; // the option value
10
+
11
+ public $wp_filter_id; // used by WP hooks
12
+
13
+ /**
14
+ * Create a new set of options
15
+ *
16
+ * @param key Option name
17
+ * @param string Reference to main plugin file
18
+ * @param array An associative array of default values
19
+ */
20
+ function __construct($key, $file, $defaults = '') {
21
+ $this->key = $key;
22
+ $this->defaults = $defaults;
23
+ $this->data = get_option($this->key);
24
+
25
+ if ( is_array($this->defaults) ) {
26
+ $this->data = (array) $this->data;
27
+
28
+ register_activation_hook($file, array($this, '_update_reset'));
29
+ }
30
+
31
+ register_uninstall_hook($file, array($this, '_delete'));
32
+ }
33
+
34
+ /**
35
+ * Get all data fields, certain fields or a single field
36
+ *
37
+ * @param string|array $field The field(s) to get
38
+ * @return mixed Whatever is in those fields
39
+ */
40
+ function get($field = '') {
41
+ return $this->_get($field, $this->data);
42
+ }
43
+
44
+ /**
45
+ * Get all default fields, certain fields or a single field
46
+ *
47
+ * @param string|array $field The field(s) to get
48
+ * @return mixed Whatever is in those fields
49
+ */
50
+ function get_defaults($field = '') {
51
+ return $this->_get($field, $this->defaults);
52
+ }
53
+
54
+ /**
55
+ * Set all data fields, certain fields or a single field
56
+ *
57
+ * @param string|array $field The field to update or an associative array
58
+ * @param mixed $value The new value (ignored if $field is array)
59
+ * @return null
60
+ */
61
+ function set($field, $value = '') {
62
+ if ( is_array($field) )
63
+ $newdata = $field;
64
+ else
65
+ $newdata = array($field => $value);
66
+
67
+ $this->update(array_merge($this->data, $newdata));
68
+ }
69
+
70
+ /**
71
+ * Update raw data
72
+ *
73
+ * @param mixed $newdata
74
+ * @return null
75
+ */
76
+ function update($newdata) {
77
+ if ( $this->data === $newdata )
78
+ return;
79
+
80
+ $this->data = $newdata;
81
+
82
+ update_option($this->key, $this->data);
83
+ }
84
+
85
+ /**
86
+ * Reset option to defaults
87
+ *
88
+ * @return null
89
+ */
90
+ function reset() {
91
+ $this->update($this->defaults);
92
+ }
93
+
94
+
95
+ //_____INTERNAL METHODS_____
96
+
97
+
98
+ // Get one, more or all fields from an array
99
+ private function _get($field, $data) {
100
+ if ( empty($field) )
101
+ return $data;
102
+
103
+ if ( is_string($field) )
104
+ return $data[$field];
105
+
106
+ foreach ( $field as $key )
107
+ if ( isset($data[$key]) )
108
+ $result[] = $data[$key];
109
+
110
+ return $result;
111
+ }
112
+
113
+ // Magic method: $options->field
114
+ function __get($field) {
115
+ return $this->data[$field];
116
+ }
117
+
118
+ // Magic method: $options->field = $value
119
+ function __set($field, $value) {
120
+ $this->set($field, $value);
121
+ }
122
+
123
+ // Magic method: isset($options->field)
124
+ function __isset($field) {
125
+ return isset($this->data[$field]);
126
+ }
127
+
128
+ // Add new fields with their default values
129
+ function _update_reset() {
130
+ $this->update(array_merge($this->defaults, $this->data));
131
+ }
132
+
133
+ // Delete option
134
+ function _delete() {
135
+ delete_option($this->key);
136
+ }
137
+
138
+ // DEPRECATED
139
+ function update_part($data) {
140
+ $this->set($data);
141
+ }
142
+ }
143
+
scb/Table.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Takes care of creating, updating and deleting database tables
4
+ class scbTable {
5
+ protected $name;
6
+ protected $columns;
7
+
8
+ function __construct($name, $file, $columns) {
9
+ global $wpdb;
10
+
11
+ $wpdb->$name = $this->name = $wpdb->prefix . $name;
12
+ $this->columns = $columns;
13
+
14
+ register_activation_hook($file, array($this, 'install'));
15
+ register_uninstall_hook($file, array($this, 'uninstall'));
16
+ }
17
+
18
+ function install() {
19
+ global $wpdb;
20
+
21
+ $charset_collate = '';
22
+ if ( $wpdb->has_cap( 'collation' ) ) {
23
+ if ( ! empty($wpdb->charset) )
24
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
25
+ if ( ! empty($wpdb->collate) )
26
+ $charset_collate .= " COLLATE $wpdb->collate";
27
+ }
28
+
29
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
30
+
31
+ dbDelta("CREATE TABLE $this->name ($this->columns) $charset_collate;");
32
+ }
33
+
34
+ function uninstall() {
35
+ global $wpdb;
36
+
37
+ $wpdb->query("DROP TABLE IF EXISTS $this->name");
38
+ }
39
+ }
40
+
scb/Util.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class scbUtil {
4
+ // Force script enqueue
5
+ static function do_scripts($handles) {
6
+ global $wp_scripts;
7
+
8
+ if ( ! is_a($wp_scripts, 'WP_Scripts') )
9
+ $wp_scripts = new WP_Scripts();
10
+
11
+ $wp_scripts->do_items((array) $handles);
12
+ }
13
+
14
+ // Force style enqueue
15
+ static function do_styles($handles) {
16
+ global $wp_styles;
17
+
18
+ if ( ! is_a($wp_styles, 'WP_Styles') )
19
+ $wp_styles = new WP_Styles();
20
+
21
+ $wp_styles->do_items((array) $handles);
22
+ }
23
+
24
+ // Better debug function
25
+ static function debug() {
26
+ // integrate with FirePHP
27
+ if ( function_exists('FB') ) {
28
+ foreach ( func_get_args() as $arg )
29
+ FB($arg);
30
+
31
+ return;
32
+ }
33
+
34
+ echo "<pre>";
35
+ foreach ( func_get_args() as $arg )
36
+ if ( is_array($arg) || is_object($arg) )
37
+ print_r($arg);
38
+ else
39
+ var_dump($arg);
40
+ echo "</pre>";
41
+ }
42
+
43
+ // Minimalist HTML framework
44
+ static function html($tag, $content = '', $indent = null) {
45
+ list($closing) = explode(' ', $tag, 2);
46
+
47
+ return "<{$tag}>{$content}</{$closing}>";
48
+ }
49
+
50
+ // Generate an <a> tag
51
+ static function html_link($url, $title = '') {
52
+ if ( empty($title) )
53
+ $title = $url;
54
+
55
+ return sprintf("<a href='%s'>%s</a>", $url, $title);
56
+ }
57
+
58
+
59
+ // Extract $keys from $array
60
+ static function array_extract($array, $keys) {
61
+ $r = array();
62
+ foreach ( $keys as $key )
63
+ if ( array_key_exists($key, $array) )
64
+ $r[$key] = $array[$key];
65
+
66
+ return $r;
67
+ }
68
+
69
+ // Prepare an array for an IN statement
70
+ static function array_to_sql($values) {
71
+ foreach ( $values as &$val )
72
+ $val = "'" . esc_sql(trim($val)) . "'";
73
+
74
+ return implode(',', $values);
75
+ }
76
+ }
77
+
78
+ // Create shortcuts
79
+ foreach ( array('debug', 'html', 'html_link') as $func )
80
+ if ( ! function_exists($func) )
81
+ eval("
82
+ function $func() {
83
+ \$args = func_get_args();
84
+
85
+ return call_user_func_array(array('scbUtil', '$func'), \$args);
86
+ }
87
+ ");
88
+
scb/Widget.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Adds compatibility methods between WP_Widget and scbForms
4
+
5
+ abstract class scbWidget extends WP_Widget {
6
+ private static $widgets = array();
7
+ private static $migrations = array();
8
+
9
+ function widget($args, $instance) {
10
+ extract($args);
11
+
12
+ echo $before_widget;
13
+
14
+ $title = apply_filters('widget_title', $instance['title'], $this->name);
15
+
16
+ if ( ! empty($title) )
17
+ echo $before_title . $title . $after_title;
18
+
19
+ $this->content($instance);
20
+
21
+ echo $after_widget;
22
+ }
23
+
24
+ function content($instance) {}
25
+
26
+ static function init($class, $file = '', $base = '') {
27
+ self::$widgets[] = $class;
28
+ self::$migrations[] = $base;
29
+
30
+ add_action('widgets_init', array(__CLASS__, 'scb_register'));
31
+ register_activation_hook($file, array(__CLASS__, 'scb_migrate'));
32
+ }
33
+
34
+
35
+ // ____HELPER METHODS____
36
+
37
+
38
+ // See scbForms::input()
39
+ // Allows extra parameter $args['title']
40
+ function input($args, $formdata = array()) {
41
+ // Add default class
42
+ if ( !isset($args['extra']) )
43
+ $args['extra'] = 'class="widefat"';
44
+
45
+ // Add default label position
46
+ if ( !in_array($args['type'], array('checkbox', 'radio')) && empty($args['desc_pos']) )
47
+ $args['desc_pos'] = 'before';
48
+
49
+ // Then add prefix to names and formdata
50
+ $new_formdata = array();
51
+ foreach ( (array) $args['name'] as $name ) {
52
+ if ( false !== strpos($name, '[') )
53
+ $newname = str_replace('[]', '', $this->get_field_name('')) . str_replace('[]', '', $name) . '[]';
54
+ else
55
+ $newname = $this->get_field_name($name);
56
+
57
+ $new_formdata[ $newname ] = $formdata[$name];
58
+ }
59
+ $new_names = array_keys($new_formdata);
60
+
61
+ // Finally, replace the old names
62
+ if ( 1 == count($new_names) )
63
+ $args['name'] = $new_names[0];
64
+ else
65
+ $args['name'] = $new_names;
66
+
67
+ // Remember $desc and replace with $title
68
+ if ( $args['desc'] )
69
+ $desc = "<small>{$args['desc']}</small>";
70
+ $args['desc'] = $args['title'];
71
+ unset($args['title']);
72
+
73
+ $input = scbForms::input($args, $new_formdata);
74
+
75
+ return "<p>{$input}\n<br />\n$desc\n</p>\n";
76
+ }
77
+
78
+
79
+ // ____________PRIVATE METHODS____________
80
+
81
+
82
+ static function scb_register() {
83
+ foreach ( self::$widgets as $widget )
84
+ register_widget($widget);
85
+ }
86
+
87
+ static function scb_migrate() {
88
+ foreach ( self::$migrations as $base )
89
+ self::migrate($base);
90
+ }
91
+
92
+ // Migrate from old scbWidget to WP_Widget
93
+ private static function migrate($base) {
94
+ $old_base = 'multiwidget_' . $base;
95
+ $new_base = 'widget_' . $base;
96
+
97
+ if ( ! $old = get_option($old_base) )
98
+ return;
99
+
100
+ foreach ( $old as $widget ) {
101
+ if ( ! $id = $widget['__multiwidget'] )
102
+ continue;
103
+ unset($widget['__multiwidget']);
104
+
105
+ $migrated[$id] = $widget;
106
+ }
107
+
108
+ $widgets = get_option('sidebars_widgets');
109
+
110
+ foreach ( array_keys($migrated) as $key )
111
+ $widgets['wp_inactive_widgets'][] = $base . '-' . $key;
112
+
113
+ update_option('sidebars_widgets', $widgets);
114
+
115
+ $migrated['_multiwidget'] = 1;
116
+
117
+ update_option($new_base, $migrated);
118
+ delete_option($old_base);
119
+ }
120
+ }
121
+
scb/load.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ You can use this code to autoload the available classes of the scbFramework.
4
+ This has the advantage that the user is not required to install scbFramework as a separate plugin.
5
+ Things to note:
6
+ - you have to include the class files with each plugin
7
+ - you will have to update the framework manually
8
+
9
+ To load the classes, you just need to require the file, like so:
10
+
11
+ require_once dirname(__FILE__) . '/scb/load.php';
12
+
13
+ This file needs to be in the same directory as the class files.
14
+ */
15
+
16
+ if ( !class_exists('scbLoad2') ) :
17
+ abstract class scbLoad2 {
18
+ private static $path;
19
+
20
+ static function init($file, $classes) {
21
+ self::$path = dirname($file) . '/';
22
+
23
+ if ( class_exists('scbFramework') )
24
+ self::$path .= 'classes/';
25
+
26
+ foreach ( $classes as $className )
27
+ self::load($className);
28
+ }
29
+
30
+ private static function load($className) {
31
+ if ( class_exists($className) )
32
+ return false;
33
+
34
+ $fpath = self::$path . substr($className, 3) . '.php';
35
+
36
+ if ( ! @file_exists($fpath) )
37
+ return false;
38
+
39
+ include $fpath;
40
+
41
+ return true;
42
+ }
43
+ }
44
+ endif;
45
+
46
+ scbLoad2::init(__FILE__, array(
47
+ 'scbOptions', 'scbForms', 'scbAdminPage', 'scbBoxesPage',
48
+ 'scbWidget', 'scbCron', 'scbTable', 'scbUtil', 'scbRewrite',
49
+ ));
50
+
useronline-js.dev.js CHANGED
@@ -1,52 +1,23 @@
1
- /*
2
- +----------------------------------------------------------------+
3
- | |
4
- | WordPress 2.8 Plugin: WP-UserOnline 2.50 |
5
- | Copyright (c) 2008 Lester "GaMerZ" Chan |
6
- | |
7
- | File Written By: |
8
- | - Lester "GaMerZ" Chan |
9
- | - http://lesterchan.net |
10
- | |
11
- | File Information: |
12
- | - Useronline Javascript File |
13
- | - wp-content/plugins/wp-useronline/useronline-js.js |
14
- | |
15
- +----------------------------------------------------------------+
16
- */
17
-
18
-
19
- // Variables
20
- useronlineL10n.timeout = parseInt(useronlineL10n.timeout);
21
-
22
- // UserOnline JavaScript Init
23
- function useronline_init() {
24
- if(jQuery('#useronline-count').length) {
25
- setInterval("get_useronline_count()", useronlineL10n.timeout);
26
- }
27
- if(jQuery('#useronline-browsing-site').length) {
28
- setInterval("get_useronline_browsingsite()", useronlineL10n.timeout);
29
- }
30
- if(jQuery('#useronline-browsing-page').length) {
31
- setInterval("get_useronline_browsingpage()", useronlineL10n.timeout);
32
- }
33
- }
34
-
35
- // Get UserOnline Count
36
- function get_useronline_count() {
37
- jQuery.ajax({type: 'GET', url: useronlineL10n.ajax_url, data: 'useronline_mode=useronline_count', cache: false, success: function (data) { jQuery('#useronline-count').html(data);}});
38
- }
39
-
40
- // Get Users Browsing Site
41
- function get_useronline_browsingsite() {
42
- jQuery.ajax({type: 'GET', url: useronlineL10n.ajax_url, data: 'useronline_mode=useronline_browsingsite', cache: false, success: function (data) { jQuery('#useronline-browsing-site').html(data);}});
43
- }
44
-
45
- // Get Users Browsing Page
46
- function get_useronline_browsingpage() {
47
- jQuery.ajax({type: 'GET', url: useronlineL10n.ajax_url, data: 'useronline_mode=useronline_browsingpage', cache: false, success: function (data) { jQuery('#useronline-browsing-page').html(data);}});
48
- }
49
-
50
- // Init UserOnline
51
- addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
52
- addLoadEvent(useronline_init);
1
+ jQuery(document).ready(function($){
2
+ var timeout = parseInt(useronlineL10n.timeout);
3
+
4
+ var get_data = function(mode) {
5
+ var data = {
6
+ 'action': 'useronline',
7
+ 'mode': mode
8
+ };
9
+
10
+ $.post(useronlineL10n.ajax_url, data, function(response){
11
+ $('#useronline-' + mode).html(response);
12
+ });
13
+ }
14
+
15
+ if ( $('#useronline-count').length )
16
+ setInterval("get_data('count')", timeout);
17
+
18
+ if ( $('#useronline-browsing-site').length )
19
+ setInterval("get_data('browsing-site')", timeout);
20
+
21
+ if ( $('#useronline-browsing-page').length )
22
+ setInterval("get_data('browsing-page')", timeout);
23
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
useronline-js.js CHANGED
@@ -1 +1 @@
1
- useronlineL10n.timeout=parseInt(useronlineL10n.timeout);function useronline_init(){if(jQuery("#useronline-count").length){setInterval("get_useronline_count()",useronlineL10n.timeout)}if(jQuery("#useronline-browsing-site").length){setInterval("get_useronline_browsingsite()",useronlineL10n.timeout)}if(jQuery("#useronline-browsing-page").length){setInterval("get_useronline_browsingpage()",useronlineL10n.timeout)}}function get_useronline_count(){jQuery.ajax({type:"GET",url:useronlineL10n.ajax_url,data:"useronline_mode=useronline_count",cache:false,success:function(a){jQuery("#useronline-count").html(a)}})}function get_useronline_browsingsite(){jQuery.ajax({type:"GET",url:useronlineL10n.ajax_url,data:"useronline_mode=useronline_browsingsite",cache:false,success:function(a){jQuery("#useronline-browsing-site").html(a)}})}function get_useronline_browsingpage(){jQuery.ajax({type:"GET",url:useronlineL10n.ajax_url,data:"useronline_mode=useronline_browsingpage",cache:false,success:function(a){jQuery("#useronline-browsing-page").html(a)}})}addLoadEvent=function(a){if(typeof jQuery!="undefined"){jQuery(document).ready(a)}else{if(typeof wpOnload!="function"){wpOnload=a}else{var b=wpOnload;wpOnload=function(){b();a()}}}};addLoadEvent(useronline_init);
1
+ jQuery(document).ready(function($){var timeout=parseInt(useronlineL10n.timeout);var get_data=function(mode){var data={action:"useronline",mode:mode};$.post(useronlineL10n.ajax_url,data,function(response){$("#useronline-"+mode).html(response)})};if($("#useronline-count").length){setInterval("get_data('count')",timeout)}if($("#useronline-browsing-site").length){setInterval("get_data('browsing-site')",timeout)}if($("#useronline-browsing-page").length){setInterval("get_data('browsing-page')",timeout)}});
useronline-options.php DELETED
@@ -1,386 +0,0 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 2.8 Plugin: WP-UserOnline 2.50 |
6
- | Copyright (c) 2009 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Useronline Options Page |
14
- | - wp-content/plugins/wp-useronline/useronline-options.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Variables Variables Variables
21
- $base_name = plugin_basename('wp-useronline/useronline-options.php');
22
- $base_page = 'admin.php?page='.$base_name;
23
- $mode = trim($_GET['mode']);
24
- $useronline_tables = array($wpdb->useronline);
25
- $useronline_settings = array('useronline_most_users', 'useronline_most_timestamp', 'useronline_timeout', 'useronline_bots', 'useronline_url', 'useronline_naming', 'useronline_template_useronline', 'useronline_template_browsingsite', 'useronline_template_browsingpage', 'widget_useronline');
26
-
27
-
28
- ### Form Processing
29
- // Update Options
30
- if(!empty($_POST['Submit'])) {
31
- $useronline_bots = array();
32
- $useronline_timeout = intval($_POST['useronline_timeout']);
33
- $useronline_bots_name = explode("\n", trim($_POST['useronline_bots_name']));
34
- $useronline_bots_agent = explode("\n", trim($_POST['useronline_bots_agent']));
35
- $useronline_bots_keys = array_values((array) $useronline_bots_name);
36
- $useronline_bots_vals = array_values((array) $useronline_bots_agent);
37
- $n = max(count($useronline_bots_keys), count($useronline_bots_vals));
38
- for($i = 0; $i < $n; $i++) {
39
- $useronline_bots[trim($useronline_bots_keys[$i])] = trim($useronline_bots_vals[$i]);
40
- }
41
- $useronline_url = trim($_POST['useronline_url']);
42
- $useronline_naming_user = trim($_POST['useronline_naming_user']);
43
- $useronline_naming_users = trim($_POST['useronline_naming_users']);
44
- $useronline_naming_member = trim($_POST['useronline_naming_member']);
45
- $useronline_naming_members = trim($_POST['useronline_naming_members']);
46
- $useronline_naming_guest = trim($_POST['useronline_naming_guest']);
47
- $useronline_naming_guests = trim($_POST['useronline_naming_guests']);
48
- $useronline_naming_bot = trim($_POST['useronline_naming_bot']);
49
- $useronline_naming_bots = trim($_POST['useronline_naming_bots']);
50
- $useronline_naming = array('user' => $useronline_naming_user, 'users' => $useronline_naming_users, 'member' => $useronline_naming_member, 'members' => $useronline_naming_members, 'guest' => $useronline_naming_guest, 'guests' => $useronline_naming_guests, 'bot' => $useronline_naming_bot, 'bots' => $useronline_naming_bots);
51
- $useronline_template_useronline = trim($_POST['useronline_template_useronline']);
52
- $useronline_template_browsingsite = array($_POST['useronline_separator_browsingsite_members'], $_POST['useronline_separator_browsingsite_guests'], $_POST['useronline_separator_browsingsite_bots'], trim($_POST['useronline_template_browsingsite']));
53
- $useronline_template_browsingpage = array($_POST['useronline_separator_browsingpage_members'], $_POST['useronline_separator_browsingpage_guests'], $_POST['useronline_separator_browsingpage_bots'], trim($_POST['useronline_template_browsingpage']));
54
- $update_useronline_queries = array();
55
- $update_useronline_text = array();
56
- $update_useronline_queries[] = update_option('useronline_timeout', $useronline_timeout);
57
- $update_useronline_queries[] = update_option('useronline_bots', $useronline_bots);
58
- $update_useronline_queries[] = update_option('useronline_url', $useronline_url);
59
- $update_useronline_queries[] = update_option('useronline_naming', $useronline_naming);
60
- $update_useronline_queries[] = update_option('useronline_template_useronline', $useronline_template_useronline);
61
- $update_useronline_queries[] = update_option('useronline_template_browsingsite', $useronline_template_browsingsite);
62
- $update_useronline_queries[] = update_option('useronline_template_browsingpage', $useronline_template_browsingpage);
63
- $update_useronline_text[] = __('Useronline Timeout', 'wp-useronline');
64
- $update_useronline_text[] = __('Useronline Bots', 'wp-useronline');
65
- $update_useronline_text[] = __('Useronline URL', 'wp-useronline');
66
- $update_useronline_text[] = __('Useronline Naming Conventions', 'wp-useronline');
67
- $update_useronline_text[] = __('User(s) Online Template', 'wp-useronline');
68
- $update_useronline_text[] = __('User(s) Browsing Site Template', 'wp-useronline');
69
- $update_useronline_text[] = __('User(s) Browsing Page Template', 'wp-useronline');
70
- $i=0;
71
- $text = '';
72
- foreach($update_useronline_queries as $update_useronline_query) {
73
- if($update_useronline_query) {
74
- $text .= '<font color="green">'.$update_useronline_text[$i].' '.__('Updated', 'wp-useronline').'</font><br />';
75
- }
76
- $i++;
77
- }
78
- if(empty($text)) {
79
- $text = '<font color="red">'.__('No Useronline Option Updated', 'wp-useronline').'</font>';
80
- }
81
- }
82
- // Uninstall WP-UserOnline
83
- if(!empty($_POST['do'])) {
84
- switch($_POST['do']) {
85
- case __('UNINSTALL WP-UserOnline', 'wp-useronline') :
86
- if(trim($_POST['uninstall_useronline_yes']) == 'yes') {
87
- echo '<div id="message" class="updated fade">';
88
- echo '<p>';
89
- foreach($useronline_tables as $table) {
90
- $wpdb->query("DROP TABLE {$table}");
91
- echo '<font style="color: green;">';
92
- printf(__('Table \'%s\' has been deleted.', 'wp-useronline'), "<strong><em>{$table}</em></strong>");
93
- echo '</font><br />';
94
- }
95
- echo '</p>';
96
- echo '<p>';
97
- foreach($useronline_settings as $setting) {
98
- $delete_setting = delete_option($setting);
99
- if($delete_setting) {
100
- echo '<font color="green">';
101
- printf(__('Setting Key \'%s\' has been deleted.', 'wp-useronline'), "<strong><em>{$setting}</em></strong>");
102
- echo '</font><br />';
103
- } else {
104
- echo '<font color="red">';
105
- printf(__('Error deleting Setting Key \'%s\'.', 'wp-useronline'), "<strong><em>{$setting}</em></strong>");
106
- echo '</font><br />';
107
- }
108
- }
109
- echo '</p>';
110
- echo '</div>';
111
- $mode = 'end-UNINSTALL';
112
- }
113
- break;
114
- }
115
- }
116
-
117
-
118
- ### Determines Which Mode It Is
119
- switch($mode) {
120
- // Deactivating WP-UserOnline
121
- case 'end-UNINSTALL':
122
- $deactivate_url = 'plugins.php?action=deactivate&amp;plugin=wp-useronline/wp-useronline.php';
123
- if(function_exists('wp_nonce_url')) {
124
- $deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_wp-useronline/wp-useronline.php');
125
- }
126
- echo '<div class="wrap">';
127
- echo '<h2>'.__('Uninstall WP-UserOnline', 'wp-useronline').'</h2>';
128
- echo '<p><strong>'.sprintf(__('<a href="%s">Click Here</a> To Finish The Uninstallation And WP-UserOnline Will Be Deactivated Automatically.', 'wp-useronline'), $deactivate_url).'</strong></p>';
129
- echo '</div>';
130
- break;
131
- // Main Page
132
- default:
133
- $useronline_options_naming = get_option('useronline_naming');
134
- $useronline_options_bots = get_option('useronline_bots');
135
- $useronline_template_browsingsite = get_option('useronline_template_browsingsite');
136
- $useronline_template_browsingpage = get_option('useronline_template_browsingpage');
137
- $useronline_options_bots_name = '';
138
- $useronline_options_bots_agent = '';
139
- foreach($useronline_options_bots as $botname => $botagent) {
140
- $useronline_options_bots_name .= $botname."\n";
141
- $useronline_options_bots_agent .= $botagent."\n";
142
- }
143
- $useronline_options_bots_name = trim($useronline_options_bots_name);
144
- $useronline_options_bots_agent = trim($useronline_options_bots_agent);
145
- ?>
146
- <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
147
- <script type="text/javascript">
148
- /* <![CDATA[*/
149
- function useronline_default_templates(template) {
150
- var default_template;
151
- switch(template) {
152
- case "useronline":
153
- default_template = "<a href=\"%USERONLINE_PAGE_URL%\" title=\"%USERONLINE_USERS%\"><strong>%USERONLINE_USERS%</strong> <?php _e('Online', 'wp-useronline'); ?></a>";
154
- break;
155
- }
156
- jQuery("#useronline_template_" + template).val(default_template);
157
- }
158
-
159
- function useronline_default_naming() {
160
- jQuery("#useronline_naming_user").val("<?php _e('1 User', 'wp-useronline'); ?>");
161
- jQuery("#useronline_naming_users").val("<?php _e('%USERONLINE_COUNT% Users', 'wp-useronline'); ?>");
162
- jQuery("#useronline_naming_member").val("<?php _e('1 Member', 'wp-useronline'); ?>");
163
- jQuery("#useronline_naming_members").val("<?php _e('%USERONLINE_COUNT% Members', 'wp-useronline'); ?>");
164
- jQuery("#useronline_naming_guest").val("<?php _e('1 Guest', 'wp-useronline'); ?>");
165
- jQuery("#useronline_naming_guests").val("<?php _e('%USERONLINE_COUNT% Guests', 'wp-useronline'); ?>");
166
- jQuery("#useronline_naming_bot").val("<?php _e('1 Bot', 'wp-useronline'); ?>");
167
- jQuery("#useronline_naming_bots").val("<?php _e('%USERONLINE_COUNT% Bots', 'wp-useronline'); ?>");
168
- }
169
- function useronline_default_browsing_site() {
170
- jQuery("#useronline_separator_browsingsite_members").val("<?php _e(',', 'wp-useronline') ?> ");
171
- jQuery("#useronline_separator_browsingsite_guests").val("<?php _e(',', 'wp-useronline') ?> ");
172
- jQuery("#useronline_separator_browsingsite_bots").val("<?php _e(',', 'wp-useronline') ?> ");
173
- jQuery("#useronline_template_browsingsite").val("<?php echo(_c('Users|Template Element', 'wp-useronline')); ?>: <strong>%USERONLINE_MEMBER_NAMES%%USERONLINE_GUESTS_SEPERATOR%%USERONLINE_GUESTS%%USERONLINE_BOTS_SEPERATOR%%USERONLINE_BOTS%</strong>");
174
- }
175
- function useronline_default_browsing_page() {
176
- jQuery("#useronline_separator_browsingpage_members").val("<?php _e(',', 'wp-useronline') ?> ");
177
- jQuery("#useronline_separator_browsingpage_guests").val("<?php _e(',', 'wp-useronline') ?> ");
178
- jQuery("#useronline_separator_browsingpage_bots").val("<?php _e(',', 'wp-useronline') ?> ");
179
- jQuery("#useronline_template_browsingpage").val("<strong>%USERONLINE_USERS%</strong> <?php _e('Browsing This Page.', 'wp-useronline'); ?><br /><?php echo(_c('Users|Template Element', 'wp-useronline')); ?>: <strong>%USERONLINE_MEMBER_NAMES%%USERONLINE_GUESTS_SEPERATOR%%USERONLINE_GUESTS%%USERONLINE_BOTS_SEPERATOR%%USERONLINE_BOTS%</strong>");
180
- }
181
- /* ]]> */
182
- </script>
183
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
184
- <div class="wrap">
185
- <?php screen_icon(); ?>
186
- <h2><?php _e('Useronline Options', 'wp-useronline'); ?></h2>
187
- <h3><?php _e('Useronline Options', 'wp-useronline'); ?></h3>
188
- <table class="form-table">
189
- <tr>
190
- <th scope="row" valign="top"><?php _e('Time Out', 'wp-useronline'); ?></th>
191
- <td>
192
- <input type="text" name="useronline_timeout" value="<?php echo get_option('useronline_timeout'); ?>" size="4" /><br /><?php _e('How long till it will remove the user from the database (In seconds).', 'wp-useronline'); ?>
193
- </td>
194
- </tr>
195
- <tr>
196
- <th scope="row" valign="top"><?php _e('UserOnline URL', 'wp-useronline'); ?></th>
197
- <td>
198
- <input type="text" name="useronline_url" value="<?php echo get_option('useronline_url'); ?>" size="50" dir="ltr" /><br /><?php _e('URL To UserOnline Page (leave blank if you do not want to link it to the UserOnline Page)<br />Example: http://www.yoursite.com/blogs/useronline/<br />Example: http://www.yoursite.com/blogs/?page_id=2', 'wp-useronline'); ?>
199
- </td>
200
- </tr>
201
- <tr>
202
- <th scope="row" valign="top"><?php _e('Bots Name/User Agent', 'wp-useronline'); ?></th>
203
- <td>
204
- <?php _e('Here are a list of bots and their partial browser agents.<br />On the left column will be the <strong>Bot\'s Name</strong> and on the right column will be their <strong>Partial Browser Agent</strong>.<br />Start each entry on a new line.', 'wp-useronline'); ?>
205
- <br /><br />
206
- <textarea cols="20" rows="30" name="useronline_bots_name" dir="ltr"><?php echo $useronline_options_bots_name; ?></textarea>
207
- <textarea cols="20" rows="30" name="useronline_bots_agent" dir="ltr"><?php echo $useronline_options_bots_agent; ?></textarea>
208
- </td>
209
- </tr>
210
- <tr>
211
- <td width="30%">
212
- <strong><?php _e('Naming Conventions:', 'wp-useronline'); ?></strong><br /><br /><br />
213
- <?php _e('Allowed Variables:', 'wp-useronline'); ?><br />
214
- - %USERONLINE_COUNT%<br /><br />
215
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-useronline'); ?>" onclick="useronline_default_naming();" class="button" />
216
- </td>
217
- <td>
218
- <table class="form-table">
219
- <thead>
220
- <tr>
221
- <th><?php _e('Singular Form', 'wp-useronline'); ?></th>
222
- <th><?php _e('Plural Form', 'wp-useronline'); ?></th>
223
- </tr>
224
- </thead>
225
- <tbody>
226
- <tr>
227
- <td><input type="text" id="useronline_naming_user" name="useronline_naming_user" value="<?php echo stripslashes($useronline_options_naming['user']); ?>" size="20" /></td>
228
- <td><input type="text" id="useronline_naming_users" name="useronline_naming_users" value="<?php echo stripslashes($useronline_options_naming['users']); ?>" size="40" /></td>
229
- </tr>
230
- <tr>
231
- <td><input type="text" id="useronline_naming_member" name="useronline_naming_member" value="<?php echo stripslashes($useronline_options_naming['member']); ?>" size="20" /></td>
232
- <td><input type="text" id="useronline_naming_members" name="useronline_naming_members" value="<?php echo stripslashes($useronline_options_naming['members']); ?>" size="40" /></td>
233
- </tr>
234
- <tr>
235
- <td><input type="text" id="useronline_naming_guest" name="useronline_naming_guest" value="<?php echo stripslashes($useronline_options_naming['guest']); ?>" size="20" /></td>
236
- <td><input type="text" id="useronline_naming_guests" name="useronline_naming_guests" value="<?php echo stripslashes($useronline_options_naming['guests']); ?>" size="40" /></td>
237
- </tr>
238
- <tr>
239
- <td><input type="text" id="useronline_naming_bot" name="useronline_naming_bot" value="<?php echo stripslashes($useronline_options_naming['bot']); ?>" size="20" /></td>
240
- <td><input type="text" id="useronline_naming_bots" name="useronline_naming_bots" value="<?php echo stripslashes($useronline_options_naming['bots']); ?>" size="40" /></td>
241
- </tr>
242
- </tbody>
243
- </table>
244
- <br />
245
- </td>
246
- </tr>
247
- </table>
248
-
249
- <h3><?php _e('Useronline Templates', 'wp-useronline'); ?></h3>
250
- <table class="form-table">
251
- <tr>
252
- <td width="30%">
253
- <strong><?php _e('User(s) Online:', 'wp-useronline'); ?></strong><br /><br /><br />
254
- <?php _e('Allowed Variables:', 'wp-useronline'); ?><br />
255
- - %USERONLINE_USERS%<br />
256
- - %USERONLINE_PAGE_URL%<br />
257
- - %USERONLINE_MOSTONLINE_COUNT%<br />
258
- - %USERONLINE_MOSTONLINE_DATE%<br /><br />
259
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-useronline'); ?>" onclick="useronline_default_templates('useronline');" class="button" />
260
- </td>
261
- <td><textarea cols="80" rows="12" id="useronline_template_useronline" name="useronline_template_useronline"><?php echo htmlspecialchars(stripslashes(get_option('useronline_template_useronline'))); ?></textarea></td>
262
- </tr>
263
- <tr>
264
- <td width="30%">
265
- <strong><?php _e('User(s) Browsing Site:', 'wp-useronline'); ?></strong><br /><br /><br />
266
- <?php _e('Allowed Variables:', 'wp-useronline'); ?><br />
267
- - %USERONLINE_USERS%<br />
268
- - %USERONLINE_MEMBERS%<br />
269
- - %USERONLINE_MEMBER_NAMES%<br />
270
- - %USERONLINE_GUESTS_SEPERATOR%<br />
271
- - %USERONLINE_GUESTS%<br />
272
- - %USERONLINE_BOTS_SEPERATOR%<br />
273
- - %USERONLINE_BOTS%<br /><br />
274
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-useronline'); ?>" onclick="useronline_default_browsing_site();" class="button" />
275
- </td>
276
- <td>
277
- <table class="form-table">
278
- <thead>
279
- <tr>
280
- <th><?php _e('Member Names Separator', 'wp-useronline'); ?></th>
281
- <th><?php _e('Guests Separator', 'wp-useronline'); ?></th>
282
- <th><?php _e('Bots Separator', 'wp-useronline'); ?></th>
283
- </tr>
284
- </thead>
285
- <tr>
286
- <td><input type="text" id="useronline_separator_browsingsite_members" name="useronline_separator_browsingsite_members" value="<?php echo stripslashes($useronline_template_browsingsite[0]); ?>" size="15" /></td>
287
- <td><input type="text" id="useronline_separator_browsingsite_guests" name="useronline_separator_browsingsite_guests" value="<?php echo stripslashes($useronline_template_browsingsite[1]); ?>" size="15" /></td>
288
- <td><input type="text" id="useronline_separator_browsingsite_bots" name="useronline_separator_browsingsite_bots" value="<?php echo stripslashes($useronline_template_browsingsite[2]); ?>" size="15" /></td>
289
- </tr>
290
- </table>
291
- <br />
292
- <textarea cols="80" rows="12" id="useronline_template_browsingsite" name="useronline_template_browsingsite"><?php echo htmlspecialchars(stripslashes($useronline_template_browsingsite[3])); ?></textarea>
293
- </td>
294
- </tr>
295
- <tr>
296
- <td width="30%">
297
- <strong><?php _e('User(s) Browsing Page:', 'wp-useronline'); ?></strong><br /><br /><br />
298
- <?php _e('Allowed Variables:', 'wp-useronline'); ?><br />
299
- - %USERONLINE_USERS%<br />
300
- - %USERONLINE_MEMBERS%<br />
301
- - %USERONLINE_MEMBER_NAMES%<br />
302
- - %USERONLINE_GUESTS_SEPERATOR%<br />
303
- - %USERONLINE_GUESTS%<br />
304
- - %USERONLINE_BOTS_SEPERATOR%<br />
305
- - %USERONLINE_BOTS%<br /><br />
306
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-useronline'); ?>" onclick="useronline_default_browsing_page();" class="button" />
307
- </td>
308
- <td>
309
- <table class="form-table">
310
- <thead>
311
- <tr>
312
- <th><?php _e('Member Names Separator', 'wp-useronline'); ?></th>
313
- <th><?php _e('Guests Separator', 'wp-useronline'); ?></th>
314
- <th><?php _e('Bots Separator', 'wp-useronline'); ?></th>
315
- </tr>
316
- </thead>
317
- <tr>
318
- <td><input type="text" id="useronline_separator_browsingpage_members" name="useronline_separator_browsingpage_members" value="<?php echo stripslashes($useronline_template_browsingpage[0]); ?>" size="15" /></td>
319
- <td><input type="text" id="useronline_separator_browsingpage_guests" name="useronline_separator_browsingpage_guests" value="<?php echo stripslashes($useronline_template_browsingpage[1]); ?>" size="15" /></td>
320
- <td><input type="text" id="useronline_separator_browsingpage_bots" name="useronline_separator_browsingpage_bots" value="<?php echo stripslashes($useronline_template_browsingpage[2]); ?>" size="15" /></td>
321
- </tr>
322
- </table>
323
- <br />
324
- <textarea cols="80" rows="12" id="useronline_template_browsingpage" name="useronline_template_browsingpage"><?php echo htmlspecialchars(stripslashes($useronline_template_browsingpage[3])); ?></textarea>
325
- </td>
326
- </tr>
327
- </table>
328
- <p class="submit">
329
- <input type="submit" name="Submit" class="button" value="<?php _e('Save Changes', 'wp-useronline'); ?>" />
330
- </p>
331
- </div>
332
- </form>
333
- <p>&nbsp;</p>
334
-
335
- <!-- Uninstall WP-UserOnline -->
336
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
337
- <div class="wrap">
338
- <h3><?php _e('Uninstall WP-UserOnline', 'wp-useronline'); ?></h3>
339
- <p>
340
- <?php _e('Deactivating WP-UserOnline plugin does not remove any data that may have been created, such as the useronline options. To completely remove this plugin, you can uninstall it here.', 'wp-useronline'); ?>
341
- </p>
342
- <p style="color: red">
343
- <strong><?php _e('WARNING:', 'wp-useronline'); ?></strong><br />
344
- <?php _e('Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first.', 'wp-useronline'); ?>
345
- </p>
346
- <p style="color: red">
347
- <strong><?php _e('The following WordPress Options/Tables will be DELETED:', 'wp-useronline'); ?></strong><br />
348
- </p>
349
- <table class="widefat">
350
- <thead>
351
- <tr>
352
- <th><?php _e('WordPress Options', 'wp-useronline'); ?></th>
353
- <th><?php _e('WordPress Tables', 'wp-useronline'); ?></th>
354
- </tr>
355
- </thead>
356
- <tr>
357
- <td valign="top">
358
- <ol>
359
- <?php
360
- foreach($useronline_settings as $settings) {
361
- echo '<li>'.$settings.'</li>'."\n";
362
- }
363
- ?>
364
- </ol>
365
- </td>
366
- <td valign="top" class="alternate">
367
- <ol>
368
- <?php
369
- foreach($useronline_tables as $tables) {
370
- echo '<li>'.$tables.'</li>'."\n";
371
- }
372
- ?>
373
- </ol>
374
- </td>
375
- </tr>
376
- </table>
377
- <p>&nbsp;</p>
378
- <p style="text-align: center;">
379
- <input type="checkbox" name="uninstall_useronline_yes" value="yes" />&nbsp;<?php _e('Yes', 'wp-useronline'); ?><br /><br />
380
- <input type="submit" name="do" value="<?php _e('UNINSTALL WP-UserOnline', 'wp-useronline'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Uninstall WP-UserOnline From WordPress.\nThis Action Is Not Reversible.\n\n Choose [Cancel] To Stop, [OK] To Uninstall.', 'wp-useronline'); ?>')" />
381
- </p>
382
- </div>
383
- </form>
384
- <?php
385
- } // End switch($mode)
386
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
widget.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class UserOnline_Widget extends scbWidget {
4
+ function UserOnline_Widget() {
5
+ $widget_ops = array('description' => __('WP-UserOnline users online statistics', 'wp-useronline'));
6
+ $this->WP_Widget('useronline', __('UserOnline', 'wp-useronline'), $widget_ops);
7
+ }
8
+
9
+ function content($instance) {
10
+ $type = esc_attr($instance['type']);
11
+
12
+ echo '<ul>'."\n";
13
+ switch($type) {
14
+ case 'users_online':
15
+ echo '<li><div id="useronline-count">';
16
+ get_useronline();
17
+ echo '</div></li>'."\n";
18
+ break;
19
+ case 'users_browsing_page':
20
+ echo '<li><div id="useronline-browsing-page">';
21
+ get_users_browsing_page();
22
+ echo '</div></li>'."\n";
23
+ break;
24
+ case 'users_browsing_site':
25
+ echo '<li><div id="useronline-browsing-site">';
26
+ get_users_browsing_site();
27
+ echo '</div></li>'."\n";
28
+ break;
29
+ case 'users_online_browsing_page':
30
+ echo '<li><div id="useronline-count">';
31
+ get_useronline();
32
+ echo '</div></li>'."\n";
33
+ echo '<li><div id="useronline-browsing-page">';
34
+ get_users_browsing_page();
35
+ echo '</div></li>'."\n";
36
+ break;
37
+ case 'users_online_browsing_site':
38
+ echo '<li><div id="useronline-count">';
39
+ get_useronline();
40
+ echo '</div></li>'."\n";
41
+ echo '<li><div id="useronline-browsing-site">';
42
+ get_users_browsing_site();
43
+ echo '</div></li>'."\n";
44
+ break;
45
+ }
46
+ echo "</ul>\n";
47
+ }
48
+
49
+ function update($new_instance, $old_instance) {
50
+ if ( !isset($new_instance['submit']) )
51
+ return false;
52
+
53
+ $instance = $old_instance;
54
+ $instance['title'] = strip_tags($new_instance['title']);
55
+ $instance['type'] = strip_tags($new_instance['type']);
56
+
57
+ return $instance;
58
+ }
59
+
60
+ function form($instance) {
61
+ global $wpdb;
62
+ $instance = wp_parse_args((array) $instance, array(
63
+ 'title' => __('UserOnline', 'wp-useronline'),
64
+ 'type' => 'users_online'
65
+ ));
66
+ $title = esc_attr($instance['title']);
67
+ $type = esc_attr($instance['type']);
68
+ ?>
69
+ <p>
70
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'wp-useronline'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label>
71
+ </p>
72
+ <p>
73
+ <label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Statistics Type:', 'wp-useronline'); ?>
74
+ <select name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>" class="widefat">
75
+ <option value="users_online"<?php selected('users_online', $type); ?>><?php _e('Users Online Count', 'wp-useronline'); ?></option>
76
+ <option value="users_browsing_page"<?php selected('users_browsing_page', $type); ?>><?php _e('Users Browsing Current Page', 'wp-useronline'); ?></option>
77
+ <option value="users_browsing_site"<?php selected('users_browsing_site', $type); ?>><?php _e('Users Browsing Site', 'wp-useronline'); ?></option>
78
+ <optgroup>&nbsp;</optgroup>
79
+ <option value="users_online_browsing_page"<?php selected('users_online_browsing_page', $type); ?>><?php _e('Users Online Count & Users Browsing Current Page', 'wp-useronline'); ?></option>
80
+ <option value="users_online_browsing_site"<?php selected('users_online_browsing_site', $type); ?>><?php _e('Users Online Count & Users Browsing Site', 'wp-useronline'); ?></option>
81
+ </select>
82
+ </label>
83
+ </p>
84
+ <input type="hidden" id="<?php echo $this->get_field_id('submit'); ?>" name="<?php echo $this->get_field_name('submit'); ?>" value="1" />
85
+ <?php
86
+ }
87
+ }
88
+
wp-stats.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class UserOnline_WpStats {
4
+ function init() {
5
+ add_filter('wp_stats_page_admin_plugins', array(__CLASS__, 'page_admin_general_stats'));
6
+ add_filter('wp_stats_page_plugins', array(__CLASS__, 'page_general_stats'));
7
+
8
+ add_filter('useronline_display_name', array(__CLASS__, 'stats_page_link'));
9
+ }
10
+
11
+ function stats_page_link($author) {
12
+ $stats_url = add_query_arg('stats_author', urlencode($author), get_option('stats_url'));
13
+
14
+ return html_link($stats_url, $author);
15
+ }
16
+
17
+ // Add WP-UserOnline General Stats To WP-Stats Page Options
18
+ function page_admin_general_stats($content) {
19
+ $stats_display = get_option('stats_display');
20
+
21
+ $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_useronline" value="useronline"' . checked($stats_display['useronline'], 1, false) . '/>&nbsp;&nbsp;<label for="wpstats_useronline">'.__('WP-UserOnline', 'wp-useronline').'</label><br />'."\n";
22
+
23
+ return $content;
24
+ }
25
+
26
+ // Add WP-UserOnline General Stats To WP-Stats Page
27
+ function page_general_stats($content) {
28
+ $stats_display = get_option('stats_display');
29
+
30
+ $str = _n(
31
+ '<strong>%s</strong> user online now.',
32
+ '<strong>%s</strong> users online now.',
33
+ get_useronline_count(), 'wp-useronline'
34
+ );
35
+
36
+ if ( $stats_display['useronline'] == 1 )
37
+ $content .=
38
+ html('p', html('strong', __('WP-UserOnline', 'wp-useronline')))
39
+ .html('ul',
40
+ html('li', sprintf($str, number_format_i18n(get_useronline_count())))
41
+ .html('li', UserOnline_Template::format_most_users())
42
+ );
43
+
44
+ return $content;
45
+ }
46
+ }
47
+ UserOnline_WpStats::init();
48
+
wp-useronline.mo DELETED
Binary file
wp-useronline.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  /*
3
  Plugin Name: WP-UserOnline
4
- Plugin URI: http://lesterchan.net/portfolio/programming/php/
5
  Description: Enable you to display how many users are online on your Wordpress blog with detailed statistics of where they are and who there are(Members/Guests/Search Bots).
6
- Version: 2.50
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: http://lesterchan.net
9
  */
10
 
11
 
12
- /*
13
  Copyright 2009 Lester Chan (email : lesterchan@gmail.com)
14
 
15
  This program is free software; you can redistribute it and/or modify
@@ -27,221 +27,272 @@ Author URI: http://lesterchan.net
27
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
  */
29
 
 
30
 
31
- ### Load WP-Config File If This File Is Called Directly
32
- if (!function_exists('add_action')) {
33
- $wp_root = '../../..';
34
- if (file_exists($wp_root.'/wp-load.php')) {
35
- require_once($wp_root.'/wp-load.php');
36
- } else {
37
- require_once($wp_root.'/wp-config.php');
 
 
 
 
 
 
 
 
38
  }
39
- }
40
 
 
 
 
 
41
 
42
- ### Create Text Domain For Translations
43
- add_action('init', 'useronline_textdomain');
44
- function useronline_textdomain() {
45
- load_plugin_textdomain('wp-useronline', false, 'wp-useronline');
46
- }
 
 
 
 
 
 
 
 
47
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
- ### UserOnline Table Name
50
- global $wpdb;
51
- $wpdb->useronline = $wpdb->prefix.'useronline';
52
 
 
 
 
 
 
 
53
 
54
- ### Function: WP-UserOnline Menu
55
- add_action('admin_menu', 'useronline_menu');
56
- function useronline_menu() {
57
- if (function_exists('add_submenu_page')) {
58
- add_submenu_page('index.php', __('WP-UserOnline', 'wp-useronline'), __('WP-UserOnline', 'wp-useronline'), 1, 'wp-useronline/wp-useronline.php', 'display_useronline');
 
59
  }
60
- if (function_exists('add_options_page')) {
61
- add_options_page(__('UserOnline', 'wp-useronline'), __('UserOnline', 'wp-useronline'), 'manage_options', 'wp-useronline/useronline-options.php');
 
 
 
 
62
  }
63
- }
64
 
 
 
 
 
 
 
 
65
 
66
- ### Function: Print Out jQuery Script At The Top
67
- add_action('wp_head', 'useronline_javascripts_header');
68
- function useronline_javascripts_header() {
69
- wp_print_scripts('jquery');
70
- }
71
 
 
 
 
72
 
73
- ### Function: Enqueue Useronline Javascripts/CSS
74
- add_action('wp_enqueue_scripts', 'useronline_scripts');
75
- function useronline_scripts() {
76
- wp_enqueue_script('wp-useronline', plugins_url('wp-useronline/useronline-js.js'), array('jquery'), '2.50', true);
77
- wp_localize_script('wp-useronline', 'useronlineL10n', array(
78
- 'ajax_url' => plugins_url('wp-useronline/wp-useronline.php'),
79
- 'timeout' => (get_option('useronline_timeout')*1000)
80
- ));
81
- }
82
 
 
 
 
 
 
83
 
84
- ### Function: Process UserOnline
85
- add_action('admin_head', 'useronline');
86
- add_action('wp_head', 'useronline');
87
- function useronline() {
88
- global $wpdb, $useronline;
89
- // Useronline Settings
90
- $timeoutseconds = get_option('useronline_timeout');
91
- $timestamp = current_time('timestamp');
92
- $timeout = ($timestamp-$timeoutseconds);
93
- $ip = get_ipaddress();
94
- $url = addslashes(urlencode($_SERVER['REQUEST_URI']));
95
- $referral = '';
96
- $useragent = $_SERVER['HTTP_USER_AGENT'];
97
- $current_user = wp_get_current_user();
98
- if(!empty($_SERVER['HTTP_REFERER'])) {
99
- $referral = addslashes(urlencode(strip_tags($_SERVER['HTTP_REFERER'])));
100
- }
101
- // Check For Bot
102
- $bots = get_option('useronline_bots');
103
- foreach ($bots as $name => $lookfor) {
104
- if (stristr($useragent, $lookfor) !== false) {
105
- $user_id = 0;
106
- $display_name = addslashes($name);
107
- $user_name = addslashes($lookfor);
108
  $type = 'bot';
109
  $where = "WHERE ip = '$ip'";
110
  $bot_found = true;
 
111
  break;
112
- }
113
- }
114
 
115
- // If No Bot Is Found, Then We Check Members And Guests
116
- if(!$bot_found) {
117
- // Check For Member
118
- if($current_user->ID > 0) {
119
- $user_id = $current_user->ID;
120
- $display_name = addslashes($current_user->display_name);
121
- $user_name = addslashes($current_user->user_login);
122
- $type = 'member';
123
- $where = "WHERE userid = '$user_id'";
124
- // Check For Comment Author (Guest)
125
- } elseif(!empty($_COOKIE['comment_author_'.COOKIEHASH])) {
126
- $user_id = 0;
127
- $display_name = addslashes(trim($_COOKIE['comment_author_'.COOKIEHASH]));
128
- $user_name = __('guest', 'wp-useronline').'_'.$display_name;
129
- $type = 'guest';
130
- $where = "WHERE ip = '$ip'";
131
- // Check For Guest
 
 
 
 
 
 
 
 
 
 
 
 
132
  } else {
133
- $user_id = 0;
134
- $display_name = __('Guest', 'wp-useronline');
135
- $user_name = "guest";
136
- $type = 'guest';
137
- $where = "WHERE ip = '$ip'";
 
138
  }
139
- }
140
 
141
- // Get User Agent
142
- $useragent = addslashes($useragent);
143
 
144
- // Check For Page Title
145
- $make_page = wp_title('&raquo;', false);
146
- if(empty($make_page)) {
147
- $make_page = get_bloginfo('name').' &raquo; '.$_SERVER['REQUEST_URI'];
148
- } elseif(is_single()) {
149
- $make_page = get_bloginfo('name').' &raquo; '.__('Blog Archive', 'wp-useronline').' '.$make_page;
150
- } else {
151
- $make_page = get_bloginfo('name').$make_page;
 
 
 
 
 
 
 
 
152
  }
153
- $make_page = addslashes($make_page);
154
 
155
- // Delete Users
156
- $delete_users = $wpdb->query("DELETE FROM $wpdb->useronline $where OR (timestamp < $timeout)");
157
-
158
- // Insert Users
159
- $insert_user = $wpdb->query("INSERT INTO $wpdb->useronline VALUES ('$timestamp', '$user_id', '$user_name', '$display_name', '$useragent', '$ip', '$make_page', '$url', '$type', '$referral')");
160
 
161
- // Count Users Online
162
- $useronline = intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline"));
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
- // Get Most User Online
165
- $most_useronline = intval(get_option('useronline_most_users'));
 
 
 
166
 
167
- // Check Whether Current Users Online Is More Than Most Users Online
168
- if($useronline > $most_useronline) {
169
- update_option('useronline_most_users', $useronline);
170
- update_option('useronline_most_timestamp', current_time('timestamp'));
171
  }
172
- }
173
 
 
 
174
 
175
- ### Function: Display UserOnline
176
- if(!function_exists('get_useronline')) {
177
- function get_useronline($display = true) {
178
- // Template - Naming Conventions
179
- $useronline_naming = get_option('useronline_naming');
180
- // Template - User(s) Online
181
- $template_useronline = stripslashes(get_option('useronline_template_useronline'));
182
- $template_useronline = str_replace('%USERONLINE_PAGE_URL%', get_option('useronline_url'), $template_useronline);
183
- $template_useronline = str_replace('%USERONLINE_MOSTONLINE_COUNT%', number_format_i18n(get_most_useronline()), $template_useronline);
184
- $template_useronline = str_replace('%USERONLINE_MOSTONLINE_DATE%', get_most_useronline_date(), $template_useronline);
185
- if(get_useronline_count() == 1) {
186
- $template_useronline = str_replace('%USERONLINE_USERS%', stripslashes($useronline_naming['user']), $template_useronline);
187
- } else {
188
- $useronline_naming_users = str_replace('%USERONLINE_COUNT%', number_format_i18n(get_useronline_count()), stripslashes($useronline_naming['users']));
189
- $template_useronline = str_replace('%USERONLINE_USERS%', $useronline_naming_users, $template_useronline);
190
- }
191
- if($display) {
192
- echo $template_useronline;
193
- } else {
194
- return $template_useronline;
195
- }
196
  }
197
  }
198
 
 
 
 
 
 
 
199
 
200
- ### Function: Display UserOnline Count
201
- if(!function_exists('get_useronline_count')) {
202
- function get_useronline_count($display = false) {
203
- global $useronline;
204
- if($display) {
205
- echo number_format_i18n($useronline);
206
- } else {
207
- return $useronline;
208
- }
209
- }
210
  }
211
 
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
  ### Function: Display Max UserOnline
214
- if(!function_exists('get_most_useronline')) {
215
- function get_most_useronline($display = false) {
216
- $most_useronline_users = intval(get_option('useronline_most_users'));
217
- if($display) {
218
- echo number_format_i18n($most_useronline_users);
219
- } else {
220
- return $most_useronline_users;
221
- }
222
  }
223
  }
224
 
225
-
226
  ### Function: Display Max UserOnline Date
227
- if(!function_exists('get_most_useronline_date')) {
228
- function get_most_useronline_date($display = false) {
229
- $most_useronline_timestamp = get_option('useronline_most_timestamp');
230
- $most_useronline_date = mysql2date(sprintf(__('%s @ %s', 'wp-useronline'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $most_useronline_timestamp));
231
- if($display) {
232
- echo $most_useronline_date;
233
- } else {
234
- return $most_useronline_date;
235
- }
236
- }
237
- }
238
 
 
 
 
 
 
239
 
240
  ### Function Check If User Is Online
241
- function is_online($user_login) {
242
  global $wpdb;
243
- $is_online = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline WHERE username = '$user_login' LIMIT 1");
244
- return intval($is_online);
245
  }
246
 
247
 
@@ -250,7 +301,7 @@ function is_online($user_login) {
250
  //add_action('wp_head', 'update_memberlastvisit');
251
  function update_memberlastvisit() {
252
  global $current_user, $user_ID;
253
- if(!empty($current_user) && is_user_logged_in()) {
254
  update_user_option($user_ID, 'member_last_login', current_time('timestamp'));
255
  }
256
  }
@@ -258,12 +309,7 @@ function update_memberlastvisit() {
258
 
259
  ### Function: Get Member last Visit
260
  function get_memberlastvisit($user_id = 0) {
261
- $date_format = sprintf(__('%s @ %s', 'wp-useronline'), get_option('date_format'), get_option('time_format'));
262
- if($user_id == 0) {
263
- return mysql2date($date_format, gmdate('Y-m-d H:i:s', get_user_option('member_last_login')));
264
- } else {
265
- return mysql2date($date_format, gmdate('Y-m-d H:i:s', get_user_option('member_last_login', $user_id)));
266
- }
267
  }
268
 
269
 
@@ -271,747 +317,236 @@ function get_memberlastvisit($user_id = 0) {
271
  function get_users_browsing_site($display = true) {
272
  global $wpdb;
273
 
274
- // Get Users Browsing Site
275
- $page_url = addslashes(urlencode($_SERVER['REQUEST_URI']));
276
- $users_browse = $wpdb->get_results("SELECT displayname, type FROM $wpdb->useronline ORDER BY type");
277
-
278
- // Variables
279
- $members = array();
280
- $guests = array();
281
- $bots = array();
282
- $total_members = 0;
283
- $total_guests = 0;
284
- $total_bots = 0;
285
- $nicetext_members = '';
286
- $nicetext_guests = '';
287
- $nicetext_bots = '';
288
-
289
- // If There Is Users Browsing, Then We Execute
290
- if($users_browse) {
291
- // Get Users Information
292
- foreach($users_browse as $user_browse) {
293
- switch($user_browse->type) {
294
- case 'member':
295
- $members[] = stripslashes($user_browse->displayname);
296
- $total_members++;
297
- break;
298
- case 'guest':
299
- $guests[] = stripslashes($user_browse->displayname);
300
- $total_guests++;
301
- break;
302
- case 'bot':
303
- $bots[] = stripslashes($user_browse->displayname);
304
- $total_bots++;
305
- break;
306
- }
307
- }
308
-
309
- // If We Do Not Display It, Return Respective Users Count
310
- if(!$display) {
311
- return array($total_members, $total_guests, $total_bots);
312
- }
313
-
314
- // Template - Naming Conventions
315
- $useronline_naming = get_option('useronline_naming');
316
-
317
- // Template - User(s) Browsing Site
318
- $options_browsingsite = get_option('useronline_template_browsingsite');
319
- $separator_members_browsingsite = stripslashes($options_browsingsite[0]);
320
- $separator_guests_browsingsite = stripslashes($options_browsingsite[1]);
321
- $separator_bots_browsingsite = stripslashes($options_browsingsite[2]);
322
- $template_browsingsite = stripslashes($options_browsingsite[3]);
323
-
324
- // Nice Text For Users
325
- if(get_useronline_count() == 1) {
326
- $template_browsingsite = str_replace('%USERONLINE_USERS%', stripslashes($useronline_naming['user']), $template_browsingsite);
327
- } else {
328
- $useronline_naming_users = str_replace('%USERONLINE_COUNT%', number_format_i18n(get_useronline_count()), stripslashes($useronline_naming['users']));
329
- $template_browsingsite = str_replace('%USERONLINE_USERS%', $useronline_naming_users, $template_browsingsite);
330
- }
331
-
332
- // Print Member Name
333
- if($members) {
334
- $temp_member = '';
335
- if(!function_exists('get_totalposts')) {
336
- foreach($members as $member) {
337
- $temp_member .= $member.$separator_members_browsingsite;
338
- }
339
- } else {
340
- foreach($members as $member) {
341
- $temp_member .= useronline_stats_page_link($member).$separator_members_browsingsite;
342
- }
343
- }
344
- $template_browsingsite = str_replace('%USERONLINE_MEMBER_NAMES%', substr($temp_member, 0, -strlen($separator_members_browsingsite)), $template_browsingsite);
345
- } else {
346
- $template_browsingsite = str_replace('%USERONLINE_MEMBER_NAMES%', '', $template_browsingsite);
347
- }
348
-
349
- // Nice Text For Members
350
- if($total_members > 1) {
351
- $useronline_naming_members = str_replace('%USERONLINE_COUNT%', number_format_i18n($total_members), stripslashes($useronline_naming['members']));
352
- $template_browsingsite = str_replace('%USERONLINE_MEMBERS%', $useronline_naming_members, $template_browsingsite);
353
- } elseif($total_members == 1) {
354
- $template_browsingsite = str_replace('%USERONLINE_MEMBERS%', stripslashes($useronline_naming['member']), $template_browsingsite);
355
- } else {
356
- $template_browsingsite = str_replace('%USERONLINE_MEMBERS%', '', $template_browsingsite);
357
- }
358
-
359
- // Nice Text For Guests
360
- if($total_guests > 1) {
361
- $useronline_naming_guests = str_replace('%USERONLINE_COUNT%', number_format_i18n($total_guests), stripslashes($useronline_naming['guests']));
362
- $template_browsingsite = str_replace('%USERONLINE_GUESTS%', $useronline_naming_guests, $template_browsingsite);
363
- } elseif($total_guests == 1) {
364
- $template_browsingsite = str_replace('%USERONLINE_GUESTS%', stripslashes($useronline_naming['guest']), $template_browsingsite);
365
- } else {
366
- $template_browsingsite = str_replace('%USERONLINE_GUESTS%', '', $template_browsingsite);
367
- }
368
 
369
- // Nice Text For Bots
370
- if($total_bots > 1) {
371
- $useronline_naming_bots = str_replace('%USERONLINE_COUNT%', number_format_i18n($total_bots), stripslashes($useronline_naming['bots']));
372
- $template_browsingsite = str_replace('%USERONLINE_BOTS%', $useronline_naming_bots, $template_browsingsite);
373
- } elseif($total_bots == 1) {
374
- $template_browsingsite = str_replace('%USERONLINE_BOTS%', stripslashes($useronline_naming['bot']), $template_browsingsite);
375
- } else {
376
- $template_browsingsite = str_replace('%USERONLINE_BOTS%', '', $template_browsingsite);
377
- }
378
- // Seperators
379
- if($total_members > 0 && $total_guests > 0) {
380
- $template_browsingsite = str_replace('%USERONLINE_GUESTS_SEPERATOR%', $separator_guests_browsingsite, $template_browsingsite);
381
- } else {
382
- $template_browsingsite = str_replace('%USERONLINE_GUESTS_SEPERATOR%', '', $template_browsingsite);
383
- }
384
- if(($total_guests > 0 || $total_members > 0) && $total_bots > 0) {
385
- $template_browsingsite = str_replace('%USERONLINE_BOTS_SEPERATOR%', $separator_bots_browsingsite, $template_browsingsite);
386
- } else {
387
- $template_browsingsite = str_replace('%USERONLINE_BOTS_SEPERATOR%', '', $template_browsingsite);
388
- }
389
 
390
- // Output The Template
391
- echo $template_browsingsite;
392
- } else {
393
- // This Should Not Happen
394
- global $l10n;
395
- if (!isset($l10n['wp-useronline'])) {
396
- useronline_textdomain();
397
- }
398
- _e('No User Is Browsing This Site', 'wp-useronline');
399
- }
400
  }
401
 
402
-
403
  ### Function: Display Users Browsing The Page
404
  function get_users_browsing_page($display = true) {
405
  global $wpdb;
406
 
407
- // Get Users Browsing Page
408
- $page_url = addslashes(urlencode($_SERVER['REQUEST_URI']));
409
- $users_browse = $wpdb->get_results("SELECT displayname, type FROM $wpdb->useronline WHERE url = '$page_url' ORDER BY type");
410
-
411
- // Variables
412
- $members = array();
413
- $guests = array();
414
- $bots = array();
415
- $total_users = 0;
416
- $total_members = 0;
417
- $total_guests = 0;
418
- $total_bots = 0;
419
- $nicetext_members = '';
420
- $nicetext_guests = '';
421
- $nicetext_bots = '';
422
-
423
- // If There Is Users Browsing, Then We Execute
424
- if($users_browse) {
425
- // Reassign Bots Name
426
- $bots = get_option('useronline_bots');
427
- $bots_name = array();
428
- foreach($bots as $botname => $botlookfor) {
429
- $bots_name[] = $botname;
430
- }
431
- // Get Users Information
432
- foreach($users_browse as $user_browse) {
433
- switch($user_browse->type) {
434
- case 'member':
435
- $members[] = stripslashes($user_browse->displayname);
436
- $total_members++;
437
- break;
438
- case 'guest':
439
- $guests[] = stripslashes($user_browse->displayname);
440
- $total_guests++;
441
- break;
442
- case 'bot':
443
- $bots[] = stripslashes($user_browse->displayname);
444
- $total_bots++;
445
- break;
446
- }
447
- }
448
- $total_users = ($total_guests+$total_bots+$total_members);
449
-
450
- // If We Do Not Display It, Return Respective Users Count
451
- if(!$display) {
452
- return array ($total_users, $total_members, $total_guests, $total_bots);
453
- }
454
-
455
- // Template - Naming Conventions
456
- $useronline_naming = get_option('useronline_naming');
457
 
458
- // Template - User(s) Browsing Site
459
- $options_browsingpage = get_option('useronline_template_browsingpage');
460
- $separator_members_browsingpage = stripslashes($options_browsingpage[0]);
461
- $separator_guests_browsingpage = stripslashes($options_browsingpage[1]);
462
- $separator_bots_browsingpage = stripslashes($options_browsingpage[2]);
463
- $template_browsingpage = stripslashes($options_browsingpage[3]);
464
 
465
- // Nice Text For Users
466
- if($total_users == 1) {
467
- $template_browsingpage = str_replace('%USERONLINE_USERS%', stripslashes($useronline_naming['user']), $template_browsingpage);
468
- } else {
469
- $useronline_naming_users = str_replace('%USERONLINE_COUNT%', number_format_i18n($total_users), stripslashes($useronline_naming['users']));
470
- $template_browsingpage = str_replace('%USERONLINE_USERS%', $useronline_naming_users, $template_browsingpage);
471
- }
472
 
473
- // Print Member Name
474
- if($members) {
475
- $temp_member = '';
476
- if(!function_exists('get_totalposts')) {
477
- foreach($members as $member) {
478
- $temp_member .= $member.$separator_members_browsingpage;
479
- }
480
- } else {
481
- foreach($members as $member) {
482
- $temp_member .= useronline_stats_page_link($member).$separator_members_browsingpage;
483
- }
484
- }
485
- $template_browsingpage = str_replace('%USERONLINE_MEMBER_NAMES%', substr($temp_member, 0, -strlen($separator_members_browsingpage)), $template_browsingpage);
486
- } else {
487
- $template_browsingpage = str_replace('%USERONLINE_MEMBER_NAMES%', '', $template_browsingpage);
488
- }
489
 
490
- // Nice Text For Members
491
- if($total_members > 1) {
492
- $useronline_naming_members = str_replace('%USERONLINE_COUNT%', number_format_i18n($total_members), stripslashes($useronline_naming['members']));
493
- $template_browsingpage = str_replace('%USERONLINE_MEMBERS%', $useronline_naming_members, $template_browsingpage);
494
- } elseif($total_members == 1) {
495
- $template_browsingpage = str_replace('%USERONLINE_MEMBERS%', stripslashes($useronline_naming['member']), $template_browsingpage);
496
- } else {
497
- $template_browsingpage = str_replace('%USERONLINE_MEMBERS%', '', $template_browsingpage);
498
- }
499
-
500
- // Nice Text For Guests
501
- if($total_guests > 1) {
502
- $useronline_naming_guests = str_replace('%USERONLINE_COUNT%', number_format_i18n($total_guests), stripslashes($useronline_naming['guests']));
503
- $template_browsingpage = str_replace('%USERONLINE_GUESTS%', $useronline_naming_guests, $template_browsingpage);
504
- } elseif($total_guests == 1) {
505
- $template_browsingpage = str_replace('%USERONLINE_GUESTS%', stripslashes($useronline_naming['guest']), $template_browsingpage);
506
- } else {
507
- $template_browsingpage = str_replace('%USERONLINE_GUESTS%', '', $template_browsingpage);
508
- }
509
 
510
- // Nice Text For Bots
511
- if($total_bots > 1) {
512
- $useronline_naming_bots = str_replace('%USERONLINE_COUNT%', number_format_i18n($total_bots), stripslashes($useronline_naming['bots']));
513
- $template_browsingpage = str_replace('%USERONLINE_BOTS%', $useronline_naming_bots, $template_browsingpage);
514
- } elseif($total_bots == 1) {
515
- $template_browsingpage = str_replace('%USERONLINE_BOTS%', stripslashes($useronline_naming['bot']), $template_browsingpage);
516
- } else {
517
- $template_browsingpage = str_replace('%USERONLINE_BOTS%', '', $template_browsingpage);
518
- }
519
- // Seperators
520
- if($total_members > 0 && $total_guests > 0) {
521
- $template_browsingpage = str_replace('%USERONLINE_GUESTS_SEPERATOR%', $separator_guests_browsingpage, $template_browsingpage);
522
- } else {
523
- $template_browsingpage = str_replace('%USERONLINE_GUESTS_SEPERATOR%', '', $template_browsingpage);
524
- }
525
- if(($total_guests > 0 || $total_members > 0) && $total_bots > 0) {
526
- $template_browsingpage = str_replace('%USERONLINE_BOTS_SEPERATOR%', $separator_bots_browsingpage, $template_browsingpage);
527
- } else {
528
- $template_browsingpage = str_replace('%USERONLINE_BOTS_SEPERATOR%', '', $template_browsingpage);
529
- }
530
 
 
531
 
532
- // Output The Template
533
- echo $template_browsingpage;
534
- } else {
535
- // This Should Not Happen
536
- global $l10n;
537
- if (!isset($l10n['wp-useronline'])) {
538
- useronline_textdomain();
539
- }
540
- _e('No User Is Browsing This Page', 'wp-useronline');
541
  }
542
- }
543
 
 
 
 
 
 
544
 
545
- ### Function: Get IP Address
546
- if(!function_exists('get_ipaddress')) {
547
- function get_ipaddress() {
548
- if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
549
- $ip_address = $_SERVER["REMOTE_ADDR"];
550
- } else {
551
- $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
552
- }
553
- if(strpos($ip_address, ',') !== false) {
554
- $ip_address = explode(',', $ip_address);
555
- $ip_address = $ip_address[0];
556
- }
557
- return esc_attr($ip_address);
558
- }
559
  }
560
 
561
 
562
- ### Function: Check IP
563
- function check_ip($ip) {
564
- $current_user = wp_get_current_user();
565
- $user_level = intval($current_user->wp_user_level);
566
- $ip2long = ip2long($ip);
567
- if($user_level == 10 && ($ip != 'unknown') && $ip == long2ip($ip2long) && $ip2long !== false) {
568
- return "<span dir=\"ltr\">(<a href=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput=$ip\" title=\"".gethostbyaddr($ip)."\">$ip</a>)</span>";
569
- }
570
- }
571
 
 
 
 
 
572
 
573
- ### Function: Get User's Country Name/Code
574
- function get_user_origin($ip) {
575
- global $wpdb, $cache_ips;
576
- if (!isset($cache_ips[$ip])) {
577
- $cache_ips[$ip] = $wpdb->get_row("SELECT c.country, c.code FROM ip2nationCountries c, ip2nation i WHERE i.ip < INET_ATON('$ip') AND c.code = i.country ORDER BY i.ip DESC LIMIT 1");
578
- }
579
- return $cache_ips[$ip];
580
- }
581
 
 
 
582
 
583
- ### Function: Output User's Country Flag/Name
584
- function ip2nation_country($ip, $display_countryname = 0) {
585
- //$country_mirror = 'http://lesterchan.net/wp-content/themes/lesterchan/images/flags';
586
- $country_mirror = plugins_url('wp-useronline/images/flags');
587
- $country_imgtype = 'png';
588
- $origin = get_user_origin($ip);
589
- $output = '';
590
- if($origin) {
591
- $country_code = $origin->code;
592
- $country_name = $origin->country;
593
- if($country_name != 'Private') {
594
- if(@file_exists(WP_PLUGIN_DIR.'/wp-useronline/images/flags/sg.'.$country_imgtype) !== false) {
595
- $output .= '<img src="'.$country_mirror.'/'.$country_code.'.'.$country_imgtype.'" alt="'.$country_name.'" title="'.$country_name.'" /> ';
596
- }
597
- if($display_countryname) {
598
- $output .= $country_name.' ';
599
- }
600
- }
601
- }
602
- return $output;
603
- }
604
 
 
 
605
 
606
- ### Function: Display UserOnline For Admin
607
- function display_useronline() {
608
- $useronline_page = useronline_page();
609
- echo '<div class="wrap">'."\n";
610
- screen_icon();
611
- echo '<h2>'.__('Users Online Now', 'wp-useronline').'</h2>'."\n";
612
- echo $useronline_page;
613
- echo '</div>'."\n";
614
- }
615
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
616
 
617
- ### Function Display UserOnline For Admin's Right Now
618
- add_action('rightnow_end', 'useronline_rightnow');
619
- function useronline_rightnow() {
620
- $total_users = get_useronline_count(false);
621
- echo '<p>';
622
- if ($total_users == 1) {
623
- printf(__('There is <strong><a href="%s">%s user</a></strong> online now.', 'wp-useronline'), admin_url('index.php?page=wp-useronline/wp-useronline.php'), number_format_i18n($total_users));
624
- } else {
625
- printf(__('There are a total of <strong><a href="%s">%s users</a></strong> online now.', 'wp-useronline'), admin_url('index.php?page=wp-useronline/wp-useronline.php'), number_format_i18n($total_users));
626
  }
627
- echo '<br />';
628
- get_users_browsing_site();
629
- echo '.<br />';
630
- printf(__('Most users ever online were <strong>%s</strong>, on <strong>%s</strong>', 'wp-useronline'), number_format_i18n(get_most_useronline()), get_most_useronline_date());
631
- echo '</p>'."\n";
632
- }
633
 
 
 
 
634
 
635
- ### Function: Short Code For Inserting Users Online Into Page
636
- add_shortcode('page_useronline', 'useronline_page_shortcode');
637
- function useronline_page_shortcode($atts) {
638
- return useronline_page();
639
- }
640
 
 
 
 
 
641
 
642
- ### Function: Format URL
643
- function format_url($url) {
644
- $url = str_replace('&', '&amp;', $url);
645
- $url = str_replace(' ', '+', $url);
646
- return $url;
647
- }
648
 
 
649
 
650
- ### Function: UserOnline Page
651
- function useronline_page() {
652
- global $wpdb;
653
- // Get The Users Online
654
- $usersonline = $wpdb->get_results("SELECT * FROM $wpdb->useronline ORDER BY type");
 
 
 
 
 
 
 
655
 
656
- // Variables Variables Variables
657
- $useronline_output = '';
658
- $members = array();
659
- $guests = array();
660
- $bots = array();
661
- $total_users = 0;
662
- $total_members = 0;
663
- $total_guests = 0;
664
- $total_bots = 0;
665
- $nicetext_users = '';
666
- $nicetext_members = '';
667
- $nicetext_guests = '';
668
- $nicetext_bots = '';
669
- $url_front = 'http://'.$_SERVER['SERVER_NAME'];
670
-
671
- // Process Those User Who Is Online
672
- if($usersonline) {
673
- foreach($usersonline as $useronline) {
674
- switch($useronline->type) {
675
- case 'member':
676
- $members[] = array('timestamp' => $useronline->timestamp, 'user_id' => $useronline->userid, 'user_name' => stripslashes($useronline->username), 'display_name' => stripslashes($useronline->displayname), 'user_agent' => stripslashes($useronline->useragent), 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => $url_front.stripslashes(urldecode($useronline->url)), 'referral' => stripslashes(urldecode($useronline->referral)));
677
- $total_members++;
678
- break;
679
- case 'guest':
680
- $guests[] = array('timestamp' => $useronline->timestamp, 'user_id' => $useronline->userid, 'user_name' => stripslashes($useronline->username), 'display_name' => stripslashes($useronline->displayname), 'user_agent' => stripslashes($useronline->useragent), 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => $url_front.stripslashes(urldecode($useronline->url)), 'referral' => stripslashes(urldecode($useronline->referral)));
681
- $total_guests++;
682
- break;
683
- case 'bot':
684
- $bots[] = array('timestamp' => $useronline->timestamp, 'user_id' => $useronline->userid, 'user_name' => stripslashes($useronline->username), 'display_name' => stripslashes($useronline->displayname), 'user_agent' => stripslashes($useronline->useragent), 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => $url_front.stripslashes(urldecode($useronline->url)), 'referral' => stripslashes(urldecode($useronline->referral)));
685
- $total_bots++;
686
- break;
687
  }
688
  }
689
- $total_users = ($total_guests+$total_bots+$total_members);
690
- }
691
-
692
- // Nice Text For Users
693
- if($total_users == 1) {
694
- $nicetext_users = number_format_i18n($total_users).' '.__('User', 'wp-useronline');
695
- } else {
696
- $nicetext_users = number_format_i18n($total_users).' '.__('Users', 'wp-useronline');
697
- }
698
 
699
- // Nice Text For Members
700
- if($total_members == 1) {
701
- $nicetext_members = number_format_i18n($total_members).' '.__('Member', 'wp-useronline');
702
- } else {
703
- $nicetext_members = number_format_i18n($total_members).' '.__('Members', 'wp-useronline');
704
- }
705
-
706
-
707
- // Nice Text For Guests
708
- if($total_guests == 1) {
709
- $nicetext_guests = number_format_i18n($total_guests).' '.__('Guest', 'wp-useronline');
710
- } else {
711
- $nicetext_guests = number_format_i18n($total_guests).' '.__('Guests', 'wp-useronline');
712
  }
713
 
714
- // Nice Text For Bots
715
- if($total_bots == 1) {
716
- $nicetext_bots = number_format_i18n($total_bots).' '.__('Bot', 'wp-useronline');
717
- } else {
718
- $nicetext_bots = number_format_i18n($total_bots).' '.__('Bots', 'wp-useronline');
719
- }
720
 
721
- // Check Whether WP-Stats Is Activated
722
- $wp_stats = false;
723
- if(function_exists('get_totalposts')) {
724
- $wp_stats = true;
725
- }
726
- if ($total_users == 1) {
727
- $useronline_output .= '<p>'.sprintf(__('There is <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</strong> and <strong>%s</strong>.', 'wp-useronline'), $nicetext_users, $nicetext_members, $nicetext_guests, $nicetext_bots).'</p>';
728
- } else {
729
- $useronline_output .= '<p>'.sprintf(__('There are a total of <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</strong> and <strong>%s</strong>.', 'wp-useronline'), $nicetext_users, $nicetext_members, $nicetext_guests, $nicetext_bots).'</p>';
730
- }
731
- $useronline_output .= '<p>'.sprintf(__('Most users ever online were <strong>%s</strong>, on <strong>%s</strong>', 'wp-useronline'), number_format_i18n(get_most_useronline()), get_most_useronline_date()).'</p>';
732
- // Print Out Members
733
- if($total_members > 0) {
734
- $useronline_output .= '<h2>'.$nicetext_members.' '.__('Online Now', 'wp-useronline').'</h2>'."\n";
735
- }
736
- $no=1;
737
- if($members) {
738
- foreach($members as $member) {
739
- $referral_output = '';
740
- if(!empty($member['referral'])) {
741
- $referral_output = ' [<a href="'.format_url($member['referral']).'">'.__('referral', 'wp-useronline').'</a>]';
742
- }
743
- if($wp_stats) {
744
- $useronline_output .= '<p><strong>#'.number_format_i18n($no).' - '.useronline_stats_page_link($member['display_name']).'</strong> '.ip2nation_country($member['ip']).check_ip($member['ip']).' '.__('on', 'wp-useronline').' '.mysql2date(sprintf(__('%s @ %s', 'wp-useronline'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $member['timestamp'])).'<br />'.$member['location'].' [<a href="'.format_url($member['url']).'">'.__('url', 'wp-useronline').'</a>]'.$referral_output.'</p>'."\n";
745
- } else {
746
- $useronline_output .= '<p><strong>#'.number_format_i18n($no).' - '.$member['display_name'].'</strong> '.ip2nation_country($member['ip']).check_ip($member['ip']).' '.__('on', 'wp-useronline').' '.mysql2date(sprintf(__('%s @ %s', 'wp-useronline'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $member['timestamp'])).'<br />'.$member['location'].' [<a href="'.format_url($member['url']).'">'.__('url', 'wp-useronline').'</a>]'.$referral_output.'</p>'."\n";
747
- }
748
- $no++;
749
- }
750
- }
751
 
752
- // Print Out Guest
753
- if($total_guests > 0) {
754
- $useronline_output .= '<h2>'.$nicetext_guests.' '.__('Online Now', 'wp-useronline').'</h2>'."\n";
755
- }
756
- $no=1;
757
- if($guests) {
758
- foreach($guests as $guest) {
759
- $referral_output = '';
760
- if(!empty($guest['referral'])) {
761
- $referral_output = '[<a href="'.format_url($guest['referral']).'">'.__('referral', 'wp-useronline').'</a>]';
762
- }
763
- if($wp_stats) {
764
- $useronline_output .= '<p><strong>#'.number_format_i18n($no).' - '.useronline_stats_page_link($guest['display_name']).'</strong> '.ip2nation_country($guest['ip']).check_ip($guest['ip']).' '.__('on', 'wp-useronline').' '.mysql2date(sprintf(__('%s @ %s', 'wp-useronline'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $guest['timestamp'])).'<br />'.$guest['location'].' [<a href="'.format_url($guest['url']).'">'.__('url', 'wp-useronline').'</a>]'.$referral_output.'</p>'."\n";
765
- } else {
766
- $useronline_output .= '<p><strong>#'.number_format_i18n($no).' - '.$guest['display_name'].'</strong> '.ip2nation_country($guest['ip']).check_ip($guest['ip']).' '.__('on', 'wp-useronline').' '.mysql2date(sprintf(__('%s @ %s', 'wp-useronline'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $guest['timestamp'])).'<br />'.$guest['location'].' [<a href="'.format_url($guest['url']).'">'.__('url', 'wp-useronline').'</a>]'.$referral_output.'</p>'."\n";
767
- }
768
- $no++;
769
- }
770
  }
771
 
772
- // Print Out Bots
773
- if($total_bots > 0) {
774
- $useronline_output .= '<h2>'.$nicetext_bots.' '.__('Online Now', 'wp-useronline').'</h2>'."\n";
775
- }
776
- $no=1;
777
- if($bots) {
778
- foreach($bots as $bot) {
779
- $useronline_output .= '<p><strong>#'.number_format_i18n($no).' - '.$bot['display_name'].'</strong> '.check_ip($bot['ip']).' '.__('on', 'wp-useronline').' '.mysql2date(sprintf(__('%s @ %s', 'wp-useronline'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $bot['timestamp'])).'<br />'.$bot['location'].' [<a href="'.format_url($bot['url']).'">'.__('url', 'wp-useronline').'</a>]</p>'."\n";
780
- $no++;
781
- }
782
  }
783
 
784
- // Print Out No One Is Online Now
785
- if($total_users == 0) {
786
- $useronline_output .= '<h2>'.__('No One Is Online Now', 'wp-useronline').'</h2>'."\n";
787
  }
 
 
 
788
 
789
- // Output UserOnline Page
790
- return apply_filters('useronline_page', $useronline_output);
791
- }
792
-
793
 
794
- ### Function: Stats Page Link
795
- function useronline_stats_page_link($author) {
796
- $stats_url = '';
797
- if(function_exists('stats_page')) {
798
- $stats_url = get_option('stats_url');
799
- $author_encode = urlencode($author);
800
- if(strpos($stats_url, '?') !== false) {
801
- $stats_url = "$stats_url&amp;stats_author=$author_encode";
802
- } else {
803
- $stats_url = "$stats_url?stats_author=$author_encode";
804
- }
805
- return '<a href="'.$stats_url.'" title="'.$author.'">'.$author.'</a>';
806
  }
807
- return $stats_url;
808
- }
809
-
810
-
811
- ### Function: Process AJAX Request
812
- useronline_ajax();
813
- function useronline_ajax() {
814
- global $wpdb, $useronline;
815
- $mode = trim($_GET['useronline_mode']);
816
- if(!empty($mode)) {
817
- header('Content-Type: text/html; charset='.get_option('blog_charset'));
818
- switch($mode) {
819
- case 'useronline_count':
820
- $useronline = intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline"));
821
- get_useronline();
822
- break;
823
- case 'useronline_browsingsite':
824
- get_users_browsing_site();
825
- break;
826
- case 'useronline_browsingpage':
827
- get_users_browsing_page();
828
- break;
829
- }
830
- exit();
831
  }
832
- }
833
 
 
 
 
 
 
834
 
835
- ### Function: Plug Into WP-Stats
836
- if(strpos(get_option('stats_url'), $_SERVER['REQUEST_URI']) || strpos($_SERVER['REQUEST_URI'], 'stats-options.php') || strpos($_SERVER['REQUEST_URI'], 'wp-stats/wp-stats.php')) {
837
- add_filter('wp_stats_page_admin_plugins', 'useronline_page_admin_general_stats');
838
- add_filter('wp_stats_page_plugins', 'useronline_page_general_stats');
839
- }
840
-
841
 
842
- ### Function: Add WP-UserOnline General Stats To WP-Stats Page Options
843
- function useronline_page_admin_general_stats($content) {
844
- $stats_display = get_option('stats_display');
845
- if($stats_display['useronline'] == 1) {
846
- $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_useronline" value="useronline" checked="checked" />&nbsp;&nbsp;<label for="wpstats_useronline">'.__('WP-UserOnline', 'wp-useronline').'</label><br />'."\n";
847
- } else {
848
- $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_useronline" value="useronline" />&nbsp;&nbsp;<label for="wpstats_useronline">'.__('WP-UserOnline', 'wp-useronline').'</label><br />'."\n";
849
  }
850
- return $content;
851
  }
852
 
 
 
853
 
854
- ### Function: Add WP-UserOnline General Stats To WP-Stats Page
855
- function useronline_page_general_stats($content) {
856
- $stats_display = get_option('stats_display');
857
- if($stats_display['useronline'] == 1) {
858
- $content .= '<p><strong>'.__('WP-UserOnline', 'wp-useronline').'</strong></p>'."\n";
859
- $content .= '<ul>'."\n";
860
- $content .= '<li>'.sprintf(_n('<strong>%s</strong> user online now.', '<strong>%s</strong> users online now.', get_useronline_count(), 'wp-useronline'), number_format_i18n(get_useronline_count())).'</li>'."\n";
861
- $content .= '<li>'.sprintf(_n('Most users ever online was <strong>%s</strong>.', 'Most users ever online was <strong>%s</strong>.', get_most_useronline(), 'wp-useronline'), number_format_i18n(get_most_useronline())).'</li>'."\n";
862
- $content .= '<li>'.__('On', 'wp-useronline').' <strong>'.get_most_useronline_date().'</strong>.</li>'."\n";
863
- $content .= '</ul>'."\n";
864
- }
865
- return $content;
866
- }
867
 
868
- ### Class: WP-UserOnline Widget
869
- class WP_Widget_UserOnline extends WP_Widget {
870
- // Constructor
871
- function WP_Widget_UserOnline() {
872
- $widget_ops = array('description' => __('WP-UserOnline users online statistics', 'wp-useronline'));
873
- $this->WP_Widget('useronline', __('UserOnline', 'wp-useronline'), $widget_ops);
874
- }
 
 
 
 
 
 
875
 
876
- // Display Widget
877
- function widget($args, $instance) {
878
- extract($args);
879
- $title = apply_filters('widget_title', esc_attr($instance['title']));
880
- $type = esc_attr($instance['type']);
881
- echo $before_widget.$before_title.$title.$after_title;
882
- echo '<ul>'."\n";
883
- switch($type) {
884
- case 'users_online':
885
- echo '<li><div id="useronline-count">';
886
- get_useronline();
887
- echo '</div></li>'."\n";
888
- break;
889
- case 'users_browsing_page':
890
- echo '<li><div id="useronline-browsing-page">';
891
- get_users_browsing_page();
892
- echo '</div></li>'."\n";
893
- break;
894
- case 'users_browsing_site':
895
- echo '<li><div id="useronline-browsing-site">';
896
- get_users_browsing_site();
897
- echo '</div></li>'."\n";
898
- break;
899
- case 'users_online_browsing_page':
900
- echo '<li><div id="useronline-count">';
901
- get_useronline();
902
- echo '</div></li>'."\n";
903
- echo '<li><div id="useronline-browsing-page">';
904
- get_users_browsing_page();
905
- echo '</div></li>'."\n";
906
- break;
907
- case 'users_online_browsing_site':
908
- echo '<li><div id="useronline-count">';
909
- get_useronline();
910
- echo '</div></li>'."\n";
911
- echo '<li><div id="useronline-browsing-site">';
912
- get_users_browsing_site();
913
- echo '</div></li>'."\n";
914
- break;
915
- }
916
- echo '</ul>'."\n";
917
- echo $after_widget;
918
- }
919
 
920
- // When Widget Control Form Is Posted
921
- function update($new_instance, $old_instance) {
922
- if (!isset($new_instance['submit'])) {
923
- return false;
924
- }
925
- $instance = $old_instance;
926
- $instance['title'] = strip_tags($new_instance['title']);
927
- $instance['type'] = strip_tags($new_instance['type']);
928
- return $instance;
929
- }
930
 
931
- // DIsplay Widget Control Form
932
- function form($instance) {
933
- global $wpdb;
934
- $instance = wp_parse_args((array) $instance, array('title' => __('UserOnline', 'wp-useronline'), 'type' => 'users_online'));
935
- $title = esc_attr($instance['title']);
936
- $type = esc_attr($instance['type']);
937
- ?>
938
- <p>
939
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'wp-useronline'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label>
940
- </p>
941
- <p>
942
- <label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Statistics Type:', 'wp-useronline'); ?>
943
- <select name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>" class="widefat">
944
- <option value="users_online"<?php selected('users_online', $type); ?>><?php _e('Users Online Count', 'wp-useronline'); ?></option>
945
- <option value="users_browsing_page"<?php selected('users_browsing_page', $type); ?>><?php _e('Users Browsing Current Page', 'wp-useronline'); ?></option>
946
- <option value="users_browsing_site"<?php selected('users_browsing_site', $type); ?>><?php _e('Users Browsing Site', 'wp-useronline'); ?></option>
947
- <optgroup>&nbsp;</optgroup>
948
- <option value="users_online_browsing_page"<?php selected('users_online_browsing_page', $type); ?>><?php _e('Users Online Count & Users Browsing Current Page', 'wp-useronline'); ?></option>
949
- <option value="users_online_browsing_site"<?php selected('users_online_browsing_site', $type); ?>><?php _e('Users Online Count & Users Browsing Site', 'wp-useronline'); ?></option>
950
- </select>
951
- </label>
952
- </p>
953
- <input type="hidden" id="<?php echo $this->get_field_id('submit'); ?>" name="<?php echo $this->get_field_name('submit'); ?>" value="1" />
954
- <?php
955
  }
956
  }
 
957
 
958
-
959
- ### Function: Init WP-UserOnline Widget
960
- add_action('widgets_init', 'widget_useronline_init');
961
- function widget_useronline_init() {
962
- register_widget('WP_Widget_UserOnline');
963
- }
964
-
965
-
966
- ### Function: Create UserOnline Table
967
- add_action('activate_wp-useronline/wp-useronline.php', 'create_useronline_table');
968
- function create_useronline_table() {
969
- global $wpdb;
970
- useronline_textdomain();
971
- $bots = array('Google Bot' => 'googlebot', 'Google Bot' => 'google', 'MSN' => 'msnbot', 'Alex' => 'ia_archiver', 'Lycos' => 'lycos', 'Ask Jeeves' => 'jeeves', 'Altavista' => 'scooter', 'AllTheWeb' => 'fast-webcrawler', 'Inktomi' => 'slurp@inktomi', 'Turnitin.com' => 'turnitinbot', 'Technorati' => 'technorati', 'Yahoo' => 'yahoo', 'Findexa' => 'findexa', 'NextLinks' => 'findlinks', 'Gais' => 'gaisbo', 'WiseNut' => 'zyborg', 'WhoisSource' => 'surveybot', 'Bloglines' => 'bloglines', 'BlogSearch' => 'blogsearch', 'PubSub' => 'pubsub', 'Syndic8' => 'syndic8', 'RadioUserland' => 'userland', 'Gigabot' => 'gigabot', 'Become.com' => 'become.com');
972
- if(@is_file(ABSPATH.'/wp-admin/upgrade-functions.php')) {
973
- include_once(ABSPATH.'/wp-admin/upgrade-functions.php');
974
- } elseif(@is_file(ABSPATH.'/wp-admin/includes/upgrade.php')) {
975
- include_once(ABSPATH.'/wp-admin/includes/upgrade.php');
976
- } else {
977
- die('We have problem finding your \'/wp-admin/upgrade-functions.php\' and \'/wp-admin/includes/upgrade.php\'');
978
- }
979
- $charset_collate = '';
980
- if($wpdb->supports_collation()) {
981
- if(!empty($wpdb->charset)) {
982
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
983
- }
984
- if(!empty($wpdb->collate)) {
985
- $charset_collate .= " COLLATE $wpdb->collate";
986
- }
987
- }
988
- // Drop UserOnline Table
989
- $wpdb->query("DROP TABLE IF EXISTS $wpdb->useronline");
990
- // Create UserOnline Table
991
- $create_table = "CREATE TABLE $wpdb->useronline (".
992
- " timestamp int(15) NOT NULL default '0',".
993
- " userid int(10) NOT NULL default '0',".
994
- " username varchar(20) NOT NULL default '',".
995
- " displayname varchar(255) NOT NULL default '',".
996
- " useragent varchar(255) NOT NULL default '',".
997
- " ip varchar(40) NOT NULL default '',".
998
- " location varchar(255) NOT NULL default '',".
999
- " url varchar(255) NOT NULL default '',".
1000
- " type enum('member','guest','bot') NOT NULL default 'guest',".
1001
- " referral varchar(255) NOT NULL default '',".
1002
- " UNIQUE KEY useronline_id (timestamp,username,ip,useragent)) $charset_collate;";
1003
- maybe_create_table($wpdb->useronline, $create_table);
1004
- // Add In Options
1005
- add_option('useronline_most_users', 1, 'Most Users Ever Online Count');
1006
- add_option('useronline_most_timestamp', current_time('timestamp'), 'Most Users Ever Online Date');
1007
- add_option('useronline_timeout', 300, 'Timeout In Seconds');
1008
- add_option('useronline_bots', $bots, 'Bots Name/Useragent');
1009
- // Database Upgrade For WP-UserOnline 2.05
1010
- add_option('useronline_url', site_url('useronline/'), 'UserOnline Page URL');
1011
- // Database Upgrade For WP-UserOnline 2.20
1012
- add_option('useronline_naming', array('user' => __('1 User', 'wp-useronline'), 'users' => __('%USERONLINE_COUNT% Users', 'wp-useronline'), 'member' => __('1 Member', 'wp-useronline'), 'members' => __('%USERONLINE_COUNT% Members', 'wp-useronline'), 'guest' => __('1 Guest', 'wp-useronline'), 'guests' => __('%USERONLINE_COUNT% Guests', 'wp-useronline'), 'bot' => __('1 Bot', 'wp-useronline'), 'bots' => __('%USERONLINE_COUNT% Bots', 'wp-useronline')),'Member(s), Guest(s) or Bot(s)');
1013
- add_option('useronline_template_useronline', '<a href="%USERONLINE_PAGE_URL%" title="%USERONLINE_USERS%"><strong>%USERONLINE_USERS%</strong> '.__('Online', 'wp-useronline').'</a>', 'Useronline Template');
1014
- add_option('useronline_template_browsingsite', array(__(',', 'wp-useronline').' ', __(',', 'wp-useronline').' ', __(',', 'wp-useronline').' ', _c('Users|Template Element', 'wp-useronline').': <strong>%USERONLINE_MEMBER_NAMES%%USERONLINE_GUESTS_SEPERATOR%%USERONLINE_GUESTS%%USERONLINE_BOTS_SEPERATOR%%USERONLINE_BOTS%</strong>'), 'User Browsing Site Template');
1015
- add_option('useronline_template_browsingpage', array(__(',', 'wp-useronline').' ', __(',', 'wp-useronline').' ', __(',', 'wp-useronline').' ', '<strong>%USERONLINE_USERS%</strong> '.__('Browsing This Page.', 'wp-useronline').'<br />'._c('Users|Template Element', 'wp-useronline').': <strong>%USERONLINE_MEMBER_NAMES%%USERONLINE_GUESTS_SEPERATOR%%USERONLINE_GUESTS%%USERONLINE_BOTS_SEPERATOR%%USERONLINE_BOTS%</strong>'), 'User Browsing Site Template');
1016
- }
1017
- ?>
1
  <?php
2
  /*
3
  Plugin Name: WP-UserOnline
4
+ Plugin URI: http://wordpress.org/extend/plugins/wp-useronline/
5
  Description: Enable you to display how many users are online on your Wordpress blog with detailed statistics of where they are and who there are(Members/Guests/Search Bots).
6
+ Version: 2.62
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: http://lesterchan.net
9
  */
10
 
11
 
12
+ /*
13
  Copyright 2009 Lester Chan (email : lesterchan@gmail.com)
14
 
15
  This program is free software; you can redistribute it and/or modify
27
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
  */
29
 
30
+ class UserOnline_Core {
31
 
32
+ function init() {
33
+ add_action('plugins_loaded', array(__CLASS__, 'wp_stats_integration'));
34
+
35
+ add_action('template_redirect', array(__CLASS__, 'scripts'));
36
+
37
+ add_action('admin_head', array(__CLASS__, 'record'));
38
+ add_action('wp_head', array(__CLASS__, 'record'));
39
+
40
+ add_action('wp_ajax_useronline', array(__CLASS__, 'ajax'));
41
+ add_action('wp_ajax_nopriv_useronline', array(__CLASS__, 'ajax'));
42
+
43
+ add_shortcode('page_useronline', 'useronline_page');
44
+
45
+ register_activation_hook(__FILE__, array(__CLASS__, 'install'));
46
+ register_uninstall_hook(__FILE__, array(__CLASS__, 'uninstall'));
47
  }
 
48
 
49
+ function wp_stats_integration() {
50
+ if ( function_exists('stats_page') )
51
+ require_once dirname(__FILE__) . '/wp-stats.php';
52
+ }
53
 
54
+ function install() {
55
+ self::clear_table();
56
+
57
+ $bots = array('Google Bot' => 'googlebot', 'Google Bot' => 'google', 'MSN' => 'msnbot', 'Alex' => 'ia_archiver', 'Lycos' => 'lycos', 'Ask Jeeves' => 'jeeves', 'Altavista' => 'scooter', 'AllTheWeb' => 'fast-webcrawler', 'Inktomi' => 'slurp@inktomi', 'Turnitin.com' => 'turnitinbot', 'Technorati' => 'technorati', 'Yahoo' => 'yahoo', 'Findexa' => 'findexa', 'NextLinks' => 'findlinks', 'Gais' => 'gaisbo', 'WiseNut' => 'zyborg', 'WhoisSource' => 'surveybot', 'Bloglines' => 'bloglines', 'BlogSearch' => 'blogsearch', 'PubSub' => 'pubsub', 'Syndic8' => 'syndic8', 'RadioUserland' => 'userland', 'Gigabot' => 'gigabot', 'Become.com' => 'become.com');
58
+
59
+ // Add In Options
60
+ add_option('useronline_most_users', 1);
61
+ add_option('useronline_most_timestamp', current_time('timestamp'));
62
+ add_option('useronline_timeout', 300);
63
+ add_option('useronline_bots', $bots);
64
+
65
+ // Database Upgrade For WP-UserOnline 2.05
66
+ add_option('useronline_url', site_url('useronline/'));
67
 
68
+ // Database Upgrade For WP-UserOnline 2.20
69
+ add_option('useronline_naming', array(
70
+ 'user' => __('1 User', 'wp-useronline'),
71
+ 'users' => __('%USERONLINE_COUNT% Users', 'wp-useronline'),
72
+ 'member' => __('1 Member', 'wp-useronline'),
73
+ 'members' => __('%USERONLINE_COUNT% Members', 'wp-useronline'),
74
+ 'guest' => __('1 Guest', 'wp-useronline'),
75
+ 'guests' => __('%USERONLINE_COUNT% Guests', 'wp-useronline'),
76
+ 'bot' => __('1 Bot', 'wp-useronline'),
77
+ 'bots' => __('%USERONLINE_COUNT% Bots', 'wp-useronline')
78
+ ));
79
 
80
+ add_option('useronline_template_useronline', '<a href="%USERONLINE_PAGE_URL%" title="%USERONLINE_USERS%"><strong>%USERONLINE_USERS%</strong> '.__('Online', 'wp-useronline').'</a>');
 
 
81
 
82
+ add_option('useronline_template_browsingsite', array(
83
+ __(',', 'wp-useronline').' ',
84
+ __(',', 'wp-useronline').' ',
85
+ __(',', 'wp-useronline').' ',
86
+ _c('Users|Template Element', 'wp-useronline').': <strong>%USERONLINE_MEMBER_NAMES%%USERONLINE_GUESTS_SEPERATOR%%USERONLINE_GUESTS%%USERONLINE_BOTS_SEPERATOR%%USERONLINE_BOTS%</strong>'
87
+ ));
88
 
89
+ add_option('useronline_template_browsingpage', array(
90
+ __(',', 'wp-useronline').' ',
91
+ __(',', 'wp-useronline').' ',
92
+ __(',', 'wp-useronline').' ',
93
+ '<strong>%USERONLINE_USERS%</strong> '.__('Browsing This Page.', 'wp-useronline').'<br />'._c('Users|Template Element', 'wp-useronline').': <strong>%USERONLINE_MEMBER_NAMES%%USERONLINE_GUESTS_SEPERATOR%%USERONLINE_GUESTS%%USERONLINE_BOTS_SEPERATOR%%USERONLINE_BOTS%</strong>'
94
+ ));
95
  }
96
+
97
+ function uninstall() {
98
+ $useronline_settings = array('useronline_most_users', 'useronline_most_timestamp', 'useronline_timeout', 'useronline_bots', 'useronline_url', 'useronline_naming', 'useronline_template_useronline', 'useronline_template_browsingsite', 'useronline_template_browsingpage', 'widget_useronline');
99
+
100
+ foreach ( $useronline_settings as $setting )
101
+ delete_option($setting);
102
  }
 
103
 
104
+ function scripts() {
105
+ wp_enqueue_script('wp-useronline', plugins_url('useronline-js.js', __FILE__), array('jquery'), '2.60', true);
106
+ wp_localize_script('wp-useronline', 'useronlineL10n', array(
107
+ 'ajax_url' => admin_url('admin-ajax.php'),
108
+ 'timeout' => get_option('useronline_timeout')*1000
109
+ ));
110
+ }
111
 
112
+ function record() {
113
+ global $wpdb, $useronline;
 
 
 
114
 
115
+ $timeoutseconds = get_option('useronline_timeout');
116
+ $timestamp = current_time('timestamp');
117
+ $timeout = $timestamp - $timeoutseconds;
118
 
119
+ $ip = self::get_ip();
120
+ $url = $_SERVER['REQUEST_URI'];
 
 
 
 
 
 
 
121
 
122
+ $referral = '';
123
+ $useragent = $_SERVER['HTTP_USER_AGENT'];
124
+ $current_user = wp_get_current_user();
125
+ if ( !empty($_SERVER['HTTP_REFERER'] ))
126
+ $referral = strip_tags($_SERVER['HTTP_REFERER']);
127
 
128
+ // Check For Bot
129
+ $bots = get_option('useronline_bots');
130
+ $bot_found = false;
131
+ foreach ($bots as $name => $lookfor) {
132
+ if ( stristr($useragent, $lookfor) === false )
133
+ continue;
134
+
135
+ $userid = 0;
136
+ $displayname = $name;
137
+ $username = $lookfor;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  $type = 'bot';
139
  $where = "WHERE ip = '$ip'";
140
  $bot_found = true;
141
+
142
  break;
143
+ }
 
144
 
145
+ // If No Bot Is Found, Then We Check Members And Guests
146
+ if ( !$bot_found ) {
147
+ // Check For Member
148
+ if ( $current_user->ID > 0 ) {
149
+ $userid = $current_user->ID;
150
+ $displayname = $current_user->display_name;
151
+ $username = $current_user->user_login;
152
+ $type = 'member';
153
+ $where = "WHERE userid = '$userid'";
154
+ // Check For Comment Author (Guest)
155
+ } elseif ( !empty($_COOKIE['comment_author_'.COOKIEHASH] )) {
156
+ $userid = 0;
157
+ $displayname = trim($_COOKIE['comment_author_'.COOKIEHASH]);
158
+ $username = __('guest', 'wp-useronline').'_'.$displayname;
159
+ $type = 'guest';
160
+ $where = "WHERE ip = '$ip'";
161
+ // Check For Guest
162
+ } else {
163
+ $userid = 0;
164
+ $displayname = __('Guest', 'wp-useronline');
165
+ $username = "guest";
166
+ $type = 'guest';
167
+ $where = "WHERE ip = '$ip'";
168
+ }
169
+ }
170
+
171
+ // Check For Page Title
172
+ if ( is_admin() && function_exists('get_admin_page_title') ) {
173
+ $location = ' &raquo; '.__('Admin', 'wp-useronline').' &raquo; '.get_admin_page_title();
174
  } else {
175
+ $location = wp_title('&raquo;', false);
176
+ if ( empty($location) ) {
177
+ $location = ' &raquo; '.$_SERVER['REQUEST_URI'];
178
+ } elseif ( is_singular() ) {
179
+ $location = ' &raquo; '.__('Archive', 'wp-useronline').' '.$location;
180
+ }
181
  }
182
+ $location = get_bloginfo('name').$location;
183
 
184
+ // Delete Users
185
+ $delete_users = $wpdb->query("DELETE FROM $wpdb->useronline $where OR (timestamp < $timeout)");
186
 
187
+ // Insert Users
188
+ $data = compact('timestamp', 'userid', 'username', 'displayname', 'useragent', 'ip', 'location', 'url', 'type', 'referral');
189
+ $data = stripslashes_deep($data);
190
+ $insert_user = $wpdb->insert($wpdb->useronline, $data);
191
+
192
+ // Count Users Online
193
+ $useronline = intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline"));
194
+
195
+ // Get Most User Online
196
+ $most_useronline = intval(get_option('useronline_most_users'));
197
+
198
+ // Check Whether Current Users Online Is More Than Most Users Online
199
+ if ( $useronline > $most_useronline ) {
200
+ update_option('useronline_most_users', $useronline);
201
+ update_option('useronline_most_timestamp', current_time('timestamp'));
202
+ }
203
  }
 
204
 
205
+ function ajax() {
206
+ $mode = trim($_POST['mode']);
207
+
208
+ if ( empty($mode) )
209
+ return;
210
 
211
+ switch($mode) {
212
+ case 'count':
213
+ get_useronline();
214
+ break;
215
+ case 'browsingsite':
216
+ get_users_browsing_site();
217
+ break;
218
+ case 'browsingpage':
219
+ get_users_browsing_page();
220
+ break;
221
+ }
222
+
223
+ die();
224
+ }
225
 
226
+ private function get_ip() {
227
+ if ( isset($_SERVER["HTTP_X_FORWARDED_FOR"]) )
228
+ $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
229
+ else
230
+ $ip_address = $_SERVER["REMOTE_ADDR"];
231
 
232
+ list($ip_address) = explode(',', $ip_address);
233
+
234
+ return $ip_address;
 
235
  }
 
236
 
237
+ private function clear_table() {
238
+ global $wpdb;
239
 
240
+ $wpdb->query("DELETE FROM $wpdb->useronline");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  }
242
  }
243
 
244
+ ### Function: Display UserOnline
245
+ function get_useronline($display = true) {
246
+ $template = get_option('useronline_template_useronline');
247
+ $template = str_replace('%USERONLINE_PAGE_URL%', get_option('useronline_url'), $template);
248
+ $template = str_replace('%USERONLINE_MOSTONLINE_COUNT%', number_format_i18n(get_most_useronline()), $template);
249
+ $template = str_replace('%USERONLINE_MOSTONLINE_DATE%', get_most_useronline_date(), $template);
250
 
251
+ $template = UserOnline_Template::format_count($template, get_useronline_count());
252
+
253
+ if ( !$display )
254
+ return $template;
255
+
256
+ echo $template;
 
 
 
 
257
  }
258
 
259
+ ### Function: Display UserOnline Count
260
+ function get_useronline_count($display = false) {
261
+ global $wpdb, $useronline;
262
+
263
+ if ( ! isset($useronline) )
264
+ $useronline = intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline"));
265
+
266
+ if ( !$display )
267
+ return $useronline;
268
+
269
+ echo number_format_i18n($useronline);
270
+ }
271
 
272
  ### Function: Display Max UserOnline
273
+ function get_most_useronline($display = false) {
274
+ $most_useronline_users = intval(get_option('useronline_most_users'));
275
+ if ( $display ) {
276
+ echo number_format_i18n($most_useronline_users);
277
+ } else {
278
+ return $most_useronline_users;
 
 
279
  }
280
  }
281
 
 
282
  ### Function: Display Max UserOnline Date
283
+ function get_most_useronline_date($display = false) {
284
+ $most_useronline_date = UserOnline_Template::format_date(get_option('useronline_most_timestamp'));
 
 
 
 
 
 
 
 
 
285
 
286
+ if ( !$display )
287
+ return $most_useronline_date;
288
+
289
+ echo $most_useronline_date;
290
+ }
291
 
292
  ### Function Check If User Is Online
293
+ function is_online($user_login) {
294
  global $wpdb;
295
+ return intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline WHERE username = '$user_login' LIMIT 1"));
 
296
  }
297
 
298
 
301
  //add_action('wp_head', 'update_memberlastvisit');
302
  function update_memberlastvisit() {
303
  global $current_user, $user_ID;
304
+ if ( !empty($current_user ) && is_user_logged_in()) {
305
  update_user_option($user_ID, 'member_last_login', current_time('timestamp'));
306
  }
307
  }
309
 
310
  ### Function: Get Member last Visit
311
  function get_memberlastvisit($user_id = 0) {
312
+ return UserOnline_Template::format_date(get_user_option('member_last_login', $user_id));
 
 
 
 
 
313
  }
314
 
315
 
317
  function get_users_browsing_site($display = true) {
318
  global $wpdb;
319
 
320
+ $users_online = $wpdb->get_results("SELECT displayname, type FROM $wpdb->useronline ORDER BY type");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
 
322
+ if ( !$users_online )
323
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
 
325
+ return UserOnline_Template::compact_list('site', $users_online, $display);
 
 
 
 
 
 
 
 
 
326
  }
327
 
 
328
  ### Function: Display Users Browsing The Page
329
  function get_users_browsing_page($display = true) {
330
  global $wpdb;
331
 
332
+ $page_url = esc_sql(urlencode($_SERVER['REQUEST_URI']));
333
+ $users_online = $wpdb->get_results("SELECT displayname, type FROM $wpdb->useronline WHERE url = '$page_url' ORDER BY type");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
+ if ( !$users_online )
336
+ return;
 
 
 
 
337
 
338
+ return UserOnline_Template::compact_list('page', $users_online, $display);
339
+ }
 
 
 
 
 
340
 
341
+ ### Function: UserOnline Page
342
+ function useronline_page() {
343
+ global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
344
 
345
+ $usersonline = $wpdb->get_results("SELECT * FROM $wpdb->useronline ORDER BY type");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
 
347
+ $user_buckets = array();
348
+ foreach ( $usersonline as $useronline )
349
+ $user_buckets[$useronline->type][] = (array) $useronline;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
 
351
+ $counts = UserOnline_Template::get_counts($user_buckets);
352
 
353
+ $texts = array(
354
+ 'user' => array(__('User', 'wp-useronline'), __('Users', 'wp-useronline')),
355
+ 'member' => array(__('Member', 'wp-useronline'), __('Members', 'wp-useronline')),
356
+ 'guest' => array(__('Guest', 'wp-useronline'), __('Guests', 'wp-useronline')),
357
+ 'bot' => array(__('Bot', 'wp-useronline'), __('Bots', 'wp-useronline')),
358
+ );
359
+ foreach ( $texts as $type => $strings ) {
360
+ $i = ($counts[$type] == 1) ? 0 : 1;
361
+ $nicetexts[$type] = number_format_i18n($counts[$type]).' '.$strings[$i];
362
  }
 
363
 
364
+ $text = _n(
365
+ 'There is <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</strong> and <strong>%s</strong>.',
366
+ 'There are a total of <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</strong> and <strong>%s</strong>.',
367
+ $counts['user'], 'wp-useronline'
368
+ );
369
 
370
+ $output =
371
+ html('p', sprintf($text, $nicetexts['user'], $nicetexts['member'], $nicetexts['guest'], $nicetexts['bot']))
372
+ .html('p', UserOnline_Template::format_most_users())
373
+ .UserOnline_Template::detailed_list($counts, $user_buckets, $nicetexts);
374
+
375
+ return apply_filters('useronline_page', $output);
 
 
 
 
 
 
 
 
376
  }
377
 
378
 
379
+ class UserOnline_Template {
 
 
 
 
 
 
 
 
380
 
381
+ function compact_list($type, $users, $display) {
382
+ $buckets = array();
383
+ foreach ( $users as $user )
384
+ $buckets[$user->type][] = $user->displayname;
385
 
386
+ $counts = self::get_counts($buckets);
 
 
 
 
 
 
 
387
 
388
+ if ( !$display )
389
+ return $counts;
390
 
391
+ // Template - Naming Conventions
392
+ $naming = get_option('useronline_naming');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
 
394
+ // Template - User(s) Browsing Site
395
+ list($separator_members, $separator_guests, $separator_bots, $template) = get_option("useronline_template_browsing$type");
396
 
397
+ // Nice Text For Users
398
+ $template = self::format_count($template, $counts['user']);
 
 
 
 
 
 
 
399
 
400
+ // Print Member Name
401
+ $temp_member = '';
402
+ $members = $buckets['member'];
403
+ if ( $members ) {
404
+ $temp_member = array();
405
+ foreach ( $members as $member )
406
+ $temp_member[] = self::format_name($member, 'member');
407
+ $temp_member = implode($separator_members, $temp_member);
408
+ }
409
+ $template = str_ireplace('%USERONLINE_MEMBER_NAMES%', $temp_member, $template);
410
+
411
+ // Counts
412
+ foreach ( array('member', 'guest', 'bot') as $type ) {
413
+ if ( $counts[$type] > 1 )
414
+ $number = str_ireplace('%USERONLINE_COUNT%', number_format_i18n($counts[$type]), $naming[$type . 's']);
415
+ elseif ( $counts[$type] == 1 )
416
+ $number = $naming[$type];
417
+ else
418
+ $number = '';
419
+ $template = str_ireplace('%USERONLINE_' . $type . 'S%', $number, $template);
420
+ }
421
+
422
+ // Seperators
423
+ if ( $counts['member'] > 0 && $counts['guest'] > 0 )
424
+ $separator = $separator_guests;
425
+ else
426
+ $separator = '';
427
+ $template = str_ireplace('%USERONLINE_GUESTS_SEPERATOR%', $separator, $template);
428
+
429
+ if ( ($counts['guest'] > 0 || $counts['member'] > 0 ) && $counts['bot'] > 0)
430
+ $separator = $separator_bots;
431
+ else
432
+ $separator = '';
433
+ $template = str_ireplace('%USERONLINE_BOTS_SEPERATOR%', $separator, $template);
434
 
435
+ // Output The Template
436
+ echo $template;
 
 
 
 
 
 
 
437
  }
 
 
 
 
 
 
438
 
439
+ function detailed_list($counts, $user_buckets, $nicetexts) {
440
+ if ( $counts['user'] == 0 )
441
+ return html('h2', __('No One Is Online Now', 'wp-useronline'));
442
 
443
+ $on = __('on', 'wp-useronline');
444
+ $url = __('url', 'wp-useronline');
445
+ $referral = __('referral', 'wp-useronline');
 
 
446
 
447
+ $output = '';
448
+ foreach ( array('member', 'guest', 'bot') as $type ) {
449
+ if ( !$counts[$type] )
450
+ continue;
451
 
452
+ $count = $counts[$type];
453
+ $users = $user_buckets[$type];
454
+ $nicetext = $nicetexts[$type];
 
 
 
455
 
456
+ $output .= html('h2', "$nicetext ".__('Online Now', 'wp-useronline'));
457
 
458
+ $i=1;
459
+ foreach ( $users as $user ) {
460
+ $nr = number_format_i18n($i++);
461
+ $name = self::format_name($user['displayname'], $type);
462
+ $ip = self::format_ip($user['ip']);
463
+ $date = self::format_date($user['timestamp']);
464
+ $location = $user['location'];
465
+ $current_link = '[' . html_link(esc_url($user['url']), $url) .']';
466
+
467
+ $referral_link = '';
468
+ if ( !empty($user['referral']) )
469
+ $referral_link = '[' . html_link(esc_url($user['referral']), $referral) . ']';
470
 
471
+ $output .= html('p', "<strong>#$nr - $name</strong> $ip $on $date<br/>$location $current_link $referral_link") . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
  }
473
  }
 
 
 
 
 
 
 
 
 
474
 
475
+ return $output;
 
 
 
 
 
 
 
 
 
 
 
 
476
  }
477
 
 
 
 
 
 
 
478
 
479
+ function format_ip($ip) {
480
+ if ( ! current_user_can('administrator') || empty($ip) || $ip == 'unknown' )
481
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
 
483
+ return '<span dir="ltr">(<a href="http://whois.domaintools.com/' . $ip . '" title="'.gethostbyaddr($ip).'">' . $ip . '</a>)</span>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  }
485
 
486
+ function format_date($timestamp) {
487
+ return date_i18n(sprintf(__('%s @ %s', 'wp-useronline'), get_option('date_format'), get_option('time_format')), $timestamp, true);
 
 
 
 
 
 
 
 
488
  }
489
 
490
+ function format_name($user, $type) {
491
+ return apply_filters('useronline_display_name', $user, $type);
 
492
  }
493
+
494
+ function format_count($template, $count) {
495
+ $naming = get_option('useronline_naming');
496
 
497
+ if ( $count == 1 )
498
+ $naming_users = $naming['user'];
499
+ else
500
+ $naming_users = str_ireplace('%USERONLINE_COUNT%', number_format_i18n($count), $naming['users']);
501
 
502
+ return str_ireplace('%USERONLINE_USERS%', $naming_users, $template);
 
 
 
 
 
 
 
 
 
 
 
503
  }
504
+
505
+ function format_most_users() {
506
+ return sprintf(__('Most users ever online were <strong>%s</strong>, on <strong>%s</strong>', 'wp-useronline'), number_format_i18n(get_most_useronline()), get_most_useronline_date());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  }
 
508
 
509
+ function get_counts($buckets) {
510
+ $counts = array();
511
+ $total = 0;
512
+ foreach ( array('member', 'guest', 'bot') as $type )
513
+ $total += $counts[$type] = count(@$buckets[$type]);
514
 
515
+ $counts['user'] = $total;
 
 
 
 
 
516
 
517
+ return $counts;
 
 
 
 
 
 
518
  }
 
519
  }
520
 
521
+ function _useronline_init() {
522
+ require_once dirname(__FILE__) . '/scb/load.php';
523
 
524
+ load_plugin_textdomain('wp-useronline', false, basename(dirname(__FILE__)));
 
 
 
 
 
 
 
 
 
 
 
 
525
 
526
+ new scbTable('useronline', __FILE__, "
527
+ timestamp int(15) NOT NULL default '0',
528
+ userid int(10) NOT NULL default '0',
529
+ username varchar(20) NOT NULL default '',
530
+ displayname varchar(255) NOT NULL default '',
531
+ useragent varchar(255) NOT NULL default '',
532
+ ip varchar(40) NOT NULL default '',
533
+ location varchar(255) NOT NULL default '',
534
+ url varchar(255) NOT NULL default '',
535
+ type enum('member','guest','bot') NOT NULL default 'guest',
536
+ referral varchar(255) NOT NULL default '',
537
+ UNIQUE KEY useronline_id (timestamp,username,ip,useragent)
538
+ ");
539
 
540
+ UserOnline_Core::init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
 
542
+ require_once dirname(__FILE__) . '/widget.php';
543
+ scbWidget::init('UserOnline_Widget', __FILE__);
 
 
 
 
 
 
 
 
544
 
545
+ if ( is_admin() ) {
546
+ require_once dirname(__FILE__) . '/admin.php';
547
+ new UserOnline_Options(__FILE__);
548
+ new UserOnline_Admin_Page(__FILE__);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  }
550
  }
551
+ _useronline_init();
552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wp-useronline.pot CHANGED
@@ -1,462 +1,332 @@
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WP-UserOnline 2.50\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2009-06-11 23:49+0800\n"
6
- "PO-Revision-Date: 2009-06-11 23:49+0800\n"
7
- "Last-Translator: Lester Chan <lesterchan@gmail.com>\n"
8
- "Language-Team: Lester Chan <lesterchan@gmail.com>\n"
9
  "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-Country: SINGAPORE\n"
13
- "X-Poedit-KeywordsList: __;_e;_c;_n:1,2;__ngettext_noop:1,2\n"
14
- "X-Poedit-Basepath: .\n"
15
- "X-Poedit-Language: English\n"
16
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Poedit-SearchPath-0: .\n"
18
 
19
- #: useronline-options.php:63
20
- msgid "Useronline Timeout"
21
- msgstr ""
22
-
23
- #: useronline-options.php:64
24
- msgid "Useronline Bots"
25
- msgstr ""
26
-
27
- #: useronline-options.php:65
28
- msgid "Useronline URL"
29
- msgstr ""
30
-
31
- #: useronline-options.php:66
32
- msgid "Useronline Naming Conventions"
33
- msgstr ""
34
-
35
- #: useronline-options.php:67
36
- msgid "User(s) Online Template"
37
- msgstr ""
38
-
39
- #: useronline-options.php:68
40
- msgid "User(s) Browsing Site Template"
41
- msgstr ""
42
-
43
- #: useronline-options.php:69
44
- msgid "User(s) Browsing Page Template"
45
- msgstr ""
46
-
47
- #: useronline-options.php:74
48
- msgid "Updated"
49
- msgstr ""
50
-
51
- #: useronline-options.php:79
52
- msgid "No Useronline Option Updated"
53
- msgstr ""
54
-
55
- #: useronline-options.php:85
56
- #: useronline-options.php:380
57
- msgid "UNINSTALL WP-UserOnline"
58
- msgstr ""
59
-
60
- #: useronline-options.php:92
61
- #, php-format
62
- msgid "Table '%s' has been deleted."
63
  msgstr ""
64
 
65
- #: useronline-options.php:101
66
- #, php-format
67
- msgid "Setting Key '%s' has been deleted."
 
68
  msgstr ""
69
 
70
- #: useronline-options.php:105
71
  #, php-format
72
- msgid "Error deleting Setting Key '%s'."
73
- msgstr ""
 
 
 
74
 
75
- #: useronline-options.php:127
76
- #: useronline-options.php:338
77
- msgid "Uninstall WP-UserOnline"
78
  msgstr ""
79
 
80
- #: useronline-options.php:128
81
- #, php-format
82
- msgid "<a href=\"%s\">Click Here</a> To Finish The Uninstallation And WP-UserOnline Will Be Deactivated Automatically."
83
  msgstr ""
84
 
85
- #: useronline-options.php:153
86
- #: wp-useronline.php:1013
87
  msgid "Online"
88
  msgstr ""
89
 
90
- #: useronline-options.php:160
91
- #: wp-useronline.php:1012
92
  msgid "1 User"
93
  msgstr ""
94
 
95
- #: useronline-options.php:161
96
- #: wp-useronline.php:1012
97
  msgid "%USERONLINE_COUNT% Users"
98
  msgstr ""
99
 
100
- #: useronline-options.php:162
101
- #: wp-useronline.php:1012
102
  msgid "1 Member"
103
  msgstr ""
104
 
105
- #: useronline-options.php:163
106
- #: wp-useronline.php:1012
107
  msgid "%USERONLINE_COUNT% Members"
108
  msgstr ""
109
 
110
- #: useronline-options.php:164
111
- #: wp-useronline.php:1012
112
  msgid "1 Guest"
113
  msgstr ""
114
 
115
- #: useronline-options.php:165
116
- #: wp-useronline.php:1012
117
  msgid "%USERONLINE_COUNT% Guests"
118
  msgstr ""
119
 
120
- #: useronline-options.php:166
121
- #: wp-useronline.php:1012
122
  msgid "1 Bot"
123
  msgstr ""
124
 
125
- #: useronline-options.php:167
126
- #: wp-useronline.php:1012
127
  msgid "%USERONLINE_COUNT% Bots"
128
  msgstr ""
129
 
130
- #: useronline-options.php:170
131
- #: useronline-options.php:171
132
- #: useronline-options.php:172
133
- #: useronline-options.php:176
134
- #: useronline-options.php:177
135
- #: useronline-options.php:178
136
- #: wp-useronline.php:1014
137
- #: wp-useronline.php:1015
138
  msgid ","
139
  msgstr ""
140
 
141
- #: useronline-options.php:173
142
- #: useronline-options.php:179
143
- #: wp-useronline.php:1014
144
- #: wp-useronline.php:1015
145
  msgid "Users|Template Element"
146
  msgstr ""
147
 
148
- #: useronline-options.php:179
149
- #: wp-useronline.php:1015
150
  msgid "Browsing This Page."
151
  msgstr ""
152
 
153
- #: useronline-options.php:186
154
- #: useronline-options.php:187
155
- msgid "Useronline Options"
156
  msgstr ""
157
 
158
- #: useronline-options.php:190
159
  msgid "Time Out"
160
  msgstr ""
161
 
162
- #: useronline-options.php:192
163
  msgid "How long till it will remove the user from the database (In seconds)."
164
  msgstr ""
165
 
166
- #: useronline-options.php:196
167
  msgid "UserOnline URL"
168
  msgstr ""
169
 
170
- #: useronline-options.php:198
171
- msgid "URL To UserOnline Page (leave blank if you do not want to link it to the UserOnline Page)<br />Example: http://www.yoursite.com/blogs/useronline/<br />Example: http://www.yoursite.com/blogs/?page_id=2"
 
 
 
172
  msgstr ""
173
 
174
- #: useronline-options.php:202
175
  msgid "Bots Name/User Agent"
176
  msgstr ""
177
 
178
- #: useronline-options.php:204
179
- msgid "Here are a list of bots and their partial browser agents.<br />On the left column will be the <strong>Bot's Name</strong> and on the right column will be their <strong>Partial Browser Agent</strong>.<br />Start each entry on a new line."
 
 
 
 
180
  msgstr ""
181
 
182
- #: useronline-options.php:212
183
  msgid "Naming Conventions:"
184
  msgstr ""
185
 
186
- #: useronline-options.php:213
187
- #: useronline-options.php:254
188
- #: useronline-options.php:266
189
- #: useronline-options.php:298
190
  msgid "Allowed Variables:"
191
  msgstr ""
192
 
193
- #: useronline-options.php:215
194
- #: useronline-options.php:259
195
- #: useronline-options.php:274
196
- #: useronline-options.php:306
197
  msgid "Restore Default Template"
198
  msgstr ""
199
 
200
- #: useronline-options.php:221
201
  msgid "Singular Form"
202
  msgstr ""
203
 
204
- #: useronline-options.php:222
205
  msgid "Plural Form"
206
  msgstr ""
207
 
208
- #: useronline-options.php:249
209
  msgid "Useronline Templates"
210
  msgstr ""
211
 
212
- #: useronline-options.php:253
213
  msgid "User(s) Online:"
214
  msgstr ""
215
 
216
- #: useronline-options.php:265
217
  msgid "User(s) Browsing Site:"
218
  msgstr ""
219
 
220
- #: useronline-options.php:280
221
- #: useronline-options.php:312
222
- msgid "Member Names Separator"
223
- msgstr ""
224
-
225
- #: useronline-options.php:281
226
- #: useronline-options.php:313
227
- msgid "Guests Separator"
228
- msgstr ""
229
-
230
- #: useronline-options.php:282
231
- #: useronline-options.php:314
232
- msgid "Bots Separator"
233
- msgstr ""
234
-
235
- #: useronline-options.php:297
236
  msgid "User(s) Browsing Page:"
237
  msgstr ""
238
 
239
- #: useronline-options.php:329
240
  msgid "Save Changes"
241
  msgstr ""
242
 
243
- #: useronline-options.php:340
244
- msgid "Deactivating WP-UserOnline plugin does not remove any data that may have been created, such as the useronline options. To completely remove this plugin, you can uninstall it here."
245
  msgstr ""
246
 
247
- #: useronline-options.php:343
248
- msgid "WARNING:"
249
  msgstr ""
250
 
251
- #: useronline-options.php:344
252
- msgid "Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first."
253
  msgstr ""
254
 
255
- #: useronline-options.php:347
256
- msgid "The following WordPress Options/Tables will be DELETED:"
257
  msgstr ""
258
 
259
- #: useronline-options.php:352
260
- msgid "WordPress Options"
261
  msgstr ""
262
 
263
- #: useronline-options.php:353
264
- msgid "WordPress Tables"
265
  msgstr ""
266
 
267
- #: useronline-options.php:379
268
- msgid "Yes"
269
  msgstr ""
270
 
271
- #: useronline-options.php:380
272
- msgid ""
273
- "You Are About To Uninstall WP-UserOnline From WordPress.\\n"
274
- "This Action Is Not Reversible.\\n"
275
- "\\n"
276
- " Choose [Cancel] To Stop, [OK] To Uninstall."
277
  msgstr ""
278
 
279
- #: wp-useronline.php:58
280
- #: wp-useronline.php:846
281
- #: wp-useronline.php:848
282
- #: wp-useronline.php:858
283
- msgid "WP-UserOnline"
284
  msgstr ""
285
 
286
- #: wp-useronline.php:61
287
- #: wp-useronline.php:873
288
- #: wp-useronline.php:934
289
- msgid "UserOnline"
290
  msgstr ""
291
 
292
- #: wp-useronline.php:128
293
- msgid "guest"
294
  msgstr ""
295
 
296
- #: wp-useronline.php:134
297
- #: wp-useronline.php:709
298
- msgid "Guest"
299
  msgstr ""
300
 
301
- #: wp-useronline.php:149
302
- msgid "Blog Archive"
303
  msgstr ""
304
 
305
- #: wp-useronline.php:230
306
- #: wp-useronline.php:261
307
- #: wp-useronline.php:744
308
- #: wp-useronline.php:746
309
- #: wp-useronline.php:764
310
- #: wp-useronline.php:766
311
- #: wp-useronline.php:779
312
  #, php-format
313
- msgid "%s @ %s"
314
- msgstr ""
315
-
316
- #: wp-useronline.php:398
317
- msgid "No User Is Browsing This Site"
318
- msgstr ""
319
-
320
- #: wp-useronline.php:540
321
- msgid "No User Is Browsing This Page"
322
- msgstr ""
323
 
324
- #: wp-useronline.php:611
325
- msgid "Users Online Now"
326
  msgstr ""
327
 
328
- #: wp-useronline.php:623
329
- #, php-format
330
- msgid "There is <strong><a href=\"%s\">%s user</a></strong> online now."
331
  msgstr ""
332
 
333
- #: wp-useronline.php:625
334
- #, php-format
335
- msgid "There are a total of <strong><a href=\"%s\">%s users</a></strong> online now."
336
  msgstr ""
337
 
338
- #: wp-useronline.php:630
339
- #: wp-useronline.php:731
340
- #, php-format
341
- msgid "Most users ever online were <strong>%s</strong>, on <strong>%s</strong>"
342
  msgstr ""
343
 
344
- #: wp-useronline.php:694
345
  msgid "User"
346
  msgstr ""
347
 
348
- #: wp-useronline.php:696
349
  msgid "Users"
350
  msgstr ""
351
 
352
- #: wp-useronline.php:701
353
  msgid "Member"
354
  msgstr ""
355
 
356
- #: wp-useronline.php:703
357
  msgid "Members"
358
  msgstr ""
359
 
360
- #: wp-useronline.php:711
361
  msgid "Guests"
362
  msgstr ""
363
 
364
- #: wp-useronline.php:716
365
  msgid "Bot"
366
  msgstr ""
367
 
368
- #: wp-useronline.php:718
369
  msgid "Bots"
370
  msgstr ""
371
 
372
- #: wp-useronline.php:727
373
- #, php-format
374
- msgid "There is <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</strong> and <strong>%s</strong>."
375
- msgstr ""
376
-
377
- #: wp-useronline.php:729
378
  #, php-format
379
- msgid "There are a total of <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</strong> and <strong>%s</strong>."
380
- msgstr ""
381
-
382
- #: wp-useronline.php:734
383
- #: wp-useronline.php:754
384
- #: wp-useronline.php:774
385
- msgid "Online Now"
386
- msgstr ""
387
 
388
- #: wp-useronline.php:741
389
- #: wp-useronline.php:761
390
- msgid "referral"
391
  msgstr ""
392
 
393
- #: wp-useronline.php:744
394
- #: wp-useronline.php:746
395
- #: wp-useronline.php:764
396
- #: wp-useronline.php:766
397
- #: wp-useronline.php:779
398
  msgid "on"
399
  msgstr ""
400
 
401
- #: wp-useronline.php:744
402
- #: wp-useronline.php:746
403
- #: wp-useronline.php:764
404
- #: wp-useronline.php:766
405
- #: wp-useronline.php:779
406
  msgid "url"
407
  msgstr ""
408
 
409
- #: wp-useronline.php:786
410
- msgid "No One Is Online Now"
411
- msgstr ""
412
-
413
- #: wp-useronline.php:860
414
- #, php-format
415
- msgid "<strong>%s</strong> user online now."
416
- msgid_plural "<strong>%s</strong> users online now."
417
- msgstr[0] ""
418
- msgstr[1] ""
419
-
420
- #: wp-useronline.php:861
421
- #, php-format
422
- msgid "Most users ever online was <strong>%s</strong>."
423
- msgid_plural "Most users ever online was <strong>%s</strong>."
424
- msgstr[0] ""
425
- msgstr[1] ""
426
-
427
- #: wp-useronline.php:862
428
- msgid "On"
429
- msgstr ""
430
-
431
- #: wp-useronline.php:872
432
- msgid "WP-UserOnline users online statistics"
433
  msgstr ""
434
 
435
- #: wp-useronline.php:939
436
- msgid "Title:"
437
  msgstr ""
438
 
439
- #: wp-useronline.php:942
440
- msgid "Statistics Type:"
 
441
  msgstr ""
442
 
443
- #: wp-useronline.php:944
444
- msgid "Users Online Count"
 
445
  msgstr ""
446
 
447
- #: wp-useronline.php:945
448
- msgid "Users Browsing Current Page"
449
  msgstr ""
450
 
451
- #: wp-useronline.php:946
452
- msgid "Users Browsing Site"
 
 
 
453
  msgstr ""
454
 
455
- #: wp-useronline.php:948
456
- msgid "Users Online Count & Users Browsing Current Page"
457
  msgstr ""
458
 
459
- #: wp-useronline.php:949
460
- msgid "Users Online Count & Users Browsing Site"
461
  msgstr ""
462
-
1
+ # Translation of the WordPress plugin WP-UserOnline 2.61 by Lester 'GaMerZ' Chan.
2
+ # Copyright (C) 2010 Lester 'GaMerZ' Chan
3
+ # This file is distributed under the same license as the WP-UserOnline package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: WP-UserOnline 2.61\n"
10
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-useronline\n"
11
+ "POT-Creation-Date: 2010-02-15 14:30+0000\n"
12
+ "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=utf-8\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
 
 
 
 
 
19
 
20
+ #: admin.php:8
21
+ msgid "Users Online Now"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  msgstr ""
23
 
24
+ #. #-#-#-#-# plugin.pot (WP-UserOnline 2.61) #-#-#-#-#
25
+ #. Plugin Name of an extension
26
+ #: admin.php:9 wp-stats.php:21 wp-stats.php:38
27
+ msgid "WP-UserOnline"
28
  msgstr ""
29
 
30
+ #: admin.php:22
31
  #, php-format
32
+ msgid "There is <strong><a href=\"%s\">%s user</a></strong> online now."
33
+ msgid_plural ""
34
+ "There are a total of <strong><a href=\"%s\">%s users</a></strong> online now."
35
+ msgstr[0] ""
36
+ msgstr[1] ""
37
 
38
+ #: admin.php:47
39
+ msgid "UserOnline Options"
 
40
  msgstr ""
41
 
42
+ #: admin.php:48 widget.php:6 widget.php:63
43
+ msgid "UserOnline"
 
44
  msgstr ""
45
 
46
+ #: admin.php:58 wp-useronline.php:73
 
47
  msgid "Online"
48
  msgstr ""
49
 
50
+ #: admin.php:64 wp-useronline.php:63
 
51
  msgid "1 User"
52
  msgstr ""
53
 
54
+ #: admin.php:65 wp-useronline.php:64
 
55
  msgid "%USERONLINE_COUNT% Users"
56
  msgstr ""
57
 
58
+ #: admin.php:66 wp-useronline.php:65
 
59
  msgid "1 Member"
60
  msgstr ""
61
 
62
+ #: admin.php:67 wp-useronline.php:66
 
63
  msgid "%USERONLINE_COUNT% Members"
64
  msgstr ""
65
 
66
+ #: admin.php:68 wp-useronline.php:67
 
67
  msgid "1 Guest"
68
  msgstr ""
69
 
70
+ #: admin.php:69 wp-useronline.php:68
 
71
  msgid "%USERONLINE_COUNT% Guests"
72
  msgstr ""
73
 
74
+ #: admin.php:70 wp-useronline.php:69
 
75
  msgid "1 Bot"
76
  msgstr ""
77
 
78
+ #: admin.php:71 wp-useronline.php:70
 
79
  msgid "%USERONLINE_COUNT% Bots"
80
  msgstr ""
81
 
82
+ #: admin.php:74 admin.php:75 admin.php:76 admin.php:80 admin.php:81
83
+ #: admin.php:82 wp-useronline.php:76 wp-useronline.php:77 wp-useronline.php:78
84
+ #: wp-useronline.php:83 wp-useronline.php:84 wp-useronline.php:85
 
 
 
 
 
85
  msgid ","
86
  msgstr ""
87
 
88
+ #: admin.php:77 admin.php:83 wp-useronline.php:79 wp-useronline.php:86
 
 
 
89
  msgid "Users|Template Element"
90
  msgstr ""
91
 
92
+ #: admin.php:83 wp-useronline.php:86
 
93
  msgid "Browsing This Page."
94
  msgstr ""
95
 
96
+ #: admin.php:127
97
+ msgid "Settings updated."
 
98
  msgstr ""
99
 
100
+ #: admin.php:140
101
  msgid "Time Out"
102
  msgstr ""
103
 
104
+ #: admin.php:142
105
  msgid "How long till it will remove the user from the database (In seconds)."
106
  msgstr ""
107
 
108
+ #: admin.php:146
109
  msgid "UserOnline URL"
110
  msgstr ""
111
 
112
+ #: admin.php:148
113
+ msgid ""
114
+ "URL To UserOnline Page (leave blank if you do not want to link it to the "
115
+ "UserOnline Page)<br />Example: http://www.yoursite.com/blogs/useronline/<br /"
116
+ ">Example: http://www.yoursite.com/blogs/?page_id=2"
117
  msgstr ""
118
 
119
+ #: admin.php:152
120
  msgid "Bots Name/User Agent"
121
  msgstr ""
122
 
123
+ #: admin.php:154
124
+ msgid ""
125
+ "Here are a list of bots and their partial browser agents.<br />On the left "
126
+ "column will be the <strong>Bot's Name</strong> and on the right column will "
127
+ "be their <strong>Partial Browser Agent</strong>.<br />Start each entry on a "
128
+ "new line."
129
  msgstr ""
130
 
131
+ #: admin.php:162
132
  msgid "Naming Conventions:"
133
  msgstr ""
134
 
135
+ #: admin.php:163 admin.php:197 admin.php:222
 
 
 
136
  msgid "Allowed Variables:"
137
  msgstr ""
138
 
139
+ #: admin.php:165 admin.php:202 admin.php:230
 
 
 
140
  msgid "Restore Default Template"
141
  msgstr ""
142
 
143
+ #: admin.php:171
144
  msgid "Singular Form"
145
  msgstr ""
146
 
147
+ #: admin.php:172
148
  msgid "Plural Form"
149
  msgstr ""
150
 
151
+ #: admin.php:192
152
  msgid "Useronline Templates"
153
  msgstr ""
154
 
155
+ #: admin.php:196
156
  msgid "User(s) Online:"
157
  msgstr ""
158
 
159
+ #: admin.php:206
160
  msgid "User(s) Browsing Site:"
161
  msgstr ""
162
 
163
+ #: admin.php:207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  msgid "User(s) Browsing Page:"
165
  msgstr ""
166
 
167
+ #: admin.php:210 scb/AdminPage.php:119 scb/AdminPage.php:130
168
  msgid "Save Changes"
169
  msgstr ""
170
 
171
+ #: admin.php:236
172
+ msgid "Member Names Separator"
173
  msgstr ""
174
 
175
+ #: admin.php:237
176
+ msgid "Guests Separator"
177
  msgstr ""
178
 
179
+ #: admin.php:238
180
+ msgid "Bots Separator"
181
  msgstr ""
182
 
183
+ #: scb/AdminPage.php:108
184
+ msgid "Settings <strong>saved</strong>."
185
  msgstr ""
186
 
187
+ #: scb/AdminPage.php:284
188
+ msgid "Settings"
189
  msgstr ""
190
 
191
+ #: widget.php:5
192
+ msgid "WP-UserOnline users online statistics"
193
  msgstr ""
194
 
195
+ #: widget.php:70
196
+ msgid "Title:"
197
  msgstr ""
198
 
199
+ #: widget.php:73
200
+ msgid "Statistics Type:"
 
 
 
 
201
  msgstr ""
202
 
203
+ #: widget.php:75
204
+ msgid "Users Online Count"
 
 
 
205
  msgstr ""
206
 
207
+ #: widget.php:76
208
+ msgid "Users Browsing Current Page"
 
 
209
  msgstr ""
210
 
211
+ #: widget.php:77
212
+ msgid "Users Browsing Site"
213
  msgstr ""
214
 
215
+ #: widget.php:79
216
+ msgid "Users Online Count & Users Browsing Current Page"
 
217
  msgstr ""
218
 
219
+ #: widget.php:80
220
+ msgid "Users Online Count & Users Browsing Site"
221
  msgstr ""
222
 
223
+ #: wp-stats.php:31
 
 
 
 
 
 
224
  #, php-format
225
+ msgid "<strong>%s</strong> user online now."
226
+ msgid_plural "<strong>%s</strong> users online now."
227
+ msgstr[0] ""
228
+ msgstr[1] ""
 
 
 
 
 
 
229
 
230
+ #: wp-useronline.php:151
231
+ msgid "guest"
232
  msgstr ""
233
 
234
+ #: wp-useronline.php:157 wp-useronline.php:349
235
+ msgid "Guest"
 
236
  msgstr ""
237
 
238
+ #: wp-useronline.php:166
239
+ msgid "Admin"
 
240
  msgstr ""
241
 
242
+ #: wp-useronline.php:172
243
+ msgid "Archive"
 
 
244
  msgstr ""
245
 
246
+ #: wp-useronline.php:347
247
  msgid "User"
248
  msgstr ""
249
 
250
+ #: wp-useronline.php:347
251
  msgid "Users"
252
  msgstr ""
253
 
254
+ #: wp-useronline.php:348
255
  msgid "Member"
256
  msgstr ""
257
 
258
+ #: wp-useronline.php:348
259
  msgid "Members"
260
  msgstr ""
261
 
262
+ #: wp-useronline.php:349
263
  msgid "Guests"
264
  msgstr ""
265
 
266
+ #: wp-useronline.php:350
267
  msgid "Bot"
268
  msgstr ""
269
 
270
+ #: wp-useronline.php:350
271
  msgid "Bots"
272
  msgstr ""
273
 
274
+ #: wp-useronline.php:358
 
 
 
 
 
275
  #, php-format
276
+ msgid ""
277
+ "There is <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</"
278
+ "strong> and <strong>%s</strong>."
279
+ msgid_plural ""
280
+ "There are a total of <strong>%s</strong> online now: <strong>%s</strong>, "
281
+ "<strong>%s</strong> and <strong>%s</strong>."
282
+ msgstr[0] ""
283
+ msgstr[1] ""
284
 
285
+ #: wp-useronline.php:434
286
+ msgid "No One Is Online Now"
 
287
  msgstr ""
288
 
289
+ #: wp-useronline.php:436
 
 
 
 
290
  msgid "on"
291
  msgstr ""
292
 
293
+ #: wp-useronline.php:437
 
 
 
 
294
  msgid "url"
295
  msgstr ""
296
 
297
+ #: wp-useronline.php:438
298
+ msgid "referral"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  msgstr ""
300
 
301
+ #: wp-useronline.php:449
302
+ msgid "Online Now"
303
  msgstr ""
304
 
305
+ #: wp-useronline.php:480
306
+ #, php-format
307
+ msgid "%s @ %s"
308
  msgstr ""
309
 
310
+ #: wp-useronline.php:499
311
+ #, php-format
312
+ msgid "Most users ever online were <strong>%s</strong>, on <strong>%s</strong>"
313
  msgstr ""
314
 
315
+ #. Plugin URI of an extension
316
+ msgid "http://wordpress.org/extend/plugins/wp-useronline/"
317
  msgstr ""
318
 
319
+ #. Description of an extension
320
+ msgid ""
321
+ "Enable you to display how many users are online on your Wordpress blog with "
322
+ "detailed statistics of where they are and who there are(Members/Guests/"
323
+ "Search Bots)."
324
  msgstr ""
325
 
326
+ #. Author of an extension
327
+ msgid "Lester 'GaMerZ' Chan"
328
  msgstr ""
329
 
330
+ #. Author URI of an extension
331
+ msgid "http://lesterchan.net"
332
  msgstr ""