示例#1
0
 public function pluginDeactivate($system)
 {
     ThemeHelper::setSystemThemeDirName(ThemeHelper::SYSTEM_MOBILE_THEME, null);
     // 删除在 Manage 系统中的设置
     ManageThemePlugin::removeSystemUrlBase(PluginHelper::SYSTEM_MOBILE);
     return true;
 }
示例#2
0
 public function __construct()
 {
     $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
     // 我们只搜索有效商品
     $this->searchExtraCondArray = array(array('is_delete = 0 AND is_on_sale = 1 AND is_alone_sale = 1'), array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray())));
     // 选择我们需要的字段
     $this->searchFieldSelector = 'goods_id, goods_name, market_price, shop_price';
 }
示例#3
0
 public function __construct()
 {
     $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
     // 我们只搜索有效商品
     $this->searchExtraCondArray = array(array('is_delete = 0 AND is_on_sale = 1 AND is_alone_sale = 1'), array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray())));
     // 选择我们需要的字段
     $this->searchFieldSelector = 'goods_id, cat_id, goods_sn, goods_name, brand_id, goods_number, market_price, shop_price, suppliers_id,' . 'virtual_buy_number, user_buy_number, user_pay_number, (virtual_buy_number + user_pay_number) as total_buy_number';
 }
示例#4
0
    public function get($f3)
    {
        global $smarty;
        $smartyCacheId = 'EtaoFeed|' . md5(__NAMESPACE__ . '\\' . __CLASS__ . '_\\' . __METHOD__);
        // 判断是否有缓存
        enableSmartyCache(true, 1200);
        // 缓存 20 分钟
        if ($smarty->isCached('empty.tpl', $smartyCacheId)) {
            goto out_display;
        }
        $currentStamp = Time::localTimeStr();
        $sellerId = EtaoFeedPlugin::getOptionValue('etaofeed_seller_id');
        $categoryUrl = RouteHelper::makeUrl('/Thirdpart/EtaoFeed/Category', null, false, true);
        $itemDir = RouteHelper::makeUrl('/Thirdpart/EtaoFeed/Item', null, false, true);
        $itemIdXmlList = '';
        // 处理 delete 的商品
        $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
        $totalGoodsCount = SearchHelper::count(SearchHelper::Module_Goods, array(array('is_on_sale = 0'), array('update_time', '>=', EtaoFeedPlugin::getOptionValue('etaofeed_query_timestamp')), array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray()))));
        if ($totalGoodsCount <= 0) {
            goto query_update_goods;
        }
        $totalPageCount = ceil($totalGoodsCount / Item::$pageSize);
        for ($index = 0; $index < $totalPageCount; $index++) {
            $itemIdXmlList .= '<outer_id action="delete">1' . $index . '</outer_id>';
        }
        query_update_goods:
        // 处理修改过的商品
        $totalGoodsCount = SearchHelper::count(SearchHelper::Module_Goods, array(array('is_on_sale = 1'), array('update_time', '>=', EtaoFeedPlugin::getOptionValue('etaofeed_query_timestamp')), array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray()))));
        if ($totalGoodsCount <= 0) {
            goto out_output;
        }
        $totalPageCount = ceil($totalGoodsCount / Item::$pageSize);
        for ($index = 0; $index < $totalPageCount; $index++) {
            $itemIdXmlList .= '<outer_id action="upload">2' . $index . '</outer_id>';
        }
        out_output:
        $apiXml = <<<XML
<?xml version="1.0" encoding="utf-8" ?>
<root>
  <version>1.0</version>
  <modified>{$currentStamp}</modified>
  <seller_id>{$sellerId}</seller_id>
  <cat_url>{$categoryUrl}</cat_url>
  <dir>{$itemDir}/</dir>
  <item_ids>{$itemIdXmlList}</item_ids>
</root>
XML;
        $smarty->assign('outputContent', $apiXml);
        // 更新查询时间
        //EtaoFeedPlugin::saveOptionValue('etaofeed_query_timestamp', Time::gmTime());
        out_display:
        header('Content-Type:text/xml;charset=utf-8');
        header("Cache-Control: no-cache, must-revalidate");
        // HTTP/1.1 //查询信息
        $smarty->display('empty.tpl', $smartyCacheId);
    }
