Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates $is_mobile() #156

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Updates $is_mobile() #156

wants to merge 2 commits into from

Conversation

Billy-
Copy link

@Billy- Billy- commented Jul 2, 2014

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 all occurrences of this and replaced it with $is_mobile = is_mobile();.

Billy added 2 commits July 2, 2014 10:32
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.
@Billy-
Copy link
Author

Billy- commented Oct 27, 2014

is this repo dead? @MattWilcox

@joeguilmette
Copy link

It's pretty inactive but there are signs of life every once in awhile.

Maybe it's time to fork it, or check out some of the other forks.

Or maybe Matt will add some maintainers to help out?

On Mon, Oct 27, 2014 at 9:09 AM, Billy Mathews [email protected]
wrote:

is this repo dead? @MattWilcox

Reply to this email directly or view it on GitHub:
#156 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants