Loads a Bower asset from the Nails asset module's bower_components directory

@param  string $sAsset     The asset to unload
@param  string $sForceType Force a particular type of asset (i.e. JS or CSS)

@return void
1134
protected function unloadNailsBower($sAsset, $sForceType)
    {
        $sType = $this->determineType($sAsset, $sForceType);

        switch ($sType) {

            case 'CSS':

                unset($this->aCss['NAILS-BOWER-' . $sAsset]);
                break;

            case 'JS':

                unset($this->aJs['NAILS-BOWER-' . $sAsset]);
                break;
        }
    }
403756
public function createNewResourceIconSet(IconSet $iconSet, $iconNamesForType)
    {
        // Persist new Set
        $this->om->persist($iconSet);
        $this->om->flush();
        // Create icon set's folder
        $this->createIconSetDirForCname($iconSet->getCname());
        $this->extractResourceIconSetZipAndReturnNewIconItems($iconSet, $iconNamesForType);
        $this->om->flush();

        return $iconSet;
    }
522741
public function execute(DataSetInterface $dataSet): void
    {
        $currencyCode = $dataSet[PriceProductMerchantRelationshipDataSetInterface::CURRENCY];
        if (!isset($this->idCurrencyCache[$currencyCode])) {
            $idCurrency = SpyCurrencyQuery::create()
                ->select(SpyCurrencyTableMap::COL_ID_CURRENCY)
                ->findOneByCode($currencyCode);

            if (!$idCurrency) {
                throw new EntityNotFoundException(sprintf('Could not find currency by code "%s"', $currencyCode));
            }

            $this->idCurrencyCache[$currencyCode] = $idCurrency;
        }

        $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_CURRENCY] = $this->idCurrencyCache[$currencyCode];
    }
115600
public function setImageSet($imageSet)
    {
        if (! in_array($imageSet, $this->availableImageSets)) {
            throw new \InvalidArgumentException('Invalid Gravatar image set.');
        }

        $this->imageSet = $imageSet;
    }
521364
public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $typePointer): void
    {
        $tokens = $phpcsFile->getTokens();

        /** @var int $namePointer */
        $namePointer = TokenHelper::findNext($phpcsFile, T_STRING, $typePointer + 1);
        $namespacePointer = TokenHelper::findPrevious($phpcsFile, T_NAMESPACE, $typePointer - 1);

        if (!$this->hasNamespace($namespacePointer)) {
            return;
        }

        $typeName = NamespaceHelper::normalizeToCanonicalName(
            ClassHelper::getFullyQualifiedName($phpcsFile, $typePointer)
        );

        $rootDirectory = \getcwd() . \DIRECTORY_SEPARATOR;
        $fileInfo = new \SplFileInfo($phpcsFile->getFilename());

        foreach ($this->rootNamespaces as $directory => $namespace) {
            if ($this->shouldSkip($directory)) {
                return;
            }

            if (StringHelper::startsWith($typeName, $namespace)) {
                $expectedTypeName = rtrim($fileInfo->getPathname(), '.' . $fileInfo->getExtension());
                $expectedTypeName = \str_replace($rootDirectory . $directory, '', $expectedTypeName);
                $expectedTypeName = \str_replace(\DIRECTORY_SEPARATOR, '\\', $expectedTypeName);
                $expectedTypeName = $namespace . '\\' . ltrim($expectedTypeName, '\\');

                if (strcasecmp($typeName, $expectedTypeName) === 0) {
                    return;
                }
            }
        }

        $phpcsFile->addError(
            sprintf(
                '%s name %s does not match filepath %s.',
                ucfirst($tokens[$typePointer]['content']),
                $typeName,
                $phpcsFile->getFilename()
            ),
            $namePointer,
            self::CODE_NO_MATCH_BETWEEN_TYPE_NAME_AND_FILE_NAME
        );
    }
