Project

General

Profile

1
<?php
2
  /**
3
  * QuickSkin Extension TXT
4
  * This function will replace the string with the value of  language array of the module
5
  *
6
  * Usage Example:
7
  * in Template use:{TXT:"OPEN_FILE"}
8
  *	returns the translated string
9
  *  
10
  * 
11
  * Important Note:
12
  * ===============
13
  * In order to use this function, you will need to follow the standard Naming Convention of WebsiteBaker CMS
14
  * It is: if your Module has the name "myModule", your language array needs to be named "$MOD_MYMODULE[]"
15
  * If you follow this rule, you can use this function (this extension) flawlessly
16
  *
17
  * @author WebsiteBaker Org e.V.
18
  *
19
  */
20
function qx_TXT ( $var ) {
21
	
22
	$ret_val = '';
23
	switch (TRUE)
24
	{
25
		// retrieve the MODULE_NAME
26
		case isset($GLOBALS['tool']): $MODULE_NAME = $GLOBALS['tool']; break;				// AdminTool
27
		case isset($GLOBALS['section']['module']): $MODULE_NAME = $GLOBALS['section']['module']; break;     // PageType Module
28
		case isset($GLOBALS['module_dir']): $MODULE_NAME = $GLOBALS['module_dir']; break;	// SnippetType Module
29
		default: $MODULE_NAME = FALSE;	
30
	}
31
	
32
	if(!isset($MODULE_NAME))
33
	{
34
		$ret_val = 'A problem occured. <br />(QuickSkin Extension) qx_TXT issue.';		
35
	} 
36
	else 
37
	{	
38
		$MODULE_NAME = strtoupper($MODULE_NAME);
39
		$LANG_ARRAY = $GLOBALS['MOD_'.$MODULE_NAME];
40
		$ret_val = isset($LANG_ARRAY[$var]) ? $LANG_ARRAY[$var] : ('<span style="color:#777">'.$var.'</span>');
41
	}	
42
	return $ret_val;
43
}
(2-2/43)