Changeset 633
- Timestamp:
- 06/02/2011 02:40:27 AM (12 months ago)
- File:
-
- 1 edited
-
trunk/WordPress/plugin/transposh/core/parser.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/core/parser.php
r632 r633 16 16 require_once("logging.php"); 17 17 require_once("utils.php"); 18 19 define('PUNCT_BREAKS', TRUE); // Will punctiations such as , . ( and such will break a phrase 20 define('NUM_BREAKS', TRUE); // Will a number break a phrase 21 define('ENT_BREAKS', TRUE); // Will an HTML entity break a phrase 18 22 19 23 /** … … 341 345 while ($pos < strlen($string)) { 342 346 // Some HTML entities make us break, almost all but apostrophies 343 if ( $len_of_entity = $this->is_html_entity($string, $pos)) {347 if (ENT_BREAKS && $len_of_entity = $this->is_html_entity($string, $pos)) { 344 348 $entity = substr($string, $pos, $len_of_entity); 345 349 if (($this->is_white_space(@$string[$pos + $len_of_entity]) || $this->is_entity_breaker($entity)) && !$this->is_entity_letter($entity)) { … … 382 386 } 383 387 // will break translation unit when there's a breaker ",.[]()..." 384 elseif ( $senb_len = $this->is_sentence_breaker($string[$pos], @$string[$pos + 1], @$string[$pos + 2])) {388 elseif (PUNCT_BREAKS && $senb_len = $this->is_sentence_breaker($string[$pos], @$string[$pos + 1], @$string[$pos + 2])) { 385 389 // logger ("sentence breaker..."); 386 390 $this->tag_phrase($string, $start, $pos); … … 390 394 // Numbers also break, if they are followed by whitespace (or a sentence breaker) (don't break 42nd) // TODO: probably by breaking entities too... 391 395 // also prefixed by whitespace? 392 elseif ( $num_len = $this->is_number($string, $pos)) {396 elseif (NUM_BREAKS && $num_len = $this->is_number($string, $pos)) { 393 397 // logger ("numnum... $num_len"); 394 398 // this is the case of B2 or B2, … … 695 699 //fix urls more 696 700 // WORK IN PROGRESS 697 /*foreach ($this->atags as $e) { 698 $hrefspans = ''; 699 foreach (call_user_func_array($this->split_url_func, array($e->href)) as $part) { 700 // fix - not for dashes 701 list ($source, $translated_text) = call_user_func_array($this->fetch_translate_func, array($part, $this->lang)); 702 $hrefspans .= $this->create_edit_span($part, $translated_text, $source, true); 703 } 701 /* foreach ($this->atags as $e) { 702 $hrefspans = ''; 703 foreach (call_user_func_array($this->split_url_func, array($e->href)) as $part) { 704 // fix - not for dashes 705 list ($source, $translated_text) = call_user_func_array($this->fetch_translate_func, array($part, $this->lang)); 706 $hrefspans .= $this->create_edit_span($part, $translated_text, $source, true); 707 } 708 $e->href = call_user_func_array($this->url_rewrite_func, array($e->href)); 709 $e->outertext .= $hrefspans; 710 } */ 711 712 // fix urls... 713 foreach ($this->atags as $e) { 704 714 $e->href = call_user_func_array($this->url_rewrite_func, array($e->href)); 705 $e->outertext .= $hrefspans;706 }*/707 708 // fix urls...709 foreach ($this->atags as $e) {710 $e->href = call_user_func_array($this->url_rewrite_func, array($e->href));711 715 } 712 716 foreach ($this->otags as $e) {
Note: See TracChangeset
for help on using the changeset viewer.
