Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Mobile Version
« Reply #15, on June 6th, 2012, 11:46 AM »
Oh yeah, forgot to suggest logging off :)

ziycon

  • Posts: 126
APRAI - Custom Theme - SMF 2.0.5


Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
The way it's meant to be

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Mobile Version
« Reply #18, on June 6th, 2012, 11:50 AM »
Yup... And/or log out ;)

ziycon

  • Posts: 126
Re: Mobile Version
« Reply #19, on June 6th, 2012, 12:46 PM »
Cleared everything I could possible clear and logged out and back in, still the same. <_<

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Mobile Version
« Reply #20, on June 6th, 2012, 01:09 PM »
It's no fun anymore. :(

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Mobile Version
« Reply #21, on June 6th, 2012, 01:20 PM »
Code: (Class-MoDe.php) [Select]
if (strpos($ua, $device) !== false)
return true;
Shouldn't that be
Code: (Replace) [Select]
if (preg_match('/' . $device . '/i', $ua))
return true;
?

Plus I don't see samsung/bada in there?
Posted: June 6th, 2012, 01:16 PM

Crap, no. Didn't read the foreach declaration.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Mobile Version
« Reply #22, on June 6th, 2012, 01:21 PM »
Quote from Dragooon on June 6th, 2012, 01:16 PM
Code: (Class-MoDe.php) [Select]
if (strpos($ua, $device) !== false)
return true;
Shouldn't that be
Code: (Replace) [Select]
if (preg_match('/' . $device . '/i', $ua))
return true;
?
No... This is an array of short strings that are lowercased, and the user agent is lowercased at this point, too. There's no point in wasting time compiling a regex for that. I'm just scanning the user agent for these strings. It could be faster to do a global regex match for the entire list of devices, but I did some tests earlier and it was actually slower... (Yes, a single preg_match was slower than dozens of strpos calls...)
Maybe it has changed since I did my first tests, but I doubt so.
Quote
Plus I don't see samsung/bada in there?
Because it's not committed yet. Currently on wedge.org there's an additional '|samsung|' in the 'generic' list. It should return 0 for ziycon (start of the string), which is !== false (but not != false of course), and thus should return true overall...

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Mobile Version
« Reply #23, on June 6th, 2012, 01:22 PM »
It is case sensitive. samsung won't match anything as it's SAMSUNG (strpos is case sensitive, stripos isn't).

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Mobile Version
« Reply #24, on June 6th, 2012, 02:18 PM »
Look at the strtolower............. :whistle:

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Mobile Version
« Reply #25, on June 6th, 2012, 02:26 PM »
What the f....I got no idea why that won't work.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Mobile Version
« Reply #26, on June 6th, 2012, 02:38 PM »
Hence my original reply...

Perhaps it always worked for him, but he chose to go Weaving at some point during his mobile tests, and I can't do anything for him...
But if he's logged out (a guest), and has cookies disabled, then it SHOULD work...

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Mobile Version
« Reply #27, on June 6th, 2012, 02:44 PM »
Did a test run using that UA, code is evaluating it fine (after adding |samsung|). So must be something else.

Nao

  • Dadman with a boy
  • Posts: 16,082

ziycon

  • Posts: 126
Re: Mobile Version
« Reply #29, on June 6th, 2012, 04:55 PM »
The only other thing I can think of is that the mobile site is being applied but it doesn't like working with my device, can you post a screen of what the mobile site should look like?!