public static function highlight($code, $add_tags = FALSE, $output_text = FALSE) { $captures = CrayonWP::capture_crayons(0, $code); $the_captures = $captures['capture']; if (count($the_captures) == 0 && $add_tags) { // Nothing captured, so wrap in a pre and try again $code = '<pre>' . $code . '</pre>'; $captures = CrayonWP::capture_crayons(0, $code); $the_captures = $captures['capture']; } $the_content = $captures['content']; $the_content = CrayonUtil::strip_tags_blacklist($the_content, array('script')); $the_content = CrayonUtil::strip_event_attributes($the_content); foreach ($the_captures as $id => $capture) { $atts = $capture['atts']; $no_enqueue = array(CrayonSettings::ENQUEUE_THEMES => FALSE, CrayonSettings::ENQUEUE_FONTS => FALSE); $atts = array_merge($atts, $no_enqueue); $code = $capture['code']; $crayon = CrayonWP::shortcode($atts, $code, $id); $crayon_formatted = $crayon->output(TRUE, FALSE); $the_content = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $the_content, 1, $count); } if ($output_text) { header('Content-Type: text/plain'); } else { header('Content-Type: text/html'); } return $the_content; }