Checks an embedded asset embed code for URL's that are safe (or in other words, are whitelisted).

@param EmbeddedAsset $embeddedAsset
@return bool
12861
public function isEmbedSafe(EmbeddedAsset $embeddedAsset): bool
	{
		$isSafe = $this->checkWhitelist($embeddedAsset->url);

		if ($isSafe)
		{
			$dom = $this->getEmbedCode($embeddedAsset);

			if ($dom)
			{
				foreach ($dom->getElementsByTagName('iframe') as $iframeElement)
				{
					$href = $iframeElement->getAttribute('href');
					$isSafe = $isSafe && (!$href || $this->checkWhitelist($href));
				}

				foreach ($dom->getElementsByTagName('script') as $scriptElement)
				{
					$src = $scriptElement->getAttribute('src');
					$content = $scriptElement->textContent;

					// Inline scripts are impossible to analyse for safety, so just assume they're all evil
					$isSafe = $isSafe && !$content && (!$src || $this->checkWhitelist($src));
				}
			}
		}

		return $isSafe;
	}
1353831
public function isEmbeddedObject(array $objectElement)
    {
        foreach ($objectElement as $childKey => $childValue) {
            $childKeyIndicator = substr($childKey, 0, 1);
            if ($childKeyIndicator !== '#' && $childKeyIndicator !== '_') {
                return true;
            }
        }

        return false;
    }
635289
public static function getAssetsUrl($forceCopyAssets = false, $cdn = false)
    {
        if (!isset(static::$assetsUrl)) {
            if ($cdn) {
                static::$assetsUrl = '//cdn.jsdelivr.net/foundation/4.3.1/';
            } else {
                $assetsPath        = static::getAssetsPath();
                static::$assetsUrl = \Yii::app()->assetManager->publish($assetsPath, true, -1, $forceCopyAssets);
            }
        }
        return static::$assetsUrl;
    }
553173
private function checkInclude($include,$deep = false){
		if (is_string($include)){
			$include = array($include);
		}
		$include = Hash::normalize($include);

		foreach($include as $key => $val){
			$val = Hash::merge($this->includeDef,$val);
			// if Embed in config is true all include array set true
			if($this->config['embed']){
				$val['embed'] = true;
			}
			if ($val['include']){
				$val['include'] = $this->checkInclude($val['include'],true);
			}
			$include[$key] = $val;

		}
		
		
		if (!$deep){
			$this->include = $include;
		}
    	return $include;
	}
1114434
public function markAssetAsIncluded($assetType, $assetHandle = false)
    {
        $list = AssetList::getInstance();
        if ($assetType && $assetHandle) {
            $asset = $list->getAsset($assetType, $assetHandle);
        } else {
            $assetGroup = $list->getAssetGroup($assetType);
        }

        if (isset($assetGroup)) {
            $this->providedAssetGroup->addGroup($assetGroup);
        } elseif (isset($asset)) {
            $ap = new AssetPointer($asset->getAssetType(), $asset->getAssetHandle());
            $this->providedAssetGroup->add($ap);
        } else {
            $ap = new AssetPointer($assetType, $assetHandle);
            $this->providedAssetGroupUnmatched[] = $ap;
        }
    }
471930
public static function assetFileTypeExists($sAssetFileType)
    {
        if (!is_string($sAssetFileType)) {
            throw new \InvalidArgumentException('Asset file type expects string, "' . gettype($sAssetFileType) . '" given');
        }
        switch ($sAssetFileType) {
            case self::ASSET_CSS:
            case self::ASSET_LESS:
            case self::ASSET_JS:
            case self::ASSET_MEDIA:
                return true;
            default:
                return false;
        }
    }
404007
public function findAsset($url)
    {
        if (empty($url)) {
            return false;
        }

        $this->asset = $this->processUrl($url);

        if ($this->asset === false) {
            return false;
        }

        // check main assets dir
        $mainAsset = $this->findMainAsset(
            $this->docRoot . DS . $this->assetDir . DS . $this->asset['asset']
        );
        if ($mainAsset !== false) {
            return $mainAsset;
        }

        // check the set theme
        $themeAsset = $this->findThemeAsset(
            $this->asset['folder'],
            $this->assetDir . DS . $this->asset['asset']
        );
        if ($themeAsset !== false) {
            return $themeAsset;
        }

        // get the last "fallback" directory
        return $this->findFallbackAsset(
            $this->assetDir . DS . $this->asset['asset'],
            $this->Folder
        );
    }
1025800
private static function imageIsValid(Url $url, Url $baseUrl, $externalImages)
    {
        //base64 or same domain
        if ($url->getContent() !== null || $url->getDomain() === $baseUrl->getDomain()) {
            return true;
        }

        return is_bool($externalImages) ? $externalImages : $url->match($externalImages);
    }
