Link temizleme
4
●522
- 06-03-2014, 11:23:20Php de str_replace fonksiyonu var. Tam da ihtiyacın olan şey. Bir incelersen kullanımı oldukça basittir.
- 06-03-2014, 11:35:36Üyeliği durdurulduSrCn adlı üyeden alıntı: mesajı görüntüle
function ClearText ($text) { $text = preg_replace( '/<div.+?>/', '', $text ); $text = preg_replace("'<script[^>]*>.*?</script>'si", '', $text ); $text = preg_replace( '/<!--.+?-->/', '', $text ); $text = preg_replace( '/<iframe.+?>/', '', $text ); $text = preg_replace( '/<a.+?>/', '', $text ); $text = preg_replace( '/<p class.+?>/', '<p>', $text ); $text = preg_replace( '/<p style.+?>/', '<p>', $text ); $text = preg_replace( '/<span.+?>/', '', $text ); $text = preg_replace( '/<input.+?>/', '', $text ); $text = preg_replace( '/<textarea.+?>/', '', $text ); $text = preg_replace( '/<label.+?>/', '', $text ); $text = preg_replace( '/<legend.+?>/', '', $text ); $text = preg_replace( '/<ul.+?>/', '', $text ); $text = preg_replace( '/<li.+?>/', '', $text ); $text = preg_replace( '/<table.+?>/', '', $text ); $text = preg_replace( '/<tbody.+?>/', '', $text ); $text = preg_replace( '/<td.+?>/', '', $text ); $text = preg_replace( '/<th.+?>/', '', $text ); $text = preg_replace( '/<tr.+?>/', '', $text ); $text = preg_replace( '/<em.+?>/', '', $text ); $text = preg_replace( '/<ins.+?>/', '', $text ); $text = preg_replace( '/<i.+?>/', '', $text ); $text = preg_replace( '/<address.+?>/', '', $text ); $text = preg_replace( '/{.+?}/', '', $text ); $text = preg_replace( '/ /', ' ', $text ); $text = preg_replace( '/&/', ' ', $text ); $text = preg_replace( '/"/', ' ', $text ); $text = preg_replace( '/'/', ' ', $text ); $text = preg_replace( '/’/', ' ', $text ); $text = str_replace(array('cihan.com.tr','aa.com.tr','iha.com.tr','CİHAN','AA','İHA','IHA','(DHA)','DHA','Haberin Devamı','</a>','<span>','</span>','</address>','</textarea>','</label>','</legend>','</ul>','</li>','</ins>','</table>','</tbody>','</th>','</td>','</tr>','</em>','</i>','</div>','</iframe>'), array(''), $text); return trim($text); }buyur hocam linkleri ve diger gelen işe yaramaz html kodları temizler