diff --git a/index.php b/index.php index 1b278a6..fcd6c79 100644 --- a/index.php +++ b/index.php @@ -1,9 +1,5 @@ base_url(), $content); @@ -59,6 +77,12 @@ class Pico { return $content; } + /** + * Parses the file meta from the txt file header + * + * @param string $content the raw txt content + * @return array $headers an array of meta values + */ function read_file_meta($content) { $headers = array( @@ -78,6 +102,11 @@ class Pico { return $headers; } + /** + * Loads the config + * + * @return array $defaults an array of config values + */ function get_config() { global $config; @@ -96,6 +125,11 @@ class Pico { return $defaults; } + /** + * Helper function to work out the base URL + * + * @return string the base url + */ function base_url() { global $config; @@ -110,6 +144,11 @@ class Pico { return rtrim(str_replace($url, '', $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), '/'); } + /** + * Tries to guess the server protocol. Used in base_url() + * + * @return string the current protocol + */ function get_protocol() { preg_match("|^HTTP[S]?|is",$_SERVER['SERVER_PROTOCOL'],$m);