public static function save_comment($id, $is_spam = NULL, $comment = NULL) { self::init_tags_regex(); if ($comment === NULL) { $comment = get_comment($id); } $content = $comment->comment_content; $post_id = $comment->comment_post_ID; $found = preg_match(self::$tags_regex, $content); if ($found) { CrayonSettingsWP::add_post($post_id); } return $found; }
public static function save_post($id, $post) { CrayonSettingsWP::load_settings(TRUE); if (wp_is_post_revision($id)) { // Ignore revisions return; } self::init_tags_regex(); if (preg_match(self::$tags_regex, $post->post_content)) { CrayonSettingsWP::add_post($id); } else { CrayonSettingsWP::remove_post($id); } }