Exemple #1
0
<?php

$this->setTitle("Site Compressor");
?>
<div class="contents" style="margin-top: 100px;">
  <center>
    <div style="margin-bottom: 20px;">
      <a class="button" href="<?php 
echo \Lobby\App::u("/site");
?>
"><h2>Compress A Site</h2></a>
    </div>
    <div style="margin-bottom: 20px;">
      <a class="button"  href="<?php 
echo \Lobby\App::u("/html");
?>
">Compress Hyper Text Markup Language (HTML)</a>
    </div>
    <a class="button" href="<?php 
echo \Lobby\App::u("/css");
?>
">Compress Cascading Style Sheet (CSS)</a>
    <a class="button" href="<?php 
echo \Lobby\App::u("/js");
?>
">Compress JavaScript (JS)</a>
  </center>
</div>
Exemple #2
0
 /**
  * Make a URL from Lobby Base. Eg: /hello to http://lobby.dev/lobby/hello
  */
 public static function u($path = "", $relative = false)
 {
     $orPath = $path;
     // The original path
     $path = substr($path, 0, 1) == "/" ? substr($path, 1) : $path;
     $url = $path;
     $parts = parse_url($path);
     if ($path == "") {
         /**
          * If no path, give the current page URL
          */
         $pageURL = 'http';
         if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
             $pageURL .= "s";
         }
         $pageURL .= "://";
         $request_uri = $relative === false ? $_SERVER["ORIG_REQUEST_URI"] : $_SERVER["REQUEST_URI"];
         if ($_SERVER["SERVER_PORT"] != "80") {
             $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $request_uri;
         } else {
             $pageURL .= $_SERVER["SERVER_NAME"] . $request_uri;
         }
         $url = $pageURL;
     } elseif ($path == L_URL) {
         $url = L_URL;
     } elseif (!preg_match("/http/", $path) || $parts['host'] != $_SERVER['HTTP_HOST']) {
         if (!defined("APP_DIR") || substr($orPath, 0, 1) == "/") {
             $url = L_URL . "/{$path}";
         } else {
             $url = \Lobby\App::u($orPath);
         }
     }
     return $url;
 }