10 defined(
'JPATH_PLATFORM') or die;
26 protected $methodInPostRequest =
false;
32 protected $suffixMap = array(
39 'OPTIONS' =>
'Options'
53 public function execute($route)
56 $name = $this->parseRoute($route);
59 $name .= $this->fetchControllerSuffix();
62 $controller = $this->fetchController($name);
65 $controller->execute();
78 public function setHttpMethodSuffix($method, $suffix)
80 $this->suffixMap[strtoupper((
string) $method)] = (string) $suffix;
94 public function setMethodInPostRequest($value)
96 $this->methodInPostRequest = $value;
106 public function isMethodInPostRequest()
108 return $this->methodInPostRequest;
119 protected function fetchControllerSuffix()
122 if (!isset($this->suffixMap[$this->input->getMethod()]))
124 throw new RuntimeException(sprintf(
'Unable to support the HTTP method `%s`.', $this->input->getMethod()), 404);
128 if ( $this->methodInPostRequest ==
true && strcmp(strtoupper($this->input->server->getMethod()),
'POST') === 0)
131 $postMethod = $this->input->get->getWord(
'_method');
134 if ($postMethod && isset($this->suffixMap[strtoupper($postMethod)]))
136 return ucfirst($this->suffixMap[strtoupper($postMethod)]);
140 return ucfirst($this->suffixMap[$this->input->getMethod()]);