Skip to content

Commit

Permalink
Updates to disable iMT UI by default for iPad. Also added useragent d…
Browse files Browse the repository at this point in the history
…etection for Palm Pre.
  • Loading branch information
bradchoate committed Apr 26, 2010
1 parent 6746470 commit ffa7409
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
10 changes: 9 additions & 1 deletion CHANGES.txt
@@ -1,19 +1,27 @@
# Version 1.11 - April 26, 2010

* Recognize user agent for Palm Pre
* Disable iMT behavior for iPad (can be reversed using a config setting "iMTForiPad 1")


# Version 1.1 - March 3, 2010

* Updated for MT 5.
* Support for Nexus One.
* A fix for running in persistent environments.
* Styling fix for menus affecting iPhone OS 3.0 and later.


# Version 1.02 - June 4, 2008

* Fix for MT 4.2


# Version 1.01 - September 10, 2008

* Support for Opera Mini.


# Version 1.0 - September 10, 2008

* Initial release.

18 changes: 16 additions & 2 deletions README.txt
@@ -1,5 +1,5 @@
iMT, a Plugin for Movable Type
Version 1.1
Version 1.11

This plugin will provide a more natural user interface for Apple's iPhone
and iPod touch products.
Expand All @@ -11,7 +11,21 @@ Once installed, you can access your Movable Type installation from your
iPhone or iPod touch and it should display the new user interface
automatically. No other configuration is required.

This plugin recognizes several mobile devices/browsers, including:

* iPhone (all models)
* iPod touch (all models)
* Opera Mini
* Palm Pre
* Android phones
* Google Nexus One

The plugin does not enable a mobile interface for Apple iPad. If however,
you want to use the iMT interface for iPad, you will need to add this
configuration setting to mt-config.cgi:

iMTForiPad 1

This plugin has been released under the terms of the GNU Public License,
version 2.0.


19 changes: 13 additions & 6 deletions plugins/iMT/iMT.pl
Expand Up @@ -12,7 +12,7 @@ package MT::Plugin::iMT;
my $enabled = 0;
my $orig_alt_tmpl_path;

our $VERSION = '1.1';
our $VERSION = '1.11';
my $plugin = __PACKAGE__->new({
name => "iPhone / iPod touch UI Support",
author_name => "<a href='http://www.iwalt.com/'>Walt Dickinson</a>, <a href='http://bradchoate.com/'>Brad Choate</a>",
Expand Down Expand Up @@ -80,13 +80,20 @@ sub init_request {
if ($app->isa('MT::App::CMS')) {
# A bit of User Agent sniffing to determine if MT should
# be using our AppleWebKit mobile interface.
# Using keyword detection provided by Apple:
# Using keyword detection guidance provided by Apple:
# http://trac.webkit.org/projects/webkit/wiki/DetectingWebKit
# Adjusted 'Mobile/' to 'Mobile[ /]' to match for Nexus One which
# supplies no device identifier following the 'Mobile' keyword
if (my $ua = $ENV{HTTP_USER_AGENT}) {
if ((($ua =~ m!AppleWebKit/!) && ($ua =~ m!Mobile[ /]!)) ||
($ua =~ m!Opera Mini/!)) {
# supplies no device identifier following the 'Mobile' keyword
# Disabled iMT by default for iPad; can be overridden using
# 'iMTForiPad' config setting.
if (my $agent = $ENV{HTTP_USER_AGENT}) {
my $is_iphone = ($agent =~ /AppleWebKit/ && ( $agent =~ m!Mobile[ /]! || $agent =~ /Pre/ )) || ($agent =~ m!Opera Mini/!);
if ($is_iphone && (! $app->config('iMTForiPad'))) {
if ($agent =~ /iPad/) {
$is_iphone = 0;
}
}
if ($is_iphone) {
$enabled = 1;

# Redirect 'dashboard' or 'default' modes to iphone_main
Expand Down

0 comments on commit ffa7409

Please sign in to comment.