Example #1
0
/**
 * Wrapping ampersands.
 *
 * @param string $text
 *   text to work on.
 */
function SmartAmpersand($text)
{
    $tokens;
    $tokens = _TokenizeHTML($text);
    $result = '';
    // Keep track of when we're inside <pre> or <code> tags.
    $in_pre = 0;
    foreach ($tokens as $cur_token) {
        if ($cur_token[0] == "tag") {
            // Don't mess with quotes inside tags.
            $result .= $cur_token[1];
            if (preg_match(SMARTYPANTS_TAGS_TO_SKIP, $cur_token[1], $matches)) {
                $in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
            }
        } else {
            $t = $cur_token[1];
            if (!$in_pre) {
                $t = Typogrify::amp($t);
            }
            $result .= $t;
        }
    }
    return $result;
}
 public function filter_post_title_atom($title)
 {
     if (Options::get('typogrify__title_case')) {
         $title = Typogrify::title_case($title);
     }
     // for now, just bypass the rest of the filters - they cause problems ATM
     // return $title;
     return $this->filter($title);
 }
Example #3
0
 /**
  * typogrify
  * 
  * The super typography filter.   
  * Applies the following filters: widont, smartypants, caps, amp, initial_quotes
  * Optionally choose to apply quote span tags to Gullemets as well.
  */
 public static function filter($text, $do_guillemets=FALSE) {
   $text = Typogrify::amp($text);
   $text = Typogrify::widont($text);
   $text = SmartyPants($text);
   $text = Typogrify::caps($text);
   $text = Typogrify::initial_quotes($text, $do_guillemets);
   $text = Typogrify::dash($text);
   return $text;
 }