Changeset 6109
- Timestamp:
- 06/08/06 10:42:10 (2 years ago)
- Location:
- wp-useronline/trunk
- Files:
-
- 1 added
- 3 modified
-
readme.html (modified) (4 diffs)
-
useronline/useronline-js.js (added)
-
useronline/useronline-widget.php (modified) (2 diffs)
-
useronline/useronline.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-useronline/trunk/readme.html
r6105 r6109 217 217 <b>Version 2.04 (01-07-2006)</b> 218 218 <ul> 219 <li>NEW: AJAX Is Now Used For Updating Users Online Every 1 Minute Without Refreshing The Page</li> 219 220 <li>NEW: You Can Now Place Users Online Count And Users Browsing Site Data On The Sidebar As A Widget</li> 220 221 <li>NEW: UserOnline Options Panel And The Code That WP-UserOnline Generated Is XHTML 1.0 Transitional</li> … … 333 334 <h2>UserOnline</h2><br /> 334 335 <ul><br /> 335 <li>< a href="<?php echo get_settings('home'); ?>/wp-content/plugins/useronline/wp-useronline.php"><?php get_useronline(); ?></a></li><br />336 <li><div id="useronline-count"><?php get_useronline(); ?></div></li><br /> 336 337 </ul><br /> 337 338 </li><br /> … … 364 365 <blockquote> 365 366 <?php if (function_exists('get_users_browsing_site')): ?><br /> 366 < ?php get_users_browsing_site(); ?><br />367 <div id="useronline-browsing-site"><?php get_users_browsing_site(); ?></div><br /> 367 368 <?php endif; ?> 368 369 </blockquote> … … 375 376 <blockquote> 376 377 <?php if (function_exists('get_users_browsing_page')): ?><br /> 377 < ?php get_users_browsing_page(); ?><br />378 <div id="useronline-browsing-page"><?php get_users_browsing_page(); ?></div><br /> 378 379 <?php endif; ?> 379 380 </blockquote> -
wp-useronline/trunk/useronline/useronline-widget.php
r6105 r6109 42 42 if (function_exists('useronline')) { 43 43 echo '<ul>'."\n"; 44 echo '<li>< a href="'.get_settings('home').'/wp-content/plugins/useronline/wp-useronline.php">';44 echo '<li><div id="useronline-count">'; 45 45 get_useronline(); 46 echo '</ a></li>'."\n";46 echo '</div></li>'."\n"; 47 47 if(intval($options['display_usersbrowsingsite']) == 1) { 48 echo '<li> ';48 echo '<li><div id="useronline-browsing-site">'; 49 49 get_users_browsing_site(); 50 echo '</ li>'."\n";50 echo '</div></li>'."\n"; 51 51 } 52 52 echo '</ul>'."\n"; … … 65 65 update_option('widget_useronline', $options); 66 66 } 67 echo '<p style="text-align: center;"><label for="useronline-usersbrowsingsite">Display Users Browsing Site Under Users Online Count?</label></p>' ;67 echo '<p style="text-align: center;"><label for="useronline-usersbrowsingsite">Display Users Browsing Site Under Users Online Count?</label></p>'."\n"; 68 68 echo '<p style="text-align: center;"><input type="radio" id="useronline-usersbrowsingsite" name="useronline-usersbrowsingsite" value="1"'; 69 69 checked(1, intval($options['display_usersbrowsingsite'])); 70 70 echo ' /> Yes <input type="radio" id="useronline-usersbrowsingsite" name="useronline-usersbrowsingsite" value="0"'; 71 71 checked(0, intval($options['display_usersbrowsingsite'])); 72 echo ' /> No</p>' ;73 echo '<input type="hidden" id="useronline-submit" name="useronline-submit" value="1" />' ;72 echo ' /> No</p>'."\n"; 73 echo '<input type="hidden" id="useronline-submit" name="useronline-submit" value="1" />'."\n"; 74 74 } 75 75 -
wp-useronline/trunk/useronline/useronline.php
r6105 r6109 44 44 45 45 46 ### Function: Get IP Address 47 if(!function_exists('get_ipaddress')) { 48 function get_ipaddress() { 49 if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { 50 $ip_address = $_SERVER["REMOTE_ADDR"]; 51 } else { 52 $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"]; 53 } 54 if(strpos($ip_address, ',') !== false) { 55 $ip_address = explode(',', $ip_address); 56 $ip_address = $ip_address[0]; 57 } 58 return $ip_address; 46 ### Function: Displays UserOnline Header 47 add_action('wp_head', 'useronline_header'); 48 function useronline_header() { 49 echo '<script type="text/javascript">'."\n"; 50 echo '/* Start Of Javascript Generated By WP-UserOnline 2.04 */'."\n"; 51 echo '/* <![CDATA[ */'."\n"; 52 echo "\t".'if(site_url != \''.get_settings('siteurl').'\') {'."\n"; 53 echo "\t\t".'var site_url = \''.get_settings('siteurl').'\';'."\n"; 54 echo "\t".'}'."\n"; 55 echo '/* ]]> */'."\n"; 56 echo '/* End Of Javascript Generated By WP-UserOnline 2.04 */'."\n"; 57 echo '</script>'."\n"; 58 echo '<script src="'.get_settings('siteurl').'/wp-includes/js/tw-sack.js" type="text/javascript"></script>'."\n"; 59 echo '<script src="'.get_settings('siteurl').'/wp-content/plugins/useronline/useronline-js.js" type="text/javascript"></script>'."\n"; 60 } 61 62 63 ### Function: Process AJAX Request 64 add_action('init', 'useronline_ajax'); 65 function useronline_ajax() { 66 global $wpdb, $useronline; 67 $mode = trim($_GET['useronline_mode']); 68 if(!empty($mode)) { 69 switch($mode) { 70 case 'useronline_count': 71 $useronline = intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline")); 72 get_useronline(); 73 break; 74 case 'useronline_browsingsite': 75 get_users_browsing_site(); 76 break; 77 case 'useronline_browsingpage': 78 get_users_browsing_page(); 79 break; 80 } 81 exit(); 59 82 } 60 83 } … … 136 159 if($display) { 137 160 if($useronline > 1) { 138 echo '< b>'.number_format($useronline)."</b> $users ".__('Online');161 echo '<a href="'.get_settings('siteurl').'/wp-content/plugins/useronline/wp-useronline.php"><b>'.number_format($useronline).'</b> '.$users.' '.__('Online').'</a>'."\n"; 139 162 } else { 140 echo "<b>$useronline</b> $user ".__('Online');163 echo '<a href="'.get_settings('siteurl').'/wp-content/plugins/useronline/wp-useronline.php"><b>'.$useronline.'</b> '.$user.' '.__('Online').'</a>'."\n"; 141 164 } 142 165 } else { … … 248 271 } else { 249 272 // This Should Not Happen 250 _e('No User Is Browsing This Page');273 _e('No User Is Browsing This Site'); 251 274 } 252 275 } … … 328 351 // This Should Not Happen 329 352 _e('No User Is Browsing This Page'); 353 } 354 } 355 356 357 ### Function: Get IP Address 358 if(!function_exists('get_ipaddress')) { 359 function get_ipaddress() { 360 if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { 361 $ip_address = $_SERVER["REMOTE_ADDR"]; 362 } else { 363 $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"]; 364 } 365 if(strpos($ip_address, ',') !== false) { 366 $ip_address = explode(',', $ip_address); 367 $ip_address = $ip_address[0]; 368 } 369 return $ip_address; 330 370 } 331 371 }
