public function switch_blog($new_blog, $old_blog)
 {
     // need to check that some languages are defined when user is logged in, has several blogs, some without any languages
     if (parent::switch_blog($new_blog, $old_blog) && did_action('pll_language_defined') && $this->model->get_languages_list()) {
         static $restore_curlang;
         if (empty($restore_curlang)) {
             $restore_curlang = $this->curlang->slug;
         }
         // to always remember the current language through blogs
         $lang = $this->model->get_language($restore_curlang);
         $this->curlang = $lang ? $lang : $this->model->get_language($this->options['default_lang']);
         $this->links->init_page_on_front_cache();
         $this->load_strings_translations();
     }
 }
Ejemplo n.º 2
0
 public function switch_blog($new_blog, $old_blog)
 {
     // need to check that some languages are defined when user is logged in, has several blogs, some without any languages
     if (parent::switch_blog($new_blog, $old_blog) && did_action('pll_language_defined') && $this->model->get_languages_list()) {
         static $restore_curlang;
         if (empty($restore_curlang)) {
             $restore_curlang = $this->curlang->slug;
         }
         // to always remember the current language through blogs
         // FIXME need some simplification as there are too many variables storing the same value
         $lang = $this->model->get_language($restore_curlang);
         $this->curlang = $lang ? $lang : $this->model->get_language($this->options['default_lang']);
         $this->choose_lang->curlang = $this->links->curlang = $this->curlang;
         $this->links->home = $this->links_model->home;
         // set in parent class
         if ('page' == get_option('show_on_front')) {
             $this->choose_lang->page_on_front = $this->links->page_on_front = get_option('page_on_front');
             $this->choose_lang->page_for_posts = $this->links->page_for_posts = get_option('page_for_posts');
         } else {
             $this->choose_lang->page_on_front = $this->links->page_on_front = 0;
             $this->choose_lang->page_for_posts = $this->links->page_for_posts = 0;
         }
         $this->filters_search->using_permalinks = $this->links->using_permalinks = (bool) get_option('permalink_structure');
     }
 }