Build Facebook post request body.

@return array
519683
public function getPostBody()
    {
        $body = [
            'message' => $this->getContent(),
        ];

        if ($this->link != null) {
            $body['link'] = $this->link->getUrl();
        }

        if ($this->image != null) {
            $body['media'] = $this->image;
        }

        if ($this->video != null) {
            $body['media'] = $this->video;
        }

        if ($this->params != null) {
            $body = array_merge($body, $this->params);
        }

        return $body;
    }
186257
public function getBodyData()
    {
        if(is_null($this->body_data)) 
        {
            $data = json_decode(file_get_contents("php://input"), true);
            if(!$data)
            {
                $data = array();
            }
            
            $this->body_data = $data;
        }
        
        return $this->body_data;
    }
1027778
protected function buildBasePageIndexerRequest()
    {
        $request = $this->getPageIndexerRequest();
        $request->setParameter('loggingEnabled', $this->loggingEnabled);

        if (!empty($this->options['authorization.'])) {
            $request->setAuthorizationCredentials(
                $this->options['authorization.']['username'],
                $this->options['authorization.']['password']
            );
        }

        if (!empty($this->options['frontendDataHelper.']['headers.'])) {
            foreach ($this->options['frontendDataHelper.']['headers.'] as $headerValue) {
                $request->addHeader($headerValue);
            }
        }

        if (!empty($this->options['frontendDataHelper.']['requestTimeout'])) {
            $request->setTimeout((float)$this->options['frontendDataHelper.']['requestTimeout']);
        }

        return $request;
    }
704109
private function parseRequestBody()
	{
		$content_type = $this->getRequestHeader()->getContentType();
		if (strpos($content_type, 'application/json') !== false) {
			$this->requestBody = new JsonBody();
		} elseif (strpos($content_type, 'application/x-www-form-urlencoded') !== false) {
			$this->requestBody = new FormBody();
		} elseif (strpos($content_type, 'text/plain') !== false) {
			$this->requestBody = new PlainBody();
		} elseif (strpos($content_type, 'multipart/form-data') !== false) {
			$this->requestBody = new MultipartBody();
		} else {
			$this->requestBody = new HttpBody();
		}
	}
607101
public function body()
	{
		$msg = $this->getMessage();
		
		if (422 == $this->getCode() && !empty($msg)) {
			$this->extra['errors'] = json_decode($msg, true);
			$msg = null;
		}
		
		if (empty($msg)) {
			switch ($this->getCode()) {
				case 404:
					$msg = 'Not Found';
					break;
				case 405:
					$msg = 'Method Not Allowed';
					break;
				case 400:
					$msg = 'Bad Request';
					break;
				case 401:
					$msg = 'Unauthorized';
					break;
				case 402:
					$msg = 'Payment Required';
					break;
				case 403:
					$msg = 'Forbidden';
					break;
				case 422:
					$msg = 'Unprocessable Entity';
					break;
				case 410:
					$msg = 'Resource Deleted';
					break;
				case 500:
					$msg = 'Server Error';
					break;
				default:
					$msg = 'Error';
			}
		}
		
		$output = array(
			'status'  => $this->getCode(),
			'message' => $msg,
		);
		
		if (!empty($this->getExtra())) {
			$output = array_merge($output, $this->getExtra());
		}
		
		return $output;
	}
518517
public function getAllPostGet()
    {
        if (isset($this->request->post, $this->request->get)) {
            return array_merge($this->request->get, $this->request->post);
        }
        return $this->request->post ?? $this->request->get ?? [];
    }
780804
public function getRequestBody() {
    if (!$this->evaluated) {
      $this->evaluateWebPage();
    }

    if ($this->webPage instanceof JsonPage) {
      $serializer = $this->router->getJsonSerializer();
      return $serializer->serialize($this->rawRequestBody);
    } else {
      return $this->rawRequestBody;
    }
  }
515627
function createHttpRequest()
    {
        $headers = [
            'User-Agent' => $this->getContext()->getUserAgent(),
            'Content-Type' => 'application/x-www-form-urlencoded'
        ];

        $body = $this->buildQuery($this->getRequestParameters());

        return $this->getContext()->getMessageFactory()->createRequest(
            'POST',
            $this->getEndpoint(),
            $headers,
            $body
        );

        $httpRequest = new Request(
            'POST',
            $this->getEndpoint(),
            $headers,
            $body
        );

        return $httpRequest;
    }