示例#5
0
    public function get($f3)
    {
        global $smarty;
        $cacheTime = 300;
        // 缓存5分钟
        enableSmartyCache(true, $cacheTime);
        $smartyCacheId = 'Api|' . md5(__NAMESPACE__ . '\\' . __CLASS__ . '\\' . __METHOD__);
        // 判断是否有缓存
        if ($smarty->isCached('empty.tpl', $smartyCacheId)) {
            goto out_display;
        }
        // 查询商品
        $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
        $condArray = array(array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray())));
        $apiGoodsService = new ApiGoodsService();
        $goodsGalleryPromoteArray = $apiGoodsService->fetchGoodsGalleryPromote($condArray, 'aimeidaren_sort_order desc, sort_order desc, goods_id desc', 0, 0, $cacheTime);
        // 商品和图片
        $goodsArray = $goodsGalleryPromoteArray['goods'];
        $goodsIdToGalleryArray = $goodsGalleryPromoteArray['goodsIdToGalleryArray'];
        $xmlItems = '';
        $goodsArrayCount = count($goodsArray);
        for ($index = 0; $index < $goodsArrayCount; $index++) {
            $xmlItems .= $this->getGoodsItemXml($index + 1, $goodsArray[$index], $goodsIdToGalleryArray);
        }
        $apiXml = <<<XML
<?xml version="1.0" encoding="utf-8" ?>
<urlset>
\t{$xmlItems}
</urlset>
XML;
        unset($xmlItems);
        $smarty->assign('outputContent', $apiXml);
        out_display:
        header('Content-Type:text/xml;charset=utf-8');
        header("Cache-Control: no-cache, must-revalidate");
        // HTTP/1.1 //查询信息
        $smarty->display('empty.tpl', $smartyCacheId);
    }
示例#6
0
    /**
     * 输出 sitemapIndex 文件
     */
    public function outputSiteMapXml($f3, $fileName)
    {
        global $smarty;
        //缓存 60 分钟
        enableSmartyCache(true, 3600, \Smarty::CACHING_LIFETIME_CURRENT);
        $smartyCacheId = 'Api|' . md5(__NAMESPACE__ . '\\' . __CLASS__ . '\\' . __METHOD__);
        // 判断是否有缓存
        if ($smarty->isCached('empty.tpl', $smartyCacheId)) {
            goto out_display;
        }
        // sitemap 列表
        $siteMapFileList = '';
        // 当前时间
        $currentTime = time();
        /***************** 生成 /Goods/View 列表 *******************/
        // 查询商品数量,决定分页有多少页
        $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
        $totalGoodsCount = SearchHelper::count(SearchHelper::Module_Goods, array(array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray(), 'g'))));
        $pageCount = ceil($totalGoodsCount / $this->pageSize);
        // 取得当前的目录路径
        $currentUrl = RouteHelper::getFullURL();
        $currentUrl = substr($currentUrl, 0, strrpos($currentUrl, $fileName));
        // 生成 goods 页面索引
        for ($index = 0; $index < $pageCount; $index++) {
            $siteMapFileList .= '<sitemap><loc>' . $currentUrl . 'GoodsView_' . $currentTime . '_' . $index . '.xml</loc></sitemap>';
        }
        /***************** 生成 /Goods/Search 列表 *******************/
        // 生成 search 页面索引
        $siteMapFileList .= '<sitemap><loc>' . $currentUrl . 'GoodsSearch_' . $currentTime . '_0.xml</loc></sitemap>';
        /***************** 生成 /Article/View 列表 *******************/
        // 查询商品数量,决定分页有多少页
        $totalArticleCount = SearchHelper::count(SearchHelper::Module_Article, QueryBuilder::buildSearchParamArray(array('a.is_open' => 1)));
        $pageCount = ceil($totalArticleCount / $this->pageSize);
        // 生成 Article 页面索引
        for ($index = 0; $index < $pageCount; $index++) {
            $siteMapFileList .= '<sitemap><loc>' . $currentUrl . 'ArticleView_' . $currentTime . '_' . $index . '.xml</loc></sitemap>';
        }
        $apiXml = <<<XML
<?xml version="1.0" encoding="utf-8" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{$siteMapFileList}
</sitemapindex>
XML;
        $smarty->assign('outputContent', $apiXml);
        out_display:
        header('Content-Type:text/xml;charset=utf-8');
        header("Cache-Control: no-cache, must-revalidate");
        // HTTP/1.1 //查询信息
        $smarty->display('empty.tpl', $smartyCacheId);
    }
