Skip to content

Commit

Permalink
feat(export): removed HTML5 export (#3008)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Jun 23, 2024
1 parent 84c1277 commit db7a49b
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 161 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.
- improved session timout warning for admins (Thorsten)
- removed Twitter/X support (Thorsten)
- removed support for adding own meta-content in templates (Thorsten)
- removed HTML5 export (Thorsten)
- removed REST API v2 (Thorsten)
- migrated from Yarn to PNPM (Thorsten)
- migrated from Fork Awesome to Bootstrap Icons (Thorsten, Jan Harms)
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/admin/export.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* JSON, HTML5 and PDF export
* JSON, and PDF export
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
Expand Down
4 changes: 0 additions & 4 deletions phpmyfaq/assets/templates/admin/import-export/export.twig
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@
<input class="form-check-input" type="radio" name="export-type" id="pdf" value="pdf">
<label class="form-check-label" for="pdf">PDF</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="export-type" id="html5" value="html5">
<label class="form-check-label" for="html5">HTML5</label>
</div>
</div>
</div>

Expand Down
8 changes: 1 addition & 7 deletions phpmyfaq/src/phpMyFAQ/Administration/HttpStreamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* This class manages the stream of a generic content
* taking into account the correct http headers settings
*
* Currently, it supports only 4 content (mime) types:
* Currently, it supports only 3 content (mime) types:
* - PDF: application/pdf
* - HTML5: text/html
* - CSV: text/csv
* - JSON: application/json
* - Generic file: application/octet-stream
Expand Down Expand Up @@ -95,11 +94,6 @@ private function setHttpHeaders(): void
$description = 'phpMyFAQ PDF export file';
$mimeType = 'application/pdf';
break;
case 'html5':
$filename = 'phpmyfaq.html';
$description = 'phpMyFAQ HTML5 export file';
$mimeType = 'text/html';
break;
case 'csv':
$filename = 'phpmyfaq.csv';
$description = 'phpMyFAQ CSV export file';
Expand Down
6 changes: 2 additions & 4 deletions phpmyfaq/src/phpMyFAQ/Export.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* JSON, XML, HTML5 and PDF export
* JSON, and PDF export
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
Expand All @@ -19,7 +19,6 @@
namespace phpMyFAQ;

use phpMyFAQ\Core\Exception;
use phpMyFAQ\Export\Html5;
use phpMyFAQ\Export\Json;
use phpMyFAQ\Export\Pdf;

Expand All @@ -45,11 +44,10 @@ public static function create(
Category $category,
Configuration $configuration,
string $mode = 'pdf'
): Pdf|Html5|Json {
): Pdf|Json {
return match ($mode) {
'json' => new Json($faq, $category, $configuration),
'pdf' => new Pdf($faq, $category, $configuration),
'html5' => new Html5($faq, $category, $configuration),
default => throw new Exception('Export not implemented!'),
};
}
Expand Down
132 changes: 0 additions & 132 deletions phpmyfaq/src/phpMyFAQ/Export/Html5.php

This file was deleted.

3 changes: 0 additions & 3 deletions phpmyfaq/src/phpMyFAQ/Faq/QueryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
public const FAQ_QUERY_TYPE_APPROVAL = 'faq_approval';
public const FAQ_QUERY_TYPE_EXPORT_PDF = 'faq_export_pdf';
public const FAQ_QUERY_TYPE_EXPORT_JSON = 'faq_export_json';
public const FAQ_QUERY_TYPE_EXPORT_HTML5 = 'faq_export_html';

private Configuration $configuration;

Expand Down Expand Up @@ -147,7 +146,6 @@ public function getQuery(
$query .= " fd.active = '" . self::FAQ_SQL_ACTIVE_NO . "'";
break;
case self::FAQ_QUERY_TYPE_EXPORT_PDF:
case self::FAQ_QUERY_TYPE_EXPORT_HTML5:
case self::FAQ_QUERY_TYPE_EXPORT_JSON:
default:
$query .= ' AND';
Expand All @@ -157,7 +155,6 @@ public function getQuery(

match ($queryType) {
self::FAQ_QUERY_TYPE_EXPORT_PDF,
self::FAQ_QUERY_TYPE_EXPORT_HTML5,
self::FAQ_QUERY_TYPE_EXPORT_JSON => $query .= "\nORDER BY fcr.category_id, fd.id",
default => $query .= "\nORDER BY fcr.category_id, fd.id",
};
Expand Down
10 changes: 0 additions & 10 deletions tests/phpMyFAQ/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use phpMyFAQ\Core\Exception;
use phpMyFAQ\Database\Sqlite3;
use phpMyFAQ\Export\Html5;
use phpMyFAQ\Export\Json;
use phpMyFAQ\Export\Pdf;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -50,15 +49,6 @@ public function testCreatePdf(): void
$this->assertInstanceOf(Pdf::class, $pdf);
}

/**
* @throws Exception
*/
public function testCreateHtml5(): void
{
$html5 = Export::create($this->faq, $this->category, $this->configuration, 'html5');
$this->assertInstanceOf(Html5::class, $html5);
}

/**
* @throws Exception
*/
Expand Down

0 comments on commit db7a49b

Please sign in to comment.