diff options
author | rvelices <rv-github@modusoptimus.com> | 2012-10-12 20:00:16 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2012-10-12 20:00:16 +0000 |
commit | 267c548896d1e16ace40b6c1cb4df5913ac0bfa4 (patch) | |
tree | 08717cfd200a8beecdacf6d9492efd9e65e785b3 /include/functions.inc.php | |
parent | 5a061cb37dcd224f4fd33ebe2845660d6d327b38 (diff) |
- remove unsed code; shorten existing code and improve readability ...
git-svn-id: http://piwigo.org/svn/trunk@18629 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r-- | include/functions.inc.php | 60 |
1 files changed, 10 insertions, 50 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index 031ee652a..f8727f770 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -125,32 +125,6 @@ function get_filename_wo_extension( $filename ) return ($pos===false) ? $filename : substr( $filename, 0, $pos); } -/** - * returns an array contening sub-directories, excluding ".svn" - * - * @param string $dir - * @return array - */ -function get_dirs($directory) -{ - $sub_dirs = array(); - if ($opendir = opendir($directory)) - { - while ($file = readdir($opendir)) - { - if ($file != '.' - and $file != '..' - and is_dir($directory.'/'.$file) - and $file != '.svn') - { - array_push($sub_dirs, $file); - } - } - closedir($opendir); - } - return $sub_dirs; -} - define('MKGETDIR_NONE', 0); define('MKGETDIR_RECURSIVE', 1); define('MKGETDIR_DIE_ON_ERROR', 2); @@ -1274,6 +1248,7 @@ function load_language($filename, $dirname = '', $languages = array_unique($languages); + /*Note: target charset is always utf-8 if ( empty($options['target_charset']) ) { $target_charset = get_pwg_charset(); @@ -1282,7 +1257,7 @@ function load_language($filename, $dirname = '', { $target_charset = $options['target_charset']; } - $target_charset = strtolower($target_charset); + $target_charset = strtolower($target_charset);*/ $source_file = ''; foreach ($languages as $language) { @@ -1309,6 +1284,7 @@ function load_language($filename, $dirname = '', if ( !isset($lang) ) $lang=array(); if ( !isset($lang_info) ) $lang_info=array(); + /* Note: target charset is always utf-8 if ( 'utf-8'!=$target_charset) { if ( is_array($load_lang) ) @@ -1333,16 +1309,16 @@ function load_language($filename, $dirname = '', } } else - { + {*/ $lang = array_merge( $lang, (array)$load_lang ); $lang_info = array_merge( $lang_info, (array)$load_lang_info ); - } + //} return true; } else { $content = @file_get_contents($source_file); - $content = convert_charset($content, 'utf-8', $target_charset); + //Note: target charset is always utf-8 $content = convert_charset($content, 'utf-8', $target_charset); return $content; } } @@ -1604,36 +1580,20 @@ function get_privacy_level_options() global $conf; $options = array(); + $label = ''; foreach (array_reverse($conf['available_permission_levels']) as $level) { - $label = null; - if (0 == $level) { $label = l10n('Everybody'); } else { - $labels = array(); - $sub_levels = array_reverse($conf['available_permission_levels']); - foreach ($sub_levels as $sub_level) + if (strlen($label)) { - if ($sub_level == 0 or $sub_level < $level) - { - break; - } - array_push( - $labels, - l10n( - sprintf( - 'Level %d', - $sub_level - ) - ) - ); + $label .= ', '; } - - $label = implode(', ', $labels); + $label .= l10n( sprintf('Level %d',$level) ); } $options[$level] = $label; } |