PluginProbe
Polylang / 1.1
Polylang v1.1
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, at include/plugins-compat.php

47 lines 1.6 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 if ($polylang->is_admin)
13 add_filter('override_load_textdomain', array(&$this, 'wpseo_override_load_textdomain'), 10, 2);
14
15 add_filter('get_terms_args', array(&$this, 'wpseo_remove_terms_filter'));
16
17 // Custom field template
18 add_action('dbx_post_advanced', array(&$this, 'cft_copy'));
19 }
20
21 // Unfortunately WPSEO loads the text domain before Polylang is able to modify the locale
22 // this hack works because Polylang is loaded before WPSEO...
23 function wpseo_override_load_textdomain( $return, $domain ) {
24 if ($domain == 'wordpress-seo' && !did_action('plugins_loaded')) {
25 add_filter('plugins_loaded', create_function('', "load_plugin_textdomain('wordpress-seo', false, dirname(WPSEO_BASENAME).'/languages');"));
26 return true;
27 }
28 return $return;
29 }
30
31 // removes the language filter for the taxonomy sitemaps
32 function wpseo_remove_terms_filter($args) {
33 if (defined('WPSEO_VERSION') && isset($GLOBALS['wp_query']->query['sitemap']))
34 $args['lang'] = 0;
35 return $args;
36 }
37
38 // Custom field template does check $_REQUEST['post'] to populate the custom fields values
39 function cft_copy() {
40 global $post, $custom_field_template;
41 if (isset($custom_field_template) && !empty($post) && isset($_REQUEST['from_post']) && isset($_REQUEST['new_lang']))
42 $_REQUEST['post'] = $post->ID;
43 }
44 }
45
46 new Polylang_Plugins_Compat();
47