mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-29 09:44:28 +01:00
Only add country to JSON if flag fits country code regex
This commit is contained in:
parent
9d21d0665d
commit
994634a953
@ -80,8 +80,8 @@ class Api {
|
||||
// Handle country field
|
||||
if (isset($post->body_nomarkup) && $this->config['country_flags']) {
|
||||
$modifiers = extract_modifiers($post->body_nomarkup);
|
||||
if (isset($modifiers['flag']) && isset($modifiers['flag alt'])) {
|
||||
$country = mb_convert_case($modifiers['flag'], MB_CASE_UPPER);
|
||||
if (isset($modifiers['flag']) && isset($modifiers['flag alt']) && preg_match('/^[a-z]{2}$/', $modifiers['flag'])) {
|
||||
$country = strtoupper($modifiers['flag']);
|
||||
if ($country) {
|
||||
$apiPost['country'] = $country;
|
||||
$apiPost['country_name'] = $modifiers['flag alt'];
|
||||
|
Loading…
Reference in New Issue
Block a user