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

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

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

Loading…
Cancel
Save