From 56b051a4f64e2150569cabcc32c331edf1838aa3 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 28 Oct 2008 12:21:53 +0000 Subject: Closes #440 git-svn-id: https://code.elgg.org/elgg/trunk@2326 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/social.php | 96 ++++++++++++++++++++++++++++++--------------------- languages/en.php | 5 +++ 2 files changed, 61 insertions(+), 40 deletions(-) diff --git a/engine/lib/social.php b/engine/lib/social.php index ffa98444b..2f288db48 100644 --- a/engine/lib/social.php +++ b/engine/lib/social.php @@ -64,47 +64,63 @@ } - // Set the shout words blacklist, these do not become tags when the string is converted - // Any language packs should include their own! - + + /** + * Initialise. + * + * Sets a blacklist of words in the current language. This is a comma separated list in word:blacklist. + */ function social_init() { - global $CONFIG; - $CONFIG->wordblacklist = array( - 'and', - 'the', - 'then', - 'but', - 'she', - 'his', - 'her', - 'him', - 'one', - 'not', - 'also', - 'about', - 'now', - 'hence', - 'however', - 'still', - 'likewise', - 'otherwise', - 'therefore', - 'conversely', - 'rather', - 'consequently', - 'furthermore', - 'nevertheless', - 'instead', - 'meanwhile', - 'accordingly', - 'this', - 'seems', - 'what', - 'whom', - 'whose', - 'whoever', - 'whomever', - ); + global $CONFIG; + + $CONFIG->wordblacklist = array(); + + $list = explode(',', elgg_echo('word:blacklist')); + if ($list) + { + foreach ($list as $l) + $CONFIG->wordblacklist[] = trim($l); + } + else + { + // Fallback - shouldn't happen + $CONFIG->wordblacklist = array( + 'and', + 'the', + 'then', + 'but', + 'she', + 'his', + 'her', + 'him', + 'one', + 'not', + 'also', + 'about', + 'now', + 'hence', + 'however', + 'still', + 'likewise', + 'otherwise', + 'therefore', + 'conversely', + 'rather', + 'consequently', + 'furthermore', + 'nevertheless', + 'instead', + 'meanwhile', + 'accordingly', + 'this', + 'seems', + 'what', + 'whom', + 'whose', + 'whoever', + 'whomever', + ); + } } register_elgg_event_handler("init","system","social_init"); diff --git a/languages/en.php b/languages/en.php index 40dd0ffc7..6b1f486cd 100644 --- a/languages/en.php +++ b/languages/en.php @@ -814,6 +814,11 @@ You cannot reply to this email.", 'actiongatekeeper:timeerror' => 'The page you were using has expired. Please refresh and try again.', 'actiongatekeeper:pluginprevents' => 'A extension has prevented this form from being submitted.', + /** + * Word blacklists + */ + 'word:blacklist' => 'and, the, then, but, she, his, her, him, one, not, also, about, now, hence, however, still, likewise, otherwise, therefore, conversely, rather, consequently, furthermore, nevertheless, instead, meanwhile, accordingly, this, seems, what, whom, whose, whoever, whomever', + /** * Languages according to ISO 639-1 */ -- cgit v1.2.3