Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Klap-in committed Feb 7, 2024
1 parent 0ed7a96 commit c1a842d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions syntax/bookmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
$num = 10;
$order = 'date';
if($type == 'archive') {
list(/* $junk */, $params) = explode(':', $match, 2);
list($param1, $param2) = explode('&', $params, 2);
[/* $junk */, $params] = array_pad(explode(':', $match, 2), 2, '');
[$param1, $param2] = array_pad(explode('&', $params, 2),2, '');

$sortoptions = ['date', 'title'];
if(is_numeric($param1)) {
Expand All @@ -102,7 +102,7 @@ function handle($match, $state, $pos, Doku_Handler $handler) {

/**
* @param string $format render mode e.g. text, xhtml, meta,...
* @param Doku_Renderer &$renderer
* @param Doku_Renderer $renderer
* @param array $data return of handle()
* @return bool
*/
Expand Down Expand Up @@ -349,7 +349,7 @@ function _datesort($a, $b) {
* @return int
*/
function _titlesort($a, $b) {
if($a['id'] <= $b['id']) return -1;
if($a['id'] < $b['id']) return -1;
if($a['id'] > $b['id']) return 1;
return 0;
}
Expand Down Expand Up @@ -398,11 +398,11 @@ private function getlist($order, $limit = 0) {
* @return string html of list
*/
private function showlist($result, $isbookmanager = false) {
$output = '<ul>'.DOKU_LF;
$output = '<ul>';
foreach($result as $item) {
$output .= $this->hlp->createListitem($item, $isbookmanager);
}
$output .= '</ul>'.DOKU_LF;
$output .= '</ul>';
return $output;
}
}
4 changes: 2 additions & 2 deletions syntax/exportlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public function handle($match, $state, $pos, Doku_Handler $handler)
{
global $ID;
$match = substr($match, 2, -2); //remove ~~
list($type, $match) = explode('>', $match, 2);
[$type, $match] = array_pad(explode('>', $match, 2),2, '');

$type = strtolower(substr($type, 0, -2)); //remove NS
list($ns, $title) = explode('|', $match, 2);
[$ns, $title] = array_pad(explode('|', $match, 2), 2, '');
$id = $ns . ':start';
$resolver = new PageResolver($ID);
$page = $resolver->resolveId($id);
Expand Down
6 changes: 3 additions & 3 deletions syntax/exportsaved.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getSort()
public function handle($match, $state, $pos, Doku_Handler $handler)
{
$match = substr($match, 2, -2); // strip markup
list($type, $savedSelectionPage) = explode(':', $match, 2);
[$type, $savedSelectionPage] = array_pad(explode(':', $match, 2), 2, '');
//type: EXPORT...
$type = strtolower(substr($type, 6));
$exporturl = [
Expand All @@ -60,8 +60,8 @@ public function handle($match, $state, $pos, Doku_Handler $handler)
}
$link = $exporturl[$type];

list($savedSelectionPage, $linktitle) = explode('|', $savedSelectionPage, 2);
list($savedSelectionPage, $extraParameters) = explode('&', $savedSelectionPage, 2);
[$savedSelectionPage, $linktitle] = array_pad(explode('|', $savedSelectionPage, 2), 2, '');
[$savedSelectionPage, $extraParameters] = array_pad(explode('&', $savedSelectionPage, 2), 2, '');

$ns = $this->getConf('save_namespace');
$savedSelectionPageid = cleanID($ns . ":" . $savedSelectionPage);
Expand Down

0 comments on commit c1a842d

Please sign in to comment.