@@ 433-451 (lines=19) @@ | ||
430 | return $body; |
|
431 | } |
|
432 | ||
433 | function _getSummary($content, $str_size = 50) |
|
434 | { |
|
435 | $content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content); |
|
436 | // Replace tags such as </p> , </div> , </li> and others to a whitespace |
|
437 | $content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content); |
|
438 | // Remove Tag |
|
439 | $content = preg_replace('!<([^>]*?)>!is','', $content); |
|
440 | // Replace tags to <, >, " and whitespace |
|
441 | $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); |
|
442 | // Delete a series of whitespaces |
|
443 | $content = preg_replace('/ ( +)/is', ' ', $content); |
|
444 | // Truncate string |
|
445 | $content = trim(cut_str($content, $str_size, $tail)); |
|
446 | // Replace back <, >, " to the original tags |
|
447 | $content = str_replace(array('<','>','"'),array('<','>','"'), $content); |
|
448 | // Fixed to a newline bug for consecutive sets of English letters |
|
449 | $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content); |
|
450 | return $content; |
|
451 | } |
|
452 | ||
453 | /** |
|
454 | * @brief function to receive contents from rss url |
@@ 380-398 (lines=19) @@ | ||
377 | return $body; |
|
378 | } |
|
379 | ||
380 | function _getSummary($content, $str_size = 50) |
|
381 | { |
|
382 | $content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content); |
|
383 | // Replace tags such as </p> , </div> , </li> and others to a whitespace |
|
384 | $content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content); |
|
385 | // Remove Tag |
|
386 | $content = preg_replace('!<([^>]*?)>!is','', $content); |
|
387 | // Replace tags to < , > , " |
|
388 | $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); |
|
389 | // Delete a series of whitespaces |
|
390 | $content = preg_replace('/ ( +)/is', ' ', $content); |
|
391 | // Truncate string |
|
392 | $content = trim(cut_str($content, $str_size, $tail)); |
|
393 | // Replace back < , > , " to theoriginal tags |
|
394 | $content = str_replace(array('<','>','"'),array('<','>','"'), $content); |
|
395 | // Fixed a newline bug on a set of consecutive English letters |
|
396 | $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content); |
|
397 | return $content; |
|
398 | } |
|
399 | ||
400 | ||
401 | /** |