# HTML!
$this->mOffset = $this->mRequest->getText( 'offset' );
$this->mLimit = $this->mRequest->getInt( 'limit', $this->mDefaultLimit );
- if ( $this->mLimit <= 0 ) {
+ if ( $this->mLimit <= 0 || $this->mLimit > 50000 ) {
$this->mLimit = $this->mDefaultLimit;
}
$this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' );
$next = array( 'offset' => $this->mLastShown, 'limit' => $urlLimit );
$last = array( 'dir' => 'prev', 'limit' => $urlLimit );
}
- return compact( 'prev', 'next', 'first', 'last' );
+ return array( 'prev' => $prev, 'next' => $next, 'first' => $first, 'last' => $last );
}
/**
$links[] = $this->makeLink( $wgLang->formatNum( $limit ),
array( 'offset' => $offset, 'limit' => $limit ) );
}
+ return $links;
}
/**
$limitLinks = $this->getLimitLinks();
$limits = implode( ' | ', $limitLinks );
- $this->mNavigationBar = "($latestText | $earliestText) " . wfMsgHtml("viewprevnext", $prevText, $nextText, $limits);
+ $this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " . wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
return $this->mNavigationBar;
}
}
function getStartBody() {
global $wgStylePath;
- $s = "<table border='1' class=\"TablePager\"><thead><tr>\n";
+ $tableClass = htmlspecialchars( $this->getTableClass() );
+ $sortClass = htmlspecialchars( $this->getSortHeaderClass() );
+
+ $s = "<table border='1' class=\"$tableClass\"><thead><tr>\n";
$fields = $this->getFieldNames();
+
+ # Make table header
foreach ( $fields as $field => $name ) {
if ( strval( $name ) == '' ) {
$s .= "<th> </th>\n";
$link = $this->makeLink(
"<img width=\"12\" height=\"12\" alt=\"$alt\" src=\"$image\" />" .
htmlspecialchars( $name ), $query );
- $s .= "<th class=\"TablePager_sort\">$link</th>\n";
+ $s .= "<th class=\"$sortClass\">$link</th>\n";
} else {
$s .= '<th>' . $this->makeLink( htmlspecialchars( $name ), $query ) . "</th>\n";
}
}
function getEndBody() {
- return '</tbody></table>';
+ return "</tbody></table>\n";
}
function getEmptyBody() {
if ( $formatted == '' ) {
$formatted = ' ';
}
- $s .= "<td>$formatted</td>\n";
+ $class = 'TablePager_col_' . htmlspecialchars( $field );
+ $s .= "<td class=\"$class\">$formatted</td>\n";
}
$s .= "</tr>\n";
return $s;
return $this->mSort;
}
+ function getTableClass() {
+ return 'TablePager';
+ }
+
+ function getNavClass() {
+ return 'TablePager_nav';
+ }
+
+ function getSortHeaderClass() {
+ return 'TablePager_sort';
+ }
+
/**
* A navigation bar with images
*/
'next' => $wgContLang->isRTL() ? 'arrow_disabled_left_25.png' : 'arrow_disabled_right_25.png',
'last' => $wgContLang->isRTL() ? 'arrow_disabled_first_25.png' : 'arrow_disabled_last_25.png',
);
-
+
$linkTexts = array();
$disabledTexts = array();
foreach ( $labels as $type => $label ) {
}
$links = $this->getPagingLinks( $linkTexts, $disabledTexts );
- $s = '<table class="TablePager_nav" align="center" cellpadding="3"><tr>';
+ $navClass = htmlspecialchars( $this->getNavClass() );
+ $s = "<table class=\"$navClass\" align=\"center\" cellpadding=\"3\"><tr>\n";
$cellAttrs = 'valign="top" align="center" width="' . 100 / count( $links ) . '%"';
foreach ( $labels as $type => $label ) {
$s .= "<td $cellAttrs>{$links[$type]}</td>\n";
}
- $s .= '</tr></table>';
+ $s .= "</tr></table>\n";
return $s;
}