function render_sort_link($text, $sort_to_request) { if ($this->_suppress_sort_links) { return $text; } if (!$this->validate_sort_link($sort_to_request)) { return $text; } $url_values = $_GET; $url_values['sort'] = $sort_to_request; unset($url_values['sort_direction']); if (isset($this->_sort) && $this->_sort == $sort_to_request && !(isset($this->_sort_direction) && $this->_sort_direction == AMP_SORT_DESC)) { $url_values['sort_direction'] = AMP_SORT_DESC; } return $this->_renderer->link(AMP_url_add_vars($_SERVER['PHP_SELF'], AMP_url_build_query($url_values)), $text); }
function AMP_url_update_without_pretty_urls($url, $attr = array()) { if (empty($attr) || !$attr) { return $url; } $url_segments = split('\\?', $url); $base_url = $url_segments[0]; $updated_values = AMP_url_build_query($attr); if (!isset($url_segments[1])) { return $url . '?' . join('&', $updated_values); } parse_str($url_segments['1'], $start_values); $url_start_values = AMP_url_build_query($start_values); $final_values = array_merge($url_start_values, $updated_values); return $base_url . '?' . join('&', $final_values); }