本文整理汇总了PHP中Magento\Framework\App\Utility\Files::getPhtmlFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::getPhtmlFiles方法的具体用法?PHP Files::getPhtmlFiles怎么用?PHP Files::getPhtmlFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Utility\Files
的用法示例。
在下文中一共展示了Files::getPhtmlFiles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deploy
/**
* Populate all static view files for specified root path and list of languages
*
* @param ObjectManagerFactory $omFactory
* @param array $locales
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function deploy(ObjectManagerFactory $omFactory, array $locales)
{
$this->omFactory = $omFactory;
if ($this->isDryRun) {
$this->output->writeln('Dry run. Nothing will be recorded to the target directory.');
}
$langList = implode(', ', $locales);
$this->output->writeln("Requested languages: {$langList}");
$libFiles = $this->filesUtil->getStaticLibraryFiles();
list($areas, $appFiles) = $this->collectAppFiles($locales);
foreach ($areas as $area => $themes) {
$this->emulateApplicationArea($area);
foreach ($locales as $locale) {
$this->emulateApplicationLocale($locale, $area);
foreach ($themes as $themePath) {
$this->output->writeln("=== {$area} -> {$themePath} -> {$locale} ===");
$this->count = 0;
$this->errorCount = 0;
/** @var \Magento\Theme\Model\View\Design $design */
$design = $this->objectManager->create('Magento\\Theme\\Model\\View\\Design');
$design->setDesignTheme($themePath, $area);
$assetRepo = $this->objectManager->create('Magento\\Framework\\View\\Asset\\Repository', ['design' => $design]);
$fileManager = $this->objectManager->create('Magento\\RequireJs\\Model\\FileManager', ['config' => $this->objectManager->create('Magento\\Framework\\RequireJs\\Config', ['assetRepo' => $assetRepo, 'design' => $design]), 'assetRepo' => $assetRepo]);
$fileManager->createRequireJsConfigAsset();
foreach ($appFiles as $info) {
list($fileArea, $fileTheme, , $module, $filePath) = $info;
if (($fileArea == $area || $fileArea == 'base') && ($fileTheme == '' || $fileTheme == $themePath || in_array($fileArea . Theme::THEME_PATH_SEPARATOR . $fileTheme, $this->findAncestors($area . Theme::THEME_PATH_SEPARATOR . $themePath)))) {
$this->deployFile($filePath, $area, $themePath, $locale, $module);
}
}
foreach ($libFiles as $filePath) {
$this->deployFile($filePath, $area, $themePath, $locale, null);
}
if ($this->jsTranslationConfig->dictionaryEnabled()) {
$this->deployFile($this->jsTranslationConfig->getDictionaryFileName(), $area, $themePath, $locale, null);
}
$fileManager->clearBundleJsPool();
$this->bundleManager->flush();
$this->output->writeln("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n");
}
}
}
$this->output->writeln("=== Minify templates ===");
$this->count = 0;
foreach ($this->filesUtil->getPhtmlFiles(false, false) as $template) {
$this->htmlMinifier->minify($template);
if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->output->writeln($template . " minified\n");
} else {
$this->output->write('.');
}
$this->count++;
}
$this->output->writeln("\nSuccessful: {$this->count} files modified\n---\n");
$version = (new \DateTime())->getTimestamp();
$this->output->writeln("New version of deployed files: {$version}");
if (!$this->isDryRun) {
$this->versionStorage->save($version);
}
}
示例2: deploy
/**
* Populate all static view files for specified root path and list of languages
*
* @param ObjectManagerFactory $omFactory
* @param array $locales
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function deploy(ObjectManagerFactory $omFactory, array $locales)
{
$this->omFactory = $omFactory;
if ($this->isDryRun) {
$this->output->writeln('Dry run. Nothing will be recorded to the target directory.');
}
$langList = implode(', ', $locales);
$this->output->writeln("Requested languages: {$langList}");
$libFiles = $this->filesUtil->getStaticLibraryFiles();
list($areas, $appFiles) = $this->collectAppFiles($locales);
foreach ($areas as $area => $themes) {
$this->emulateApplicationArea($area);
foreach ($locales as $locale) {
$this->emulateApplicationLocale($locale, $area);
foreach ($themes as $themePath) {
$this->output->writeln("=== {$area} -> {$themePath} -> {$locale} ===");
$this->count = 0;
$this->errorCount = 0;
foreach ($appFiles as $info) {
list($fileArea, , , $module, $filePath) = $info;
if ($fileArea == $area || $fileArea == 'base') {
$this->deployFile($filePath, $area, $themePath, $locale, $module);
}
}
foreach ($libFiles as $filePath) {
$this->deployFile($filePath, $area, $themePath, $locale, null);
}
if ($this->jsTranslationConfig->dictionaryEnabled()) {
$this->deployFile(
$this->jsTranslationConfig->getDictionaryFileName(),
$area,
$themePath,
$locale,
null
);
}
$this->bundleManager->flush();
$this->output->writeln("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n");
}
}
}
$this->output->writeln("=== Minify templates ===");
$this->count = 0;
foreach ($this->filesUtil->getPhtmlFiles(false, false) as $template) {
$this->htmlMinifier->minify($template);
if ($this->output->isVerbose()) {
$this->output->writeln($template . " minified\n");
} else {
$this->output->write('.');
}
$this->count++;
}
$this->output->writeln("\nSuccessful: {$this->count} files modified\n---\n");
$version = (new \DateTime())->getTimestamp();
$this->output->writeln("New version of deployed files: {$version}");
if (!$this->isDryRun) {
$this->versionStorage->save($version);
}
}
示例3: deploy
/**
* Populate all static view files for specified root path and list of languages
*
* @param ObjectManagerFactory $omFactory
* @param array $locales
* @param array $deployableAreaThemeMap
* @return int
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function deploy(ObjectManagerFactory $omFactory, array $locales, array $deployableAreaThemeMap = [])
{
$this->omFactory = $omFactory;
if ($this->getOption(Options::DRY_RUN)) {
$this->output->writeln('Dry run. Nothing will be recorded to the target directory.');
}
$libFiles = $this->filesUtil->getStaticLibraryFiles();
$appFiles = $this->filesUtil->getStaticPreProcessingFiles();
foreach ($deployableAreaThemeMap as $area => $themes) {
$this->emulateApplicationArea($area);
foreach ($locales as $locale) {
$this->emulateApplicationLocale($locale, $area);
foreach ($themes as $themePath) {
$this->output->writeln("=== {$area} -> {$themePath} -> {$locale} ===");
$this->count = 0;
$this->errorCount = 0;
/** @var \Magento\Theme\Model\View\Design $design */
$design = $this->objectManager->create(\Magento\Theme\Model\View\Design::class);
$design->setDesignTheme($themePath, $area);
$assetRepo = $this->objectManager->create(\Magento\Framework\View\Asset\Repository::class, ['design' => $design]);
/** @var \Magento\RequireJs\Model\FileManager $fileManager */
$fileManager = $this->objectManager->create(\Magento\RequireJs\Model\FileManager::class, ['config' => $this->objectManager->create(\Magento\Framework\RequireJs\Config::class, ['assetRepo' => $assetRepo, 'design' => $design]), 'assetRepo' => $assetRepo]);
$fileManager->createRequireJsConfigAsset();
foreach ($appFiles as $info) {
list($fileArea, $fileTheme, , $module, $filePath, $fullPath) = $info;
if ($this->checkSkip($filePath)) {
continue;
}
if (($fileArea == $area || $fileArea == 'base') && ($fileTheme == '' || $fileTheme == $themePath || in_array($fileArea . Theme::THEME_PATH_SEPARATOR . $fileTheme, $this->findAncestors($area . Theme::THEME_PATH_SEPARATOR . $themePath)))) {
$compiledFile = $this->deployFile($filePath, $area, $themePath, $locale, $module, $fullPath);
if ($compiledFile !== '') {
$this->deployFile($compiledFile, $area, $themePath, $locale, $module, $fullPath);
}
}
}
foreach ($libFiles as $filePath) {
if ($this->checkSkip($filePath)) {
continue;
}
$compiledFile = $this->deployFile($filePath, $area, $themePath, $locale, null);
if ($compiledFile !== '') {
$this->deployFile($compiledFile, $area, $themePath, $locale, null);
}
}
if (!$this->getOption(Options::NO_JAVASCRIPT)) {
if ($this->jsTranslationConfig->dictionaryEnabled()) {
$dictionaryFileName = $this->jsTranslationConfig->getDictionaryFileName();
$this->deployFile($dictionaryFileName, $area, $themePath, $locale, null);
}
if ($this->getMinification()->isEnabled('js')) {
$fileManager->createMinResolverAsset();
}
}
$this->bundleManager->flush();
$this->output->writeln("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n");
}
}
}
if (!($this->getOption(Options::NO_HTML_MINIFY) ?: !$this->getAssetConfig()->isMinifyHtml())) {
$this->output->writeln('=== Minify templates ===');
$this->count = 0;
foreach ($this->filesUtil->getPhtmlFiles(false, false) as $template) {
$this->htmlMinifier->minify($template);
if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->output->writeln($template . " minified\n");
} else {
$this->output->write('.');
}
$this->count++;
}
$this->output->writeln("\nSuccessful: {$this->count} files modified\n---\n");
}
$version = (new \DateTime())->getTimestamp();
$this->output->writeln("New version of deployed files: {$version}");
if (!$this->getOption(Options::DRY_RUN)) {
$this->versionStorage->save($version);
}
if ($this->errorCount > 0) {
// we must have an exit code higher than zero to indicate something was wrong
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
}
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
}