Ejemplo n.º 1
0
 /**
  * 其它系统加载本主题
  *
  * @return bool
  */
 private function doOtherAction()
 {
     // 获取当前插件的根地址
     $currentThemeBasePath = dirname(__FILE__);
     require_once $currentThemeBasePath . '/manage/Code/Cache/MobileClear.php';
     // 注册 Smarty 缓存清除功能,用户在 Manage 后台编辑商品的时候就能智能清除缓存了
     ClearHelper::registerInstanceClass('\\Cache\\MobileClear');
     return true;
 }
Ejemplo n.º 2
0
 public function __construct($system)
 {
     global $f3;
     $this->assetUrlPrefix = $f3->get('sysConfig[webroot_url_prefix]') . '/asset';
     $this->assetBasePath = '/' . $system . '/asset';
     // 注册 F3 的路由,所有 /asset 请求都由我们自己处理
     global $f3;
     $f3->route('GET /asset/*', __CLASS__ . '->fetchAsset');
     // 注册 Clear方法,用于清除 Asset 资源
     ClearHelper::registerInstanceClass(__NAMESPACE__ . '\\' . 'SaeAssetClear');
 }
Ejemplo n.º 3
0
 * @author QiangYu
 *
 * 主题加载文件,用于主题自身的初始化
 *
 * */
use Core\Plugin\SystemHelper;
$themeUniqueId = 'theme_manage';
$themeVersion = $f3->get('sysConfig[version]') ?: '1.0';
$themeBasePath = dirname(__FILE__);
// 增加当前主题的 autoload 路径
SystemHelper::addAutoloadPath($themeBasePath . '/Code', true);
// 加载路由定义
$f3->config($themeBasePath . '/route.cfg');
$f3->config($themeBasePath . '/route-rewrite.cfg');
// 注册一个通用的缓存清除程序
\Core\Cache\ClearHelper::registerInstanceClass('\\Core\\Cache\\ShareClear');
// 设置模板文件路径
$smarty->addTemplateDir($themeBasePath . '/Tpl/');
// 注册模块
\Core\Asset\ManagerHelper::registerModule($themeUniqueId, $themeVersion, $themeBasePath . '/Asset');
// 发布主题的资源文件
\Core\Asset\ManagerHelper::publishAsset($themeUniqueId, 'bootstrap-custom');
\Core\Asset\ManagerHelper::publishAsset($themeUniqueId, 'css');
\Core\Asset\ManagerHelper::publishAsset($themeUniqueId, 'img');
\Core\Asset\ManagerHelper::publishAsset($themeUniqueId, 'js');
// 加载 smarty 的扩展,里面有一些我们需要用到的函数
require_once dirname(__FILE__) . '/Code/smarty_helper.php';
// 注册 smarty 函数
smarty_helper_register($smarty);
// 注册资源应用函数
function smarty_helper_get_asset_url(array $paramArray, $smarty)