Upload assets.

@param $assets

@return bool
425146
public function upload($assets)
    {
        // connect before uploading
        $connected = $this->connect();

        if (!$connected) {
            return false;
        }

        // user terminal message
        $this->console->writeln('<fg=yellow>Comparing local files and bucket...</fg=yellow>');

        $assets = $this->getFilesAlreadyOnBucket($assets);

        // upload each asset file to the CDN
        if(count($assets) > 0) {
            $this->console->writeln('<fg=yellow>Upload in progress......</fg=yellow>');
            foreach ($assets as $file) {
                try {
                    $this->console->writeln('<fg=cyan>'.'Uploading file path: '.$file->getRealpath().'</fg=cyan>');
                    $command = $this->s3_client->getCommand('putObject', [

                        // the bucket name
                        'Bucket' => $this->getBucket(),
                        // the path of the file on the server (CDN)
                        'Key' => str_replace('\\', '/', $file->getPathName()),
                        // the path of the path locally
                        'Body' => fopen($file->getRealPath(), 'r'),
                        // the permission of the file

                        'ACL' => $this->acl,
                        'CacheControl' => $this->default['providers']['aws']['s3']['cache-control'],
                        'Metadata' => $this->default['providers']['aws']['s3']['metadata'],
                        'Expires' => $this->default['providers']['aws']['s3']['expires'],
                    ]);
//                var_dump(get_class($command));exit();


                    $this->s3_client->execute($command);
                } catch (S3Exception $e) {
                    $this->console->writeln('<fg=red>'.$e->getMessage().'</fg=red>');

                    return false;
                }
            }

            // user terminal message
            $this->console->writeln('<fg=green>Upload completed successfully.</fg=green>');
        } else {
            // user terminal message
            $this->console->writeln('<fg=yellow>No new files to upload.</fg=yellow>');
        }

        return true;
    }
488766
protected function protectAll($assets)
    {
        if (empty($assets)) {
            return;
        }
        $store = $this->getAssetStore();
        foreach ($assets as $asset) {
            $store->protect($asset['Filename'], $asset['Hash']);
        }
    }
666397
private function setAssets (array $newAssets) : void
    {
        $this->assets = $newAssets;
        $this->cacheItem->set($this->assets);
        $this->cachePool->save($this->cacheItem);
    }
223843
public function createFileInfos($asset)
    {
        $assetId = Utilities::getEntityId(
            $asset,
            'WindowsAzure\MediaServices\Models\Asset'
        );
        $assetIdEncoded = urlencode($assetId);

        $method = Resources::HTTP_GET;
        $headers = [];
        $postParams = [];
        $queryParams = [];
        $path = "CreateFileInfos?assetid='{$assetIdEncoded}'";
        $statusCode = Resources::STATUS_NO_CONTENT;

        $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode
        );
    }
528017
public function push()
    {
        // return the configurations from the config file
        $configurations = $this->helper->getConfigurations();

        // Initialize an instance of the asset holder to read the configurations
        // then call the read(), to return all the allowed assets as a collection of files objects
        $assets = $this->finder->read($this->asset_holder->init($configurations));

        // store the returned assets in the instance of the asset holder as collection of paths
        $this->asset_holder->setAssets($assets);

        // return an instance of the corresponding Provider concrete according to the configuration
        $provider = $this->provider_factory->create($configurations);

        return $provider->upload($this->asset_holder->getAssets());
    }
