function add_notice(&$user, &$pl) { $body = trim($pl['body']); $content_shortened = common_shorten_link($body); if (mb_strlen($content_shortened) > 140) { $content = trim(mb_substr($body, 0, 140)); $content_shortened = common_shorten_link($content); } else { $content = $body; } $notice = Notice::saveNew($user->id, $content, 'xmpp'); if (is_string($notice)) { $this->log(LOG_ERR, $notice); return; } common_broadcast_notice($notice); $this->log(LOG_INFO, 'Added notice ' . $notice->id . ' from user ' . $user->nickname); $notice->free(); unset($notice); }
function common_longurl($short_url) { $long_url = common_shorten_link($short_url, true); if ($long_url === $short_url) { return false; } return $long_url; }