本文整理汇总了PHP中ItemList::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP ItemList::populate方法的具体用法?PHP ItemList::populate怎么用?PHP ItemList::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::populate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __exp__getFeedContent
function __exp__getFeedContent($cid)
{
$cid = sanitize($cid, RSS_SANITIZER_NUMERIC);
ob_start();
rss_require('cls/items.php');
$readItems = new ItemList();
$readItems->populate(" not(i.unread & " . RSS_MODE_UNREAD_STATE . ") and i.cid= {$cid}", "", 0, 2, ITEM_SORT_HINT_READ);
$readItems->setTitle(__('Recent items'));
$readItems->setRenderOptions(IL_TITLE_NO_ESCAPE);
foreach ($readItems->feeds[0]->items as $item) {
$item->render();
}
$c = ob_get_contents();
ob_end_clean();
return "{$cid}|@|{$c}";
}
示例2: trim
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
# http://www.gnu.org/licenses/gpl.html
#
###############################################################################
# E-mail: mbonetti at gmail dot com
# Web page: http://gregarius.net/
#
###############################################################################
require_once 'init.php';
$a = trim(sanitize($_REQUEST['author'], RSS_SANITIZER_WORDS));
$sql = "select distinct(author) from " . getTable('item') . " where author like '%{$a}'";
list($ra) = rss_fetch_row(rss_query($sql));
if (!$ra) {
rss_404();
exit;
}
$t = ucfirst(__('items')) . " " . __(' by ') . " " . $ra;
$GLOBALS['rss']->header = new Header($t);
$GLOBALS['rss']->feedList = new FeedList(false);
$authorItems = new ItemList();
$sqlWhere = " i.author like '%{$a}' ";
$numItems = getConfig('rss.output.frontpage.numitems');
$authorItems->populate($sqlWhere, "", 0, $numItems);
$authorItems->setTitle($t);
$authorItems->setRenderOptions(IL_NO_COLLAPSE | IL_TITLE_NO_ESCAPE);
$GLOBALS['rss']->appendContentObject($authorItems);
$GLOBALS['rss']->renderWithTemplate('index.php', 'items');
示例3: populate
function populate()
{
if (!$this->query) {
return;
}
$this->matchMode = sanitize(!array_key_exists(QUERY_MATCH_MODE, $_REQUEST) ? QUERY_MATCH_AND : $_REQUEST[QUERY_MATCH_MODE], RSS_SANITIZER_CHARACTERS_EXT);
$this->matchType = sanitize(!array_key_exists(QUERY_MATCH_TYPE, $_REQUEST) ? "" : $_REQUEST[QUERY_MATCH_TYPE], RSS_SANITIZER_CHARACTERS_EXT);
$this->channelId = sanitize(array_key_exists(QUERY_CHANNEL, $_REQUEST) ? $_REQUEST[QUERY_CHANNEL] : ALL_CHANNELS_ID, RSS_SANITIZER_NUMERIC);
if (!$this->resultsPerPage) {
$this->resultsPerPage = sanitize(array_key_exists(QUERY_RESULTS, $_REQUEST) ? $_REQUEST[QUERY_RESULTS] : 15, RSS_SANITIZER_NUMERIC);
}
$this->currentPage = sanitize(array_key_exists(QUERY_CURRENT_PAGE, $_REQUEST) ? $_REQUEST[QUERY_CURRENT_PAGE] : 0, RSS_SANITIZER_NUMERIC);
$this->startItem = $this->resultsPerPage * $this->currentPage;
$this->endItem = $this->startItem + $this->resultsPerPage - 1;
if ($this->resultsPerPage == INFINE_RESULTS) {
$this->endItem = 99999999;
}
$this->orderBy = sanitize(array_key_exists(QUERY_ORDER_BY, $_REQUEST) ? $_REQUEST[QUERY_ORDER_BY] : QUERY_ORDER_BY_DATE, RSS_SANITIZER_CHARACTERS_EXT);
$qWhere = "";
$this->regMatch = "";
$term = "";
if ($this->matchMode == QUERY_MATCH_OR || $this->matchMode == QUERY_MATCH_AND) {
$this->logicSep = $this->matchMode == QUERY_MATCH_OR ? "or" : "and";
$this->searchTerms = explode(" ", $this->query);
foreach ($this->searchTerms as $term) {
$term = trim($term);
if ($term != "") {
$qWhere .= "(i.description like '%{$term}%' or " . " i.title like '%{$term}%') " . $this->logicSep;
}
// this will be used later for the highliting regexp
if ($this->regMatch != "") {
$this->regMatch .= "|";
}
$this->regMatch .= $term;
}
$qWhere .= $this->matchMode == QUERY_MATCH_OR ? " 1=0 " : " 1=1 ";
} else {
$this->logicSep = "";
$this->searchTerms[0] = $this->query;
$term = $this->query;
$qWhere .= "(i.description like '%{$term}%' or " . " i.title like '%{$term}%') ";
$this->regMatch = $this->query;
}
$qWhere = "(" . $qWhere . ") ";
if ($this->channelId != ALL_CHANNELS_ID) {
$qWhere .= " and c.id = " . $this->channelId . " ";
}
if (hidePrivate()) {
$qWhere .= " and not(i.unread & " . RSS_MODE_PRIVATE_STATE . ") ";
}
$qWhere .= " and not(i.unread & " . RSS_MODE_DELETED_STATE . ") ";
if (array_key_exists(QUERY_MATCH_STATE, $_REQUEST) && QUERY_MATCH_READ == $_REQUEST[QUERY_MATCH_STATE]) {
// Show only read items.
$qWhere .= " and not (i.unread & " . RSS_MODE_UNREAD_STATE . ") ";
} else {
if (array_key_exists(QUERY_MATCH_STATE, $_REQUEST) && QUERY_MATCH_UNREAD == $_REQUEST[QUERY_MATCH_STATE]) {
// Show only unread items.
$qWhere .= " and (i.unread & " . RSS_MODE_UNREAD_STATE . ") ";
}
}
if ($this->orderBy == QUERY_ORDER_BY_DATE) {
$qOrder = " ts desc";
} else {
if (getConfig('rss.config.absoluteordering')) {
$qOrder = " f.position asc, c.position asc";
} else {
$qOrder = " f.name asc, c.title asc";
}
}
$qOrder .= ", i.added desc";
parent::populate($qWhere, $qOrder, 0, getConfig("rss.search.maxitems"), ITEM_SORT_HINT_MIXED, true);
$this->filterItems();
$this->nav();
}
示例4: populate
function populate($sqlWhere, $sqlOrder = "", $startItem = 0, $itemCount = -1, $hint = ITEM_SORT_HINT_MIXED, $includeDeprecated = false)
{
$si = $this->page * $this->itemsPerPage;
parent::populate($sqlWhere, $sqlOrder, $si, $itemCount > 0 ? $this->itemsPerPage : $itemCount, $hint, $includeDeprecated);
$sql = "select count(*) as cnt " . " from " . $this->_sqlActualFrom . " where " . $this->_sqlActualWhere;
list($this->numItems) = rss_fetch_row(rss_query($sql));
if ($this->itemsPerPage && $this->numItems > $this->itemsPerPage) {
$this->navigation = new ItemListNavigation($this);
}
}