diff --git a/README.md b/README.md index 5b6a405..bb4376d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Introducing Multi Device Switcher -This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom). +Multi Device Switcher plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom). This plugin detects if your site is being viewed by UserAgent, and switches to selected theme. The Custom Switcher can add every device. ## Features @@ -379,25 +379,42 @@ turn on default CSS wp multi-device css on -## Resources - -* [Developer Blog (Japanese) - http://blog.thingslabo.com/ ](https://blog.thingslabo.com/archives/category/multi_device_switcher) - ## WordPress Plugin Directory Multi Device Switcher is hosted on the WordPress Plugin Directory. [https://wordpress.org/plugins/multi-device-switcher/](https://wordpress.org/plugins/multi-device-switcher/) -## Test Matrix +## Resources -For operation compatibility between PHP version and WordPress version, see below [Github Actions](https://github.com/thingsym/multi-device-switcher/actions). +* [Developer Blog (Japanese) - http://blog.thingslabo.com/ ](https://blog.thingslabo.com/archives/category/multi_device_switcher) + +## Support + +If you have any trouble, you can use the forums or report bugs. + +* Forum: [https://wordpress.org/support/plugin/multi-device-switcher/](https://wordpress.org/support/plugin/multi-device-switcher/) +* Issues: [https://github.com/thingsym/multi-device-switcher/issues](https://github.com/thingsym/multi-device-switcher/issues) ## Contribution +Small patches and bug reports can be submitted a issue tracker in Github. + +Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors. + +If you have created or updated your own language pack, you can send gettext PO and MO files to author. I can bundle it into plugin. + +* VCS - Github: [https://github.com/thingsym/multi-device-switcher/](https://github.com/thingsym/multi-device-switcher/) +* [Translate Multi Device Switcher into your language.](https://translate.wordpress.org/projects/wp-plugins/multi-device-switcher) + +You can also contribute by answering issues on the forums. + +* Forum: [https://wordpress.org/support/plugin/multi-device-switcher/](https://wordpress.org/support/plugin/multi-device-switcher/) +* Issues: [https://github.com/thingsym/multi-device-switcher/issues](https://github.com/thingsym/multi-device-switcher/issues) + ### Patches and Bug Fixes -Small patches and bug reports can be submitted a issue tracker in Github. Forking on Github is another good way. You can send a pull request. +Forking on Github is another good way. You can send a pull request. 1. Fork [Multi Device Switcher](https://github.com/thingsym/multi-device-switcher) from GitHub repository 2. Create a feature branch: git checkout -b my-new-feature @@ -405,8 +422,32 @@ Small patches and bug reports can be submitted a issue tracker in Github. Forkin 4. Push to the branch: git push origin my-new-feature 5. Create new Pull Request +### Contribute guidlines + +If you would like to contribute, here are some notes and guidlines. + +* All development happens on the **develop** branch, so it is always the most up-to-date +* The **master** branch only contains tagged releases +* If you are going to be submitting a pull request, please submit your pull request to the **develop** branch +* See about [forking](https://help.github.com/articles/fork-a-repo/) and [pull requests](https://help.github.com/articles/using-pull-requests/) + +## Test Matrix + +For operation compatibility between PHP version and WordPress version, see below [Github Actions](https://github.com/thingsym/multi-device-switcher/actions). + ## Changelog +* Version 1.8.4 + * tested up to 6.1.0 + * update japanese translation + * update pot + * fix composer.json + * add test case + * update useragent + * fix load_textdomain method for testability + * add msgmerge to composer scripts + * add support section and enhance contribution section + * fix license * Version 1.8.3 * update japanese translation * update pot diff --git a/composer.json b/composer.json index 6b28d11..3233c63 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,27 @@ { - "description": "composer.json for testing WordPress theme/plugin", - "license": "GPL2 or later", + "name": "thingsym/multi-device-switcher", + "version": "1.8.4", + "description": "This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom).", + "author": [ + { + "name": "Thingsym", + "email": "", + "homepage": "https://github.com/thingsym/", + "role": "Developer" + } + ], + "license": "GPLv2 or later", + "homepage": "https://wordpress.org/plugins/multi-device-switcher/", + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/thingsym/multi-device-switcher" + } + ], + "support": { + "forum": "https://wordpress.org/support/plugin/multi-device-switcher/", + "issues": "https://github.com/thingsym/multi-device-switcher/issues" + }, "require": {}, "require-dev": { "squizlabs/php_codesniffer": "3.*", @@ -31,6 +52,7 @@ ], "bats": "bats tests/cli", "makepot:wpcli": "wp i18n make-pot ./ ./languages/multi-device-switcher.pot --exclude=dist,bin,tests,node_modules,vendor", + "msgmerge:ja": "msgmerge --update --backup off ./languages/multi-device-switcher-ja.po ./languages/multi-device-switcher.pot", "makemo:ja": "wp i18n make-mo languages/multi-device-switcher-ja.po languages/", "msgfmt:ja": "msgfmt languages/multi-device-switcher-ja.po -o languages/multi-device-switcher-ja.mo" } diff --git a/languages/multi-device-switcher-ja.mo b/languages/multi-device-switcher-ja.mo index 5474e46..bcb91cb 100644 Binary files a/languages/multi-device-switcher-ja.mo and b/languages/multi-device-switcher-ja.mo differ diff --git a/languages/multi-device-switcher-ja.po b/languages/multi-device-switcher-ja.po index f4c59d1..4c8582d 100644 --- a/languages/multi-device-switcher-ja.po +++ b/languages/multi-device-switcher-ja.po @@ -1,24 +1,24 @@ # Copyright (C) 2022 thingsym -# This file is distributed under the GPL2 or later. +# This file is distributed under the GPLv2 or later. msgid "" msgstr "" -"Project-Id-Version: Multi Device Switcher 1.8.3\n" -"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/multi-device-switcher\n" +"Project-Id-Version: Multi Device Switcher 1.8.4\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/multi-device-" +"switcher\n" +"POT-Creation-Date: 2022-11-25T10:39:41+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-02-28T07:21:41+00:00\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.5.0\n" "X-Domain: multi-device-switcher\n" #. Plugin Name of the plugin -#: multi-device-switcher.php:755 -#: multi-device-switcher.php:756 -#: multi-device-switcher.php:939 -#: multi-device-switcher.php:1395 +#: multi-device-switcher.php:754 multi-device-switcher.php:755 +#: multi-device-switcher.php:938 multi-device-switcher.php:1394 msgid "Multi Device Switcher" msgstr "Multi Device Switcher" @@ -27,8 +27,12 @@ msgid "https://github.com/thingsym/multi-device-switcher" msgstr "https://github.com/thingsym/multi-device-switcher" #. Description of the plugin -msgid "This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom)." -msgstr "This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom)." +msgid "" +"This WordPress plugin allows you to set a separate theme for device (Smart " +"Phone, Tablet PC, Mobile Phone, Game and custom)." +msgstr "" +"This WordPress plugin allows you to set a separate theme for device (Smart " +"Phone, Tablet PC, Mobile Phone, Game and custom)." #. Author of the plugin msgid "thingsym" @@ -38,161 +42,142 @@ msgstr "thingsym" msgid "https://www.thingslabo.com/" msgstr "https://www.thingslabo.com/" -#: multi-device-switcher.php:532 -#: multi-device-switcher.php:538 +#: multi-device-switcher.php:532 multi-device-switcher.php:538 msgid "Mobile" msgstr "モバイル" -#: multi-device-switcher.php:532 -#: multi-device-switcher.php:538 +#: multi-device-switcher.php:532 multi-device-switcher.php:538 msgid "PC" msgstr "PC" - -#: multi-device-switcher.php:801 +#: multi-device-switcher.php:800 msgid "Settings" msgstr "設定" -#: multi-device-switcher.php:826 +#: multi-device-switcher.php:825 msgid "Become a sponsor" msgstr "スポンサーになる" -#: multi-device-switcher.php:961 +#: multi-device-switcher.php:960 msgid "Theme" msgstr "テーマ" -#: multi-device-switcher.php:963 -#: multi-device-switcher.php:1386 +#: multi-device-switcher.php:962 multi-device-switcher.php:1385 msgid "Smart Phone Theme" msgstr "スマートフォン用テーマ" -#: multi-device-switcher.php:972 -#: multi-device-switcher.php:975 -#: multi-device-switcher.php:1005 -#: multi-device-switcher.php:1008 -#: multi-device-switcher.php:1038 -#: multi-device-switcher.php:1041 -#: multi-device-switcher.php:1071 -#: multi-device-switcher.php:1074 -#: multi-device-switcher.php:1118 -#: multi-device-switcher.php:1121 -#: multi-device-switcher.php:1376 -#: multi-device-switcher.php:1431 +#: multi-device-switcher.php:971 multi-device-switcher.php:974 +#: multi-device-switcher.php:1004 multi-device-switcher.php:1007 +#: multi-device-switcher.php:1037 multi-device-switcher.php:1040 +#: multi-device-switcher.php:1070 multi-device-switcher.php:1073 +#: multi-device-switcher.php:1117 multi-device-switcher.php:1120 +#: multi-device-switcher.php:1375 multi-device-switcher.php:1430 msgid "None" msgstr "なし" -#: multi-device-switcher.php:997 -#: multi-device-switcher.php:1387 +#: multi-device-switcher.php:996 multi-device-switcher.php:1386 msgid "Tablet PC Theme" msgstr "タブレット端末用テーマ" -#: multi-device-switcher.php:1030 -#: multi-device-switcher.php:1388 +#: multi-device-switcher.php:1029 multi-device-switcher.php:1387 msgid "Mobile Phone Theme" msgstr "携帯モバイル端末用テーマ" -#: multi-device-switcher.php:1063 -#: multi-device-switcher.php:1389 +#: multi-device-switcher.php:1062 multi-device-switcher.php:1388 msgid "Game Platforms Theme" msgstr "ゲームプラットフォーム用テーマ" -#: multi-device-switcher.php:1098 +#: multi-device-switcher.php:1097 msgid "Custom Switcher Theme" msgstr "Custom Switcher用テーマ" #. translators: confirm: 1: custom switcher name -#: multi-device-switcher.php:1137 +#: multi-device-switcher.php:1136 msgid "Delete" msgstr "削除" #. translators: confirm: 1: custom switcher name -#: multi-device-switcher.php:1137 +#: multi-device-switcher.php:1136 msgid "Are you sure you want to delete %1$s ?" msgstr "%1$s を削除してよろしいですか?" -#: multi-device-switcher.php:1149 -#: multi-device-switcher.php:1151 +#: multi-device-switcher.php:1148 multi-device-switcher.php:1150 msgid "Add Custom Switcher" msgstr "Custom Switcher を追加" -#: multi-device-switcher.php:1153 +#: multi-device-switcher.php:1152 msgid "Add" msgstr "追加" -#: multi-device-switcher.php:1154 +#: multi-device-switcher.php:1153 msgid "20 characters max, alphanumeric" msgstr "半角英数字 20 文字以内" -#: multi-device-switcher.php:1162 +#: multi-device-switcher.php:1161 msgid "UserAgent" msgstr "ユーザーエージェント" -#: multi-device-switcher.php:1163 +#: multi-device-switcher.php:1162 msgid "Enter Comma-separated values (csv) format." msgstr "csv 形式で入力してください。" -#: multi-device-switcher.php:1166 +#: multi-device-switcher.php:1165 msgid "Smart Phone" msgstr "スマートフォン" -#: multi-device-switcher.php:1169 +#: multi-device-switcher.php:1168 msgid "Tablet PC" msgstr "タブレット端末" -#: multi-device-switcher.php:1172 +#: multi-device-switcher.php:1171 msgid "Mobile Phone" msgstr "携帯モバイル端末" -#: multi-device-switcher.php:1175 +#: multi-device-switcher.php:1174 msgid "Game Platforms" msgstr "ゲームプラットフォーム" -#: multi-device-switcher.php:1179 +#: multi-device-switcher.php:1178 msgid "Reset Settings to Default UserAgent" msgstr "ユーザーエージェントをデフォルトにもどす" -#: multi-device-switcher.php:1184 +#: multi-device-switcher.php:1183 msgid "Custom Switcher UserAgent" msgstr "Custom Switcher用ユーザーエージェント" -#: multi-device-switcher.php:1206 -#: pc-switcher-widget.php:57 +#: multi-device-switcher.php:1205 pc-switcher-widget.php:57 msgid "PC Switcher" msgstr "PC Switcher" -#: multi-device-switcher.php:1209 -#: multi-device-switcher.php:1211 +#: multi-device-switcher.php:1208 multi-device-switcher.php:1210 msgid "Add PC Switcher" msgstr "PC Switcher を追加" -#: multi-device-switcher.php:1212 +#: multi-device-switcher.php:1211 msgid "Add a PC Switcher to the footer." msgstr "PC Switcher をフッターに追加する" -#: multi-device-switcher.php:1215 -#: multi-device-switcher.php:1217 +#: multi-device-switcher.php:1214 multi-device-switcher.php:1216 msgid "Add default CSS" msgstr "デフォルトCSSを追加" -#: multi-device-switcher.php:1218 +#: multi-device-switcher.php:1217 msgid "Add a default CSS." msgstr "デフォルトCSSを追加" -#: multi-device-switcher.php:1225 +#: multi-device-switcher.php:1224 msgid "Disable Switcher" msgstr "切り替え無効" -#: multi-device-switcher.php:1228 -#: multi-device-switcher.php:1230 +#: multi-device-switcher.php:1227 multi-device-switcher.php:1229 msgid "Path" msgstr "パス" -#: multi-device-switcher.php:1235 -#: multi-device-switcher.php:1237 +#: multi-device-switcher.php:1234 multi-device-switcher.php:1236 msgid "Regex mode" msgstr "正規表現モード" -#: multi-device-switcher.php:1238 +#: multi-device-switcher.php:1237 msgid "Enable Regex" msgstr "正規表現を有効化" diff --git a/languages/multi-device-switcher.pot b/languages/multi-device-switcher.pot index c567b2d..ffc4a6b 100644 --- a/languages/multi-device-switcher.pot +++ b/languages/multi-device-switcher.pot @@ -1,24 +1,24 @@ # Copyright (C) 2022 thingsym -# This file is distributed under the GPL2 or later. +# This file is distributed under the GPLv2 or later. msgid "" msgstr "" -"Project-Id-Version: Multi Device Switcher 1.8.3\n" +"Project-Id-Version: Multi Device Switcher 1.8.4\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/multi-device-switcher\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-02-28T07:21:41+00:00\n" +"POT-Creation-Date: 2022-11-25T10:39:41+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.5.0\n" "X-Domain: multi-device-switcher\n" #. Plugin Name of the plugin +#: multi-device-switcher.php:754 #: multi-device-switcher.php:755 -#: multi-device-switcher.php:756 -#: multi-device-switcher.php:939 -#: multi-device-switcher.php:1395 +#: multi-device-switcher.php:938 +#: multi-device-switcher.php:1394 msgid "Multi Device Switcher" msgstr "" @@ -48,150 +48,150 @@ msgstr "" msgid "PC" msgstr "" -#: multi-device-switcher.php:801 +#: multi-device-switcher.php:800 msgid "Settings" msgstr "" -#: multi-device-switcher.php:826 +#: multi-device-switcher.php:825 msgid "Become a sponsor" msgstr "" -#: multi-device-switcher.php:961 +#: multi-device-switcher.php:960 msgid "Theme" msgstr "" -#: multi-device-switcher.php:963 -#: multi-device-switcher.php:1386 +#: multi-device-switcher.php:962 +#: multi-device-switcher.php:1385 msgid "Smart Phone Theme" msgstr "" -#: multi-device-switcher.php:972 -#: multi-device-switcher.php:975 -#: multi-device-switcher.php:1005 -#: multi-device-switcher.php:1008 -#: multi-device-switcher.php:1038 -#: multi-device-switcher.php:1041 -#: multi-device-switcher.php:1071 -#: multi-device-switcher.php:1074 -#: multi-device-switcher.php:1118 -#: multi-device-switcher.php:1121 -#: multi-device-switcher.php:1376 -#: multi-device-switcher.php:1431 +#: multi-device-switcher.php:971 +#: multi-device-switcher.php:974 +#: multi-device-switcher.php:1004 +#: multi-device-switcher.php:1007 +#: multi-device-switcher.php:1037 +#: multi-device-switcher.php:1040 +#: multi-device-switcher.php:1070 +#: multi-device-switcher.php:1073 +#: multi-device-switcher.php:1117 +#: multi-device-switcher.php:1120 +#: multi-device-switcher.php:1375 +#: multi-device-switcher.php:1430 msgid "None" msgstr "" -#: multi-device-switcher.php:997 -#: multi-device-switcher.php:1387 +#: multi-device-switcher.php:996 +#: multi-device-switcher.php:1386 msgid "Tablet PC Theme" msgstr "" -#: multi-device-switcher.php:1030 -#: multi-device-switcher.php:1388 +#: multi-device-switcher.php:1029 +#: multi-device-switcher.php:1387 msgid "Mobile Phone Theme" msgstr "" -#: multi-device-switcher.php:1063 -#: multi-device-switcher.php:1389 +#: multi-device-switcher.php:1062 +#: multi-device-switcher.php:1388 msgid "Game Platforms Theme" msgstr "" -#: multi-device-switcher.php:1098 +#: multi-device-switcher.php:1097 msgid "Custom Switcher Theme" msgstr "" #. translators: confirm: 1: custom switcher name -#: multi-device-switcher.php:1137 +#: multi-device-switcher.php:1136 msgid "Delete" msgstr "" #. translators: confirm: 1: custom switcher name -#: multi-device-switcher.php:1137 +#: multi-device-switcher.php:1136 msgid "Are you sure you want to delete %1$s ?" msgstr "" -#: multi-device-switcher.php:1149 -#: multi-device-switcher.php:1151 +#: multi-device-switcher.php:1148 +#: multi-device-switcher.php:1150 msgid "Add Custom Switcher" msgstr "" -#: multi-device-switcher.php:1153 +#: multi-device-switcher.php:1152 msgid "Add" msgstr "" -#: multi-device-switcher.php:1154 +#: multi-device-switcher.php:1153 msgid "20 characters max, alphanumeric" msgstr "" -#: multi-device-switcher.php:1162 +#: multi-device-switcher.php:1161 msgid "UserAgent" msgstr "" -#: multi-device-switcher.php:1163 +#: multi-device-switcher.php:1162 msgid "Enter Comma-separated values (csv) format." msgstr "" -#: multi-device-switcher.php:1166 +#: multi-device-switcher.php:1165 msgid "Smart Phone" msgstr "" -#: multi-device-switcher.php:1169 +#: multi-device-switcher.php:1168 msgid "Tablet PC" msgstr "" -#: multi-device-switcher.php:1172 +#: multi-device-switcher.php:1171 msgid "Mobile Phone" msgstr "" -#: multi-device-switcher.php:1175 +#: multi-device-switcher.php:1174 msgid "Game Platforms" msgstr "" -#: multi-device-switcher.php:1179 +#: multi-device-switcher.php:1178 msgid "Reset Settings to Default UserAgent" msgstr "" -#: multi-device-switcher.php:1184 +#: multi-device-switcher.php:1183 msgid "Custom Switcher UserAgent" msgstr "" -#: multi-device-switcher.php:1206 +#: multi-device-switcher.php:1205 #: pc-switcher-widget.php:57 msgid "PC Switcher" msgstr "" -#: multi-device-switcher.php:1209 -#: multi-device-switcher.php:1211 +#: multi-device-switcher.php:1208 +#: multi-device-switcher.php:1210 msgid "Add PC Switcher" msgstr "" -#: multi-device-switcher.php:1212 +#: multi-device-switcher.php:1211 msgid "Add a PC Switcher to the footer." msgstr "" -#: multi-device-switcher.php:1215 -#: multi-device-switcher.php:1217 +#: multi-device-switcher.php:1214 +#: multi-device-switcher.php:1216 msgid "Add default CSS" msgstr "" -#: multi-device-switcher.php:1218 +#: multi-device-switcher.php:1217 msgid "Add a default CSS." msgstr "" -#: multi-device-switcher.php:1225 +#: multi-device-switcher.php:1224 msgid "Disable Switcher" msgstr "" -#: multi-device-switcher.php:1228 -#: multi-device-switcher.php:1230 +#: multi-device-switcher.php:1227 +#: multi-device-switcher.php:1229 msgid "Path" msgstr "" -#: multi-device-switcher.php:1235 -#: multi-device-switcher.php:1237 +#: multi-device-switcher.php:1234 +#: multi-device-switcher.php:1236 msgid "Regex mode" msgstr "" -#: multi-device-switcher.php:1238 +#: multi-device-switcher.php:1237 msgid "Enable Regex" msgstr "" diff --git a/multi-device-switcher.php b/multi-device-switcher.php index 47466cd..48403a5 100644 --- a/multi-device-switcher.php +++ b/multi-device-switcher.php @@ -3,10 +3,10 @@ * Plugin Name: Multi Device Switcher * Plugin URI: https://github.com/thingsym/multi-device-switcher * Description: This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom). - * Version: 1.8.3 + * Version: 1.8.4 * Author: thingsym * Author URI: https://www.thingslabo.com/ - * License: GPL2 or later + * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html * Text Domain: multi-device-switcher * Domain Path: /languages/ @@ -113,7 +113,7 @@ class Multi_Device_Switcher { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -887,15 +887,15 @@ public function get_options( $option_name = null ) { * * @access public * - * @return void + * @return boolean * * @since 1.6.0 */ public function load_textdomain() { - load_plugin_textdomain( + return load_plugin_textdomain( 'multi-device-switcher', false, - dirname( plugin_basename( __MULTI_DEVICE_SWITCHER_FILE__ ) ) . '/languages/' + plugin_dir_path( __MULTI_DEVICE_SWITCHER_FILE__ ) . 'languages' ); } diff --git a/pc-switcher-widget.php b/pc-switcher-widget.php index fbc644e..1e154bf 100644 --- a/pc-switcher-widget.php +++ b/pc-switcher-widget.php @@ -3,10 +3,10 @@ * Widget Name: PC Switcher Widget * Plugin URI: https://github.com/thingsym/multi-device-switcher * Description: PC Switcher Widget add-on for the Multi Device Switcher. Use this widget to add the PC Switcher to a widget. - * Version: 1.8.3 + * Version: 1.8.4 * Author: thingsym * Author URI: https://www.thingslabo.com/ - * License: GPL2 or later + * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html * Text Domain: multi-device-switcher * Domain Path: /languages/ diff --git a/readme.txt b/readme.txt index 51cf612..6b8e9a6 100644 --- a/readme.txt +++ b/readme.txt @@ -4,18 +4,18 @@ Contributors: thingsym Link: https://github.com/thingsym/multi-device-switcher Donate link: https://github.com/sponsors/thingsym Tags: switcher, theme, ipad, iphone, android, tablet, mobile, game -Stable tag: 1.8.3 -Tested up to: 6.0.0 +Stable tag: 1.8.4 +Tested up to: 6.1.0 Requires at least: 4.9 Requires PHP: 5.6 -License: GPL2 or later +License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html -This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom). +Multi Device Switcher plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom). == Description == -This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom). +Multi Device Switcher plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom). This plugin detects if your site is being viewed by UserAgent, and switches to selected theme. The Custom Switcher can add every device. @@ -29,9 +29,12 @@ The Custom Switcher can add every device. * Can be using **is_multi_device()** function that detect of the device. * **Multi Device Switcher Command** command-line tool (required WP-CLI) -= Test Matrix = += Support = -For operation compatibility between PHP version and WordPress version, see below [Github Actions](https://github.com/thingsym/multi-device-switcher/actions). +If you have any trouble, you can use the forums or report bugs. + +* Forum: [https://wordpress.org/support/plugin/multi-device-switcher/](https://wordpress.org/support/plugin/multi-device-switcher/) +* Issues: [https://github.com/thingsym/multi-device-switcher/issues](https://github.com/thingsym/multi-device-switcher/issues) = Contribution = @@ -39,12 +42,39 @@ Small patches and bug reports can be submitted a issue tracker in Github. Forkin Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors. -If you have created or updated your own language pack, you can send gettext PO and MO files to author. I can bundle it into Multi Device Switcher. +If you have created or updated your own language pack, you can send gettext PO and MO files to author. I can bundle it into plugin. -* [multi-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher) -* [Multi Device Switcher - WordPress Plugin](https://wordpress.org/plugins/multi-device-switcher/) +* [VCS - GitHub](https://github.com/thingsym/multi-device-switcher) +* [Homepage - WordPress Plugin](https://wordpress.org/plugins/multi-device-switcher/) * [Translate Multi Device Switcher into your language.](https://translate.wordpress.org/projects/wp-plugins/multi-device-switcher) -* [Developer Blog (Japanese) - http://blog.thingslabo.com/ ](https://blog.thingslabo.com/archives/category/multi_device_switcher) + +You can also contribute by answering issues on the forums. + +* Forum: [https://wordpress.org/support/plugin/multi-device-switcher/](https://wordpress.org/support/plugin/multi-device-switcher/) +* Issues: [https://github.com/thingsym/multi-device-switcher/issues](https://github.com/thingsym/multi-device-switcher/issues) + += Patches and Bug Fixes = + +Forking on Github is another good way. You can send a pull request. + +1. Fork [Multi Device Switcher](https://github.com/thingsym/multi-device-switcher) from GitHub repository +2. Create a feature branch: git checkout -b my-new-feature +3. Commit your changes: git commit -am 'Add some feature' +4. Push to the branch: git push origin my-new-feature +5. Create new Pull Request + += Contribute guidlines = + +If you would like to contribute, here are some notes and guidlines. + +* All development happens on the **develop** branch, so it is always the most up-to-date +* The **master** branch only contains tagged releases +* If you are going to be submitting a pull request, please submit your pull request to the **develop** branch +* See about [forking](https://help.github.com/articles/fork-a-repo/) and [pull requests](https://help.github.com/articles/using-pull-requests/) + += Test Matrix = + +For operation compatibility between PHP version and WordPress version, see below [Github Actions](https://github.com/thingsym/multi-device-switcher/actions). == Screenshots == @@ -365,6 +395,18 @@ For more information about the Multi Device Switcher Command, see `wp help multi == Changelog == += 1.8.4 = +* tested up to 6.1.0 +* update japanese translation +* update pot +* fix composer.json +* add test case +* update useragent +* fix load_textdomain method for testability +* add msgmerge to composer scripts +* add support section and enhance contribution section +* fix license + = 1.8.3 = * update japanese translation * update pot diff --git a/tests/cli/default.bats b/tests/cli/default.bats index 5da3690..d4a9078 100755 --- a/tests/cli/default.bats +++ b/tests/cli/default.bats @@ -101,7 +101,7 @@ setup() { assert_lines_equal "smartphone (Smart Phone) None iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko" 2 assert_lines_equal "tablet (Tablet PC) None iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko" 3 assert_lines_equal "mobile (Mobile Phone) None DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia" 4 - assert_lines_equal "game (Game Platforms) None PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox" 5 + assert_lines_equal "game (Game Platforms) None PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox" 5 } @test "add Custom Switcher" { diff --git a/tests/test-cdn.php b/tests/test-cdn.php index 601f97a..03cc377 100644 --- a/tests/test-cdn.php +++ b/tests/test-cdn.php @@ -17,7 +17,7 @@ public function setUp() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', diff --git a/tests/test-constructor.php b/tests/test-constructor.php index aba6a24..c87d8c3 100644 --- a/tests/test-constructor.php +++ b/tests/test-constructor.php @@ -33,7 +33,7 @@ function public_variable() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); diff --git a/tests/test-detect-useragent.php b/tests/test-detect-useragent.php new file mode 100644 index 0000000..30eecfb --- /dev/null +++ b/tests/test-detect-useragent.php @@ -0,0 +1,247 @@ +multi_device_switcher = new Multi_Device_Switcher(); + + $options = array( + 'pc_switcher' => 1, + 'default_css' => 1, + 'theme_smartphone' => 'Twenty Sixteen', + 'theme_tablet' => 'Twenty Sixteen', + 'theme_mobile' => 'None', + 'theme_game' => 'None', + 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', + 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', + 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', + 'disable_path' => '', + 'enable_regex' => 0, + 'custom_switcher_theme_tv' => 'Twenty Sixteen', + 'custom_switcher_userAgent_tv' => 'AFTB,AppleTV', + 'custom_switcher_theme_inAppBrowser' => 'Twenty Sixteen', + 'custom_switcher_userAgent_inAppBrowser' => 'Instagram, Line, FBAN, FBAV, MicroMessenger', + ); + + update_option( 'multi_device_switcher_options', $options ); + } + + /** + * @test + * @group detect_useragent + */ + function detect_useragent() { + $useragent_case = array( + array( + 'useragent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', + 'device' => '', + 'massage' => 'Desktop', + ), + array( + 'useragent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36', + 'device' => '', + 'massage' => 'Desktop', + ), + array( + 'useragent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:43.0) Gecko/20100101 Firefox/43.0', + 'device' => '', + 'massage' => 'Desktop', + ), + array( + 'useragent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1', + 'device' => 'smart', + 'massage' => 'iPhone', + ), + array( + 'useragent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/91.0.4472.80 Mobile/15E148 Safari/604.1', + 'device' => 'smart', + 'massage' => 'iPhone', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; Android 11; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36', + 'device' => 'smart', + 'massage' => 'Android', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; Android 11; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36', + 'device' => 'smart', + 'massage' => 'Android', + ), + array( + 'useragent' => 'Mozilla/5.0 (Mobile; LGL25; rv:32.0) Gecko/32.0 Firefox/32.0', + 'device' => 'smart', + 'massage' => 'Firefox', + ), + array( + 'useragent' => 'Mozilla/5.0 (BlackBerry; U; BlackBerry 9320; en-GB) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.398 Mobile Safari/534.11+', + 'device' => 'smart', + 'massage' => 'BlackBerry', + ), + array( + 'useragent' => 'Mozilla/5.0 (iPad; CPU OS 10_0_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A403 Safari/602.1', + 'device' => 'tablet', + 'massage' => 'iPad', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; Android 5.0.2; SM-T530 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Safari/537.36', + 'device' => 'tablet', + 'massage' => 'Android', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1', + 'device' => 'tablet', + 'massage' => 'Kindle Fire', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Silk/1.0.146.3-Gen4_12000410) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Silk-Accelerated=true', + 'device' => 'tablet', + 'massage' => 'Kindle Fire', + ), + array( + 'useragent' => 'DoCoMo/2.0 F2051(c100;TB;serXXXXXXXXXXXXXXX;iccxxxxxxxxxxxxxxxxxxxx)', + 'device' => 'mobile', + 'massage' => 'DoCoMo', + ), + array( + 'useragent' => 'KDDI-HI31 UP.Browser/6.2.0.5 (GUI) MMP/2.0', + 'device' => 'mobile', + 'massage' => 'KDDI', + ), + array( + 'useragent' => 'Vodafone/1.0/V904SH/SHJ001/SN Browser/VF-NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1', + 'device' => 'mobile', + 'massage' => 'SoftBank', + ), + array( + 'useragent' => 'SoftBank/1.0/910T/TJ001/SN Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1', + 'device' => 'mobile', + 'massage' => 'SoftBank', + ), + array( + 'useragent' => 'Mozilla/5.0 (Nintendo WiiU) AppleWebKit/536.28', + 'device' => 'game', + 'massage' => 'Nintendo Wii', + ), + array( + 'useragent' => 'Mozilla/5.0 (PLAYSTATION 3 4.11) AppleWebKit/531.22.8 (KHTML, like Gecko)', + 'device' => 'game', + 'massage' => 'PlayStation 3', + ), + array( + 'useragent' => 'Mozilla/4.0 (PSP (PlayStation Portable); 2.00)', + 'device' => 'game', + 'massage' => 'Playstation Portable', + ), + array( + 'useragent' => 'Mozilla/5.0 (Playstation Vita 2.02) AppleWebKit/536.26 (KHTML, like Gecko) Silk/3.2', + 'device' => 'game', + 'massage' => 'Playstation Vita', + ), + array( + 'useragent' => 'Mozilla/5.0 (PlayStation 4 1.52) AppleWebKit/536.26 (KHTML, like Gecko)', + 'device' => 'game', + 'massage' => 'PlayStation 4', + ), + array( + 'useragent' => 'Mozilla/5.0 (PlayStation 5/SmartTV) AppleWebKit/605.1.15 (KHTML, like Gecko)', + 'device' => 'game', + 'massage' => 'PlayStation 5', + ), + array( + 'useragent' => 'Mozilla/5.0 (PlayStation Vita 1.50) AppleWebKit/531.22.8 (KHTML, like Gecko) Silk/3.2', + 'device' => 'game', + 'massage' => 'PlayStation Vita', + ), + array( + 'useragent' => 'Mozilla/5.0 (Nintendo Switch; ShareApplet) AppleWebKit/601.6 (KHTML, like Gecko) NF/4.0.0.5.9 NintendoBrowser/5.1.0.13341', + 'device' => 'game', + 'massage' => 'Nintendo Switch', + ), + array( + 'useragent' => 'Mozilla/5.0 (Nintendo WiiU) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.4.2.11 NintendoBrowser/4.3.0.11224.US', + 'device' => 'game', + 'massage' => 'Nintendo WiiU', + ), + array( + 'useragent' => 'Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.20 Mobile NintendoBrowser/1.8.10156.US', + 'device' => 'game', + 'massage' => 'Nintendo 3DS', + ), + array( + 'useragent' => 'Mozilla/5.0 (Windows NT 10.0,; Win64; x64; Xbox; Xbox One) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10553', + 'device' => 'game', + 'massage' => 'Xbox', + ), + + // Custom Switcher + array( + 'useragent' => 'Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; AFTB Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', + 'device' => 'custom_switcher_tv', + 'massage' => 'Amazon Fire TV', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; Android 4.2.2; AFTB Build/JDQ39) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.173 Mobile Safari/537.22', + 'device' => 'custom_switcher_tv', + 'massage' => 'Amazon Fire TV', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; Android 4.2.2; AFTB Build/JDQ39) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.173 Mobile Safari/537.22 cordova-amazon-fireos/3.4.0 AmazonWebAppPlatform/3.4.0;2.0', + 'device' => 'custom_switcher_tv', + 'massage' => 'Amazon Fire TV', + ), + array( + 'useragent' => 'AppleTV6,2/11.1', + 'device' => 'custom_switcher_tv', + 'massage' => 'Apple TV', + ), + array( + 'useragent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 [FBAN/FBIOS;FBDV/iPhone13,3;FBMD/iPhone;FBSN/iOS;FBSV/14.5;FBSS/3;FBID/phone;FBLC/ja_JP;FBOP/5]', + 'device' => 'custom_switcher_inAppBrowser', + 'massage' => 'Facebook', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; Android 11; Pixel 4 Build/RQ2A.210405.005; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/90.0.4430.210 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/324.0.0.48.120;]', + 'device' => 'custom_switcher_inAppBrowser', + 'massage' => 'Facebook', + ), + array( + 'useragent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Instagram 193.0.0.29.121 (iPhone13,3; iOS 14_5; ja_JP; ja-JP; scale=3.00; 1170x2532; 299401192) NW/3', + 'device' => 'custom_switcher_inAppBrowser', + 'massage' => 'Instagram', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; Android 11; Pixel 4 Build/RQ2A.210405.005; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/90.0.4430.210 Mobile Safari/537.36 Instagram 193.0.0.45.120 Android (30/11; 440dpi; 1080x2236; Google/google; Pixel 4; flame; flame; ja_JP; 300078998)', + 'device' => 'custom_switcher_inAppBrowser', + 'massage' => 'Instagram', + ), + array( + 'useragent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Safari Line/11.10.0', + 'device' => 'custom_switcher_inAppBrowser', + 'massage' => 'LINE', + ), + array( + 'useragent' => 'Mozilla/5.0 (Linux; Android 11; Pixel 4 Build/RQ2A.210405.005; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/90.0.4430.210 Mobile Safari/537.36 Line/11.10.2/IAB', + 'device' => 'custom_switcher_inAppBrowser', + 'massage' => 'LINE', + ), + array( + 'useragent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.30(0x18001e29) NetType/WIFI Language/zh_TW', + 'device' => 'custom_switcher_inAppBrowser', + 'massage' => 'WeChat', + ), + ); + + foreach ( $useragent_case as $case ) { + $GLOBALS['_SERVER']['HTTP_USER_AGENT'] = $case[ 'useragent' ]; + $this->multi_device_switcher->detect_device(); + $this->assertSame( $case[ 'device' ], $this->multi_device_switcher->device, $case[ 'massage' ] ); + + $this->multi_device_switcher->device = ''; + unset($GLOBALS['_SERVER']['HTTP_USER_AGENT']); + } + } + +} diff --git a/tests/test-functions-detect_device.php b/tests/test-functions-detect_device.php index 29ec570..6c45d4a 100644 --- a/tests/test-functions-detect_device.php +++ b/tests/test-functions-detect_device.php @@ -17,7 +17,7 @@ public function setUp() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', @@ -98,7 +98,7 @@ function detect_device_match_disable_switcher() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => "/test\n/abc\n", 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', diff --git a/tests/test-functions-switch-theme.php b/tests/test-functions-switch-theme.php index a965076..e6c3bcd 100644 --- a/tests/test-functions-switch-theme.php +++ b/tests/test-functions-switch-theme.php @@ -17,7 +17,7 @@ public function setUp() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', diff --git a/tests/test-functions.php b/tests/test-functions.php index b04a1a0..68b3ab9 100644 --- a/tests/test-functions.php +++ b/tests/test-functions.php @@ -17,7 +17,7 @@ public function setUp() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', @@ -43,7 +43,7 @@ function get_options_user_agent() { 'smart' => array('iPhone', 'iPod', 'Android.*Mobile', 'dream', 'CUPCAKE', 'Windows Phone', 'IEMobile.*Touch', 'webOS', 'BB10.*Mobile', 'BlackBerry.*Mobile', 'Mobile.*Gecko'), 'tablet' => array('iPad', 'Kindle', 'Silk', 'Android(?!.*Mobile)', 'Windows.*Touch', 'PlayBook', 'Tablet.*Gecko'), 'mobile' => array('DoCoMo', 'SoftBank', 'J-PHONE', 'Vodafone', 'KDDI', 'UP.Browser', 'WILLCOM', 'emobile', 'DDIPOCKET', 'Windows CE', 'BlackBerry', 'Symbian', 'PalmOS', 'Huawei', 'IAC', 'Nokia'), - 'game' => array('PlayStation Portable', 'PlayStation Vita', 'PSP', 'PS2', 'PLAYSTATION 3', 'PlayStation 4', 'Nitro', 'Nintendo 3DS', 'Nintendo Wii', 'Nintendo WiiU', 'Xbox'), + 'game' => array('PSP', 'PS2', 'PLAYSTATION 3', 'PlayStation (Portable|Vita|4|5)', 'Nitro', 'Nintendo (3DS|Wii|WiiU|Switch)', 'Xbox'), 'custom_switcher_test' => array('test1', 'test2'), ); @@ -159,7 +159,7 @@ function is_disable_switcher() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => "/test\n/abc\n", 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', @@ -184,7 +184,7 @@ function is_disable_switcher() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => "^\/te\nbc$\n", 'enable_regex' => 1, 'custom_switcher_theme_test' => 'Twenty Sixteen', @@ -352,9 +352,41 @@ function load_file() { * @test * @group functions */ - function load_textdomain() { - $result = $this->multi_device_switcher->load_textdomain(); - $this->assertNull( $result ); + public function load_textdomain() { + $loaded = $this->multi_device_switcher->load_textdomain(); + $this->assertFalse( $loaded ); + + unload_textdomain( 'multi-device-switcher' ); + + add_filter( 'locale', [ $this, '_change_locale' ] ); + add_filter( 'load_textdomain_mofile', [ $this, '_change_textdomain_mofile' ], 10, 2 ); + + $loaded = $this->multi_device_switcher->load_textdomain(); + $this->assertTrue( $loaded ); + + remove_filter( 'load_textdomain_mofile', [ $this, '_change_textdomain_mofile' ] ); + remove_filter( 'locale', [ $this, '_change_locale' ] ); + + unload_textdomain( 'multi-device-switcher' ); + } + + /** + * hook for load_textdomain + */ + function _change_locale( $locale ) { + return 'ja'; + } + + function _change_textdomain_mofile( $mofile, $domain ) { + if ( $domain === 'multi-device-switcher' ) { + $locale = determine_locale(); + $mofile = plugin_dir_path( __MULTI_DEVICE_SWITCHER_FILE__ ) . 'languages/multi-device-switcher-' . $locale . '.mo'; + + $this->assertSame( $locale, get_locale() ); + $this->assertFileExists( $mofile ); + } + + return $mofile; } /** diff --git a/tests/test-local-functions.php b/tests/test-local-functions.php index 7e3f48d..8673a4c 100644 --- a/tests/test-local-functions.php +++ b/tests/test-local-functions.php @@ -17,7 +17,7 @@ public function setUp() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', @@ -92,7 +92,7 @@ function local_multi_device_switcher_get_default_options() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); diff --git a/tests/test-options.php b/tests/test-options.php index bbda923..1b162fe 100644 --- a/tests/test-options.php +++ b/tests/test-options.php @@ -22,7 +22,7 @@ function get_default_options() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -63,7 +63,7 @@ function get_options_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -89,7 +89,7 @@ public function get_options_case_filters() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); diff --git a/tests/test-pc-switcher-widget.php b/tests/test-pc-switcher-widget.php index 473286f..2463aab 100644 --- a/tests/test-pc-switcher-widget.php +++ b/tests/test-pc-switcher-widget.php @@ -58,9 +58,9 @@ function widget() { $widget = ob_get_clean(); // var_dump($widget); - // $this->assertRegExp( '#

