示例#1
0
            exit(1);
        }
    }
}
echo 'Populate locales...' . PHP_EOL;
foreach ($config['locale'] as $game => $locales) {
    if (isset($games[$game])) {
        foreach ($locales as $locale => $content) {
            if ($locale === '_all' || $locale === $config['default_locale'] || !isset($internal[$game]['locale']['_all'][$locale])) {
                continue;
            }
            echo '> ' . $game . '.' . $locale . PHP_EOL;
            foreach ($internal[$game]['keys'] as $rKey) {
                if (!isset($content[$rKey])) {
                    if (isset($internal[$game]['dynamic'][$rKey])) {
                        $output[$game][$locale][$rKey] = createKeyValueList($internal[$game]['dynamic'][$rKey], requestResource($games[$game], $internal[$game]['dynamic'][$rKey]['method'], $locale, $internal[$game]['locale']['_all'][$locale]));
                    } else {
                        $output[$game][$locale][$rKey] = $internal[$game]['default'][$rKey];
                    }
                } else {
                    $output[$game][$locale][$rKey] = $content[$rKey];
                }
            }
        }
    }
}
$header = <<<'EOD'
<?php
/**
 * This file is part of the bnetlib Library.
 * Copyright (c) 2012 Eric Boh <*****@*****.**>
示例#2
0
                    printf('> No source resource found in %s:%d' . PHP_EOL, $game, $i);
                }
                if (!isset($extend['source']['arguments'])) {
                    $extend['source']['arguments'] = array();
                }
            }
            if (!isset($extend['target'])) {
                $error = true;
                printf('> No target found in %s:%d' . PHP_EOL, $game, $i);
            }
            if ($error) {
                continue;
            }
            printf('> %s::get%s... ', get_class($games[$game]), $extend['source']['resource']);
            try {
                $tmp = requestResource($games[$game], $extend['source']['resource'], array($extend['source']['arguments']));
                if (!isset($tmp['content'][$extend['target']])) {
                    echo 'error, target not found!' . PHP_EOL;
                } else {
                    $output[$game][$extend['source']['resource']]['content'][$extend['target']] = $tmp['content'][$extend['target']];
                    echo 'done!' . PHP_EOL;
                }
            } catch (bnetlib\Exception\ExceptionInterface $e) {
                echo 'skipped!' . PHP_EOL;
                printf('>> %s' . PHP_EOL, $e->getMessage());
                continue;
            }
        }
    }
}
echo PHP_EOL . 'Write to files...' . PHP_EOL;