function WikiDB_backend_dumb_TextSearchIter(&$backend, &$pages, $search, $fulltext = false, $options = array()) { $this->_backend =& $backend; $this->_pages = $pages; $this->_fulltext = $fulltext; $this->_search =& $search; $this->_index = 0; $this->_stoplist =& $search->_stoplist; $this->stoplisted = array(); $this->_from = 0; if (isset($options['limit'])) { // extract from,count from limit list($this->_from, $this->_count) = WikiDB_backend::limit($options['limit']); } else { $this->_count = 0; } if (isset($options['exclude'])) { $this->_exclude = $options['exclude']; } else { $this->_exclude = false; } }
function WikiDB_backend_dbaBase_pageiter(&$backend, &$pages, $options = false) { $this->_backend = $backend; $this->_options = $options; if ($pages) { if (!empty($options['sortby'])) { $sortby = WikiDB_backend::sortby($options['sortby'], 'db', array('pagename', 'mtime')); // check for which column to sortby if ($sortby and !strstr($sortby, "hits ")) { usort($pages, 'WikiDB_backend_dbaBase_sortby_' . str_replace(' ', '_', $sortby)); } } if (!empty($options['limit'])) { list($offset, $limit) = WikiDB_backend::limit($options['limit']); $pages = array_slice($pages, $offset, $limit); } $this->_pages = $pages; } else { $this->_pages = array(); } }
function addPageList(&$list) { if (empty($list)) { return; } // Protect reset from a null arg if (isset($this->_options['limit'])) { // extract from,count from limit list($from, $limit) = WikiDB_backend::limit($this->_options['limit']); $limit += $from; } else { $limit = 0; } $this->_options['slice'] = 0; $i = 0; foreach ($list as $page) { $i++; if ($from and $i < $from) { continue; } if (!$limit or $limit and $i < $limit) { if (is_object($page)) { $page = $page->_pagename; } $this->addPage((string) $page); } } }