You are here

function _fillpdf_replacements_to_array in FillPDF 7.2

Same name and namespace in other branches
  1. 6 fillpdf.module \_fillpdf_replacements_to_array()
  2. 7 fillpdf.module \_fillpdf_replacements_to_array()
2 calls to _fillpdf_replacements_to_array()
fillpdf_load in ./fillpdf.module
Whoa, a load function! FillPDF is growing up!
fillpdf_merge_pdf in ./fillpdf.module

File

./fillpdf.module, line 1042
Allows mappings of PDFs to site content

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);
        if (count($split) == 2) {

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