Changeset f359950 in github
- Timestamp:
- Feb 8, 2012 6:58:33 AM (16 months ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.8
- Children:
- a7321e7
- Parents:
- 67e5925
- File:
-
- 1 edited
-
program/lib/html2text.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/lib/html2text.php
r67e5925 rf359950 250 250 */ 251 251 var $callback_search = array( 252 '/<(a) [^>]*href=("|\')([^"\']+)\2[^>]*>(.*?)<\/a>/i', 253 // <a href=""> 252 254 '/<(h)[123456][^>]*>(.*?)<\/h[123456]>/i', // H1 - H3 253 255 '/<(b)[^>]*>(.*?)<\/b>/i', // <b> 254 256 '/<(strong)[^>]*>(.*?)<\/strong>/i', // <strong> 255 '/<(a) [^>]*href=("|\')([^"\']+)\2[^>]*>(.*?)<\/a>/i',256 // <a href="">257 257 '/<(th)[^>]*>(.*?)<\/th>/i', // <th> and </th> 258 258 ); … … 676 676 case 'b': 677 677 case 'strong': 678 return $this->_ strtoupper($matches[2]);678 return $this->_toupper($matches[2]); 679 679 case 'th': 680 return $this->_ strtoupper("\t\t". $matches[2] ."\n");680 return $this->_toupper("\t\t". $matches[2] ."\n"); 681 681 case 'h': 682 return $this->_ strtoupper("\n\n". $matches[2] ."\n\n");682 return $this->_toupper("\n\n". $matches[2] ."\n\n"); 683 683 case 'a': 684 684 // Remove spaces in URL (#1487805) … … 700 700 701 701 /** 702 * Strtoupper multibyte wrapper function with HTML entities handling 703 * 704 * @param string $str Text to convert 705 * @return string Converted text 702 * Strtoupper function with HTML tags and entities handling. 703 * 704 * @param string $str Text to convert 705 * @return string Converted text 706 */ 707 private function _toupper($str) 708 { 709 // string can containg HTML tags 710 $chunks = preg_split('/(<[^>]*>)/', $str, null, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); 711 712 // convert toupper only the text between HTML tags 713 foreach ($chunks as $idx => $chunk) { 714 if ($chunk[0] != '<') { 715 $chunks[$idx] = $this->_strtoupper($chunk); 716 } 717 } 718 719 return implode($chunks); 720 } 721 722 /** 723 * Strtoupper multibyte wrapper function with HTML entities handling. 724 * 725 * @param string $str Text to convert 726 * @return string Converted text 706 727 */ 707 728 private function _strtoupper($str)
Note: See TracChangeset
for help on using the changeset viewer.
