本文整理汇总了PHP中Notice类的典型用法代码示例。如果您正苦于以下问题:PHP Notice类的具体用法?PHP Notice怎么用?PHP Notice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Notice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: send
/**
* @param Notice $notice
* @return string
**/
public function send(Notice $notice)
{
$curl = curl_init();
$xml = $notice->toXml($this->configuration);
curl_setopt($curl, CURLOPT_URL, $this->configuration->get('apiEndPoint'));
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, $this->configuration->get('timeout'));
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
// HTTP proxy support
$proxyHost = $this->configuration->get('proxyHost');
$proxyUser = $this->configuration->get('proxyUser');
if (null !== $proxyHost) {
curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $this->configuration->get('proxyPort'));
if (null !== $proxyUser) {
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUser . ':' . $this->configuration->get('proxyPass'));
}
}
$return = curl_exec($curl);
curl_close($curl);
return $return;
}
开发者ID:dbtlr,项目名称:php-airbrake,代码行数:30,代码来源:Connection.php
示例2: onStartNoticeDistribute
/**
* If poster is in one of the forced groups, make sure their notice
* gets saved into that group even if not explicitly mentioned.
*
* @param Notice $notice
* @return boolean event hook return
*/
function onStartNoticeDistribute($notice)
{
$profile = $notice->getProfile();
$isRemote = !User::getKV('id', $profile->id);
if ($isRemote) {
/*
* Notices from remote users on other sites
* will normally not end up here unless they're
* specifically directed here, e.g.: via explicit
* post to a remote (to them) group. But remote
* notices can also be `pulled in' as a result of
* local users subscribing to the remote user;
* from the remote user's perspective, this results
* in group-forcing appearing effectively random.
* So let's be consistent, and just never force
* incoming remote notices into a ForceGroup:
*/
return true;
}
foreach ($this->post as $nickname) {
$group = User_group::getForNickname($nickname);
if ($group && $profile->isMember($group)) {
$notice->addToGroupInbox($group);
}
}
return true;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:34,代码来源:ForceGroupPlugin.php
示例3: handle
/**
* Handle distribution of a notice after we've saved it:
* @li add to local recipient inboxes
* @li send email notifications to local @-reply targets
* @li run final EndNoticeSave plugin events
* @li put any remaining post-processing into the queues
*
* If this function indicates failure, a warning will be logged
* and the item is placed back in the queue to be re-run.
*
* @fixme addToInboxes is known to fail sometimes with large recipient sets
*
* @param Notice $notice
* @return boolean true on success, false on failure
*/
function handle($notice)
{
try {
$notice->addToInboxes();
} catch (Exception $e) {
$this->logit($notice, $e);
}
try {
$notice->sendReplyNotifications();
} catch (Exception $e) {
$this->logit($notice, $e);
}
try {
Event::handle('EndNoticeDistribute', array($notice));
} catch (Exception $e) {
$this->logit($notice, $e);
}
try {
Event::handle('EndNoticeSave', array($notice));
} catch (Exception $e) {
$this->logit($notice, $e);
}
try {
// Enqueue for other handlers
common_enqueue_notice($notice);
} catch (Exception $e) {
$this->logit($notice, $e);
}
return true;
}
开发者ID:microcosmx,项目名称:experiments,代码行数:45,代码来源:distribqueuehandler.php
示例4: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
// XXX It would be nice to do this without a join
// (necessary to do it efficiently on accounts with long history)
$notice = new Notice();
$query = "select id from notice join notice_tag on id=notice_id where tag='" . $notice->escape($this->tag) . "' and profile_id=" . intval($this->profile->id);
$since = Notice::whereSinceId($since_id, 'id', 'notice.created');
if ($since) {
$query .= " and ({$since})";
}
$max = Notice::whereMaxId($max_id, 'id', 'notice.created');
if ($max) {
$query .= " and ({$max})";
}
$query .= ' order by notice.created DESC, id DESC';
if (!is_null($offset)) {
$query .= " LIMIT " . intval($limit) . " OFFSET " . intval($offset);
}
$notice->query($query);
$ids = array();
while ($notice->fetch()) {
$ids[] = $notice->id;
}
return $ids;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:25,代码来源:taggedprofilenoticestream.php
示例5: getStreamByIds
static function getStreamByIds($ids)
{
$cache = Cache::instance();
if (!empty($cache)) {
$notices = array();
foreach ($ids as $id) {
$n = Notice::staticGet('id', $id);
if (!empty($n)) {
$notices[] = $n;
}
}
return new ArrayWrapper($notices);
} else {
$notice = new Notice();
if (empty($ids)) {
//if no IDs requested, just return the notice object
return $notice;
}
$notice->whereAdd('id in (' . implode(', ', $ids) . ')');
$notice->find();
$temp = array();
while ($notice->fetch()) {
$temp[$notice->id] = clone $notice;
}
$wrapped = array();
foreach ($ids as $id) {
if (array_key_exists($id, $temp)) {
$wrapped[] = $temp[$id];
}
}
return new ArrayWrapper($wrapped);
}
}
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:33,代码来源:noticestream.php
示例6: getNoticeIds
function getNoticeIds($offset, $limit, $since_id = null, $max_id = null)
{
$notice = new Notice();
// SELECT
$notice->selectAdd();
$notice->selectAdd('id');
// WHERE
$notice->conversation = $this->id;
if (!empty($since_id)) {
$notice->whereAdd(sprintf('notice.id > %d', $since_id));
}
if (!empty($max_id)) {
$notice->whereAdd(sprintf('notice.id <= %d', $max_id));
}
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
if (!empty($this->selectVerbs)) {
$notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb'));
}
// ORDER BY
// currently imitates the previously used "_reverseChron" sorting
$notice->orderBy('notice.created DESC');
$notice->find();
return $notice->fetchAll('id');
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:26,代码来源:conversationnoticestream.php
示例7: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$qry = null;
$qry = 'SELECT notice.* FROM notice ';
$qry .= 'INNER JOIN happening ON happening.uri = notice.uri ';
$qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
if ($since_id != 0) {
$qry .= 'AND notice.id > ' . $since_id . ' ';
}
if ($max_id != 0) {
$qry .= 'AND notice.id <= ' . $max_id . ' ';
}
// NOTE: we sort by event time, not by notice time!
$qry .= 'ORDER BY happening.created DESC ';
if (!is_null($offset)) {
$qry .= "LIMIT {$limit} OFFSET {$offset}";
}
$notice->query($qry);
$ids = array();
while ($notice->fetch()) {
$ids[] = $notice->id;
}
$notice->free();
unset($notice);
return $ids;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:27,代码来源:eventsnoticestream.php
示例8: send
/**
* @param Notice $notice
* @return string
**/
public function send(Notice $notice)
{
$xml = $notice->toXml($this->configuration);
$opts = array('http' => array('method' => 'POST', 'header' => $this->headers, 'content' => $xml));
$context = stream_context_create($opts);
$result = file_get_contents($this->configuration->apiEndPoint, false, $context);
return $result;
}
开发者ID:n-coders-dev,项目名称:php-airbrake,代码行数:12,代码来源:Connection.php
示例9: getNextBatch
/**
* Fetch the next self::DELETION_WINDOW messages for this user.
* @return Notice
*/
protected function getNextBatch(User $user)
{
$notice = new Notice();
$notice->profile_id = $user->id;
$notice->limit(self::DELETION_WINDOW);
$notice->find();
return $notice;
}
开发者ID:phpsource,项目名称:gnu-social,代码行数:12,代码来源:deluserqueuehandler.php
示例10: locFromStored
static function locFromStored(Notice $stored)
{
$loc = new Notice_location();
$loc->notice_id = $stored->getID();
if (!$loc->find(true)) {
throw new NoResultException($loc);
}
return $loc->asLocation();
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:9,代码来源:Notice_location.php
示例11: onEndShowThreadedNoticeTail
public function onEndShowThreadedNoticeTail(NoticeListItem $nli, Notice $notice, array $notices)
{
if ($this->prerender_replyforms) {
$nli->out->elementStart('li', array('class' => 'notice-reply', 'style' => 'display: none;'));
$replyForm = new NoticeForm($nli->out, array('inreplyto' => $notice->getID()));
$replyForm->show();
$nli->out->elementEnd('li');
}
return true;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:10,代码来源:DefaultLayoutPlugin.php
示例12: onStartNoticeDistribute
/**
* If poster is in one of the forced groups, make sure their notice
* gets saved into that group even if not explicitly mentioned.
*
* @param Notice $notice
* @return boolean event hook return
*/
function onStartNoticeDistribute($notice)
{
$profile = $notice->getProfile();
foreach ($this->post as $nickname) {
$group = User_group::getForNickname($nickname);
if ($group && $profile->isMember($group)) {
$notice->addToGroupInbox($group);
}
}
return true;
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:18,代码来源:ForceGroupPlugin.php
示例13: approve
function approve($id)
{
if ($_POST) {
$notice = new Notice($id);
$_POST['approve_id'] = $this->session->userdata('id');
$notice->approve_date = date("Y-m-d H:i:s");
$notice->from_array($_POST);
$notice->save();
echo approve_comment($notice);
}
}
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:11,代码来源:notices.php
示例14: getUpdates
function getUpdates($seconds)
{
$notice = new Notice();
# XXX: cache this. Depends on how big this protocol becomes;
# Re-doing this query every 15 seconds isn't the end of the world.
$notice->query('SELECT profile_id, max(id) AS max_id ' . 'FROM notice ' . (common_config('db', 'type') == 'pgsql' ? 'WHERE extract(epoch from created) > (extract(epoch from now()) - ' . $seconds . ') ' : 'WHERE created > (now() - ' . $seconds . ') ') . 'GROUP BY profile_id');
$updates = array();
while ($notice->fetch()) {
$updates[] = array($notice->profile_id, $notice->max_id);
}
return $updates;
}
开发者ID:Br3nda,项目名称:laconica,代码行数:12,代码来源:sup.php
示例15: saveNew
public static function saveNew(Notice $notice, Profile $profile, $reason = null)
{
$att = new Attention();
$att->notice_id = $notice->getID();
$att->profile_id = $profile->getID();
$att->reason = $reason;
$att->created = common_sql_now();
$result = $att->insert();
if ($result === false) {
throw new Exception('Could not saveNew in Attention');
}
return $att;
}
开发者ID:phpsource,项目名称:gnu-social,代码行数:13,代码来源:Attention.php
示例16: noticeCount
static function noticeCount($id)
{
$keypart = sprintf('conversation:notice_count:%d', $id);
$cnt = self::cacheGet($keypart);
if ($cnt !== false) {
return $cnt;
}
$notice = new Notice();
$notice->conversation = $id;
$cnt = $notice->count();
self::cacheSet($keypart, $cnt);
return $cnt;
}
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:13,代码来源:Conversation.php
示例17: noticeCount
static function noticeCount($id)
{
$keypart = sprintf('conversation:notice_count:%d', $id);
$cnt = self::cacheGet($keypart);
if ($cnt !== false) {
return $cnt;
}
$notice = new Notice();
$notice->conversation = $id;
$notice->whereAddIn('verb', array(ActivityVerb::POST, ActivityUtils::resolveUri(ActivityVerb::POST, true)), $notice->columnType('verb'));
$cnt = $notice->count();
self::cacheSet($keypart, $cnt);
return $cnt;
}
开发者ID:phpsource,项目名称:gnu-social,代码行数:14,代码来源:Conversation.php
示例18: run
public function run()
{
$this->controller->_seoTitle = '系统公告 - ' . $this->controller->_setting['site_name'];
$model = new Notice();
$criteria = new CDbCriteria();
//查询条件
$criteria->addColumnCondition(array('status' => 'Y'));
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 10;
$pages->applyLimit($criteria);
$lists = $model->findAll($criteria);
$this->controller->render('index', array('lists' => $lists, 'pages' => $pages));
}
开发者ID:github-zjh,项目名称:task,代码行数:14,代码来源:IndexAction.php
示例19: activityObjectFromNotice
function activityObjectFromNotice(Notice $notice)
{
$object = new ActivityObject();
$object->id = $notice->uri;
$object->type = Video::OBJECT_TYPE;
$object->title = $notice->content;
$object->summary = $notice->content;
$object->link = $notice->getUrl();
$vid = Video::getByNotice($notice);
if ($vid) {
$object->extra[] = array('link', array('rel' => 'enclosure', 'href' => $vid->url), array());
}
return $object;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:14,代码来源:GNUsocialVideoPlugin.php
示例20: publishNotice
public function publishNotice()
{
$title = Input::get("title");
$content = Input::get("content");
if (!$title || !$content) {
return Response::json(array("errCode" => 1, "errMsg" => "[参数错误]请填写要发布公告的标题和内容"));
}
$notice = new Notice();
$notice->title = $title;
$notice->content = $content;
if (!$notice->save()) {
return Response::json(array("errCode" => 1, "errMsg" => "[数据库错误]发布失败"));
}
return Response::json(array("errCode" => 0));
}
开发者ID:Jv-Juven,项目名称:carService,代码行数:15,代码来源:AdminController.php
注:本文中的Notice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论