示例#1
0
文件: core.php 项目: uoyknaht/kc
 function __construct()
 {
     parent::__construct();
     // init options often needed
     $this->page_for_posts = get_option('page_for_posts');
     $this->page_on_front = get_option('page_on_front');
     // if no language found, choose the preferred one
     add_filter('pll_get_current_language', array(&$this, 'pll_get_current_language'));
     // sets the language of comment
     add_action('pre_comment_on_post', array(&$this, 'pre_comment_on_post'));
     // text domain management
     if ($this->options['force_lang'] && get_option('permalink_structure') && PLL_LANG_EARLY) {
         add_action('setup_theme', array(&$this, 'setup_theme'), 20);
     } else {
         add_filter('override_load_textdomain', array(&$this, 'mofile'), 10, 3);
         add_filter('gettext', array(&$this, 'gettext'), 10, 3);
         add_filter('gettext_with_context', array(&$this, 'gettext_with_context'), 10, 4);
     }
     add_action('init', array(&$this, 'init'));
     foreach (array('wp', 'login_init', 'admin_init') as $filter) {
         // admin_init for ajax thanks to g100g
         add_action($filter, array(&$this, 'load_textdomains'), 5);
     }
     // priority 5 for post types and taxonomies registered in wp hook with default priority
     // filters the WordPress locale
     add_filter('locale', array(&$this, 'get_locale'));
     // filters posts according to the language
     add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
     // filter sticky posts by current language
     add_filter('option_sticky_posts', array(&$this, 'option_sticky_posts'));
     // translates page for posts and page on front
     add_filter('option_page_for_posts', array(&$this, 'translate_page'));
     add_filter('option_page_on_front', array(&$this, 'translate_page'));
 }
示例#2
0
 function __construct()
 {
     parent::__construct();
     // init options often needed
     $this->page_for_posts = get_option('page_for_posts');
     $this->page_on_front = get_option('page_on_front');
     // text domain management
     add_action('init', array(&$this, 'init'));
     add_filter('override_load_textdomain', array(&$this, 'mofile'), 10, 3);
     add_action('wp', array(&$this, 'load_textdomains'));
     add_action('login_init', array(&$this, 'load_textdomains'));
     // filters posts according to the language
     add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
     // filter sticky posts by current language
     add_filter('option_sticky_posts', array(&$this, 'option_sticky_posts'));
     // translates page for posts and page on front
     add_filter('option_page_for_posts', array(&$this, 'translate_page'));
     add_filter('option_page_on_front', array(&$this, 'translate_page'));
 }