public static function comment_text($text) { global $comment; $comment_id = strval($comment->comment_ID); // Find if this post has Crayons if (array_key_exists($comment_id, self::$comment_queue)) { // XXX We want the plain post content, no formatting $the_content_original = $text; // Loop through Crayons $post_in_queue = self::$comment_queue[$comment_id]; foreach ($post_in_queue as $id => $v) { $atts = $v['atts']; $content = $v['code']; // The code we replace post content with $crayon = self::shortcode($atts, $content, $id); $crayon_formatted = $crayon->output(TRUE, FALSE); // Replacing may cause <p> tags to become disjoint with a <div> inside them, close and reopen them if needed if (!$crayon->is_inline()) { $text = preg_replace_callback('#' . self::REGEX_BETWEEN_PARAGRAPH_SIMPLE . '#msi', 'CrayonWP::add_paragraphs', $text); } // Replace the code with the Crayon $text = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $text, 1, $text); } } return $text; }