本文整理汇总了PHP中Utils_Unicode::lessenAsEncoding方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_Unicode::lessenAsEncoding方法的具体用法?PHP Utils_Unicode::lessenAsEncoding怎么用?PHP Utils_Unicode::lessenAsEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_Unicode
的用法示例。
在下文中一共展示了Utils_Unicode::lessenAsEncoding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('ServiceSettings');
$query->setQualifier('name', 'equals', Utils_Unicode::lessenAsEncoding($this->name, 32), false);
if (isset($this->value)) {
$query->setAttribute('value', Utils_Unicode::lessenAsEncoding($this->value, 255), true);
}
return $query;
}
示例2: updateLink
function updateLink($blogid, $link)
{
$id = $link['id'];
$name = Utils_Unicode::lessenAsEncoding(trim($link['name']), 255);
$url = Utils_Unicode::lessenAsEncoding(trim($link['url']), 255);
if (empty($name) || empty($url)) {
return false;
}
$category = isset($link['category']) ? $link['category'] : 0;
if (isset($link['newCategory']) && !empty($link['newCategory'])) {
// Add new category information
$newCategoryTitle = Utils_Unicode::lessenAsEncoding(trim($link['newCategory']), 255);
$newCategoryId = addLinkCategory($blogid, $newCategoryTitle);
if (!empty($newCategoryId)) {
$category = $newCategoryId;
}
}
$rss = isset($link['rss']) ? Utils_Unicode::lessenAsEncoding(trim($link['rss']), 255) : '';
$pool = DBModel::getInstance();
$pool->init("Links");
$pool->setAttribute("category", $category);
$pool->setAttribute("name", $name, true);
$pool->setAttribute("url", $url, true);
$pool->setAttribute("rss", $rss, true);
$pool->setAttribute("written", Timestamp::getUNIXtime());
$pool->setQualifier("blogid", "eq", $blogid);
$pool->setQualifier("id", "eq", $link['id']);
$result = $pool->update();
// Garbage correction
$pool->init("Links");
$pool->setQualifier("blogid", "eq", $blogid);
$existCategories = $pool->getColumn("category", array("filter" => "distinct"));
$pool->init("LinkCategories");
$pool->setQualifier("blogid", "eq", $blogid);
$pool->setQualifier("id", "hasnoneof", $existCategories);
$pool->delete();
return $result;
}
示例3: _buildQuery
function _buildQuery()
{
global $database;
$query = DBModel::getInstance();
$query->reset('Comments');
$query->setQualifier('blogid', 'equals', getBlogId());
$query->setQualifier('entry', 'equals', 0);
if (isset($this->id)) {
if (!Validator::number($this->id, 1)) {
return $this->_error('id');
}
$query->setQualifier('id', 'equals', $this->id);
}
if (isset($this->parent)) {
if (!Validator::number($this->parent, 1)) {
return $this->_error('parent');
}
}
$query->setAttribute('parent', $this->parent);
if (isset($this->commenter)) {
if (!Validator::number($this->commenter, 1)) {
return $this->_error('commenter');
}
if (!($this->name = User::getName($this->commenter))) {
return $this->_error('commenter');
}
$query->setAttribute('replier', $this->commenter);
}
if (isset($this->name)) {
$this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 80);
if (empty($this->name)) {
return $this->_error('name');
}
$query->setAttribute('name', $this->name, true);
}
if (isset($this->openid)) {
$this->openid = Utils_Unicode::lessenAsEncoding(trim($this->openid), 128);
if (empty($this->openid)) {
return $this->_error('openid');
}
$query->setAttribute('openid', $this->openid, true);
}
if (isset($this->homepage)) {
$this->homepage = Utils_Unicode::lessenAsEncoding(trim($this->homepage), 80);
if (empty($this->homepage)) {
return $this->_error('homepage');
}
$query->setAttribute('homepage', $this->homepage, true);
}
if (isset($this->ip)) {
if (!Validator::ip($this->ip)) {
return $this->_error('ip');
}
$query->setAttribute('ip', $this->ip, true);
}
if (isset($this->secret)) {
$query->setAttribute('secret', Validator::getBit($this->secret));
}
if (isset($this->content)) {
$this->content = trim($this->content);
if (empty($this->content)) {
return $this->_error('content');
}
$query->setAttribute('comment', $this->content, true);
}
if (isset($this->written)) {
if (!Validator::timestamp($this->written)) {
return $this->_error('written');
}
$query->setAttribute('written', $this->written);
}
if (isset($this->isfiltered)) {
$query->setAttribute('isfiltered', Validator::getBit($this->isfiltered));
}
if (isset($this->password)) {
$this->password = Utils_Unicode::lessenAsEncoding($this->password, 32);
$query->setAttribute('password', $this->password, true);
$this->password = null;
}
return $query;
}
示例4: add
static function add($email, $name)
{
global $database, $service, $user, $blog;
if (empty($email)) {
return 1;
}
if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) {
return 2;
}
if (strcmp($email, Utils_Unicode::lessenAsEncoding($email, 64)) != 0) {
return 11;
}
$loginid = POD::escapeString(Utils_Unicode::lessenAsEncoding($email, 64));
$name = POD::escapeString(Utils_Unicode::lessenAsEncoding($name, 32));
$password = User::__generatePassword();
$authtoken = md5(User::__generatePassword());
if (POD::queryExistence("SELECT * FROM {$database['prefix']}Users WHERE loginid = '{$loginid}'")) {
return 9;
// User already exists.
}
if (POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Users WHERE name = '{$name}'")) {
$name = $name . '.' . time();
}
$result = POD::query("INSERT INTO {$database['prefix']}Users (userid, loginid, password, name, created, lastlogin, host) VALUES (" . (User::__getMaxUserId() + 1) . ", '{$loginid}', '" . md5($password) . "', '{$name}', UNIX_TIMESTAMP(), 0, " . getUserId() . ")");
if (empty($result)) {
return 11;
}
$result = POD::query("INSERT INTO {$database['prefix']}UserSettings (userid, name, value) VALUES ('" . User::getUserIdByEmail($loginid) . "', 'AuthToken', '{$authtoken}')");
if (empty($result)) {
return 11;
}
return true;
}
示例5: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('RemoteResponses');
$query->setQualifier('blogid', getBlogId());
$query->setQualifier('responsetype', 'pingback');
if (isset($this->id)) {
if (!Validator::number($this->id, 1)) {
return $this->_error('id');
}
$query->setQualifier('id', $this->id);
}
if (isset($this->entry)) {
if (!Validator::number($this->entry, 1)) {
return $this->_error('entry');
}
$query->setQualifier('entry', $this->entry);
}
if (isset($this->url)) {
$this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
if (empty($this->url)) {
return $this->_error('url');
}
$query->setQualifier('url', $this->url, true);
}
if (isset($this->ip)) {
if (!Validator::ip($this->ip)) {
return $this->_error('ip');
}
$query->setAttribute('ip', $this->ip, true);
}
if (isset($this->received)) {
if (!Validator::timestamp($this->received)) {
return $this->_error('received');
}
$query->setAttribute('written', $this->received);
}
if (isset($this->isFiltered)) {
if ($this->isFiltered) {
$query->setAttribute('isFiltered', 'UNIX_TIMESTAMP()');
} else {
$query->setAttribute('isFiltered', Validator::getBit($this->isFiltered));
}
}
return $query;
}
示例6: add
function add()
{
global $database;
$this->id = null;
$this->link = Utils_Unicode::lessenAsEncoding(trim($this->link), 255);
if (empty($this->link)) {
return false;
}
if (isset($this->group)) {
if (is_numeric($this->group) && $this->group > 0) {
FeedGroup::getName($this->group);
}
}
if (!is_numeric($this->feed)) {
return false;
}
if (!is_numeric($this->published)) {
return false;
}
$query = DBModel::getInstance();
$query->reset('FeedItems');
$query->setQualifier('feed', 'equals', $this->feed);
$query->setQualifier('permalink', 'equals', $this->link, true);
$this->id = $query->getCell('id');
if (is_null($this->id)) {
$query->setAttribute('id', $this->_getMaxId() + 1);
$query->setAttribute('title', Utils_Unicode::lessenAsEncoding($this->title, 255), true);
$query->setAttribute('description', $this->description, true);
$query->setAttribute('tags', Utils_Unicode::lessenAsEncoding($this->tags, 255), true);
$query->setAttribute('enclosure', Utils_Unicode::lessenAsEncoding($this->enclosure, 255), true);
$query->setAttribute('author', Utils_Unicode::lessenAsEncoding($this->author, 255), true);
$query->setAttribute('written', $this->published);
$this->id = $query->insert();
//echo mysql_error(), '<br />';
if ($this->id === false) {
return false;
}
}
return true;
}
示例7: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('Users');
$query->setQualifier('userid', getUserId());
if (isset($this->userid)) {
if (!Validator::number($this->userid, 1)) {
return $this->_error('userid');
}
$query->setQualifier('userid', $this->userid);
}
if (isset($this->loginid)) {
$this->loginid = Utils_Unicode::lessenAsEncoding(trim($this->loginid), 64);
if (empty($this->loginid)) {
return $this->_error('loginid');
}
$query->setAttribute('loginid', $this->loginid, true);
}
if (isset($this->password)) {
$this->password = trim($this->password);
if (empty($this->password)) {
return $this->_error('password');
}
$query->setAttribute('password', $this->password, true);
}
if (isset($this->name)) {
$this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 32);
if (empty($this->name)) {
return $this->_error('name');
}
$query->setAttribute('name', $this->name, true);
}
if (isset($this->created)) {
if (!Validator::number($this->created, 0)) {
return $this->_error('created');
}
$query->setAttribute('created', $this->created);
}
if (isset($this->lastLogin)) {
if (!Validator::number($this->lastLogin, 1)) {
return $this->_error('lastLogin');
}
$query->setAttribute('lastLogin', $this->lastLogin);
}
if (isset($this->host)) {
if (!Validator::number($this->host, 0)) {
return $this->_error('host');
}
$query->setAttribute('host', $this->host);
}
return $query;
}
示例8: add
function add()
{
if ($this->id != 0) {
$this->id = null;
}
if (isset($this->parent) && !is_numeric($this->parent)) {
return $this->_error('parent');
}
$this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 127);
if (empty($this->name)) {
return $this->_error('name');
}
$query = DBModel::getInstance();
$query->reset('Categories');
$query->setQualifier('blogid', 'equals', getBlogId());
if (isset($this->parent)) {
if (is_null($parentLabel = Category::getLabel($this->parent))) {
return $this->_error('parent');
}
$query->setQualifier('parent', 'equals', $this->parent);
$query->setAttribute('label', Utils_Unicode::lessenAsEncoding($parentLabel . '/' . $this->name, 255), true);
} else {
$query->setQualifier('parent', null);
$query->setAttribute('label', $this->name, true);
}
$query->setQualifier('name', 'equals', $this->name, true);
if (isset($this->priority)) {
if (!is_numeric($this->priority)) {
return $this->_error('priority');
}
$query->setAttribute('priority', $this->priority);
}
if ($query->doesExist()) {
$this->id = $query->getCell('id');
if ($query->update()) {
return true;
} else {
return $this->_error('update');
}
}
if (!isset($this->id)) {
$this->id = $this->getNextCategoryId();
$query->setQualifier('id', 'equals', $this->id);
}
if (!$query->insert()) {
return $this->_error('insert');
}
return true;
}
示例9: _buildQuery
function _buildQuery()
{
if (!Validator::directory($this->name)) {
return $this->_error('name');
}
$query = DBModel::getInstance();
$query->reset('Plugins');
$query->setQualifier('blogid', 'equals', getBlogId());
$query->setQualifier('name', 'equals', Utils_Unicode::lessenAsEncoding($this->name, 255), true);
if (isset($this->setting)) {
$query->setAttribute('settings', $this->setting, true);
}
return $query;
}
示例10: sendTrackback
function sendTrackback($blogid, $entryId, $url)
{
importlib('model.blog.entry');
importlib('model.blog.keyword');
$context = Model_Context::getInstance();
$entry = getEntry($blogid, $entryId);
if (is_null($entry)) {
return false;
}
$link = $context->getProperty('uri.default') . "/" . $entryId;
$title = htmlspecialchars($entry['title']);
$entry['content'] = getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
$excerpt = str_tag_on(Utils_Unicode::lessen(removeAllTags(stripHTML($entry['content'])), 255));
$blogTitle = $context->getProperty('blog.title');
$isNeedConvert = strpos($url, '/rserver.php?') !== false || strpos($url, 'blog.naver.com/tb') !== false || strpos($url, 'news.naver.com/tb/') !== false || strpos($url, 'blog.empas.com') !== false || strpos($url, 'blog.yahoo.com') !== false || strpos($url, 'www.blogin.com/tb/') !== false || strpos($url, 'cytb.cyworld.nate.com') !== false || strpos($url, 'www.cine21.com/Movies/tb.php') !== false;
if ($isNeedConvert) {
$title = Utils_Unicode::convert($title, 'EUC-KR');
$excerpt = Utils_Unicode::convert($excerpt, 'EUC-KR');
$blogTitle = Utils_Unicode::convert($blogTitle, 'EUC-KR');
$content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
$request = new HTTPRequest('POST', $url);
$request->contentType = 'application/x-www-form-urlencoded; charset=euc-kr';
$isSuccess = $request->send($content);
} else {
$content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
$request = new HTTPRequest('POST', $url);
$request->contentType = 'application/x-www-form-urlencoded; charset=utf-8';
$isSuccess = $request->send($content);
}
if ($isSuccess && checkResponseXML($request->responseText) === 0) {
$trackbacklog = new TrackbackLog();
$trackbacklog->entry = $entryId;
$trackbacklog->url = Utils_Unicode::lessenAsEncoding($url, 255);
$trackbacklog->add();
return true;
}
return false;
}
示例11: add
static function add($email, $name)
{
$context = Model_Context::getInstance();
$pool = DBModel::getInstance();
if (empty($email)) {
return 1;
}
if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) {
return 2;
}
if (strcmp($email, Utils_Unicode::lessenAsEncoding($email, 64)) != 0) {
return 11;
}
$loginid = Utils_Unicode::lessenAsEncoding($email, 64);
$name = Utils_Unicode::lessenAsEncoding($name, 32);
$password = User::__generatePassword();
$authtoken = md5(User::__generatePassword());
$pool->reset("Users");
$pool->setQualifier("loginid", "eq", $loginid, true);
if ($pool->doesExist()) {
return 9;
// User already exists.
}
$pool->reset("Users");
$pool->setQualifier("name", "eq", $name, true);
if ($pool->getCount()) {
$name = $name . '.' . time();
}
$pool->reset("Users");
$pool->setAttribute("userid", User::__getMaxUserId() + 1);
$pool->setAttribute("loginid", $loginid, true);
$pool->setAttribute("password", md5($password), true);
$pool->setAttribute("name", $name, true);
$pool->setAttribute("created", Timestamp::getUNIXtime());
$pool->setAttribute("lastlogin", 0);
$pool->setAttribute("host", getUserId());
$result = $pool->insert();
if (empty($result)) {
return 11;
}
$pool->reset("UserSettings");
$pool->setAttribute("userid", User::getUserIdByEmail($loginid));
$pool->setAttribute("name", 'AuthToken', true);
$pool->setAttribute("value", $authtoken, true);
$result = $pool->insert();
if (empty($result)) {
return 11;
}
return true;
}
示例12: treatPluginTable
function treatPluginTable($plugin, $name, $fields, $keys, $version)
{
$context = Model_Context::getInstance();
// global $context;
if (doesExistTable($context->getProperty('database.prefix') . $name)) {
$keyname = 'Database_' . $name;
$value = $plugin;
$result = Setting::getServiceSetting($keyname, null, true);
if (is_null($result)) {
$keyname = Utils_Unicode::lessenAsEncoding($keyname, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
$query = DBModel::getInstance();
$query->reset('ServiceSettings');
$query->setAttribute('name', $keyname, true);
$query->setAttribute('value', $value, true);
$query->insert();
} else {
$keyname = Utils_Unicode::lessenAsEncoding($keyname, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
$values = explode('/', $result, 2);
if (strcmp($plugin, $values[0]) != 0) {
// diff plugin
return false;
// nothing can be done
} else {
if (strcmp($version, $values[1]) != 0) {
$query = DBModel::getInstance();
$query->reset('ServiceSettings');
$query->setQualifier('name', 'equals', $keyname, true);
$query->setAttribute('value', $value, true);
$query->update();
$eventName = 'UpdateDB_' . $name;
fireEvent($eventName, $values[1]);
}
}
}
return true;
} else {
$query = "CREATE TABLE " . $context->getProperty('database.prefix') . $name . " (blogid int(11) NOT NULL default 0,";
$isaiExists = false;
$index = '';
foreach ($fields as $field) {
$ai = '';
if (strtolower($field['attribute']) == 'int' || strtolower($field['attribute']) == 'mediumint') {
if ($field['autoincrement'] == 1 && !$isaiExists) {
$ai = ' AUTO_INCREMENT ';
$isaiExists = true;
if (!in_array($field['name'], $keys)) {
$index = ", KEY({$field['name']})";
}
}
}
$isNull = $field['isnull'] == 0 ? ' NOT NULL ' : ' NULL ';
$defaultValue = is_null($field['default']) ? '' : " DEFAULT '" . POD::escapeString($field['default']) . "' ";
$fieldLength = $field['length'] >= 0 ? "(" . $field['length'] . ")" : '';
$sentence = $field['name'] . " " . $field['attribute'] . $fieldLength . $isNull . $defaultValue . $ai . ",";
$query .= $sentence;
}
array_unshift($keys, 'blogid');
$query .= " PRIMARY KEY (" . implode(',', $keys) . ")";
$query .= $index;
$query .= ") TYPE=MyISAM ";
$query .= POD::charset() == 'utf8' ? 'DEFAULT CHARSET=utf8' : '';
if (POD::execute($query)) {
$keyname = Utils_Unicode::lessenAsEncoding('Database_' . $name, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
Setting::setServiceSetting($keyname, $value, true);
#POD::execute("INSERT INTO {$database['prefix']}ServiceSettings SET name='$keyname', value ='$value'");
return true;
} else {
return false;
}
}
return true;
}
示例13: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('CommentsNotifiedSiteInfo');
if (isset($this->id)) {
if (!Validator::number($this->id, 1)) {
return $this->_error('id');
}
$query->setQualifier('id', 'equals', $this->id);
}
if (isset($this->title)) {
$this->title = Utils_Unicode::lessenAsEncoding(trim($this->title), 255);
$query->setAttribute('title', $this->title, true);
}
if (isset($this->name)) {
$this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 255);
$query->setAttribute('name', $this->name, true);
}
if (isset($this->url)) {
$this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
if (empty($this->url)) {
return $this->_error('url');
}
$query->setAttribute('url', $this->url, true);
}
if (isset($this->modified)) {
if (!Validator::timestamp($this->modified)) {
return $this->_error('modified');
}
$query->setAttribute('modified', $this->modified);
}
return $query;
}
示例14: _buildQuery
function _buildQuery()
{
global $database;
$query = DBModel::getInstance();
$query->reset('Links');
$query->setQualifier('blogid', 'equals', getBlogId());
if (isset($this->id)) {
if (!Validator::number($this->id, 1)) {
return $this->_error('id');
}
$query->setQualifier('id', 'equals', $this->id);
}
if (isset($this->pid)) {
if (!Validator::number($this->pid, 1)) {
return $this->_error('pid');
}
$query->setQualifier('pid', 'equals', $this->pid);
}
if (isset($this->category)) {
if (intval($this->category) < 0) {
return $this->_error('category');
}
$query->setQualifier('category', 'equals', $this->category);
}
if (isset($this->url)) {
$this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
if (empty($this->url)) {
return $this->_error('url');
}
$query->setQualifier('url', 'equals', $this->url, true);
}
if (isset($this->title)) {
$this->title = Utils_Unicode::lessenAsEncoding(trim($this->title), 255);
if (empty($this->title)) {
return $this->_error('title');
}
$query->setAttribute('name', $this->title, true);
}
if (isset($this->feed)) {
$this->feed = Utils_Unicode::lessenAsEncoding(trim($this->feed), 255);
if (empty($this->feed)) {
return $this->_error('feed');
}
$query->setAttribute('rss', $this->feed, true);
}
if (isset($this->registered)) {
if (!Validator::number($this->registered, 1)) {
return $this->_error('registered');
}
$query->setAttribute('written', $this->registered);
}
if (isset($this->xfn)) {
$this->xfn = Utils_Unicode::lessenAsEncoding(trim($this->xfn), 255);
if (empty($this->xfn)) {
return $this->_error('xfn');
}
$query->setAttribute('xfn', $this->xfn, true);
}
$this->_count = 0;
$this->reset();
return $query;
}
示例15: _buildQuery
function _buildQuery()
{
global $database;
$query = DBModel::getInstance();
$query->reset('Comments');
$query->setQualifier('blogid', 'equals', getBlogId());
if (isset($this->id)) {
if (!Validator::number($this->id, 1)) {
return $this->_error('id');
}
$query->setQualifier('id', 'equals', $this->id);
}
if (isset($this->entry)) {
if (!Validator::number($this->entry, 1)) {
return $this->_error('entry');
}
$query->setAttribute('entry', $this->entry);
}
if (isset($this->parent)) {
if (!Validator::number($this->parent, 1)) {
return $this->_error('parent');
}
}
$query->setAttribute('parent', $this->parent);
if (isset($this->commenter)) {
if (!Validator::number($this->commenter, 1)) {
return $this->_error('commenter');
}
if (!isset($this->name)) {
if (!($this->name = User::getName($this->commenter))) {
return $this->_error('commenter');
}
} else {
// name information exists. however, replier maybe different from services.
// It is a limitation of spec.
if ($this->name == User::getName($this->commenter)) {
// If name == commenter, it is same service (maybe).
$query->setAttribute('replier', $this->commenter);
}
}
// $query->setAttribute('replier', $this->commenter);
}
if (isset($this->name)) {
$this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 80);
if (empty($this->name)) {
return $this->_error('name');
}
$query->setAttribute('name', $this->name, true);
}
if (isset($this->openid)) {
$this->openid = Utils_Unicode::lessenAsEncoding(trim($this->openid), 128);
if (empty($this->openid)) {
return $this->_error('openid');
}
$query->setAttribute('openid', $this->openid, true);
}
if (isset($this->homepage)) {
$this->homepage = Utils_Unicode::lessenAsEncoding(trim($this->homepage), 80);
if (empty($this->homepage)) {
return $this->_error('homepage');
}
$query->setAttribute('homepage', $this->homepage, true);
}
if (isset($this->ip)) {
if (!Validator::ip($this->ip)) {
return $this->_error('ip');
}
$query->setAttribute('ip', $this->ip, true);
}
if (isset($this->secret)) {
$query->setAttribute('secret', Validator::getBit($this->secret));
}
if (isset($this->content)) {
$this->content = trim($this->content);
if (empty($this->content)) {
return $this->_error('content');
}
$query->setAttribute('comment', $this->content, true);
}
if (isset($this->longitude) && Validator::number($this->longitude)) {
$query->setAttribute('longitude', $this->longitude, false);
} else {
$query->setAttribute('longitude', null);
}
if (isset($this->latitude) && Validator::number($this->latitude)) {
$query->setAttribute('latitude', $this->latitude, false);
} else {
$query->setAttribute('latitude', null);
}
if (isset($this->written)) {
if (!Validator::timestamp($this->written)) {
return $this->_error('written');
}
$query->setAttribute('written', $this->written);
}
if (isset($this->isfiltered)) {
$query->setAttribute('isfiltered', Validator::getBit($this->isfiltered));
}
if (isset($this->password)) {
$this->password = Utils_Unicode::lessenAsEncoding($this->password, 32);
//.........这里部分代码省略.........