コード例 #1
0
 public function filter($text)
 {
     if (Options::get('typogrify__do_amp')) {
         $text = amp($text);
     }
     if (Options::get('typogrify__do_widont')) {
         $text = widont($text);
     }
     if (Options::get('typogrify__do_smartypants')) {
         // Standard options plus convert_quot ('w') to
         // convert " entities, that Habari might
         // already have converted '"' characters into.
         $text = SmartyPants($text, "qbdew");
     }
     if (Options::get('typogrify__do_caps')) {
         $text = caps($text);
     }
     if (Options::get('typogrify__do_initial_quotes')) {
         $text = initial_quotes($text);
     }
     if (Options::get('typogrify__do_guillemets')) {
         $text = initial_quotes($text, true);
     }
     if (Options::get('typogrify__do_dash')) {
         $text = dash($text);
     }
     return $text;
 }
コード例 #2
0
 public function initialQuotesFilter($str)
 {
     $charset = craft()->templates->getTwig()->getCharset();
     $str = initial_quotes($str);
     return new \Twig_Markup($str, $charset);
 }
コード例 #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.
 */
function typogrify($text, $do_guillemets = false)
{
    $text = amp($text);
    $text = widont($text);
    $text = SmartyPants($text);
    $text = caps($text);
    $text = initial_quotes($text, $do_guillemets);
    $text = dash($text);
    return $text;
}