getDB(); foreach ($pagesKey as $pageKey) { try { $page = new Page($pageKey); // Check page status if ($page->published() || $page->sticky() || $page->isStatic()) { // Check if the query contains in the title $lowerTitle = Text::lowercase($page->title()); if (Text::stringContains($lowerTitle, $query)) { $tmp = array('disabled'=>false); $tmp['id'] = $page->key(); $tmp['text'] = $page->title(); $tmp['type'] = $page->type(); array_push($result, $tmp); } } } catch (Exception $e) { // continue } } exit (json_encode(array('results'=>$result))); ?>