includes/class-parse-this-html.php
private static function limit_img( $src, $source_url ) {
		$src = self::limit_url( $src, $source_url );

		if ( preg_match( '!/ad[sx]?/!i', $src ) ) {
			// Ads
			return '';
		} elseif ( preg_match( '!(/share-?this[^.]+?\.[a-z0-9]{3,4})(\?.*)?$!i', $src ) ) {
			// Share-this type button
			return '';
		} elseif ( preg_match( '!/(spinner|loading|spacer|blank|rss)\.(gif|jpg|png)!i', $src ) ) {
			// Loaders, spinners, spacers
			return '';
		} elseif ( preg_match( '!/([^./]+[-_])?(spinner|loading|spacer|blank)s?([-_][^./]+)?\.[a-z0-9]{3,4}!i', $src ) ) {
			// Fancy loaders, spinners, spacers
			return '';
		} elseif ( preg_match( '!([^./]+[-_])?thumb[^.]*\.(gif|jpg|png)$!i', $src ) ) {
			// Thumbnails, too small, usually irrelevant to context
			return '';
		} elseif ( false !== stripos( $src, '/wp-includes/' ) ) {
			// Classic WordPress interface images
			return '';
		} elseif ( false !== stripos( $src, '/wp-content/themes' ) ) {
			// Anything within a WordPress theme directory
			return '';
		} elseif ( false !== stripos( $src, '/wp-content/plugins' ) ) {
			// Anything within a WordPress plugin directory
			return '';
		} elseif ( preg_match( '![^\d]\d{1,2}x\d+\.(gif|jpg|png)$!i', $src ) ) {
			// Most often tiny buttons/thumbs (< 100px wide)
			return '';
		} elseif ( preg_match( '!/pixel\.(mathtag|quantserve)\.com!i', $src ) ) {
			// See mathtag.com and https://www.quantcast.com/how-we-do-it/iab-standard-measurement/how-we-collect-data/
			return '';
		} elseif ( preg_match( '!/[gb]\.gif(\?.+)?$!i', $src ) ) {
			// WordPress.com stats gif
			return '';
		}
		// Optionally add additional limits
		return apply_filters( 'parse_this_img_filters', $src );
	}
private static function limit_img( $src, $source_url ) {
		$src = self::limit_url( $src, $source_url );

		if ( preg_match( '!/ad[sx]?/!i', $src ) ) {
			// Ads
			return '';
		} elseif ( preg_match( '!(/share-?this[^.]+?\.[a-z0-9]{3,4})(\?.*)?$!i', $src ) ) {
			// Share-this type button
			return '';
		} elseif ( preg_match( '!/(spinner|loading|spacer|blank|rss)\.(gif|jpg|png)!i', $src ) ) {
			// Loaders, spinners, spacers
			return '';
		} elseif ( preg_match( '!/([^./]+[-_])?(spinner|loading|spacer|blank)s?([-_][^./]+)?\.[a-z0-9]{3,4}!i', $src ) ) {
			// Fancy loaders, spinners, spacers
			return '';
		} elseif ( preg_match( '!([^./]+[-_])?thumb[^.]*\.(gif|jpg|png)$!i', $src ) ) {
			// Thumbnails, too small, usually irrelevant to context
			return '';
		} elseif ( false !== stripos( $src, '/wp-includes/' ) ) {
			// Classic WordPress interface images
			return '';
		} elseif ( false !== stripos( $src, '/wp-content/themes' ) ) {
			// Anything within a WordPress theme directory
			return '';
		} elseif ( false !== stripos( $src, '/wp-content/plugins' ) ) {
			// Anything within a WordPress plugin directory
			return '';
		} elseif ( preg_match( '![^\d]\d{1,2}x\d+\.(gif|jpg|png)$!i', $src ) ) {
			// Most often tiny buttons/thumbs (< 100px wide)
			return '';
		} elseif ( preg_match( '!/pixel\.(mathtag|quantserve)\.com!i', $src ) ) {
			// See mathtag.com and https://www.quantcast.com/how-we-do-it/iab-standard-measurement/how-we-collect-data/
			return '';
		} elseif ( preg_match( '!/[gb]\.gif(\?.+)?$!i', $src ) ) {
			// WordPress.com stats gif
			return '';
		}
		// Optionally add additional limits
		return apply_filters( 'parse_this_img_filters', $src );
	}
private static function limit_img ( $ src , $ source_url ) { $ src = self :: limit_url ( $ src , $ source_url ) ; if ( preg_match ( '!/ad[sx]?/!i' , $ src ) ) { // Ads return '' ; } elseif ( preg_match ( '!(/share-?this[^.]+?\.[a-z0-9]{3,4})(\?.*)?$!i' , $ src ) ) { // Share-this type button return '' ; } elseif ( preg_match ( '!/(spinner|loading|spacer|blank|rss)\.(gif|jpg|png)!i' , $ src ) ) { // Loaders, spinners, spacers return '' ; } elseif ( preg_match ( '!/([^./]+[-_])?(spinner|loading|spacer|blank)s?([-_][^./]+)?\.[a-z0-9]{3,4}!i' , $ src ) ) { // Fancy loaders, spinners, spacers return '' ; } elseif ( preg_match ( '!([^./]+[-_])?thumb[^.]*\.(gif|jpg|png)$!i' , $ src ) ) { // Thumbnails, too small, usually irrelevant to context return '' ; } elseif ( false !== stripos ( $ src , '/wp-includes/' ) ) { // Classic WordPress interface images return '' ; } elseif ( false !== stripos ( $ src , '/wp-content/themes' ) ) { // Anything within a WordPress theme directory return '' ; } elseif ( false !== stripos ( $ src , '/wp-content/plugins' ) ) { // Anything within a WordPress plugin directory return '' ; } elseif ( preg_match ( '![^\d]\d{1,2}x\d+\.(gif|jpg|png)$!i' , $ src ) ) { // Most often tiny buttons/thumbs (< 100px wide) return '' ; } elseif ( preg_match ( '!/pixel\.(mathtag|quantserve)\.com!i' , $ src ) ) { // See mathtag.com and https://www.quantcast.com/how-we-do-it/iab-standard-measurement/how-we-collect-data/ return '' ; } elseif ( preg_match ( '!/[gb]\.gif(\?.+)?$!i' , $ src ) ) { // WordPress.com stats gif return '' ; } // Optionally add additional limits return apply_filters ( 'parse_this_img_filters' , $ src ) ; }
Utility method to limit image source URLs.

Excluded URLs include share-this type buttons, loaders, spinners, spacers, WordPress interface images,
tiny buttons or thumbs, mathtag.com or quantserve.com images, or the WordPress.com stats gif.


@param string $src Image source URL.
@return string If not matched an excluded URL type, the original URL, empty string otherwise.
Utility method to limit image source URLs .