Determines if an asset is an embedded asset or not.

@deprecated Will be removed in next major version. Use the `get` method instead.

@param Asset $asset
@return bool
511325
public function isEmbedded(Asset $asset): bool
	{
		Craft::$app->getDeprecator()->log('craft.embeddedAssets.isEmbedded', "The template method `craft.embeddedAssets.isEmbedded` is now deprecated. Use `craft.embeddedAssets.get` instead.");

		return (bool)EmbeddedAssets::$plugin->methods->getEmbeddedAsset($asset);
	}
335581
public function removeTransformsForAsset(Asset $asset)
    {
        $config = self::getConfig();

        try {
            $sourceModel = new LocalSourceImageModel($asset);
            $targetModel = new LocalTargetImageModel($sourceModel, []);

            if (strpos($targetModel->path, $config->imagerSystemPath) !== false) {
                try {
                    FileHelper::clearDirectory(FileHelper::normalizePath($targetModel->path));
                } catch (ErrorException $e) {
                    Craft::error('Could not clear directory "'.$targetModel->path.'" ('.$e->getMessage().')', __METHOD__);
                } catch (InvalidParamException $e) {
                    Craft::error('Could not clear directory "'.$targetModel->path.'" ('.$e->getMessage().')', __METHOD__);
                }

                Craft::$app->templateCaches->deleteCachesByElementId($asset->id);

                if ($sourceModel->type !== 'local' && file_exists($sourceModel->getFilePath())) {
                    try {
                        FileHelper::unlink($sourceModel->getFilePath());
                    } catch (ErrorException $e) {
                        Craft::error('Could not remove file "'.$sourceModel->getFilePath().'" ('.$e->getMessage().')', __METHOD__);
                    }
                }
            }
        } catch (ImagerException $e) {
            Craft::error($e->getMessage(), __METHOD__);
        }
    }
11844
public function getAsset($assetType, $assetHandle)
    {
        return isset($this->assets[$assetType][$assetHandle]) ? $this->assets[$assetType][$assetHandle] : null;
    }
299956
public function process(array $asset)
	{
		// Any dependencies that need processing?
		$dependencies = isset($asset['dependencies']) ? $asset['dependencies'] : array();
		$dependencies = array_unique(array_merge(array_get($this->dependencies, $asset['ext'], array()), $dependencies));
		if (!empty($dependencies)) {
			foreach ($dependencies as $dep_source) {
				if ($asset['source'] == $dep_source) {
					continue;
				}
				
				$this->process(array(
					'source' => $dep_source,
					'ext'    => pathinfo($dep_source, PATHINFO_EXTENSION),
				));
			}
		}
		
		$path        = $this->path($asset['source']);
		$public_path = $this->publicPath($asset);
		
		if (empty(static::$processed[$asset['source']]) && $this->needsProcessing($asset)) {
			if (File::exists($path)) {
				File::put($public_path, $this->compile($path));
			}
		}
		
		$asset['path'] = $public_path;
		$asset['url']  = str_ireplace($this->public_path, '', $public_path);
		
		static::$processed[$asset['source']] = true;
		
		return $asset;
	}
834036
public function removeAsset(Asset $asset): bool
    {
        if ($asset->getAssetCollections()->contains($this) === false) {
            $this->assets->removeElement($asset);
            return true;
        }
        return false;
    }
859843
protected function locateResource($asset = null)
    {
        if (null === $asset) {
            $asset = $this->asset;
        }

        $asset = $this->normalizePath($asset);
        if(\substr($asset, 0, 1) != '@') $asset = '@' . $asset;

        try
        {
            // Fetches the relative resource to locate from asset
            preg_match('/(@[^\/]+)?([\w\/\.\-_]+)?/', $asset, $match);
            if (empty($match[1])) {
                return;
            }

            $resource = $this->kernel->locateResource($match[1]);
            
            $resourceLength = strlen($resource) - 1;
            if (substr($resource, $resourceLength, 1) == '/') $resource = substr($resource, 0, $resourceLength);

            return (isset($match[2])) ? $resource . $match[2] : $resource;
        }
        catch(\Exception $e)
        {
            return null;
        }
    }
