Multi Device Switcher - Version 1.6.0

Version Description

  • change Requires at least version 3.7
  • remove cache with PC Switcher widget
  • add init function
  • change hook destination from plugin_action_links to plugin_action_links_{$plugin_file}
  • add load_textdomain function
  • add define variable MULTI_DEVICE_SWITCHER_FILE
  • check class Multi_Device_Switcher
  • check ABSPATH
  • add isset to conditional statement
  • fix boolean
  • add tests
Download this release

Release Info

Developer thingsym
Plugin Icon wp plugin Multi Device Switcher
Version 1.6.0
Comparing to
See all releases

Code changes from version 1.5.4 to 1.6.0

Files changed (4) hide show
  1. multi-device-switcher.php +64 -29
  2. pc-switcher-widget.php +7 -36
  3. readme.md +30 -16
  4. readme.txt +49 -16
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.5.4
7
  * Author: thingsym
8
  * Author URI: http://www.thingslabo.com/
9
  * License: GPL2
@@ -29,6 +29,10 @@
29
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
30
  */
31
 
 
 
 
 
32
  class Multi_Device_Switcher {
33
  protected $option_group = 'multi_device_switcher';
34
  protected $option_name = 'multi_device_switcher_options';
@@ -39,7 +43,6 @@ class Multi_Device_Switcher {
39
  protected $capability = 'switch_themes';
40
 
41
  protected $textdomain = 'multi-device-switcher';
42
- protected $languages_path = 'multi-device-switcher/languages';
43
 
44
  protected $cookie_name_multi_device_switcher = 'multi-device-switcher';
45
  protected $cookie_name_disable_switcher = 'disable-switcher';
@@ -48,14 +51,15 @@ class Multi_Device_Switcher {
48
  public $device = '';
49
 
50
  public function __construct() {
 
 
 
51
  if ( is_admin() ) {
52
  add_action( 'admin_init', array( $this, 'admin_init' ) );
53
- add_filter( 'option_page_capability_' . $this->option_group, array( $this, 'option_page_capability' ) );
54
  add_action( 'admin_menu', array( $this, 'add_option_page' ) );
55
  }
56
  else {
57
  add_filter( 'wp_headers', array( $this, 'add_header_vary' ) );
58
- add_shortcode( 'multi', array( $this, 'shortcode_display_switcher' ) );
59
  add_action( 'plugins_loaded', array( $this, 'switch_theme' ) );
60
  }
61
 
@@ -63,6 +67,22 @@ class Multi_Device_Switcher {
63
  add_action( 'plugins_loaded', array( $this, 'load_file' ) );
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  public function switch_theme() {
67
 
68
  if ( isset( $_COOKIE[ $this->cookie_name_disable_switcher ] ) ) {
@@ -106,8 +126,6 @@ class Multi_Device_Switcher {
106
  }
107
 
108
  if ( $this->device ) {
109
- load_plugin_textdomain( $this->textdomain, false, $this->languages_path );
110
-
111
  add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
112
  add_filter( 'template', array( $this, 'get_template' ) );
113
  add_action( 'wp_footer', array( $this, 'add_pc_switcher' ) );
@@ -277,33 +295,33 @@ class Multi_Device_Switcher {
277
 
278
  public function is_multi_device( $device = '' ) {
279
  if ( $device === $this->device ) {
280
- return 1;
281
  }
282
  if ( 'custom_switcher_' . $device === $this->device ) {
283
- return 1;
284
  }
285
 
286
- return 0;
287
  }
288
 
289
  public function is_pc_switcher() {
290
  return isset( $_COOKIE[ $this->cookie_name_pc_switcher ] );
291
  }
292
 
293
- public function is_disable_switcher( $disable = 0 ) {
294
  $options = $this->get_options();
295
  $disable_path = preg_split( '/\R/', $options['disable_path'], -1, PREG_SPLIT_NO_EMPTY );
296
 
297
  foreach ( $disable_path as $path ) {
298
  if ( $options['enable_regex'] ) {
299
  if ( preg_match( '/' . $path . '/i', $_SERVER['REQUEST_URI'] ) ) {
300
- $disable = 1;
301
  break;
302
  }
303
  }
304
  else {
305
  if ( preg_match( '/^' . preg_quote( $path , '/' ) . '$/i', $_SERVER['REQUEST_URI'] ) ) {
306
- $disable = 1;
307
  break;
308
  }
309
  }
@@ -411,9 +429,6 @@ class Multi_Device_Switcher {
411
  * @since 1.0
412
  */
413
  public function add_option_page() {
414
- load_plugin_textdomain( $this->textdomain, false, $this->languages_path );
415
-
416
- add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
417
 
418
  $page_hook = add_theme_page(
419
  __( $this->page_title, $this->textdomain ),
@@ -443,15 +458,21 @@ class Multi_Device_Switcher {
443
  }
444
 
445
  /**
446
- * Add the settings link to the plugin page.
 
 
 
 
447
  *
448
- * @since 1.2
 
 
 
 
 
 
449
  */
450
- public function plugin_action_links( $links, $file ) {
451
- if ( plugin_basename( __FILE__ ) !== $file ) {
452
- return $links;
453
- }
454
-
455
  $settings_link = '<a href="themes.php?page=multi-device-switcher">' . __( 'Settings', $this->textdomain ) . '</a>';
456
 
457
  array_unshift( $links, $settings_link );
@@ -535,6 +556,19 @@ class Multi_Device_Switcher {
535
  return $options;
536
  }
537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  /**
539
  * Rendering Options Setting Page.
540
  *
@@ -941,7 +975,7 @@ class Multi_Device_Switcher {
941
  unset( $output[ 'custom_switcher_userAgent_' . $custom_switcher_name ] );
942
  }
943
 
944
- if ( isset( $input['add_custom_switcher'] ) && ! empty( $input['custom_switcher'] ) && ! $output[ 'custom_switcher_theme_' . $input['custom_switcher'] ] ) {
945
  if ( ! in_array( $input['custom_switcher'], array( 'smartphone', 'smart', 'tablet', 'mobile', 'game' ) )
946
  && preg_match( '/^[A-Za-z0-9]{1,20}$/', $input['custom_switcher'] ) ) {
947
  $output[ 'custom_switcher_theme_' . $input['custom_switcher'] ] = 'None';
@@ -967,7 +1001,6 @@ class Multi_Device_Switcher {
967
  * @since 1.3.1
968
  */
969
  public function customize_register( $wp_customize ) {
970
- load_plugin_textdomain( $this->textdomain, false, $this->languages_path );
971
  $options = $this->get_options();
972
  $default_theme_options = $this->get_default_options();
973
  $default_theme = wp_get_theme()->get( 'Name' );
@@ -1048,7 +1081,7 @@ class Multi_Device_Switcher {
1048
  * @since 1.2
1049
  *
1050
  */
1051
- require_once( dirname( __FILE__ ) . '/pc-switcher-widget.php' );
1052
 
1053
  /**
1054
  * include Multi Device Switcher Command
@@ -1057,12 +1090,16 @@ class Multi_Device_Switcher {
1057
  *
1058
  */
1059
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
1060
- require_once( dirname( __FILE__ ) . '/wp-cli.php' );
1061
  }
1062
  }
1063
  }
1064
 
1065
- $multi_device_switcher = new Multi_Device_Switcher();
 
 
 
 
1066
 
1067
  /**
1068
  * Add PC Switcher.
@@ -1139,5 +1176,3 @@ function multi_device_switcher_get_default_options() {
1139
  }
1140
  }
1141
  endif;
1142
-
1143
- ?>
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.6.0
7
  * Author: thingsym
8
  * Author URI: http://www.thingslabo.com/
9
  * License: GPL2
29
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
30
  */
31
 
32
+ if ( ! defined( 'ABSPATH' ) ) {
33
+ exit;
34
+ }
35
+
36
  class Multi_Device_Switcher {
37
  protected $option_group = 'multi_device_switcher';
38
  protected $option_name = 'multi_device_switcher_options';
43
  protected $capability = 'switch_themes';
44
 
45
  protected $textdomain = 'multi-device-switcher';
 
46
 
47
  protected $cookie_name_multi_device_switcher = 'multi-device-switcher';
48
  protected $cookie_name_disable_switcher = 'disable-switcher';
51
  public $device = '';
52
 
53
  public function __construct() {
54
+ add_action( 'init', array( $this, 'load_textdomain' ) );
55
+ add_action( 'init', array( $this, 'init' ) );
56
+
57
  if ( is_admin() ) {
58
  add_action( 'admin_init', array( $this, 'admin_init' ) );
 
59
  add_action( 'admin_menu', array( $this, 'add_option_page' ) );
60
  }
61
  else {
62
  add_filter( 'wp_headers', array( $this, 'add_header_vary' ) );
 
63
  add_action( 'plugins_loaded', array( $this, 'switch_theme' ) );
64
  }
65
 
67
  add_action( 'plugins_loaded', array( $this, 'load_file' ) );
68
  }
69
 
70
+ /**
71
+ * Initialize.
72
+ *
73
+ * Hooks to init
74
+ *
75
+ * @access public
76
+ *
77
+ * @since 1.6.0
78
+ */
79
+ public function init() {
80
+ add_filter( 'option_page_capability_' . $this->option_group, array( $this, 'option_page_capability' ) );
81
+ add_filter( 'plugin_action_links_' . plugin_basename( __MULTI_DEVICE_SWITCHER_FILE__ ), array( $this, 'plugin_action_links' ) );
82
+
83
+ add_shortcode( 'multi', array( $this, 'shortcode_display_switcher' ) );
84
+ }
85
+
86
  public function switch_theme() {
87
 
88
  if ( isset( $_COOKIE[ $this->cookie_name_disable_switcher ] ) ) {
126
  }
127
 
128
  if ( $this->device ) {
 
 
129
  add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
130
  add_filter( 'template', array( $this, 'get_template' ) );
131
  add_action( 'wp_footer', array( $this, 'add_pc_switcher' ) );
295
 
296
  public function is_multi_device( $device = '' ) {
297
  if ( $device === $this->device ) {
298
+ return true;
299
  }
300
  if ( 'custom_switcher_' . $device === $this->device ) {
301
+ return true;
302
  }
303
 
304
+ return false;
305
  }
306
 
307
  public function is_pc_switcher() {
308
  return isset( $_COOKIE[ $this->cookie_name_pc_switcher ] );
309
  }
310
 
311
+ public function is_disable_switcher( $disable = false ) {
312
  $options = $this->get_options();
313
  $disable_path = preg_split( '/\R/', $options['disable_path'], -1, PREG_SPLIT_NO_EMPTY );
314
 
315
  foreach ( $disable_path as $path ) {
316
  if ( $options['enable_regex'] ) {
317
  if ( preg_match( '/' . $path . '/i', $_SERVER['REQUEST_URI'] ) ) {
318
+ $disable = true;
319
  break;
320
  }
321
  }
322
  else {
323
  if ( preg_match( '/^' . preg_quote( $path , '/' ) . '$/i', $_SERVER['REQUEST_URI'] ) ) {
324
+ $disable = true;
325
  break;
326
  }
327
  }
429
  * @since 1.0
430
  */
431
  public function add_option_page() {
 
 
 
432
 
433
  $page_hook = add_theme_page(
434
  __( $this->page_title, $this->textdomain ),
458
  }
459
 
460
  /**
461
+ * Set link to customizer section on the plugins page.
462
+ *
463
+ * Hooks to plugin_action_links_{$plugin_file}
464
+ *
465
+ * @see https://developer.wordpress.org/reference/hooks/plugin_action_links_plugin_file/
466
  *
467
+ * @access public
468
+ *
469
+ * @param array $links An array of plugin action links.
470
+ *
471
+ * @return array $links
472
+ *
473
+ * @since 1.6.0
474
  */
475
+ public function plugin_action_links( $links = array() ) {
 
 
 
 
476
  $settings_link = '<a href="themes.php?page=multi-device-switcher">' . __( 'Settings', $this->textdomain ) . '</a>';
477
 
478
  array_unshift( $links, $settings_link );
556
  return $options;
557
  }
558
 
559
+ /**
560
+ * Load textdomain
561
+ *
562
+ * @access public
563
+ *
564
+ * @return void
565
+ *
566
+ * @since 1.6.0
567
+ */
568
+ public function load_textdomain() {
569
+ load_plugin_textdomain( 'multi-device-switcher', false, dirname( plugin_basename( __MULTI_DEVICE_SWITCHER_FILE__ ) ) . '/languages/' );
570
+ }
571
+
572
  /**
573
  * Rendering Options Setting Page.
574
  *
975
  unset( $output[ 'custom_switcher_userAgent_' . $custom_switcher_name ] );
976
  }
977
 
978
+ if ( isset( $input['add_custom_switcher'] ) && ! empty( $input['custom_switcher'] ) && ! isset( $output[ 'custom_switcher_theme_' . $input['custom_switcher'] ] ) ) {
979
  if ( ! in_array( $input['custom_switcher'], array( 'smartphone', 'smart', 'tablet', 'mobile', 'game' ) )
980
  && preg_match( '/^[A-Za-z0-9]{1,20}$/', $input['custom_switcher'] ) ) {
981
  $output[ 'custom_switcher_theme_' . $input['custom_switcher'] ] = 'None';
1001
  * @since 1.3.1
1002
  */
1003
  public function customize_register( $wp_customize ) {
 
1004
  $options = $this->get_options();
1005
  $default_theme_options = $this->get_default_options();
1006
  $default_theme = wp_get_theme()->get( 'Name' );
1081
  * @since 1.2
1082
  *
1083
  */
1084
+ require_once( dirname( __MULTI_DEVICE_SWITCHER_FILE__ ) . '/pc-switcher-widget.php' );
1085
 
1086
  /**
1087
  * include Multi Device Switcher Command
1090
  *
1091
  */
1092
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
1093
+ require_once( dirname( __MULTI_DEVICE_SWITCHER_FILE__ ) . '/wp-cli.php' );
1094
  }
1095
  }
1096
  }
1097
 
1098
+ define( '__MULTI_DEVICE_SWITCHER_FILE__', __FILE__ );
1099
+
1100
+ if ( class_exists( 'Multi_Device_Switcher' ) ) {
1101
+ $multi_device_switcher = new Multi_Device_Switcher();
1102
+ };
1103
 
1104
  /**
1105
  * Add PC Switcher.
1176
  }
1177
  }
1178
  endif;
 
 
pc-switcher-widget.php CHANGED
@@ -3,7 +3,7 @@
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.5.4
7
  * Author: thingsym
8
  * Author URI: http://www.thingslabo.com/
9
  * License: GPL2
@@ -45,14 +45,14 @@ function pc_switcher_load_widgets() {
45
  class PC_Switcher extends WP_Widget {
46
 
47
  function __construct() {
48
- load_plugin_textdomain( 'multi-device-switcher', false, 'multi-device-switcher/languages' );
49
- $widget_ops = array( 'classname' => 'widget_pc_switcher', 'description' => __( 'Add the PC Switcher to a widget.', 'multi-device-switcher' ) );
 
 
 
 
50
  parent::__construct( 'pc-switcher', __( 'PC Switcher', 'multi-device-switcher' ), $widget_ops );
51
  $this->alt_option_name = 'widget_pc_switcher';
52
-
53
- add_action( 'save_post', array( &$this, 'flush_widget_cache' ) );
54
- add_action( 'deleted_post', array( &$this, 'flush_widget_cache' ) );
55
- add_action( 'switch_theme', array( &$this, 'flush_widget_cache' ) );
56
  }
57
 
58
  function widget( $args, $instance ) {
@@ -64,47 +64,18 @@ class PC_Switcher extends WP_Widget {
64
  $name = $multi_device_switcher->get_device_theme();
65
 
66
  if ( $name && 'None' !== $name ) {
67
-
68
- $cache = wp_cache_get( 'widget_pc_switcher', 'widget' );
69
-
70
- if ( ! is_array( $cache ) ) {
71
- $cache = array();
72
- }
73
-
74
- if ( isset( $cache[ $args['widget_id'] ] ) ) {
75
- echo $cache[ $args['widget_id'] ];
76
- return;
77
- }
78
-
79
- ob_start();
80
-
81
  echo $args['before_widget'];
82
  multi_device_switcher_add_pc_switcher();
83
  echo $args['after_widget'];
84
-
85
- $cache[ $args['widget_id'] ] = ob_get_flush();
86
- wp_cache_set( 'widget_pc_switcher', $cache, 'widget' );
87
  }
88
  }
89
 
90
  function update( $new_instance, $old_instance ) {
91
  $instance = $old_instance;
92
 
93
- $this->flush_widget_cache();
94
-
95
- $alloptions = wp_cache_get( 'alloptions', 'options' );
96
- if ( isset( $alloptions['widget_pc_switcher'] ) ) {
97
- delete_option( 'widget_pc_switcher' );
98
- }
99
-
100
  return $instance;
101
  }
102
 
103
- function flush_widget_cache() {
104
- wp_cache_delete( 'widget_pc_switcher', 'widget' );
105
- }
106
-
107
  function form( $instance ) {
108
  }
109
  }
110
- ?>
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.6.0
7
  * Author: thingsym
8
  * Author URI: http://www.thingslabo.com/
9
  * License: GPL2
45
  class PC_Switcher extends WP_Widget {
46
 
47
  function __construct() {
48
+ load_plugin_textdomain( 'multi-device-switcher', false, dirname( plugin_basename( __MULTI_DEVICE_SWITCHER_FILE__ ) ) . '/languages/' );
49
+
50
+ $widget_ops = array(
51
+ 'classname' => 'widget_pc_switcher',
52
+ 'description' => __( 'Add the PC Switcher to a widget.', 'multi-device-switcher' )
53
+ );
54
  parent::__construct( 'pc-switcher', __( 'PC Switcher', 'multi-device-switcher' ), $widget_ops );
55
  $this->alt_option_name = 'widget_pc_switcher';
 
 
 
 
56
  }
57
 
58
  function widget( $args, $instance ) {
64
  $name = $multi_device_switcher->get_device_theme();
65
 
66
  if ( $name && 'None' !== $name ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  echo $args['before_widget'];
68
  multi_device_switcher_add_pc_switcher();
69
  echo $args['after_widget'];
 
 
 
70
  }
71
  }
72
 
73
  function update( $new_instance, $old_instance ) {
74
  $instance = $old_instance;
75
 
 
 
 
 
 
 
 
76
  return $instance;
77
  }
78
 
 
 
 
 
79
  function form( $instance ) {
80
  }
81
  }
 
readme.md CHANGED
@@ -1,5 +1,9 @@
1
  # Introducing Multi Device Switcher
2
 
 
 
 
 
3
  This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom).
4
  This plugin detects if your site is being viewed by UserAgent, and switches to selected theme. The Custom Switcher can add every device.
5
 
@@ -366,32 +370,40 @@ turn on default CSS
366
 
367
  wp multi-device css on
368
 
369
- ## Contributing
370
 
371
- ### Patches and Bug Fixes
372
-
373
- 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.
374
 
375
- ### Translations
376
 
377
- [Translate Multi Device Switcher into your language.](https://translate.wordpress.org/projects/wp-plugins/multi-device-switcher)
378
 
379
  Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors.
380
 
381
  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.
382
 
383
- ##### Send your own language pack
384
-
385
- You can send your own language pack to author.
386
-
387
- - [multi-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher)
388
- - [http://blog.thingslabo.com (ja)](https://blog.thingslabo.com/archives/category/multi_device_switcher)
389
 
390
  ## Changelog
391
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  * Version 1.5.4
393
  * fixed: fix property keyword for testability
394
- * fixed: fix add_action 'customize_register' with __construct()
395
  * fixed: fix capability
396
  * Version 1.5.3
397
  * fixed: add function multi_device_switcher_get_default_options for wp multi-device [#9](https://github.com/thingsym/multi-device-switcher/pull/9)
@@ -453,7 +465,7 @@ You can send your own language pack to author.
453
  * Version 1.1.0
454
  * new features: Custom Switcher
455
  * Version 1.0.4
456
- * fixed: fix the object model PHP5, __construct() to replace Multi_Device_Switcher
457
  * fixed: wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme()
458
  * Version 1.0.3
459
  * updated: update screenshots
@@ -469,5 +481,7 @@ You can send your own language pack to author.
469
 
470
  ## Upgrade Notice
471
 
472
- * 1.1.2
473
- * Requires at least version 3.4 of the Wordpress
 
 
1
  # Introducing Multi Device Switcher
2
 
3
+ [![Build Status](https://travis-ci.org/thingsym/multi-device-switcher.svg?branch=master)](https://travis-ci.org/thingsym/multi-device-switcher)
4
+
5
+ [![WordPress](https://img.shields.io/wordpress/v/multi-device-switcher.svg)](https://wordpress.org/plugins/multi-device-switcher/)
6
+
7
  This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom).
8
  This plugin detects if your site is being viewed by UserAgent, and switches to selected theme. The Custom Switcher can add every device.
9
 
370
 
371
  wp multi-device css on
372
 
373
+ ## Test Matrix
374
 
375
+ For operation compatibility between PHP version and WordPress version, see below [Travis CI](https://travis-ci.org/thingsym/multi-device-switcher).
 
 
376
 
377
+ ## Contribution
378
 
379
+ 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.
380
 
381
  Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors.
382
 
383
  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.
384
 
385
+ * [multi-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher)
386
+ * [Multi Device Switcher - WordPress Plugin](https://wordpress.org/plugins/multi-device-switcher/)
387
+ * [Translate Multi Device Switcher into your language.](https://translate.wordpress.org/projects/wp-plugins/multi-device-switcher)
388
+ * [Developer Blog (Japanese) - http://blog.thingslabo.com/ ](https://blog.thingslabo.com/archives/category/multi_device_switcher)
 
 
389
 
390
  ## Changelog
391
 
392
+ * Version 1.6.0
393
+ * change Requires at least version 3.7
394
+ * remove cache with PC Switcher widget
395
+ * add init function
396
+ * change hook destination from plugin_action_links to plugin_action_links_{$plugin_file}
397
+ * add load_textdomain function
398
+ * add define variable __MULTI_DEVICE_SWITCHER_FILE__
399
+ * check class Multi_Device_Switcher
400
+ * check ABSPATH
401
+ * add isset to conditional statement
402
+ * fix boolean
403
+ * add tests
404
  * Version 1.5.4
405
  * fixed: fix property keyword for testability
406
+ * fixed: fix add_action 'customize_register' with \_\_construct()
407
  * fixed: fix capability
408
  * Version 1.5.3
409
  * fixed: add function multi_device_switcher_get_default_options for wp multi-device [#9](https://github.com/thingsym/multi-device-switcher/pull/9)
465
  * Version 1.1.0
466
  * new features: Custom Switcher
467
  * Version 1.0.4
468
+ * fixed: fix the object model PHP5, \_\_construct() to replace Multi_Device_Switcher
469
  * fixed: wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme()
470
  * Version 1.0.3
471
  * updated: update screenshots
481
 
482
  ## Upgrade Notice
483
 
484
+ * Version 1.6.0
485
+ * Requires at least version 3.7 of the WordPress
486
+ * Version 1.1.2
487
+ * Requires at least version 3.4 of the WordPress
readme.txt CHANGED
@@ -4,9 +4,10 @@ Contributors: thingsym
4
  Donate link: http://blog.thingslabo.com/archives/000251.html
5
  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: 4.7.4
9
- Stable tag: 1.5.4
 
10
  License: GPL2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -29,26 +30,22 @@ The Custom Switcher can add every device.
29
  * Can be using **is_multi_device()** function that detect of the device.
30
  * **Multi Device Switcher Command** command-line tool (required WP-CLI)
31
 
32
- = Contributing =
33
 
34
- = Patches and Bug Fixes =
35
 
36
- 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.
37
-
38
- = Translations =
39
 
40
- [Translate Multi Device Switcher into your language.](https://translate.wordpress.org/projects/wp-plugins/multi-device-switcher)
41
 
42
  Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors.
43
 
44
  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.
45
 
46
- = Send your own language pack =
47
-
48
- You can send your own language pack to author.
49
-
50
  * [multi-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher)
51
- - [http://blog.thingslabo.com (ja)](https://blog.thingslabo.com/archives/category/multi_device_switcher)
 
 
52
 
53
  == Screenshots ==
54
 
@@ -359,29 +356,49 @@ For more information about the Multi Device Switcher Command, see `wp help multi
359
 
360
  == Changelog ==
361
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  = 1.5.4 =
363
  * fixed: fix property keyword for testability
364
- * fixed: fix add_action 'customize_register' with __construct()
365
  * fixed: fix capability
 
366
  = 1.5.3 =
367
  * fixed: add function multi_device_switcher_get_default_options for wp multi-device [#9](https://github.com/thingsym/multi-device-switcher/pull/9)
 
368
  = 1.5.2 =
369
  * fixed: fix setcookie() [#8](https://github.com/thingsym/multi-device-switcher/pull/8)
 
370
  = 1.5.1 =
371
  * fixed: fix preg_split()
 
372
  = 1.5.0 =
373
  * fixed: refactoring by the PHP_CodeSniffer
374
  * fixed: change admin functions to class/object methods
 
375
  = 1.4.2 =
376
  * edited: edit readme
377
  * new features: Display Switcher Shortcode
378
  * updated: update default UserAgent
379
  * fixed: fix pc-switcher ssl url
 
380
  = 1.4.1 =
381
  * edited: edit readme
382
  * new features: is_disable_switcher() function
383
  * new features: is_pc_switcher() function
384
  * fixed: fix redirect url and pc-switcher url
 
385
  = 1.4.0 =
386
  * edited: edit readme
387
  * added: add cookies 'multi-device-switcher', 'disable-switcher'
@@ -391,6 +408,7 @@ For more information about the Multi Device Switcher Command, see `wp help multi
391
  * new features: Multi Device Switcher Command
392
  * added: add option settings into Theme Customizer
393
  * fixed: refactoring by the PHP_CodeSniffer
 
394
  = 1.3.0 =
395
  * fixed: fix script, style, html and readme
396
  * new features: is_multi_device() function
@@ -399,45 +417,60 @@ For more information about the Multi Device Switcher Command, see `wp help multi
399
  * fixed: replace WP_PLUGIN_URL with plugins_url()
400
  * fixed: using Page Hook Suffix
401
  * merged: pull request [#3](https://github.com/thingsym/multi-device-switcher/pull/3)
 
402
  = 1.2.3 =
403
  * fixed: fix redirect uri with query string, using add_query_arg
404
  * fixed: fix translation
405
  * fixed: fix readme
 
406
  = 1.2.2 =
407
  * improved: improve responsiveness UI
408
  * fixed: fix html
 
409
  = 1.2.1 =
410
  * fixed: delete add_contextual_help
411
  * fixed: fix readme and html
 
412
  = 1.2.0 =
413
  * added: add PC Switcher Widget
414
  * new features: PC Switcher
415
  * added: add the settings link to the plugin page
 
416
  = 1.1.2 =
417
  * required: at least version 3.4
418
  * fixed: fix tabs and buttons
 
419
  = 1.1.1 =
420
  * fixed: change the order of the UserAgent detection
421
  * updated: update default UserAgent
422
  * added: add HTTP/1.1 Vary header
 
423
  = 1.1.0 =
424
  * new features: Custom Switcher
 
425
  = 1.0.4 =
426
  * fixed: fix the object model PHP5, __construct() to replace Multi_Device_Switcher
427
  * fixed: wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme()
 
428
  = 1.0.3 =
429
  * updated: update screenshots
430
  * fixed: fix reset button
 
431
  = 1.0.2 =
432
  * added: add file uninstall.php
433
  * fixed: split admin_enqueue_scripts() into two functions
434
  * fixed: detects is_admin()
 
435
  = 1.0.1 =
436
  * fixed: split multi_device_switcher_init() into two functions
 
437
  = 1.0.0 =
438
  * Initial release.
439
 
440
  == Upgrade Notice ==
441
 
 
 
 
442
  = 1.1.2 =
443
- * Requires at least version 3.4 of the Wordpress
4
  Donate link: http://blog.thingslabo.com/archives/000251.html
5
  Link: https://github.com/thingsym/multi-device-switcher
6
  Tags: switcher, theme, ipad, iphone, android, tablet, mobile, game
7
+ Requires at least: 3.7
8
+ Requires PHP: 5.4
9
+ Tested up to: 4.9
10
+ Stable tag: 1.6.0
11
  License: GPL2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
30
  * Can be using **is_multi_device()** function that detect of the device.
31
  * **Multi Device Switcher Command** command-line tool (required WP-CLI)
32
 
33
+ = Test Matrix =
34
 
35
+ For operation compatibility between PHP version and WordPress version, see below [Travis CI](https://travis-ci.org/thingsym/multi-device-switcher).
36
 
37
+ = Contribution =
 
 
38
 
39
+ 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.
40
 
41
  Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors.
42
 
43
  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.
44
 
 
 
 
 
45
  * [multi-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher)
46
+ * [Multi Device Switcher - WordPress Plugin](https://wordpress.org/plugins/multi-device-switcher/)
47
+ * [Translate Multi Device Switcher into your language.](https://translate.wordpress.org/projects/wp-plugins/multi-device-switcher)
48
+ * [Developer Blog (Japanese) - http://blog.thingslabo.com/ ](https://blog.thingslabo.com/archives/category/multi_device_switcher)
49
 
50
  == Screenshots ==
51
 
356
 
357
  == Changelog ==
358
 
359
+ = 1.6.0 =
360
+ * change Requires at least version 3.7
361
+ * remove cache with PC Switcher widget
362
+ * add init function
363
+ * change hook destination from plugin_action_links to plugin_action_links_{$plugin_file}
364
+ * add load_textdomain function
365
+ * add define variable __MULTI_DEVICE_SWITCHER_FILE__
366
+ * check class Multi_Device_Switcher
367
+ * check ABSPATH
368
+ * add isset to conditional statement
369
+ * fix boolean
370
+ * add tests
371
+
372
  = 1.5.4 =
373
  * fixed: fix property keyword for testability
374
+ * fixed: fix add_action 'customize_register' with \_\_construct()
375
  * fixed: fix capability
376
+
377
  = 1.5.3 =
378
  * fixed: add function multi_device_switcher_get_default_options for wp multi-device [#9](https://github.com/thingsym/multi-device-switcher/pull/9)
379
+
380
  = 1.5.2 =
381
  * fixed: fix setcookie() [#8](https://github.com/thingsym/multi-device-switcher/pull/8)
382
+
383
  = 1.5.1 =
384
  * fixed: fix preg_split()
385
+
386
  = 1.5.0 =
387
  * fixed: refactoring by the PHP_CodeSniffer
388
  * fixed: change admin functions to class/object methods
389
+
390
  = 1.4.2 =
391
  * edited: edit readme
392
  * new features: Display Switcher Shortcode
393
  * updated: update default UserAgent
394
  * fixed: fix pc-switcher ssl url
395
+
396
  = 1.4.1 =
397
  * edited: edit readme
398
  * new features: is_disable_switcher() function
399
  * new features: is_pc_switcher() function
400
  * fixed: fix redirect url and pc-switcher url
401
+
402
  = 1.4.0 =
403
  * edited: edit readme
404
  * added: add cookies 'multi-device-switcher', 'disable-switcher'
408
  * new features: Multi Device Switcher Command
409
  * added: add option settings into Theme Customizer
410
  * fixed: refactoring by the PHP_CodeSniffer
411
+
412
  = 1.3.0 =
413
  * fixed: fix script, style, html and readme
414
  * new features: is_multi_device() function
417
  * fixed: replace WP_PLUGIN_URL with plugins_url()
418
  * fixed: using Page Hook Suffix
419
  * merged: pull request [#3](https://github.com/thingsym/multi-device-switcher/pull/3)
420
+
421
  = 1.2.3 =
422
  * fixed: fix redirect uri with query string, using add_query_arg
423
  * fixed: fix translation
424
  * fixed: fix readme
425
+
426
  = 1.2.2 =
427
  * improved: improve responsiveness UI
428
  * fixed: fix html
429
+
430
  = 1.2.1 =
431
  * fixed: delete add_contextual_help
432
  * fixed: fix readme and html
433
+
434
  = 1.2.0 =
435
  * added: add PC Switcher Widget
436
  * new features: PC Switcher
437
  * added: add the settings link to the plugin page
438
+
439
  = 1.1.2 =
440
  * required: at least version 3.4
441
  * fixed: fix tabs and buttons
442
+
443
  = 1.1.1 =
444
  * fixed: change the order of the UserAgent detection
445
  * updated: update default UserAgent
446
  * added: add HTTP/1.1 Vary header
447
+
448
  = 1.1.0 =
449
  * new features: Custom Switcher
450
+
451
  = 1.0.4 =
452
  * fixed: fix the object model PHP5, __construct() to replace Multi_Device_Switcher
453
  * fixed: wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme()
454
+
455
  = 1.0.3 =
456
  * updated: update screenshots
457
  * fixed: fix reset button
458
+
459
  = 1.0.2 =
460
  * added: add file uninstall.php
461
  * fixed: split admin_enqueue_scripts() into two functions
462
  * fixed: detects is_admin()
463
+
464
  = 1.0.1 =
465
  * fixed: split multi_device_switcher_init() into two functions
466
+
467
  = 1.0.0 =
468
  * Initial release.
469
 
470
  == Upgrade Notice ==
471
 
472
+ = 1.6.0 =
473
+ * Requires at least version 3.7 of the WordPress
474
+
475
  = 1.1.2 =
476
+ * Requires at least version 3.4 of the WordPress