Ejemplo n.º 1
0
 * @copyright 2011-2014 See AUTHORS.txt
 * @license CC-BY 3.0 <https://creativecommons.org/licenses/by/3.0/>
 * @package intuition
 */
/**
 * Configuration
 * -------------------------------------------------
 */
// BaseTool & Localization
require_once __DIR__ . '/../libs/basetool/InitTool.php';
require_once __DIR__ . '/../ToolStart.php';
$I18N = new Intuition(array('domain' => 'tsintuition', 'mode' => 'dashboard'));
// Load all domains so we can get some statistics later on and
// make sure "getAvailableLangs" is complete
foreach ($I18N->getAllRegisteredDomains() as $domainKey) {
    $I18N->loadTextdomain($domainKey);
}
// Initialize BaseTool
$Tool = BaseTool::newFromArray(array('displayTitle' => $I18N->msg('title'), 'remoteBasePath' => $I18N->dashboardHome, 'localBasePath' => $I18N->localBaseDir, 'revisionId' => $I18N->version, 'styles' => array('main.css'), 'scripts' => array('main.js'), 'licenses' => array('CC-BY 3.0' => 'https://creativecommons.org/licenses/by/3.0/')));
$Tool->setSourceInfoGithub('Krinkle', 'intuition', dirname(__DIR__));
/**
 * Tool settings
 * -------------------------------------------------
 */
$toolSettings = array('tabs' => array());
/**
 * Post actions
 * -------------------------------------------------
 */
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
Ejemplo n.º 2
0
$domains = $kgReq->getVal('domains', false);
$lang = $kgReq->getVal('lang', $I18N->getLang());
/**
 * Response
 * -------------------------------------------------
 */
$resp = array();
if (!$domains) {
    // HTTP 400 Bad Request
    http_response_code(400);
    $resp['error'] = 'Parameter "domains" is required';
    i18nApiResp($resp);
}
$domains = explode('|', $domains);
$resp['messages'] = array();
foreach ($domains as $domain) {
    $normalisedDomain = $I18N->loadTextdomain($domain);
    if (!$normalisedDomain) {
        // Doesn't exist
        $resp['messages'][$domain] = false;
        continue;
    }
    if ($normalisedDomain !== $domain) {
        $resp['normalised']['domains'][$domain] = $normalisedDomain;
    }
    $keys = $I18N->listMsgs($normalisedDomain);
    foreach ($keys as $msgKey) {
        $resp['messages'][$domain][$msgKey] = $rawMsg = $I18N->rawMsg($normalisedDomain, $lang, $msgKey);
    }
}
i18nApiResp($resp);