710406
public function loadOrderArticles($aOrders)
    {
        if (!count($aOrders)) {
            $this->clear();

            return;
        }

        foreach ($aOrders as $iKey => $oOrder) {
            $aOrdersIds[] = $oOrder->getId();
        }

        $oBaseObject = $this->getBaseObject();
        $sArticleTable = $oBaseObject->getViewName();
        $sArticleFields = $oBaseObject->getSelectFields();
        $sArticleFields = str_replace("`$sArticleTable`.`oxid`", "`oxorderarticles`.`oxartid` AS `oxid`", $sArticleFields);

        $sSelect = "SELECT $sArticleFields FROM oxorderarticles ";
        $sSelect .= "left join $sArticleTable on oxorderarticles.oxartid = $sArticleTable.oxid ";
        $sSelect .= "WHERE oxorderarticles.oxorderid IN ( '" . implode("','", $aOrdersIds) . "' ) ";
        $sSelect .= "order by $sArticleTable.oxid ";

        $this->selectString($sSelect);

        // not active or not available products must not have button "tobasket"
        $sNow = date('Y-m-d H:i:s');
        foreach ($this as $oArticle) {
            if (!$oArticle->oxarticles__oxactive->value &&
                ($oArticle->oxarticles__oxactivefrom->value > $sNow ||
                 $oArticle->oxarticles__oxactiveto->value < $sNow
                )
            ) {
                $oArticle->setBuyableState(false);
            }
        }
    }
705129
private function getMacSource(Dataset $dataset, $requestType)
    {
        $this->formatParams($dataset);
        $macParams = $this->getNormalizedMacParams($dataset, $requestType);
        $source = implode($macParams);

        return $source;
    }
902
private function loadStyleSheetAsset($css){

        $imageRe = "/url\\s*\\(['|\"]?([^)]*\.(png|jpg|jpeg|gif|svg))['|\"]?\\)/mi";
        $importRe = "/@import\\s*(url\\s*\\()?['\"]?([^;]*)['\"]/mi";
        $fontFaceRe = "/@font-face\\s*\\{(.*)?\\}/mi";
        $fontRe = "/url\\s*\\(['|\"]?([^)'|\"]*)['|\"]?\\)/i";

        //extract images
        preg_match_all($imageRe, $css, $matches);
        if(isset($matches[1])){
            foreach($matches[1] as $match){
                $this->addAsset('img', $match);
            }
        }

        //extract @import
        preg_match_all($importRe, $css, $matches);
        if(isset($matches[2])){
            foreach($matches[2] as $match){
                $this->addAsset('css', $match);
            }
        }

        //extract fonts
        preg_match_all($fontFaceRe, $css, $matches);
        if(isset($matches[1])){
            foreach($matches[1] as $faceMatch){
                preg_match_all($fontRe, $faceMatch, $fontMatches);
                if(isset($fontMatches[1])){
                    foreach($fontMatches[1] as $fontMatch){
                        $this->addAsset('font', $fontMatch);
                    }
                }
            }
        }
    }
