From 29422fa55379aa61a61019b832c83dab6d450264 Mon Sep 17 00:00:00 2001 From: cweiske Date: Sat, 3 Oct 2009 14:00:33 +0000 Subject: move files to new locations git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@386 b3834d28-1941-0410-a4f8-b48e95affb8f --- www/ajaxGetTitle.php | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 www/ajaxGetTitle.php (limited to 'www/ajaxGetTitle.php') diff --git a/www/ajaxGetTitle.php b/www/ajaxGetTitle.php new file mode 100644 index 0000000..fc895db --- /dev/null +++ b/www/ajaxGetTitle.php @@ -0,0 +1,73 @@ +(.*)<\/title>/si', $html, $matches); + $title = $matches[1][0]; + + // Get encoding from charset attribute + preg_match_all('//i', $html, $matches); + $encoding = strtoupper($matches[1][0]); + + // Convert to UTF-8 from the original encoding + if (function_exists("mb_convert_encoding")) { + $title = @mb_convert_encoding($title, 'UTF-8', $encoding); + } + + if (utf8_strlen($title) > 0) { + return $title; + } else { + // No title, so return filename + $uriparts = explode('/', $url); + $filename = end($uriparts); + unset($uriparts); + + return $filename; + } + } else { + return false; + } +} +echo ''; +?> + + +getTitle + + + + + -- cgit v1.2.3