Vergleich inc/class_language.php - 1.6.6 - 1.6.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 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 5297 2010-12-28 22:01:14Z Tomm $

 * $Id$

 */

class MyLanguage

 */

class MyLanguage

Zeile 25Zeile 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 32Zeile 39
	 * @var array
*/
public $settings;

	 * @var array
*/
public $settings;





	/**
* Set the path for the language folder.

	/**
* Set the path for the language folder.

	 *

	 *

	 * @param string The path to the language folder.
*/
function set_path($path)

	 * @param string The path to the language folder.
*/
function set_path($path)

Zeile 48Zeile 55
	 *
* @param string The language to check for.
* @return boolean True when exists, false when does not exist.

	 *
* @param string The language to check for.
* @return boolean True when exists, false when does not exist.

	 */

	 */

	function language_exists($language)

	function language_exists($language)

	{

	{

		$language = preg_replace("#[^a-z0-9\-_]#i", "", $language);
if(file_exists($this->path."/".$language.".php"))

		$language = preg_replace("#[^a-z0-9\-_]#i", "", $language);
if(file_exists($this->path."/".$language.".php"))

		{

		{

			return true;

			return true;

		}

		}

		else
{
return false;

		else
{
return false;

Zeile 69Zeile 76
	 * @param string The area to set the language for.
*/
function set_language($language="english", $area="user")

	 * @param string The area to set the language for.
*/
function set_language($language="english", $area="user")

	{
global $mybb;


	{
global $settings;


		$language = preg_replace("#[^a-z0-9\-_]#i", "", $language);

// Default language is English.

		$language = preg_replace("#[^a-z0-9\-_]#i", "", $language);

// Default language is English.

Zeile 95Zeile 102
		{
if(!is_dir($this->path."/".$language."/{$area}"))
{

		{
if(!is_dir($this->path."/".$language."/{$area}"))
{

				if(!is_dir($this->path."/".$mybb->settings['cplanguage']."/{$area}"))

				if(!is_dir($this->path."/".$settings['cplanguage']."/{$area}"))

				{
if(!is_dir($this->path."/english/{$area}"))
{

				{
if(!is_dir($this->path."/english/{$area}"))
{

Zeile 108Zeile 115
				}
else
{

				}
else
{

					$language = $mybb->settings['cplanguage'];

					$language = $settings['cplanguage'];

				}
}
$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 126Zeile 134
	{
// Assign language variables.
// Datahandlers are never in admin lang directory.

	{
// Assign language variables.
// Datahandlers are never in admin lang directory.

		if($isdatahandler === true)





		if($isdatahandler)
{
$lfile = $this->path.'/'.str_replace('/admin', '', $this->language).'/'.$section.'.lang.php';
}
else

		{

		{

			$this->language = str_replace('/admin', '', $this->language);

			$lfile = $this->path.'/'.$this->language.'/'.$section.'.lang.php';

		}

		}

		$lfile = $this->path."/".$this->language."/".$section.".lang.php";

 
		
if(file_exists($lfile))
{
require_once $lfile;
}

		
if(file_exists($lfile))
{
require_once $lfile;
}

		elseif(file_exists($this->path."/english/".$section.".lang.php"))

		elseif(file_exists($this->path."/".$this->fallback."/".$section.".lang.php"))

		{

		{

			require_once $this->path."/english/".$section.".lang.php";

			require_once $this->path."/".$this->fallback."/".$section.".lang.php";

		}
else
{

		}
else
{

Zeile 210Zeile 221
	 */
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];

	}
}
?>

	}
}
?>