Revision 1945
Added by darkviper over 11 years ago
Lib.php | ||
---|---|---|
45 | 45 |
|
46 | 46 |
|
47 | 47 |
/** @var array holds several values from the default.ini */ |
48 |
private $_config = array(); |
|
48 |
private $_config = array();
|
|
49 | 49 |
/** @var array set several values for Twig_Environment */ |
50 |
private $_aTwigEnv = array(); |
|
50 |
private $_aTwigEnv = array();
|
|
51 | 51 |
/** @var array set several values for Twig_Loader */ |
52 | 52 |
private $_aTwigLoader = array(); |
53 |
/** @var string set icon extension */ |
|
54 |
private $_sExtension = array(); |
|
53 | 55 |
/** |
54 | 56 |
* constructor used to import some application constants and objects |
55 | 57 |
*/ |
56 | 58 |
public function __construct() |
57 | 59 |
{ |
58 | 60 |
// import global vars and objects |
59 |
$this->_wbAdaptor(); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* used to import some WB-constants and objects |
|
64 |
*/ |
|
65 |
private function _wbAdaptor() |
|
66 |
{ |
|
67 | 61 |
if(!defined('ADMIN_REL')) { define('ADMIN_REL', WB_REL.'/'.ADMIN_DIRECTORY); } |
68 |
|
|
69 |
$this->_oApp = (isset($GLOBALS['admin']) ? $GLOBALS['admin'] : $GLOBALS['wb']); |
|
70 |
$this->_oDb = WbDatabase::getInstance(); |
|
71 |
$this->_oReg = WbAdaptor::getInstance(); |
|
72 |
|
|
73 |
$this->_config = parse_ini_file(dirname(__FILE__).'/default.ini',true); |
|
74 |
$this->_aTwigEnv = $this->_config['twig-environment']; |
|
62 |
$this->_oApp = (isset($GLOBALS['admin']) ? $GLOBALS['admin'] : $GLOBALS['wb']); |
|
63 |
$this->_oDb = WbDatabase::getInstance(); |
|
64 |
$this->_oReg = WbAdaptor::getInstance(); |
|
65 |
$this->_config = parse_ini_file(dirname(__FILE__).'/default.ini',true); |
|
66 |
$this->_aTwigEnv = $this->_config['twig-environment']; |
|
75 | 67 |
$this->_aTwigLoader = $this->_config['twig-loader-file']; |
76 |
|
|
77 | 68 |
} |
78 | 69 |
|
79 | 70 |
/** |
... | ... | |
254 | 245 |
'sUrl' => $this->_oReg->AppRel.$this->_oReg->PagesDir.trim($pages[$value['language']]['link'],'/').$this->_oReg->PageExtension, |
255 | 246 |
'sTitle' => $pages[$value['language']]['page_title'], |
256 | 247 |
'FilePrefix' => strtolower($pages[$value['language']]['language']), |
248 |
'sExtension' => $this->_sExtension, |
|
257 | 249 |
); |
258 | 250 |
} |
259 | 251 |
} |
... | ... | |
275 | 267 |
return $twig->render($this->_aTwigLoader['default_template'], $data); |
276 | 268 |
} |
277 | 269 |
|
270 |
private function _detectIE() |
|
271 |
{ |
|
272 |
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $aMatches); |
|
278 | 273 |
|
274 |
if (count($aMatches)>1){ |
|
275 |
return true; |
|
276 |
} |
|
277 |
return false; |
|
278 |
} |
|
279 |
|
|
280 |
public function setExtension($sExtension = 'auto') |
|
281 |
{ |
|
282 |
if($sExtension == 'auto' || $sExtension == 'svg') { |
|
283 |
$this->_sExtension = ($this->_detectIE() == true) ? 'png' : 'svg'; |
|
284 |
} else { |
|
285 |
$this->_sExtension = 'png'; |
|
286 |
} |
|
287 |
return; |
|
288 |
} |
|
289 |
|
|
279 | 290 |
public function getLangMenu() |
280 | 291 |
{ |
281 | 292 |
return $this->_getLangMenuTwig ( ); |
Also available in: Unified diff
module/MultiLingual updated for make use of different graphics format
added Droplet to use Multilingual in index.php of template