return [array_values($title),$nav];
}
- public function method_post_accept_decode() {
+ public function method_post_accept_decode($type=null) {
if ( empty($_SERVER['REQUEST_METHOD']) or $_SERVER['REQUEST_METHOD'] != 'POST' ) return;
+ if (empty($type)) $type = self::client_content_type();
$raw = null;
foreach (['json','yaml'] as $type) {
- if (!strpos(self::client_content_type(),'/'.$type)) continue;
+ if (!strpos($type,'/'.$type)) continue;
if ($raw) $_POST = [ $type => $raw ];
if (empty($_POST[$type])) continue;
#bye($_POST);
}
private function uri_init() {
- $this->method_post_accept_decode();
#
# Parse path, respect params order
if ($this->params['format']) {
$format = $this->params['format'];
- } else if ($content_type = self::client_content_type() and ( $format=Mime::toExt($content_type) )) {
- #$format = $format;
+ } else if ($content_type = self::client_content_type() and ( $format = Mime::toExt($content_type) )) {
+ # Not empty !
} else {
$format =
// Affect values to objects
if ($format == 'html') $format = $this->format_html;
$this->format($format);
+ $this->method_post_accept_decode();
$this->is_html = strpos($content_type,'html') ? true : false;
$this->db->is_html = $this->is_html;