Skip to content

Commit

Permalink
Merge branch 'enforced_utf_8_encoding' into 'main'
Browse files Browse the repository at this point in the history
Enforced UTF-8 encoding on DOMDocument

See merge request softwares-pkp/plugins_ojs/fullJournalTransfer!62
  • Loading branch information
thiagolepidus committed Feb 10, 2025
2 parents 12610a3 + fda5eaa commit 4fbcc33
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion filter/export/AnnouncementNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getClassName()

public function &process(&$announcements)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$deployment = $this->getDeployment();
Expand Down
2 changes: 1 addition & 1 deletion filter/export/AnnouncementTypeNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getClassName()

public function &process(&$announcementTypes)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$deployment = $this->getDeployment();
Expand Down
2 changes: 1 addition & 1 deletion filter/export/JournalNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private function getJournalLocalizedProps()

public function &process(&$journal)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$deployment = $this->getDeployment();
Expand Down
2 changes: 1 addition & 1 deletion filter/export/NavigationMenuItemNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getClassName()

public function &process(&$navigationMenuItems)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$deployment = $this->getDeployment();
Expand Down
2 changes: 1 addition & 1 deletion filter/export/NavigationMenuNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getClassName()

public function &process(&$navigationMenus)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$deployment = $this->getDeployment();
Expand Down
2 changes: 1 addition & 1 deletion filter/export/PluginNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getClassName()

public function &process(&$plugins)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$deployment = $this->getDeployment();
Expand Down
2 changes: 1 addition & 1 deletion filter/export/ReviewFormElementNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getClassName()

public function &process(&$reviewFormElements)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$deployment = $this->getDeployment();
Expand Down
2 changes: 1 addition & 1 deletion filter/export/ReviewFormNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getClassName()

public function &process(&$reviewForms)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$deployment = $this->getDeployment();
Expand Down
2 changes: 1 addition & 1 deletion filter/import/NativeXmlJournalFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function parseUsers($node, $journal)

echo __('plugins.importexport.fullJournal.importingUsers') . "\n";

$usersDoc = new DOMDocument('1.0');
$usersDoc = new DOMDocument('1.0', 'utf-8');
$usersDoc->preserveWhiteSpace = false;
$usersDoc->formatOutput = true;
$usersDoc->appendChild($usersDoc->importNode($node, true));
Expand Down
4 changes: 2 additions & 2 deletions tests/NativeImportExportFilterTestCase.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protected function setUp(): void
{
parent::setUp();

$this->doc = new DOMDocument('1.0');
$this->doc = new DOMDocument('1.0', 'utf-8');
$this->doc->preserveWhiteSpace = false;
$this->doc->formatOutput = true;

Expand Down Expand Up @@ -46,7 +46,7 @@ abstract protected function getNativeImportExportFilterClass();
protected function getSampleXml($sampleFile)
{
$fileContent = file_get_contents(__DIR__ . '/samples/' . $sampleFile);
$xml = new DOMDocument('1.0');
$xml = new DOMDocument('1.0', 'utf-8');
$xml->loadXML($fileContent);

return $xml;
Expand Down
4 changes: 2 additions & 2 deletions tests/export/AnnouncementNativeXmlFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testAddDateElements()
{
$deployment = $this->announcementExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down Expand Up @@ -107,7 +107,7 @@ public function testCreateAnnouncementNode()
{
$deployment = $this->announcementExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down
2 changes: 1 addition & 1 deletion tests/export/AnnouncementTypeNativeXmlFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testCreateAnnouncementTypeNode()
$announcementTypeExportFilter = $this->getNativeImportExportFilter();
$deployment = $announcementTypeExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down
14 changes: 7 additions & 7 deletions tests/export/JournalNativeXmlFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ public function testCreateSubmissionChecklistNode()
$journalExportFilter = $this->getNativeImportExportFilter();
$deployment = $journalExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down Expand Up @@ -693,7 +693,7 @@ public function testCreateJournalOptionalNodes()
$journalExportFilter = $this->getNativeImportExportFilter();
$deployment = $journalExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand All @@ -717,7 +717,7 @@ public function testCreateJournalLocalizedNodes()
$journalExportFilter = $this->getNativeImportExportFilter();
$deployment = $journalExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down Expand Up @@ -807,7 +807,7 @@ public function testAddPlugins()
$deployment->setContext($journal);
$journalExportFilter->setDeployment($deployment);

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand All @@ -834,7 +834,7 @@ public function testAddSections()

$journal = $this->createJournal();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand All @@ -859,7 +859,7 @@ public function testAddMetrics()

$journal = $this->createJournal();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down Expand Up @@ -894,7 +894,7 @@ public function testCreateJournalNode()
$journalExportFilter = $this->getNativeImportExportFilter();
$deployment = $journalExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down
2 changes: 1 addition & 1 deletion tests/export/NavigationMenuItemNativeXmlFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testCreateNavigationMenuItemNode()
$navMenuItemExportFilter = $this->getNativeImportExportFilter();
$deployment = $navMenuItemExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down
4 changes: 2 additions & 2 deletions tests/export/NavigationMenuNativeXmlFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testAddNavigationMenuAssignments()
$navMenuExportFilter = $this->getNativeImportExportFilter();
$deployment = $navMenuExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down Expand Up @@ -72,7 +72,7 @@ public function testCreateNavigationMenuNode()
$navMenuExportFilter = $this->getNativeImportExportFilter();
$deployment = $navMenuExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down
2 changes: 1 addition & 1 deletion tests/export/PluginNativeXmlFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testCreatePluginNode()
$pluginExportFilter = $this->getNativeImportExportFilter();
$deployment = $pluginExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down
4 changes: 2 additions & 2 deletions tests/export/ReviewFormElementNativeXmlFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testAddPossibleResponsesNode()
'en_US' => ['option 1','option 2', 'option 3']
];

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down Expand Up @@ -71,7 +71,7 @@ public function testCreateReviewFormElementNode()
$reviewFormElementExportFilter = $this->getNativeImportExportFilter();
$deployment = $reviewFormElementExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down
4 changes: 2 additions & 2 deletions tests/export/ReviewFormNativeXmlFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testAddReviewFormElements()
$reviewFormExportFilter = $this->getNativeImportExportFilter();
$deployment = $reviewFormExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand All @@ -120,7 +120,7 @@ public function testCreateReviewFormNode()
$reviewFormExportFilter = $this->getNativeImportExportFilter();
$deployment = $reviewFormExportFilter->getDeployment();

$doc = new DOMDocument('1.0');
$doc = new DOMDocument('1.0', 'utf-8');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;

Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>
<application>fullJournalTransfer</application>
<type>plugins.importexport</type>
<release>2.0.15.0</release>
<date>2024-09-12</date>
<release>2.0.16.0</release>
<date>2025-02-10</date>
<class>FullJournalImportExportPlugin</class>
</version>

0 comments on commit 4fbcc33

Please sign in to comment.