static function run() { $self = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $path_self = @$_SERVER['PATH_TRANSLATED'] ?: $_SERVER['SCRIPT_FILENAME']; $a = strlen($self); $b = strlen($path_self); $i = 0; while ($self[$a - $i - 1] == $path_self[$b - $i - 1] && $i < 1000) { $i++; } if ($i == 0) { return; } self::$base_url = substr($self, 0, strlen($self) - $i); self::$base_path = substr($path_self, 0, strlen($path_self) - $i); self::$tea = isset($_GET['tea']); $urls = $_REQUEST['url']; if (!is_array($urls)) { $urls = array($urls); } foreach ($urls as $url) { self::process($url); } echo json_encode(self::$cache); }