PluginProbe
Polylang / 1.1.6
Polylang v1.1.6
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / include / plugins-compat.php

plugins-compat.php in Polylang 1.1.6, at include/plugins-compat.php

61 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Polylang_Plugins_Compat {
4 function __construct() {
5 global $polylang;
6
7 // YARPP
8 // just makes YARPP aware of the language taxonomy (after Polylang registered it)
9 add_action('init', create_function('',"\$GLOBALS['wp_taxonomies']['language']->yarpp_support = 1;"), 20);
10
11 // WordPress SEO by Yoast
12 add_filter('override_load_textdomain', array(&$this, 'wpseo_override_load_textdomain'), 10, 2);
13 add_filter('get_terms_args', array(&$this, 'wpseo_remove_terms_filter'));
14 add_filter('pll_home_url_white_list', create_function('$arr', "return array_merge(\$arr, array(array('file' => 'wordpress-seo')));"));
15
16 // Custom field template
17 add_action('dbx_post_advanced', array(&$this, 'cft_copy'));
18
19 // Jetpack infinite scroll
20 add_filter('pre_get_posts', array(&$this, 'jetpack_infinite_scroll'));
21
22 // Aqua Resizer
23 add_filter('pll_home_url_black_list', create_function('$arr', "return array_merge(\$arr, array(array('function' => 'aq_resize')));"));
24 }
25
26 // Unfortunately WPSEO loads the text domain before Polylang is able to modify the locale
27 // this hack works because Polylang is loaded before WPSEO...
28 function wpseo_override_load_textdomain( $return, $domain ) {
29 if ($domain == 'wordpress-seo' && !did_action('plugins_loaded')) {
30 add_filter('plugins_loaded', create_function('', "load_plugin_textdomain('wordpress-seo', false, dirname(WPSEO_BASENAME).'/languages');"));
31 return true;
32 }
33 return $return;
34 }
35
36 // removes the language filter for the taxonomy sitemaps
37 function wpseo_remove_terms_filter($args) {
38 if (defined('WPSEO_VERSION') && isset($GLOBALS['wp_query']->query['sitemap']))
39 $args['lang'] = 0;
40 return $args;
41 }
42
43 // Custom field template does check $_REQUEST['post'] to populate the custom fields values
44 function cft_copy() {
45 global $post, $custom_field_template;
46 if (isset($custom_field_template, $_REQUEST['from_post'], $_REQUEST['new_lang']) && !empty($post))
47 $_REQUEST['post'] = $post->ID;
48 }
49
50 // Currently it is not possible to set the language in ajax url so let's use our cookie
51 function jetpack_infinite_scroll($query) {
52 if (isset($_GET['infinity'], $_GET['page'])) {
53 $query->set('lang', $GLOBALS['polylang']->get_preferred_language()->slug);
54 if (empty($qv['post_type']) && !$query->is_search)
55 $query->set('post_type', 'post');
56 }
57 }
58 }
59
60 new Polylang_Plugins_Compat();
61