Version Description
Download this release
Release Info
Developer | thingsym |
Plugin | Multi Device Switcher |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.2.0
- languages/multi-device-switcher-ja.mo +0 -0
- languages/multi-device-switcher-ja.po +27 -2
- languages/multi-device-switcher.pot +25 -0
- multi-device-switcher.php +147 -34
- pc-switcher-widget.php +105 -0
- pc-switcher.css +49 -0
- readme.md +69 -2
- readme.txt +68 -2
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
languages/multi-device-switcher-ja.mo
CHANGED
Binary file
|
languages/multi-device-switcher-ja.po
CHANGED
@@ -3,8 +3,8 @@ msgstr ""
|
|
3 |
"Project-Id-Version: Multi Device Switcher\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: 2012-01-17 22:01+0900\n"
|
6 |
-
"PO-Revision-Date:
|
7 |
-
"Last-Translator:
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
@@ -13,6 +13,9 @@ msgstr ""
|
|
13 |
msgid "Multi Device Switcher"
|
14 |
msgstr "マルチデバイス"
|
15 |
|
|
|
|
|
|
|
16 |
msgid "Theme"
|
17 |
msgstr "テーマ"
|
18 |
|
@@ -64,6 +67,24 @@ msgstr "追加"
|
|
64 |
msgid "Delete"
|
65 |
msgstr "削除"
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
msgid "Are you sure you want to delete %1$s ?"
|
68 |
msgstr "%1$s を削除してよろしいですか?"
|
69 |
|
@@ -73,3 +94,7 @@ msgstr "ドネーションウェア (寄付)"
|
|
73 |
msgid "If you like this plugin, please donate to support development and maintenance."
|
74 |
msgstr "よろしければ、開発とメンテナンスのために寄付していただければうれしいです。"
|
75 |
|
|
|
|
|
|
|
|
3 |
"Project-Id-Version: Multi Device Switcher\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: 2012-01-17 22:01+0900\n"
|
6 |
+
"PO-Revision-Date: 2013-03-21 19:37+0900\n"
|
7 |
+
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
13 |
msgid "Multi Device Switcher"
|
14 |
msgstr "マルチデバイス"
|
15 |
|
16 |
+
msgid "Settings"
|
17 |
+
msgstr "設定"
|
18 |
+
|
19 |
msgid "Theme"
|
20 |
msgstr "テーマ"
|
21 |
|
67 |
msgid "Delete"
|
68 |
msgstr "削除"
|
69 |
|
70 |
+
msgid "Add PC Switcher"
|
71 |
+
msgstr "PC Switcher を追加"
|
72 |
+
|
73 |
+
msgid "Add a PC Switcher to the footer."
|
74 |
+
msgstr "PC Switcher をフッターに追加する"
|
75 |
+
|
76 |
+
msgid "Add default CSS"
|
77 |
+
msgstr "デフォルトCSSを追加"
|
78 |
+
|
79 |
+
msgid "Add a default CSS."
|
80 |
+
msgstr "デフォルトCSSを追加する"
|
81 |
+
|
82 |
+
msgid "Mobile"
|
83 |
+
msgstr "モバイル"
|
84 |
+
|
85 |
+
msgid "PC"
|
86 |
+
msgstr "PC"
|
87 |
+
|
88 |
msgid "Are you sure you want to delete %1$s ?"
|
89 |
msgstr "%1$s を削除してよろしいですか?"
|
90 |
|
94 |
msgid "If you like this plugin, please donate to support development and maintenance."
|
95 |
msgstr "よろしければ、開発とメンテナンスのために寄付していただければうれしいです。"
|
96 |
|
97 |
+
# pc-switcher-widget.php
|
98 |
+
msgid "Add the PC Switcher to a widget."
|
99 |
+
msgstr "PC Switcher をウィジェットに追加"
|
100 |
+
|
languages/multi-device-switcher.pot
CHANGED
@@ -13,6 +13,9 @@ msgstr ""
|
|
13 |
msgid "Multi Device Switcher"
|
14 |
msgstr ""
|
15 |
|
|
|
|
|
|
|
16 |
msgid "Theme"
|
17 |
msgstr ""
|
18 |
|
@@ -64,6 +67,24 @@ msgstr ""
|
|
64 |
msgid "Delete"
|
65 |
msgstr ""
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
msgid "Are you sure you want to delete %1$s ?"
|
68 |
msgstr ""
|
69 |
|
@@ -72,3 +93,7 @@ msgstr ""
|
|
72 |
|
73 |
msgid "If you like this plugin, please donate to support development and maintenance."
|
74 |
msgstr ""
|
|
|
|
|
|
|
|
13 |
msgid "Multi Device Switcher"
|
14 |
msgstr ""
|
15 |
|
16 |
+
msgid "Settings"
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
msgid "Theme"
|
20 |
msgstr ""
|
21 |
|
67 |
msgid "Delete"
|
68 |
msgstr ""
|
69 |
|
70 |
+
msgid "Add PC Switcher"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
msgid "Add a PC Switcher to the footer."
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
msgid "Add default CSS"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
msgid "Add a default CSS."
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
msgid "Mobile"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
msgid "PC"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
msgid "Are you sure you want to delete %1$s ?"
|
89 |
msgstr ""
|
90 |
|
93 |
|
94 |
msgid "If you like this plugin, please donate to support development and maintenance."
|
95 |
msgstr ""
|
96 |
+
|
97 |
+
# pc-switcher-widget.php
|
98 |
+
msgid "Add the PC Switcher to a widget."
|
99 |
+
msgstr ""
|
multi-device-switcher.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Multi Device Switcher
|
4 |
Plugin URI: https://github.com/thingsym/multi-device-switcher
|
5 |
Description: This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom).
|
6 |
-
Version: 1.
|
7 |
Author: thingsym
|
8 |
Author URI: http://www.thingslabo.com/
|
9 |
License: GPL2
|
@@ -30,6 +30,7 @@ License: GPL2
|
|
30 |
class Multi_Device_Switcher {
|
31 |
|
32 |
public function __construct() {
|
|
|
33 |
|
34 |
$userAgent = $this->get_options_userAgent();
|
35 |
$this->device = '';
|
@@ -37,13 +38,13 @@ class Multi_Device_Switcher {
|
|
37 |
foreach ( array_reverse($userAgent) as $key => $val ) {
|
38 |
if ( ! preg_match( "/^custom_switcher_/", $key ) )
|
39 |
continue;
|
40 |
-
if ($userAgent[$key] && preg_match( '/' . implode( '|', $userAgent[$key] ) . '/i', $_SERVER['HTTP_USER_AGENT']) ) {
|
41 |
$this->device = $key;
|
42 |
break;
|
43 |
}
|
44 |
}
|
45 |
|
46 |
-
if (! $this->device) {
|
47 |
if ( $userAgent['game'] && preg_match( '/' . implode( '|', $userAgent['game'] ) . '/i', $_SERVER['HTTP_USER_AGENT']) ) {
|
48 |
$this->device = 'game';
|
49 |
}
|
@@ -59,8 +60,15 @@ class Multi_Device_Switcher {
|
|
59 |
}
|
60 |
|
61 |
if ($this->device) {
|
|
|
62 |
add_filter('stylesheet', array(&$this, 'get_stylesheet'));
|
63 |
add_filter('template', array(&$this, 'get_template'));
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
}
|
66 |
|
@@ -107,7 +115,7 @@ class Multi_Device_Switcher {
|
|
107 |
|
108 |
$themes = wp_get_themes();
|
109 |
foreach ( $themes as $t ) {
|
110 |
-
if ($name == $t->get('Name')) {
|
111 |
$theme = $t;
|
112 |
break;
|
113 |
}
|
@@ -130,7 +138,7 @@ class Multi_Device_Switcher {
|
|
130 |
|
131 |
$themes = wp_get_themes();
|
132 |
foreach ( $themes as $t ) {
|
133 |
-
if ($name == $t->get('Name')) {
|
134 |
$theme = $t;
|
135 |
break;
|
136 |
}
|
@@ -167,7 +175,7 @@ class Multi_Device_Switcher {
|
|
167 |
|
168 |
$custom_switcher_name = preg_replace("/^custom_switcher_theme_/", '', $key);
|
169 |
|
170 |
-
if ($this->device == 'custom_switcher_' . $custom_switcher_name) {
|
171 |
return $options[$key];
|
172 |
}
|
173 |
}
|
@@ -175,6 +183,45 @@ class Multi_Device_Switcher {
|
|
175 |
|
176 |
return;
|
177 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
|
180 |
if ( ! is_admin() )
|
@@ -194,6 +241,17 @@ function multi_device_switcher_add_header_vary( $headers ) {
|
|
194 |
}
|
195 |
add_filter( 'wp_headers', 'multi_device_switcher_add_header_vary' );
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
/**
|
198 |
* Properly enqueue scripts for our multi_device_switcher options page.
|
199 |
*
|
@@ -203,7 +261,7 @@ add_filter( 'wp_headers', 'multi_device_switcher_add_header_vary' );
|
|
203 |
*
|
204 |
*/
|
205 |
function multi_device_switcher_admin_enqueue_scripts( $hook_suffix ) {
|
206 |
-
wp_enqueue_script('jquery-ui-tabs');
|
207 |
wp_enqueue_script( 'multi-device-switcher-options', WP_PLUGIN_URL . '/multi-device-switcher/multi-device-switcher.js', array( 'jquery' ), '2011-08-22' );
|
208 |
}
|
209 |
|
@@ -273,6 +331,8 @@ add_filter( 'option_page_capability_multi_device_switcher', 'multi_device_switch
|
|
273 |
function multi_device_switcher_add_page() {
|
274 |
load_plugin_textdomain('multi-device-switcher', false, 'multi-device-switcher/languages');
|
275 |
|
|
|
|
|
276 |
$theme_page = add_theme_page(
|
277 |
__( 'Multi Device Switcher', 'multi-device-switcher' ), // Name of page
|
278 |
__( 'Multi Device Switcher', 'multi-device-switcher' ), // Label in menu
|
@@ -294,6 +354,22 @@ function multi_device_switcher_add_page() {
|
|
294 |
}
|
295 |
add_action( 'admin_menu', 'multi_device_switcher_add_page' );
|
296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
/**
|
298 |
* Returns the default options.
|
299 |
*
|
@@ -301,6 +377,8 @@ add_action( 'admin_menu', 'multi_device_switcher_add_page' );
|
|
301 |
*/
|
302 |
function multi_device_switcher_get_default_options() {
|
303 |
$default_theme_options = array(
|
|
|
|
|
304 |
'theme_smartphone' => 'None',
|
305 |
'theme_tablet' => 'None',
|
306 |
'theme_mobile' => 'None',
|
@@ -323,6 +401,11 @@ function multi_device_switcher_get_options() {
|
|
323 |
$options = get_option( 'multi_device_switcher_options' );
|
324 |
$default_options = multi_device_switcher_get_default_options();
|
325 |
|
|
|
|
|
|
|
|
|
|
|
326 |
if ( ! isset( $options['theme_smartphone'] ) )
|
327 |
$options['theme_smartphone'] = $default_options['theme_smartphone'];
|
328 |
if ( ! isset( $options['theme_tablet'] ) )
|
@@ -365,7 +448,7 @@ function multi_device_switcher_render_page() {
|
|
365 |
$themes = wp_get_themes();
|
366 |
$theme_names = array();
|
367 |
|
368 |
-
if (count($themes)) {
|
369 |
foreach ( $themes as $t ) {
|
370 |
$theme_names[] = $t->get('Name');
|
371 |
}
|
@@ -381,20 +464,20 @@ function multi_device_switcher_render_page() {
|
|
381 |
<td>
|
382 |
|
383 |
<?php
|
384 |
-
if (count($theme_names)) {
|
385 |
$html = '<select name="multi_device_switcher_options[theme_smartphone]">';
|
386 |
|
387 |
-
if (($options['theme_smartphone'] == 'None') || ($options['theme_smartphone'] == '')) {
|
388 |
$html .= '<option value="None" selected="selected">None</option>';
|
389 |
}
|
390 |
else {
|
391 |
$html .= '<option value="None">None</option>';
|
392 |
}
|
393 |
|
394 |
-
foreach ($theme_names as $theme_name) {
|
395 |
-
if ($default_theme == $theme_name)
|
396 |
continue;
|
397 |
-
if ($options['theme_smartphone'] == $theme_name) {
|
398 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
399 |
}
|
400 |
else {
|
@@ -411,20 +494,20 @@ function multi_device_switcher_render_page() {
|
|
411 |
<td>
|
412 |
|
413 |
<?php
|
414 |
-
if (count($theme_names)) {
|
415 |
$html = '<select name="multi_device_switcher_options[theme_tablet]">';
|
416 |
|
417 |
-
if (($options['theme_tablet'] == 'None') || ($options['theme_tablet'] == '')) {
|
418 |
$html .= '<option value="None" selected="selected">None</option>';
|
419 |
}
|
420 |
else {
|
421 |
$html .= '<option value="None">None</option>';
|
422 |
}
|
423 |
|
424 |
-
foreach ($theme_names as $theme_name) {
|
425 |
-
if ($default_theme == $theme_name)
|
426 |
continue;
|
427 |
-
if ($options['theme_tablet'] == $theme_name) {
|
428 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
429 |
}
|
430 |
else {
|
@@ -441,20 +524,20 @@ function multi_device_switcher_render_page() {
|
|
441 |
<td>
|
442 |
|
443 |
<?php
|
444 |
-
if (count($theme_names)) {
|
445 |
$html = '<select name="multi_device_switcher_options[theme_mobile]">';
|
446 |
|
447 |
-
if (($options['theme_mobile'] == 'None') || ($options['theme_mobile'] == '')) {
|
448 |
$html .= '<option value="None" selected="selected">None</option>';
|
449 |
}
|
450 |
else {
|
451 |
$html .= '<option value="None">None</option>';
|
452 |
}
|
453 |
|
454 |
-
foreach ($theme_names as $theme_name) {
|
455 |
-
if ($default_theme == $theme_name)
|
456 |
continue;
|
457 |
-
if ($options['theme_mobile'] == $theme_name) {
|
458 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
459 |
}
|
460 |
else {
|
@@ -471,20 +554,20 @@ function multi_device_switcher_render_page() {
|
|
471 |
<td>
|
472 |
|
473 |
<?php
|
474 |
-
if (count($theme_names)) {
|
475 |
$html = '<select name="multi_device_switcher_options[theme_game]">';
|
476 |
|
477 |
-
if (($options['theme_game'] == 'None') || ($options['theme_game'] == '')) {
|
478 |
$html .= '<option value="None" selected="selected">None</option>';
|
479 |
}
|
480 |
else {
|
481 |
$html .= '<option value="None">None</option>';
|
482 |
}
|
483 |
|
484 |
-
foreach ($theme_names as $theme_name) {
|
485 |
-
if ($default_theme == $theme_name)
|
486 |
continue;
|
487 |
-
if ($options['theme_game'] == $theme_name) {
|
488 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
489 |
}
|
490 |
else {
|
@@ -516,20 +599,20 @@ function multi_device_switcher_render_page() {
|
|
516 |
<td>
|
517 |
|
518 |
<?php
|
519 |
-
if (count($theme_names)) {
|
520 |
$html = '<select name="multi_device_switcher_options[' . $custom_switcher_option . ']">';
|
521 |
|
522 |
-
if (($custom_switcher_theme == 'None') || ($custom_switcher_theme == '')) {
|
523 |
$html .= '<option value="None" selected="selected">None</option>';
|
524 |
}
|
525 |
else {
|
526 |
$html .= '<option value="None">None</option>';
|
527 |
}
|
528 |
|
529 |
-
foreach ($theme_names as $theme_name) {
|
530 |
-
if ($default_theme == $theme_name)
|
531 |
continue;
|
532 |
-
if ($custom_switcher_theme == $theme_name) {
|
533 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
534 |
}
|
535 |
else {
|
@@ -551,7 +634,7 @@ function multi_device_switcher_render_page() {
|
|
551 |
<tr><th scope="row"><?php _e( 'Add Custom Switcher', 'multi-device-switcher' ); ?></th>
|
552 |
<td>
|
553 |
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Add Custom Switcher', 'thingscms' ); ?></span></legend>
|
554 |
-
<input type="text" name="multi_device_switcher_options[custom_switcher]" id="custom-switcher" value="" size="24"
|
555 |
<span class="submit"><input type="submit" name="multi_device_switcher_options[add_custom_switcher]" value="<?php _e( 'Add', 'multi-device-switcher' ); ?>" class="button"></span><br>
|
556 |
<?php _e( '20 characters max, alphanumeric', 'multi-device-switcher' ); ?>
|
557 |
</td>
|
@@ -600,6 +683,26 @@ function multi_device_switcher_render_page() {
|
|
600 |
|
601 |
</table>
|
602 |
</fieldset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
</div>
|
604 |
<?php submit_button(); ?>
|
605 |
</form>
|
@@ -699,7 +802,17 @@ function multi_device_switcher_validate( $input ) {
|
|
699 |
}
|
700 |
}
|
701 |
|
|
|
|
|
|
|
702 |
return apply_filters( 'multi_device_switcher_validate', $output, $input, $default_options );
|
703 |
}
|
704 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
?>
|
3 |
Plugin Name: Multi Device Switcher
|
4 |
Plugin URI: https://github.com/thingsym/multi-device-switcher
|
5 |
Description: This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom).
|
6 |
+
Version: 1.2.0
|
7 |
Author: thingsym
|
8 |
Author URI: http://www.thingslabo.com/
|
9 |
License: GPL2
|
30 |
class Multi_Device_Switcher {
|
31 |
|
32 |
public function __construct() {
|
33 |
+
add_action('init', array(&$this, 'session'));
|
34 |
|
35 |
$userAgent = $this->get_options_userAgent();
|
36 |
$this->device = '';
|
38 |
foreach ( array_reverse($userAgent) as $key => $val ) {
|
39 |
if ( ! preg_match( "/^custom_switcher_/", $key ) )
|
40 |
continue;
|
41 |
+
if ( $userAgent[$key] && preg_match( '/' . implode( '|', $userAgent[$key] ) . '/i', $_SERVER['HTTP_USER_AGENT']) ) {
|
42 |
$this->device = $key;
|
43 |
break;
|
44 |
}
|
45 |
}
|
46 |
|
47 |
+
if ( ! $this->device ) {
|
48 |
if ( $userAgent['game'] && preg_match( '/' . implode( '|', $userAgent['game'] ) . '/i', $_SERVER['HTTP_USER_AGENT']) ) {
|
49 |
$this->device = 'game';
|
50 |
}
|
60 |
}
|
61 |
|
62 |
if ($this->device) {
|
63 |
+
load_plugin_textdomain('multi-device-switcher', false, 'multi-device-switcher/languages');
|
64 |
add_filter('stylesheet', array(&$this, 'get_stylesheet'));
|
65 |
add_filter('template', array(&$this, 'get_template'));
|
66 |
+
add_action('wp_footer', array(&$this, 'add_pc_switcher'));
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( isset($_COOKIE['pc-switcher']) ) {
|
70 |
+
remove_filter('stylesheet', array(&$this, 'get_stylesheet'));
|
71 |
+
remove_filter('template', array(&$this, 'get_template'));
|
72 |
}
|
73 |
}
|
74 |
|
115 |
|
116 |
$themes = wp_get_themes();
|
117 |
foreach ( $themes as $t ) {
|
118 |
+
if ( $name == $t->get('Name') ) {
|
119 |
$theme = $t;
|
120 |
break;
|
121 |
}
|
138 |
|
139 |
$themes = wp_get_themes();
|
140 |
foreach ( $themes as $t ) {
|
141 |
+
if ( $name == $t->get('Name') ) {
|
142 |
$theme = $t;
|
143 |
break;
|
144 |
}
|
175 |
|
176 |
$custom_switcher_name = preg_replace("/^custom_switcher_theme_/", '', $key);
|
177 |
|
178 |
+
if ( $this->device == 'custom_switcher_' . $custom_switcher_name ) {
|
179 |
return $options[$key];
|
180 |
}
|
181 |
}
|
183 |
|
184 |
return;
|
185 |
}
|
186 |
+
|
187 |
+
public function session() {
|
188 |
+
if ( isset($_GET['pc-switcher']) ) {
|
189 |
+
setcookie( 'pc-switcher', $_GET['pc-switcher'] ? 1 : '', null, '/' );
|
190 |
+
|
191 |
+
$uri = preg_replace( '/^(.+?)(\?.*)$/', '$1', $_SERVER['REQUEST_URI'] );
|
192 |
+
|
193 |
+
unset($_GET['pc-switcher']);
|
194 |
+
if ( ! empty($_GET) )
|
195 |
+
$uri = $uri . '?' . http_build_query($_GET);
|
196 |
+
|
197 |
+
wp_redirect( esc_attr($uri) );
|
198 |
+
exit;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
public function add_pc_switcher($pc_switcher = 0) {
|
203 |
+
$options = get_option('multi_device_switcher_options');
|
204 |
+
$name = $this->get_device_theme();
|
205 |
+
|
206 |
+
if ($options['pc_switcher'])
|
207 |
+
$pc_switcher = 1;
|
208 |
+
|
209 |
+
if ( $pc_switcher && $name && $name != 'None' ) {
|
210 |
+
if ($options['default_css'])
|
211 |
+
wp_enqueue_style( 'pc-switcher-options', WP_PLUGIN_URL . '/multi-device-switcher/pc-switcher.css', false, '2013-03-20' );
|
212 |
+
|
213 |
+
if ( isset($_COOKIE['pc-switcher']) ) {
|
214 |
+
?>
|
215 |
+
<div class="pc-switcher"><a href="?pc-switcher=0" class="active"><?php _e( 'Mobile', 'multi-device-switcher' ); ?></a><span class="active"><?php _e( 'PC', 'multi-device-switcher' ); ?></span></div>
|
216 |
+
<?php
|
217 |
+
}
|
218 |
+
else {
|
219 |
+
?>
|
220 |
+
<div class="pc-switcher"><span class="active"><?php _e( 'Mobile', 'multi-device-switcher' ); ?></span><a href="?pc-switcher=1" class="active"><?php _e( 'PC', 'multi-device-switcher' ); ?></a></div>
|
221 |
+
<?php
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
}
|
226 |
|
227 |
if ( ! is_admin() )
|
241 |
}
|
242 |
add_filter( 'wp_headers', 'multi_device_switcher_add_header_vary' );
|
243 |
|
244 |
+
/**
|
245 |
+
* Add PC Switcher.
|
246 |
+
*
|
247 |
+
* @since 1.2
|
248 |
+
*
|
249 |
+
*/
|
250 |
+
function multi_device_switcher_add_pc_switcher() {
|
251 |
+
global $multi_device_switcher;
|
252 |
+
$multi_device_switcher->add_pc_switcher(1);
|
253 |
+
}
|
254 |
+
|
255 |
/**
|
256 |
* Properly enqueue scripts for our multi_device_switcher options page.
|
257 |
*
|
261 |
*
|
262 |
*/
|
263 |
function multi_device_switcher_admin_enqueue_scripts( $hook_suffix ) {
|
264 |
+
wp_enqueue_script( 'jquery-ui-tabs' );
|
265 |
wp_enqueue_script( 'multi-device-switcher-options', WP_PLUGIN_URL . '/multi-device-switcher/multi-device-switcher.js', array( 'jquery' ), '2011-08-22' );
|
266 |
}
|
267 |
|
331 |
function multi_device_switcher_add_page() {
|
332 |
load_plugin_textdomain('multi-device-switcher', false, 'multi-device-switcher/languages');
|
333 |
|
334 |
+
add_filter( 'plugin_action_links', 'multi_device_switcher_plugin_action_links', 10, 2 );
|
335 |
+
|
336 |
$theme_page = add_theme_page(
|
337 |
__( 'Multi Device Switcher', 'multi-device-switcher' ), // Name of page
|
338 |
__( 'Multi Device Switcher', 'multi-device-switcher' ), // Label in menu
|
354 |
}
|
355 |
add_action( 'admin_menu', 'multi_device_switcher_add_page' );
|
356 |
|
357 |
+
/**
|
358 |
+
* Add the settings link to the plugin page.
|
359 |
+
*
|
360 |
+
* @since 1.2
|
361 |
+
*/
|
362 |
+
function multi_device_switcher_plugin_action_links( $links, $file ) {
|
363 |
+
if ( $file != plugin_basename( __FILE__ ))
|
364 |
+
return $links;
|
365 |
+
|
366 |
+
$settings_link = '<a href="themes.php?page=multi-device-switcher">' . __( 'Settings', 'multi-device-switcher' ) . '</a>';
|
367 |
+
|
368 |
+
array_unshift( $links, $settings_link );
|
369 |
+
|
370 |
+
return $links;
|
371 |
+
}
|
372 |
+
|
373 |
/**
|
374 |
* Returns the default options.
|
375 |
*
|
377 |
*/
|
378 |
function multi_device_switcher_get_default_options() {
|
379 |
$default_theme_options = array(
|
380 |
+
'pc_switcher' => 1,
|
381 |
+
'default_css' => 1,
|
382 |
'theme_smartphone' => 'None',
|
383 |
'theme_tablet' => 'None',
|
384 |
'theme_mobile' => 'None',
|
401 |
$options = get_option( 'multi_device_switcher_options' );
|
402 |
$default_options = multi_device_switcher_get_default_options();
|
403 |
|
404 |
+
if ( ! isset( $options['pc_switcher'] ) )
|
405 |
+
$options['pc_switcher'] = $default_options['pc_switcher'];
|
406 |
+
if ( ! isset( $options['default_css'] ) )
|
407 |
+
$options['default_css'] = $default_options['default_css'];
|
408 |
+
|
409 |
if ( ! isset( $options['theme_smartphone'] ) )
|
410 |
$options['theme_smartphone'] = $default_options['theme_smartphone'];
|
411 |
if ( ! isset( $options['theme_tablet'] ) )
|
448 |
$themes = wp_get_themes();
|
449 |
$theme_names = array();
|
450 |
|
451 |
+
if ( count($themes) ) {
|
452 |
foreach ( $themes as $t ) {
|
453 |
$theme_names[] = $t->get('Name');
|
454 |
}
|
464 |
<td>
|
465 |
|
466 |
<?php
|
467 |
+
if ( count($theme_names) ) {
|
468 |
$html = '<select name="multi_device_switcher_options[theme_smartphone]">';
|
469 |
|
470 |
+
if ( ($options['theme_smartphone'] == 'None') || ($options['theme_smartphone'] == '') ) {
|
471 |
$html .= '<option value="None" selected="selected">None</option>';
|
472 |
}
|
473 |
else {
|
474 |
$html .= '<option value="None">None</option>';
|
475 |
}
|
476 |
|
477 |
+
foreach ( $theme_names as $theme_name ) {
|
478 |
+
if ( $default_theme == $theme_name )
|
479 |
continue;
|
480 |
+
if ( $options['theme_smartphone'] == $theme_name ) {
|
481 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
482 |
}
|
483 |
else {
|
494 |
<td>
|
495 |
|
496 |
<?php
|
497 |
+
if ( count($theme_names) ) {
|
498 |
$html = '<select name="multi_device_switcher_options[theme_tablet]">';
|
499 |
|
500 |
+
if ( ($options['theme_tablet'] == 'None') || ($options['theme_tablet'] == '') ) {
|
501 |
$html .= '<option value="None" selected="selected">None</option>';
|
502 |
}
|
503 |
else {
|
504 |
$html .= '<option value="None">None</option>';
|
505 |
}
|
506 |
|
507 |
+
foreach ( $theme_names as $theme_name ) {
|
508 |
+
if ( $default_theme == $theme_name )
|
509 |
continue;
|
510 |
+
if ( $options['theme_tablet'] == $theme_name ) {
|
511 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
512 |
}
|
513 |
else {
|
524 |
<td>
|
525 |
|
526 |
<?php
|
527 |
+
if ( count($theme_names) ) {
|
528 |
$html = '<select name="multi_device_switcher_options[theme_mobile]">';
|
529 |
|
530 |
+
if ( ($options['theme_mobile'] == 'None') || ($options['theme_mobile'] == '') ) {
|
531 |
$html .= '<option value="None" selected="selected">None</option>';
|
532 |
}
|
533 |
else {
|
534 |
$html .= '<option value="None">None</option>';
|
535 |
}
|
536 |
|
537 |
+
foreach ( $theme_names as $theme_name ) {
|
538 |
+
if ( $default_theme == $theme_name )
|
539 |
continue;
|
540 |
+
if ( $options['theme_mobile'] == $theme_name ) {
|
541 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
542 |
}
|
543 |
else {
|
554 |
<td>
|
555 |
|
556 |
<?php
|
557 |
+
if ( count($theme_names) ) {
|
558 |
$html = '<select name="multi_device_switcher_options[theme_game]">';
|
559 |
|
560 |
+
if ( ($options['theme_game'] == 'None') || ($options['theme_game'] == '') ) {
|
561 |
$html .= '<option value="None" selected="selected">None</option>';
|
562 |
}
|
563 |
else {
|
564 |
$html .= '<option value="None">None</option>';
|
565 |
}
|
566 |
|
567 |
+
foreach ( $theme_names as $theme_name ) {
|
568 |
+
if ( $default_theme == $theme_name )
|
569 |
continue;
|
570 |
+
if ( $options['theme_game'] == $theme_name ) {
|
571 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
572 |
}
|
573 |
else {
|
599 |
<td>
|
600 |
|
601 |
<?php
|
602 |
+
if ( count($theme_names) ) {
|
603 |
$html = '<select name="multi_device_switcher_options[' . $custom_switcher_option . ']">';
|
604 |
|
605 |
+
if ( ($custom_switcher_theme == 'None') || ($custom_switcher_theme == '') ) {
|
606 |
$html .= '<option value="None" selected="selected">None</option>';
|
607 |
}
|
608 |
else {
|
609 |
$html .= '<option value="None">None</option>';
|
610 |
}
|
611 |
|
612 |
+
foreach ( $theme_names as $theme_name ) {
|
613 |
+
if ( $default_theme == $theme_name )
|
614 |
continue;
|
615 |
+
if ( $custom_switcher_theme == $theme_name ) {
|
616 |
$html .= '<option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>';
|
617 |
}
|
618 |
else {
|
634 |
<tr><th scope="row"><?php _e( 'Add Custom Switcher', 'multi-device-switcher' ); ?></th>
|
635 |
<td>
|
636 |
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Add Custom Switcher', 'thingscms' ); ?></span></legend>
|
637 |
+
<input type="text" name="multi_device_switcher_options[custom_switcher]" id="custom-switcher" value="" size="24">
|
638 |
<span class="submit"><input type="submit" name="multi_device_switcher_options[add_custom_switcher]" value="<?php _e( 'Add', 'multi-device-switcher' ); ?>" class="button"></span><br>
|
639 |
<?php _e( '20 characters max, alphanumeric', 'multi-device-switcher' ); ?>
|
640 |
</td>
|
683 |
|
684 |
</table>
|
685 |
</fieldset>
|
686 |
+
|
687 |
+
<fieldset id="PC-Switcher" class="options">
|
688 |
+
<h3 class="label"><?php _e( 'PC Switcher', 'multi-device-switcher' ); ?></h3>
|
689 |
+
|
690 |
+
<table class="form-table">
|
691 |
+
<tr><th scope="row"><?php _e( 'Add PC Switcher', 'multi-device-switcher' ); ?></th>
|
692 |
+
<td>
|
693 |
+
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Add PC Switcher', 'multi-device-switcher' ); ?></span></legend>
|
694 |
+
<label><input type="checkbox" name="multi_device_switcher_options[pc_switcher]" id="pc-switcher" value="1"<?php checked(1, $options['pc_switcher']); ?>> <?php _e( 'Add a PC Switcher to the footer.', 'multi-device-switcher' ); ?></label>
|
695 |
+
</td>
|
696 |
+
</tr>
|
697 |
+
<tr><th scope="row"><?php _e( 'Add default CSS', 'multi-device-switcher' ); ?></th>
|
698 |
+
<td>
|
699 |
+
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Add default CSS', 'multi-device-switcher' ); ?></span></legend>
|
700 |
+
<label><input type="checkbox" name="multi_device_switcher_options[default_css]" id="add-default-css" value="1"<?php checked(1, $options['default_css']); ?>> <?php _e( 'Add a default CSS.', 'multi-device-switcher' ); ?></label>
|
701 |
+
</td>
|
702 |
+
</tr>
|
703 |
+
</table>
|
704 |
+
</fieldset>
|
705 |
+
|
706 |
</div>
|
707 |
<?php submit_button(); ?>
|
708 |
</form>
|
802 |
}
|
803 |
}
|
804 |
|
805 |
+
$output['pc_switcher'] = isset($input['pc_switcher']) ? $input['pc_switcher'] : 0;
|
806 |
+
$output['default_css'] = isset($input['default_css']) ? $input['default_css'] : 0;
|
807 |
+
|
808 |
return apply_filters( 'multi_device_switcher_validate', $output, $input, $default_options );
|
809 |
}
|
810 |
|
811 |
+
/**
|
812 |
+
* include PC Switcher Widget.
|
813 |
+
*
|
814 |
+
* @since 1.2
|
815 |
+
*/
|
816 |
+
require_once( dirname(__FILE__) . '/pc-switcher-widget.php' );
|
817 |
+
|
818 |
?>
|
pc-switcher-widget.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Widget Name: PC Switcher Widget
|
4 |
+
Plugin URI: https://github.com/thingsym/multi-device-switcher
|
5 |
+
Description: PC Switcher Widget add-on for the Multi Device Switcher. Use this widget to add the PC Switcher to a widget.
|
6 |
+
Version: 1.2
|
7 |
+
Author: thingsym
|
8 |
+
Author URI: http://www.thingslabo.com/
|
9 |
+
License: GPL2
|
10 |
+
*/
|
11 |
+
|
12 |
+
/*
|
13 |
+
Copyright 2013 thingsym (http://www.thingslabo.com/)
|
14 |
+
|
15 |
+
This program is free software; you can redistribute it and/or modify
|
16 |
+
it under the terms of the GNU General Public License as published by
|
17 |
+
the Free Software Foundation; either version 2 of the License, or
|
18 |
+
(at your option) any later version.
|
19 |
+
|
20 |
+
This program is distributed in the hope that it will be useful,
|
21 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
+
GNU General Public License for more details.
|
24 |
+
|
25 |
+
You should have received a copy of the GNU General Public License
|
26 |
+
along with this program; if not, write to the Free Software
|
27 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
|
28 |
+
*/
|
29 |
+
|
30 |
+
/**
|
31 |
+
* PC Switcher Widget
|
32 |
+
*
|
33 |
+
* @since 1.2
|
34 |
+
*/
|
35 |
+
if ( class_exists('Multi_Device_Switcher') )
|
36 |
+
add_action('widgets_init', 'PC_Switcher_load_widgets');
|
37 |
+
|
38 |
+
function PC_Switcher_load_widgets() {
|
39 |
+
register_widget('PC_Switcher');
|
40 |
+
}
|
41 |
+
|
42 |
+
class PC_Switcher extends WP_Widget {
|
43 |
+
|
44 |
+
function __construct() {
|
45 |
+
load_plugin_textdomain('multi-device-switcher', false, 'multi-device-switcher/languages');
|
46 |
+
$widget_ops = array('classname' => 'widget_pc_switcher', 'description' => __( "Add the PC Switcher to a widget.", 'multi-device-switcher') );
|
47 |
+
parent::__construct('pc-switcher', __('PC Switcher', 'multi-device-switcher'), $widget_ops);
|
48 |
+
$this->alt_option_name = 'widget_pc_switcher';
|
49 |
+
|
50 |
+
add_action( 'save_post', array(&$this, 'flush_widget_cache') );
|
51 |
+
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') );
|
52 |
+
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') );
|
53 |
+
}
|
54 |
+
|
55 |
+
function widget($args, $instance) {
|
56 |
+
if ( ! function_exists( 'multi_device_switcher_add_pc_switcher' ) )
|
57 |
+
return;
|
58 |
+
|
59 |
+
global $multi_device_switcher;
|
60 |
+
$name = $multi_device_switcher->get_device_theme();
|
61 |
+
|
62 |
+
if ( $name && $name != 'None' ) {
|
63 |
+
|
64 |
+
$cache = wp_cache_get('widget_pc_switcher', 'widget');
|
65 |
+
|
66 |
+
if ( !is_array($cache) )
|
67 |
+
$cache = array();
|
68 |
+
|
69 |
+
if ( isset($cache[$args['widget_id']]) ) {
|
70 |
+
echo $cache[$args['widget_id']];
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
ob_start();
|
75 |
+
extract($args);
|
76 |
+
|
77 |
+
echo $before_widget;
|
78 |
+
multi_device_switcher_add_pc_switcher();
|
79 |
+
echo $after_widget;
|
80 |
+
|
81 |
+
$cache[$args['widget_id']] = ob_get_flush();
|
82 |
+
wp_cache_set('widget_pc_switcher', $cache, 'widget');
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
function update( $new_instance, $old_instance ) {
|
87 |
+
$instance = $old_instance;
|
88 |
+
|
89 |
+
$this->flush_widget_cache();
|
90 |
+
|
91 |
+
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
92 |
+
if ( isset($alloptions['widget_pc_switcher']) )
|
93 |
+
delete_option('widget_pc_switcher');
|
94 |
+
|
95 |
+
return $instance;
|
96 |
+
}
|
97 |
+
|
98 |
+
function flush_widget_cache() {
|
99 |
+
wp_cache_delete('widget_pc_switcher', 'widget');
|
100 |
+
}
|
101 |
+
|
102 |
+
function form( $instance ) {
|
103 |
+
}
|
104 |
+
}
|
105 |
+
?>
|
pc-switcher.css
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.pc-switcher {
|
2 |
+
clear: both;
|
3 |
+
text-align: center;
|
4 |
+
margin: 1.4em auto;
|
5 |
+
}
|
6 |
+
.pc-switcher a,
|
7 |
+
.pc-switcher span {
|
8 |
+
padding: 0.4em 8%;
|
9 |
+
text-align: center;
|
10 |
+
border: 1px solid #0059A8;
|
11 |
+
border-left: none;
|
12 |
+
color: #fff !important;
|
13 |
+
font-weight: bold;
|
14 |
+
text-decoration: none;
|
15 |
+
}
|
16 |
+
.pc-switcher a {
|
17 |
+
background-color: #0074DA;
|
18 |
+
background-image: -moz-linear-gradient(#0074DA, #004A8D);
|
19 |
+
background-image: -o-linear-gradient(#0074DA, #004A8D);
|
20 |
+
background-image: -ms-linear-gradient(#0074DA, #004A8D);
|
21 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#0074DA), to(#004A8D));
|
22 |
+
background-image: -webkit-linear-gradient(#0074DA, #004A8D);
|
23 |
+
background-image: linear-gradient(#0074DA, #004A8D);
|
24 |
+
}
|
25 |
+
.pc-switcher a:hover {
|
26 |
+
background-color: #0059A8;
|
27 |
+
background-image: -moz-linear-gradient(#0059A8, #004A8D);
|
28 |
+
background-image: -o-linear-gradient(#0059A8, #004A8D);
|
29 |
+
background-image: -ms-linear-gradient(#0059A8, #004A8D);
|
30 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#0059A8), to(#004A8D));
|
31 |
+
background-image: -webkit-linear-gradient(#0059A8, #004A8D);
|
32 |
+
background-image: linear-gradient(#0059A8, #004A8D);
|
33 |
+
}
|
34 |
+
.pc-switcher span.active {
|
35 |
+
background-color: #00305C;
|
36 |
+
}
|
37 |
+
.pc-switcher a:first-child,
|
38 |
+
.pc-switcher span:first-child {
|
39 |
+
border-left: 1px solid #0074DA;
|
40 |
+
-webkit-border-radius: 2.4em 0 0 2.4em;
|
41 |
+
-moz-border-radius: 2.4em 0 0 2.4em;
|
42 |
+
border-radius: 2.4em 0 0 2.4em;
|
43 |
+
}
|
44 |
+
.pc-switcher a:last-child,
|
45 |
+
.pc-switcher span:last-child {
|
46 |
+
-webkit-border-radius: 0 2.4em 2.4em 0;
|
47 |
+
-moz-border-radius: 0 2.4em 2.4em 0;
|
48 |
+
border-radius: 0 2.4em 2.4em 0;
|
49 |
+
}
|
readme.md
CHANGED
@@ -4,9 +4,15 @@ This WordPress plugin allows you to set a separate theme for device (Smart Phone
|
|
4 |
This plugin detects if your site is being viewed by UserAgent, and switches to selected theme.
|
5 |
The Custom Switcher can add every device.
|
6 |
|
7 |
-
##
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
2. Upload "multi-device-switcher" to the "/wp-content/plugins/" directory.
|
11 |
3. Activate the plugin through the 'Plugins' menu in WordPress.
|
12 |
4. Upload a separate theme to the "/wp-content/themes/" directory.
|
@@ -21,9 +27,64 @@ The Custom Switcher can add every device.
|
|
21 |
3. Configure settings. Select Theme by Theme option. Add UserAgent by UserAgent option.
|
22 |
4. Have fun!
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
## Changelog
|
25 |
|
|
|
|
|
|
|
|
|
26 |
* Version 1.1.2
|
|
|
27 |
* fixed: fix tabs and buttons
|
28 |
* Version 1.1.1
|
29 |
* fixed: change the order of the UserAgent detection
|
@@ -45,3 +106,9 @@ The Custom Switcher can add every device.
|
|
45 |
* fixed: split multi_device_switcher_init() into two functions
|
46 |
* Version 1.0.0
|
47 |
* Initial release.
|
|
|
|
|
|
|
|
|
|
|
|
4 |
This plugin detects if your site is being viewed by UserAgent, and switches to selected theme.
|
5 |
The Custom Switcher can add every device.
|
6 |
|
7 |
+
## Features
|
8 |
|
9 |
+
- Set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game), switches to selected theme.
|
10 |
+
- Add every device by the Custom Switcher.
|
11 |
+
- Add links 'Mobile' or 'PC' in the theme by the PC Switcher, switch to the default theme.
|
12 |
+
|
13 |
+
## How do I use it ?
|
14 |
+
|
15 |
+
1. Download and unzip files. Or install multi-device-switcher using the WordPress plugin installer. In that case, skip 2.
|
16 |
2. Upload "multi-device-switcher" to the "/wp-content/plugins/" directory.
|
17 |
3. Activate the plugin through the 'Plugins' menu in WordPress.
|
18 |
4. Upload a separate theme to the "/wp-content/themes/" directory.
|
27 |
3. Configure settings. Select Theme by Theme option. Add UserAgent by UserAgent option.
|
28 |
4. Have fun!
|
29 |
|
30 |
+
## Setting and Using the PC Switcher
|
31 |
+
|
32 |
+
There are three ways how to Using the PC Switcher.
|
33 |
+
|
34 |
+
### 1. Add a PC Switcher to the footer
|
35 |
+
|
36 |
+
1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
|
37 |
+
2. Configure settings. Check the checkbox 'Add a PC Switcher to the footer.' by PC Switcher option.
|
38 |
+
3. Have fun!
|
39 |
+
|
40 |
+
### 2. Add a PC Switcher to your sidebars/widget areas
|
41 |
+
|
42 |
+
1. Add-on the widget 'PC Switcher', when you activate the plugin "Multi Device Switcher".
|
43 |
+
2. Go to the "Widgets" options page through the 'Appearance' menu in WordPress.
|
44 |
+
3. Drag and drop the title bars 'PC Switcher' into the desired area.
|
45 |
+
4. Have fun!
|
46 |
+
|
47 |
+
### 3. For the theme authors and developers, add a PC Switcher to your theme.
|
48 |
+
|
49 |
+
1. Add the following code into the PHP files, when you develop your theme.
|
50 |
+
`<?php if ( function_exists('multi_device_switcher_add_pc_switcher') ) { multi_device_switcher_add_pc_switcher(); } ?>`
|
51 |
+
2. Have fun!
|
52 |
+
|
53 |
+
### Using default CSS and customized CSS
|
54 |
+
|
55 |
+
1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
|
56 |
+
2. Configure settings. Check the checkbox 'Add a default CSS.' by PC Switcher option. If you want to customize CSS, uncheck the checkbox.
|
57 |
+
3. Have fun!
|
58 |
+
|
59 |
+
## Translations
|
60 |
+
|
61 |
+
- Japanese (ja) - <a href="http://global.thingslabo.com/blog/">Thingsym</a>
|
62 |
+
|
63 |
+
Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors.
|
64 |
+
|
65 |
+
If you have created or updated your own language pack, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to me. I can bundle it into Multi Device Switcher.
|
66 |
+
|
67 |
+
#### The latest PO and MO files
|
68 |
+
|
69 |
+
- [POT file](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/multi-device-switcher.pot)
|
70 |
+
- [PO files](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/)
|
71 |
+
|
72 |
+
#### Contact to me
|
73 |
+
|
74 |
+
You can send your own language pack to me.
|
75 |
+
|
76 |
+
- [multi-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher)
|
77 |
+
- [http://global.thingslabo.com/blog/ (en)](http://global.thingslabo.com/blog/)
|
78 |
+
- [http://blog.thingslabo.com (ja)](http://blog.thingslabo.com)
|
79 |
+
|
80 |
## Changelog
|
81 |
|
82 |
+
* Version 1.2.0
|
83 |
+
* added: add PC Switcher Widget
|
84 |
+
* new features: PC Switcher
|
85 |
+
* added: add the settings link to the plugin page
|
86 |
* Version 1.1.2
|
87 |
+
* required: at least version 3.4
|
88 |
* fixed: fix tabs and buttons
|
89 |
* Version 1.1.1
|
90 |
* fixed: change the order of the UserAgent detection
|
106 |
* fixed: split multi_device_switcher_init() into two functions
|
107 |
* Version 1.0.0
|
108 |
* Initial release.
|
109 |
+
|
110 |
+
## Upgrade Notice
|
111 |
+
|
112 |
+
* 1.1.2
|
113 |
+
* Requires at least version 3.4 of the Wordpress
|
114 |
+
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Link: https://github.com/thingsym/multi-device-switcher
|
|
6 |
Tags: switcher, theme, ipad, iphone, android, tablet, mobile, game
|
7 |
Requires at least: 3.4
|
8 |
Tested up to: 3.5
|
9 |
-
Stable tag: 1.
|
10 |
License: GPL2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -18,14 +18,44 @@ This WordPress plugin allows you to set a separate theme for device (Smart Phone
|
|
18 |
This plugin detects if your site is being viewed by UserAgent, and switches to selected theme.
|
19 |
The Custom Switcher can add every device.
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
== Screenshots ==
|
22 |
|
23 |
1. Theme option
|
24 |
2. UserAgent option
|
|
|
|
|
25 |
|
26 |
== Installation ==
|
27 |
|
28 |
-
1.
|
29 |
2. Upload "multi-device-switcher" to the "/wp-content/plugins/" directory.
|
30 |
3. Activate the plugin through the 'Plugins' menu in WordPress.
|
31 |
4. Upload a separate theme to the "/wp-content/themes/" directory.
|
@@ -40,9 +70,39 @@ The Custom Switcher can add every device.
|
|
40 |
3. Configure settings. Select Theme by Theme option. Add UserAgent by UserAgent option.
|
41 |
4. Have fun!
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
== Changelog ==
|
44 |
|
45 |
= 1.1.2 =
|
|
|
46 |
* fixed: fix tabs and buttons
|
47 |
= 1.1.1 =
|
48 |
* fixed: change the order of the UserAgent detection
|
@@ -64,3 +124,9 @@ The Custom Switcher can add every device.
|
|
64 |
* fixed: split multi_device_switcher_init() into two functions
|
65 |
= 1.0.0 =
|
66 |
* Initial release.
|
|
|
|
|
|
|
|
|
|
|
|
6 |
Tags: switcher, theme, ipad, iphone, android, tablet, mobile, game
|
7 |
Requires at least: 3.4
|
8 |
Tested up to: 3.5
|
9 |
+
Stable tag: 1.2.0
|
10 |
License: GPL2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
18 |
This plugin detects if your site is being viewed by UserAgent, and switches to selected theme.
|
19 |
The Custom Switcher can add every device.
|
20 |
|
21 |
+
|
22 |
+
= Features =
|
23 |
+
|
24 |
+
* Set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game), switches to selected theme.
|
25 |
+
* Add every device by the Custom Switcher.
|
26 |
+
* Add links 'Mobile' or 'PC' in the theme by the PC Switcher, switch to the default theme.
|
27 |
+
|
28 |
+
= Translations =
|
29 |
+
|
30 |
+
* Japanese (ja) - <a href="http://global.thingslabo.com/blog/">Thingsym</a>
|
31 |
+
|
32 |
+
Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors.
|
33 |
+
|
34 |
+
If you have created or updated your own language pack, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to me. I can bundle it into Multi Device Switcher.
|
35 |
+
|
36 |
+
= The latest PO and MO files =
|
37 |
+
|
38 |
+
* [POT file](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/multi-device-switcher.pot)
|
39 |
+
* [PO files](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/)
|
40 |
+
|
41 |
+
= Contact to me =
|
42 |
+
|
43 |
+
You can send your own language pack to me.
|
44 |
+
|
45 |
+
* [multi-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher)
|
46 |
+
* [http://global.thingslabo.com/blog/ (en)](http://global.thingslabo.com/blog/)
|
47 |
+
* [http://blog.thingslabo.com (ja)](http://blog.thingslabo.com)
|
48 |
+
|
49 |
== Screenshots ==
|
50 |
|
51 |
1. Theme option
|
52 |
2. UserAgent option
|
53 |
+
3. PC Switcher option
|
54 |
+
4. PC Switcher button
|
55 |
|
56 |
== Installation ==
|
57 |
|
58 |
+
1. Download and unzip files. Or install multi-device-switcher using the WordPress plugin installer. In that case, skip 2.
|
59 |
2. Upload "multi-device-switcher" to the "/wp-content/plugins/" directory.
|
60 |
3. Activate the plugin through the 'Plugins' menu in WordPress.
|
61 |
4. Upload a separate theme to the "/wp-content/themes/" directory.
|
70 |
3. Configure settings. Select Theme by Theme option. Add UserAgent by UserAgent option.
|
71 |
4. Have fun!
|
72 |
|
73 |
+
= Setting and Using the PC Switcher =
|
74 |
+
|
75 |
+
There are three ways how to Using the PC Switcher.
|
76 |
+
|
77 |
+
= 1. Add a PC Switcher to the footer =
|
78 |
+
|
79 |
+
1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
|
80 |
+
2. Configure settings. Check the checkbox 'Add a PC Switcher to the footer.' by PC Switcher option.
|
81 |
+
3. Have fun!
|
82 |
+
|
83 |
+
= 2. Add a PC Switcher to your sidebars/widget areas =
|
84 |
+
|
85 |
+
1. Add-on the widget 'PC Switcher', when you activate the plugin "Multi Device Switcher".
|
86 |
+
2. Go to the "Widgets" options page through the 'Appearance' menu in WordPress.
|
87 |
+
3. Drag and drop the title bars 'PC Switcher' into the desired area.
|
88 |
+
4. Have fun!
|
89 |
+
|
90 |
+
= 3. For the theme authors and developers, add a PC Switcher to your theme.
|
91 |
+
|
92 |
+
1. Add the following code into the PHP files, when you develop your theme.
|
93 |
+
`<?php if ( function_exists('multi_device_switcher_add_pc_switcher') ) { multi_device_switcher_add_pc_switcher(); } ?>`
|
94 |
+
2. Have fun!
|
95 |
+
|
96 |
+
= Using default CSS and customized CSS =
|
97 |
+
|
98 |
+
* Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
|
99 |
+
* Configure settings. Check the checkbox 'Add a default CSS.' by PC Switcher option. If you want to customize CSS, uncheck the checkbox.
|
100 |
+
* Have fun!
|
101 |
+
|
102 |
== Changelog ==
|
103 |
|
104 |
= 1.1.2 =
|
105 |
+
* required: at least version 3.4
|
106 |
* fixed: fix tabs and buttons
|
107 |
= 1.1.1 =
|
108 |
* fixed: change the order of the UserAgent detection
|
124 |
* fixed: split multi_device_switcher_init() into two functions
|
125 |
= 1.0.0 =
|
126 |
* Initial release.
|
127 |
+
|
128 |
+
== Upgrade Notice ==
|
129 |
+
|
130 |
+
= 1.1.2 =
|
131 |
+
* Requires at least version 3.4 of the Wordpress
|
132 |
+
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
screenshot-4.png
ADDED
Binary file
|