aaaaa

#', $widget ); + // $this->assertMatchesRegularExpression( '#

aaaaa

#', $widget ); - // $this->markTestIncomplete( 'This test has not been implemented yet.' ); + $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** @@ -68,7 +68,12 @@ function widget() { * @group widget */ function update_case() { - $this->markTestIncomplete( 'This test has not been implemented yet.' ); + $new_instance = array(); + $expected = array(); + + $validate = $this->pc_switcher->update( $new_instance, array() ); + + $this->assertSame( $validate, $expected ); } /** diff --git a/tests/test-shortcode.php b/tests/test-shortcode.php index 25cf0c4..954f52f 100644 --- a/tests/test-shortcode.php +++ b/tests/test-shortcode.php @@ -17,7 +17,7 @@ public function setUp() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', diff --git a/tests/test-validate.php b/tests/test-validate.php index c2d4a73..fc86660 100644 --- a/tests/test-validate.php +++ b/tests/test-validate.php @@ -23,7 +23,7 @@ function validate_case_none() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -49,7 +49,7 @@ function validate_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -63,7 +63,7 @@ function validate_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -104,7 +104,7 @@ function validate_restore_useragent_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -130,7 +130,7 @@ function validate_add_custom_switcher_theme_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'add_custom_switcher' => 'Add', @@ -146,7 +146,7 @@ function validate_add_custom_switcher_theme_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'None', @@ -178,7 +178,7 @@ function validate_add_custom_switcher_theme_case_2() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'add_custom_switcher' => 'Add', @@ -194,7 +194,7 @@ function validate_add_custom_switcher_theme_case_2() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -222,7 +222,7 @@ function validate_add_custom_switcher_theme_case_3() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'add_custom_switcher' => 'Add', @@ -238,7 +238,7 @@ function validate_add_custom_switcher_theme_case_3() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -266,7 +266,7 @@ function validate_delete_custom_switcher_theme_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'delete_custom_switcher_test' => 'Delete', @@ -283,7 +283,7 @@ function validate_delete_custom_switcher_theme_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -311,7 +311,7 @@ function validate_add_custom_switcher_useragent_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', @@ -327,7 +327,7 @@ function validate_add_custom_switcher_useragent_case_1() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, 'custom_switcher_theme_test' => 'Twenty Sixteen', @@ -357,7 +357,7 @@ function validate_case_via_filter() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, ); @@ -371,7 +371,7 @@ function validate_case_via_filter() { 'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko', 'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko', 'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia', - 'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox', + 'userAgent_game' => 'PSP, PS2, PLAYSTATION 3, PlayStation (Portable|Vita|4|5), Nitro, Nintendo (3DS|Wii|WiiU|Switch), Xbox', 'disable_path' => '', 'enable_regex' => 0, );