select()->where('table.contents.type = ? OR (table.contents.type = ? AND table.contents.parent = ?)', 'page', 'page_draft', 0); /** 过滤标题 */ if (NULL != ($keywords = $this->request->keywords)) { $args = array(); $keywordsList = explode(' ', $keywords); $args[] = implode(' OR ', array_fill(0, count($keywordsList), 'table.contents.title LIKE ?')); foreach ($keywordsList as $keyword) { $args[] = '%' . Typecho_Common::filterSearchQuery($keyword) . '%'; } call_user_func_array(array($select, 'where'), $args); } /** 提交查询 */ $select->order('table.contents.order', Typecho_Db::SORT_ASC); $this->db->fetchAll($select, array($this, 'push')); } }