Extracts icons from provided zipfile into iconSet directory.

@param IconSet $iconSet
@param $iconSetIconItemList

@return array
327949
private function extractResourceIconSetZipAndReturnNewIconItems(
        IconSet $iconSet,
        ResourceIconSetIconItemList $iconSetIconItemList
    ) {
        $ds = DIRECTORY_SEPARATOR;
        $zipFile = $iconSet->getIconsZipfile();
        $cname = $iconSet->getCname();
        $iconSetDir = $this->iconSetsWebDir.$ds.$cname;
        if (!empty($zipFile)) {
            $zipArchive = new \ZipArchive();
            if (true === $zipArchive->open($zipFile)) {
                //Test to see if a resource stamp icon is present in zip file
                $resourceStamp = $this->extractResourceStampIconFromZip($zipArchive, $iconSetDir);
                if (!empty($resourceStamp)) {
                    $iconSet->setResourceStampIcon($resourceStamp);
                    $this->om->persist($iconSet);
                    if ($iconSet->isActive()) {
                        $this->regenerateShortcutForAllResourceIcons($resourceStamp);
                    }
                }
                //List filenames and extract all files without subfolders
                for ($i = 0; $i < $zipArchive->numFiles; ++$i) {
                    $file = $zipArchive->getNameIndex($i);
                    $fileinfo = pathinfo($file);
                    $filename = $fileinfo['filename'];
                    //If file associated with one of mimeTypes then extract it. Otherwise don't
                    $alreadyInSet = $iconSetIconItemList->isInSetIcons($filename);
                    $iconItemFilenameList = $alreadyInSet ?
                        $iconSetIconItemList->getSetIcons() :
                        $iconSetIconItemList->getDefaultIcons();
                    $iconNameTypes = $iconItemFilenameList->getItemByKey($filename);
                    if (!empty($iconNameTypes)) {
                        $iconPath = $iconSetDir.$ds.$fileinfo['basename'];
                        $this->fs->remove($iconSetDir.DIRECTORY_SEPARATOR.$fileinfo['basename']);
                        $zipArchive->extractTo($iconSetDir, [$file]);

                        foreach ($iconNameTypes->getMimeTypes() as $type) {
                            // If icon don't exist, create it, otherwise update it's url in case of extension change
                            $icon = $iconItemFilenameList->getIconByMimeType($type);
                            if (!$alreadyInSet) {
                                $resourceIcon = $icon->getResourceIcon();
                                $this->createIconItemForResourceIconSet(
                                    $iconSet,
                                    $this->getRelativePathForResourceIcon($iconPath),
                                    $resourceIcon
                                );
                            } else {
                                $this->updateIconItemForResourceIconSet(
                                    $iconSet,
                                    $this->getRelativePathForResourceIcon($iconPath),
                                    $icon
                                );
                            }
                        }
                    }
                }
                $zipArchive->close();
            }
        }
    }
109283
function mget($filelist) {

        $result = true;

        foreach ($filelist as $remotepath => $localpath) {

            $localpath   = rtrim($localpath, "/");
            $remotepath  = rtrim($remotepath, "/");

            // attempt to create local path
            if ($this->is_dir($remotepath)) {
                $pathparts = explode("/", $localpath."/ "); // add one level, last level will be created as dir
            } else {
                $pathparts = explode("/", $localpath);
            }
            $checkpath = "";
            for ($i=1; $i<sizeof($pathparts)-1; $i++) {
                $checkpath .= "/" . $pathparts[$i];
                if (!is_dir($checkpath)) {

                    $result &= mkdir($checkpath);
                }
            }

            if ($result) {
                // recurse directories
                if ($this->is_dir($remotepath)) {
                    $list = $this->ls($remotepath);

                    $fl = array();
                    foreach($list as $e) {
                        $fullpath = urldecode($e['href']);
                        $filename = basename($fullpath);
                        if ($filename != '' and $fullpath != $remotepath . '/') {
                            $fl[$remotepath."/".$filename] = $localpath."/".$filename;
                        }
                    }
                    $result &= $this->mget($fl);
                } else {
                    $result &= ($this->get_file($remotepath, $localpath));
                }
            }
        }
        return $result;
    }