160469
private function createEmbeddedAsset(array $array)
	{
		$embeddedAsset = new EmbeddedAsset();

		$isLegacy = isset($array['__embeddedasset__']);
		if ($isLegacy)
		{
			$array = $this->_convertFromLegacy($array);
		}

		foreach ($array as $key => $value)
		{
			if (!$embeddedAsset->hasProperty($key))
			{
				return null;
			}

			switch ($key)
			{
				case 'code':
				{
					$code = $value instanceof Twig_Markup ? (string)$value :
						is_string($value) ? $value : '';

					$embeddedAsset->$key = empty($code) ? null : Template::raw($code);
				}
				break;
				default:
				{
					$embeddedAsset->$key = $value;
				}
			}
		}

		// Attempts to extract missing dimensional properties from the embed code
		$dimensions = $this->_getDimensions($embeddedAsset);
		$embeddedAsset->width = $dimensions[0];
		$embeddedAsset->height = $dimensions[1];

		// Sets aspect ratio is missing
		if (!$embeddedAsset->aspectRatio && $embeddedAsset->width && $embeddedAsset->height)
		{
			$embeddedAsset->aspectRatio = $embeddedAsset->height / $embeddedAsset->width * 100;
		}

		return $embeddedAsset->validate() ? $embeddedAsset : null;
	}
1247599
def embeddedFileDel(self, name):
        """"""
        if self.isClosed or self.isEncrypted:
            raise ValueError("operation illegal for closed / encrypted doc")

        return _fitz.Document_embeddedFileDel(self, name)
776647
protected function _sendEmbeddedFiles($embeddedFiles, $boundary)
    {
        foreach ($embeddedFiles as $embeddedFile) {
            if (!is_file($file = $this->alias->resolve($embeddedFile['file']))) {
                throw new InvalidValueException(['`:file` inline file is not exists', 'file' => $file]);
            }
            $this->_writeLine()
                ->_writeLine("--$boundary")
                ->_writeLine('Content-Type: ' . mime_content_type($file))
                ->_writeLine('Content-Length: ' . filesize($file))
                ->_writeLine('Content-ID: <' . $embeddedFile['cid'] . '>')
                ->_writeLine('Content-Disposition: inline; filename="' . $embeddedFile['name'] . '"')
                ->_writeLine('Content-Transfer-Encoding: base64')
                ->_writeLine()
                ->_writeLine(chunk_split(base64_encode(file_get_contents($file)), 983));
        }

        return $this;
    }
1343619
public function embed($file)
    {
        if (isset($this->embeddedFiles[$file])) {
            return $this->embeddedFiles[$file];
        }

        return $this->embeddedFiles[$file] = $this->swift->embed(
            Swift_Image::fromPath($file)
        );
    }
954455
protected function checkEmbeds()
	{
		foreach ($this->getElements('embed') as $embed)
		{
			// Test <xsl:attribute/> descendants
			$this->checkDynamicAttributes($embed);

			// Test the element's attributes
			$this->checkAttributes($embed);
		}
	}
713890
public function validatePlugin($oAssetFileFilter) {
        if ($oAssetFileFilter instanceof \AssetsBundle\AssetFile\AssetFileFilter\AssetFileFilterInterface) {
            return;
        }
        throw new \RuntimeException(sprintf(
                'Assets Filter expects an instance of \AssetsBundle\AssetFile\AssetFileFilter\AssetFileFilterInterface, "%s" given', is_object($oAssetFileFilter) ? get_class($oAssetFileFilter) : (is_scalar($oAssetFileFilter) ? $oAssetFileFilter : gettype($oAssetFileFilter))
        ));
    }
3072
public function getEmbedHtml () : string
    {
        if (null === $this->assetHelper && null === $this->packages)
        {
            throw new AssetIntegrationFailedException("No asset integration extension found. Please either install `becklyn/assets-bundle` or `symfony/asset` to use this bundle.");
        }

        $trackJsToken = $this->hostingConfig->getTrackJsToken();

        // only embed if token is set, in production and not in debug
        if (null === $trackJsToken || $this->isDebug || "prod" !== $this->environment)
        {
            return "";
        }

        $assetUrl = null !== $this->assetHelper
            ? $this->assetHelper->getUrl("@hosting/js/trackjs.js")
            : $this->packages->getUrl("bundles/becklynhosting/js/trackjs.js");

        return \sprintf(
            '<script src="%s"></script><script>window.TrackJS && TrackJS.install(%s)</script>',
            $assetUrl,
            \json_encode([
                "token" => $trackJsToken,
                "application" => $this->hostingConfig->getProjectName(),
                "version" => $this->hostingConfig->getGitCommit(),
                "console" => [
                    "display" => false,
                ],
            ])
        );

    }
11844
public function getAsset($assetType, $assetHandle)
    {
        return isset($this->assets[$assetType][$assetHandle]) ? $this->assets[$assetType][$assetHandle] : null;
    }
1159129
public function findUntagged(AssetCollection $assetCollection = null)
    {
        $query = $this->createQuery();
        $query->matching($query->isEmpty('tags'));
        $this->addImageVariantFilterClause($query);
        $this->addAssetCollectionToQueryConstraints($query, $assetCollection);
        return $query->execute();
    }