protected function getCss(Book $book) { $css = FontProvider::getCss($book->options['fonts'], 'fonts/'); $css .= getTempFile($book->lang, 'epub.css'); return $css; }
/** * return the list of the namespaces for the current wiki. * @return string[] */ public function getNamespaces() { $namespaces = unserialize(getTempFile($this->api->lang, 'namespaces.sphp')); if (is_array($namespaces)) { return $namespaces; } else { return []; } }
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); }
if ($format == "pdfunite") { // Content is json_encoded array $pdf_contents = json_decode($contents); if (!$pdf_contents) { _errormsg("Invalid contents for pdfunite"); } $infiles = array(); foreach ($pdf_contents as $encodedPdf) { $file = getTempFile("pdfin", "pdf"); $decoded = base64_decode($encodedPdf); if (!$decoded) { _errormsg("Unable to obtain one of the incoming pdf files for pdfunite"); } file_put_contents($file, base64_decode($encodedPdf)); $infiles[] = $file; } $pdfs = implode(" ", $infiles); $outpdf = getTempFile("pdfout", "pdf"); exec("pdfunite {$pdfs} {$outpdf}"); foreach ($infiles as $ifile) { unlink($ifile); } $response = file_get_contents($outpdf); if (!$response) { _errormsg("Could not convert using pdfunite"); } unlink($outpdf); print json_encode(array("status" => "ok", "{$format}" => base64_encode($response))); exit; } _errormsg("invalid formats");
public function testRefreshUpdatesNamespacesList() { $this->refresh('en'); $namespaces = unserialize(getTempFile('en', 'namespaces.sphp')); $this->assertEquals(['0' => 'test'], $namespaces); }