/** * Prepare project for display * * @param boolean $make_clickable * @return string */ function getFormattedOverview($make_clickable = true) { $overview = $this->getOverview(); if ($overview) { if ($make_clickable) { require_once SMARTY_PATH . '/plugins/modifier.clickable.php'; $overview = smarty_modifier_clickable($overview); } // if return nl2br_pre($overview); } // if return $overview; }
/** * Convert line feeds to <br /> tags * @param string * @return string */ public function convertLineFeeds($strComment) { global $objPage; $strComment = nl2br_pre($strComment, $objPage->outputFormat == 'xhtml'); // Use paragraphs to generate new lines if (strncmp('<p>', $strComment, 3) !== 0) { $strComment = '<p>' . $strComment . '</p>'; } $arrReplace = array('@<br>\\s?<br>\\s?@' => "</p>\n<p>", '@\\s?<br></p>@' => '</p>', '@<p><div@' => '<div', '@</div></p>@' => '</div>'); return preg_replace(array_keys($arrReplace), array_values($arrReplace), $strComment); }
/** * Convert line feeds to <br /> tags * @param string * @return string */ public function convertLineFeeds($strComment) { global $objPage; $strComment = nl2br_pre($strComment, ($objPage->outputFormat == 'xhtml')); // Use paragraphs to generate new lines if (strncmp('<p>', $strComment, 3) !== 0) { $strComment = '<p>'. $strComment .'</p>'; } $arrReplace = array ( '@<br>\s?<br>\s?@' => "</p>\n<p>", // Convert two linebreaks into a new paragraph '@\s?<br></p>@' => '</p>', // Remove BR tags before closing P tags '@<p><div@' => '<div', // Do not nest DIVs inside paragraphs '@</div></p>@' => '</div>' // Do not nest DIVs inside paragraphs ); return preg_replace(array_keys($arrReplace), array_values($arrReplace), $strComment); }