Example #1
0
function theme_shop_smarty_helper_function_get_asset_url(array $paramArray, $smarty)
{
    if (!isset($paramArray['asset'])) {
        return '';
    }
    return ManagerHelper::getAssetUrl(ShopThemePlugin::pluginGetUniqueId(), $paramArray['asset']);
}
Example #2
0
 public function doUpdate($currentVersion)
 {
     // 增加了新的设置选项
     ShopThemePlugin::saveOptionValue('goods_after_service', '这里是售后服务说明');
     // 设置新的版本
     ShopThemePlugin::saveOptionValue('version', $this->targetVersion);
     return true;
 }
Example #3
0
 public function doUpdate($currentVersion)
 {
     // 增加了新的设置选项
     ShopThemePlugin::saveOptionValue('business_qq', null);
     // 设置新的版本
     ShopThemePlugin::saveOptionValue('version', $this->targetVersion);
     return true;
 }
Example #4
0
 public function doUpdate($currentVersion)
 {
     // 增加了新的设置选项
     ShopThemePlugin::saveOptionValue('goods_view_detail_notice', null);
     // 设置新的版本
     ShopThemePlugin::saveOptionValue('version', $this->targetVersion);
     return true;
 }
Example #5
0
 public function doUpdate($currentVersion)
 {
     // 增加了新的设置选项
     ShopThemePlugin::saveOptionValue('goods_search_adv_slider', null);
     ShopThemePlugin::saveOptionValue('goods_view_adv_slider', null);
     // 设置新的版本
     ShopThemePlugin::saveOptionValue('version', $this->targetVersion);
     return true;
 }
Example #6
0
 public function post($f3)
 {
     // 权限检查
     $this->requirePrivilege('manage_plugin_theme_configure');
     // 保存数据
     ShopThemePlugin::saveOptionValue('head_nav_json_data', json_encode($f3->get('POST[headNav]')));
     // 清除 所有页面
     $shopClear = new ShopClear();
     $shopClear->clearAllCache();
     $this->addFlashMessage('保存设置成功');
     RouteHelper::reRoute($this, '/Theme/Shop/HeadNav');
 }
Example #7
0
 public function beforeRoute($f3)
 {
     parent::beforeRoute($f3);
     // 发布我们自己的资源
     ManagerHelper::publishAsset(ShopThemePlugin::pluginGetUniqueId(), 'css');
     ManagerHelper::publishAsset(ShopThemePlugin::pluginGetUniqueId(), 'js');
     ManagerHelper::publishAsset(ShopThemePlugin::pluginGetUniqueId(), 'img');
     // 插件注册 css, js
     ManagerHelper::registerCss(ManagerHelper::getAssetUrl(ShopThemePlugin::pluginGetUniqueId(), 'css/theme_shop.css'));
     ManagerHelper::registerCss(ManagerHelper::getAssetUrl(ShopThemePlugin::pluginGetUniqueId(), 'css/advblock.css'));
     ManagerHelper::registerJs(ManagerHelper::getAssetUrl(ShopThemePlugin::pluginGetUniqueId(), 'js/theme_shop.js'));
     // 注册自己使用的 smarty 函数
     theme_shop_smarty_register();
 }
Example #8
0
 public function doUpdate($currentVersion)
 {
     // 增加了新的设置选项
     ShopThemePlugin::saveOptionValue('shop_index_notice', '这里是网站公告');
     ShopThemePlugin::saveOptionValue('smarty_cache_time_article_view', 86400);
     $jsonArray = array(array('title' => '', 'url' => ''));
     ShopThemePlugin::saveOptionValue('head_nav_json_data', json_encode($jsonArray));
     $jsonArray = array(0 => array('title' => '新手指南', 'item' => array(0 => array('title' => '账户注册', 'url' => '#'), 1 => array('title' => '购物流程', 'url' => '#'), 3 => array('title' => '付款方式', 'url' => '#'), 4 => array('title' => '常见问题', 'url' => '#'))), 1 => array('title' => '配送方式', 'item' => array(0 => array('title' => '配送说明', 'url' => '#'), 1 => array('title' => '订单拆分', 'url' => '#'))), 2 => array('title' => '支付方式', 'item' => array(0 => array('title' => '在线支付', 'url' => '#'), 1 => array('title' => '其它支付方式', 'url' => '#'))), 3 => array('title' => '售后服务', 'item' => array(0 => array('title' => '退换货政策', 'url' => '#'), 1 => array('title' => '退换货办理流程', 'url' => '#'))), 4 => array('title' => '购物保障', 'item' => array(0 => array('title' => '免责声明', 'url' => '#'), 1 => array('title' => '隐私保护', 'url' => '#'), 2 => array('title' => '注册协议', 'url' => '#'), 3 => array('title' => '正品保障', 'url' => '#'))));
     ShopThemePlugin::saveOptionValue('foot_nav_json_data', json_encode($jsonArray));
     $jsonArray = array(array('title' => '', 'url' => ''));
     ShopThemePlugin::saveOptionValue('friend_link_json_data', json_encode($jsonArray));
     // 设置新的版本
     ShopThemePlugin::saveOptionValue('version', $this->targetVersion);
     return true;
 }
Example #9
0
 public function post($f3)
 {
     // 权限检查
     $this->requirePrivilege('manage_plugin_theme_adv_configure');
     // 参数验证
     $validator = new Validator($f3->get('POST'));
     // 广告设置 json 数据,由 JavaScript 打包发送过来
     $shop_index_advblock_json_data = $validator->validate('shop_index_advblock_json_data');
     $jsonObject = json_decode($shop_index_advblock_json_data, true);
     if (empty($jsonObject)) {
         $shop_index_advblock_json_data = null;
     }
     ShopThemePlugin::saveOptionValue('shop_index_advblock_json_data', $shop_index_advblock_json_data);
     // 清除 /Shop/Index 页面
     $shopClear = new ShopClear();
     $shopClear->clearHomePage();
     $this->addFlashMessage('保存设置成功');
     RouteHelper::reRoute($this, '/Theme/Shop/AdvShopBlock');
 }
