function get_text($str, $html = 0) { /* 3.22 막음 (HTML 체크 줄바꿈시 출력 오류때문) $source[] = "/ /"; $target[] = " "; */ // 3.31 // TEXT 출력일 경우 & 등의 코드를 정상으로 출력해 주기 위함 if ($html == 0) { $str = html_symbol($str); } $source[] = "/</"; $target[] = "<"; $source[] = "/>/"; $target[] = ">"; //$source[] = "/\"/"; //$target[] = """; $source[] = "/\\'/"; $target[] = "'"; //$source[] = "/}/"; $target[] = "}"; if ($html) { $source[] = "/\n/"; $target[] = "<br/>"; } return preg_replace($source, $target, $str); }
function get_text($str, $html = 0, $restore = false) { $source[] = "<"; $target[] = "<"; $source[] = ">"; $target[] = ">"; $source[] = "\""; $target[] = """; $source[] = "\\'"; $target[] = "'"; if ($restore) { $str = str_replace($target, $source, $str); } // 3.31 // TEXT 출력일 경우 & 등의 코드를 정상으로 출력해 주기 위함 if ($html == 0) { $str = html_symbol($str); } if ($html) { $source[] = "\n"; $target[] = "<br/>"; } return str_replace($source, $target, $str); }
/** * * html 을 text 데이터로 변환 * * @param string $content HTML * @return string TEXT 데이터 */ protected function _wikiTxt($content) { $content = html_symbol($content); $content = get_text($content, 0); return $content; }
/** * * Html to Text * * HTML 태그들을 <, > 등의 문자들로 변환 * * @param string $content HTML 컨텐트 * @return string text 데이터 */ function wiki_text($content) { $content = html_symbol($content); $content = get_text($content, 0); return $content; }