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

Commit 3639a06

Browse files
committed
Merge branch 'release/1.6.0'
2 parents 80767cd + 820c587 commit 3639a06

23 files changed

+534
-155
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WP Multilang
1+
# [WP Multilang](https://wordpress.org/plugins/wp-multilang/)
22

33
Multilingual plugin for WordPress.
44

@@ -39,6 +39,7 @@ Features of the plugin WP Multilang:
3939
* Max Mega Menu
4040
* MasterSlider
4141
* WP-PageNavi
42+
* BuddyPress
4243

4344
Supports configuration via json.
4445

assets/scripts/add-lang-to-customizer.js

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var WPMLang = (function( api, $ ) {
2929
}
3030

3131
api.bind( 'ready', function(){
32-
// console.log( home.url );
3332
api.previewer.previewUrl.set( home.url );
3433
});
3534
};

composer.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configs/buddypress.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"post_types": {
3+
"bp-email": {}
4+
},
5+
"options": {
6+
"bp_email_options": {
7+
"footer_text": {}
8+
}
9+
},
10+
"admin_pages": [
11+
"users_page_bp-profile-setup"
12+
]
13+
}

configs/ml-slider.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"post_types": {
3+
"ml-slide": {
4+
"post_title": null,
5+
"post_content": null
6+
},
7+
"ml-slider": {
8+
"post_content": null,
9+
"post_excerpt": null
10+
}
11+
},
12+
"post_fields": {
13+
"ml-slider_title": {},
14+
"ml-slider_url": {}
15+
},
16+
"admin_pages": [
17+
"toplevel_page_metaslider"
18+
]
19+
}

configs/tablepress.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"post_types": {
3+
"tablepress_table": {
4+
"post_content": null
5+
}
6+
},
7+
"admin_pages": [
8+
"tablepress_list",
9+
"tablepress_edit"
10+
]
11+
}

core/admin/class-wpm-admin-customizer.php

+4-15
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* @package WPM/Core/Admin
88
* @class WPM_Admin_Customizer
99
* @since 1.4.9
10+
* @version 1.0.1
1011
*/
1112

1213
namespace WPM\Core\Admin;
@@ -34,20 +35,8 @@ public function add_lang_to_customizer_previewer() {
3435
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
3536
$src = wpm_asset_path( '/scripts/add-lang-to-customizer' . $suffix . '.js' );
3637
wp_enqueue_script( 'wpm-add-lang-to-customizer', $src, array( 'customize-controls' ), WPM_VERSION , true );
37-
$url = add_query_arg( 'lang', wpm_get_language(), get_home_url() );
38-
$this->add_lang_to_template( $url );
39-
}
40-
41-
/**
42-
* Set the previewer url
43-
*
44-
* @param string $url
45-
*/
46-
public function add_lang_to_template( $url ) {
47-
wp_add_inline_script(
48-
'wpm-add-lang-to-customizer',
49-
sprintf( 'WPMLang.init( %s );', wp_json_encode( array( 'url' => $url ) ) ),
50-
'after'
51-
);
38+
$base_url = apply_filters( 'wpm_customizer_url', get_home_url() );
39+
$url = add_query_arg( 'lang', wpm_get_language(), $base_url );
40+
wp_add_inline_script( 'wpm-add-lang-to-customizer', sprintf( 'WPMLang.init( %s );', wp_json_encode( array( 'url' => $url ) ) ) );
5241
}
5342
}

core/class-wpm-posts.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Class WPM_Posts
1111
* @package WPM\Core
1212
* @author VaLeXaR
13-
* @version 1.1.3
13+
* @version 1.1.4
1414
*/
1515
class WPM_Posts extends \WPM_Object {
1616

@@ -89,13 +89,19 @@ public function filter_posts_by_language( $query ) {
8989
}
9090
}
9191

92+
/*if ( isset( $query->query_vars['lang'] ) && ! empty( $query->query_vars['lang'] ) ) {
93+
$lang = $query->query_vars['lang'];
94+
} else {
95+
$lang = wpm_get_language();
96+
}*/
97+
9298
$lang = get_query_var( 'lang' );
9399

94100
if ( ! $lang && ! $query->is_main_query() ) {
95101
$lang = wpm_get_user_language();
96102
}
97103

98-
if ( $lang ) {
104+
if ( 'all' !== $lang ) {
99105
$lang_meta_query = array(
100106
array(
101107
'relation' => 'OR',

core/class-wpm-setup.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ public function redirect_to_user_language() {
448448
}
449449
} else {
450450
if ( $_COOKIE['wpm_language'] != $this->user_language ) {
451-
do_action( 'wpm_changed_language' );
452451
wpm_setcookie( 'wpm_language', $this->user_language, time() + YEAR_IN_SECONDS );
452+
do_action( 'wpm_changed_language' );
453453
}
454454
} // End if().
455455
} // End if().

core/class-wpm-taxonomies.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ public function filter_terms_by_language( $args, $taxonomies ) {
8989
}
9090
}
9191

92-
$lang = get_query_var( 'lang' );
93-
94-
if ( ! $lang ) {
95-
$lang = wpm_get_user_language();
92+
if ( isset( $args['lang'] ) && ! empty( $args['lang'] ) ) {
93+
$lang = $args['lang'];
94+
} else {
95+
$lang = wpm_get_language();
9696
}
9797

98-
if ( $lang ) {
98+
if ( 'all' != $lang ) {
9999
$lang_meta_query = array(
100100
array(
101101
'relation' => 'OR',
@@ -287,10 +287,10 @@ public function update_description( $tt_id, $taxonomy ) {
287287
return;
288288
}
289289

290-
$old_value = $this->description['old'];
291-
$strings = wpm_value_to_ml_array( $old_value );
292-
$value = wpm_set_language_value( $strings, $value, $taxonomies_config[ $taxonomy ] );
293-
$description = wpm_ml_value_to_string( $value );
290+
$old_value = $this->description['old'];
291+
$strings = wpm_value_to_ml_array( $old_value );
292+
$value = wpm_set_language_value( $strings, $value, $taxonomies_config[ $taxonomy ] );
293+
$description = wpm_ml_value_to_string( $value );
294294

295295
$wpdb->update( $wpdb->term_taxonomy, compact( 'description' ), array( 'term_taxonomy_id' => $tt_id ) );
296296
}

core/class-wpm-widgets.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct() {
3030
* @return bool|array
3131
*/
3232
public function widget_display( $instance ) {
33-
if ( isset( $instance['languages'] ) && is_array( $instance['languages'] ) && ! in_array( wpm_get_user_language(), $instance['languages'] ) ) {
33+
if ( isset( $instance['languages'] ) && is_array( $instance['languages'] ) && ! in_array( wpm_get_language(), $instance['languages'] ) ) {
3434
return false;
3535
}
3636

core/vendor/class-wpm-aiosp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function update_old_fields( $check, $object_id, $meta_key, $meta_value )
123123
if ( isset( $this->meta_fields[ $meta_key ] ) && $this->meta_fields[ $meta_key ] ) {
124124

125125
$old_value = wpm_value_to_ml_array( $this->meta_fields[ $meta_key ] );
126-
$meta_value = wpm_set_language_value( $old_value, $meta_value, array() );
126+
$meta_value = wpm_set_language_value( $old_value, $meta_value );
127127
$meta_value = wpm_ml_value_to_string( $meta_value );
128128

129129

0 commit comments

Comments
 (0)