public static function node_matches($node) { // Is this an image node? if (('img' == $node->nodeName || 'figure' == $node->nodeName) && self::remote_file_exists($node)) { return $node; } return null; }