Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class BasePathGenerator {
- private static $isSet = false;
- private static $foundBasePath = null;
- public static function get() {
- if (self::$isSet) return self::$foundBasePath;
- if (!isset($_SERVER['REQUEST_URI'])) return false;
- $jumps = explode('/', $_SERVER['REQUEST_URI']);
- $c = count($jumps);
- $c--; //Remove first element
- $path = '';
- for ($i = 0; $i < $c; $i++) {
- $path .= '../';
- }
- self::$isSet = true;
- self::$foundBasePath = $path;
- return $path;
- }
- //end BasePathGenerator
- }
- ?>
Add Comment
Please, Sign In to add comment