Plugin Directory

Changeset 365240


Ignore:
Timestamp:
03/26/2011 10:56:48 PM (15 years ago)
Author:
kyleabaker
Message:

v0.10.6

  • Added detection for BlackHawk, Gtk+ WebCore, Tencent Traveler and Vimprobable.
  • Added a quick fix for Arch Linux improperly being detected when IE users have SearchToolbar installed (since it improperly matched seARCHtoolbar).
  • Added new feature to hide "Unknown" output. This is disabled by default (props: Cahya)
Location:
wp-useragent/trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • wp-useragent/trunk/readme.txt

    r359601 r365240  
    44Tags: useragent, user-agent, user agent, web, browser, web browser, operating system, platform, os, mac, apple, windows, win, linux, phone
    55Requires at least: 2.0
    6 Tested up to: 3.1
    7 Stable tag: 0.10.5
     6Tested up to: 3.2
     7Stable tag: 0.10.6
    88
    99== Description ==
     
    6666
    6767== 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
    6874
    6975= v0.10.5 =
     
    495501== Upgrade Notice ==
    496502
    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  
    1717            $ua_text_links=get_option('ua_text_links');
    1818            $ua_show_au_bool=get_option('ua_show_ua_bool');
     19            $ua_hide_unknown_bool=get_option('ua_hide_unknown_bool');
    1920            $ua_output_location=get_option('ua_output_location');
    2021        ?>
     
    165166                                        <select id="ua_show_ua_bool" name="ua_show_ua_bool" onchange="preview();">
    166167                                            <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>
    168178                                        </select>
    169179                                    </div></td>
     
    276286
    277287        <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" />
    279289        <p class="submit">
    280290            <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
  • wp-useragent/trunk/wp-useragent.php

    r359601 r365240  
    44Plugin URI: http://kyleabaker.com/goodies/coding/wp-useragent/
    55Description: 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.5
     6Version: 0.10.6
    77Author: Kyle Baker
    88Author URI: http://kyleabaker.com/
     
    5353$ua_text_links=get_option('ua_text_links');
    5454$ua_show_ua_bool=get_option('ua_show_ua_bool');
     55$ua_hide_unknown_bool=get_option('ua_hide_unknown_bool');
    5556$ua_output_location=get_option('ua_output_location');
    5657
     
    101102    elseif(strtolower($title)=="opera mobi")
    102103        return "Opera Mobile ".$version;
     104    elseif(strtolower($title)=="osb-browser")
     105        return "Gtk+ WebCore ".$version;
    103106    elseif(strtolower($title)=="tablet browser")
    104107        return "MicroB ".$version;
     
    111114//Detect webbrowsers
    112115function detect_webbrowser(){
    113     global $useragent, $ua_show_text, $ua_text_links;
     116    global $useragent, $ua_show_text, $ua_text_links, $ua_hide_unknown_bool;
    114117    $mobile=0;
    115118    if(preg_match('/360se/i', $useragent)){
     
    169172        $title=detect_browser_version("Blackbird");
    170173        $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";
    171178    }elseif(preg_match('/Blazer/i', $useragent)){
    172179        $link="http://en.wikipedia.org/wiki/Blazer_(web_browser)";
     
    639646        $title="Oregano Web Browser";
    640647        $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";
    641652    }elseif(preg_match('/\ Pre\//i', $useragent)){
    642653        $link="http://www.palm.com/us/products/phones/pre/index.html";
     
    779790        $title=detect_browser_version(" Teleca");
    780791        $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";
    781796    }elseif(preg_match('/TheWorld/i', $useragent)){
    782797        $link="http://www.ioage.com/";
     
    831846        $title="uzbl";
    832847        $code="uzbl";
     848    }elseif(preg_match('/Vimprobable/i', $useragent)){
     849        $link="http://www.vimprobable.org/";
     850        $title=detect_browser_version("Vimprobable");
     851        $code="null";
    833852    }elseif(preg_match('/Vonkeror/i', $useragent)){
    834853        $link="http://zzo38computer.cjb.net/vonkeror/";
     
    918937        $title="Unknown";
    919938        $code="null";
     939        if($ua_hide_unknown_bool=='true' && $ua_show_text==2)
     940            return $title;
    920941    }
    921942    if($ua_show_text=="1" && $ua_text_links!="0")       //image and linked text
     
    11811202        $title="Android";
    11821203        $code="android";
    1183     }elseif(preg_match('/Arch/i', $useragent)){
     1204    }elseif(preg_match('/[^A-Za-z]Arch/i', $useragent)) { //&& !preg_match('/Search/i', $useragent)){
    11841205        $link="http://www.archlinux.org/";
    11851206        $title="Arch Linux";
     
    13671388    }elseif(preg_match('/Suse/i', $useragent)){
    13681389        $link="http://www.opensuse.org/";
    1369         $title="SuSE";
     1390        $title="openSUSE";
    13701391        $code="suse";
    13711392    }elseif(preg_match('/Symb[ian]?[OS]?/i', $useragent)){
     
    15141535//Detect Platform (check for Device, then OS if no device is found, else return null)
    15151536function detect_platform(){
    1516     global $useragent, $ua_show_text, $ua_text_links;
     1537    global $useragent, $ua_show_text, $ua_text_links, $ua_hide_unknown_bool;
    15171538    if(strlen($detected_platform=detect_device()) > 0){
    15181539        return $detected_platform;
     
    15231544        $link="#";
    15241545        $code="null";
     1546        if($ua_hide_unknown_bool=='true' && $ua_show_text==2)
     1547            return $title;
    15251548    }
    15261549    if($ua_show_text=="1" && $ua_text_links!="0")       //image and linked text
     
    15391562//Detect Trackbacks -- Check if it works...
    15401563function 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;
    15421565    $ua_trackback=0;
    15431566    if(preg_match('/Drupal/i', $useragent)){
     
    16111634        $title="Unknown";
    16121635        $code="null";
     1636        if($ua_hide_unknown_bool=='true' && $ua_show_text==2)
     1637            return $title;
    16131638    }
    16141639    $title.=" ".$version;
     
    16771702//Function to form the final String
    16781703function 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;
    16801705    //Check if the comment is a trackback.
    16811706    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        }
    16861719    }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        }
    16911741    }
    16921742
    16931743    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>";
    16981751    }
    16991752
Note: See TracChangeset for help on using the changeset viewer.