[이윰] 본문 내용 추출시 특정 태그 제거하기
페이지 정보
루루아빠
3,265
2016.05.09 17:45:25
짧은주소
-
https://yadolee.com/tip/398 주소복사
본문
그누보드5/eyoom/classes/eyoom.class.php 를 열고 public function remove_editor_code($content) { 를 검색한다.
수정 전
수정 전
public function remove_editor_code($content) {
$content = preg_replace("/\\n/","",$content);
$content = preg_replace("/\s{2,}/","",$content);
$content = preg_replace("/{CODE\s*\:([^}]*)}(.*?){\/CODE}/is","",$content);
return $content;
}
수정 후
public function remove_editor_code($content) {
$content = preg_replace("/\\n/","",$content);
$content = preg_replace("/\s{2,}/","",$content);
$content = preg_replace("/{CODE\s*\:([^}]*)}(.*?){\/CODE}/is","",$content);
$content = preg_replace("/{http\s*\:([^}]*)}/i","",$content); // 본문 내용 추출시 댓글 외부 이미지 코드 제거
$content = preg_replace("!<iframe(.*?)<\/iframe>!is","",$content); // 본문 내용 추출시 iframe 태그 제거
$content = preg_replace("!<script(.*?)<\/script>!is","",$content); // 본문 내용 추출시 script 태그 제거
$content = preg_replace("!<style(.*?)<\/style>!is","",$content); // 본문 내용 추출시 style 태그 제거
return $content;
}
상기 코드를 추가하면 게시글 목록과 최신글에서 본문 내용 추출시 iframe, script, style 이 제거된 후 텍스트만 표시된다.
추천인
레벨 101
경험치 1,519,440
Progress Bar 14.66%
- 가입일 : 2015-03-04 03:24:54
- 서명 : KNOW YOUR LIMITS
BUT NEVER STOP TRYING TO EXCEED THEM !!
- 자기소개 : 루루의 자랑
루루아빠랍니다~~
최신댓글이 없습니다.


댓글
첫 번째 댓글을 남겨 주세요