public function is_external_file( $file_url ) {

        // Set default return value.
        $is_external_file = false;

        // Parse url.
        $parsed_file_url = parse_url( $file_url );

        // Parse site url.
        $parsed_site_url = parse_url( site_url() );

        // Check if hosts don't match.
        if ( $parsed_file_url[ 'host' ] !== $parsed_site_url[ 'host' ] ) {

            // We now know the file is externally hosted.
            $is_external_file = true;

        }

        return $is_external_file;

    }
public function is_external_file( $file_url ) {

        // Set default return value.
        $is_external_file = false;

        // Parse url.
        $parsed_file_url = parse_url( $file_url );

        // Parse site url.
        $parsed_site_url = parse_url( site_url() );

        // Check if hosts don't match.
        if ( $parsed_file_url[ 'host' ] !== $parsed_site_url[ 'host' ] ) {

            // We now know the file is externally hosted.
            $is_external_file = true;

        }

        return $is_external_file;

    }
public function is_external_file ( $ file_url ) { // Set default return value. $ is_external_file = false ; // Parse url. $ parsed_file_url = parse_url ( $ file_url ) ; // Parse site url. $ parsed_site_url = parse_url ( site_url ( ) ) ; // Check if hosts don't match. if ( $ parsed_file_url [ 'host' ] !== $ parsed_site_url [ 'host' ] ) { // We now know the file is externally hosted. $ is_external_file = true ; } return $ is_external_file ; }
Determines if a file is externally hosted based on url.

@param string $file_url File url.
@return boolean Whether a file is externally hosted or not.
Determines if a file is externally hosted based on url .