PbootCms微信小程序社交电商软件公司官网源码

   日期:2024-12-26    作者:ark1w 移动:http://ljhr2012.riyuangf.com/mobile/quote/38182.html
<?php

PbootCms微信小程序社交电商软件公司官网源码

namespace apphomecontroller; use corebasicController; use apphomemodelParserModel; use corebasicUrl; class ParserController extends Controller { protected $model; protected $pre = array(); protected $var = array(); public function __construct() { $this->model = new ParserModel(); } public function _empty() { error('您访问的地址有误,请核对后重试!'); } // 解析全局前置公共标签 public function parserBefore($content) { // 处理模板中不需要解析的标签 $content = $this->savePreLabel($content); return $content; } // 解析全局后置公共标签 public function parserAfter($content) { // 默认页面信息替换 $content = str_replace('{pboot:pagetitle}', '{pboot:sitetitle}-{pboot:sitesubtitle}', $content); $content = str_replace('{pboot:pagekeywords}', '{pboot:sitekeywords}', $content); $content = str_replace('{pboot:pagedescription}', '{pboot:sitedescription}', $content); $content = $this->parserSingleLabel($content); // 单标签解析 $content = $this->parserSiteLabel($content); // 站点标签 $content = $this->parserCompanyLabel($content); // 公司标签 $content = $this->parserUserLabel($content); // 自定义标签 $content = $this->parserNavLabel($content); // 分类列表 $content = $this->parserSelectAllLabel($content); // CMS筛选全部标签解析 $content = $this->parserSelectLabel($content); // CMS筛选标签解析 $content = $this->parserSpecifySortLabel($content); // 指定分类 $content = $this->parserListLabel($content); // 指定列表 $content = $this->parserSpecifyContentLabel($content); // 指定内容 $content = $this->parserContentPicsLabel($content); // 内容多图 $content = $this->parserContentCheckboxLabel($content); // 内容多选调取 $content = $this->parserContentTagsLabel($content); // 内容tags调取 $content = $this->parserSlideLabel($content); // 幻灯片 $content = $this->parserLinkLabel($content); // 友情链接 $content = $this->parserMessageLabel($content); // 留言板 $content = $this->parserFormLabel($content); // 自定义表单 $content = $this->parserSubmitFormLabel($content); // 自定义表单提交 $content = $this->parserQrcodeLabel($content); // 二维码生成 $content = $this->parserPageLabel($content); // CMS分页标签解析(需置后) $content = $this->parserLoopLabel($content); // LOOP语句(需置后) $content = $this->parserIfLabel($content); // IF语句(需置最后) $content = $this->restorePreLabel($content); // 还原不需要解析的内容 $content = $this->parserReplaceKeyword($content); // 页面关键词替换 return $content; } // 保存保留内容 public function savePreLabel($content) { $pattern = '/{pboot:pre}([sS]*?){/pboot:pre}/'; if (preg_match_all($pattern, $content, $matches)) { $count = count($matches[0]); for ($i = 0; $i < $count; $i ++) { $this->pre[] = $matches[1][$i]; end($this->pre); $content = str_replace($matches[0][$i], '#pre:' . key($this->pre) . '#', $content); } } return $content; } // 还原保留内容 public function restorePreLabel($content) { $pattern = '/#pre:([0-9]+)#/'; if (preg_match_all($pattern, $content, $matches)) { $count = count($matches[0]); for ($i = 0; $i < $count; $i ++) { $content = str_replace($matches[0][$i], $this->pre[$matches[1][$i]], $content); } } return $content; } // 解析单标签 public function parserSingleLabel($content) { $content = str_replace('{pboot:msgaction}', Url::home('home/Index/addMsg'), $content); // 留言提交路径 $content = str_replace('{pboot:scaction}', Url::home('home/Index/search'), $content); // 搜索提交路径 $content = str_replace('{pboot:checkcode}', CORE_DIR . '/code.php', $content); // 验证码路径 $content = str_replace('{pboot:lgpath}', Url::get('home/Do/area'), $content); // 多语言切换前置路径,如{pboot:lgpath}?lg=cn $content = str_replace('{pboot:appid}', $this->config('api_appid'), $content); // API认证用户 $content = str_replace('{pboot:timestamp}', time(), $content); // 认证时间戳 $content = str_replace('{pboot:signature}', md5(md5($this->config('api_appid') . $this->config('api_secret') . time())), $content); // API认证密钥 $content = str_replace('{pboot:httpurl}', get_http_url(), $content); // 当前访问的域名地址 $content = str_replace('{pboot:pageurl}', get_current_url(), $content); // 当前页面的地址 $content = str_replace('{pboot:keyword}', get('keyword', 'vars'), $content); // 当前搜索的关键字 $content = str_replace('{pboot:checkcodestatus}', $this->config('message_check_code'), $content); // 是否开启验证码 return $content; } // 解析站点标签 public function parserSiteLabel($content) { $pattern = '/{pboot:site([w]+)(s+[^}]+)?}/'; if (preg_match_all($pattern, $content, $matches)) { $data = $this->model->getSite(); $count = count($matches[0]); for ($i = 0; $i < $count; $i ++) { $params = $this->parserParam($matches[2][$i]); switch ($matches[1][$i]) { case 'index': $content = str_replace($matches[0][$i], Url::home('home/Index/'), $content); break; case 'path': $content = str_replace($matches[0][$i], SITE_DIR, $content); break; case 'logo': if (isset($data->logo) && $data->logo) { if (! preg_match('/^http/', $data->logo)) { $content = str_replace($matches[0][$i], $this->adjustLabelData($params, SITE_DIR . $data->logo), $content); } else { $content = str_replace($matches[0][$i], $this->adjustLabelData($params, $data->logo), $content); } } else { $content = str_replace($matches[0][$i], STATIC_DIR . '/images/logo.png', $content); } break; case 'tplpath': $content = str_replace($matches[0][$i], APP_THEME_DIR, $content); break; case 'language': $content = str_replace($matches[0][$i], get_lg(), $content); break; case 'statistical': if (isset($data->statistical)) { $content = str_replace($matches[0][$i], decode_string($data->statistical), $content); } else { $content = str_replace($matches[0][$i], '', $content); } case 'copyright': if (isset($data->copyright)) { $content = str_replace($matches[0][$i], decode_string($data->copyright), $content); } else { $content = str_replace($matches[0][$i], '', $content); } default:

特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


举报收藏 0评论 0
0相关评论
相关最新动态
推荐最新动态
点击排行
{
网站首页  |  关于我们  |  联系方式  |  使用协议  |  隐私政策  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报  |  鄂ICP备2020018471号