示例#7
0
文件: index.php 项目: swcug/bzfshop
    // 调试模式下,弄一个 fileLogger 方便查看所有的日志输出
    $fileLogger = new \Core\Log\File(\Core\Helper\Utility\Time::localTimeStr('Y-m-d') . '.supplier.debug.log');
    $logger->addLogger($fileLogger);
    // 把 smarty 的一些错误警告关闭,不然会影响我们的调试
    Smarty::muteExpectedErrors();
    // 使用自定义的调试框架
    if ($f3->get('USERDEBUG')) {
        require_once PROTECTED_PATH . '/Framework/Debug/BzfDebug.php';
        // 开启 debug 功能
        BzfDebug::enableDebug();
        // 开启 Smarty Web Log
        BzfDebug::enableSmartyWebLog();
    }
}
// ---------------------------------------- 4. 加载显示主题 --------------------------------------
$themeIntance = ThemeHelper::loadSystemTheme(ThemeHelper::SYSTEM_SUPPLIER_THEME);
if (!$themeIntance) {
    die('没有正确设置 ' . ThemeHelper::SYSTEM_SUPPLIER_THEME . ' 主题');
}
// 调用主题自己的初始化方法
$themeLoadRet = $themeIntance->pluginLoad(PluginHelper::SYSTEM_SUPPLIER);
if (true !== $themeLoadRet) {
    die(ThemeHelper::SYSTEM_SUPPLIER_THEME . ' 主题无法初始化:' . $themeLoadRet);
}
// 调用主题的 action
$themeActionRet = $themeIntance->pluginAction(PluginHelper::SYSTEM_SUPPLIER);
if (true !== $themeActionRet) {
    die(ThemeHelper::SYSTEM_SUPPLIER_THEME . ' 主题无法加载:' . $themeActionRet);
}
// ---------------------------------------- 5. 加载系统插件 --------------------------------------
// 这里我们加载额外的插件
示例#8
0
 /**
  * 加载所有 Active 的 theme
  *
  * @param string $system
  * @param string $excludeSystemTheme 排除某个系统
  */
 public static function loadActiveTheme($system, $excludeSystemTheme = null)
 {
     $activeThemeArray = ThemeHelper::getActiveThemeArray();
     if (empty($activeThemeArray)) {
         return;
     }
     foreach ($activeThemeArray as $activeTheme) {
         // 排除某个系统
         if ($excludeSystemTheme == $activeTheme) {
             printLog('exclude theme [' . $activeTheme . ']', 'PLUGIN', \Core\Log\Base::DEBUG);
             continue;
         }
         $instance = static::loadPluginInstance($activeTheme);
         if (!$instance) {
             printLog('theme [' . $activeTheme . '] does not exist', 'PLUGIN', \Core\Log\Base::ERROR);
             continue;
         }
         //调用插件的 load 方法做初始化
         if (true !== $instance->pluginLoad($system)) {
             // 如果加载失败,就不要做后面的操作了
             printLog('load theme [' . $activeTheme . '] failed', 'PLUGIN', \Core\Log\Base::DEBUG);
             unset($instance);
             continue;
         }
         global $f3;
         if ($f3->get('DEBUG')) {
             printLog('load theme [' . $activeTheme . '] success', 'PLUGIN', \Core\Log\Base::DEBUG);
         }
         // 把插件放入到列表中
         static::$pluginInstanceArray[$activeTheme] = $instance;
         unset($instance);
     }
 }
示例#9
0
 public function pluginDeactivate($system)
 {
     ThemeHelper::setSystemThemeDirName(ThemeHelper::SYSTEM_SUPPLIER_THEME, null);
     return true;
 }
示例#10
0
 public function UpdateTheme($f3)
 {
     // 权限检查,有权限安装就有权限升级
     $this->requirePrivilege('manage_plugin_theme_installtheme');
     // 参数验证
     $validator = new Validator($f3->get('GET'));
     $themeDirName = $validator->required()->validate('themeDirName');
     if (!$this->validate($validator)) {
         goto out;
     }
     $themeInstance = ThemeHelper::loadPluginInstance($themeDirName);
     if (!$themeInstance) {
         $this->addFlashMessage('主题[' . $themeDirName . ']无效');
         goto out;
     }
     // 调用主题操作
     $ret = $themeInstance->pluginUpdate();
     if (true !== $ret) {
         $this->addFlashMessage('主题[' . $themeDirName . ']升级失败:' . $ret);
         goto out;
     }
     $this->addFlashMessage('主题升级成功');
     out:
     RouteHelper::reRoute($this, RouteHelper::getRefer(), false);
 }
