當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Fave::whereAdd方法代碼示例

本文整理匯總了PHP中Fave::whereAdd方法的典型用法代碼示例。如果您正苦於以下問題:PHP Fave::whereAdd方法的具體用法?PHP Fave::whereAdd怎麽用?PHP Fave::whereAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Fave的用法示例。


在下文中一共展示了Fave::whereAdd方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getNoticeIds

 function getNoticeIds($offset, $limit, $since_id, $max_id)
 {
     $weightexpr = common_sql_weight('modified', common_config('popular', 'dropoff'));
     $cutoff = sprintf("modified > '%s'", common_sql_date(time() - common_config('popular', 'cutoff')));
     $fave = new Fave();
     $fave->selectAdd();
     $fave->selectAdd('notice_id');
     $fave->selectAdd("{$weightexpr} as weight");
     $fave->whereAdd($cutoff);
     $fave->orderBy('weight DESC');
     $fave->groupBy('notice_id');
     if (!is_null($offset)) {
         $fave->limit($offset, $limit);
     }
     // FIXME: $since_id, $max_id are ignored
     $ids = array();
     if ($fave->find()) {
         while ($fave->fetch()) {
             $ids[] = $fave->notice_id;
         }
     }
     return $ids;
 }
開發者ID:bashrc,項目名稱:gnusocial-debian,代碼行數:23,代碼來源:popularnoticestream.php

示例2: onAppendUserActivityStreamObjects

 public function onAppendUserActivityStreamObjects(UserActivityStream $uas, array &$objs)
 {
     $fave = new Fave();
     $fave->user_id = $uas->getUser()->id;
     if (!empty($uas->after)) {
         $fave->whereAdd("modified > '" . common_sql_date($uas->after) . "'");
     }
     if ($fave->find()) {
         while ($fave->fetch()) {
             $objs[] = clone $fave;
         }
     }
     return true;
 }
開發者ID:bashrc,項目名稱:gnusocial-debian,代碼行數:14,代碼來源:FavoritePlugin.php

示例3: initFaveURI

function initFaveURI()
{
    printfnq("Ensuring all faves have a URI...");
    $fave = new Fave();
    $fave->whereAdd('uri IS NULL');
    if ($fave->find()) {
        while ($fave->fetch()) {
            try {
                $fave->decache();
                $fave->query(sprintf('update fave ' . 'set uri = "%s", ' . '    modified = "%s" ' . 'where user_id = %d ' . 'and notice_id = %d', Fave::newURI($fave->user_id, $fave->notice_id, $fave->modified), common_sql_date(strtotime($fave->modified)), $fave->user_id, $fave->notice_id));
            } catch (Exception $e) {
                common_log(LOG_ERR, "Error updated fave URI: " . $e->getMessage());
            }
        }
    }
    printfnq("DONE.\n");
}
開發者ID:Grasia,項目名稱:bolotweet,代碼行數:17,代碼來源:upgrade.php

示例4: getFaves

 function getFaves()
 {
     $faves = array();
     $fave = new Fave();
     $fave->user_id = $this->user->id;
     if (!empty($this->after)) {
         $fave->whereAdd("modified > '" . common_sql_date($this->after) . "'");
     }
     if ($fave->find()) {
         while ($fave->fetch()) {
             $faves[] = clone $fave;
         }
     }
     return $faves;
 }
開發者ID:Grasia,項目名稱:bolotweet,代碼行數:15,代碼來源:useractivitystream.php


注:本文中的Fave::whereAdd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。