Changeset 2479 for trunk/include/functions.inc.php
- Timestamp:
- Aug 20, 2008, 2:35:22 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r2456 r2479 238 238 239 239 return $tndir; 240 }241 242 // The get_picture_size function return an array containing :243 // - $picture_size[0] : final width244 // - $picture_size[1] : final height245 // The final dimensions are calculated thanks to the original dimensions and246 // the maximum dimensions given in parameters. get_picture_size respects247 // the width/height ratio248 function get_picture_size( $original_width, $original_height,249 $max_width, $max_height )250 {251 $width = $original_width;252 $height = $original_height;253 $is_original_size = true;254 255 if ( $max_width != "" )256 {257 if ( $original_width > $max_width )258 {259 $width = $max_width;260 $height = floor( ( $width * $original_height ) / $original_width );261 }262 }263 if ( $max_height != "" )264 {265 if ( $original_height > $max_height )266 {267 $height = $max_height;268 $width = floor( ( $height * $original_width ) / $original_height );269 $is_original_size = false;270 }271 }272 if ( is_numeric( $max_width ) and is_numeric( $max_height )273 and $max_width != 0 and $max_height != 0 )274 {275 $ratioWidth = $original_width / $max_width;276 $ratioHeight = $original_height / $max_height;277 if ( ( $ratioWidth > 1 ) or ( $ratioHeight > 1 ) )278 {279 if ( $ratioWidth < $ratioHeight )280 {281 $width = floor( $original_width / $ratioHeight );282 $height = $max_height;283 }284 else285 {286 $width = $max_width;287 $height = floor( $original_height / $ratioWidth );288 }289 $is_original_size = false;290 }291 }292 $picture_size = array();293 $picture_size[0] = $width;294 $picture_size[1] = $height;295 return $picture_size;296 240 } 297 241 … … 753 697 load_language('common.lang'); 754 698 trigger_action('loading_lang'); 755 load_language('local.lang' );699 load_language('local.lang', '', array('no_fallback'=>true) ); 756 700 list($tmpl, $thm) = explode('/', get_default_template()); 757 701 $template = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm); … … 1395 1339 * @param string filename 1396 1340 * @param string dirname 1397 * @param string language 1398 * @param bool return_content - if true the file content is returned otherwise 1399 * the file is evaluated as php 1400 * @return boolean success status or a string if return_content is true 1401 */ 1402 function load_language($filename, $dirname = '', $language = '', 1403 $return_content=false, $target_charset=null) 1341 * @param mixed options can contain 1342 * language - language to load (if empty uses user language) 1343 * return - if true the file content is returned otherwise the file is evaluated as php 1344 * target_charset - 1345 * no_fallback - the language must be respected 1346 * @return boolean success status or a string if options['return'] is true 1347 */ 1348 function load_language($filename, $dirname = '', 1349 $options = array() ) 1404 1350 { 1405 1351 global $user; 1406 1352 1407 if (! $return_content)1353 if (! @$options['return'] ) 1408 1354 { 1409 1355 $filename .= '.php'; //MAYBE to do .. load .po and .mo localization files … … 1416 1362 1417 1363 $languages = array(); 1418 if ( !empty($ language) )1419 { 1420 $languages[] = $ language;1364 if ( !empty($options['language']) ) 1365 { 1366 $languages[] = $options['language']; 1421 1367 } 1422 1368 if ( !empty($user['language']) ) … … 1424 1370 $languages[] = $user['language']; 1425 1371 } 1426 if ( defined('PHPWG_INSTALLED') ) 1427 { 1428 $languages[] = get_default_language(); 1429 } 1430 $languages[] = PHPWG_DEFAULT_LANGUAGE; 1372 if ( ! @$options['no_fallback'] ) 1373 { 1374 if ( defined('PHPWG_INSTALLED') ) 1375 { 1376 $languages[] = get_default_language(); 1377 } 1378 $languages[] = PHPWG_DEFAULT_LANGUAGE; 1379 } 1380 1431 1381 $languages = array_unique($languages); 1432 1382 1433 if ( empty($ target_charset) )1383 if ( empty($options['target_charset']) ) 1434 1384 { 1435 1385 $target_charset = get_pwg_charset(); 1386 } 1387 else 1388 { 1389 $target_charset = $options['target_charset']; 1436 1390 } 1437 1391 $target_charset = strtolower($target_charset); … … 1473 1427 if ( !empty($source_file) ) 1474 1428 { 1475 if (! $return_content)1429 if (! @$options['return'] ) 1476 1430 { 1477 1431 @include($source_file);
Note: See TracChangeset
for help on using the changeset viewer.