You are here

function dsq_get_post_content in Drupal Most Popular 7

2 calls to dsq_get_post_content()
_dsq_fopen_urlopen in modules/mostpopular_disqus/disqusapi/url.php
_dsq_fsockopen_urlopen in modules/mostpopular_disqus/disqusapi/url.php

File

modules/mostpopular_disqus/disqusapi/url.php, line 25

Code

function dsq_get_post_content($boundary, $postdata, $file_name, $file_field) {
  if (empty($file_name) || empty($file_field)) {
    return dsq_get_query_string($postdata);
  }
  $content = array();
  $content[] = '--' . $boundary;
  foreach ($postdata as $key => $value) {
    $content[] = 'Content-Disposition: form-data; name="' . $key . '"' . "\r\n\r\n" . $value;
    $content[] = '--' . $boundary;
  }
  $content[] = 'Content-Disposition: form-data; name="' . $file_field . '"; filename="' . $file_name . '"';

  // HACK: We only need to handle text/plain files right now.
  $content[] = "Content-Type: text/plain\r\n";
  $content[] = file_get_contents($file_name);
  $content[] = '--' . $boundary . '--';
  $content = implode("\r\n", $content);
  return $content;
}