private function filterHref($matches) {

		static $script;
		static $observeRewrite;

		if(is_null($script)) {
			$script = trim(Request::createFromGlobals()->getScriptName(), '/');
		}

		if(is_null($observeRewrite)) {
            $observeRewrite = Application::getInstance()->getRouter()->getServerSideRewrite();
		}

		$matches[4] = html_entity_decode($matches[4]);

		$uriParts = [];

		if($observeRewrite) {
			if($script !== 'index.php') {
				$uriParts[] = basename($script, '.php');
			}
		}
		else {
			$uriParts[] = $script;
		}

		if($matches[3] !== '') {
			$uriParts[] = $matches[3];
		}

		$uri = implode('/', $uriParts) . $matches[4];

		return "<a{$matches[1]} href={$matches[2]}/$uri{$matches[2]}{$matches[5]}>";
	}
private function filterHref($matches) {

		static $script;
		static $observeRewrite;

		if(is_null($script)) {
			$script = trim(Request::createFromGlobals()->getScriptName(), '/');
		}

		if(is_null($observeRewrite)) {
            $observeRewrite = Application::getInstance()->getRouter()->getServerSideRewrite();
		}

		$matches[4] = html_entity_decode($matches[4]);

		$uriParts = [];

		if($observeRewrite) {
			if($script !== 'index.php') {
				$uriParts[] = basename($script, '.php');
			}
		}
		else {
			$uriParts[] = $script;
		}

		if($matches[3] !== '') {
			$uriParts[] = $matches[3];
		}

		$uri = implode('/', $uriParts) . $matches[4];

		return "<a{$matches[1]} href={$matches[2]}/$uri{$matches[2]}{$matches[5]}>";
	}
private function filterHref ( $ matches ) { static $ script ; static $ observeRewrite ; if ( is_null ( $ script ) ) { $ script = trim ( Request :: createFromGlobals ( ) -> getScriptName ( ) , '/' ) ; } if ( is_null ( $ observeRewrite ) ) { $ observeRewrite = Application :: getInstance ( ) -> getRouter ( ) -> getServerSideRewrite ( ) ; } $ matches [ 4 ] = html_entity_decode ( $ matches [ 4 ] ) ; $ uriParts = [ ] ; if ( $ observeRewrite ) { if ( $ script !== 'index.php' ) { $ uriParts [ ] = basename ( $ script , '.php' ) ; } } else { $ uriParts [ ] = $ script ; } if ( $ matches [ 3 ] !== '' ) { $ uriParts [ ] = $ matches [ 3 ] ; } $ uri = implode ( '/' , $ uriParts ) . $ matches [ 4 ] ; return "<a{$matches[1]} href={$matches[2]}/$uri{$matches[2]}{$matches[5]}>" ; }
callback to turn href shortcuts into site conform valid URLs

$/foo/bar?baz=1 becomes /foo/bar?baz=1 or index.php/foo/bar?baz=1

@param array $matches
@return string
callback to turn href shortcuts into site conform valid URLs