Advertisement
GWibisono

helper languages

Jun 19th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. <?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3.  * CodeIgniter
  4.  *
  5.  * An open source application development framework for PHP 4.3.2 or newer
  6.  *
  7.  * @package     CodeIgniter
  8.  * @author      Unknown
  9.  * @copyright   Copyright (c) 2008 - 2012, EllisLab, Inc.
  10.  * @license     http://codeigniter.com/user_guide/license.html
  11.  * @link        http://codeigniter.com
  12.  * @since       Version 1.7
  13.  * @filesource
  14.  */
  15.  
  16. // ------------------------------------------------------------------------
  17.  
  18. /**
  19.  * CodeIgniter MyLanguage Helpers
  20.  *
  21.  * @package     CodeIgniter
  22.  * @subpackage  Helpers
  23.  * @category    Helpers
  24.  * @author      ExpressionEngine Dev Team
  25.  * @link        http://codeigniter.com/wiki/Language_Library_Extension/
  26.  */
  27.  
  28. // ------------------------------------------------------------------------
  29.  
  30. /**
  31.  * Lang
  32.  *
  33.  * Fetches a language variable and optionally outputs a form label
  34.  *
  35.  * @access  public
  36.  * @param   string  the language line
  37.  * @param   string  the id of the form element
  38.  * @return  string
  39.  */
  40. if ( ! function_exists('show')||! function_exists('line_with_param'))
  41. {
  42.  
  43.     function line_with_param($line, $params)
  44.     {
  45.         $CI =& get_instance();
  46.        
  47.         $line = $CI->lang->line($line);
  48.        
  49.          
  50.         if($line !== false)
  51.         {
  52.             if(is_array($params))
  53.                 $line = vsprintf ($line, $params);
  54.             elseif($params==1)
  55.                 $line= htmlentities($line);
  56.             else
  57.                 $line = sprintf ($line, $params);
  58.         }
  59.         return $line;
  60.          
  61.     }
  62.    
  63.     function show($key,$params=1)
  64.     {
  65.        
  66.         return line_with_param($key,$params);  
  67.     }
  68.    
  69. }
  70.  
  71. /*
  72.  
  73. source
  74. http://codeigniter.com/wiki/Language_Library_Extension/
  75. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement