/** * Read meta from an array * Bypassing walking the sitemap * * @param array $request Page meta key * @param array $page Page meta array * @return mixed */ public static function meta($request, $meta) { // If all are sought if ($request == 'all') { return $meta; // Does the page exist? } elseif ($request == 'exists') { // If there is no entry if (isset($meta['not_found']) && $meta['not_found']) { return FALSE; // If it's just a menu item } elseif (isset($meta['href']) && $meta['href']) { return FALSE; } else { return TRUE; } // If it's set return it. } elseif (isset($meta[$request])) { return $meta[$request]; } // The meta has not been explicitly set so lets estimate it switch ($request) { case 'title': if (isset($meta['slug'])) { return Str::title($meta['slug']); } else { Log::write('error', 'page has no slug.. Something has been configured incorrectly.'); return 'Error'; } break; case 'hidden': // If the page requires authentication and the user is NOT logged in if (isset($meta['auth']) && $meta['auth'] && !Xysti::user_check()) { return TRUE; // Else if the page is disabled } elseif (isset($meta['disabled']) && $meta['disabled']) { return TRUE; } case 'href': break; } //Log::write('debug', 'Could not find Xysti::meta(' . $request . ') at ' . URI::current() . '.'); return FALSE; }