PHP GetUserstateFromRequest
public function getUserStateFromRequest($key, $request, $default = null, $type = 'none', $resetPage = true) { $app = \JFactory::getApplication(); $input = $app->input; $old_state = $app->getUserState($key); $cur_state = $old_state !== null ? $old_state : $default; $new_state = $input->get($request, null, $type);// BC for Search Tools which uses different naming if ($new_state === null && strpos($request, 'filter_') === 0) { $name = substr($request, 7); $filters = $app->input->get('filter', array(), 'array');if (isset($filters[$name])) { $new_state = $filters[$name]; } }if ($cur_state != $new_state && $new_state !== null && $resetPage) { $input->set('limitstart', 0); }// Save the new value only if it is set in this request. if ($new_state !== null) { $app->setUserState($key, $new_state); } else { $new_state = $cur_state; }return $new_state; }
Ashamed Anteater