} else { /*** 错误处理,如果网站出现错误,我简单的把用户定位到 首页 ***/ $f3->set('ONERROR', function ($f3) { /** * Information about the last HTTP error that occurred. * ERROR.code is the HTTP status code. * ERROR.title contains a brief description of the error. * ERROR.text provides greater detail. For HTTP 500 errors, use ERROR.trace to retrieve the stack trace. */ $code = $f3->get('ERROR.code'); RouteHelper::reRoute(null, '/'); }); } // ---------------------------------------- 4. 加载显示主题 -------------------------------------- // 为 Manage 设置网站的 WebRootBase,这样在 Manage 中就可以对相应网站做操作 $systemUrlBase = ManageThemePlugin::getSystemUrlBase(PluginHelper::SYSTEM_MOBILE); if (empty($systemUrlBase) || $systemUrlBase['base'] != $f3->get('sysConfig[webroot_url_prefix]')) { ManageThemePlugin::saveSystemUrlBase(PluginHelper::SYSTEM_MOBILE, '移动', '棒主妇移动端网站', $f3->get('sysConfig[webroot_url_prefix]')); } $themeIntance = ThemeHelper::loadSystemTheme(ThemeHelper::SYSTEM_MOBILE_THEME); if (!$themeIntance) { die('没有正确设置 ' . ThemeHelper::SYSTEM_MOBILE_THEME . ' 主题'); } // 调用主题自己的初始化方法 $themeLoadRet = $themeIntance->pluginLoad(PluginHelper::SYSTEM_MOBILE); if (true !== $themeLoadRet) { die(ThemeHelper::SYSTEM_MOBILE_THEME . ' 主题无法初始化:' . $themeLoadRet); } // 调用主题的 action $themeActionRet = $themeIntance->pluginAction(PluginHelper::SYSTEM_MOBILE); if (true !== $themeActionRet) {
/** * 生成不同系统的 URL,比如生成 Shop, Groupon, Mobile 系统的 URL * 在 Manage 或者 Supplier 中很有用 * * @param string $system * @param string $controller * @param array $paramArray * @param bool $static * * @return string * @throws \InvalidArgumentException */ public static function makeShopSystemUrl($system, $controller, array $paramArray = null, $static = null) { if (empty($system)) { throw new \InvalidArgumentException('system can not be empty'); } $systemUrlBase = ManageThemePlugin::getSystemUrlBase($system); global $f3; if (empty($systemUrlBase) || !isset($systemUrlBase['base'])) { if ($f3->get('DEBUG')) { throw new \InvalidArgumentException('system [' . $system . '] is invalid'); } return ''; } if (null === $static) { $static = $f3->get('sysConfig[enable_static_url][' . $system . ']'); if (empty($static)) { $static = false; } } return self::makeUrlWithSiteBase($systemUrlBase['base'], $controller, $paramArray, false, false, $static); }