Hi
I want to sugest new (I haven't found it in the script) option. Automaticly downloading title and description (from Meta
Tags) of page we want to add. Perhaps this script could be used:
<?php
/*
// getPageInfo.php - skrypt do pobierania META danych stron www
// Copyright (C) 2006 Yuriy Hatala (yuriy@myth.org.ua)
//
// Niniejszy program jest wolnym oprogramowaniem; mo?esz go
// rozprowadza? dalej i/lub modyfikowa? na warunkach Powszechnej
// Licencji Publicznej GNU, wydanej przez Fundacj? Wolnego
// Oprogramowania - wed?ug wersji 2-giej tej Licencji lub której?
// z pó?niejszych wersji.
//
// Niniejszy program rozpowszechniany jest z nadziej?, i? b?dzie on
// u?yteczny - jednak BEZ JAKIEJKOLWIEK GWARANCJI, nawet domy?lnej
// gwarancji PRZYDATNO?CI HANDLOWEJ albo PRZYDATNO?CI DO OKRE?LONYCH
// ZASTOSOWA?. W celu uzyskania bli?szych informacji - Powszechna
// Licencja Publiczna GNU.
*/
function iso2utf()
{
return array(
"\xb1" => "\xc4\x85", "\xa1" => "\xc4\x84", "\xe6" =>
"\xc4\x87",
"\xc6" => "\xc4\x86", "\xea" => "\xc4\x99", "\xca" =>
"\xc4\x98",
"\xb3" => "\xc5\x82", "\xa3" => "\xc5\x81", "\xf3" =>
"\xc3\xb3",
"\xd3" => "\xc3\x93", "\xb6" => "\xc5\x9b", "\xa6" =>
"\xc5\x9a",
"\xbc" => "\xc5\xbc", "\xac" => "\xc5\xbb", "\xbf" =>
"\xc5\xba",
"\xaf" => "\xc5\xb9", "\xf1" => "\xc5\x84", "\xd1" =>
"\xc5\x83");
}
function win2utf()
{
return array(
"\xb9" => "\xc4\x85", "\xa5" => "\xc4\x84", "\xe6" =>
"\xc4\x87",
"\xc6" => "\xc4\x86", "\xea" => "\xc4\x99", "\xca" =>
"\xc4\x98",
"\xb3" => "\xc5\x82", "\xa3" => "\xc5\x81", "\xf3" =>
"\xc3\xb3",
"\xd3" => "\xc3\x93", "\x9c" => "\xc5\x9b", "\x8c" =>
"\xc5\x9a",
"\x9f" => "\xc5\xbc", "\xaf" => "\xc5\xbb", "\xbf" =>
"\xc5\xba",
"\xac" => "\xc5\xb9", "\xf1" => "\xc5\x84", "\xd1" =>
"\xc5\x83");
}
function iso2win()
{
return array(
"\xa" => "\xa5", "\xa6" => "\x8c", "\xac" =>
"\x8f",
"\xb1" => "\xb9", "\xb6" => "\x9c", "\xbc" =>
"\x9f");
}
function GetPageInfo($PageURL)
{
$Content = '';
$ReturnArray = array();
$Header = array( 'title' => '/(<title>)(.+)(<\/title>)/i',
'description'=>
'/(name=[\'\"]?description[\'\"]?\s*content=[\'\"]?)((.(?!>))+)([\'\"]?\s*\/?>)/i',
'keywords' =>
'/(name=[\'\"]?keywords[\'\"]?\s*content=[\'\"]?)((.(?!>))+)([\'\"]?\s*\/?>)/i',
'charset' => '/(charset=[\'\"]?)((.(?!>))+)([\'\"]?\s*\/?>)/i');
if (!empty($PageURL))
{
$handle = fopen($PageURL, "r");
if (is_resource($handle) && ($handle !== FALSE))
{
while (!(preg_match("/<\/head>/i", $Content)) && !feof($handle))
{ $Content .= preg_replace("/[\r\n]+/", "", fread($handle, 256)); }
if (!empty($Content))
{
foreach ($Header as $key => $value)
{
$Result = array();
if (preg_match($value, $Content, $Result))
{ $ReturnArray[$key] = preg_replace("/\s+/", " ", (preg_replace("/,/",
", ", $Result[2]))); }
}
}
}
fclose($handle);
if (!preg_match("/^iso/i", $ReturnArray['charset']))
{
$RecodeArray = array();
switch (strtolower(substr($ReturnArray['charset'], 0, 3)))
{
case 'win' : $RecodeArray = array_flip(iso2win()); break;
case 'utf' : $RecodeArray = array_flip(iso2utf()); break;
}
foreach ($ReturnArray as $key => $value) { $ReturnArray[$key] = strtr($value, $RecodeArray); }
}
}
return $ReturnArray;
}
?>
I think It could help a lot.
and
I want to ask again about other languages of this script, is there any chance for a translation?
I want to sugest new (I haven't found it in the script) option. Automaticly downloading title and description (from Meta
Tags) of page we want to add. Perhaps this script could be used:
<?php
/*
// getPageInfo.php - skrypt do pobierania META danych stron www
// Copyright (C) 2006 Yuriy Hatala (yuriy@myth.org.ua)
//
// Niniejszy program jest wolnym oprogramowaniem; mo?esz go
// rozprowadza? dalej i/lub modyfikowa? na warunkach Powszechnej
// Licencji Publicznej GNU, wydanej przez Fundacj? Wolnego
// Oprogramowania - wed?ug wersji 2-giej tej Licencji lub której?
// z pó?niejszych wersji.
//
// Niniejszy program rozpowszechniany jest z nadziej?, i? b?dzie on
// u?yteczny - jednak BEZ JAKIEJKOLWIEK GWARANCJI, nawet domy?lnej
// gwarancji PRZYDATNO?CI HANDLOWEJ albo PRZYDATNO?CI DO OKRE?LONYCH
// ZASTOSOWA?. W celu uzyskania bli?szych informacji - Powszechna
// Licencja Publiczna GNU.
*/
function iso2utf()
{
return array(
"\xb1" => "\xc4\x85", "\xa1" => "\xc4\x84", "\xe6" =>
"\xc4\x87",
"\xc6" => "\xc4\x86", "\xea" => "\xc4\x99", "\xca" =>
"\xc4\x98",
"\xb3" => "\xc5\x82", "\xa3" => "\xc5\x81", "\xf3" =>
"\xc3\xb3",
"\xd3" => "\xc3\x93", "\xb6" => "\xc5\x9b", "\xa6" =>
"\xc5\x9a",
"\xbc" => "\xc5\xbc", "\xac" => "\xc5\xbb", "\xbf" =>
"\xc5\xba",
"\xaf" => "\xc5\xb9", "\xf1" => "\xc5\x84", "\xd1" =>
"\xc5\x83");
}
function win2utf()
{
return array(
"\xb9" => "\xc4\x85", "\xa5" => "\xc4\x84", "\xe6" =>
"\xc4\x87",
"\xc6" => "\xc4\x86", "\xea" => "\xc4\x99", "\xca" =>
"\xc4\x98",
"\xb3" => "\xc5\x82", "\xa3" => "\xc5\x81", "\xf3" =>
"\xc3\xb3",
"\xd3" => "\xc3\x93", "\x9c" => "\xc5\x9b", "\x8c" =>
"\xc5\x9a",
"\x9f" => "\xc5\xbc", "\xaf" => "\xc5\xbb", "\xbf" =>
"\xc5\xba",
"\xac" => "\xc5\xb9", "\xf1" => "\xc5\x84", "\xd1" =>
"\xc5\x83");
}
function iso2win()
{
return array(
"\xa" => "\xa5", "\xa6" => "\x8c", "\xac" =>
"\x8f",
"\xb1" => "\xb9", "\xb6" => "\x9c", "\xbc" =>
"\x9f");
}
function GetPageInfo($PageURL)
{
$Content = '';
$ReturnArray = array();
$Header = array( 'title' => '/(<title>)(.+)(<\/title>)/i',
'description'=>
'/(name=[\'\"]?description[\'\"]?\s*content=[\'\"]?)((.(?!>))+)([\'\"]?\s*\/?>)/i',
'keywords' =>
'/(name=[\'\"]?keywords[\'\"]?\s*content=[\'\"]?)((.(?!>))+)([\'\"]?\s*\/?>)/i',
'charset' => '/(charset=[\'\"]?)((.(?!>))+)([\'\"]?\s*\/?>)/i');
if (!empty($PageURL))
{
$handle = fopen($PageURL, "r");
if (is_resource($handle) && ($handle !== FALSE))
{
while (!(preg_match("/<\/head>/i", $Content)) && !feof($handle))
{ $Content .= preg_replace("/[\r\n]+/", "", fread($handle, 256)); }
if (!empty($Content))
{
foreach ($Header as $key => $value)
{
$Result = array();
if (preg_match($value, $Content, $Result))
{ $ReturnArray[$key] = preg_replace("/\s+/", " ", (preg_replace("/,/",
", ", $Result[2]))); }
}
}
}
fclose($handle);
if (!preg_match("/^iso/i", $ReturnArray['charset']))
{
$RecodeArray = array();
switch (strtolower(substr($ReturnArray['charset'], 0, 3)))
{
case 'win' : $RecodeArray = array_flip(iso2win()); break;
case 'utf' : $RecodeArray = array_flip(iso2utf()); break;
}
foreach ($ReturnArray as $key => $value) { $ReturnArray[$key] = strtr($value, $RecodeArray); }
}
}
return $ReturnArray;
}
?>
I think It could help a lot.
and
I want to ask again about other languages of this script, is there any chance for a translation?