Parse postfield data when content-dispositioning is happening, else return
normal postfield vars.
If the content-type is application/json the content is parsed as json array body

@return array
182326
public function getPostFromInput()
    {
        $ct = $_SERVER['CONTENT_TYPE'];
        $position = stripos($ct, "boundary=");
        $jsonCheck = "application/json";

        $input = file_get_contents("php://input");

        $this->rawData = $input;

        $postVars = array();
        if ($position !== false) {

            $exp = explode("boundary=", $ct);
            if (isset($exp[1])) {
                $boundary = trim($exp[1]);

                $variables = explode("--" . $boundary, $input);

                foreach ($variables as $var) {
                    $var = urldecode($var);
                    if (trim($var) != "" && trim($var) != "--") {
                        preg_match('/Content-Disposition:[ _]*form-data;[ _]*name="([^\"]*)"(.*)/si', $var, $result);
                        $postVars[trim($result[1])] = trim($result[2]);
                    }
                }
            }
        } else if (substr($ct, 0, strlen($jsonCheck)) === $jsonCheck) {
            $postVars = json_decode($input, true);
        } else {
            parse_str($input, $postVars);
        }

        if (count($_POST) > 0 && count($postVars) === 0) {
            $postVars = $_POST;
        }

        return $postVars;
    }
711459
protected function parseDataFromResponse()
    {
        $content = $this->rawResponse->body;
        $config = new LoggingConfig();
        $config->parseFromXml($content);
        return $config;
    }
157012
protected function parseDataFromResponse()
    {
        $content = $this->rawResponse->body;
        $config = new WebsiteConfig();
        $config->parseFromXml($content);
        return $config;
    }
122741
private function formatBody()
    {
        $body = [];

        if (!empty($this->files)) {
            $data = [];

            if(!is_null($this->serialized_payload)) {
                collect($this->serialized_payload)->each(function($value, $key) use (&$data) {
                    $data[] = [
                        'name'     => $key,
                        'contents' => $value,
                    ];
                });
            }

            $body['multipart'] = array_merge($this->files, $data);

            return $body;
        }

        if ($this->content_type == Mime::JSON) {
            $body['json'] = $this->serialized_payload;
        } elseif ($this->method == Http::GET) {
            $body['query'] = $this->serialized_payload;
        } elseif (is_array($this->serialized_payload)) {
            $body['form_params'] = $this->serialized_payload;
        } else {
            $body['body'] = $this->serialized_payload;
        }

        return $body;
    }
559479
public function getResponseData()
    {
        $data = null;

        if ($body = $this->getResponseBody()) {
            if (($decoded = json_decode($body, true))) {
                $data = $decoded;
            }
        }

        return $data;
    }
1344417
protected function pullPost() {
		if (!is_array($this->postVars)) {
			$this->postVars = $this->request->getParsedBody();
			
			if (!is_array($this->postVars)) {
				$this->postVars = [];
			}
		}
		
		return $this->postVars;
	}
879774
private function parseInput()
    {
        $result = null;
        try {
            $rawBody = file_get_contents('php://input');
            if (strpos($rawBody, '&form_key=')) {
                $parts = explode('&form_key=', $rawBody);
                $rawBody = reset($parts);
            }
            $obj = json_decode($rawBody, true);
            if ($obj) {
                $type = $this->getInDataType();
                $asArray = (array)$obj;
                $result = $this->inputProcessor->convertValue($asArray, $type);
            }
        } catch (\Throwable $t) {
            $this->logger->error("Cannot parse input data: " . $t->getMessage());
        }
        return $result;
    }
1349953
protected static function getPostData()
    {
        $post_data = '-';
        if(!empty($_POST))
        {
            /*
             * Clean posted data to hide passwords
            */
            $password_subtexts = ['password', 'pwd'];

            $post = $_POST;

            foreach($post as $field => $value)
            {
                if(is_string($value))
                {
                    foreach($password_subtexts as $password_subtext){
                        if(stripos($field, $password_subtext) !== false){
                            $post[$field] = '*****';
                        }
                    }
                }
                elseif(is_array($value))
                {
                    foreach($value as $f => $v)
                    {
                        if(is_string($v))
                        {
                            foreach($password_subtexts as $password_subtext){
                                if(stripos($f, $password_subtext) !== false){
                                    $post[$field][$f] = '*****';
                                }
                            }
                        }
                    }
                }
            }

            $post_data = json_encode($post);

            return $post_data;
        }
    }
127915
protected function parseFieldOptionsJson()
    {
        foreach ($this->data->rawData['fields'] as $fieldId => &$fieldData) {

            $optionsJson = trim( $fieldData['options'] );

            if (empty($optionsJson)) continue;

            $fieldData['options'] = json_decode($optionsJson, true);
        }

        unset($fieldData);
    }
1330393
public static function getBody()
    {
        $contentType = static::getHeader('Content-Type');
        $body = file_get_contents('php://input');

        if (mb_strpos($contentType,'application/x-www-form-urlencoded') === 0) {
            parse_str($body, $data);
            return $data;
        } else if (mb_strpos($contentType, 'application/json') === 0) {
            return json_decode($body, true);
        } else {
            return $body;
        }
    }
