Changeset 430
- Timestamp:
- Oct 31, 2013 9:21:07 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1dev/lib/SpellCheck.inc.php
r429 r430 202 202 // http://stackoverflow.com/questions/790596/split-a-text-into-single-words 203 203 $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}ââ-]+|(\p{P}+$))/", $string); 204 // Remove non-word elements.205 $words = preg_grep('/\w+/', $words);206 207 204 if (is_array($words) && !empty($words)) { 205 // Remove non-word elements. 206 $words = preg_grep('/\w+/', $words); 207 $words = array_map('strip_tags', $words); 208 208 foreach ($words as $i => $word) { 209 209 if (!$this->check($word)) { … … 238 238 // http://stackoverflow.com/questions/790596/split-a-text-into-single-words 239 239 $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}ââ-]+|(\p{P}+$))/", $string); 240 // Remove non-word elements.241 $check_words = preg_grep('/\w+/', $words);242 243 if (is_array($check_words) && !empty($check_words)) {244 foreach ($ check_words as $i => $word) {240 if (is_array($words) && !empty($words)) { 241 // Remove non-word elements. 242 $words = preg_grep('/\w+/', $words); 243 $words = array_map('strip_tags', $words); 244 foreach ($words as $i => $word) { 245 245 if (!$this->check($word)) { 246 246 $errors[] = $word; … … 271 271 // http://stackoverflow.com/questions/790596/split-a-text-into-single-words 272 272 $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}ââ-]+|(\p{P}+$))/", $string); 273 $check_words = preg_grep('/\w+/', $words);274 273 $cnt = 0; 275 if (is_array($check_words) && !empty($check_words)) { 276 foreach ($check_words as $i => $word) { 274 if (is_array($words) && !empty($words)) { 275 $words = preg_grep('/\w+/', $words); 276 foreach ($words as $i => $word) { 277 277 if (!$this->check($word)) { 278 278 $footnote = $show_footnote ? '<sup style="color:#999;">' . ++$cnt . '</sup>' : ''; … … 300 300 <?php 301 301 302 $form_words = array_values($this->getStringSuggestions(getFormData($form_name)));302 $form_words = $this->getStringSuggestions(getFormData($form_name)); 303 303 if (is_array($form_words) && !empty($form_words)) { 304 304 ?><ol><?php 305 $j = 1; 305 306 foreach ($form_words as $i => $words) { 306 307 ?> 307 308 <li> 308 <label style="color:#999;"><sub style="vertical-align:text-top;"><?php echo $ i + 1; ?></sub></label>309 <label style="color:#999;"><sub style="vertical-align:text-top;"><?php echo $j++; ?></sub></label> 309 310 <select name="spelling_suggestions[<?php echo $form_name ?>][<?php echo $i ?>]" onchange="document.forms[0].elements['spelling_corrections[<?php echo $form_name ?>][<?php echo $i ?>]'].value = this.value;"> 310 311 <?php $original_word = array_shift($words); ?>
Note: See TracChangeset
for help on using the changeset viewer.