/** * Get/parse path + query string parameters * * @return array */ public static function parseParameters() { self::cachingHeaders(); // Verify if the browser has a cached version self::$requestPath = self::requestPath(); self::$queryString = self::queryString(); if (self::$requestPath) { // Merge two arrays // Order is important ! The query string shouldn't erase request path ! $config = array_merge(self::$queryString, self::$requestPath); self::$config = $config; return true; } return false; }
<?php /** * Image placeholder * @copyright Copyright 2012, Guillaume Lafarge http://guillaumelafarge.fr */ /** * Required classes */ require 'class/PlaceholderRequest.php'; require 'class/PlaceholderImage.php'; /** * Here's where all the magic happens :) */ // A good query makes me happy if (PlaceholderRequest::parseParameters()) { $placeholder = new PlaceholderImage(PlaceholderRequest::$config); if (isset($_GET['forceDownload'])) { $placeholder->forceDownload(); } else { $placeholder->output(); } } /** * Home page */ include 'home.php';