更新第三方登录插件扩展
This commit is contained in:
@@ -8,16 +8,15 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller;
|
||||
|
||||
use think\App;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\View;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Route;
|
||||
use think\facade\Event;
|
||||
use think\Validate;
|
||||
use app\model\Config;
|
||||
use app\model\Hooks;
|
||||
use app\model\SeoRule;
|
||||
use think\App;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Event;
|
||||
use think\facade\View;
|
||||
use think\Validate;
|
||||
|
||||
class Base {
|
||||
|
||||
@@ -78,7 +77,7 @@ class Base {
|
||||
$hooks = Cache::get('sentcms_hooks');
|
||||
if (!$hooks) {
|
||||
$hooks = Hooks::where('status', 1)->column('addons', 'name');
|
||||
foreach($hooks as $key => $values){
|
||||
foreach ($hooks as $key => $values) {
|
||||
if (is_string($values)) {
|
||||
$values = explode(',', $values);
|
||||
} else {
|
||||
@@ -95,7 +94,6 @@ class Base {
|
||||
Event::listenEvents($hooks);
|
||||
}
|
||||
|
||||
|
||||
View::assign('version', \think\facade\Env::get('VERSION'));
|
||||
View::assign('config', $this->config);
|
||||
// 控制器初始化
|
||||
@@ -142,19 +140,20 @@ class Base {
|
||||
}
|
||||
|
||||
protected function fetch($template = '') {
|
||||
if($this->request->param('addon')){
|
||||
if ($this->request->param('addon')) {
|
||||
$this->tpl_config['view_dir_name'] = 'addons' . DIRECTORY_SEPARATOR . $this->request->param('addon') . DIRECTORY_SEPARATOR . 'view';
|
||||
}
|
||||
View::config($this->tpl_config);
|
||||
View::assign($this->data);
|
||||
return View::fetch($template);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否为手机访问
|
||||
* @return boolean [description]
|
||||
*/
|
||||
public function isMobile() {//return true;
|
||||
public function isMobile() {
|
||||
//return true;
|
||||
// 如果有HTTP_X_WAP_PROFILE则一定是移动设备
|
||||
if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) {
|
||||
return true;
|
||||
@@ -200,14 +199,14 @@ class Base {
|
||||
if (class_exists($class)) {
|
||||
$reflection = new \ReflectionClass($class);
|
||||
$group_doc = $this->Parser($reflection->getDocComment());
|
||||
if(isset($group_doc['title'])){
|
||||
if (isset($group_doc['title'])) {
|
||||
$mate = $group_doc['title'];
|
||||
}
|
||||
$method = $reflection->getMethods(\ReflectionMethod::IS_FINAL | \ReflectionMethod::IS_PUBLIC);
|
||||
$method = $reflection->getMethods(\ReflectionMethod::IS_FINAL | \ReflectionMethod::IS_PUBLIC);
|
||||
foreach ($method as $key => $v) {
|
||||
if($action == $v->name){
|
||||
if ($action == $v->name) {
|
||||
$title_doc = $this->Parser($v->getDocComment());
|
||||
if(isset($title_doc['title'])){
|
||||
if (isset($title_doc['title'])) {
|
||||
$mate = $title_doc['title'];
|
||||
}
|
||||
}
|
||||
@@ -223,8 +222,8 @@ class Base {
|
||||
|
||||
protected function setSeo($title = '', $keywords = '', $description = '') {
|
||||
$seo = array(
|
||||
'title' => $title,
|
||||
'keywords' => $keywords,
|
||||
'title' => $title,
|
||||
'keywords' => $keywords,
|
||||
'description' => $description,
|
||||
);
|
||||
//获取还没有经过变量替换的META信息
|
||||
@@ -237,10 +236,19 @@ class Base {
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'title' => $meta['title'],
|
||||
'keywords' => $meta['keywords'],
|
||||
'title' => $meta['title'],
|
||||
'keywords' => $meta['keywords'],
|
||||
'description' => $meta['description'],
|
||||
);
|
||||
View::assign('seo', $data);
|
||||
}
|
||||
|
||||
protected function getAddonsConfig() {
|
||||
$config = [];
|
||||
$addons = $this->request->param('addon');
|
||||
$addon = get_addons_instance($addons)->getConfig();
|
||||
$config = \app\model\Addons::where('name', $addons)->value('config');
|
||||
|
||||
return $config ? json_decode($config, true) : $addon;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ class Addons extends Base {
|
||||
if ($this->request->isPost()) {
|
||||
$config = $this->request->post();
|
||||
$id = $this->request->param('id');
|
||||
|
||||
|
||||
$result = AddonsM::update(['config' => $config], ['id' => $id]);
|
||||
if ($result) {
|
||||
return $this->success('完成设置!');
|
||||
@@ -138,8 +138,9 @@ class Addons extends Base {
|
||||
|
||||
$keyList = $class->getConfig(true);
|
||||
$this->data = array(
|
||||
'info' => $info['config'],
|
||||
'keyList' => $keyList,
|
||||
'meta_title' => $info['title'] . " - 设置"
|
||||
'meta_title' => $info['title'] . " - 设置",
|
||||
);
|
||||
return $this->fetch('admin/public/edit');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user