public function testSetAuthorIp() { $c = new ae_CommentModel(); $c->setAuthorIp('127.0.0.1'); $this->assertEquals($c->getAuthorIp(), '127.0.0.1'); $c->setAuthorIp('FE80:0000:0000:0000:0202:B3FF:FE1E:8329'); $this->assertEquals($c->getAuthorIp(), 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329'); $c->setAuthorIp('FE80::0202:B3FF:FE1E:8329'); $this->assertEquals($c->getAuthorIp(), 'FE80::0202:B3FF:FE1E:8329'); $this->setExpectedException('Exception'); $c->setAuthorIp('127.0.0.1.0'); }
/** * Get the content of the filter target. * @param {string} $cfTarget Target identifier. * @param {ae_CommentModel} $co The comment. * @return {string} Target content. */ protected static function getTarget($cfTarget, ae_CommentModel $co) { switch ($cfTarget) { case ae_CommentfilterModel::TARGET_CONTENT: $target = $co->getContent(); break; case ae_CommentfilterModel::TARGET_EMAIL: $target = $co->getAuthorEmail(); break; case ae_CommentfilterModel::TARGET_IP: $target = $co->getAuthorIp(); break; case ae_CommentfilterModel::TARGET_NAME: $target = $co->getAuthorName(); break; case ae_CommentfilterModel::TARGET_URL: $target = $co->getAuthorUrl(); break; case ae_CommentfilterModel::TARGET_USERID: $target = $co->getUserId(); break; default: $target = NULL; } return $target; }