/**
 * Checks if the given url is a local or external one
 *
 * @since 1.8.2
 */
function wprss_ftp_is_url_local( $url, $home_url = null ) {
	if ( is_null( $home_url) )
		$home_url = get_option( 'siteurl' );

	// What about the URLs are we comparing?
	$relevant_parts = array( 'host', 'path' );

	// Get the site's url
	$siteurl = trim( WPRSS_FTP_Utils::rebuild_url( $home_url, $relevant_parts ), '/');
	// The URL in question
	$url = trim( WPRSS_FTP_Utils::rebuild_url( WPRSS_FTP_Utils::encode_and_parse_url( $url ), $relevant_parts , '/'));

	return strpos( $url, $siteurl ) === 0;
}