Example #1
0
 /** Function to add acronyms/abbreviations
  * 
  * @param $string text to add abbreviations to
  * @return $string Text with abbreviations inserted into html
  */
 public function Acronyms($string)
 {
     //Retrieve acronyms array from the database
     $acros = new Acronyms();
     $acronyms = $acros->getValid();
     $text = " {$string} ";
     foreach ($acronyms as $acronym => $fulltext) {
         $text = preg_replace("|(?!<[^<>]*?)(?<![?.&])\\b{$acronym}\\b(?!:)(?![^<>]*?>)|msU", "<abbr title=\"{$fulltext}\">{$acronym}</abbr>", $text);
     }
     $text = trim($text);
     return $text;
 }
Example #2
0
 /** Get the acronyms
  * @access public
  * @return array Array of acronyms
  */
 public function getAcronyms()
 {
     $acronyms = new Acronyms();
     return $acronyms->getValid();
 }