You are here

function _fillpdf_replacements_to_array in FillPDF 7

Same name and namespace in other branches
  1. 6 fillpdf.module \_fillpdf_replacements_to_array()
  2. 7.2 fillpdf.module \_fillpdf_replacements_to_array()
2 calls to _fillpdf_replacements_to_array()
fillpdf_load in ./fillpdf.module
Loads a FillPDF template by ID.
fillpdf_merge_pdf in ./fillpdf.module
Constructs a page and sends it to the browser or saves it.

File

./fillpdf.module, line 1975

Code

function _fillpdf_replacements_to_array($replacements) {
  if (empty($replacements) !== TRUE) {
    $standardized_replacements = str_replace(array(
      "\r\n",
      "\r",
    ), "\n", $replacements);
    $lines = explode("\n", $standardized_replacements);
    $return = array();
    foreach ($lines as $replacement) {
      if (!empty($replacement)) {
        $split = explode('|', $replacement);

        // Sometimes it isn't; don't know why.
        if (count($split) == 2) {
          $return[$split[0]] = preg_replace('|<br />|', '
', $split[1]);
        }
      }
    }
    return $return;
  }
  else {
    return array();
  }
}