Minor - format code

pull/3368/head
Julio Montoya 5 years ago
parent 26d57fe0a5
commit fd2670e106
  1. 57
      main/inc/lib/pear/Pager/Common.php
  2. 28
      main/inc/lib/pear/Pager/Sliding.php
  3. 4
      main/inc/lib/sortable_table.class.php

@ -837,7 +837,7 @@ class Pager_Common
*/
function _renderLink($altText, $linkText)
{
if ($this->_httpMethod == 'GET') {
if ($this->_httpMethod === 'GET') {
if ($this->_append) {
$href = '?' . $this->_http_build_query_wrapper($this->_linkData);
} else {
@ -1020,6 +1020,7 @@ class Pager_Common
$qs = $_GET;
}
}
foreach ($this->_excludeVars as $exclude) {
$use_preg = $this->_isRegexp($exclude);
foreach (array_keys($qs) as $qs_item) {
@ -1039,6 +1040,7 @@ class Pager_Common
$this->_recursive_urldecode($this->_extraVars);
$qs = array_merge($qs, $this->_extraVars);
}
if (count($qs)
&& function_exists('get_magic_quotes_gpc')
&& -1 == version_compare(PHP_VERSION, '5.2.99')
@ -1120,17 +1122,17 @@ class Pager_Common
if ($this->_currentPage > 1) {
$this->_linkData[$this->_urlVar] = $this->getPreviousPageID();
$back = $this->_renderLink($this->_altPrev, $this->_prevImg)
. $this->_spacesBefore . $this->_spacesAfter;
} else if ($this->_prevImgEmpty !== null && $this->_totalPages > 1) {
$back = $this->_prevImgEmpty
. $this->_spacesBefore . $this->_spacesAfter;
.$this->_spacesBefore.$this->_spacesAfter;
} else {
if ($this->_prevImgEmpty !== null && $this->_totalPages > 1) {
$back = $this->_prevImgEmpty
.$this->_spacesBefore.$this->_spacesAfter;
}
}
return $back;
}
// }}}
// {{{ _getPageLinks()
/**
* Returns pages link
*
@ -1145,9 +1147,6 @@ class Pager_Common
return $this->raiseError($msg, ERROR_PAGER_NOT_IMPLEMENTED);
}
// }}}
// {{{ _getNextLink()
/**
* Returns next link
*
@ -1171,19 +1170,19 @@ class Pager_Common
if ($this->_currentPage < $this->_totalPages) {
$this->_linkData[$this->_urlVar] = $this->getNextPageID();
$next = $this->_spacesAfter
. $this->_renderLink($this->_altNext, $this->_nextImg)
. $this->_spacesBefore . $this->_spacesAfter;
} else if ($this->_nextImgEmpty !== null && $this->_totalPages > 1) {
$next = $this->_spacesAfter
. $this->_nextImgEmpty
. $this->_spacesBefore . $this->_spacesAfter;
.$this->_renderLink($this->_altNext, $this->_nextImg)
.$this->_spacesBefore.$this->_spacesAfter;
} else {
if ($this->_nextImgEmpty !== null && $this->_totalPages > 1) {
$next = $this->_spacesAfter
.$this->_nextImgEmpty
.$this->_spacesBefore.$this->_spacesAfter;
}
}
return $next;
}
// }}}
// {{{ _getFirstLinkTag()
/**
* Returns first link tag
*
@ -1209,9 +1208,6 @@ class Pager_Common
);
}
// }}}
// {{{ _getPrevLinkTag()
/**
* Returns previous link tag
*
@ -1439,9 +1435,6 @@ class Pager_Common
}
}
// }}}
// {{{ _http_build_query_wrapper()
/**
* This is a slightly modified version of the http_build_query() function;
* it heavily borrows code from PHP_Compat's http_build_query().
@ -1455,20 +1448,20 @@ class Pager_Common
*/
function _http_build_query_wrapper($data)
{
$data = (array)$data;
$data = (array) $data;
if (empty($data)) {
return '';
}
$separator = ini_get('arg_separator.output');
if ($separator == '&amp;') {
if ($separator === '&amp;') {
$separator = '&'; //the string is escaped by htmlentities anyway...
}
$tmp = array ();
$tmp = [];
foreach ($data as $key => $val) {
if (is_scalar($val)) {
//array_push($tmp, $key.'='.$val);
$val = urlencode($val);
array_push($tmp, $key .'='. str_replace('%2F', '/', $val));
array_push($tmp, $key.'='.str_replace('%2F', '/', $val));
continue;
}
// If the value is an array, recursively parse it
@ -1477,12 +1470,10 @@ class Pager_Common
continue;
}
}
return implode($separator, $tmp);
}
// }}}
// {{{ __http_build_query()
/**
* Helper function
*

@ -162,13 +162,13 @@ class Pager_Sliding extends Pager_Common
}
}
$back = str_replace('&nbsp;', '', $this->_getBackLink());
$next = str_replace('&nbsp;', '', $this->_getNextLink());
$pages = $this->_getPageLinks();
$first = $this->_printFirstPage();
$last = $this->_printLastPage();
$all = $this->links;
$linkTags = $this->linkTags;
$back = str_replace('&nbsp;', '', $this->_getBackLink());
$next = str_replace('&nbsp;', '', $this->_getNextLink());
$pages = $this->_getPageLinks();
$first = $this->_printFirstPage();
$last = $this->_printLastPage();
$all = $this->links;
$linkTags = $this->linkTags;
$linkTagsRaw = $this->linkTagsRaw;
if (!is_null($pageID)) {
@ -183,13 +183,13 @@ class Pager_Sliding extends Pager_Common
$last,
$all,
$linkTags,
'back' => $back,
'pages' => $pages,
'next' => $next,
'first' => $first,
'last' => $last,
'all' => $all,
'linktags' => $linkTags,
'back' => $back,
'pages' => $pages,
'next' => $next,
'first' => $first,
'last' => $last,
'all' => $all,
'linktags' => $linkTags,
'linkTagsRaw' => $linkTagsRaw,
);
}

@ -337,6 +337,7 @@ class SortableTable extends HTML_Table
);
}
$query_vars_exclude = array_diff($query_vars, $query_vars_needed);
$params['excludeVars'] = $query_vars_exclude;
$this->pager = &Pager::factory($params);
}
@ -936,7 +937,7 @@ class SortableTable extends HTML_Table
{
$param_string_parts = [];
if (is_array($this->additional_parameters) && count($this->additional_parameters) > 0) {
foreach ($this->additional_parameters as $key => &$value) {
foreach ($this->additional_parameters as $key => $value) {
$param_string_parts[] = urlencode($key).'='.urlencode($value);
}
}
@ -944,7 +945,6 @@ class SortableTable extends HTML_Table
foreach ($this->other_tables as $index => &$tablename) {
$param = [];
if (isset($_GET[$tablename.'_direction'])) {
//$param[$tablename.'_direction'] = $_GET[$tablename.'_direction'];
$my_get_direction = $_GET[$tablename.'_direction'];
if (!in_array($my_get_direction, ['ASC', 'DESC'])) {
$param[$tablename.'_direction'] = 'ASC';

Loading…
Cancel
Save