CI framework source code reading --------- Lang. php
Source: Internet
Author: User
[Php] & lt ;? Phpif (! Defined (& amp; #39; BASEPATH & amp; #39;) exit (& amp; #39; Nodirectscriptaccessallowed & amp; #39 ;); /*** CodeIgniter *** Anopensourceapplicatio [php] In is_loaded and $ this-> language, go to * @ param bool add suffix to $ langfile whether to add the suffix * @ param string alternative path to look for language file the custom path of the language pack * @ return mixed */function load ($ langfile = '', $ idiom = '', $ return = FALSE, $ add_suffix = TRUE, $ alt_path ='') {// langfile. remove the php suffix $ langfile = str_replace ('. php ', '', $ langfile); // You do not need to add a suffix if you need it. // Set _ lang. remove and add _ lang if ($ add_suffi X = TRUE) {$ langfile = str_replace ('_ lang. ', '', $ langfile ). '_ lang';} // add a name for langfile. php suffix $ langfile. = '. php '; // Determine whether the current file has been loaded if (in_array ($ langfile, $ this-> is_loaded, TRUE) {return ;} // Get the data in the configuration file $ config = & get_config (); // if the language to be used is null // we will obtain if ($ idiom = '') {$ deft_lang = (! Isset ($ config ['language'])? 'INC': $ config ['language']; $ idiom = ($ deft_lang = '')? 'INC': $ deft_lang;} // Determine where the language file is and load it // find the language pack in the custom path and load if ($ alt_path! = ''& File_exists ($ alt_path. 'language /'. $ idiom. '/'. $ langfile) {include ($ alt_path. 'language /'. $ idiom. '/'. $ langfile);} else {// call get_instance ()-> load-> get_package_paths (TRUE) if the custom path is not found) // search for/get_package_paths in the package path. in php, $ found = FALSE; foreach (get_instance ()-> load-> get_package_paths (TRUE) as $ package_path) {if (file_exists ($ package_path. 'language /'. $ idiom. '/'. $ langfile) {incl Ude ($ package_path. 'language /'. $ idiom. '/'. $ langfile); $ found = TRUE; break;} // if not found, only an error is returned. // if ($ found! = TRUE) {show_error ('unable to load the requested language file: language/'. $ idiom.'/'. $ langfile) ;}} if (! Isset ($ lang) {log_message ('error', 'Language file contains no data: Language /'. $ idiom. '/'. $ langfile); return;} if ($ return = TRUE) {return $ lang;} $ this-> is_loaded [] = $ langfile; $ this-> language = array_merge ($ this-> language, $ lang); unset ($ lang); log_message ('debug', 'Language file loaded: Language /'. $ idiom. '/'. $ langfile); return TRUE ;}//-------------------------------------------------- ------------------/*** Fetch a single line of text from the language array * get a line of text * @ access public * @ param string $ line the language line * @ return string */function line ($ line = '') {/** $ this-> language format * $ lang ['error _ email_missing '] = "You must submit an email address "; * $ lang ['error _ url_missing '] = "You must submit a URL"; * $ lang ['error _ username_missing'] = "You must submit a user Name "; */$ value = ($ line ='' OR! Isset ($ this-> language [$ line])? FALSE: $ this-> language [$ line]; // Because killer robots like unicorns! If ($ value = FALSE) {log_message ('error', 'could not find the language line "'. $ line. '"') ;}return $ value ;}// END Language Class/* End of file Lang. php * // * Location :. /system/core/Lang. php */
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.