Returns the attachment object

@static
@access public
@see https://pippinsplugins.com/retrieve-attachment-id-from-image-url/
@param string $url URL to the image.
@return int|string Numeric ID of the attachement.
323823
public static function get_image_id( $url ) {
		global $wpdb;
		if ( empty( $url ) ) {
			return 0;
		}

		$attachment = wp_cache_get( 'kirki_image_id_' . md5( $url ), null );
		if ( false === $attachment ) {
			$attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid = %s;", $url ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
			wp_cache_add( 'kirki_image_id_' . md5( $url ), $attachment, null );
		}

		if ( ! empty( $attachment ) ) {
			return $attachment[0];
		}
		return 0;
	}
903072
public function getVideoId($url)
    {
        // looks like there are, now let's only do this for YouTube and Vimeo
        if($this->getInfo($url)->type == 'video' && ($this->isYouTube($url) || $this->isVimeo($url)))
        {
            if ($this->isYouTube($url))
            {
                return $this->getYouTubeId($url);
            }
            else if ($this->isVimeo($url))
            {
                return $this->getVimeoId($url);
            }
        }
        else
        {
            // return empty string
            return '';
        }
    }
962611
public static function getPortFromURL($url)
	{
		$url = self::getDomainFromURL($url);
		$url = explode(':', $url);
		
		if(count($url) == 1)
		{
			return 80;
		}
		else
		{
			if(!is_numeric($url[1]))
				return 80;
			else
				return (integer) $url[1];
		}
	}
200160
public static function getLinkCount($url = false)
    {
        $data = static::getCols('2048', $url);
        return (parent::noDataDefaultValue() == $data) ? $data :
            $data['uid'];
    }
287817
public function downloadAttachment($url)
	{
		$result = $this->client->sendRequest(
			self::REQUEST_GET,
			$url,
			array(),
			null,
			$this->authentication,
			true,
			false
		);

		return $result;
	}
471699
public function fetch( $url ) {
		try {
			$new_h5p_id = \H5P_Plugin::get_instance()->fetch_h5p( $url );
		} catch ( \Throwable $e ) {
			$new_h5p_id = 0;
		}
		return $new_h5p_id;
	}
894484
public static function getRelativeUrl($url = null) {
        $url = is_null($url) ? '/'.ltrim($_SERVER['REQUEST_URI'], '/') : $url;
        $rootUrlPath	= parse_url(ROOT_URL, PHP_URL_PATH);
        $absPath		= parse_url($url, PHP_URL_PATH);
        if (substr($absPath, 0, strlen($rootUrlPath)) != $rootUrlPath ) {
            throw new ResolverException('Request Uri '.$url.' outside of TAO path '.ROOT_URL);
        }
        if ($absPath === $rootUrlPath) {
            $result = '';
        } else {
            $result = substr($absPath, strlen($rootUrlPath));
        }
        return $result;
    }
652719
public static function getRelativePath($url)
  {
    $urlParts = explode("://", $url);
    array_shift($urlParts);
    $urlPath = implode("://", $urlParts);

    return Entity::fixPath($urlPath);
  }
145569
public function downloadFileFromURL($url)
    {
        $request     = new \Google_Http_Request($url, 'GET', null, null);
        $httpRequest = $this->service->getClient()
           ->getAuth()
           ->authenticatedRequest($request);
        if ($httpRequest->getResponseHttpCode() == 200) {
            return $httpRequest->getResponseBody();
        } else {
            // An error occurred.
            return null;
        }
    }
600115
protected function getUrlContent($url)
    {
        $contents = '';
        $time = (int) self::MAX_TIMEOUT_MINS * 60;

        $timeout = stream_context_create(array(
            'http' => array(
                'timeout' => $time,
            ),
        ));
        set_time_limit($time);
        ini_set('max_execution_time', $time);

        // check if the URL is valid
        if($this->isValidUrl($url)) {
            // make sure we are not getting 404 when accessing the page
            if( (int) $this->getUrlStatus($url) != self::HTTP_NOT_OK ) {
                // ge the contents of the page
                $contents = @file_get_contents($url, false, $timeout);

                // if the contents has results
                if($contents === true) {
                    // convert encodings
                    $contents = mb_convert_encoding($contents, 'HTML-ENTITIES', self::ENCODING);
                }
            }
        }



        return $contents;
    }
1343925
public static function extractFromURL($url)
		{
			$html = file_get_contents($url);
			
			if($html === FALSE) 
			{
				return;
			}
			
			return self::extractFromHTML($html, $url);
		}
1184217
public function getDomDocument($url)
    {
        $dom = new \DOMDocument();
        @$dom->loadHTML($this->getContent($url));
        return $dom;
    }
49322
public function getAttachmentURL($url, $post_id) {
	    if ($this->skipGifs) {
	        $mimeType = get_post_mime_type($post_id);
	        if ($mimeType == 'image/gif') {
                /** @var StorageTool $storageTool */
                $storageTool = ToolsManager::instance()->tools['storage'];

                $gifURL = $storageTool->getAttachmentURL($url, $post_id);
                return $gifURL;
            }
        }

		$res = $this->buildImgixImage($post_id, 'full');
		if(!$res || !is_array($res)) {
			return $url;
		}

		$new_url = $res[0];
		if(!$new_url) {
			return $url;
		}

		return $new_url;
	}
1298787
public function getFilePath($url)
    {
        return isset($this->_file_paths[$url]) ? $this->_file_paths[$url] : null;
    }
790140
public static function getFromUrl($url)
    {
        // check is valid url
        if (!filter_var($url, FILTER_VALIDATE_URL) || !function_exists('curl_init')) {
            return null;
        }

        // initialize curl & set required options and target url
        $curl = \curl_init();
        \curl_setopt($curl, CURLOPT_URL, $url);
        if (Str::startsWith('https', $url)) {
            \curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
            \curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        }
        \curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        \curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        \curl_setopt($curl, CURLOPT_HEADER, 0);
        \curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
        \curl_setopt($curl, CURLOPT_FAILONERROR, true);
        \curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        \curl_setopt($curl, CURLOPT_AUTOREFERER, true);
        \curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        $content = \curl_exec($curl);
        \curl_close($curl);

        return $content;
    }
304716
public function url($url)
    {
        if (\is_string($url)) {
            if ('/' == $url[0]) {
                return $this->getPathToRoot().ltrim($url, '/');
            } elseif (\is_string($url)) {
                return $url;
            }
        } elseif ($url instanceof ClassDefinition) {
            return $this->url(Documentation::classUrl($url));
        } elseif ($url instanceof CompilerFile) {
            return $this->url(Documentation::classUrl($url->getClassDefinition()));
        }

        return '';
    }
312683
public function getImageUrl($size = 'thumbnail')
    {
        $res = wp_get_attachment_image_src($this->getId(), $size);
        return $res && isset($res[0]) ? $res[0] : null;
    }