当前位置: 首页>>代码示例>>PHP>>正文


PHP Notice::update方法代码示例

本文整理汇总了PHP中Notice::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::update方法的具体用法?PHP Notice::update怎么用?PHP Notice::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notice的用法示例。


在下文中一共展示了Notice::update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clearRepeats

 function clearRepeats()
 {
     $repeatNotice = new Notice();
     $repeatNotice->repeat_of = $this->id;
     //Null any notices that are repeats of this notice
     if ($repeatNotice->find()) {
         while ($repeatNotice->fetch()) {
             $orig = clone $repeatNotice;
             $repeatNotice->repeat_of = null;
             $repeatNotice->update($orig);
         }
     }
 }
开发者ID:a780201,项目名称:gnu-social,代码行数:13,代码来源:Notice.php

示例2: realpath

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
// Abort if called from a web server
if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
    print "This script must be run from the command line\n";
    exit;
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
define('GNUSOCIAL', true);
define('STATUSNET', true);
// compatibility
require_once INSTALLDIR . '/lib/common.php';
common_log(LOG_INFO, 'Starting to do old notices.');
$notice = new Notice();
$cnt = $notice->find();
while ($notice->fetch()) {
    common_log(LOG_INFO, 'Getting tags for notice #' . $notice->id);
    $notice->saveTags();
    $original = clone $notice;
    $notice->rendered = common_render_content($notice->content, $notice->getProfile(), $notice->hasParent() ? $notice->getParent() : null);
    $result = $notice->update($original);
    if (!$result) {
        common_log_db_error($notice, 'UPDATE', __FILE__);
    }
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:31,代码来源:fixup_hashtags.php

示例3: importer


//.........这里部分代码省略.........
                    if (!empty($node['tag'][$i]['.value'])) {
                        array_push($post->tags, $node['tag'][$i]['.value']);
                    }
                }
            }
            if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) {
                $post->content = nl2brWithHTML($post->content);
            }
            if (!$post->add()) {
                user_error(__LINE__ . $post->error);
            }
            if (isset($node['attachment'])) {
                for ($i = 0; $i < count($node['attachment']); $i++) {
                    $attachment = new Attachment();
                    $attachment->parent = $post->id;
                    $cursor =& $node['attachment'][$i];
                    $attachment->name = $cursor['name'][0]['.value'];
                    $attachment->label = $cursor['label'][0]['.value'];
                    $attachment->mime = @$cursor['.attributes']['mime'];
                    $attachment->size = $cursor['.attributes']['size'];
                    $attachment->width = $cursor['.attributes']['width'];
                    $attachment->height = $cursor['.attributes']['height'];
                    $attachment->enclosure = @$cursor['enclosure'][0]['.value'];
                    $attachment->attached = $cursor['attached'][0]['.value'];
                    $attachment->downloads = @$cursor['downloads'][0]['.value'];
                    if (!$attachment->add()) {
                        user_error(__LINE__ . $attachment->error);
                    } else {
                        if ($cursor['name'][0]['.value'] != $attachment->name) {
                            $post2 = new Post();
                            if ($post2->open($post->id, 'id, content')) {
                                $post2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $post2->content);
                                $post2->loadTags();
                                $post2->update();
                                $post2->close();
                            }
                            unset($post2);
                        }
                    }
                    if (!empty($cursor['content'][0]['.stream'])) {
                        Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        fclose($cursor['content'][0]['.stream']);
                        unset($cursor['content'][0]['.stream']);
                    }
                }
            }
            if (isset($node['comment'])) {
                for ($i = 0; $i < count($node['comment']); $i++) {
                    $comment = new Comment();
                    $comment->entry = $post->id;
                    $cursor =& $node['comment'][$i];
                    $comment->name = $cursor['commenter'][0]['name'][0]['.value'];
                    if (!empty($cursor['id'][0]['.value'])) {
                        $comment->id = $cursor['id'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['.attributes']['id'])) {
                        $comment->commenter = $cursor['commenter'][0]['.attributes']['id'];
                    }
                    if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) {
                        $comment->homepage = $cursor['commenter'][0]['homepage'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) {
                        $comment->ip = $cursor['commenter'][0]['ip'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) {
开发者ID:webhacking,项目名称:Textcube,代码行数:67,代码来源:index.php

示例4: Notice

    $notice = new Notice();
    if (empty($nid->reply_to)) {
        $cid = $nid->id;
    } else {
        $reply = Notice::staticGet('id', $notice->reply_to);
        if (empty($reply)) {
            common_log(LOG_WARNING, "Replied-to notice {$notice->reply_to} not found.");
            $notice->conversation = $notice->id;
        } else {
            if (empty($reply->conversation)) {
                common_log(LOG_WARNING, "Replied-to notice {$reply->id} has no conversation ID.");
                $notice->conversation = $notice->id;
            } else {
                $notice->conversation = $reply->conversation;
            }
        }
        unset($reply);
        $reply = null;
    }
    print "{$notice->conversation}";
    $result = $notice->update($orig);
    if (!$result) {
        common_log_db_error($notice, 'UPDATE', __FILE__);
        continue;
    }
    $notice = null;
    $orig = null;
    unset($notice);
    unset($orig);
    print ".\n";
}
开发者ID:Br3nda,项目名称:laconica,代码行数:31,代码来源:fixup_conversations.php

示例5: initNoticeReshare

function initNoticeReshare()
{
    printfnq("Ensuring all reshares have the correct verb and object-type...");
    $notice = new Notice();
    $notice->whereAdd('repeat_of is not null');
    $notice->whereAdd('(verb != "' . ActivityVerb::SHARE . '" OR object_type != "' . ActivityObject::ACTIVITY . '")');
    if ($notice->find()) {
        while ($notice->fetch()) {
            try {
                $orig = Notice::staticGet('id', $notice->id);
                $notice->verb = ActivityVerb::SHARE;
                $notice->object_type = ActivityObject::ACTIVITY;
                $notice->update($orig);
            } catch (Exception $e) {
                printfv("Error updating verb and object_type for {$notice->id}:" . $e->getMessage());
            }
        }
    }
    printfnq("DONE.\n");
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:20,代码来源:upgrade.php

示例6: onEndUpgrade

 function onEndUpgrade()
 {
     // Version 0.9.x of the plugin didn't stamp notices
     // with verb and object-type (for obvious reasons). Update
     // those notices here.
     $notice = new Notice();
     $notice->whereAdd('exists (select uri from bookmark where bookmark.uri = notice.uri)');
     $notice->whereAdd('((object_type is null) or (object_type = "' . ActivityObject::NOTE . '"))');
     $notice->find();
     while ($notice->fetch()) {
         $original = clone $notice;
         $notice->verb = ActivityVerb::POST;
         $notice->object_type = ActivityObject::BOOKMARK;
         $notice->update($original);
     }
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:16,代码来源:BookmarkPlugin.php

示例7: clearRepeats

 function clearRepeats()
 {
     $repeatNotice = new Notice();
     $repeatNotice->repeat_of = $this->id;
     //Null any notices that are repeats of this notice
     if ($repeatNotice->find()) {
         while ($repeatNotice->fetch()) {
             $orig = clone $repeatNotice;
             $repeatNotice->repeat_of = null;
             $repeatNotice->update($orig);
         }
     }
     if (!empty($this->repeat_of)) {
         $repeatToNotice = new Notice();
         $repeatToNotice->id = $this->repeat_of;
         if ($repeatToNotice->find()) {
             $this->reduceRepostCount($repeatToNotice->id);
         }
     }
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:20,代码来源:Notice.php


注:本文中的Notice::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。