コード例 #1
0
 public static function capture_replace_pre($capture, $original, $id, $is_inline, $wp_content, $args = array())
 {
     $code = $capture['code'];
     $oldAtts = $capture['atts'];
     $newAtts = array();
     $encode = isset($args['encode']) ? $args['encode'] : FALSE;
     if (!isset($oldAtts[CrayonSettings::DECODE]) && $encode) {
         // Encode the content, since no decode information exists.
         $code = CrayonUtil::htmlentities($code);
     }
     // We always set decode=1 irrespectively - so at this point the code is assumed to be encoded
     $oldAtts[CrayonSettings::DECODE] = TRUE;
     $newAtts['class'] = CrayonUtil::html_attributes($oldAtts, CrayonGlobalSettings::val_str(CrayonSettings::ATTR_SEP), '');
     return str_replace($original, CrayonUtil::html_element('pre', $code, $newAtts), $wp_content);
 }