1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Issue #247 - format news keywords before saving to the DB, improved meta

keys formatting
This commit is contained in:
SecretR
2013-05-08 12:25:43 +03:00
parent 1dad1b0eca
commit b19c99c674
2 changed files with 6 additions and 1 deletions

View File

@@ -699,6 +699,11 @@ class news_admin_ui extends e_admin_ui
$_POST['news_meta_description'] = $row['news_meta_description'];
}
}
else // on submit
{
if(!empty($_POST['news_meta_keywords'])) $_POST['news_meta_keywords'] = eHelper::formatMetaKeys($_POST['news_meta_keywords']);
}
}
}
}

View File

@@ -4211,7 +4211,7 @@ class eHelper
public static function formatMetaKeys($keywordString)
{
$keywordString = preg_replace('/[^\w\pL\s\-.,+]/u', '', strip_tags(e107::getParser()->toHTML($keywordString, TRUE)));
return trim(preg_replace('/[\s]+,[\s]+/', ',', str_replace('_', ' ', $keywordString)));
return trim(preg_replace('/[\s]?,[\s]?/', ',', str_replace('_', ' ', $keywordString)));
}
public static function formatMetaDescription($descrString)