]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2339 - removes social library and deprecates its two functions (put it output...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 14 Oct 2010 11:06:19 +0000 (11:06 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 14 Oct 2010 11:06:19 +0000 (11:06 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7078 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/elgglib.php
engine/lib/output.php
engine/lib/social.php [deleted file]
engine/start.php
install/ElggInstaller.php

index 5b224e0be70429083af9842f2b243e3727a696f2..675c0143edccda463e0731902f55095b0d9d38cf 100644 (file)
@@ -2265,6 +2265,17 @@ function elgg_init() {
 
        // Trigger the shutdown:system event upon PHP shutdown.
        register_shutdown_function('__elgg_shutdown_hook');
+
+       // Sets a blacklist of words in the current language.
+       // This is a comma separated list in word:blacklist.
+       // @todo possibly deprecate
+       $CONFIG->wordblacklist = array();
+       $list = explode(',', elgg_echo('word:blacklist'));
+       if ($list) {
+               foreach ($list as $l) {
+                       $CONFIG->wordblacklist[] = trim($l);
+               }
+       }
 }
 
 /**
index 640ada1cfda4a0673e211a3063beb430149cfcb1..28e520e564026f40260892787c855012ed0abc9d 100644 (file)
@@ -263,3 +263,60 @@ function elgg_strip_tags($string) {
 
        return $string;
 }
+
+/**
+  * Filters a string into an array of significant words
+  *
+  * @deprecated 1.8
+  * @param string $string
+  * @return array
+  */
+function filter_string($string) {
+       elgg_deprecated_notice('filter_string() was deprecated!', 1.8);
+
+       // Convert it to lower and trim
+       $string = strtolower($string);
+       $string = trim($string);
+
+       // Remove links and email addresses
+       // match protocol://address/path/file.extension?some=variable&another=asf%
+       $string = preg_replace("/\s([a-zA-Z]+:\/\/[a-z][a-z0-9\_\.\-]*[a-z]{2,6}[a-zA-Z0-9\/\*\-\?\&\%\=]*)([\s|\.|\,])/iu"," ", $string);
+       // match www.something.domain/path/file.extension?some=variable&another=asf%
+       $string = preg_replace("/\s(www\.[a-z][a-z0-9\_\.\-]*[a-z]{2,6}[a-zA-Z0-9\/\*\-\?\&\%\=]*)([\s|\.|\,])/iu"," ", $string);
+       // match name@address
+       $string = preg_replace("/\s([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})([\s|\.|\,])/iu"," ", $string);
+
+       // Sanitise the string; remove unwanted characters
+       $string = preg_replace('/\W/ui', ' ', $string);
+
+       // Explode it into an array
+       $terms = explode(' ',$string);
+
+       // Remove any blacklist terms
+       //$terms = array_filter($terms, 'remove_blacklist');
+
+       return $terms;
+}
+
+/**
+ * Returns true if the word in $input is considered significant
+ *
+ * @deprecated 1.8
+ * @param string $input
+ * @return true|false
+ */
+function remove_blacklist($input) {
+       elgg_deprecated_notice('remove_blacklist() was deprecated!', 1.8);
+
+       global $CONFIG;
+
+       if (!is_array($CONFIG->wordblacklist)) {
+               return $input;
+       }
+
+       if (strlen($input) < 3 || in_array($input,$CONFIG->wordblacklist)) {
+               return false;
+       }
+
+       return true;
+}
\ No newline at end of file
diff --git a/engine/lib/social.php b/engine/lib/social.php
deleted file mode 100644 (file)
index 381c7ea..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-/**
- * Elgg Social
- * Functions and objects which provide powerful social aspects within Elgg
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider
- * @link http://elgg.org/
-
-/**
-  * Filters a string into an array of significant words
-  *
-  * @param string $string
-  * @return array
-  */
-function filter_string($string) {
-       // Convert it to lower and trim
-       $string = strtolower($string);
-       $string = trim($string);
-
-       // Remove links and email addresses
-       // match protocol://address/path/file.extension?some=variable&another=asf%
-       $string = preg_replace("/\s([a-zA-Z]+:\/\/[a-z][a-z0-9\_\.\-]*[a-z]{2,6}[a-zA-Z0-9\/\*\-\?\&\%\=]*)([\s|\.|\,])/iu"," ", $string);
-       // match www.something.domain/path/file.extension?some=variable&another=asf%
-       $string = preg_replace("/\s(www\.[a-z][a-z0-9\_\.\-]*[a-z]{2,6}[a-zA-Z0-9\/\*\-\?\&\%\=]*)([\s|\.|\,])/iu"," ", $string);
-       // match name@address
-       $string = preg_replace("/\s([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})([\s|\.|\,])/iu"," ", $string);
-
-       // Sanitise the string; remove unwanted characters
-       $string = preg_replace('/\W/ui', ' ', $string);
-
-       // Explode it into an array
-       $terms = explode(' ',$string);
-
-       // Remove any blacklist terms
-       //$terms = array_filter($terms, 'remove_blacklist');
-
-       return $terms;
-}
-
-/**
- * Returns true if the word in $input is considered significant
- *
- * @param string $input
- * @return true|false
- */
-function remove_blacklist($input) {
-       global $CONFIG;
-
-       if (!is_array($CONFIG->wordblacklist)) {
-               return $input;
-       }
-
-       if (strlen($input) < 3 || in_array($input,$CONFIG->wordblacklist)) {
-               return false;
-       }
-
-       return true;
-}
-
-
-/**
- * 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();
-
-       $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");
\ No newline at end of file
index 18be0181d3348c8121ad3c95a39537374b8f5734..4bc1abd451a0d258d0546225528473e3d127c19d 100644 (file)
@@ -98,7 +98,7 @@ $lib_files = array(
        'memcache.php', 'metadata.php', 'metastrings.php', 'notification.php',
        'objects.php', 'opendd.php', 'pagehandler.php',
        'pageowner.php', 'pam.php', 'plugins.php', 'query.php',
-       'relationships.php', 'river.php', 'sites.php', 'social.php',
+       'relationships.php', 'river.php', 'sites.php',
        'statistics.php', 'system_log.php', 'tags.php', 'usersettings.php',
        'users.php', 'version.php', 'widgets.php', 'xml.php', 'xml-rpc.php'
 );
index 304eb18b7d6cd48183324fc5c55a1b45ac89d376..d3cc523c869bdd4812cf70cd95d411e8ce89fc44 100644 (file)
@@ -708,7 +708,7 @@ class ElggInstaller {
                                'memcache.php', 'metadata.php', 'metastrings.php', 'notification.php',
                                'objects.php', 'opendd.php', 'pagehandler.php',
                                'pageowner.php', 'pam.php', 'plugins.php', 'query.php',
-                               'relationships.php', 'river.php', 'sites.php', 'social.php',
+                               'relationships.php', 'river.php', 'sites.php',
                                'statistics.php', 'tags.php', 'usersettings.php',
                                'users.php', 'version.php', 'widgets.php', 'xml.php', 'xml-rpc.php'
                        );