티스토리 뷰
/skin/board/스킨명/view.skin.php
/*
해킹방지를 위해 인코딩된 Youtube iframe 코드 :
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/_khfDbhitZw" width="560"></iframe>
*/
$youtube_embed_code_regexp_pattern = '<iframe.+?src="https?:\/\/www.youtube.com\/embed\/([a-zA-Z0-9_-]{11})"[^>]+?><\/iframe>';
preg_match("/{$youtube_embed_code_regexp_pattern}/i", $view["content"], $youtube_embed_codes);
if ($youtube_embed_codes) {
$youtube_embed_code = $youtube_embed_code_encoded = $youtube_embed_codes[0];
$youtube_embed_code = str_replace("<", "<", $youtube_embed_code);
$youtube_embed_code = str_replace(">", ">", $youtube_embed_code);
$view["content"] = str_replace($youtube_embed_code_encoded, $youtube_embed_code, $view["content"]);
}
정규식 확인 [새창]
'웹프로그래밍 > PHP' 카테고리의 다른 글
| PHP Composer package version 표현법 (0) | 2015.02.25 |
|---|---|
| Laravel Framework 설치 (0) | 2015.02.25 |
| 그누보드4 가변 파일 (다중 파일 업로드) 웹접근성 개선 (0) | 2015.01.12 |
| PHP 다국어 지역화 gettext() *.po *.mo (1) | 2015.01.06 |
| 워드프레스 사이트/경로 이전 (0) | 2014.12.16 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- API
- iphone
- macos
- 한글
- Android
- Mac
- JSON
- Debug
- javascript
- Prototype
- nginx
- centos
- IOS
- IE
- git
- mssql
- CSS
- ASP
- Wordpress
- sencha touch
- iis
- JQuery
- Docker
- Linux
- 안드로이드
- 워드프레스
- laravel
- classic asp
- PHP
- nodejs
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함