function getTags($lst, $usr) { $profile_tag = new Notice_tag(); $profile_tag->query('SELECT DISTINCT(tag) ' . 'FROM profile_tag, subscription ' . 'WHERE tagger = ' . $this->target->id . ' ' . 'AND ' . $usr . ' = ' . $this->target->id . ' ' . 'AND ' . $lst . ' = tagged ' . 'AND tagger != tagged'); $tags = array(); while ($profile_tag->fetch()) { $tags[] = $profile_tag->tag; } $profile_tag->free(); return $tags; }
function ping_notice_tags($notice) { $tag = new Notice_tag(); $tag->notice_id = $notice->id; $tags = array(); if ($tag->find()) { while ($tag->fetch()) { $tags[] = $tag->tag; } $tag->free(); unset($tag); return implode('|', $tags); } return NULL; }
function twitterRssEntryArray($notice) { $entry = array(); if (Event::handle('StartRssEntryArray', array($notice, &$entry))) { $profile = $notice->getProfile(); // We trim() to avoid extraneous whitespace in the output $entry['content'] = common_xml_safe_str(trim($notice->rendered)); $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content)); $entry['link'] = common_local_url('shownotice', array('notice' => $notice->id)); $entry['published'] = common_date_iso8601($notice->created); $taguribase = TagURI::base(); $entry['id'] = "tag:{$taguribase}:{$entry['link']}"; $entry['updated'] = $entry['published']; $entry['author'] = $profile->getBestName(); // Enclosures $attachments = $notice->attachments(); $enclosures = array(); foreach ($attachments as $attachment) { $enclosure_o = $attachment->getEnclosure(); if ($enclosure_o) { $enclosure = array(); $enclosure['url'] = $enclosure_o->url; $enclosure['mimetype'] = $enclosure_o->mimetype; $enclosure['size'] = $enclosure_o->size; $enclosures[] = $enclosure; } } if (!empty($enclosures)) { $entry['enclosures'] = $enclosures; } // Tags/Categories $tag = new Notice_tag(); $tag->notice_id = $notice->id; if ($tag->find()) { $entry['tags'] = array(); while ($tag->fetch()) { $entry['tags'][] = $tag->tag; } } $tag->free(); // RSS Item specific $entry['description'] = $entry['content']; $entry['pubDate'] = common_date_rfc2822($notice->created); $entry['guid'] = $entry['link']; if (isset($notice->lat) && isset($notice->lon)) { // This is the format that GeoJSON expects stuff to be in. // showGeoRSS() below uses it for XML output, so we reuse it $entry['geo'] = array('type' => 'Point', 'coordinates' => array((double) $notice->lat, (double) $notice->lon)); } else { $entry['geo'] = null; } Event::handle('EndRssEntryArray', array($notice, &$entry)); } return $entry; }
function clearTags() { $tag = new Notice_tag(); $tag->notice_id = $this->id; if ($tag->find()) { while ($tag->fetch()) { self::blow('profile:notice_ids_tagged:%d:%s', $this->profile_id, Cache::keyize($tag->tag)); self::blow('profile:notice_ids_tagged:%d:%s;last', $this->profile_id, Cache::keyize($tag->tag)); self::blow('notice_tag:notice_ids:%s', Cache::keyize($tag->tag)); self::blow('notice_tag:notice_ids:%s;last', Cache::keyize($tag->tag)); $tag->delete(); } } $tag->free(); }
function getNoticeTags($notice) { $tags = null; $nt = new Notice_tag(); $nt->notice_id = $notice->id; if ($nt->find()) { $tags = array(); while ($nt->fetch()) { $tags[] = $nt->tag; } } $nt->free(); $nt = null; return $tags; }
public function getTags() { $tags = array(); $tag = new Notice_tag(); $tag->notice_id = $this->id; if ($tag->find()) { while ($tag->fetch()) { $tags[] = $tag->tag; } } $tag->free(); return $tags; }
function blowTagCache($blowLast = false) { $cache = common_memcache(); if ($cache) { $tag = new Notice_tag(); $tag->notice_id = $this->id; if ($tag->find()) { while ($tag->fetch()) { $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag)); if ($blowLast) { $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag . ';last')); } } } $tag->free(); unset($tag); } }