/** * @brief Syndicating routine. * @see Tag, User, DBModel, Model_Context */ function SyndicateToEolin($entryId, $entry, $mode) { $context = Model_Context::getInstance(); $blogid = $context->getProperty('blog.id'); $rpc = new XMLRPC(); $rpc->url = 'http://ping.eolin.com/'; $summary = array('blogURL' => $context->getProperty('uri.default'), 'syncURL' => $context->getProperty('uri.default') . "/plugin/abstractToEolin?entryId={$entryId}"); if ($mode == 'create') { $summary['blogTitle'] = $context->getProperty('blog.title'); $summary['language'] = $context->getProperty('blog.language'); $summary['permalink'] = $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']); $summary['title'] = Utils_Unicode::lessenAsByte($entry['title'], 255); $summary['content'] = Utils_Unicode::lessenAsByte(stripHTML(getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'])), 1023, ''); $summary['author'] = User::authorName($entry['userid'], $entryId); $summary['tags'] = Tag::getTagsWithEntryId($blogid, $entry); $summary['location'] = $entry['location']; $summary['written'] = Timestamp::getRFC1123($entry['published']); } return $rpc->call("sync.{$mode}", $summary); }
private function validate() { if (is_null($this->id)) { $this->id = $this->getNextId(); } $this->category = Utils_Unicode::lessenAsByte($this->category, 11); $this->content = Utils_Unicode::lessenAsByte($this->content, 512); if (empty($this->author)) { $this->author = User::getName(); } $this->author = Utils_Unicode::lessenAsByte($this->author, 32); if (!Validator::isInteger($this->blogid, 1)) { return $this->error('blogid'); } if (!Validator::timestamp($this->created)) { return $this->error('created'); } return true; }
static function lessenAsEncoding($str, $length = 255, $tail = '...') { $context = Model_Context::getInstance(); if ($context->getProperty('database.utf8') != true) { return Utils_Unicode::lessen($str, $length, $tail); } else { return Utils_Unicode::lessenAsByte($str, $length, $tail); } }