示例#11
0
文件: Item.php 项目: jackycgq/bzfshop
 /**
  * 查询下线的商品
  *
  * @param $pageNo
  *
  * @return mixed
  */
 private function queryDeleteGoods($pageNo)
 {
     $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
     return SearchHelper::search(SearchHelper::Module_Goods, $this->fieldSelector, array(array('is_on_sale = 0'), array('update_time', '>=', EtaoFeedPlugin::getOptionValue('etaofeed_query_timestamp')), array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray()))), array(array('g.goods_id', 'desc')), $pageNo * self::$pageSize, self::$pageSize);
 }
示例#12
0
    die(ThemeHelper::SYSTEM_MOBILE_THEME . ' 主题无法初始化:' . $themeLoadRet);
}
// 调用主题的 action
$themeActionRet = $themeIntance->pluginAction(PluginHelper::SYSTEM_MOBILE);
if (true !== $themeActionRet) {
    die(ThemeHelper::SYSTEM_MOBILE_THEME . ' 主题无法加载:' . $themeActionRet);
}
// ---------------------------------------- 5. 加载系统插件 --------------------------------------
// 这里我们加载额外的插件
PluginHelper::loadActivePlugin(PluginHelper::SYSTEM_MOBILE);
// 执行插件的 action 方法,让插件能完成各种注册
PluginHelper::doActivePluginAction(PluginHelper::SYSTEM_MOBILE);
// ----------------------------- 6. 把系统安装的主题当作插件一样加载上来,用于不同主题之间互相合作----------------
ThemeHelper::loadActiveTheme(PluginHelper::SYSTEM_MOBILE, ThemeHelper::getSystemThemeDirName(ThemeHelper::SYSTEM_MOBILE_THEME));
ThemeHelper::doActiveThemeAction(PluginHelper::SYSTEM_MOBILE);
// ---------------------------------------- 7. 启动整个系统 --------------------------------------
// 是否开启 URL 伪静态化
if ($f3->get('sysConfig[enable_static_url][' . PluginHelper::SYSTEM_MOBILE . ']')) {
    RouteHelper::$isMakeStaticUrl = true;
    // 我们开启 URL 伪静态化
    RouteHelper::processStaticUrl();
    // 解析静态化的 URL
}
// 启动控制器
$f3->run();
// unload 系统 active 的主题插件
ThemeHelper::unloadActiveTheme(PluginHelper::SYSTEM_MOBILE);
// 执行完成,卸载插件
PluginHelper::unloadActivePlugin(PluginHelper::SYSTEM_MOBILE);
// 执行完成,卸载主题
$themeIntance->pluginUnload(PluginHelper::SYSTEM_MOBILE);
示例#13
0
 private function verifyOrderSystem($orderInfo)
 {
     $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
     return in_array($orderInfo['system_id'], $currentThemeInstance->getOrderFilterSystemArray());
 }
