: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
class WPML_Compatibility_Disqus implements IWPML_Action {
const LANGUAGE_NOT_SUPPORTED = '';
* @param SitePress $sitepress
public function __construct( SitePress $sitepress ) {
$this->sitepress = $sitepress;
public function add_hooks() {
add_action( 'wp_footer', array( $this, 'set_language' ) );
public function set_language() {
$current_language = $this->get_current_lang();
if ( $current_language !== self::LANGUAGE_NOT_SUPPORTED ) {
<script type="text/javascript">
* We define our custom disqus configs here. This function is invoked from:
* /disqus-comment-system/public/js/comment_embed.js by variable `disqus_config_custom`
var disqus_config = function () {
this.language = "' . $current_language . '";
private function get_current_lang() {
$current_language = $this->sitepress->get_current_language();
$map = $this->get_lang_map();
return isset( $map[ $current_language ] ) ? $map[ $current_language ] : $current_language;
private function get_lang_map() {
'bs' => self::LANGUAGE_NOT_SUPPORTED,
'ga' => self::LANGUAGE_NOT_SUPPORTED,
'hi' => self::LANGUAGE_NOT_SUPPORTED,
'ku' => self::LANGUAGE_NOT_SUPPORTED,
'mn' => self::LANGUAGE_NOT_SUPPORTED,
'mo' => self::LANGUAGE_NOT_SUPPORTED,
'mt' => self::LANGUAGE_NOT_SUPPORTED,
'ne' => self::LANGUAGE_NOT_SUPPORTED,
'pa' => self::LANGUAGE_NOT_SUPPORTED,
'qu' => self::LANGUAGE_NOT_SUPPORTED,
'so' => self::LANGUAGE_NOT_SUPPORTED,
'ta' => self::LANGUAGE_NOT_SUPPORTED,
'uz' => self::LANGUAGE_NOT_SUPPORTED,
'yi' => self::LANGUAGE_NOT_SUPPORTED,
return apply_filters( 'wpml_disqus_language_map', $map );