/**
  * The singleton method.
  *
  * @return Muut_Custom_Post_Types The instance.
  * @author Paul Hughes
  * @since  3.0
  */
 public static function instance()
 {
     if (!is_a(self::$instance, __CLASS__)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * Initializes the Custom Post Types class.
  *
  * @return void
  * @author Paul Hughes
  * @since 3.0.2
  */
 public function initCustomPostTypes()
 {
     $class = 'Muut_Custom_Post_Types';
     if (!in_array($class, $this->alreadyInit)) {
         require_once muut()->getPluginPath() . 'lib/custom-post-types.class.php';
         if (class_exists($class)) {
             Muut_Custom_Post_Types::instance();
         }
         $this->alreadyInit[] = $class;
     }
 }
 /**
  * Process the 'unspam' Muut event.
  *
  * @param $request
  * @param $event
  * @return void
  * @author Paul Hughes
  * @since 3.0.2.1
  */
 public function processUnspam($request, $event)
 {
     $path = $request['path'];
     // The path leads to an individual reply.
     if (self::webhookPathType($path) == 'reply') {
         $comment = self::webhookGetCommentFromPath($path, Muut_Custom_Post_Types::MUUT_SPAM_POST_STATUS);
         if ($comment) {
             Muut_Custom_Post_Types::instance()->markCommentAsNotSpam($comment->comment_ID);
         }
         // The path leads the a top-level thread.
     } else {
         $thread_post = self::webhookGetPostFromPath($path, Muut_Custom_Post_Types::MUUT_SPAM_POST_STATUS);
         if ($thread_post) {
             Muut_Custom_Post_Types::instance()->markPostAsNotSpam($thread_post->ID);
         }
     }
 }