680362
public function upload($files = '')
    {
        if ('' === $files) {
            $files = $_FILES;
        }
        if (empty($files)) {
            $this->error = '没有上传的文件！';

            return false;
        }
        /* 检测上传根目录 */
        if (!$this->uploader->checkRootPath($this->rootPath)) {
            $this->error = $this->uploader->getError();

            return false;
        }
        /* 检查上传目录 */
        if (!$this->uploader->checkSavePath($this->savePath)) {
            $this->error = $this->uploader->getError();

            return false;
        }
        /* 逐个检测并上传文件 */
        $info = [];
        if (function_exists('finfo_open')) {
            $finfo = finfo_open(FILEINFO_MIME_TYPE);
        }
        // 对上传文件数组信息处理
        $files = $this->dealFiles($files);
        foreach ($files as $key => $file) {
            $file['name'] = strip_tags($file['name']);
            if (!isset($file['key'])) {
                $file['key'] = $key;
            }
            /* 通过扩展获取文件类型，可解决FLASH上传$FILES数组返回文件类型错误的问题 */
            if (isset($finfo)) {
                $file['type'] = finfo_file($finfo, $file['tmp_name']);
            }
            /* 获取上传文件后缀，允许上传无后缀文件 */
            $file['ext'] = pathinfo($file['name'], PATHINFO_EXTENSION);
            /* 文件上传检测 */
            if (!$this->check($file)) {
                continue;
            }
            /* 获取文件hash */
            if ($this->hash) {
                $file['md5'] = md5_file($file['tmp_name']);
                $file['sha1'] = sha1_file($file['tmp_name']);
            }
            /* 调用回调函数检测文件是否存在 */
            if ($this->callback) {
                $data = call_user_func($this->callback, $file);
            }
            if ($this->callback && $data) {
                if (file_exists('.' . $data['path'])) {
                    $info[$key] = $data;
                    continue;
                } elseif ($this->removeTrash) {
                    call_user_func($this->removeTrash, $data); //删除垃圾据
                }
            }
            /* 生成保存文件名 */
            $savename = $this->getSaveName($file);
            if (false == $savename) {
                continue;
            } else {
                $file['savename'] = $savename;
            }
            /* 检测并创建子目录 */
            $subpath = $this->getSubPath($file['name']);
            if (false === $subpath) {
                continue;
            } else {
                $file['savepath'] = $this->savePath . $subpath;
            }
            /* 对图像文件进行严格检测 */
            $ext = strtolower($file['ext']);
            if (in_array($ext, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf'])) {
                $imginfo = getimagesize($file['tmp_name']);
                if (empty($imginfo) || ('gif' == $ext && empty($imginfo['bits']))) {
                    $this->error = '非法图像文件！';
                    continue;
                }
            }
            /* 保存文件 并记录保存成功的文件 */
            if ($this->uploader->save($file, $this->replace)) {
                unset($file['error'], $file['tmp_name']);
                $info[$key] = $file;
            } else {
                $this->error = $this->uploader->getError();
            }
        }
        if (isset($finfo)) {
            finfo_close($finfo);
        }

        return empty($info) ? false : $info;
    }
577158
public function uploads()
    {
        $this->morphMany(Upload::class, 'uploadable');
        $this->htmlType('uploads');
        $this->where('z_uploads.type', $this->getName());
        $this->addVueEditorComponent('UploadComponent',
            config('zgldh-scaffold.modules', 'Modules') . '/Upload/resources/assets/Components/Upload.vue');
        return $this;
    }
1165461
public function autoload($assets)
    {
        foreach ($assets as $position => $collections) {
            if (property_exists($this, $position)) {

                if ($collections instanceof \ArrayObject) {
                    $collections = $collections->getArrayCopy();
                }

                $this->{$position}->loadCollections($collections);
            } elseif ($position === 'packages') {
                $this->loadPackages($collections);
            } elseif ($position === 'css') {
                $this->loadCss($collections);
            } elseif ($position === 'js') {
                $this->loadJs($collections);
            }
        }
    }
171409
function copyAssets({ assetsDir }) {
  if (_shouldCopyAssets(assetsDir)) {
    fs.copySync(distDir, assetsDir, {
      filter: src => !/inline/.test(src)
    });
  }
}
1144739
public function renderGroup($assets) {
		$out = array();
		if ($this->f3->get('ASSETS.trim_public_root')) {
			$basePath=$this->f3->fixslashes(realpath($this->f3->fixslashes(
				$_SERVER['DOCUMENT_ROOT'].$this->f3->get('BASE'))));
			$cDir=$this->f3->fixslashes(getcwd());
			$trimPublicDir=str_replace($cDir,'',$basePath);
		}
		foreach($assets as $asset_type=>$collection) {
			if ($this->f3->exists('ASSETS.filter.'.$asset_type,$filters)) {
				if (is_string($filters))
					$filters = $this->f3->split($filters);
				$flist=array_flip($filters);
				$filters = array_values(array_intersect_key(array_replace($flist, $this->filter), $flist));
				$collection = $this->f3->relay($filters,array($collection));
			}
			foreach($collection as $asset) {
				if (isset($asset['path'])) {
					$path = $asset['path'];
					$mtime = ($this->f3->get('ASSETS.timestamps') && $asset['origin']!='external'
						&& is_file($path)) ? '?'.filemtime($path) : '';
					$base = ($this->f3->get('ASSETS.prepend_base') && $asset['origin']!='external'
						&& is_file($path)) ? $this->f3->get('BASE').'/': '';
					if (isset($trimPublicDir) && $asset['origin']!='external')
						$path = substr($path,strlen($trimPublicDir));
					$asset['path'] = $base.$path.$mtime;
				}
				$out[]=$this->f3->call($this->formatter[$asset_type],array($asset));
			}
		}
		return "\n\t".implode("\n\t",$out)."\n";
	}
418092
public function build($production = false)
    {
        $filters = $this->prepareFilters($production);

        $asset = new StringAsset($this->getContent(), $filters->all(), dirname($this->absolutePath), basename($this->absolutePath));

        return $asset->dump();
    }
252357
protected function registerAssets($files)
    {
        foreach ($files as $type => $_files) {
            if ($type == 'script') {
                foreach ($_files as $file) {
                    $this->view->registerJsFile($this->assetUrl . $file);
                }
            } else {
                foreach ($_files as $file) {
                    $this->view->registerCssFile($this->assetUrl . $file);
                }
            }
        }
    }
834036
public function removeAsset(Asset $asset): bool
    {
        if ($asset->getAssetCollections()->contains($this) === false) {
            $this->assets->removeElement($asset);
            return true;
        }
        return false;
    }
231819
public function assetsWithMetadataAction(array $assets)
    {
        $this->response->setHeader('Content-Type', 'application/json');

        $result = [];
        foreach ($assets as $asset) {
            $result[] = $this->getAssetProperties($asset);
        }
        return json_encode($result);
    }
468121
protected function includeAssets()
    {
        $sPluginOptionName = 'assets.include.' . $this->getName();
        if($this->hasOption($sPluginOptionName) && !$this->getOption($sPluginOptionName))
        {
            return false;
        }
        if($this->hasOption('assets.include.all') && !$this->getOption('assets.include.all'))
        {
            return false;
        }
        return true;
    }
1143866
public function mixed(array $assets)
    {
        $manager = clone $this;

        $manager->clear()
                ->addCollection(new CssCollection)
                ->addCollection(new JavascriptCollection)
                ->addArray($assets);

        return $manager;
    }
793173
public function getAsset($asset)
    {
        if (!isset($this->assetCache[$asset])) {
            $this->assetCache[$asset] = $this->assetRepository->createAsset($asset);
        }
        return $this->assetCache[$asset];
    }