221841
def should_add_tenant_theme_to_asset?(asset)
      if asset.is_a? String
        return true if (! asset.match /^http:\/\//) && (! asset.match /^\//)
      end
      false
    end
839513
protected function getAssetScheme($asset)
    {
        if (starts_with($asset, ['//', 'http://', 'https://'])) {
            return $asset;
        }

        if (substr($asset, 0, 1) == '/') {
            $asset = Url::asset($asset);
        }

        return $asset;
    }
97426
protected function findLocalizedAsset($locale, $asset)
    {
        $localized = $this->doFindLocalizedAsset($locale, $asset);

        if (0 === \count($localized)) {
            $localized = $this->doFindLocalizedAsset($this->getFallbackLocale(), $asset);
        }

        return $localized;
    }
846070
public function filterDump(AssetInterface $asset)
    {
        $this->assetDirectory = $this->realPath($asset->getSourceRoot());

        $content = $asset->getContent();

        // Spin through the symlinks and normalize them. We'll first unset the original
        // symlink so that it doesn't clash with the new symlinks once they are added
        // back in.
        foreach ($this->symlinks as $link => $target)
        {
            unset($this->symlinks[$link]);

            if ($link == '//')
            {
                $link = $this->documentRoot;
            }
            else
            {
                $link = str_replace('//', $this->documentRoot.'/', $link);
            }

            $link = strtr($link, '/', DIRECTORY_SEPARATOR);

            $this->symlinks[$link] = $this->realPath($target);
        }

        $content = $this->trimUrls($content);

        $content = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/', array($this, 'processUriCallback'), $content);

        $content = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/', array($this, 'processUriCallback'), $content);

        $asset->setContent($content);
    }
1055968
public function url($asset)
    {   
        $url = $this->parsePathAlias($asset, false);

        return $this->buildUrl($url);
    }
452658
public function import (Asset $asset) : Asset
    {
        $fileContent = $this->fileLoader->loadFile($asset, FileLoader::MODE_PROD);
        $fileType = $this->fileTypeRegistry->getFileType($asset);

        $asset->setHash(
            \base64_encode(\hash("sha256", $fileContent, true)),
            $fileType->shouldIncludeHashInFileName()
        );

        $outputPath = "{$this->storagePath}/{$asset->getNamespace()}/{$asset->getDumpFilePath()}";

        // ensure that the target directory exists
        $this->filesystem->mkdir(dirname($outputPath));

        // copy file
        $this->filesystem->dumpFile($outputPath, $fileContent);

        if ($fileType->shouldBeGzipCompressed())
        {
            $this->compression->compressFile($outputPath);
        }

        return $asset;
    }
456374
public function addAsset(Asset $asset): bool
    {
        if ($asset->getAssetCollections()->contains($this) === false) {
            $this->assets->add($asset);
            return true;
        }

        return false;
    }
1061888
public function findMainAsset($asset)
    {
        if (file_exists($asset) && $this->checkLink($asset)) {
            return '/' . $this->assetDir . '/' . $this->asset['asset'];
        }

        return false;
    }
49647
public function asset($asset, $secure = null)
    {
        return url('themes/' . $this->getCurrent() . '/' . $asset, null, $secure);
    }
1007920
public function registerCreatedAsset(AssetInterface $asset)
    {
        if (!$asset instanceof AssetVariantInterface || !$asset instanceof AssetSourceAwareInterface) {
            return;
        }

        $variantAssetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);
        $originalAsset = $asset->getOriginalAsset();
        $originalAssetIdentifier = $this->persistenceManager->getIdentifierByObject($originalAsset);

        $originalImportedAsset = $this->importedAssetRepository->findOneByLocalAssetIdentifier($originalAssetIdentifier);
        if ($originalImportedAsset instanceof ImportedAsset) {
            $asset->setAssetSourceIdentifier($originalImportedAsset->getAssetSourceIdentifier());

            $variantImportedAsset = new ImportedAsset(
                $originalImportedAsset->getAssetSourceIdentifier(),
                $originalImportedAsset->getRemoteAssetIdentifier(),
                $variantAssetIdentifier, new \DateTimeImmutable(),
                $originalAssetIdentifier
            );

            $this->importedAssetRepository->add($variantImportedAsset);
            $this->logger->debug(sprintf('Asset created: %s / %s', $asset->getResource()->getFilename(), $this->persistenceManager->getIdentifierByObject($asset)));
        }
    }
1074905
private function getIntegrityHtml (Asset $asset) : string
    {
        return $this->isDebug
            ? ""
            : sprintf(
                ' integrity="sha256-%s"',
                $this->registry->get($asset)->getHash()
            );
    }