public static function getPostInfo(&$x, $type, &$res) { $res =& $res[0]; $meta = new dcMeta($x->core); $rs = $meta->getMeta('tag', null, null, $res['postid']); $m = array(); while ($rs->fetch()) { $m[] = $rs->meta_id; } $res['mt_keywords'] = implode(', ', $m); }
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; }
<body> <h2><?php echo html::escapeHTML($core->blog->name); ?> › <?php echo __('Tags'); ?> </h2> <?php if (!empty($_GET['del'])) { echo '<p class="message">' . __('Tag has been successfully removed') . '</p>'; } $meta = new dcMeta($core); $tags = $meta->getMeta('tag'); $tags->sort('meta_id_lower', 'asc'); $last_letter = null; $cols = array('', ''); $col = 0; while ($tags->fetch()) { $letter = mb_strtoupper(mb_substr($tags->meta_id, 0, 1)); if ($last_letter != $letter) { if ($tags->index() >= round($tags->count() / 2)) { $col = 1; } $cols[$col] .= '<tr class="tagLetter"><td colspan="2"><span>' . $letter . '</span></td></tr>'; } $cols[$col] .= '<tr class="line">' . '<td class="maximal"><a href="' . $p_url . '&m=tag_posts&tag=' . rawurlencode($tags->meta_id) . '">' . $tags->meta_id . '</a></td>' . '<td class="nowrap"><strong>' . $tags->count . '</strong> ' . __('entries') . '</td>' . '</tr>'; $last_letter = $letter; }
public static function tagFeed($args) { if (!preg_match('#^(.+)/(atom|rss2)(/comments)?$#', $args, $m)) { self::p404(); } else { $tag = $m[1]; $type = $m[2]; $comments = !empty($m[3]); $objMeta = new dcMeta($GLOBALS['core']); $GLOBALS['_ctx']->meta = $objMeta->getMeta('tag', null, $tag); if ($GLOBALS['_ctx']->meta->isEmpty()) { # The specified tag does not exist. self::p404(); } else { $GLOBALS['_ctx']->feed_subtitle = ' - ' . __('Tag') . ' - ' . $GLOBALS['_ctx']->meta->meta_id; if ($type == 'atom') { $mime = 'application/atom+xml'; } else { $mime = 'application/xml'; } $tpl = $type; if ($comments) { $tpl .= '-comments'; $GLOBALS['_ctx']->nb_comment_per_page = $GLOBALS['core']->blog->settings->nb_comment_per_feed; } else { $GLOBALS['_ctx']->nb_entry_per_page = $GLOBALS['core']->blog->settings->nb_post_per_feed; $GLOBALS['_ctx']->short_feed_items = $GLOBALS['core']->blog->settings->short_feed_items; } $tpl .= '.xml'; self::serveDocument($tpl, $mime); } } }
private function getTags($user, $pwd) { if (!class_exists('dcMeta')) { throw new Exception('Metadata management is not available on this blog.'); } $this->setUser($user, $pwd); $this->setBlog(); $meta = new dcMeta($this->core); $tags = $meta->getMeta('tag'); $tags->sort('meta_id_lower', 'asc'); $res = array(); $url = $this->core->blog->url . $this->core->url->getBase('tag') . '/%s'; $f_url = $this->core->blog->url . $this->core->url->getBase('tag_feed') . '/%s'; while ($tags->fetch()) { $res[] = array('tag_id' => $tags->meta_id, 'name' => $tags->meta_id, 'count' => $tags->count, 'slug' => $tags->meta_id, 'html_url' => sprintf($url, $tags->meta_id), 'rss_url' => sprintf($f_url, $tags->meta_id)); } return $res; }