Only add country to JSON if flag fits country code regex
This commit is contained in:
parent
ed142a5e5d
commit
9d77a4cc4c
@ -80,8 +80,8 @@ class Api {
|
|||||||
// Handle country field
|
// Handle country field
|
||||||
if (isset($post->body_nomarkup) && $this->config['country_flags']) {
|
if (isset($post->body_nomarkup) && $this->config['country_flags']) {
|
||||||
$modifiers = extract_modifiers($post->body_nomarkup);
|
$modifiers = extract_modifiers($post->body_nomarkup);
|
||||||
if (isset($modifiers['flag']) && isset($modifiers['flag alt'])) {
|
if (isset($modifiers['flag']) && isset($modifiers['flag alt']) && preg_match('/^[a-z]{2}$/', $modifiers['flag'])) {
|
||||||
$country = mb_convert_case($modifiers['flag'], MB_CASE_UPPER);
|
$country = strtoupper($modifiers['flag']);
|
||||||
if ($country) {
|
if ($country) {
|
||||||
$apiPost['country'] = $country;
|
$apiPost['country'] = $country;
|
||||||
$apiPost['country_name'] = $modifiers['flag alt'];
|
$apiPost['country_name'] = $modifiers['flag alt'];
|
||||||
|
Loading…
Reference in New Issue
Block a user