Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: class_language.php 5828 2012-05-08 16:06:16Z Tomm $
| * $Id$
|
*/
class MyLanguage
| */
class MyLanguage
|
Zeile 25 | Zeile 25 |
---|
* @var string */ public $language;
|
* @var string */ public $language;
|
| /** * The fallback language we are using. * * @var string */ public $fallback = 'english';
|
/** * Information about the current language.
| /** * Information about the current language.
|
Zeile 112 | Zeile 119 |
---|
} } $this->language = $language."/{$area}";
|
} } $this->language = $language."/{$area}";
|
| $this->fallback = $this->fallback."/{$area}";
|
} }
/** * Load the language variables for a section.
|
} }
/** * Load the language variables for a section.
|
*
| *
|
* @param string The section name. * @param boolean Is this a datahandler? * @param boolean supress the error if the file doesn't exist?
| * @param string The section name. * @param boolean Is this a datahandler? * @param boolean supress the error if the file doesn't exist?
|
Zeile 127 | Zeile 135 |
---|
// Assign language variables. // Datahandlers are never in admin lang directory. if($isdatahandler === true)
|
// Assign language variables. // Datahandlers are never in admin lang directory. if($isdatahandler === true)
|
{ $this->language = str_replace('/admin', '', $this->language);
| { $lfile = $this->path."/".str_replace('/admin', '', $this->language)."/".$section.".lang.php"; } else { $lfile = $this->path."/".$this->language."/".$section.".lang.php";
|
}
|
}
|
$lfile = $this->path."/".$this->language."/".$section.".lang.php";
| |
if(file_exists($lfile))
|
if(file_exists($lfile))
|
{
| {
|
require_once $lfile; }
|
require_once $lfile; }
|
| elseif(file_exists($this->path."/".$this->fallback."/".$section.".lang.php")) { require_once $this->path."/".$this->fallback."/".$section.".lang.php"; } // Deprecated! This fallback will be removed in future versions!
|
elseif(file_exists($this->path."/english/".$section.".lang.php")) { require_once $this->path."/english/".$section.".lang.php";
| elseif(file_exists($this->path."/english/".$section.".lang.php")) { require_once $this->path."/english/".$section.".lang.php";
|
Zeile 210 | Zeile 226 |
---|
*/ function parse($contents) {
|
*/ function parse($contents) {
|
$contents = preg_replace("#<lang:([a-zA-Z0-9_]+)>#e", "\$this->$1", $contents);
| $contents = preg_replace_callback("#<lang:([a-zA-Z0-9_]+)>#", array($this, 'parse_replace'), $contents);
|
return $contents;
|
return $contents;
|
| }
/** * Replace content with language variable. * * @param array Matches. * @return string Language variable. */ function parse_replace($matches) { return $this->$matches[1];
|
} } ?>
| } } ?>
|