You are here

function wrap_and_pdf_escape in Recipe 6

2 calls to wrap_and_pdf_escape()
get_new_pdf_page in plugins/recipe_pdf35.module
get_pdf_pages in plugins/recipe_pdf35.module

File

plugins/recipe_pdf35.module, line 514
recipe_pdf35.module - Enables exporting of 3x5" cards in pdf format. This is incredibly rudimentary at this point. 1 and only 1 card and if you go over, the text is lost.

Code

function wrap_and_pdf_escape($item_str, $wrap_cols, $wrap_indent = NULL) {
  if (isset($wrap_indent)) {
    $item_str = wordwrap($item_str, $wrap_cols, $wrap_indent);
  }
  else {
    $item_str = wordwrap($item_str, $wrap_cols);
  }
  $item_str = str_replace(array(
    "\\",
    "(",
    ")",
  ), array(
    "\\\\",
    "\\(",
    "\\)",
  ), $item_str);
  $item_list = preg_split('/\\n/', $item_str);
  for ($i = 0; $i < count($item_list); $i++) {
    $item_list[$i] = str_replace("\r", " ", $item_list[$i]);
    $item_list[$i] = "({$item_list[$i]})'\n";
  }
  return $item_list;
}