[turba] patch for last names

Bo Daley bo at tilda.com.au
Thu Sep 11 19:12:27 PDT 2003


hi all,

this fixes a couple of issues I was having with names containing 
parentheses and other punctuation characters (mostly likely names of 
organisations rather than individuals).

hopefully this makes sense

bo.


-------------- next part --------------
Index: lib/Turba.php
===================================================================
RCS file: /repository/turba/lib/Turba.php,v
retrieving revision 1.39
diff -u -r1.39 Turba.php
--- lib/Turba.php	2 Sep 2003 19:21:13 -0000	1.39
+++ lib/Turba.php	12 Sep 2003 02:07:49 -0000
@@ -125,14 +125,14 @@
             }
 
             /* Take out anything in parentheses. */
-            $name = preg_replace('|\(.*\)|', '', $name);
+            $name = trim(preg_replace('|\(.*\)|', '', $name));
 
             $namelist = explode(' ', $name);
             $name = $namelist[($nameindex = (count($namelist) - 1))];
 
             while (String::length($name) < 5 &&
                    strspn($name[(String::length($name) - 1)], '.:-') &&
-                   isset($namelist[($nameindex - 1)])) {
+                   !empty($namelist[($nameindex - 1)])) {
                 $nameindex--;
                 $name = $namelist[$nameindex];
             }


More information about the turba mailing list