Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤖 Automatic code style fixes #497

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions DokuImageProcessorDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@ public static function adjustGetImageLinks($file, $orig_srcpath)
$w = 0;
$h = 0;
$rev = '';
if (preg_match('/[?&]w=(\d+)/', $file, $m)) $w = $m[1];
if (preg_match('/[?&]h=(\d+)/', $file, $m)) $h = $m[1];
if (preg_match('/[&?]rev=(\d+)/', $file, $m)) $rev = $m[1];
if (preg_match('/[?&]w=(\d+)/', $file, $m)) {
$w = $m[1];
}
if (preg_match('/[?&]h=(\d+)/', $file, $m)) {
$h = $m[1];
}
if (preg_match('/[&?]rev=(\d+)/', $file, $m)) {
$rev = $m[1];
}

if (media_isexternal($media)) {
$local = media_get_from_URL($media, $ext, -1);
if (!$local) $local = $media; // let mpdf try again
if (!$local) {
$local = $media;
} // let mpdf try again
} else {
$media = cleanID($media);
//check permissions (namespace only)
Expand Down
40 changes: 30 additions & 10 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ public function convert(Event $event)

// our event?
$allowedEvents = ['export_pdfbook', 'export_pdf', 'export_pdfns'];
if (!in_array($event->data, $allowedEvents)) return;
if (!in_array($event->data, $allowedEvents)) {
return;
}

try {
//collect pages and check permissions
Expand Down Expand Up @@ -211,7 +213,9 @@ protected function collectExportablePages(Event $event)
if (!empty($excludesns)) {
$result = array_filter($result, function ($item) use ($excludesns) {
foreach ($excludesns as $ns) {
if (strpos($item['id'], $ns . ':') === 0) return false;
if (strpos($item['id'], $ns . ':') === 0) {
return false;
}
}
return true;
});
Expand Down Expand Up @@ -376,7 +380,9 @@ protected function wikiToDW2PDF($id, $rev = '', $date_at = '')
{
$file = wikiFN($id, $rev);

if (!file_exists($file)) return '';
if (!file_exists($file)) {
return '';
}

//ensure $id is in global $ID (needed for parsing)
global $ID;
Expand Down Expand Up @@ -883,8 +889,12 @@ public function getExportedPages()
*/
public function cbDateSort($a, $b)
{
if ($b['rev'] < $a['rev']) return -1;
if ($b['rev'] > $a['rev']) return 1;
if ($b['rev'] < $a['rev']) {
return -1;
}
if ($b['rev'] > $a['rev']) {
return 1;
}
return strcmp($b['id'], $a['id']);
}

Expand Down Expand Up @@ -913,14 +923,22 @@ public function cbPagenameSort($a, $b)
// have we reached the page level?
if ($i === ($countA - 1) || $i === ($countB - 1)) {
// start page first
if ($partA == $conf['start']) return -1;
if ($partB == $conf['start']) return 1;
if ($partA == $conf['start']) {
return -1;
}
if ($partB == $conf['start']) {
return 1;
}
}

// prefer page over namespace
if ($partA === $partB) {
if (!isset($partsA[$i + 1])) return -1;
if (!isset($partsB[$i + 1])) return 1;
if (!isset($partsA[$i + 1])) {
return -1;
}
if (!isset($partsB[$i + 1])) {
return 1;
}
continue;
}

Expand Down Expand Up @@ -1094,7 +1112,9 @@ protected function getDocumentLanguage($pageid)
$trans = plugin_load('helper', 'translation');
if ($trans) {
$tr = $trans->getLangPart($pageid);
if ($tr) $lang = $tr;
if ($tr) {
$lang = $tr;
}
}

return $lang;
Expand Down
8 changes: 6 additions & 2 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public function document_start()
*/
public function canRender($format)
{
if ($format == 'xhtml') return true;
if ($format == 'xhtml') {
return true;
}
return false;
}

Expand All @@ -70,7 +72,9 @@ public function canRender($format)
*/
public function header($text, $level, $pos, $returnonly = false)
{
if (!$text) return; //skip empty headlines
if (!$text) {
return;
} //skip empty headlines
global $ID;

$hid = $this->_headerToLink($text, true);
Expand Down