Beispiel #1
0
 public static function editPost($x, $post_id, &$cur, $content, $struct, $publish)
 {
     # Check if we have mt_keywords in struct
     if (isset($struct['mt_keywords'])) {
         $meta = new dcMeta($x->core);
         $meta->delPostMeta($post_id, 'tag');
         foreach ($meta->splitMetaValues($struct['mt_keywords']) as $m) {
             $meta->setPostMeta($post_id, 'tag', $m);
         }
     }
 }
Beispiel #2
0
 public static function setPostMeta(&$core, $get, $post)
 {
     if (empty($post['postId'])) {
         throw new Exception('No post ID');
     }
     if (empty($post['meta'])) {
         throw new Exception('No meta');
     }
     if (empty($post['metaType'])) {
         throw new Exception('No meta type');
     }
     $meta = new dcMeta($core);
     # Get previous meta for post
     $post_meta = $meta->getMeta($post['metaType'], null, null, $post['postId']);
     $pm = array();
     while ($post_meta->fetch()) {
         $pm[] = $post_meta->meta_id;
     }
     foreach ($meta->splitMetaValues($post['meta']) as $m) {
         if (!in_array($m, $pm)) {
             $meta->setPostMeta($post['postId'], $post['metaType'], $m);
         }
     }
     return true;
 }