Exemplo n.º 1
0
function getI18n($lang)
{
    $content = getTempFile($lang, 'i18n.sphp');
    if ($content == '') {
        $refresh = new Refresh(new Api($lang));
        $refresh->refresh();
        $content = getTempFile($lang, 'i18n.sphp');
    }
    return unserialize($content);
}
Exemplo n.º 2
0
$title = isset($_GET['page']) ? trim(htmlspecialchars(urldecode($_GET['page']))) : '';
$format = isset($_GET['format']) ? htmlspecialchars(urldecode($_GET['format'])) : 'epub';
$options = [];
$options['images'] = isset($_GET['images']) ? filter_var($_GET['images'], FILTER_VALIDATE_BOOLEAN) : true;
if (in_array($api->lang, ['fr', 'en', 'de', 'it', 'es', 'pt', 'vec', 'pl', 'nl', 'fa', 'he', 'ar'])) {
    $options['fonts'] = isset($_GET['fonts']) ? strtolower(htmlspecialchars(urldecode($_GET['fonts']))) : '';
} else {
    $options['fonts'] = isset($_GET['fonts']) ? strtolower(htmlspecialchars(urldecode($_GET['fonts']))) : 'freeserif';
    if (filter_var($options['fonts'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === false) {
        $options['fonts'] = '';
    }
}
try {
    if (isset($_GET['refresh'])) {
        $refresh = new Refresh($api);
        $refresh->refresh();
        $success = 'The cache is updated for ' . $api->lang . ' language.';
        include 'templates/book.php';
    }
    if ($title === '') {
        include 'templates/book.php';
    } else {
        $creator = BookCreator::forApi($api, $format, $options);
        try {
            list($book, $file) = $creator->create($title);
        } catch (WSExportInvalidArgumentException $exception) {
            throw new HttpException('Unsupported Media Type', 415);
        }
        header('X-Robots-Tag: none');
        header('Content-Description: File Transfer');
        header('Content-Type: ' . $creator->getMimeType());
Exemplo n.º 3
0
 private function refresh($lang)
 {
     $api = new API($lang, '', $this->mockClient($this->defaultResponses()));
     $refresh = new Refresh($api);
     $refresh->refresh();
 }