public static function refresh_post($post, $refresh_legacy = TRUE, $save = TRUE) { $postID = $post->ID; if (wp_is_post_revision($postID)) { // Ignore revisions return; } if (CrayonWP::scan_post($post)) { CrayonSettingsWP::add_post($postID, $save); if ($refresh_legacy) { if (self::scan_legacy_post($post)) { CrayonSettingsWP::add_legacy_post($postID, $save); } else { CrayonSettingsWP::remove_legacy_post($postID, $save); } } } else { CrayonSettingsWP::remove_post($postID, $save); CrayonSettingsWP::remove_legacy_post($postID, $save); } }
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); } }