示例#14
0
}
// 调用主题的 action
$themeActionRet = $themeIntance->pluginAction(PluginHelper::SYSTEM_SHOP);
if (true !== $themeActionRet) {
    die(ThemeHelper::SYSTEM_SHOP_THEME . ' 主题无法加载:' . $themeActionRet);
}
// ---------------------------------------- 5. 加载系统插件 --------------------------------------
// 在这里启动插件体系架构
// 这里我们加载额外的插件
PluginHelper::loadActivePlugin(PluginHelper::SYSTEM_SHOP);
// 执行插件的 action 方法,让插件能完成各种注册
PluginHelper::doActivePluginAction(PluginHelper::SYSTEM_SHOP);
// ----------------------------- 6. 把系统安装的主题当作插件一样加载上来,用于不同主题之间互相合作----------------
ThemeHelper::loadActiveTheme(PluginHelper::SYSTEM_SHOP, ThemeHelper::getSystemThemeDirName(ThemeHelper::SYSTEM_SHOP_THEME));
ThemeHelper::doActiveThemeAction(PluginHelper::SYSTEM_SHOP);
// ---------------------------------------- 7. 启动整个系统 --------------------------------------
// 是否开启 URL 伪静态化
if ($f3->get('sysConfig[enable_static_url][' . PluginHelper::SYSTEM_SHOP . ']')) {
    RouteHelper::$isMakeStaticUrl = true;
    // 我们开启 URL 伪静态化
    RouteHelper::processStaticUrl();
    // 解析静态化的 URL
}
// 启动控制器
$f3->run();
// unload 系统 active 的主题插件
ThemeHelper::unloadActiveTheme(PluginHelper::SYSTEM_SHOP);
// 执行完成,卸载插件
PluginHelper::unloadActivePlugin(PluginHelper::SYSTEM_SHOP);
// 执行完成,卸载主题
$themeIntance->pluginUnload(PluginHelper::SYSTEM_SHOP);
示例#15
0
 public function __construct()
 {
     $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
     // 我们只搜索有效商品
     $this->searchExtraCondArray = array(array('g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1'), array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray(), 'g')));
 }
示例#16
0
 public function __construct()
 {
     $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
     // 我们只搜索特定的系统的订单
     $this->searchExtraCondArray = array(array(QueryBuilder::buildOrderFilterForSystem($currentThemeInstance->getOrderFilterSystemArray())));
 }
示例#17
0
 public function execute($cartInstance)
 {
     // 使用引用取得内部数据,方便操作
     $cartContext =& $cartInstance->getCartContextRef();
     if ($cartContext->isEmpty()) {
         // 没有数据,不需要计算
         goto out_fail;
     }
     // 当前主题允许哪些系统的商品被加入到购物车
     $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
     $goodsFilterSystemArray = $currentThemeInstance->getGoodsFilterSystemArray();
     // 从购物车中删除掉的 OrderGoods
     $removeOrderGoods = array();
     // 对每个商品做检查
     foreach ($cartContext->orderGoodsArray as &$orderGoodsItem) {
         // 商品已经下线了,不能购买
         $goodsInfo = $orderGoodsItem->goods;
         if (empty($goodsInfo) || !$goodsInfo['is_on_sale']) {
             $removeOrderGoods[] = array($goodsInfo['goods_id'], null);
             $cartContext->addErrorMessage('商品 [' . $goodsInfo['goods_id'] . '] 已经下线');
             continue;
         }
         $goodsAttr = $orderGoodsItem->getValue('goods_attr');
         // 有规格的商品,用户必须做出选择
         if (!empty($goodsInfo['goods_spec']) && empty($goodsAttr)) {
             $cartContext->addErrorMessage('商品 [' . $goodsInfo['goods_id'] . '] 必须选择规格');
             $removeOrderGoods[] = array($goodsInfo['goods_id'], null);
             continue;
         }
         // 检查商品库存
         if (!empty($goodsAttr)) {
             // 商品有规格选择
             if (empty($goodsInfo['goods_spec'])) {
                 $cartContext->addErrorMessage('商品 [' . $goodsInfo['goods_id'] . '|' . $goodsAttr . '] 选择非法');
                 $removeOrderGoods[] = array($goodsInfo['goods_id'], $goodsAttr);
                 continue;
             }
             // 检查规格是否合法
             $goodsSpecService = new GoodsSpecService();
             $goodsSpecService->initWithJson($goodsInfo['goods_spec']);
             $goodsSpecDataArray = $goodsSpecService->getGoodsSpecDataArray($goodsAttr);
             if (empty($goodsSpecDataArray)) {
                 $cartContext->addErrorMessage('商品 [' . $goodsInfo['goods_id'] . '|' . $goodsAttr . '] 选择非法');
                 $removeOrderGoods[] = array($goodsInfo['goods_id'], $goodsAttr);
                 continue;
             }
             // 检查规格对应的库存
             if ($orderGoodsItem->getValue('goods_number') > @$goodsSpecDataArray['goods_number']) {
                 $cartContext->addErrorMessage('商品 [' . $goodsInfo['goods_id'] . '|' . $goodsAttr . '] 库存不足');
                 $removeOrderGoods[] = array($goodsInfo['goods_id'], $goodsAttr);
                 continue;
             }
         } else {
             // 简单商品,没有规格,检查库存
             if ($orderGoodsItem->getValue('goods_number') > $goodsInfo['goods_number']) {
                 $cartContext->addErrorMessage('商品 [' . $goodsInfo['goods_id'] . '] 库存不足');
                 $removeOrderGoods[] = array($goodsInfo['goods_id'], null);
                 continue;
             }
         }
         // 商品不属于当前系统,不能购买
         $goodsSystemArray = Utils::parseTagString($goodsInfo['system_tag_list']);
         $intersectSystem = array_intersect($goodsSystemArray, $goodsFilterSystemArray);
         if (empty($intersectSystem)) {
             $removeOrderGoods[] = array($goodsInfo['goods_id'], null);
             continue;
         }
     }
     unset($orderGoodsItem);
     // 删除不合格的 orderGoods 记录
     foreach ($removeOrderGoods as $removeItem) {
         $cartContext->removeGoods($removeItem[0], $removeItem[1]);
         $cartContext->addErrorMessage('商品 [' . $removeItem[0] . '] 不能购买,移除');
     }
     return true;
     out_fail:
     return false;
     // 返回 false,后面的 pipeline 就不会被执行了
 }
