/**
 * Check to see if this impression contains the valid browser.
 *
 * @param string $limitation The browser (or comma list of browsers) limitation
 * @param string $op The operator ('==', '!=', '=~', '!~')
 * @param array $aParams An array of additional parameters to be checked
 * @return boolean Whether this impression's browser passes this limitation's test.
 */
function MAX_checkClient_Browser($limitation, $op, $aParams = array())
{
    if (empty($aParams)) {
        $aParams = $GLOBALS['_MAX']['CLIENT'];
    }
    return MAX_limitationsMatchArray('browser', $limitation, $op, $aParams);
}
 function test_MAX_limitationsMatchArray()
 {
     $this->assertTrue(MAX_limitationsMatchArray('browser', 'IE', '==', array('browser' => 'IE')));
     $this->assertFalse(MAX_limitationsMatchArray('browser', 'IE,NS,FF', '==', array('browser' => 'IE')));
     $this->assertFalse(MAX_limitationsMatchArray('browser', '', '=~', array('browser' => 'IE')));
     $this->assertTrue(MAX_limitationsMatchArray('browser', 'IE,NS,FF', '=~', array('browser' => 'IE')));
     $this->assertTrue(MAX_limitationsMatchArray('browser', 'IE', '=~', array('browser' => 'IE')));
     $this->assertFalse(MAX_limitationsMatchArray('browser', 'IE,NS,FF', '!~', array('browser' => 'IE')));
     $this->assertTrue(MAX_limitationsMatchArray('browser', 'NS,FF', '!~', array('browser' => 'IE')));
     $this->assertTrue(MAX_limitationsMatchArray('browser', '', '!~', array('browser' => 'IE')));
     $this->assertTrue(MAX_limitationsMatchArray('browser', 'NS,FF', '!~', array()));
     $GLOBALS['_MAX']['CLIENT']['browser'] = 'FF';
     $this->assertFalse(MAX_limitationsMatchArray('browser', 'NS,FF', '!~', array()));
 }
/**
 * An utility function which checks if the value in the array matches
 * the limitation specified in the $limitation and $op arguments.
 * Uses $GLOBALS['_MAX']['CLIENT_GEO'] array if $aParams is empty.
 * For details on how matching is done see
 * {@link MAX_limitationsMatchArrayValue}.
 *
 * @param string $paramName
 * @param string $limitation
 * @param string $op
 * @param array $aParams
 * @return boolean true if the value matches the limitation, false otherwise.
 */
function MAX_limitationsMatchArrayClientGeo($paramName, $limitation, $op, $aParams = array())
{
    return MAX_limitationsMatchArray($paramName, $limitation, $op, $aParams, 'CLIENT_GEO');
}