Exemple #1
0
 public function __construct(&$links_model)
 {
     parent::__construct($links_model);
     add_action('pll_language_defined', array(&$this, 'pll_language_defined'), 1, 2);
     // filters posts by language
     add_filter('parse_query', array(&$this, 'parse_query'), 6);
     // not before 'check_language_code_in_url'
     if (!defined('PLL_AUTO_TRANSLATE') || PLL_AUTO_TRANSLATE) {
         add_action('wp', array(&$this, 'auto_translate'), 20);
     }
 }
Exemple #2
0
 public function __construct(&$links_model)
 {
     parent::__construct($links_model);
     // plugin i18n, only needed for backend
     load_plugin_textdomain('polylang', false, basename(POLYLANG_DIR) . '/languages');
     // adds the link to the languages panel in the WordPress admin menu
     add_action('admin_menu', array(&$this, 'add_menus'));
     // setup js scripts and css styles
     add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
     add_action('admin_print_footer_scripts', array(&$this, 'admin_print_footer_scripts'));
     // adds a 'settings' link in the plugins table
     add_filter('plugin_action_links_' . POLYLANG_BASENAME, array(&$this, 'plugin_action_links'));
     add_action('in_plugin_update_message-' . POLYLANG_BASENAME, array(&$this, 'plugin_update_message'), 10, 2);
 }
 /**
  * Loads the polylang text domain
  * Setups actions needed on all admin pages
  *
  * @since 1.8
  *
  * @param object $links_model
  */
 public function __construct(&$links_model)
 {
     parent::__construct($links_model);
     // Plugin i18n, only needed for backend
     load_plugin_textdomain('polylang', false, basename(POLYLANG_DIR) . '/languages');
     // Adds the link to the languages panel in the WordPress admin menu
     add_action('admin_menu', array($this, 'add_menus'));
     // Setup js scripts and css styles
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('admin_print_footer_scripts', array($this, 'admin_print_footer_scripts'));
     // Lingotek
     if (!defined('PLL_LINGOTEK_AD') || PLL_LINGOTEK_AD) {
         require_once POLYLANG_DIR . '/lingotek/lingotek.php';
     }
 }
 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();
     }
 }
Exemple #5
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');
     }
 }