500296
public function load($src = null, $dir = null)
    {
        if (isset($src)) {
            $this->setSource($src, $dir);
        }

        $this->loadImageDetails();

        if ($this->fileType === IMG_WEBP) {
            $this->image = imagecreatefromwebp($this->pathToImage);
        } else {
            $imageAsString = file_get_contents($this->pathToImage);
            $this->image = imagecreatefromstring($imageAsString);
        }
        if ($this->image === false) {
            throw new Exception("Could not load image.");
        }

        /* Removed v0.7.7
        if (image_type_to_mime_type($this->fileType) == 'image/png') {
            $type = $this->getPngType();
            $hasFewColors = imagecolorstotal($this->image);

            if ($type == self::PNG_RGB_PALETTE || ($hasFewColors > 0 && $hasFewColors <= 256)) {
                if ($this->verbose) {
                    $this->log("Handle this image as a palette image.");
                }
                $this->palette = true;
            }
        }
        */

        if ($this->verbose) {
            $this->log("### Image successfully loaded from file.");
            $this->log(" imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false'));
            $this->log(" imagecolorstotal() : " . imagecolorstotal($this->image));
            $this->log(" Number of colors in image = " . $this->colorsTotal($this->image));
            $index = imagecolortransparent($this->image);
            $this->log(" Detected transparent color = " . ($index >= 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index");
        }

        return $this;
    }
879671
protected function unloadModule($sAsset, $sForceType, $sModule)
    {
        $sType = $this->determineType($sAsset, $sForceType);

        switch ($sType) {

            case 'CSS':

                unset($this->aCss['MODULE-' . $sModule . '-' . $sAsset]);
                break;

            case 'JS':

                unset($this->aJs['MODULE-' . $sModule . '-' . $sAsset]);
                break;
        }
    }
672917
public function load($removeUnfoundHref = false){

        $xincludes = $this->getXIncludes();
        
        //load xincludes in standard element
        foreach($xincludes as $xinclude){
            //retrive the xinclude from href
            $href = $xinclude->attr('href');
            if(!empty($href)){
                try {
                    $asset = $this->resolver->resolve($href);
                    $filePath = $asset->getMediaSource()->download($asset->getMediaIdentifier());
                    $this->loadXInclude($xinclude, $filePath);
                } catch (\tao_models_classes_FileNotFoundException $exception) {
                    if ($removeUnfoundHref) {
                        $xinclude->attr('href', '');
                    } else {
                        throw new XIncludeException('The file referenced by href does not exist : '.$href, $xinclude);
                    }
                }
            }
        }
        
        //load xinclude in portable element markup
        $customElements = $this->getCustomElements();
        foreach($customElements as $customElement){
            $xincludes = array_merge($xincludes, $this->parseCustomElementMarkup($customElement));
        }

        return $xincludes;
    }
1332453
protected function loadModule($sAsset, $sForceType, $mModule)
    {
        if (is_array($mModule)) {
            $sModule   = !empty($mModule[0]) ? $mModule[0] : null;
            $sLocation = !empty($mModule[1]) ? $mModule[1] : null;

        } else {

            $sModule   = $mModule;
            $sLocation = null;
        }

        $sType = $this->determineType($sAsset, $sForceType);
        $sKey  = 'MODULE-' . $sModule . '-' . $sAsset;

        switch ($sType) {

            case 'CSS':

                if ($sLocation == 'BOWER') {
                    $this->aCss[$sKey] = $this->sBaseModuleUrl . $sModule . '/assets/bower_components/' . $sAsset;
                } else {
                    $this->aCss[$sKey] = $this->sBaseModuleUrl . $sModule . '/assets/css/' . $sAsset;
                }
                break;

            case 'JS':

                if ($sLocation == 'BOWER') {
                    $this->aJs[$sKey] = $this->sBaseModuleUrl . $sModule . '/assets/bower_components/' . $sAsset;
                } else {
                    $this->aJs[$sKey] = $this->sBaseModuleUrl . $sModule . '/assets/js/' . $sAsset;
                }
                break;
        }
    }
204839
protected function _loadCategoryTree($sActCat)
    {
        /** @var \OxidEsales\Eshop\Application\Model\CategoryList $oCategoryTree */
        $oCategoryTree = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
        $oCategoryTree->buildTree($sActCat);

        $oParentView = $this->getParent();

        // setting active category tree
        $oParentView->setCategoryTree($oCategoryTree);
        $this->setCategoryTree($oCategoryTree);

        // setting active category
        $oParentView->setActiveCategory($oCategoryTree->getClickCat());
    }
154100
protected function _moveImage($sSource, $sTarget)
    {
        if (!is_dir(dirname($sTarget))) {
            mkdir(dirname($sTarget), 0744, true);
        }

        $blDone = true;
        if ($sSource !== $sTarget) {
            $blDone = move_uploaded_file($sSource, $sTarget);
        }

        if ($blDone) {
            $blDone = @chmod($sTarget, 0644);
        }

        return $blDone;
    }
1308383
function unload($cwd) {
		chdir($cwd);
		if (!$error=error_get_last())
			@session_commit();
		$handler=$this->hive['UNLOAD'];
		if ((!$handler || $this->call($handler,$this)===FALSE) &&
			$error && in_array($error['type'],
			array(E_ERROR,E_PARSE,E_CORE_ERROR,E_COMPILE_ERROR)))
			// Fatal error detected
			$this->error(500,sprintf(self::E_Fatal,$error['message']),
				array($error));
	}
1344466
public function filterLoad(AssetInterface $asset)
    {
        $root = $asset->getSourceRoot();
        $path = $asset->getSourcePath();

        $compiler = new \SassParser($this->presets);

        if ($root and $path) {
            $compiler->load_paths = array_merge($compiler->load_paths, array($root.'/'.$path));
        }

        $compiler->load_paths = array_merge($compiler->load_paths, $this->importPaths);

        $asset->setContent($compiler->toCss($asset->getContent(), false));
    }
79450
public function removeAsset($type, $fileName)
    {
        // If the key doesn't exists return false
        if (!$this->hasAsset($type, $fileName)) {
            return false;
        }
        
        // If the file was found remove the index
        unset($this->assets[$type][$fileName]);
        
        return true;
    }