webDebug->getOption('request_parameters'); if (!isset($parameters['check_links'])) { return; } return 'Links'; } public function getPanelTitle() { return 'Links'; } public function getPanelContent() { $content = ''; $response = sfContext::getInstance()->getResponse(); $rspContent = $response->getContent(); $pattern = '/(href|src)=[\'"]?([^\'" >]+)[\'" >]/'; $allOk = true; if ( preg_match_all($pattern, $rspContent, $matches) ) { $content .= ''; } if ( ! $allOk ) { $this->setStatus(sfLogger::ERR); } return $content; } public static function listenToLoadDebugWebPanelEvent(sfEvent $event) { $event->getSubject()->setPanel( 'linkchecker', new self($event->getSubject()) ); } function httpHeadCurl($url) { if (!extension_loaded('curl_init') || !function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); return $result; } throw new Exception("Curl extension not enabled" ); } }