continue; } $from = $src . DIRECTORY_SEPARATOR . $file; $to = $dst . DIRECTORY_SEPARATOR . $file; if (static::filterPath($from, $options)) { if (isset($options['beforeCopy']) && !call_user_func($options['beforeCopy'], $from, $to)) { continue; } if (is_file($from)) { 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); } }
$to = $dst . DIRECTORY_SEPARATOR . $file; if (static::filterPath($from, $options)) { if (isset($options['beforeCopy']) && !call_user_func($options['beforeCopy'], $from, $to)) { continue; } if (is_file($from)) { copy($from, $to); if (isset($options['fileMode'])) { @chmod($to, $options['fileMode']); } } else { // recursive copy, defaults to true if (!isset($options['recursive']) || $options['recursive']) {
}; } } if (!isset($opts['afterCopy']) && $this->afterCopy !== null) { $opts['afterCopy'] = $this->afterCopy; } FileHelper::copyDirectory($src, $dstDir, $opts); } return [$dstDir, $this->baseUrl . '/' . $dir]; } /**
throw new InvalidParamException("The file or directory to be published does not exist: $path"); } if (is_file($src)) { return $this->_published[$path] = $this->publishFile($src); } else { return $this->_published[$path] = $this->publishDirectory($src, $options); } } /** * Publishes a file. * @param string $src the asset file to be published
* 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; } /** * Loads dummy bundle by name
*/ 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); }
* Registers this asset bundle with a view. * @param View $view the view to be registered with * @return static the registered asset bundle instance */ public static function register($view) { return $view->registerAssetBundle(get_called_class()); } /** * Initializes the bundle. * If you override this method, make sure you call the parent implementation in the last. */
$thumb=Resource::getAppPicUrl("/images/nopic.png"); } }else { $this->title = '小游戏'; } MofangAsset::register($this); //电脑、手机链接 $pcUrl = str_replace(array('m.'), array('www.'), 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); $wapUrl = str_replace(array('m.','www.'), array('www.','m.'), 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>
*/ public function renderPhpFile($_file_, $_params_ = []) { ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); require($_file_); return ob_get_clean(); } /** * Renders dynamic content returned by the given PHP statements.
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
} public function renderFile($viewFile, $params = [], $context = null) { if ($this->theme == null) { $this->setTheme(); } return parent::renderFile($viewFile, $params, $context); } public function setTheme() { }
* @throws InvalidParamException if the view cannot be resolved or the view file does not exist. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the path alias of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidParamException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
*/ class MofangController extends \common\core\front\FrontController { public function actionIndex() { $this->layout = false; return $this->render('index'); } }
Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
if($siteStatus === '0') { $application->catchAll = ['/site/default/close', 'message' => 'test']; } $application->run();