if (isset($options['beforeCopy']) && !call_user_func($options['beforeCopy'], $from, $to)) { continue; } if (is_file($from)) { if (!$dstExists) { // delay creation of destination directory until the first file is copied to avoid creating empty directories static::createDirectory($dst, isset($options['dirMode']) ? $options['dirMode'] : 0775, true); $dstExists = true; } copy($from, $to); if (isset($options['fileMode'])) { @chmod($to, $options['fileMode']); } } else { // recursive copy, defaults to true if (!isset($options['recursive']) || $options['recursive']) { static::copyDirectory($from, $to, $options); } }
if (isset($options['fileMode'])) { @chmod($to, $options['fileMode']); } } else { // recursive copy, defaults to true if (!isset($options['recursive']) || $options['recursive']) { static::copyDirectory($from, $to, $options); } } if (isset($options['afterCopy'])) { call_user_func($options['afterCopy'], $from, $to); } }
if (isset($options['fileMode'])) { @chmod($to, $options['fileMode']); } } else { // recursive copy, defaults to true if (!isset($options['recursive']) || $options['recursive']) { static::copyDirectory($from, $to, $options); } } if (isset($options['afterCopy'])) { call_user_func($options['afterCopy'], $from, $to); } }
if (isset($options['fileMode'])) { @chmod($to, $options['fileMode']); } } else { // recursive copy, defaults to true if (!isset($options['recursive']) || $options['recursive']) { static::copyDirectory($from, $to, $options); } } if (isset($options['afterCopy'])) { call_user_func($options['afterCopy'], $from, $to); } }
}; } } if (!isset($opts['afterCopy']) && $this->afterCopy !== null) { $opts['afterCopy'] = $this->afterCopy; } FileHelper::copyDirectory($src, $dstDir, $opts); } return [$dstDir, $this->baseUrl . '/' . $dir]; } /**
} if (is_file($src)) { return $this->_published[$path] = $this->publishFile($src); } return $this->_published[$path] = $this->publishDirectory($src, $options); } /** * Publishes a file. * @param string $src the asset file to be published * @return string[] the path and the URL that the asset is published as.
* CSS or JS files using [[AssetManager::converter|asset converter]]. * @param AssetManager $am the asset manager to perform the asset publishing */ public function publish($am) { if ($this->sourcePath !== null && !isset($this->basePath, $this->baseUrl)) { list($this->basePath, $this->baseUrl) = $am->publish($this->sourcePath, $this->publishOptions); } if (isset($this->basePath, $this->baseUrl) && ($converter = $am->getConverter()) !== null) { foreach ($this->js as $i => $js) { if (is_array($js)) { $file = array_shift($js);
if (!isset($config['class'])) { $config['class'] = $name; } /* @var $bundle AssetBundle */ $bundle = Yii::createObject($config); if ($publish) { $bundle->publish($this); } return $bundle; } /**
*/ public function getBundle($name, $publish = true) { if ($this->bundles === false) { return $this->loadDummyBundle($name); } elseif (!isset($this->bundles[$name])) { return $this->bundles[$name] = $this->loadBundle($name, [], $publish); } elseif ($this->bundles[$name] instanceof AssetBundle) { return $this->bundles[$name]; } elseif (is_array($this->bundles[$name])) { return $this->bundles[$name] = $this->loadBundle($name, $this->bundles[$name], $publish); } elseif ($this->bundles[$name] === false) { return $this->loadDummyBundle($name);
* @throws InvalidConfigException if the asset bundle does not exist or a circular dependency is detected */ public function registerAssetBundle($name, $position = null) { if (!isset($this->assetBundles[$name])) { $am = $this->getAssetManager(); $bundle = $am->getBundle($name); $this->assetBundles[$name] = false; // register dependencies $pos = isset($bundle->jsOptions['position']) ? $bundle->jsOptions['position'] : null; foreach ($bundle->depends as $dep) { $this->registerAssetBundle($dep, $pos); }
$am = $this->getAssetManager(); $bundle = $am->getBundle($name); $this->assetBundles[$name] = false; // register dependencies $pos = isset($bundle->jsOptions['position']) ? $bundle->jsOptions['position'] : null; foreach ($bundle->depends as $dep) { $this->registerAssetBundle($dep, $pos); } $this->assetBundles[$name] = $bundle; } elseif ($this->assetBundles[$name] === false) { throw new InvalidConfigException("A circular dependency is detected for bundle '$name'."); } else { $bundle = $this->assetBundles[$name];
$am = $this->getAssetManager(); $bundle = $am->getBundle($name); $this->assetBundles[$name] = false; // register dependencies $pos = isset($bundle->jsOptions['position']) ? $bundle->jsOptions['position'] : null; foreach ($bundle->depends as $dep) { $this->registerAssetBundle($dep, $pos); } $this->assetBundles[$name] = $bundle; } elseif ($this->assetBundles[$name] === false) { throw new InvalidConfigException("A circular dependency is detected for bundle '$name'."); } else { $bundle = $this->assetBundles[$name];
'class' => AssetBundle::className(), 'baseUrl' => '', 'css' => [strncmp($url, '//', 2) === 0 ? $url : ltrim($url, '/')], 'cssOptions' => $options, 'depends' => (array) $depends, ]); $this->registerAssetBundle($key); } } /** * Registers a JS code block. * @param string $js the JS code block to be registered
/** * @inheritdoc */ public function registerCssFile($url, $options = [], $key = null) { parent::registerCssFile($this->addCacheBustQuery($url), $options, $key); } /** * Adds cache bust query string to given url if no query is present * * @param string $url
$parent->register(false); } } if (file_exists($this->getBasePath() . '/css/theme.css')) { $mtime = filemtime($this->getBasePath() . '/css/theme.css'); Yii::$app->view->registerCssFile($this->getBaseUrl() . '/css/theme.css?v=' . $mtime, ['depends' => AppAsset::class]); } } /**
$app->mailer->view->theme = $theme; } } } if (!Yii::$app->request->isConsoleRequest && $app->view->theme instanceof Theme) { $app->view->theme->register(); } } }
if (!isset($component)) { $component = Yii::createObject($mixed); } if ($component instanceof BootstrapInterface) { Yii::debug('Bootstrap with ' . get_class($component) . '::bootstrap()', __METHOD__); $component->bootstrap($this); } else { Yii::debug('Bootstrap with ' . get_class($component), __METHOD__); } } }
protected function bootstrap() { $request = $this->getRequest(); Yii::setAlias('@webroot', dirname($request->getScriptFile())); Yii::setAlias('@web', $request->getBaseUrl()); parent::bootstrap(); } /** * Handles the specified request. * @param Request $request the request to be handled * @return Response the resulting response
} if (Yii::getAlias('@webroot-static', false) === false) { Yii::setAlias('@webroot-static', '@webroot/static'); } parent::bootstrap(); } /** * @return string the homepage URL */ public function getHomeUrl()
/** * {@inheritdoc} */ public function init() { $this->state = self::STATE_INIT; $this->bootstrap(); } /** * Initializes extensions and executes bootstrap components. * This method is called by [[init()]] after the application has been fully configured. * If you override this method, make sure you also call the parent implementation.
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
$this->state = self::STATE_BEGIN; $this->preInit($config); $this->registerErrorHandler($config); Component::__construct($config); } /** * Pre-initializes the application. * This method is called at the beginning of the application constructor. * It initializes several important application properties.
require(__DIR__ . '/protected/humhub/config/web.php'), (is_readable(__DIR__ . '/protected/config/dynamic.php')) ? require(__DIR__ . '/protected/config/dynamic.php') : [], require(__DIR__ . '/protected/config/common.php'), require(__DIR__ . '/protected/config/web.php') ); (new humhub\components\Application($config))->run();