mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-26 19:29:58 +03:00
- RSS feed is PWG charset
- iptc are now converted from iso-8859-1 or utf-8 (automatic detection) to pwg charset - remove function get_language_filepath - load_language also checks for the default language git-svn-id: http://piwigo.org/svn/trunk@2132 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
762562ddbe
commit
5aafffb22b
5 changed files with 16 additions and 77 deletions
2
feed.php
2
feed.php
|
@ -107,7 +107,7 @@ include_once(PHPWG_ROOT_PATH.'include/feedcreator.class.php');
|
||||||
set_make_full_url();
|
set_make_full_url();
|
||||||
|
|
||||||
$rss = new UniversalFeedCreator();
|
$rss = new UniversalFeedCreator();
|
||||||
|
$rss->encoding=get_pwg_charset();
|
||||||
$rss->title = $conf['gallery_title'];
|
$rss->title = $conf['gallery_title'];
|
||||||
$rss->title.= ' (as '.$user['username'].')';
|
$rss->title.= ' (as '.$user['username'].')';
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,7 @@ class UniversalFeedCreator extends FeedCreator {
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
// prevent overwriting of properties "contentType", "encoding"; do not copy "_feed" itself
|
// prevent overwriting of properties "contentType", "encoding"; do not copy "_feed" itself
|
||||||
if (!in_array($key, array("_feed", "contentType", "encoding"))) {
|
if (!in_array($key, array("_feed", "contentType"/*PWG, "encoding"*/))) {
|
||||||
$this->_feed->{$key} = $this->{$key};
|
$this->_feed->{$key} = $this->{$key};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1499,11 +1499,14 @@ function load_language($filename, $dirname = '', $language = '',
|
||||||
{
|
{
|
||||||
$languages[] = $language;
|
$languages[] = $language;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($user['language']) )
|
if ( !empty($user['language']) )
|
||||||
{
|
{
|
||||||
$languages[] = $user['language'];
|
$languages[] = $user['language'];
|
||||||
}
|
}
|
||||||
|
if ( defined('PHPWG_INSTALLED') )
|
||||||
|
{
|
||||||
|
$languages[] = get_default_language();
|
||||||
|
}
|
||||||
$languages[] = PHPWG_DEFAULT_LANGUAGE;
|
$languages[] = PHPWG_DEFAULT_LANGUAGE;
|
||||||
$languages = array_unique($languages);
|
$languages = array_unique($languages);
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,16 @@ function clean_iptc_value($value)
|
||||||
// remove binary nulls
|
// remove binary nulls
|
||||||
$value = str_replace(chr(0x00), ' ', $value);
|
$value = str_replace(chr(0x00), ' ', $value);
|
||||||
|
|
||||||
|
if ( preg_match('/[\x80-\xff]/', $value) )
|
||||||
|
{
|
||||||
|
// apparently mac uses some MacRoman crap encoding. I don't know
|
||||||
|
// how to detect it so a plugin should do the trick.
|
||||||
|
$value = trigger_event('clean_iptc_value', $value);
|
||||||
|
$is_utf8 = seems_utf8($value);
|
||||||
|
$value = convert_charset( $value,
|
||||||
|
$is_utf8 ? 'utf-8' : 'iso-8859-1',
|
||||||
|
get_pwg_charset() );
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -929,80 +929,6 @@ SELECT name
|
||||||
return $groupname;
|
return $groupname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* return the file path of the given language filename, depending on the
|
|
||||||
* availability of the file
|
|
||||||
*
|
|
||||||
* in descending order of preference:
|
|
||||||
* param language, user language, default language
|
|
||||||
* PhpWebGallery default language.
|
|
||||||
*
|
|
||||||
* @param string filename
|
|
||||||
* @param string dirname
|
|
||||||
* @param string language
|
|
||||||
* @return string filepath
|
|
||||||
*/
|
|
||||||
function get_language_filepath($filename, $dirname = '', $language = '')
|
|
||||||
{
|
|
||||||
global $user, $conf;
|
|
||||||
|
|
||||||
if (empty($dirname))
|
|
||||||
{
|
|
||||||
$dirname = PHPWG_ROOT_PATH;
|
|
||||||
}
|
|
||||||
$dirname .= 'language'.'/';
|
|
||||||
|
|
||||||
$dir_methods = array();
|
|
||||||
|
|
||||||
if (!empty($language))
|
|
||||||
{
|
|
||||||
$dir_methods[] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dir_methods[] = 2;
|
|
||||||
$dir_methods[] = 3;
|
|
||||||
$dir_methods[] = 4;
|
|
||||||
|
|
||||||
foreach ($dir_methods as $dir_method)
|
|
||||||
{
|
|
||||||
switch ($dir_method)
|
|
||||||
{
|
|
||||||
case '1':
|
|
||||||
{
|
|
||||||
$directory = $dirname.$language;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '2':
|
|
||||||
{
|
|
||||||
$directory = $dirname.$user['language'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '3':
|
|
||||||
{
|
|
||||||
$directory = $dirname.get_default_language();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '4':
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
$directory = $dirname.PHPWG_DEFAULT_LANGUAGE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
$directory = '.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$filepath = $directory.'/'.$filename;
|
|
||||||
|
|
||||||
if (file_exists($filepath))
|
|
||||||
{
|
|
||||||
return $filepath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the auto login key or false on error
|
* returns the auto login key or false on error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue