Ejemplo n.º 1
0
 public function handlePost($postId, $post)
 {
     if (!$this->driverEnabled() || magnify_filter('disable_persist', false, $this->driver, $post) || !$this->isPersistablePostType($post) || $this->isAutosave() || $this->isAutoDraft($post)) {
         return;
     }
     if ($this->isPersistableStatus($post)) {
         $blogId = $this->getCurrentBlog();
         try {
             $this->driver->persist($blogId, $this->normalizer->normalize($blogId, $post));
             magnify_act('persisted_post', $blogId, $post);
         } catch (\Exception $e) {
             $this->logException($e, sprintf('persisting post #%d', $post->ID));
         }
     } else {
         // catches all non-published posts. Like trashed
         // or posts taht moved from published back to draft
         $this->handleDelete($post->ID);
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function normalize($blogId, \WP_Post $post)
 {
     return magnify_filter('normalized_post', $this->wrapped->normalize($blogId, $post), $blogId, $post);
 }