Changeset 11294
- Timestamp:
- 07/20/07 14:29:39 (1 year ago)
- Files:
-
- trunk/midcom/net.nemein.bannedwords/config/config.inc (modified) (1 diff)
- trunk/midcom/net.nemein.bannedwords/config/manifest.inc (modified) (1 diff)
- trunk/midcom/net.nemein.bannedwords/config/mgdschema.sql (modified) (2 diffs)
- trunk/midcom/net.nemein.bannedwords/config/mgdschema.xml (modified) (1 diff)
- trunk/midcom/net.nemein.bannedwords/config/schemadb_default.inc (added)
- trunk/midcom/net.nemein.bannedwords/editor.php (added)
- trunk/midcom/net.nemein.bannedwords/locale/default.en.txt (modified) (1 diff)
- trunk/midcom/net.nemein.bannedwords/main.php (modified) (4 diffs)
- trunk/midcom/net.nemein.bannedwords/style (added)
- trunk/midcom/net.nemein.bannedwords/style/net_nemein_bannedwords_editor.php (added)
- trunk/midcom/net.nemein.bannedwords/style/net_nemein_bannedwords_word_add.php (added)
- trunk/midcom/net.nemein.bannedwords/style/net_nemein_bannedwords_word_edit.php (added)
- trunk/midcom/net.nemein.bannedwords/style/net_nemein_bannedwords_wordlist_end.php (added)
- trunk/midcom/net.nemein.bannedwords/style/net_nemein_bannedwords_wordlist_item.php (added)
- trunk/midcom/net.nemein.bannedwords/style/net_nemein_bannedwords_wordlist_start.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/net.nemein.bannedwords/config/config.inc
r11274 r11294 1 /** 2 * These configure how to show the censored words. 3 * Default is "***Censored***" 4 */ 5 'censored_start' => '***', 6 'censored_end' => '***', 7 'censored_word_id' => 'censored', 8 'censored_custom_word' => '', 9 10 /** 11 * Global word libary is in sg0 and can be used by 12 * any website. Local library is only useable by 13 * the current sitegroup 14 */ 15 'use_global_word_library' => true, 16 'use_local_word_library' => true, 17 trunk/midcom/net.nemein.bannedwords/config/manifest.inc
r11274 r11294 18 18 ), 19 19 ), 20 'customdata' => array( 21 'request_handler_plugin' => array( 22 'class' => 'net_nemein_bannedwords_edit_handler', 23 'src' => 'file:/net/nemein/bannedwords/editor.php', 24 'name' => 'Banned words editor', 25 'config' => null, 26 ), 27 ), trunk/midcom/net.nemein.bannedwords/config/mgdschema.sql
r11274 r11294 1 1 CREATE TABLE net_nemein_bannedwords_word ( 2 2 bannedWord varchar(255) NOT NULL default '', 3 description varchar(255) NOT NULL default '', 4 language varchar(255) NOT NULL default '', 3 5 # 4 6 id int(11) NOT NULL auto_increment, … … 8 10 # 9 11 KEY net_nemein_bannedwords_word_idx (`bannedWord`(30)), 12 KEY net_nemein_description_word_idx (`description`(30)), 13 KEY net_nemein_language_word_idx (`language`(30)), 10 14 ); trunk/midcom/net.nemein.bannedwords/config/mgdschema.xml
r11274 r11294 4 4 <property name="id" type="integer" primaryfield="id" /> 5 5 <property name="bannedWord" type="text"/> 6 <property name="description" type="text"/> 7 <property name="language" type="text"/> 6 8 </type> 7 9 </Schema> trunk/midcom/net.nemein.bannedwords/locale/default.en.txt
r11274 r11294 15 15 Delete 16 16 ---STRINGEND 17 18 ---STRING banned editor 19 Banned words editor 20 ---STRINGEND trunk/midcom/net.nemein.bannedwords/main.php
r11274 r11294 11 11 var $_sitegroup = null; 12 12 13 var $_language = "en"; 14 13 15 function net_nemein_bannedwords_handler() 14 16 { … … 19 21 } 20 22 23 function set_language($language) 24 { 25 $this->_language = $language; 26 } 27 21 28 function _populate_word_list() 22 29 { 23 30 $qb = net_nemein_bannedwords_word_dba::new_query_builder(); 24 $qb->add_constraint('sitegroup', '=', $this->_sitegroup); 31 $qb->add_constraint('language', '=', $this->_language); 32 33 if ($this->_config->get('use_global_word_library') && $this->_config->get('use_local_word_library')) 34 { 35 $qb->add_constraint('sitegroup', 'IN', array(0, $this->_sitegroup)); 36 } 37 elseif ($this->_config->get(use_global_word_library)) 38 { 39 $qb->add_constraint('sitegroup', '=', 0); 40 } 41 elseif ($this->_config->get('use_local_word_library')) 42 { 43 $qb->add_constraint('sitegroup', '=', $this->_sitegroup); 44 } 45 25 46 $banned_objects = $qb->execute(); 26 47 … … 42 63 if (!empty($this->_banned_words)) 43 64 { 65 $censored_start = ""; 66 $censored_end = ""; 67 $censored_word_id = ""; 68 $censored_custom_word = ""; 69 70 if ($this->_config->get('censored_start')) 71 { 72 $censored_start = $this->_config->get('censored_start'); 73 } 74 if ($this->_config->get('censored_end')) 75 { 76 $censored_end = $this->_config->get('censored_end'); 77 } 78 if ($this->_config->get('censored_word_id')) 79 { 80 $censored_word_id = $this->_config->get('censored_word_id'); 81 } 82 if ($this->_config->get('censored_custom_word')) 83 { 84 $censored_custom_word = $this->_config->get('censored_custom_word'); 85 } 86 44 87 $regexp = $this->_build_regexp(); 45 $censored = "<span class=\"net_nemein_bannedwords_censored\">***{$this->_l10n->get('censored')}***</span>"; 88 $censored = "<span class=\"net_nemein_bannedwords_censored\">{$censored_start}"; 89 if (!empty($censored_custom_word)) 90 { 91 $censored .= $censored_custom_word; 92 } 93 else 94 { 95 $censored .= $this->_l10n->get($censored_word_id); 96 } 97 $censored .= "{$censored_end}</span>"; 98 46 99 $processed_content = eregi_replace($regexp, $censored, $content); 47 100 … … 66 119 return $processed_content; 67 120 } 121 } 122 123 function search_banned_words($content) 124 { 125 $content = strip_tags($content); 126 127 // Not working for some reason 128 $order = array('\r\n', '\r', '\n'); 129 str_replace($order, " ", $content); 130 131 if (!empty($this->_banned_words)) 132 { 133 $matches = array(); 134 $regexp = $this->_build_regexp(); 135 $words = explode(" ", $content); 136 137 foreach($words as $key => $word) 138 { 139 if (eregi($regexp, $word)) 140 { 141 $matches[$key] = $word; 142 } 143 } 144 145 return $matches; 146 } 147 148 return false; 68 149 } 69 150
