Files
wp-plugin-contactform/includes/language.php
T

10 lines
523 B
PHP

<?php
if(!defined('ABSPATH'))exit;
function hgcf_language($content='') {
if($content!=='' && preg_match('/'.get_shortcode_regex(['hg_contactform','mlh_contact']).'/s',$content,$match)) {
$attrs=shortcode_parse_atts($match[3]);if(is_array($attrs)&&in_array($attrs['lang']??'',['nl','en'],true))return $attrs['lang'];
}
if(function_exists('pll_current_language')){ $language=pll_current_language('slug');if(in_array($language,['nl','en'],true))return $language; }
return str_starts_with(get_locale(),'en')?'en':'nl';
}