当前位置: 首页>>代码示例>>PHP>>正文


PHP MauticFactory::getEnvironment方法代码示例

本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getEnvironment方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getEnvironment方法的具体用法?PHP MauticFactory::getEnvironment怎么用?PHP MauticFactory::getEnvironment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mautic\CoreBundle\Factory\MauticFactory的用法示例。


在下文中一共展示了MauticFactory::getEnvironment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->devMode = $factory->getEnvironment() == 'dev';
     $this->imageDir = $factory->getSystemPath('images');
     $this->assetHelper = $factory->getHelper('template.assets');
     $this->avatarHelper = $factory->getHelper('template.avatar');
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:10,代码来源:GravatarHelper.php

示例2: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->factory = $factory;
     $this->cacheDir = $factory->getSystemPath('cache', true);
     $this->env = $factory->getEnvironment();
     $this->configFile = $this->factory->getLocalConfigFile(false);
     $this->containerFile = $this->factory->getKernel()->getContainerFile();
 }
开发者ID:HomeRefill,项目名称:mautic,代码行数:11,代码来源:CacheHelper.php

示例3: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->devMode = $factory->getEnvironment() == 'dev';
     $this->imageDir = $factory->getSystemPath('images');
     $this->assetHelper = $factory->getHelper('template.assets');
     $this->avatarHelper = $factory->getHelper('template.avatar');
     $this->request = $factory->getRequest();
     $this->devHosts = (array) $factory->getParameter('dev_hosts');
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:12,代码来源:GravatarHelper.php

示例4: getAssets

 /**
  * Generates and returns assets
  *
  * @param bool $forceRegeneration
  *
  * @return array
  */
 public function getAssets($forceRegeneration = false)
 {
     static $assets = array();
     if (empty($assets)) {
         $loadAll = true;
         $env = $forceRegeneration ? 'prod' : $this->factory->getEnvironment();
         $rootPath = $this->factory->getSystemPath('assets_root');
         $assetsPath = $this->factory->getSystemPath('assets');
         $assetsFullPath = "{$rootPath}/{$assetsPath}";
         if ($env == 'prod') {
             $loadAll = false;
             //by default, loading should not be required
             //check for libraries and app files and generate them if they don't exist if in prod environment
             $prodFiles = array('css/libraries.css', 'css/app.css', 'js/libraries.js', 'js/app.js');
             foreach ($prodFiles as $file) {
                 if (!file_exists("{$assetsFullPath}/{$file}")) {
                     $loadAll = true;
                     //it's missing so compile it
                     break;
                 }
             }
         }
         if ($loadAll || $forceRegeneration) {
             if ($env == 'prod') {
                 ini_set('max_execution_time', 300);
                 $inProgressFile = "{$assetsFullPath}/generation_in_progress.txt";
                 if (!$forceRegeneration) {
                     while (file_exists($inProgressFile)) {
                         //dummy loop to prevent conflicts if one process is actively regenerating assets
                     }
                 }
                 file_put_contents($inProgressFile, date('r'));
             }
             $modifiedLast = array();
             //get a list of all core asset files
             $bundles = $this->factory->getParameter('bundles');
             $fileTypes = array('css', 'js');
             foreach ($bundles as $bundle) {
                 foreach ($fileTypes as $ft) {
                     if (!isset($modifiedLast[$ft])) {
                         $modifiedLast[$ft] = array();
                     }
                     $dir = "{$bundle['directory']}/Assets/{$ft}";
                     if (file_exists($dir)) {
                         $modifiedLast[$ft] = array_merge($modifiedLast[$ft], $this->findAssets($dir, $ft, $env, $assets));
                     }
                 }
             }
             $modifiedLast = array_merge($modifiedLast, $this->findOverrides($env, $assets));
             //combine the files into their corresponding name and put in the root media folder
             if ($env == "prod") {
                 $checkPaths = array($assetsFullPath, "{$assetsFullPath}/css", "{$assetsFullPath}/js");
                 array_walk($checkPaths, function ($path) {
                     if (!file_exists($path)) {
                         mkdir($path);
                     }
                 });
                 $useMinify = class_exists('\\Minify');
                 foreach ($assets as $type => $groups) {
                     foreach ($groups as $group => $files) {
                         $assetFile = "{$assetsFullPath}/{$type}/{$group}.{$type}";
                         //only refresh if a change has occurred
                         $modified = $forceRegeneration || !file_exists($assetFile) ? true : filemtime($assetFile) < $modifiedLast[$type][$group];
                         if ($modified) {
                             if (file_exists($assetFile)) {
                                 //delete it
                                 unlink($assetFile);
                             }
                             if ($type == 'css') {
                                 $out = fopen($assetFile, 'w');
                                 foreach ($files as $relPath => $details) {
                                     $cssRel = '../../' . dirname($relPath) . '/';
                                     if ($useMinify) {
                                         $content = \Minify::combine(array($details['fullPath']), array('rewriteCssUris' => false, 'minifierOptions' => array('text/css' => array('currentDir' => '', 'prependRelativePath' => $cssRel))));
                                     } else {
                                         $content = file_get_contents($details['fullPath']);
                                         $search = '#url\\((?!\\s*([\'"]?(((?:https?:)?//)|(?:data\\:?:))))\\s*([\'"])?#';
                                         $replace = "url(\$4{$cssRel}";
                                         $content = preg_replace($search, $replace, $content);
                                     }
                                     fwrite($out, $content);
                                 }
                                 fclose($out);
                             } else {
                                 array_walk($files, function (&$file) {
                                     $file = $file['fullPath'];
                                 });
                                 file_put_contents($assetFile, \Minify::combine($files));
                             }
                         }
                     }
                 }
                 unlink($inProgressFile);
//.........这里部分代码省略.........
开发者ID:HomeRefill,项目名称:mautic,代码行数:101,代码来源:AssetGenerationHelper.php

示例5: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     self::$devMode = $factory->getEnvironment() == 'dev';
 }
开发者ID:woakes070048,项目名称:mautic,代码行数:7,代码来源:GravatarHelper.php

示例6: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->factory = $factory;
     $this->cacheDir = $factory->getSystemPath('cache', true);
     $this->env = $factory->getEnvironment();
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:9,代码来源:CacheHelper.php


注:本文中的Mautic\CoreBundle\Factory\MauticFactory::getEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。