src/tools/web/PingBack.php
protected function enabled($url) {
		$web=Web::instance();
		$req=$web->request($url);
		$found=FALSE;
		if ($req && $req['body']) {
			// Look for pingback header
			foreach ($req['headers'] as $header)
				if (preg_match('/^X-Pingback:\h*(.+)/',$header,$href)) {
					$found=$href[1];
					break;
				}
			if (!$found &&
				// Scan page for pingback link tag
				preg_match('/<link\h+(.+?)\h*\/?>/i',$req['body'],$parts) &&
				preg_match('/rel\h*=\h*"pingback"/i',$parts[1]) &&
				preg_match('/href\h*=\h*"\h*(.+?)\h*"/i',$parts[1],$href))
				$found=$href[1];
		}
		return $found;
	}
protected function enabled($url) {
		$web=Web::instance();
		$req=$web->request($url);
		$found=FALSE;
		if ($req && $req['body']) {
			// Look for pingback header
			foreach ($req['headers'] as $header)
				if (preg_match('/^X-Pingback:\h*(.+)/',$header,$href)) {
					$found=$href[1];
					break;
				}
			if (!$found &&
				// Scan page for pingback link tag
				preg_match('/<link\h+(.+?)\h*\/?>/i',$req['body'],$parts) &&
				preg_match('/rel\h*=\h*"pingback"/i',$parts[1]) &&
				preg_match('/href\h*=\h*"\h*(.+?)\h*"/i',$parts[1],$href))
				$found=$href[1];
		}
		return $found;
	}
protected function enabled ( $ url ) { $ web = Web :: instance ( ) ; $ req = $ web -> request ( $ url ) ; $ found = FALSE ; if ( $ req && $ req [ 'body' ] ) { // Look for pingback header foreach ( $ req [ 'headers' ] as $ header ) if ( preg_match ( '/^X-Pingback:\h*(.+)/' , $ header , $ href ) ) { $ found = $ href [ 1 ] ; break ; } if ( ! $ found && // Scan page for pingback link tag preg_match ( '/<link\h+(.+?)\h*\/?>/i' , $ req [ 'body' ] , $ parts ) && preg_match ( '/rel\h*=\h*"pingback"/i' , $ parts [ 1 ] ) && preg_match ( '/href\h*=\h*"\h*(.+?)\h*"/i' , $ parts [ 1 ] , $ href ) ) $ found = $ href [ 1 ] ; } return $ found ; }
Return TRUE if URL points to a pingback-enabled resource
@return bool
@param $url
Return TRUE if URL points to a pingback - enabled resource