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