extension/ezjscore/classes/ezjscajaxcontent.php
public static function getHttpAccept( $default = 'xhtml', $aliasList = array( 'html' => 'xhtml',
                                                                                  'json' => 'json',
                                                                                  'javascript' => 'json',
                                                                                  'xml' => 'xml',
                                                                                  'text' => 'text' ) )
    {
        $acceptList = array();

        if ( isset($_POST['http_accept']) )
            $acceptList = explode( ',', $_POST['http_accept'] );
        else if ( isset($_POST['HTTP_ACCEPT']) )
            $acceptList = explode( ',', $_POST['HTTP_ACCEPT'] );
        else if ( isset($_GET['http_accept']) )
            $acceptList = explode( ',', $_GET['http_accept'] );
        else if ( isset($_GET['HTTP_ACCEPT']) )
            $acceptList = explode( ',', $_GET['HTTP_ACCEPT'] );
        else if ( isset($_SERVER['HTTP_ACCEPT']) )
            $acceptList = explode( ',', $_SERVER['HTTP_ACCEPT'] );

        foreach( $acceptList as $accept )
        {
            foreach( $aliasList as $alias => $returnType )
            {
                if ( strpos( $accept, $alias ) !== false )
                {
                    $default = $returnType;
                    break 2;
                }
            }
        }
        return $default;
    }
public static function getHttpAccept( $default = 'xhtml', $aliasList = array( 'html' => 'xhtml',
                                                                                  'json' => 'json',
                                                                                  'javascript' => 'json',
                                                                                  'xml' => 'xml',
                                                                                  'text' => 'text' ) )
    {
        $acceptList = array();

        if ( isset($_POST['http_accept']) )
            $acceptList = explode( ',', $_POST['http_accept'] );
        else if ( isset($_POST['HTTP_ACCEPT']) )
            $acceptList = explode( ',', $_POST['HTTP_ACCEPT'] );
        else if ( isset($_GET['http_accept']) )
            $acceptList = explode( ',', $_GET['http_accept'] );
        else if ( isset($_GET['HTTP_ACCEPT']) )
            $acceptList = explode( ',', $_GET['HTTP_ACCEPT'] );
        else if ( isset($_SERVER['HTTP_ACCEPT']) )
            $acceptList = explode( ',', $_SERVER['HTTP_ACCEPT'] );

        foreach( $acceptList as $accept )
        {
            foreach( $aliasList as $alias => $returnType )
            {
                if ( strpos( $accept, $alias ) !== false )
                {
                    $default = $returnType;
                    break 2;
                }
            }
        }
        return $default;
    }
public static function getHttpAccept ( $ default = 'xhtml' , $ aliasList = array ( 'html' => 'xhtml' , 'json' => 'json' , 'javascript' => 'json' , 'xml' => 'xml' , 'text' => 'text' ) ) { $ acceptList = array ( ) ; if ( isset ( $ _POST [ 'http_accept' ] ) ) $ acceptList = explode ( ',' , $ _POST [ 'http_accept' ] ) ; else if ( isset ( $ _POST [ 'HTTP_ACCEPT' ] ) ) $ acceptList = explode ( ',' , $ _POST [ 'HTTP_ACCEPT' ] ) ; else if ( isset ( $ _GET [ 'http_accept' ] ) ) $ acceptList = explode ( ',' , $ _GET [ 'http_accept' ] ) ; else if ( isset ( $ _GET [ 'HTTP_ACCEPT' ] ) ) $ acceptList = explode ( ',' , $ _GET [ 'HTTP_ACCEPT' ] ) ; else if ( isset ( $ _SERVER [ 'HTTP_ACCEPT' ] ) ) $ acceptList = explode ( ',' , $ _SERVER [ 'HTTP_ACCEPT' ] ) ; foreach ( $ acceptList as $ accept ) { foreach ( $ aliasList as $ alias => $ returnType ) { if ( strpos ( $ accept , $ alias ) !== false ) { $ default = $ returnType ; break 2 ; } } } return $ default ; }
Gets the first most prefered response type as defined by http_accept
uses post and get parameter if present, if not falls back to the one
defined in http header. First parameter lets you define fallback value
if none of the alternatives in second parameter is found. Second parameter
lets you limit the allowes types with a alias hash. xhtml, json, xml and
text are default allowed types.

@param string $default
@param array $aliasList
@return string
Gets the first most prefered response type as defined by http_accept uses post and get parameter if present if not falls back to the one defined in http header . First parameter lets you define fallback value if none of the alternatives in second parameter is found . Second parameter lets you limit the allowes types with a alias hash . xhtml json xml and text are default allowed types .