forked from Deesen/YAMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yams.integration.inc.php
63 lines (53 loc) · 2.19 KB
/
yams.integration.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/*
* @author PMS (http://modxcms.com/forums/index.php?action=profile;u=12570)
* @copyright Nashi Power (http://nashi.podzone.org/) 2010
* @license GPL v3
* @package YAMS (http://modxcms.com/extras/package/?package=543)
* @see Forum (http://modxcms.com/forums/index.php/board,381.0.html)
This file can be used to help integration of YAMS other
software with multilingual capabilities, such as Easy 2 Gallery
To use, simply require at the top of the relevant PHP source file
and a constant called YAMS_INTEGRATION_SETTINGS will be defined
containing a 'serialized' array of YAMS configuration parameters.
The array must be unserialised before use. So, for example:
require_once "....../assets/modules/yams/yams.integration.inc.php"
$yamsParams = unserialize(YAMS_INTEGRATION_SETTINGS);
// an array of language ids for languages which are defined
// and activated
$yamsParams['active_lang_ids']
// an array of language ids for languages which are defined
// but not activated
$yamsParams['inactive_lang_ids']
// an array of language ids for all languages
$yamsParams['all_lang_ids']
// the default language id
$yamsParams['default_lang_id']
If you find this useful and would like other YAMS parameters to be
added to this constant, please ask via the YAMS forums:
http://modxcms.com/forums/index.php/board,381.0.html
*/
if ( ! defined('YAMS_INTEGRATION_SETTINGS') )
{
require( dirname(__FILE__) . '/class/yams.config.mgr.class.inc.php');
// get an instance of the YAMS singleton class
$yamsConfigMgr = YamsConfigMgr::GetInstance();
// define the parameters
define(
'YAMS_INTEGRATION_SETTINGS'
, serialize(
array(
'active_lang_ids' => $yamsConfigMgr->GetActiveLangIds()
, 'inactive_lang_ids' => $yamsConfigMgr->GetInactiveLangIds()
, 'all_lang_ids' => array_merge(
$yamsConfigMgr->GetActiveLangIds()
, $yamsConfigMgr->GetInactiveLangIds()
)
, 'default_lang_id' => $yamsConfigMgr->GetDefaultLangId()
)
)
);
// cleanup: unset the yams config manager
unset($yamsConfigMgr);
}
?>