Example #10
0
 public function post($f3)
 {
     // 权限检查
     $this->requirePrivilege('manage_plugin_theme_configure');
     // 参数验证
     $validator = new Validator($f3->get('POST'));
     foreach ($this->optionKeyArray as $optionKey) {
         if (in_array($optionKey, $this->optionKeyNoFilterArray)) {
             $optionValue = $f3->get('POST[' . $optionKey . ']');
         } else {
             $optionValue = $validator->validate($optionKey);
         }
         ShopThemePlugin::saveOptionValue($optionKey, $optionValue);
     }
     // 清除 /Shop/Index 页面
     $shopClear = new ShopClear();
     $shopClear->clearAllCache();
     $this->addFlashMessage('保存设置成功');
     out_display:
     global $smarty;
     $smarty->display('theme_shop_basic.tpl', 'post');
 }
Example #11
0
 public function post($f3)
 {
     // 权限检查
     $this->requirePrivilege('manage_plugin_theme_adv_configure');
     // 参数验证
     $validator = new Validator($f3->get('POST'));
     // slider 广告设置
     $imageArray = $validator->validate('image');
     $urlArray = $validator->validate('url');
     $targetArray = $validator->validate('target');
     $imageSize = is_array($imageArray) ? count($imageArray) : 0;
     $shop_index_adv_slider = array();
     // 组织数据结构
     for ($index = 0; $index < $imageSize; $index++) {
         $shop_index_adv_slider[] = array('image' => $imageArray[$index], 'url' => $urlArray[$index], 'target' => $targetArray[$index]);
     }
     ShopThemePlugin::saveOptionValue('shop_index_adv_slider', json_encode($shop_index_adv_slider));
     // 清除 /Shop/Index 页面
     $shopClear = new ShopClear();
     $shopClear->clearHomePage();
     $this->addFlashMessage('保存设置成功');
     RouteHelper::reRoute($this, '/Theme/Shop/AdvShopSlider');
 }
Example #12
0
/**
 * 方便程序取得 optionValue 的一个方法
 *
 * @param string $optionKey
 *
 * @return string
 */
function bzf_get_option_value($optionKey)
{
    return \Theme\Shop\ShopThemePlugin::getOptionValue($optionKey);
}
Example #13
0
 /**
  *
  * 为 shop 系统设置运行环境
  *
  * @return bool
  */
 private function doShopAction()
 {
     global $f3;
     global $smarty;
     // 获取当前插件的根地址
     $currentThemeBasePath = dirname(__FILE__);
     // 通用的加载
     $this->doOtherAction();
     // shop Code 目录加入到 auto load 的路径中,这样系统就能自动做 class 加载
     SystemHelper::addAutoloadPath($currentThemeBasePath . '/shop/Code', true);
     // 设置路由,这样用户就能访问到我们的程序了
     $f3->config($currentThemeBasePath . '/shop/route.cfg');
     $f3->config($currentThemeBasePath . '/shop/route-rewrite.cfg');
     ReferHelper::addReferItem('HostRefer', new HostRefer());
     // 记录来源的 refer_host 和 refer_url
     // 注册 Asset 模块
     \Core\Asset\ManagerHelper::registerModule(ShopThemePlugin::pluginGetUniqueId(), $this->pluginGetVersion(), $currentThemeBasePath . '/shop/Asset');
     // 发布必要的资源文件
     \Core\Asset\ManagerHelper::publishAsset(ShopThemePlugin::pluginGetUniqueId(), 'bootstrap-custom');
     \Core\Asset\ManagerHelper::publishAsset(ShopThemePlugin::pluginGetUniqueId(), 'css');
     \Core\Asset\ManagerHelper::publishAsset(ShopThemePlugin::pluginGetUniqueId(), 'js');
     \Core\Asset\ManagerHelper::publishAsset(ShopThemePlugin::pluginGetUniqueId(), 'img');
     // 增加 smarty 模板搜索路径
     $smarty->addTemplateDir($currentThemeBasePath . '/shop/Tpl/');
     // 加载 smarty 的扩展,里面有一些我们需要用到的函数
     require_once $currentThemeBasePath . '/shop/Code/smarty_helper.php';
     // 注册 smarty 函数
     smarty_helper_register($smarty);
     // 设置网站的 Base 路径,给 JavaScript 使用
     $smarty->assign("WEB_ROOT_HOST", $f3->get('sysConfig[webroot_schema_host]'));
     $smarty->assign("WEB_ROOT_BASE", $f3->get('BASE'));
     $smarty->assign("WEB_ROOT_BASE_RES", smarty_helper_function_get_asset_url(array('asset' => ''), null));
     return true;
 }
Example #14
0
 public function doUpdate($currentVersion)
 {
     // 简单的把版本设置为 1.0.0 就算完成升级了
     ShopThemePlugin::saveOptionValue('version', $this->targetVersion);
     return true;
 }
Example #15
0
<?php

// 加载 ShopThemePlugin  插件加载文件,用于初始化插件同时返回一个插件的 instance 对象
use Theme\Shop\ShopThemePlugin;
ShopThemePlugin::instance()->setPluginDirAbsolutePath(dirname(__FILE__));
return ShopThemePlugin::instance();