1307735
public function getJson()
    {
        $body = $this->getBody();
        $json = json_decode($body, true);

        if (!is_array($json)) {
            if ($this->_wasAsync) {
                return [];
            }

            // should be an array, fail otherwise
            throw new ClientException('Got a malformed result from the server');
        }

        return $json;
    }
996485
public function getJson()
    {
        $json = array(
            'urlKeyParam' => $this->getUrlKeyParam(),
            'inputFieldName' => $this->getTokenInputName(),
            'observedCssRules' => $this->getObservedCssRules(),
            'requestUrl' => $this->getTokenUrl(),
            'cookieName' => $this->getCookieName()
        );

        return json_encode($json);
    }
216642
protected function getPostedData()
    {
        $resourcePostedDataMode = $this->getResource()->getPostedDataMethod();
        $endpointPostedDataMode = $this->getEndpoint()->getPostedDataMethod();

        $postedDataMode = $resourcePostedDataMode;
        if ($endpointPostedDataMode != PostedDataMethods::AUTO) {
            $postedDataMode = $endpointPostedDataMode;
        }

        $postedData = null;

        switch ($postedDataMode) {

            case PostedDataMethods::POST:
                $postedData = $this->request->getPost();
                break;

            case PostedDataMethods::JSON_BODY:
                $postedData = $this->request->getJsonRawBody(true);
                break;

            case PostedDataMethods::AUTO:
            default:
                $postedData = $this->request->getPostedData($this->getEndpoint()->getHttpMethod());
        }

        return $postedData;
    }
1219121
public function getTranslatableFields($postType)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess($postType, 'read')) {
            return $this->noPermission();
        }

        // fields of this post type
        $translatableFields = [];
        $fields = PostType::getFields($postType);
        foreach ($fields as $field) {
            $slug = $field->slug;
            if ($field->translatable) {
                array_push($translatableFields, $slug);
            }
        }

        return $translatableFields;
    }
294290
private function _postfields($data)
    {
        if (is_array($data)) {
            if ($this->is_array_multidim($data)) {
                $data = $this->http_build_multi_query($data);
            } else {
                // Fix "Notice: Array to string conversion" when $value in
                // curl_setopt($ch, CURLOPT_POSTFIELDS, $value) is an array
                // that contains an empty array.
                foreach ($data as $key => $value) {
                    if (is_array($value) && empty($value)) {
                        $data[$key] = '';
                    }
                }
            }
        }

        return $data;
    }
190620
public function parse()
    {
        if ($this->body === false) {
            return null;
        }

        $result = [];
        $key = null;
        foreach ($this->body as $value) {
            if (!is_null($key)) {
                $result[$key] = $value;
                $key = null;
            } else {
                $key = $value;
            }
        }

        return $result;
    }
891860
public function getPostTypeFieldsValues(string $postType, $post = null)
    {
        $fields = PostType::getFields($postType);
        $languages = Language::all();
        $values = [];

        foreach ($fields as $field){
            /**
             * prepare values for each field
             * used when this function is called in detailsJson (update form of the post)
             */
            if (isset($post) && $post) {
                $slug = $field->slug;
                if(!$field->translatable) {
                    if(array_key_exists($slug, $post->getAttributes())) {
                        if($field->type->inputType == "checkbox") { // if input type is checkbox the value should be array
                            $value = ($post->$slug) ? explode(",", $post->$slug) : [];
                            $field->value = $value;
                        }else if ($field->type->inputType == "date") { // if input type is date remove the php time form the string
                            $field->value = explode(" ", $post->$slug)[0];
                        }else{
                            $field->value = $post->$slug;
                        }
                    }
                }else{
                    if(gettype($post->$slug) != "array" && json_decode($post->$slug) == null) {
                        $value = [];
                    }else{
                        $value = (array) json_decode($post->$slug);
                    }
                    // if there is a new language this code puts the new language key in the details
                    foreach($languages as $lang){
                        if(!key_exists($lang->slug, $value)) {
                            if($field->type->inputType == "checkbox") {
                                $value[$lang->slug] = [];
                            }else{
                                $value[$lang->slug] = [];
                            }
                        }
                    }
                    $field->value = $value;
                }
            }


            /**
             * get data from database if custom field is "Dropdown from DB"
             */
            if($field->type->inputType == "db") {

                /**
                 * construct categories field (@If categories 0 it means it's value is all @else construct a array with categories slug)
                 * categories when field is dropdown from db (used to take posts of only a category)
                 */
                if(count($field->categories)) {
                    $categoriesTmp = [];
                    foreach ($field->categories as $category){
                        if($category->slug === 0) {
                            $field->categories = 0;
                            break;
                        }
                        $categoriesTmp[] = $category->slug;
                    }
                    $field->categories = $categoriesTmp;
                }else{
                    $field->categories = 0;
                }

                if($field->dbTable) {
                    $table = $field->dbTable->name;
                    $field->data = Language::filterRows(DB::table($table)->get(), false);
                    // if user add fullName as key
                    if($table == "users") {
                        $tmp = [];
                        foreach ($field->data as $userItem){
                            $userItem['fullName'] = $userItem['firstName']. " ". $userItem['lastName'];
                            $tmp[] = $userItem;
                        }
                        $field->data = $tmp;
                    }
                }
            }
            array_push($values, $field);
        }

        return $values;
    }