Development

Changeset 6983

You must first sign up to be able to contribute.

Changeset 6983

Show
Ignore:
Timestamp:
01/07/08 06:51:32 (8 months ago)
Author:
hartym
Message:

dkAntispamPlugin: refactored spam strings regexp-ification to sonfig handler, to avoid overhead

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/dkAntispamPlugin/trunk/lib/dkAntispam.class.php

    r6832 r6983  
    3939    foreach ($this->config['words'] as $word) 
    4040    { 
    41       $word = str_replace(array('a','e','i','o','l','x'), array('[a4@]','[e3]','[il1]','([o0]|\(\))','[il1]','(x|><)'), $word); 
    42  
    4341      $score += 2 * preg_match_all('/'.$word.'/', $text, $result); 
    4442 
  • plugins/dkAntispamPlugin/trunk/lib/dkAntispamConfigHandler.class.php

    r6832 r6983  
    1313    $config = sfToolKit::arrayDeepMerge(isset($config['all'])?$config['all']:array(), isset($config[$environment])?$config[$environment]:array()); 
    1414 
     15    foreach ($config['words'] as $index => $word) 
     16    { 
     17      $word = str_replace(array('a','e','i','o','l','x'), array('@A@','@E@','@I@','@O@','@L@','@X@'), $word); 
     18      $config['words'][$index] = str_replace(array('@A@','@E@','@I@','@O@','@L@','@X@'), array('[a4@]','[e3]','[il1]','([o0]|\(\))','[il1]','(x|><)'), $word); 
     19    } 
     20 
    1521    $code = sprintf("<?php\n" . 
    1622                    "// auto-generated by dkAntispamConfigHandler\n" .