示例#18
0
    }
    $smarty->setCaching(Smarty::CACHING_OFF);
}
// 初始化 logger
$logger = new \Core\Log\Wrapper();
/**
 * 用一个简单的全局函数方便日志的输出
 *
 * @param string $msg    日志消息
 * @param string $source 日志的来源,比如 'SQL'
 * @param string $level  日志等级
 *
 * */
function printLog($msg, $source = '', $level = \Core\Log\Base::INFO)
{
    global $logger;
    $logger->addLogInfo($level, $source, $msg);
}
// option 我们使用数据库实现
\Core\Plugin\Option\OptionHelper::setOptionDriver(new \Core\Plugin\Option\OptionDbDriver());
// 设置插件所在的路径
\Core\Plugin\PluginHelper::addPluginDir(PROTECTED_PATH . '/Plugin');
// 系统自带的插件
// 设置 Theme 所在的路径
\Core\Plugin\ThemeHelper::addPluginDir(PROTECTED_PATH . '/Theme');
// 加载运行环境变量设置
$f3->config(PROTECTED_PATH . '/Config/env.cfg');
// 加载全局变量设置
$f3->config(PROTECTED_PATH . '/Config/common.cfg');
// 根据环境变量的不同,加载对应的环境变量设置,开发环境和生产环境的配置显然是不一样的
$f3->config(PROTECTED_PATH . '/Config/common-' . $f3->get('sysConfig[env]') . '.cfg');
示例#19
0
    if ($f3->get('USERDEBUG')) {
        require_once PROTECTED_PATH . '/Framework/Debug/BzfDebug.php';
        // 开启 debug 功能
        BzfDebug::enableDebug();
        // 开启 Smarty Web Log
        BzfDebug::enableSmartyWebLog();
    }
}
// ---------------------------------------- 4. 加载显示主题 --------------------------------------
// 加载主题自己的初始化文件
$themeLoadFile = PROTECTED_PATH . '/Theme/' . $f3->get('sysConfig[theme]') . '/theme_load.php';
if (is_file($themeLoadFile)) {
    require_once $themeLoadFile;
} else {
    die('系统主题设置错误');
}
// ---------------------------------------- 5. 加载系统插件 --------------------------------------
// 这里我们加载额外的插件
PluginHelper::loadActivePlugin(PluginHelper::SYSTEM_MANAGE);
// 执行插件的 action 方法,让插件能完成各种注册
PluginHelper::doActivePluginAction(PluginHelper::SYSTEM_MANAGE);
// ---------------------------------------- 6. 把系统安装的主题当作插件一样加载上来,用于主题管理配置----------------
ThemeHelper::loadInstallTheme(PluginHelper::SYSTEM_MANAGE);
ThemeHelper::doInstallThemeAction(PluginHelper::SYSTEM_MANAGE);
// ---------------------------------------- 7. 启动整个系统 --------------------------------------
// 启动控制器
$f3->run();
// unload 系统安装的主题
ThemeHelper::unloadInstallTheme(PluginHelper::SYSTEM_MANAGE);
// 执行完成,unload 插件
PluginHelper::unloadActivePlugin(PluginHelper::SYSTEM_MANAGE);