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

Commit bb4c573

Browse files
author
Jonathan Bardo
committed
Update multilingual class
1 parent 3e640e9 commit bb4c573

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

wp-content/mu-plugins/jb-project/inc/class-multilingual.php

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,11 @@ function __construct() {
3434
// Plugin filter : multisite language switcher
3535
// The enable grouping of site inside a big multisite organization
3636
private function get_blog_collection(){
37-
$option = get_option('tp1_multilingual_link', 'none');
38-
if($option != 'none'){
39-
if($_SESSION['lang'] == 'fr_fr')
40-
return array(get_current_blog_id(), get_option('tp1_multilingual_link', 1));
41-
else
42-
return array(get_option('tp1_multilingual_link', 1), get_current_blog_id());
43-
}
44-
else{
37+
$option = get_option('jb_multilingual_link', 'none');
38+
if($option != 'none')
39+
return array(get_option('jb_multilingual_link', 1), get_current_blog_id());
40+
else
4541
return false;
46-
}
4742
}
4843

4944
public function msls_blog_collection($arr){
@@ -59,18 +54,13 @@ public function msls_blog_collection($arr){
5954
//--------------------------------------------------------------------------
6055
// Override custom post type archive translation page
6156
//--------------------------------------------------------------------------
62-
public function msls_options_get_permalink($url, $language){
57+
public function msls_options_get_permalink($url, $language){
6358
$post_type = get_post_type();
6459

6560
$blogs = $this->get_blog_collection();
66-
switch ($language):
67-
case 'us':
68-
$url = str_replace( '/'.get_blog_option($blogs[0],'tp1_base_'.$post_type).'/', '/'.get_blog_option($blogs[1], 'tp1_base_'.$post_type).'/', $url );
69-
break;
70-
case 'fr_FR':
71-
$url = str_replace( '/'.get_blog_option($blogs[1],'tp1_base_'.$post_type).'/', '/'.get_blog_option($blogs[0], 'tp1_base_'.$post_type).'/', $url );
72-
break;
73-
endswitch;
61+
62+
if($blogs !== false)
63+
$url = str_replace( '/'.get_blog_option($blogs[0],'jb_base_'.$post_type).'/', '/'.get_blog_option($blogs[1], 'jb_base_'.$post_type).'/', $url );
7464

7565
if($url == "")
7666
$url = home_url();

0 commit comments

Comments
 (0)