Version Description
- Fixed:
extract_text()
regex to support line breaks in strings.
Download this release
Release Info
Developer | tivnet |
Plugin | WPGlobus – Multilingual Everything! |
Version | 2.2.13 |
Comparing to | |
See all releases |
Code changes from version 2.2.12 to 2.2.13
- includes/class-wpglobus-core.php +5 -5
- readme.txt +4 -10
- wpglobus.php +2 -2
includes/class-wpglobus-core.php
CHANGED
@@ -187,7 +187,6 @@ class WPGlobus_Core {
|
|
187 |
* Extract text from a string which is either:
|
188 |
* - in the requested language (could be multiple blocks)
|
189 |
* - or does not have the language marks
|
190 |
-
* @todo Works with single line of text only. If the text contains line breaks, they will be removed.
|
191 |
* @todo May fail on large texts because regex are used.
|
192 |
*
|
193 |
* @example
|
@@ -202,9 +201,10 @@ class WPGlobus_Core {
|
|
202 |
*
|
203 |
* @return string
|
204 |
* @since 1.7.9
|
|
|
205 |
*/
|
206 |
public static function extract_text( $text = '', $language = '' ) {
|
207 |
-
if ( ! $text ) {
|
208 |
return $text;
|
209 |
}
|
210 |
|
@@ -212,9 +212,9 @@ class WPGlobus_Core {
|
|
212 |
* `$language` not passed
|
213 |
*/
|
214 |
if ( ! $language ) {
|
215 |
-
// When in unit tests
|
216 |
$language = 'en';
|
217 |
-
// Normally
|
218 |
if ( class_exists( 'WPGlobus_Config', false ) ) {
|
219 |
$language = WPGlobus::Config()->language;
|
220 |
}
|
@@ -223,7 +223,7 @@ class WPGlobus_Core {
|
|
223 |
// Pass 1. Remove the language marks surrounding the language we need.
|
224 |
// Pass 2. Remove the texts surrounded with other language marks, together with the marks.
|
225 |
return preg_replace(
|
226 |
-
array( '/{:' . $language . '}(
|
227 |
array( '\\1', '' ),
|
228 |
$text
|
229 |
);
|
187 |
* Extract text from a string which is either:
|
188 |
* - in the requested language (could be multiple blocks)
|
189 |
* - or does not have the language marks
|
|
|
190 |
* @todo May fail on large texts because regex are used.
|
191 |
*
|
192 |
* @example
|
201 |
*
|
202 |
* @return string
|
203 |
* @since 1.7.9
|
204 |
+
* @since 2.2.12 Fixed regex to support line breaks in strings.
|
205 |
*/
|
206 |
public static function extract_text( $text = '', $language = '' ) {
|
207 |
+
if ( ! $text || ! is_string( $text ) ) {
|
208 |
return $text;
|
209 |
}
|
210 |
|
212 |
* `$language` not passed
|
213 |
*/
|
214 |
if ( ! $language ) {
|
215 |
+
// When in unit tests.
|
216 |
$language = 'en';
|
217 |
+
// Normally.
|
218 |
if ( class_exists( 'WPGlobus_Config', false ) ) {
|
219 |
$language = WPGlobus::Config()->language;
|
220 |
}
|
223 |
// Pass 1. Remove the language marks surrounding the language we need.
|
224 |
// Pass 2. Remove the texts surrounded with other language marks, together with the marks.
|
225 |
return preg_replace(
|
226 |
+
array( '/{:' . $language . '}([\S\s]+?){:}/m', '/{:.+?}[\S\s]+?{:}/m' ),
|
227 |
array( '\\1', '' ),
|
228 |
$text
|
229 |
);
|
readme.txt
CHANGED
@@ -218,6 +218,10 @@ WPGlobus Version 2 supports WordPress 5.x, with Gutenberg.
|
|
218 |
|
219 |
== Changelog ==
|
220 |
|
|
|
|
|
|
|
|
|
221 |
= 2.2.12 =
|
222 |
|
223 |
* Fixed: (Config) PHP warnings for clean install.
|
@@ -245,16 +249,6 @@ WPGlobus Version 2 supports WordPress 5.x, with Gutenberg.
|
|
245 |
* Internal: (Core/Admin bar menu) Moved JS script to footer.
|
246 |
* Fixed: (Builders/Yoast) Don't run builder mode for undefined post type, e.g. `slides` from Bridge theme.
|
247 |
|
248 |
-
= 2.2.7 =
|
249 |
-
|
250 |
-
* Internal: (Core/Admin bar menu) Revised WPGlobus language menu in admin bar.
|
251 |
-
|
252 |
-
= 2.2.6 =
|
253 |
-
|
254 |
-
* Fixed: (Builders/Elementor] Revised the language switcher JS script.
|
255 |
-
* Added: (Builders/Elementor] Localized permalink for the `View Page` button.
|
256 |
-
* Internal: (Core/Config Builder] Added `is_default_language` function.
|
257 |
-
|
258 |
= Earlier versions and Add-ons =
|
259 |
|
260 |
* [See the complete changelog here](https://github.com/WPGlobus/WPGlobus/blob/master/CHANGELOG.md)
|
218 |
|
219 |
== Changelog ==
|
220 |
|
221 |
+
= 2.2.13 =
|
222 |
+
|
223 |
+
* Fixed: `extract_text()` regex to support line breaks in strings.
|
224 |
+
|
225 |
= 2.2.12 =
|
226 |
|
227 |
* Fixed: (Config) PHP warnings for clean install.
|
249 |
* Internal: (Core/Admin bar menu) Moved JS script to footer.
|
250 |
* Fixed: (Builders/Yoast) Don't run builder mode for undefined post type, e.g. `slides` from Bridge theme.
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
= Earlier versions and Add-ons =
|
253 |
|
254 |
* [See the complete changelog here](https://github.com/WPGlobus/WPGlobus/blob/master/CHANGELOG.md)
|
wpglobus.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Description: A WordPress Globalization / Multilingual Plugin. Posts, pages, menus, widgets and even custom fields - in multiple languages!
|
16 |
* Text Domain: wpglobus
|
17 |
* Domain Path: /languages/
|
18 |
-
* Version: 2.2.
|
19 |
* Author: WPGlobus
|
20 |
* Author URI: https://wpglobus.com/
|
21 |
* Network: false
|
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
42 |
exit;
|
43 |
}
|
44 |
|
45 |
-
define( 'WPGLOBUS_VERSION', '2.2.
|
46 |
define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
47 |
|
48 |
/**
|
15 |
* Description: A WordPress Globalization / Multilingual Plugin. Posts, pages, menus, widgets and even custom fields - in multiple languages!
|
16 |
* Text Domain: wpglobus
|
17 |
* Domain Path: /languages/
|
18 |
+
* Version: 2.2.13
|
19 |
* Author: WPGlobus
|
20 |
* Author URI: https://wpglobus.com/
|
21 |
* Network: false
|
42 |
exit;
|
43 |
}
|
44 |
|
45 |
+
define( 'WPGLOBUS_VERSION', '2.2.13' );
|
46 |
define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
47 |
|
48 |
/**
|