1105483
protected function extractTemplate($fileContent, MessageCatalogue $catalogue)
    {
        $translateParameters = [];

        $translateFound = preg_match_all(
            '/\\{\\{\\s*translate\\s(.*)\\s*\\}\\}/',
            $fileContent,
            $translateParameters,
            PREG_SET_ORDER
        );

        $messages = [];
        if ($translateFound) {
            foreach ($translateParameters as $translateParameter) {
                $message = $this->extractParameters($translateParameter[1], $catalogue);
                if ($message !== null) {
                    $messages[] = $message;
                }
            }
        }

        return $messages;
    }
1364497
protected function get_pack_data( DirectoryIterator $pack_dir ) {
		$pack_dirname  = $pack_dir->getFilename();
		$pack_path     = $pack_dir->getPathname();
		$cache_id      = "icon_picker_fontpack_{$pack_dirname}";
		$cache_data    = get_transient( $cache_id );
		$config_file   = "{$pack_path}/config.json";

		if ( false !== $cache_data && $cache_data['version'] === $pack_dir->getMTime() ) {
			return $cache_data;
		}

		// Make sure the config file exists and is readable.
		if ( ! is_readable( $config_file ) ) {
			trigger_error(
				sprintf(
					esc_html( $this->messages['no_config'] ),
					'<code>config.json</code>',
					sprintf( '<code>%s</code>', esc_html( $pack_path ) )
				)
			);

			return false;
		}

		$config = json_decode( file_get_contents( $config_file ), true );
		$errors = json_last_error();

		if ( ! empty( $errors ) ) {
			trigger_error(
				sprintf(
					esc_html( $this->messages['config_error'] ),
					sprintf( '<code>%s/config.json</code>', esc_html( $pack_path ) )
				)
			);

			return false;
		}

		$keys   = array( 'name', 'glyphs', 'css_prefix_text' );
		$items  = array();

		// Check each required config.
		foreach ( $keys as $key ) {
			if ( empty( $config[ $key ] ) ) {
				trigger_error(
					sprintf(
						esc_html( $this->messages['invalid'] ),
						sprintf( '<code><em>%s</em></code>', esc_html( $key ) ),
						esc_html( $config_file )
					)
				);

				return false;
			}
		}

		// Bail if no glyphs found.
		if ( ! is_array( $config['glyphs'] ) || empty( $config['glyphs'] ) ) {
			return false;
		}

		foreach ( $config['glyphs'] as $glyph ) {
			if ( ! empty( $glyph['css'] ) ) {
				$items[] = array(
					'id'   => $config['css_prefix_text'] . $glyph['css'],
					'name' => $glyph['css'],
				);
			}
		}

		if ( empty( $items ) ) {
			return false;
		}

		$pack_data = array(
			'id'             => "pack-{$config['name']}",
			'name'           => sprintf( __( 'Pack: %s', 'icon-picker' ), $config['name'] ),
			'version'        => $pack_dir->getMTime(),
			'items'          => $items,
			'stylesheet_uri' => "{$this->url}/{$pack_dirname}/css/{$config['name']}.css",
			'dir'            => "{$this->dir}/{$pack_dirname}",
			'url'            => "{$this->url}/{$pack_dirname}",
		);

		set_transient( $cache_id, $pack_data, DAY_IN_SECONDS );

		return $pack_data;
	}
207301
public function getPackageAssetsDirs($jsonData)
    {
        $packagesAssetsDir = null;
        // If some assets were set on the package
        if (isset($jsonData["extra"][self::LABEL_ASSETS_DIR])) {
            // We get the assets-dir of this package
            $packagesAssetsDir = $jsonData["extra"][self::LABEL_ASSETS_DIR];
            if (is_string($packagesAssetsDir)) {
                // If we get a string, it's the public shortcut so we uniform the return
                $packagesAssetsDir = array(self::LABEL_PUBLIC_DIR => $packagesAssetsDir);
            }
        }
        return $packagesAssetsDir;
    }
956325
public function resourceIconSetNewAction()
    {
        $form = $this->createForm(IconSetType::class);
        $iconNamesForTypes = $this->iconSetManager->getResourceIconSetIconNamesForMimeTypes();
        $shortcutIcon = $this->iconSetManager->getResourceIconSetStampIcon();
        $iconNamesForTypes->prependShortcutIcon($shortcutIcon);

        return [
            'form' => $form->createView(),
            'iconNamesForTypes' => $iconNamesForTypes,
        ];
    }
539589
public function extractCore()
    {
        $filePath = $this->getFilePath('core');

        if (!Zip::extract($filePath, $this->baseDirectory)) {
            throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePath]));
        }

        @unlink($filePath);
    }
