Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit 512ce05

Browse files
committed
fix many redirect
1 parent eff8008 commit 512ce05

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ For a switch as add code to this topic
7070
```php
7171
if ( function_exists ( 'wpm_language_switcher' ) ) wpm_language_switcher ();
7272
```
73+
74+
Function accepts two parameters:
75+
76+
$args - array
77+
'type' - 'list', 'dropdown'. Default - 'list'.
78+
'show' - 'flag', 'name', 'both'. Default - 'both'.
79+
80+
$echo - bool
81+
7382
Available features for translation:
7483
```php
7584
wpm_translate_url ($url, $language = ''); // translate url
@@ -169,6 +178,15 @@ Features of the plugin **WP Multilang**:
169178
```php
170179
<?php if ( function_exists( 'wpm_language_switcher' ) ) wpm_language_switcher(); ?>
171180
```
181+
182+
Фукція приймає два параметри:
183+
184+
$args - array
185+
'type' - 'list', 'dropdown'. Усталено - 'list'.
186+
'show' - 'flag', 'name', 'both'. Усталено - 'both'.
187+
188+
$echo - bool
189+
172190
Доступні функції для перекладу:
173191
```php
174192
wpm_translate_url( $url, $language = '' ); // translate url

core/class-wpm-setup.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Class WPM_Setup
1313
* @package WPM\Core
1414
* @author VaLeXaR
15-
* @version 1.1.0
15+
* @version 1.1.1
1616
*/
1717
class WPM_Setup {
1818

@@ -209,6 +209,9 @@ public function get_user_language() {
209209
*/
210210
public function set_user_language() {
211211

212+
$languages = $this->get_languages();
213+
$default_locale = $this->get_default_locale();
214+
212215
if ( ! is_admin() && ! defined( 'REST_REQUEST' ) ) {
213216

214217
$path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
@@ -229,8 +232,13 @@ public function set_user_language() {
229232
if ( $browser_language != $this->user_language ) {
230233

231234
$base_url = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
235+
232236
$b_home_url = $base_url . '/' . $browser_language;
233237

238+
if ( $browser_language == $languages[ $default_locale ] ) {
239+
$b_home_url = $base_url;
240+
}
241+
234242
if ( $this->user_language ) {
235243
$base_url = $base_url . '/' . $this->user_language;
236244
}
@@ -243,9 +251,6 @@ public function set_user_language() {
243251
}
244252
}
245253

246-
$languages = $this->get_languages();
247-
$default_locale = $this->get_default_locale();
248-
249254
if ( isset( $_GET['lang'] ) ) {
250255
$lang = wpm_clean( $_GET['lang'] );
251256
if ( in_array( $lang, $languages ) ) {

readme.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Contributors: valexar
44
Tags: localization, multilanguage, multilingual, translation, multilang
55
Requires at least: 4.7
66
Tested up to: 4.8
7-
Stable tag: 1.3.0
7+
Stable tag: 1.3.1
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -57,6 +57,7 @@ There are two ways:
5757

5858
1. After json.
5959
Create the root of the subject, or the roots of its plugin file `wpm-config.json` with:
60+
6061
`{
6162
"post_types": {
6263
"post": null
@@ -84,6 +85,14 @@ For a switch as add code to your template
8485

8586
`if ( function_exists ( 'wpm_language_switcher' ) ) wpm_language_switcher ();`
8687

88+
Function accepts two parameters:
89+
90+
$args - array
91+
'type' - 'list', 'dropdown'. Default - 'list'.
92+
'show' - 'flag', 'name', 'both'. Default - 'both'.
93+
94+
$echo - bool
95+
8796
Available features for translation:
8897

8998
`wpm_translate_url ($url, $language = '');` - translate url
@@ -124,6 +133,9 @@ Compatible with multisite not tested.
124133

125134
== Changelog ==
126135

136+
= 1.3.1 =
137+
* fix many redirect for first load
138+
127139
= 1.3.0 =
128140
+ add support Max Mega Menu
129141
+ add support MasterSlider

wp-multilang.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
99
* Text Domain: wpm
1010
* Domain Path: /languages
11-
* Version: 1.3.0
11+
* Version: 1.3.1
1212
*
1313
* @package WPM
1414
* @category Core
@@ -42,7 +42,7 @@ final class WP_Multilang {
4242
*
4343
* @var string
4444
*/
45-
public $version = '1.3.0';
45+
public $version = '1.3.1';
4646

4747
/**
4848
* The single instance of the class.

0 commit comments

Comments
 (0)