Welcome Guest, Not a member yet? Register   Sign In
is_mobile()
#1

[eluser]kenjis[/eluser]
Mobile agent name must be lowercase, because _set_mobile() makes it lower by strtolower().

Code:
/**
     * Set the Mobile Device
     *
     * @access    private
     * @return    bool
     */        
    function _set_mobile()
    {
        if (is_array($this->mobiles) AND count($this->mobiles) > 0)
        {        
            foreach ($this->mobiles as $key => $val)
            {
                if (FALSE !== (strpos(strtolower($this->agent), $key)))
                {
                    $this->is_mobile = TRUE;
                    $this->mobile = $val;
                    return TRUE;
                }
            }
        }    
        return FALSE;
    }

But in application/config/user_agents.php,

Code:
'blackBerry'        => 'BlackBerry',

So is_mobile() returns "BlackBerry is not mobile".


Why only mobile agent name is lowercase?
#2

[eluser]Derek Allard[/eluser]
A bug. All fixed up thanks.
#3

[eluser]Jonathon Hill[/eluser]
Still present as of 1.6.1. I had to go into user_agents.php and change 'blackBerry' to 'blackberry'.
#4

[eluser]Derek Allard[/eluser]
http://dev.ellislab.com/svn/CodeIgniter/...agents.php

Are you sure Jonathon? I just downloaded another CI zip to confirm, and you can see from above that the SVN is fixed, unless I'm just missing it entirely. What line number of user_agents.php?

Oh, and welcome to CodeIgniter!
#5

[eluser]Jonathon Hill[/eluser]
Well, I stand corrected Smile

The file I checked was from a 1.5.4 - 1.6.1 upgrade. I checked the file from a fresh 1.6.1 install and it was fine.

Oh, and thanks for the welcome! I'm LOVING CI (and hate coding from scratch now). Probably what really sold me on CI was how extensive and easily read the documentation is. You guys have done great work!


I can't wait for the CI-EE integration... Hurry up Tongue
#6

[eluser]Derek Allard[/eluser]
Great stuff! Glad to hear I'm not losing my marbles (again).




Theme © iAndrew 2016 - Forum software by © MyBB