865165
public function getIcon( $icon_class ) {
		$icon_class = $this->normalizeIconClass( $icon_class );
		$result     = false;

		$icons = $this->getAllData();

		if ( ! empty( $icons ) && array_key_exists( $icon_class, $icons ) ) {
			$result = $icons[ $icon_class ];
		}

		return $result;
	}
481207
public function collect(Map $map, array $icons = [])
    {
        foreach ($this->markerCollector->collect($map) as $marker) {
            if ($marker->hasIcon()) {
                $icons = $this->collectValue($marker->getIcon(), $icons);
            }
        }

        return $icons;
    }
858618
protected function extractZip($zipPath)
    {
        $archive = new ZipArchive;

        $archive->open($zipPath);

        $archive->extractTo($this->command->path.'/spark-new');

        $archive->close();

        @unlink($zipPath);
    }
34713
private static function extract_zip( $zipfile, $dest ) {
		if ( ! class_exists( 'ZipArchive' ) ) {
			throw new \Exception( 'Extracting a zip file requires ZipArchive.' );
		}
		$zip = new ZipArchive();
		$res = $zip->open( $zipfile );
		if ( true === $res ) {
			$tempdir = implode(
				DIRECTORY_SEPARATOR,
				array(
					dirname( $zipfile ),
					Utils\basename( $zipfile, '.zip' ),
					$zip->getNameIndex( 0 ),
				)
			);

			$zip->extractTo( dirname( $tempdir ) );
			$zip->close();

			self::copy_overwrite_files( $tempdir, $dest );
			self::rmdir( dirname( $tempdir ) );
		} else {
			throw new \Exception( sprintf( "ZipArchive failed to unzip '%s': %s.", $zipfile, self::zip_error_msg( $res ) ) );
		}
	}
128464
static function array_iconv($in_charset, $out_charset, $data)
    {
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                if (is_array($value)) $value = self::array_iconv($in_charset, $out_charset, $value);
                else $value = iconv($in_charset, $out_charset, $value);
                $data[$key] = $value;
            }
        }
        return $data;
    }
569502
public void setIcon(CharSequence iconCode, IconSet iconSet) {
        setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addIcon(iconCode, iconSet).build());
    }
179297
public function extract(
        Composer $composer,
        SymbolIteratorInterface $symbols
    ): iterable {
        $repository = $composer->getRepositoryManager()->getLocalRepository();
        $vendorPath = str_replace('\\', '/', $composer->getConfig()->get('vendor-dir', 0));

        $packages = [];

        foreach ($symbols as $symbol) {
            $package = $this->extractPackage($vendorPath, $symbol);

            if ($package === null) {
                continue;
            }

            if (!array_key_exists($package, $packages)) {
                $packages[$package] = [];
            }

            $packages[$package][] = $symbol;
        }

        $installed = $repository->getPackages();

        $candidates = [];

        foreach ($packages as $name => $symbols) {
            $package = $this->getPackageByName($installed, $name);

            if ($package === null) {
                continue;
            }

            $candidates[] = new Candidate(
                $package,
                new SymbolIterator(...$symbols)
            );
        }

        return $candidates;
    }
652200
public List<IVdmSourceUnit> getFiles(IContentType iContentType)
			throws CoreException
	{
		List<IVdmSourceUnit> list = new Vector<IVdmSourceUnit>();

		for (IContainer container : modelpath.getModelSrcPaths())
		{
			if (!container.exists() || !container.isAccessible())
			{
				continue;
			}
			for (IResource res : container.members(IContainer.INCLUDE_PHANTOMS
					| IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS))
			{
				list.addAll(ResourceManager.getInstance().getFiles(this, res, iContentType));
			}
		}

		return list;
	}
901072
public function setIcon(string $iconPath)
    {
        return $this->setParameter('chrome_web_icon', $iconPath)
            ->setParameter('chrome_icon', $iconPath)
            ->setParameter('adm_small_icon', $iconPath)
            ->setParameter('small_icon', $iconPath);
    }
950846
@Deprecated
    public List<Icon> getIconFiles() throws IOException {
        List<IconPath> iconPaths = getIconPaths();
        List<Icon> icons = new ArrayList<>(iconPaths.size());
        for (IconPath iconPath : iconPaths) {
            Icon icon = newFileIcon(iconPath.getPath(), iconPath.getDensity());
            icons.add(icon);
        }
        return icons;
    }