Any Mobile Theme Switcher - Version 1.4

Version Description

  • Use of Force Layout GET Parameter from wp-config.php
Download this release

Release Info

Developer dnesscarkey
Plugin Icon 128x128 Any Mobile Theme Switcher
Version 1.4
Comparing to
See all releases

Code changes from version 1.3 to 1.4

any-mobile-theme-switcher.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Any Mobile Theme Switcher
4
  Plugin URI: http://dineshkarki.com.np/any-mobile-theme-switcher
5
  Description: This plugin allow you to detect all mobile platform and switch the theme. Supports most of the mobile platform including iphone, ipad, ipod, windows mobile, parm os, blackberry, android, andriod tab.
6
  Author: Dinesh Karki
7
- Version: 1.3
8
  Author URI: http://www.dineshkarki.com.np
9
  */
10
 
@@ -13,12 +13,15 @@ Author URI: http://www.dineshkarki.com.np
13
  $amts_mobile_browser = '';
14
  $amts_status = '';
15
  $amts_shown_theme = '';
 
 
16
 
17
  add_action('plugins_loaded', 'amts_start', 1);
18
  function amts_start(){
19
  global $amts_mobile_browser;
20
  global $amts_status;
21
  global $amts_shown_theme;
 
22
 
23
  $time = '0';
24
  $url_path = '/';
@@ -34,13 +37,13 @@ function amts_start(){
34
  $forceLayout = $_COOKIE['am_force_theme_layout'];
35
  }
36
 
37
- if (isset($_GET['am_force_theme_layout'])){
38
- if ($_GET['am_force_theme_layout'] == 'mobile'){
39
  $forceLayout = 'mobile';
40
- setcookie('am_force_theme_layout', $_GET['am_force_theme_layout'], $time, $url_path);
41
  } else {
42
  $forceLayout = 'desktop';
43
- setcookie('am_force_theme_layout', $_GET['am_force_theme_layout'], $time, $url_path);
44
  }
45
  }
46
 
@@ -87,12 +90,13 @@ function loadMobileTheme(){
87
  function show_theme_switch_link_func( $atts ){
88
  global $amts_shown_theme;
89
  global $amts_status;
 
90
  $desktopSwitchLink = get_option('show_switch_link_for_desktop');
91
  if ($amts_shown_theme){
92
- $return = '<a rel="external" data-ajax="false" href="'.get_bloginfo('url').'?am_force_theme_layout=desktop" class="am-switch-btn godesktop">'.get_option('desktop_view_theme_link_text').'</a>';
93
  } else {
94
  if ((!empty($amts_status)) || ($desktopSwitchLink == 'yes')){
95
- $return = '<a href="'.get_bloginfo('url').'?am_force_theme_layout=mobile" class="am-switch-btn gomobile">'.get_option('mobile_view_theme_link_text').'</a>';
96
  }
97
  }
98
  return $return;
4
  Plugin URI: http://dineshkarki.com.np/any-mobile-theme-switcher
5
  Description: This plugin allow you to detect all mobile platform and switch the theme. Supports most of the mobile platform including iphone, ipad, ipod, windows mobile, parm os, blackberry, android, andriod tab.
6
  Author: Dinesh Karki
7
+ Version: 1.4
8
  Author URI: http://www.dineshkarki.com.np
9
  */
10
 
13
  $amts_mobile_browser = '';
14
  $amts_status = '';
15
  $amts_shown_theme = '';
16
+ $amts_force_param = defined('AMTS_FORCE_FLAG')?AMTS_FORCE_FLAG:'am_force_theme_layout';
17
+
18
 
19
  add_action('plugins_loaded', 'amts_start', 1);
20
  function amts_start(){
21
  global $amts_mobile_browser;
22
  global $amts_status;
23
  global $amts_shown_theme;
24
+ global $amts_force_param;
25
 
26
  $time = '0';
27
  $url_path = '/';
37
  $forceLayout = $_COOKIE['am_force_theme_layout'];
38
  }
39
 
40
+ if (isset($_GET[$amts_force_param])){
41
+ if ($_GET[$amts_force_param] == 'mobile'){
42
  $forceLayout = 'mobile';
43
+ setcookie('am_force_theme_layout', $_GET[$amts_force_param], $time, $url_path);
44
  } else {
45
  $forceLayout = 'desktop';
46
+ setcookie('am_force_theme_layout', $_GET[$amts_force_param], $time, $url_path);
47
  }
48
  }
49
 
90
  function show_theme_switch_link_func( $atts ){
91
  global $amts_shown_theme;
92
  global $amts_status;
93
+ global $amts_force_param;
94
  $desktopSwitchLink = get_option('show_switch_link_for_desktop');
95
  if ($amts_shown_theme){
96
+ $return = '<a rel="external" data-ajax="false" href="'.get_bloginfo('url').'?'.$amts_force_param.'=desktop" class="am-switch-btn godesktop">'.get_option('desktop_view_theme_link_text').'</a>';
97
  } else {
98
  if ((!empty($amts_status)) || ($desktopSwitchLink == 'yes')){
99
+ $return = '<a href="'.get_bloginfo('url').'?'.$amts_force_param.'=mobile" class="am-switch-btn gomobile">'.get_option('mobile_view_theme_link_text').'</a>';
100
  }
101
  }
102
  return $return;
includes/amts-footer.php CHANGED
@@ -23,8 +23,25 @@
23
  </thead>
24
  <tbody>
25
  <tr>
26
- <td>
27
- <a href="http://goo.gl/j1a2w" title="Any Mobile Theme Switcher Pro" target="_blank"><img src="<?php echo plugins_url('any-mobile-theme-switcher/img/amtsp.png') ?>" alt="Any Mobile Theme Switcher Pro" /></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  </td>
29
  </tr>
30
  </tbody>
23
  </thead>
24
  <tbody>
25
  <tr>
26
+ <td style="color:#0F0;">
27
+ <a href="http://goo.gl/j1a2w" title="Any Mobile Theme Switcher Pro" target="_blank">
28
+ <div style="color:#08aa00; font-style:italic; font-size:27px; line-height:30px; text-align:center;">Any Mobile Theme Switcher Pro</div>
29
+
30
+ <style>
31
+ ul.proFeature{ list-style:square; padding-left:20px;}
32
+ ul.proFeature li{color:#910000; font-size:14px; line-height:14px;}
33
+ </style>
34
+ <ul class="proFeature">
35
+ <li>Works With W3 Total Cache</li>
36
+ <li>Different Home Page based on mobile devices</li>
37
+ <li>QR code images to allow mobile users for easy bookmarking and access</li>
38
+ <li>More powerfull mobile detection.</li>
39
+ </ul>
40
+
41
+ <div style="color:#08aa00; font-style:italic; font-size:27px; line-height:30px; text-align:center;">7 days trial</div>
42
+ <div style="color:#910000; font-style:italic; font-size:20px; line-height:30px; text-align:center;">Click here for details</div>
43
+
44
+ </a>
45
  </td>
46
  </tr>
47
  </tbody>
includes/amts-readme.php CHANGED
@@ -8,14 +8,15 @@
8
  <tbody>
9
  <tr>
10
  <td>
 
11
  <p>
12
  Use the following shortcode <strong>[show_theme_switch_link]</strong> in templates to show the theme switch link.
13
  <br/>Example: <strong>&lt;?php echo do_shortcode('[show_theme_switch_link]'); ?&gt;</strong>
14
  <br/><br/>
15
  You can also add Switch Mobile Theme link to your Menus from Custom Links section under Appearance > Menus.<br />
16
  Example:<br />
17
- Url : <strong><?php bloginfo('url'); ?>/?am_force_theme_layout=desktop</strong> (For Mobile Theme)<br/>
18
- Url : <strong><?php bloginfo('url'); ?>/?am_force_theme_layout=mobile</strong> (For Desktop Theme)<br/>
19
  Label : As you wish :)
20
  </p>
21
  </td></tr></tbody></table>
8
  <tbody>
9
  <tr>
10
  <td>
11
+ <h3>Theme Switch Shortcode</h3>
12
  <p>
13
  Use the following shortcode <strong>[show_theme_switch_link]</strong> in templates to show the theme switch link.
14
  <br/>Example: <strong>&lt;?php echo do_shortcode('[show_theme_switch_link]'); ?&gt;</strong>
15
  <br/><br/>
16
  You can also add Switch Mobile Theme link to your Menus from Custom Links section under Appearance > Menus.<br />
17
  Example:<br />
18
+ Url : <strong><?php bloginfo('url'); ?>/?<?php echo $amts_force_param; ?>=desktop</strong> (For Mobile Theme)<br/>
19
+ Url : <strong><?php bloginfo('url'); ?>/?<?php echo $amts_force_param; ?>=mobile</strong> (For Desktop Theme)<br/>
20
  Label : As you wish :)
21
  </p>
22
  </td></tr></tbody></table>
plugin_interface.php CHANGED
@@ -10,7 +10,7 @@ if ($_GET['hidemsg'] == 1){
10
  function amts_pro_notification(){
11
  if (get_option('amts_hide_pro_notice') != 'yes'){
12
  echo '<div class="updated">
13
- <p><b>Any Mobile Theme Swticher Pro</b> now works with <b>W3 Total Cache</b>. Click <a href="http://dnesscarkey.com/any-mobile-theme-switcher-pro/" target="_blank">here</a> for details.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="options-general.php?pageany-mobile-theme-switcher-pro/plugin_interface.php&hidemsg=1">Hide This Message</a></p>
14
  </div>';
15
  }
16
  }
@@ -36,6 +36,7 @@ function register_mysettings_theme() {
36
  }
37
 
38
  function am_settings_page() {
 
39
  include('includes/amts-header.php');
40
  include('includes/amts-theme-select.php');
41
  include('includes/amts-force-switch.php');
10
  function amts_pro_notification(){
11
  if (get_option('amts_hide_pro_notice') != 'yes'){
12
  echo '<div class="updated">
13
+ <p><b>Any Mobile Theme Swticher Pro</b> now works with <b>W3 Total Cache</b>, have support for <b>QR code</b> and can serve different <b>Home Page</b> based on mobile devices.<br/>Click <a href="http://dnesscarkey.com/any-mobile-theme-switcher-pro/" target="_blank">here</a> for details.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="options-general.php?pageany-mobile-theme-switcher-pro/plugin_interface.php&hidemsg=1">Hide This Message</a></p>
14
  </div>';
15
  }
16
  }
36
  }
37
 
38
  function am_settings_page() {
39
+ global $amts_force_param;
40
  include('includes/amts-header.php');
41
  include('includes/amts-theme-select.php');
42
  include('includes/amts-force-switch.php');
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Any Mobile Theme Switcher ===
2
  Contributors: dnesscarkey
3
- Tags: mobile theme, mobile theme switcher, mobile browser detect, mobile detect, theme redirection based on mobile device
4
  Requires at least: 3.0.
5
- Tested up to: 3.5.1
6
- Stable tag: 1.3
7
 
8
  This Plugin detects mobile browser and display the theme as the setting done from admin. Usefull for switch to Mobile Theme.
9
 
@@ -23,7 +23,14 @@ Detects all the Mobile Browsers and loads the mobile theme as per your settings
23
 
24
  You can select a different mobile theme for each mobile browser. You can select different mobile themes for each of the options above.
25
 
26
- Any Mobile Theme Switcher Pro now works with W3 Total Cache. Click <a href="http://goo.gl/j1a2w" title="Any Mobile Theme Switcher Pro" target="_blank">here</a> for details.
 
 
 
 
 
 
 
27
 
28
  Want Mobile Theme ? Get it from <a href="http://goo.gl/eWXZp">here</a>.
29
 
@@ -52,6 +59,9 @@ Yes, the pro version works with W3 Total Cache. Click <a href="http://goo.gl/j1a
52
 
53
  == Changelog ==
54
 
 
 
 
55
  = 1.3 =
56
  * Use of Cookie inplace of session.
57
 
1
  === Any Mobile Theme Switcher ===
2
  Contributors: dnesscarkey
3
+ Tags: mobile theme, mobile theme switcher, mobile browser detect, mobile detect, theme redirection based on mobile device, mobile detect, user agent detect, mobile user agent
4
  Requires at least: 3.0.
5
+ Tested up to: 3.6.1
6
+ Stable tag: 1.4
7
 
8
  This Plugin detects mobile browser and display the theme as the setting done from admin. Usefull for switch to Mobile Theme.
9
 
23
 
24
  You can select a different mobile theme for each mobile browser. You can select different mobile themes for each of the options above.
25
 
26
+ Any Mobile Theme Switcher Pro Features
27
+
28
+ * Works With W3 Total Cache
29
+ * Serve seprate home page for mobile devices.
30
+ * QR code for mobile bookmarking.
31
+ * Better Mobile Detection.
32
+
33
+ Click <a href="http://goo.gl/j1a2w" title="Any Mobile Theme Switcher Pro" target="_blank">here</a> for details about Any Mobile Theme Swticher
34
 
35
  Want Mobile Theme ? Get it from <a href="http://goo.gl/eWXZp">here</a>.
36
 
59
 
60
  == Changelog ==
61
 
62
+ = 1.4 =
63
+ * Use of Force Layout GET Parameter from wp-config.php
64
+
65
  = 1.3 =
66
  * Use of Cookie inplace of session.
67