Version Description
Download this release
Release Info
Developer | tenpura |
Plugin | WP Multibyte Patch |
Version | 2.8 |
Comparing to | |
See all releases |
Code changes from version 2.7 to 2.8
- ext/ja/class.php +1 -1
- readme.txt +1 -1
- wp-multibyte-patch.php +33 -4
- wpmp-config-sample-ja.php +1 -0
ext/ja/class.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* WP Multibyte Patch Japanese Locale Extension
|
4 |
*
|
5 |
* @package WP_Multibyte_Patch
|
6 |
-
* @version 2.
|
7 |
* @author Seisuke Kuraishi <210pura@gmail.com>
|
8 |
* @copyright Copyright (c) 2016 Seisuke Kuraishi, Tinybit Inc.
|
9 |
* @license http://opensource.org/licenses/gpl-2.0.php GPLv2
|
3 |
* WP Multibyte Patch Japanese Locale Extension
|
4 |
*
|
5 |
* @package WP_Multibyte_Patch
|
6 |
+
* @version 2.8
|
7 |
* @author Seisuke Kuraishi <210pura@gmail.com>
|
8 |
* @copyright Copyright (c) 2016 Seisuke Kuraishi, Tinybit Inc.
|
9 |
* @license http://opensource.org/licenses/gpl-2.0.php GPLv2
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: tenpura
|
|
3 |
Tags: multibyte,i18n,wp-multibyte-patch,Japanese
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 4.6
|
6 |
-
Stable tag: 2.
|
7 |
|
8 |
Multibyte functionality enhancement for the WordPress Japanese package.
|
9 |
|
3 |
Tags: multibyte,i18n,wp-multibyte-patch,Japanese
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 2.8
|
7 |
|
8 |
Multibyte functionality enhancement for the WordPress Japanese package.
|
9 |
|
wp-multibyte-patch.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: WP Multibyte Patch
|
4 |
Description: Multibyte functionality enhancement for the WordPress Japanese package.
|
5 |
-
Version: 2.
|
6 |
Plugin URI: http://eastcoder.com/code/wp-multibyte-patch/
|
7 |
Author: Seisuke Kuraishi
|
8 |
Author URI: http://tinybit.co.jp/
|
@@ -15,7 +15,7 @@ Domain Path: /languages
|
|
15 |
* Multibyte functionality enhancement for the WordPress Japanese package.
|
16 |
*
|
17 |
* @package WP_Multibyte_Patch
|
18 |
-
* @version 2.
|
19 |
* @author Seisuke Kuraishi <210pura@gmail.com>
|
20 |
* @copyright Copyright (c) 2016 Seisuke Kuraishi, Tinybit Inc.
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GPLv2
|
@@ -50,6 +50,7 @@ class multibyte_patch {
|
|
50 |
'patch_force_twentyfifteen_google_fonts_off' => false,
|
51 |
'patch_force_twentysixteen_google_fonts_off' => false,
|
52 |
'patch_sanitize_file_name' => true,
|
|
|
53 |
'patch_bp_create_excerpt' => false,
|
54 |
'bp_excerpt_mblength' => 110,
|
55 |
'bp_excerpt_more' => ' […]'
|
@@ -64,6 +65,7 @@ class multibyte_patch {
|
|
64 |
protected $lang_dir = 'languages';
|
65 |
protected $required_version = '4.5';
|
66 |
protected $query_based_vars = array();
|
|
|
67 |
|
68 |
// For fallback purpose only. (1.6)
|
69 |
public function guess_encoding( $string, $encoding = '' ) {
|
@@ -324,6 +326,18 @@ class multibyte_patch {
|
|
324 |
}
|
325 |
}
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
public function query_based_settings() {
|
328 |
$is_query_funcs = array( 'is_feed', 'is_404', 'is_search', 'is_tax', 'is_front_page', 'is_home', 'is_attachment', 'is_single', 'is_page', 'is_category', 'is_tag', 'is_author', 'is_date', 'is_archive', 'is_paged' );
|
329 |
|
@@ -349,6 +363,18 @@ class multibyte_patch {
|
|
349 |
return version_compare( $wp_version, $required_version, '<' ) ? false : true;
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
public function filters_after_setup_theme() {
|
353 |
// add filter
|
354 |
if ( false !== $this->conf['patch_force_character_count']) {
|
@@ -430,6 +456,7 @@ class multibyte_patch {
|
|
430 |
add_action( 'wp_default_scripts', array( $this, 'wplink_js' ), 9 );
|
431 |
|
432 |
add_action( 'after_setup_theme', array( $this, 'filters_after_setup_theme' ), 99 );
|
|
|
433 |
}
|
434 |
|
435 |
public function mbfunctions_exist() {
|
@@ -473,15 +500,17 @@ class multibyte_patch {
|
|
473 |
public function __construct() {
|
474 |
$this->load_conf();
|
475 |
$this->blog_encoding = get_option( 'blog_charset' );
|
476 |
-
|
|
|
477 |
$this->blog_encoding = 'UTF-8';
|
478 |
|
479 |
// mbstring functions are required for non UTF-8 blog.
|
480 |
-
if (
|
481 |
$this->mbfunctions_required = true;
|
482 |
|
483 |
$this->has_mbfunctions = $this->mbfunctions_exist();
|
484 |
$this->has_mb_strlen = function_exists( 'mb_strlen' );
|
|
|
485 |
$this->debug_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
486 |
|
487 |
load_plugin_textdomain( $this->textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/' . $this->lang_dir );
|
2 |
/*
|
3 |
Plugin Name: WP Multibyte Patch
|
4 |
Description: Multibyte functionality enhancement for the WordPress Japanese package.
|
5 |
+
Version: 2.8
|
6 |
Plugin URI: http://eastcoder.com/code/wp-multibyte-patch/
|
7 |
Author: Seisuke Kuraishi
|
8 |
Author URI: http://tinybit.co.jp/
|
15 |
* Multibyte functionality enhancement for the WordPress Japanese package.
|
16 |
*
|
17 |
* @package WP_Multibyte_Patch
|
18 |
+
* @version 2.8
|
19 |
* @author Seisuke Kuraishi <210pura@gmail.com>
|
20 |
* @copyright Copyright (c) 2016 Seisuke Kuraishi, Tinybit Inc.
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GPLv2
|
50 |
'patch_force_twentyfifteen_google_fonts_off' => false,
|
51 |
'patch_force_twentysixteen_google_fonts_off' => false,
|
52 |
'patch_sanitize_file_name' => true,
|
53 |
+
'patch_sanitize_feed_xml_text' => false,
|
54 |
'patch_bp_create_excerpt' => false,
|
55 |
'bp_excerpt_mblength' => 110,
|
56 |
'bp_excerpt_more' => ' […]'
|
65 |
protected $lang_dir = 'languages';
|
66 |
protected $required_version = '4.5';
|
67 |
protected $query_based_vars = array();
|
68 |
+
protected $has_pcre_utf8 = false;
|
69 |
|
70 |
// For fallback purpose only. (1.6)
|
71 |
public function guess_encoding( $string, $encoding = '' ) {
|
326 |
}
|
327 |
}
|
328 |
|
329 |
+
public function sanitize_xml_text( $text, $replace = '' ) {
|
330 |
+
if ( 'UTF-8' !== $this->blog_encoding || ! $this->has_pcre_utf8 )
|
331 |
+
return $text;
|
332 |
+
|
333 |
+
if ( $this->has_mbfunctions )
|
334 |
+
$text = @mb_convert_encoding( $text, 'UTF-8', 'UTF-8' );
|
335 |
+
elseif ( function_exists( 'iconv' ) )
|
336 |
+
$text = @iconv( 'UTF-8', 'UTF-8', $text );
|
337 |
+
|
338 |
+
return @preg_replace( '/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+/u', $replace, $text );
|
339 |
+
}
|
340 |
+
|
341 |
public function query_based_settings() {
|
342 |
$is_query_funcs = array( 'is_feed', 'is_404', 'is_search', 'is_tax', 'is_front_page', 'is_home', 'is_attachment', 'is_single', 'is_page', 'is_category', 'is_tag', 'is_author', 'is_date', 'is_archive', 'is_paged' );
|
343 |
|
363 |
return version_compare( $wp_version, $required_version, '<' ) ? false : true;
|
364 |
}
|
365 |
|
366 |
+
public function filters_after_template_redirect() {
|
367 |
+
if ( is_feed() ) {
|
368 |
+
if ( false !== $this->conf['patch_sanitize_feed_xml_text'] ) {
|
369 |
+
add_filter( 'the_title_rss', array( $this, 'sanitize_xml_text' ), 99 );
|
370 |
+
add_filter( 'the_content_feed', array( $this, 'sanitize_xml_text' ), 99 );
|
371 |
+
add_filter( 'the_excerpt_rss', array( $this, 'sanitize_xml_text' ), 99 );
|
372 |
+
add_filter( 'comment_text_rss', array( $this, 'sanitize_xml_text' ), 99 );
|
373 |
+
add_filter( 'comment_text', array( $this, 'sanitize_xml_text' ), 99 );
|
374 |
+
}
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
public function filters_after_setup_theme() {
|
379 |
// add filter
|
380 |
if ( false !== $this->conf['patch_force_character_count']) {
|
456 |
add_action( 'wp_default_scripts', array( $this, 'wplink_js' ), 9 );
|
457 |
|
458 |
add_action( 'after_setup_theme', array( $this, 'filters_after_setup_theme' ), 99 );
|
459 |
+
add_action( 'template_redirect', array( $this, 'filters_after_template_redirect' ) );
|
460 |
}
|
461 |
|
462 |
public function mbfunctions_exist() {
|
500 |
public function __construct() {
|
501 |
$this->load_conf();
|
502 |
$this->blog_encoding = get_option( 'blog_charset' );
|
503 |
+
|
504 |
+
if ( preg_match( '/^utf-?8$/i', $this->blog_encoding ) || empty( $this->blog_encoding ) )
|
505 |
$this->blog_encoding = 'UTF-8';
|
506 |
|
507 |
// mbstring functions are required for non UTF-8 blog.
|
508 |
+
if ( 'UTF-8' !== $this->blog_encoding )
|
509 |
$this->mbfunctions_required = true;
|
510 |
|
511 |
$this->has_mbfunctions = $this->mbfunctions_exist();
|
512 |
$this->has_mb_strlen = function_exists( 'mb_strlen' );
|
513 |
+
$this->has_pcre_utf8 = @preg_match( '/^.$/u', "\xC2\xA9" );
|
514 |
$this->debug_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
515 |
|
516 |
load_plugin_textdomain( $this->textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/' . $this->lang_dir );
|
wpmp-config-sample-ja.php
CHANGED
@@ -101,4 +101,5 @@ $wpmp_conf['patch_force_twentyfourteen_google_fonts_off'] = false;
|
|
101 |
$wpmp_conf['patch_force_twentyfifteen_google_fonts_off'] = false;
|
102 |
$wpmp_conf['patch_force_twentysixteen_google_fonts_off'] = false;
|
103 |
$wpmp_conf['patch_sanitize_file_name'] = true;
|
|
|
104 |
$wpmp_conf['patch_bp_create_excerpt'] = false;
|
101 |
$wpmp_conf['patch_force_twentyfifteen_google_fonts_off'] = false;
|
102 |
$wpmp_conf['patch_force_twentysixteen_google_fonts_off'] = false;
|
103 |
$wpmp_conf['patch_sanitize_file_name'] = true;
|
104 |
+
$wpmp_conf['patch_sanitize_feed_xml_text'] = false;
|
105 |
$wpmp_conf['patch_bp_create_excerpt'] = false;
|