Changeset 365240
- Timestamp:
- 03/26/2011 10:56:48 PM (15 years ago)
- Location:
- wp-useragent/trunk
- Files:
-
- 4 added
- 3 edited
-
img/16/net/blackhawk.png (added)
-
img/16/net/tencenttraveler.png (added)
-
img/24/net/blackhawk.png (added)
-
img/24/net/tencenttraveler.png (added)
-
readme.txt (modified) (3 diffs)
-
wp-useragent-options.php (modified) (3 diffs)
-
wp-useragent.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-useragent/trunk/readme.txt
r359601 r365240 4 4 Tags: useragent, user-agent, user agent, web, browser, web browser, operating system, platform, os, mac, apple, windows, win, linux, phone 5 5 Requires at least: 2.0 6 Tested up to: 3. 17 Stable tag: 0.10. 56 Tested up to: 3.2 7 Stable tag: 0.10.6 8 8 9 9 == Description == … … 66 66 67 67 == Changelog == 68 69 = v0.10.6 = 70 * Added detection for BlackHawk, Gtk+ WebCore, Tencent Traveler and Vimprobable. 71 * Added a quick fix for Arch Linux improperly being detected when IE users have SearchToolbar installed (since it improperly matched seARCHtoolbar). 72 * Added new feature to hide "Unknown" output. This is disabled by default (props: Cahya) 73 68 74 69 75 = v0.10.5 = … … 495 501 == Upgrade Notice == 496 502 497 = v0.10.4 = 498 * Added missing IRIX OS images. The quality isn't great, but they're the best I could find and produce myself. Submissions are welcome. 499 * Adjusted Nokia Series60 browser detection so the output is less redundant (props: Yomi) 500 * Added detection for the Chromium web browser (props: Terry Wang) 501 * Added detection for the RockMelt social web browser. 502 * Reorganized detection for Google Chrome since so many derivatives are beginning to use it as a base and leave it in their user agent string. 503 = v0.10.6 = 504 * Added detection for BlackHawk, Gtk+ WebCore, Tencent Traveler and Vimprobable. 505 * Added a quick fix for Arch Linux improperly being detected when IE users have SearchToolbar installed (since it improperly matched seARCHtoolbar). 506 * Added new feature to hide "Unknown" output. This is disabled by default (props: Cahya) -
wp-useragent/trunk/wp-useragent-options.php
r283453 r365240 17 17 $ua_text_links=get_option('ua_text_links'); 18 18 $ua_show_au_bool=get_option('ua_show_ua_bool'); 19 $ua_hide_unknown_bool=get_option('ua_hide_unknown_bool'); 19 20 $ua_output_location=get_option('ua_output_location'); 20 21 ?> … … 165 166 <select id="ua_show_ua_bool" name="ua_show_ua_bool" onchange="preview();"> 166 167 <option value="true" <?php if($ua_show_ua_bool=="true") echo 'selected="selected"' ?>>True</option> 167 <option value="false"<?php if($ua_show_ua_bool=="false") echo 'selected="selected"' ?>>False</option> 168 <option value="false" <?php if($ua_show_ua_bool=="false") echo 'selected="selected"' ?>>False</option> 169 </select> 170 </div></td> 171 </tr> 172 <tr valign='top'> 173 <th scope='row'>Hide icons and text for Unknown:</th> 174 <td><div style="overflow:auto;max-height:100px;"> 175 <select id="ua_hide_unknown_bool" name="ua_hide_unknown_bool" onchange="preview();"> 176 <option value="true" <?php if($ua_hide_unknown_bool=="true") echo 'selected="selected"' ?>>True</option> 177 <option value="false" <?php if($ua_hide_unknown_bool!="true") echo 'selected="selected"' ?>>False</option> 168 178 </select> 169 179 </div></td> … … 276 286 277 287 <input type="hidden" name="action" value="update" /> 278 <input type="hidden" name="page_options" value="ua_doctype, ua_comment_size, ua_track_size, ua_show_text, ua_image_style, ua_image_css, ua_text_surfing, ua_text_on, ua_text_via, ua_text_links, ua_show_ua_bool, ua_ output_location" />288 <input type="hidden" name="page_options" value="ua_doctype, ua_comment_size, ua_track_size, ua_show_text, ua_image_style, ua_image_css, ua_text_surfing, ua_text_on, ua_text_via, ua_text_links, ua_show_ua_bool, ua_hide_unknown_bool, ua_output_location" /> 279 289 <p class="submit"> 280 290 <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> -
wp-useragent/trunk/wp-useragent.php
r359601 r365240 4 4 Plugin URI: http://kyleabaker.com/goodies/coding/wp-useragent/ 5 5 Description: A simple User-Agent detection plugin that lets you easily insert icons and/or textual web browser and operating system details with each comment. 6 Version: 0.10. 56 Version: 0.10.6 7 7 Author: Kyle Baker 8 8 Author URI: http://kyleabaker.com/ … … 53 53 $ua_text_links=get_option('ua_text_links'); 54 54 $ua_show_ua_bool=get_option('ua_show_ua_bool'); 55 $ua_hide_unknown_bool=get_option('ua_hide_unknown_bool'); 55 56 $ua_output_location=get_option('ua_output_location'); 56 57 … … 101 102 elseif(strtolower($title)=="opera mobi") 102 103 return "Opera Mobile ".$version; 104 elseif(strtolower($title)=="osb-browser") 105 return "Gtk+ WebCore ".$version; 103 106 elseif(strtolower($title)=="tablet browser") 104 107 return "MicroB ".$version; … … 111 114 //Detect webbrowsers 112 115 function detect_webbrowser(){ 113 global $useragent, $ua_show_text, $ua_text_links ;116 global $useragent, $ua_show_text, $ua_text_links, $ua_hide_unknown_bool; 114 117 $mobile=0; 115 118 if(preg_match('/360se/i', $useragent)){ … … 169 172 $title=detect_browser_version("Blackbird"); 170 173 $code="blackbird"; 174 }elseif(preg_match('/BlackHawk/i', $useragent)){ 175 $link="http://www.netgate.sk/blackhawk/help/welcome-to-blackhawk-web-browser.html"; 176 $title=detect_browser_version("BlackHawk"); 177 $code="blackhawk"; 171 178 }elseif(preg_match('/Blazer/i', $useragent)){ 172 179 $link="http://en.wikipedia.org/wiki/Blazer_(web_browser)"; … … 639 646 $title="Oregano Web Browser"; 640 647 $code="owb"; 648 }elseif(preg_match('/osb-browser/i', $useragent)){ 649 $link="http://gtk-webcore.sourceforge.net/"; 650 $title=detect_browser_version("osb-browser"); 651 $code="null"; 641 652 }elseif(preg_match('/\ Pre\//i', $useragent)){ 642 653 $link="http://www.palm.com/us/products/phones/pre/index.html"; … … 779 790 $title=detect_browser_version(" Teleca"); 780 791 $code="obigo"; 792 }elseif(preg_match('/TencentTraveler/i', $useragent)){ 793 $link="http://www.tencent.com/en-us/index.shtml"; 794 $title="Tencent ".detect_browser_version("Traveler"); 795 $code="tencenttraveler"; 781 796 }elseif(preg_match('/TheWorld/i', $useragent)){ 782 797 $link="http://www.ioage.com/"; … … 831 846 $title="uzbl"; 832 847 $code="uzbl"; 848 }elseif(preg_match('/Vimprobable/i', $useragent)){ 849 $link="http://www.vimprobable.org/"; 850 $title=detect_browser_version("Vimprobable"); 851 $code="null"; 833 852 }elseif(preg_match('/Vonkeror/i', $useragent)){ 834 853 $link="http://zzo38computer.cjb.net/vonkeror/"; … … 918 937 $title="Unknown"; 919 938 $code="null"; 939 if($ua_hide_unknown_bool=='true' && $ua_show_text==2) 940 return $title; 920 941 } 921 942 if($ua_show_text=="1" && $ua_text_links!="0") //image and linked text … … 1181 1202 $title="Android"; 1182 1203 $code="android"; 1183 }elseif(preg_match('/ Arch/i', $useragent)){1204 }elseif(preg_match('/[^A-Za-z]Arch/i', $useragent)) { //&& !preg_match('/Search/i', $useragent)){ 1184 1205 $link="http://www.archlinux.org/"; 1185 1206 $title="Arch Linux"; … … 1367 1388 }elseif(preg_match('/Suse/i', $useragent)){ 1368 1389 $link="http://www.opensuse.org/"; 1369 $title=" SuSE";1390 $title="openSUSE"; 1370 1391 $code="suse"; 1371 1392 }elseif(preg_match('/Symb[ian]?[OS]?/i', $useragent)){ … … 1514 1535 //Detect Platform (check for Device, then OS if no device is found, else return null) 1515 1536 function detect_platform(){ 1516 global $useragent, $ua_show_text, $ua_text_links ;1537 global $useragent, $ua_show_text, $ua_text_links, $ua_hide_unknown_bool; 1517 1538 if(strlen($detected_platform=detect_device()) > 0){ 1518 1539 return $detected_platform; … … 1523 1544 $link="#"; 1524 1545 $code="null"; 1546 if($ua_hide_unknown_bool=='true' && $ua_show_text==2) 1547 return $title; 1525 1548 } 1526 1549 if($ua_show_text=="1" && $ua_text_links!="0") //image and linked text … … 1539 1562 //Detect Trackbacks -- Check if it works... 1540 1563 function detect_trackback(){ 1541 global $useragent, $ua_trackback, $ua_show_text, $ua_text_links ;1564 global $useragent, $ua_trackback, $ua_show_text, $ua_text_links, $ua_hide_unknown_bool; 1542 1565 $ua_trackback=0; 1543 1566 if(preg_match('/Drupal/i', $useragent)){ … … 1611 1634 $title="Unknown"; 1612 1635 $code="null"; 1636 if($ua_hide_unknown_bool=='true' && $ua_show_text==2) 1637 return $title; 1613 1638 } 1614 1639 $title.=" ".$version; … … 1677 1702 //Function to form the final String 1678 1703 function display_useragent(){ 1679 global $comment, $ua_show_text, $ua_text_surfing, $ua_text_on, $ua_text_via, $ua_show_ua_bool, $ua_ doctype;1704 global $comment, $ua_show_text, $ua_text_surfing, $ua_text_on, $ua_text_via, $ua_show_ua_bool, $ua_hide_unknown_bool, $ua_doctype; 1680 1705 //Check if the comment is a trackback. 1681 1706 if($comment->comment_type=='trackback' || $comment->comment_type=='pingback'){ 1682 if($ua_show_text=="1" || $ua_show_text=="3") 1683 $ua="$ua_text_via ".detect_trackback(); 1684 elseif($ua_show_text=="2") 1685 $ua=detect_trackback(); 1707 $trackback=detect_trackback(); 1708 if($ua_show_text=="1" || $ua_show_text=="3"){ 1709 if($ua_hide_unknown_bool=='true' && strpos($trackback,"Unknown")) 1710 $ua=""; 1711 else 1712 $ua="$ua_text_via $trackback"; 1713 }elseif($ua_show_text=="2"){ 1714 if($ua_hide_unknown_bool=='true' && strpos($trackback,"Unknown")) 1715 $ua=""; 1716 else 1717 $ua=$trackback; 1718 } 1686 1719 }else{ 1687 if($ua_show_text=="1" || $ua_show_text=="3") 1688 $ua="$ua_text_surfing ".detect_webbrowser()." $ua_text_on ".detect_platform(); 1689 elseif($ua_show_text=="2") 1690 $ua=detect_webbrowser().detect_platform(); 1720 $webbrowser=detect_webbrowser(); 1721 $platform=detect_platform(); 1722 if($ua_show_text=="1" || $ua_show_text=="3"){ 1723 if($ua_hide_unknown_bool=='true' && strpos($webbrowser,"Unknown") && strpos($platform,"Unknown")) 1724 $ua=""; 1725 elseif($ua_hide_unknown_bool=='true' && strpos($webbrowser,"Unknown")) 1726 $ua="$ua_text_on $platform"; 1727 elseif($ua_hide_unknown_bool=='true' && strpos($platform,"Unknown")) 1728 $ua="$ua_text_surfing $webbrowser"; 1729 else 1730 $ua="$ua_text_surfing $webbrowser $ua_text_on $platform"; 1731 }elseif($ua_show_text=="2"){ 1732 if($ua_hide_unknown_bool=='true' && strpos($webbrowser,"Unknown") && strpos($platform,"Unknown")) 1733 $ua=""; 1734 elseif($ua_hide_unknown_bool=='true' && strpos($webbrowser,"Unknown")) 1735 $ua=$platform; 1736 elseif($ua_hide_unknown_bool=='true' && strpos($platform,"Unknown")) 1737 $ua=$webbrowser; 1738 else 1739 $ua=$webbrowser.$platform; 1740 } 1691 1741 } 1692 1742 1693 1743 if($ua_show_ua_bool=='true'){ 1694 if($ua_doctype=="html") 1695 $ua.="<br><small>".htmlspecialchars($comment->comment_agent)."</small>"; 1696 elseif($ua_doctype=="xhtml") 1697 $ua.="<br /><small>".htmlspecialchars($comment->comment_agent)."</small>"; 1744 if(strlen($ua) > 0) { 1745 if($ua_doctype=="html") 1746 $ua.="<br>"; 1747 elseif($ua_doctype=="xhtml") 1748 $ua.="<br />"; 1749 } 1750 $ua.="<small>".htmlspecialchars($comment->comment_agent)."</small>"; 1698 1751 } 1699 1752
Note: See TracChangeset
for help on using the changeset viewer.