152974
public function to_postdata() {/*{{{*/
    $total = array();
    foreach ($this->parameters as $k => $v) {
      if (is_array($v)) {
        foreach ($v as $va) {
          $total[] = OAuthUtil::urlencode_rfc3986($k) . "[]=" . OAuthUtil::urlencode_rfc3986($va);
        }
      } else {
        $total[] = OAuthUtil::urlencode_rfc3986($k) . "=" . OAuthUtil::urlencode_rfc3986($v);
      }
    }
    $out = implode("&", $total);
    return $out;
  }
407870
public function _requestPayload()
    {
        $payload = [
            'authorization_code'    => $this->authorization,
            'amount'                => $this->amount,
            'reference'             => $this->transactionRef,
            'email'                 => $this->email,
        ];

        if (!empty($this->plan)) {
            $payload['plan'] = $this->plan;
        }

        return $this->toJson($payload);
    }
285150
public function build_post_data($params) {
        $result = [];
        foreach ($params as $name => $value) {
            $result[] = urlencode($name) . '=' . urlencode($value);
        }
        return implode('&', $result);
    }
153154
private function postData()
    {
        if (empty($this->post)) {
            return;
        }

        $post = array_filter($this->post);

        return http_build_query($post);
    }
579862
protected function build()
    {
        $content = '';
        if (isset($this->parameters) && is_array($this->parameters)) {
            $content = http_build_query($this->parameters);
        }
        if (isset($this->body)) {
            $content = $this->body;
        }

        $content_type = 'application/x-www-form-urlencoded; charset=utf-8';
        if (substr($content, 0, 6) == '<?xml ') {
            $content_type = 'text/xml; charset=utf-8';
        }

        $this->request = array(
            'http' => array(
                'header' => 'Content-type: ' . $content_type,
                'method' => 'POST',
                'timeout' => 5,
                'max_redirects' => 0,
                'ignore_errors' => 1,
                'content' => $content,
            )
        );

        return $this;
    }
953763
public function build()
    {
        $params = [
            'alert' => $this->alert,
            'title' => $this->title,
            'message_variation_id' => $this->messageVariationId,
            'priority' => $this->priority,
            'collapse_key' => $this->collapseKey,
            'sound' => $this->sound,
            'custom_uri' => $this->uri,
            'summary_text' => $this->summaryText,
            'time_to_live' => $this->timeToLive,
            'notification_id' => $this->notificationId,
            'push_icon_image_url' => $this->pushIconImageUrl,
            'accent_color' => $this->accentColour,
        ];

        if (!empty($this->extra)) {
            $params['extra'] = $this->extra;
        }

        return array_filter($params, function ($param) {
            return $param !== null;
        });
    }
1165113
public function getBody() {
		if ($this->body && isset($this->headers[self::HEADER_KEY_CONTENT_TYPE]) && $this->headers[self::HEADER_KEY_CONTENT_TYPE] == 'application/x-www-form-urlencoded') {
			return http_build_query($this->body);
		} elseif ((is_object($this->body) || is_array($this->body)) &&
			(!isset($this->headers[self::HEADER_KEY_CONTENT_TYPE]) || $this->headers[self::HEADER_KEY_CONTENT_TYPE] != 'multipart/form-data')) {
			return json_encode($this->serializer->sanitizeForSerialization($this->body));
		} else {
	      return $this->body;
	    }
	}
239817
public function getFacebookPosts($postData=NULL)
	{
		if ($this->facebookUserId == NULL)
			return false;

		$result = Yii::app()->cache->get($this->theme . '_settings_facebook_data');

		if ($result == false)
		{
			$config = array(
		    	'appId' => Cii::getConfig('ha_facebook_id', NULL, NULL),
		      	'secret' => Cii::getConfig('ha_facebook_secret', NULL, NULL),
		      	'fileUpload' => false,
		      	'allowSignedRequest' => false,
		  	);

		  	$facebook = new Facebook($config);

		  	$user_id = Cii::getConfig('ha_facebook_user_id', NULL, NULL);

		  	try {
			  	$result = $facebook->api('/'.$user_id.'/feed/');
			  	Yii::app()->cache->set($this->theme.'_settings_facebook_data', $result, 900);
			  	return $result;
			} catch(FacebookApiException $e) {
				return $e->getMessage();
	      	}
      	}
      	else
      		return $result;
	}
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;
    }