MattWilcox/Adaptive-Images — pull request #155 by Billy- (2014-07-02 09:34:47+00:00)
Title: Update is_mobile() function

I have changed the `is_mobile()` function so that it returns a boolean.

function is_mobile() {
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
return !!strpos($userAgent, 'mobile');
}

This renders this if/else block unnecessary:

if(!is_mobile()){
$is_mobile = "FALSE";
} else {
$is_mobile = "TRUE";
}

I have removed this and replaced it with `$is_mobile = is_mobile();`.

I have also removed the same if else block from within the `sendErrorImage()` function, but I have **not** replaced it as the variable was unused within its scope.

It's worth pointing out that the `$is_mobile` variable is only used once in the entire script. It might be a better idea to remove the function all together, and just use `$is_mobile = !!strpos(strtolower($_SERVER['HTTP_USER_AGENT']);`. I haven't made this change as there may be need for this helper function in the future.