Changeset 2479


Ignore:
Timestamp:
Aug 20, 2008, 2:35:22 AM (16 years ago)
Author:
rvelices
Message:
  • local.lang is loaded without fallback on default language or PHPWG_DEFAULT_LANGUAGE (needed to change the signature of load_language which became a little too big)
  • move a function from functions.inc.php to functions_picture.inc.php (included only when necessary)
  • removed some css (not as much as I wanted)
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/about.php

    r2299 r2479  
    6464}
    6565
    66 $template->assign('ABOUT_MESSAGE', load_language('about.html','','',true) );
     66$template->assign('ABOUT_MESSAGE', load_language('about.html','', array('return'=>true)) );
    6767
    6868$template->pparse('about');
  • trunk/admin/help.php

    r2299 r2479  
    2929check_status(ACCESS_ADMINISTRATOR);
    3030
    31 $template->assign('ADMIN_CONTENT', load_language('help.html','','',true) );
     31$template->assign('ADMIN_CONTENT', load_language('help.html','',array('return'=>true)) );
    3232?>
  • trunk/include/common.inc.php

    r2476 r2479  
    178178}
    179179trigger_action('loading_lang');
    180 load_language('local.lang');
     180load_language('local.lang', '', array('no_fallback'=>true) );
    181181
    182182// only now we can set the localized username of the guest user (and not in
  • trunk/include/functions.inc.php

    r2456 r2479  
    238238
    239239  return $tndir;
    240 }
    241 
    242 // The get_picture_size function return an array containing :
    243 //      - $picture_size[0] : final width
    244 //      - $picture_size[1] : final height
    245 // The final dimensions are calculated thanks to the original dimensions and
    246 // the maximum dimensions given in parameters.  get_picture_size respects
    247 // the width/height ratio
    248 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       else
    285       {
    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;
    296240}
    297241
     
    753697    load_language('common.lang');
    754698    trigger_action('loading_lang');
    755     load_language('local.lang');
     699    load_language('local.lang', '', array('no_fallback'=>true) );
    756700    list($tmpl, $thm) = explode('/', get_default_template());
    757701    $template = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm);
     
    13951339 * @param string filename
    13961340 * @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 */
     1348function load_language($filename, $dirname = '',
     1349    $options = array() )
    14041350{
    14051351  global $user;
    14061352
    1407   if (!$return_content)
     1353  if (! @$options['return'] )
    14081354  {
    14091355    $filename .= '.php'; //MAYBE to do .. load .po and .mo localization files
     
    14161362
    14171363  $languages = array();
    1418   if ( !empty($language) )
    1419   {
    1420     $languages[] = $language;
     1364  if ( !empty($options['language']) )
     1365  {
     1366    $languages[] = $options['language'];
    14211367  }
    14221368  if ( !empty($user['language']) )
     
    14241370    $languages[] = $user['language'];
    14251371  }
    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
    14311381  $languages = array_unique($languages);
    14321382
    1433   if ( empty($target_charset) )
     1383  if ( empty($options['target_charset']) )
    14341384  {
    14351385    $target_charset = get_pwg_charset();
     1386  }
     1387  else
     1388  {
     1389    $target_charset = $options['target_charset'];
    14361390  }
    14371391  $target_charset = strtolower($target_charset);
     
    14731427  if ( !empty($source_file) )
    14741428  {
    1475     if (!$return_content)
     1429    if (! @$options['return'] )
    14761430    {
    14771431      @include($source_file);
  • trunk/include/functions_mail.inc.php

    r2339 r2479  
    247247
    248248      // language files
    249       load_language('common.lang', '', $language);
     249      load_language('common.lang', '', array('language'=>$language) );
    250250      // No test admin because script is checked admin (user selected no)
    251251      // Translations are in admin file too
    252       load_language('admin.lang', '', $language);
     252      load_language('admin.lang', '', array('language'=>$language) );
    253253      trigger_action('loading_lang');
    254       load_language('local.lang', '', $language);
     254      load_language('local.lang', '', array('language'=>$language, 'no_fallback'=>true));
    255255
    256256      $switch_lang[$language]['lang_info'] = $lang_info;
  • trunk/include/functions_picture.inc.php

    r2299 r2479  
    328328}
    329329
     330// The get_picture_size function return an array containing :
     331//      - $picture_size[0] : final width
     332//      - $picture_size[1] : final height
     333// The final dimensions are calculated thanks to the original dimensions and
     334// the maximum dimensions given in parameters.  get_picture_size respects
     335// the width/height ratio
     336function get_picture_size( $original_width, $original_height,
     337                           $max_width, $max_height )
     338{
     339  $width = $original_width;
     340  $height = $original_height;
     341  $is_original_size = true;
     342
     343  if ( $max_width != "" )
     344  {
     345    if ( $original_width > $max_width )
     346    {
     347      $width = $max_width;
     348      $height = floor( ( $width * $original_height ) / $original_width );
     349    }
     350  }
     351  if ( $max_height != "" )
     352  {
     353    if ( $original_height > $max_height )
     354    {
     355      $height = $max_height;
     356      $width = floor( ( $height * $original_width ) / $original_height );
     357      $is_original_size = false;
     358    }
     359  }
     360  if ( is_numeric( $max_width ) and is_numeric( $max_height )
     361       and $max_width != 0 and $max_height != 0 )
     362  {
     363    $ratioWidth = $original_width / $max_width;
     364    $ratioHeight = $original_height / $max_height;
     365    if ( ( $ratioWidth > 1 ) or ( $ratioHeight > 1 ) )
     366    {
     367      if ( $ratioWidth < $ratioHeight )
     368      {
     369        $width = floor( $original_width / $ratioHeight );
     370        $height = $max_height;
     371      }
     372      else
     373      {
     374        $width = $max_width;
     375        $height = floor( $original_height / $ratioWidth );
     376      }
     377      $is_original_size = false;
     378    }
     379  }
     380  $picture_size = array();
     381  $picture_size[0] = $width;
     382  $picture_size[1] = $height;
     383  return $picture_size;
     384}
     385
    330386?>
  • trunk/install.php

    r2339 r2479  
    207207}
    208208
    209 load_language( 'common.lang', '', $language, false, 'utf-8' );
    210 load_language( 'admin.lang', '', $language, false, 'utf-8' );
    211 load_language( 'install.lang', '', $language, false, 'utf-8' );
     209load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
     210load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
     211load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
    212212
    213213//----------------------------------------------------- template initialization
  • trunk/nbm.php

    r2325 r2479  
    3535// Need to update a second time
    3636trigger_action('loading_lang');
    37 load_language('local.lang');
     37load_language('local.lang', '', array('no_fallback'=>true) );
    3838
    3939
  • trunk/plugins/add_index/main.normal.inc.php

    r2299 r2479  
    3434    {
    3535      $help_content =
    36         load_language('help/'.$page.'.html', $this->path, '', true);
     36        load_language('help/'.$page.'.html', $this->path, array('return'=>true) );
    3737    }
    3838    else
  • trunk/plugins/language_switch/language_switch.inc.php

    r2299 r2479  
    5858  if ( $same !== $user['language'])
    5959  {
    60     load_language('common.lang', '', $user['language']);
    61     load_language('local.lang', '', $user['language']);
     60    load_language('common.lang', '', array('language'=>$user['language']) );
     61    load_language('local.lang', '', array('language'=>$user['language'], 'no_fallback'=>true) );
    6262    if (defined('IN_ADMIN') and IN_ADMIN)
    6363    {
    64       load_language('admin.lang', '', $user['language']);
     64      load_language('admin.lang', '', array('language'=>$user['language']) );
    6565    }
    6666  }
  • trunk/popuphelp.php

    r2342 r2479  
    4747{
    4848  $help_content =
    49     load_language('help/'.$_GET['page'].'.html', '', '', true);
     49    load_language('help/'.$_GET['page'].'.html', '', array('return'=>true) );
    5050
    5151  if ($help_content == false)
  • trunk/template-extension/distributed/samples/my-picture.tpl

    r2434 r2479  
    2323
    2424{if isset($previous) }
    25 <a class="navThumb" id="thumbPrev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev">
    26   <img src="{$previous.THUMB_SRC}" class="thumbLink" id="linkPrev" alt="{$previous.TITLE}">
     25<a class="navThumb" id="linkPrev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev">
     26  <img src="{$previous.THUMB_SRC}" alt="{$previous.TITLE}">
    2727</a>
    2828{/if}
    2929{if isset($next) }
    30 <a class="navThumb" id="thumbNext" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next">
    31   <img src="{$next.THUMB_SRC}" class="thumbLink" id="linkNext" alt="{$next.TITLE}">
     30<a class="navThumb" id="linkNext" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next">
     31  <img src="{$next.THUMB_SRC}" alt="{$next.TITLE}">
    3232</a>
    3333{/if}
  • trunk/template/yoga/default-layout.css

    r2476 r2479  
    164164FORM.filter FIELDSET P
    165165{
    166   clear: left;
    167   display: block;
     166        clear: left;
     167        display: block;
    168168}
    169169
    170170FORM.filter INPUT[type="submit"] {
    171   margin-top: 1em;
    172 }
    173 
    174 FORM.properties UL, FORM#update UL {
    175   list-style-type: none;
    176   margin: 0;
    177   padding: 0;
    178 }
    179 
    180 FORM.properties LI, FORM#update UL {
    181   margin-bottom: 0.5em;
    182   padding: 0;
    183   line-height: 1.8em;
    184   clear: left;
     171        margin-top: 1em;
     172}
     173
     174FORM.properties UL {
     175        list-style-type: none;
     176        margin: 0;
     177        padding: 0;
     178}
     179
     180FORM.properties LI {
     181        margin-bottom: 0.5em;
     182        padding: 0;
     183        line-height: 1.8em;
     184        clear: left;
    185185}
    186186
  • trunk/template/yoga/picture.css

    r2295 r2479  
    5959}
    6060
    61 .navThumb {
    62     margin-top: 2px;
    63 }
    64 #thumbPrev {
    65     float: left;
    66 }
    67 
    68 #thumbNext {
    69     float: right;
    70 }
    71 
    7261#linkPrev {
    73     margin-right: 10px;
    74     margin-left: 5px;
     62        float: left;
    7563}
    7664
    7765#linkNext {
    78     margin-right: 5px;
    79     margin-left: 10px;
     66        float: right;
     67}
     68
     69#linkPrev IMG {
     70        margin-right: 10px;
     71        margin-left: 5px;
     72}
     73
     74#linkNext IMG {
     75        margin-right: 5px;
     76        margin-left: 10px;
    8077}
    8178
     
    9794
    9895.rateButton, .rateButtonSelected, .rateButtonStarFull, .rateButtonStarEmpty  {
    99   padding:0;
    100   border:0;
     96        padding:0;
     97        border:0;
    10198}
    10299
    103100.rateButton, .rateButtonStarFull, .rateButtonStarEmpty {
    104   cursor: pointer;
     101        cursor: pointer;
    105102}
    106103
    107104.rateButtonSelected {
    108   font-weight:bold;
    109   font-size:120%;
     105        font-weight:bold;
     106        font-size:120%;
    110107}
    111108
  • trunk/template/yoga/picture.tpl

    r2435 r2479  
    9494
    9595{if isset($previous) }
    96 <a class="navThumb" id="thumbPrev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev">
    97   <img src="{$previous.THUMB_SRC}" class="thumbLink" id="linkPrev" alt="{$previous.TITLE}">
     96<a class="navThumb" id="linkPrev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev">
     97  <img src="{$previous.THUMB_SRC}" alt="{$previous.TITLE}">
    9898</a>
    9999{/if}
    100100{if isset($next) }
    101 <a class="navThumb" id="thumbNext" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next">
    102   <img src="{$next.THUMB_SRC}" class="thumbLink" id="linkNext" alt="{$next.TITLE}">
     101<a class="navThumb" id="linkNext" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next">
     102  <img src="{$next.THUMB_SRC}" alt="{$next.TITLE}">
    103103</a>
    104104{/if}
Note: See TracChangeset for help on using the changeset viewer.