public static function filter($url) { // dump($url); $url = trim($url); if (strpos(strtolower($url), 'javascript') === 0 || $url[0] == '#' || strpos($url, 'mailto') === 0 || strpos($url, 'data') === 0 || strpos($url, 'tel') === 0) { Logger::info('过虑掉url: ' . $url); return false; } // 不同域名 $url_info = parse_url($url); if (!empty($url_info['host']) && $url_info['host'] != self::$reference['host']) { return false; } return $url; }
private function _makePath() { $path = $this['path']; // dump($path); if (empty($path)) { $path = '/index.html'; } if ($path[strlen($path) - 1] == '/') { $path .= 'index.html'; } $dir = $this->dir . $path; $dirname = dirname($dir); if (file_exists($dir) && is_file($dir)) { Logger::info('文件已存在: ' . $dir); return false; } elseif (!is_dir($dirname)) { $res = mkdir_recursive($dirname); if ($res === false) { Logger::debug('创建目录失败: ' . $dirname); return false; } } return $dir; }