mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 12:16:07 +00:00
Updated old exportService name in controllers
This commit is contained in:
parent
a042e22481
commit
ebeca256f0
@ -8,15 +8,15 @@ use Throwable;
|
|||||||
class BookExportApiController extends ApiController
|
class BookExportApiController extends ApiController
|
||||||
{
|
{
|
||||||
protected $bookRepo;
|
protected $bookRepo;
|
||||||
protected $exportService;
|
protected $exportFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BookExportController constructor.
|
* BookExportController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(BookRepo $bookRepo, ExportFormatter $exportService)
|
public function __construct(BookRepo $bookRepo, ExportFormatter $exportFormatter)
|
||||||
{
|
{
|
||||||
$this->bookRepo = $bookRepo;
|
$this->bookRepo = $bookRepo;
|
||||||
$this->exportService = $exportService;
|
$this->exportFormatter = $exportFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,7 +26,7 @@ class BookExportApiController extends ApiController
|
|||||||
public function exportPdf(int $id)
|
public function exportPdf(int $id)
|
||||||
{
|
{
|
||||||
$book = Book::visible()->findOrFail($id);
|
$book = Book::visible()->findOrFail($id);
|
||||||
$pdfContent = $this->exportService->bookToPdf($book);
|
$pdfContent = $this->exportFormatter->bookToPdf($book);
|
||||||
return $this->downloadResponse($pdfContent, $book->slug . '.pdf');
|
return $this->downloadResponse($pdfContent, $book->slug . '.pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ class BookExportApiController extends ApiController
|
|||||||
public function exportHtml(int $id)
|
public function exportHtml(int $id)
|
||||||
{
|
{
|
||||||
$book = Book::visible()->findOrFail($id);
|
$book = Book::visible()->findOrFail($id);
|
||||||
$htmlContent = $this->exportService->bookToContainedHtml($book);
|
$htmlContent = $this->exportFormatter->bookToContainedHtml($book);
|
||||||
return $this->downloadResponse($htmlContent, $book->slug . '.html');
|
return $this->downloadResponse($htmlContent, $book->slug . '.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class BookExportApiController extends ApiController
|
|||||||
public function exportPlainText(int $id)
|
public function exportPlainText(int $id)
|
||||||
{
|
{
|
||||||
$book = Book::visible()->findOrFail($id);
|
$book = Book::visible()->findOrFail($id);
|
||||||
$textContent = $this->exportService->bookToPlainText($book);
|
$textContent = $this->exportFormatter->bookToPlainText($book);
|
||||||
return $this->downloadResponse($textContent, $book->slug . '.txt');
|
return $this->downloadResponse($textContent, $book->slug . '.txt');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,15 +8,15 @@ use Throwable;
|
|||||||
class ChapterExportApiController extends ApiController
|
class ChapterExportApiController extends ApiController
|
||||||
{
|
{
|
||||||
protected $chapterRepo;
|
protected $chapterRepo;
|
||||||
protected $exportService;
|
protected $exportFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ChapterExportController constructor.
|
* ChapterExportController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(BookRepo $chapterRepo, ExportFormatter $exportService)
|
public function __construct(BookRepo $chapterRepo, ExportFormatter $exportFormatter)
|
||||||
{
|
{
|
||||||
$this->chapterRepo = $chapterRepo;
|
$this->chapterRepo = $chapterRepo;
|
||||||
$this->exportService = $exportService;
|
$this->exportFormatter = $exportFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,7 +26,7 @@ class ChapterExportApiController extends ApiController
|
|||||||
public function exportPdf(int $id)
|
public function exportPdf(int $id)
|
||||||
{
|
{
|
||||||
$chapter = Chapter::visible()->findOrFail($id);
|
$chapter = Chapter::visible()->findOrFail($id);
|
||||||
$pdfContent = $this->exportService->chapterToPdf($chapter);
|
$pdfContent = $this->exportFormatter->chapterToPdf($chapter);
|
||||||
return $this->downloadResponse($pdfContent, $chapter->slug . '.pdf');
|
return $this->downloadResponse($pdfContent, $chapter->slug . '.pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ class ChapterExportApiController extends ApiController
|
|||||||
public function exportHtml(int $id)
|
public function exportHtml(int $id)
|
||||||
{
|
{
|
||||||
$chapter = Chapter::visible()->findOrFail($id);
|
$chapter = Chapter::visible()->findOrFail($id);
|
||||||
$htmlContent = $this->exportService->chapterToContainedHtml($chapter);
|
$htmlContent = $this->exportFormatter->chapterToContainedHtml($chapter);
|
||||||
return $this->downloadResponse($htmlContent, $chapter->slug . '.html');
|
return $this->downloadResponse($htmlContent, $chapter->slug . '.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class ChapterExportApiController extends ApiController
|
|||||||
public function exportPlainText(int $id)
|
public function exportPlainText(int $id)
|
||||||
{
|
{
|
||||||
$chapter = Chapter::visible()->findOrFail($id);
|
$chapter = Chapter::visible()->findOrFail($id);
|
||||||
$textContent = $this->exportService->chapterToPlainText($chapter);
|
$textContent = $this->exportFormatter->chapterToPlainText($chapter);
|
||||||
return $this->downloadResponse($textContent, $chapter->slug . '.txt');
|
return $this->downloadResponse($textContent, $chapter->slug . '.txt');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,15 +10,15 @@ class BookExportController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected $bookRepo;
|
protected $bookRepo;
|
||||||
protected $exportService;
|
protected $exportFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BookExportController constructor.
|
* BookExportController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(BookRepo $bookRepo, ExportFormatter $exportService)
|
public function __construct(BookRepo $bookRepo, ExportFormatter $exportFormatter)
|
||||||
{
|
{
|
||||||
$this->bookRepo = $bookRepo;
|
$this->bookRepo = $bookRepo;
|
||||||
$this->exportService = $exportService;
|
$this->exportFormatter = $exportFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +28,7 @@ class BookExportController extends Controller
|
|||||||
public function pdf(string $bookSlug)
|
public function pdf(string $bookSlug)
|
||||||
{
|
{
|
||||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||||
$pdfContent = $this->exportService->bookToPdf($book);
|
$pdfContent = $this->exportFormatter->bookToPdf($book);
|
||||||
return $this->downloadResponse($pdfContent, $bookSlug . '.pdf');
|
return $this->downloadResponse($pdfContent, $bookSlug . '.pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class BookExportController extends Controller
|
|||||||
public function html(string $bookSlug)
|
public function html(string $bookSlug)
|
||||||
{
|
{
|
||||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||||
$htmlContent = $this->exportService->bookToContainedHtml($book);
|
$htmlContent = $this->exportFormatter->bookToContainedHtml($book);
|
||||||
return $this->downloadResponse($htmlContent, $bookSlug . '.html');
|
return $this->downloadResponse($htmlContent, $bookSlug . '.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class BookExportController extends Controller
|
|||||||
public function plainText(string $bookSlug)
|
public function plainText(string $bookSlug)
|
||||||
{
|
{
|
||||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||||
$textContent = $this->exportService->bookToPlainText($book);
|
$textContent = $this->exportFormatter->bookToPlainText($book);
|
||||||
return $this->downloadResponse($textContent, $bookSlug . '.txt');
|
return $this->downloadResponse($textContent, $bookSlug . '.txt');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,15 @@ class ChapterExportController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected $chapterRepo;
|
protected $chapterRepo;
|
||||||
protected $exportService;
|
protected $exportFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ChapterExportController constructor.
|
* ChapterExportController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(ChapterRepo $chapterRepo, ExportFormatter $exportService)
|
public function __construct(ChapterRepo $chapterRepo, ExportFormatter $exportFormatter)
|
||||||
{
|
{
|
||||||
$this->chapterRepo = $chapterRepo;
|
$this->chapterRepo = $chapterRepo;
|
||||||
$this->exportService = $exportService;
|
$this->exportFormatter = $exportFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +28,7 @@ class ChapterExportController extends Controller
|
|||||||
public function pdf(string $bookSlug, string $chapterSlug)
|
public function pdf(string $bookSlug, string $chapterSlug)
|
||||||
{
|
{
|
||||||
$chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
|
$chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
|
||||||
$pdfContent = $this->exportService->chapterToPdf($chapter);
|
$pdfContent = $this->exportFormatter->chapterToPdf($chapter);
|
||||||
return $this->downloadResponse($pdfContent, $chapterSlug . '.pdf');
|
return $this->downloadResponse($pdfContent, $chapterSlug . '.pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ class ChapterExportController extends Controller
|
|||||||
public function html(string $bookSlug, string $chapterSlug)
|
public function html(string $bookSlug, string $chapterSlug)
|
||||||
{
|
{
|
||||||
$chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
|
$chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
|
||||||
$containedHtml = $this->exportService->chapterToContainedHtml($chapter);
|
$containedHtml = $this->exportFormatter->chapterToContainedHtml($chapter);
|
||||||
return $this->downloadResponse($containedHtml, $chapterSlug . '.html');
|
return $this->downloadResponse($containedHtml, $chapterSlug . '.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class ChapterExportController extends Controller
|
|||||||
public function plainText(string $bookSlug, string $chapterSlug)
|
public function plainText(string $bookSlug, string $chapterSlug)
|
||||||
{
|
{
|
||||||
$chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
|
$chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
|
||||||
$chapterText = $this->exportService->chapterToPlainText($chapter);
|
$chapterText = $this->exportFormatter->chapterToPlainText($chapter);
|
||||||
return $this->downloadResponse($chapterText, $chapterSlug . '.txt');
|
return $this->downloadResponse($chapterText, $chapterSlug . '.txt');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,15 @@ class PageExportController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected $pageRepo;
|
protected $pageRepo;
|
||||||
protected $exportService;
|
protected $exportFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PageExportController constructor.
|
* PageExportController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(PageRepo $pageRepo, ExportFormatter $exportService)
|
public function __construct(PageRepo $pageRepo, ExportFormatter $exportFormatter)
|
||||||
{
|
{
|
||||||
$this->pageRepo = $pageRepo;
|
$this->pageRepo = $pageRepo;
|
||||||
$this->exportService = $exportService;
|
$this->exportFormatter = $exportFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +33,7 @@ class PageExportController extends Controller
|
|||||||
{
|
{
|
||||||
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
|
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
|
||||||
$page->html = (new PageContent($page))->render();
|
$page->html = (new PageContent($page))->render();
|
||||||
$pdfContent = $this->exportService->pageToPdf($page);
|
$pdfContent = $this->exportFormatter->pageToPdf($page);
|
||||||
return $this->downloadResponse($pdfContent, $pageSlug . '.pdf');
|
return $this->downloadResponse($pdfContent, $pageSlug . '.pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class PageExportController extends Controller
|
|||||||
{
|
{
|
||||||
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
|
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
|
||||||
$page->html = (new PageContent($page))->render();
|
$page->html = (new PageContent($page))->render();
|
||||||
$containedHtml = $this->exportService->pageToContainedHtml($page);
|
$containedHtml = $this->exportFormatter->pageToContainedHtml($page);
|
||||||
return $this->downloadResponse($containedHtml, $pageSlug . '.html');
|
return $this->downloadResponse($containedHtml, $pageSlug . '.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class PageExportController extends Controller
|
|||||||
public function plainText(string $bookSlug, string $pageSlug)
|
public function plainText(string $bookSlug, string $pageSlug)
|
||||||
{
|
{
|
||||||
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
|
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
|
||||||
$pageText = $this->exportService->pageToPlainText($page);
|
$pageText = $this->exportFormatter->pageToPlainText($page);
|
||||||
return $this->downloadResponse($pageText, $pageSlug . '.txt');
|
return $this->downloadResponse($pageText, $pageSlug . '.txt');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user