cvs: pear /Net_UserAgent Detect.php

From: Date: Mon, 18 Apr 2005 18:15:17 +0000
Subject: cvs: pear /Net_UserAgent Detect.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-31290@lists.php.net to get a copy of this message
jrust Mon Apr 18 14:15:17 2005 EDT Modified files: /pear/Net_UserAgent Detect.php Log: * Fix the getQuirk() method so it actually works (#2919) * Add documentation for what parameters to pass to the Quirk and Feature methods http://cvs.php.net/diff.php/pear/Net_UserAgent/Detect.php?r1=1.17&r2=1.18&ty=u Index: pear/Net_UserAgent/Detect.php diff -u pear/Net_UserAgent/Detect.php:1.17 pear/Net_UserAgent/Detect.php:1.18 --- pear/Net_UserAgent/Detect.php:1.17 Mon Apr 18 14:02:13 2005 +++ pear/Net_UserAgent/Detect.php Mon Apr 18 14:15:16 2005 @@ -18,7 +18,7 @@ // | Jason Rust <jrust@php.net> | // +----------------------------------------------------------------------+ -// $Id: Detect.php,v 1.17 2005/04/18 18:02:13 jrust Exp $ +// $Id: Detect.php,v 1.18 2005/04/18 18:15:16 jrust Exp $ // }}} // {{{ constants @@ -678,6 +678,9 @@ * mechanism allows the coder to determine if an excepetion must * be made with the current client. * + * @param string $in_quirk The quirk to set + * @param string $in_hasQuirk (optional) Does the browser have the quirk? + * * @access public * @return void */ @@ -698,14 +701,14 @@ * mechanism allows the coder to determine if an excepetion must * be made with the current client. * + * @param string $in_quirk The quirk to detect + * * @access public * @return bool whether or not browser has this quirk */ function hasQuirk($in_quirk) { - Net_UserAgent_Detect::detect(); - $quirks = &Net_UserAgent_Detect::_getStaticProperty('quirks'); - return !empty($quirks[strtolower($in_quirk)]); + return (bool) Net_UserAgent_Detect::getQuirk($in_quirk); } // }}} @@ -718,14 +721,16 @@ * mechanism allows the coder to determine if an excepetion must * be made with the current client. * + * @param string $in_quirk The quirk to detect + * * @access public * @return string value of the quirk, in this case usually a boolean */ - function getQuirk() + function getQuirk($in_quirk) { Net_UserAgent_Detect::detect(); $quirks = &Net_UserAgent_Detect::_getStaticProperty('quirks'); - return isset($quirks[strtolower($in_quirks)]) ? $quirks[strtolower($in_quirks)] : null; + return isset($quirks[strtolower($in_quirk)]) ? $quirks[strtolower($in_quirk)] : null; } // }}} @@ -738,6 +743,9 @@ * helps keep track of the core features of a client, such as if the client * supports dhtml, dom, javascript, etc. * + * @param string $in_feature The feature to set + * @param string $in_hasFeature (optional) Does the browser have the feature? + * * @access public * @return void */ @@ -757,14 +765,14 @@ * helps keep track of the core features of a client, such as if the client * supports dhtml, dom, javascript, etc. * + * @param string $in_feature The feature to detect + * * @access public * @return bool whether or not the current client has this feature */ function hasFeature($in_feature) { - Net_UserAgent_Detect::detect(); - $features = &Net_UserAgent_Detect::_getStaticProperty('features'); - return !empty($features[strtolower($in_feature)]); + return (bool) Net_UserAgent_Detect::getFeature($in_feature); } // }}} @@ -777,6 +785,8 @@ * helps keep track of the core features of a client, such as if the client * supports dhtml, dom, javascript, etc. * + * @param string $in_feature The feature to detect + * * @access public * @return string value of the feature requested */

« previous php.pear.cvs (#31290) next »