Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ijianbo
rest Api To Miniprogram
提交
1e46791b
rest Api To Miniprogram
项目概览
ijianbo
/
rest Api To Miniprogram
通知
22
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
rest Api To Miniprogram
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1e46791b
编写于
4月 18, 2019
作者:
J
jianbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.增加对昵称里特殊字符的过滤
2.增加更新用户信息,在用户信息里增加角色信息
上级
4b24d83f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
68 addition
and
0 deletion
+68
-0
includes/ram-util.php
includes/ram-util.php
+68
-0
未找到文件。
includes/ram-util.php
浏览文件 @
1e46791b
...
...
@@ -477,4 +477,72 @@ function filterEmoji($str)
$str
);
return
$str
;
}
function
getUserLevel
(
$userId
)
{
global
$wpdb
;
$sql
=
$wpdb
->
prepare
(
"SELECT t.meta_value
FROM
"
.
$wpdb
->
usermeta
.
" t
WHERE
t.meta_key = '"
.
$wpdb
->
prefix
.
"user_level'
AND t.user_id =%d"
,
$userId
);
$level
=
$wpdb
->
get_var
(
$sql
);
$levelName
=
"订阅者"
;
switch
(
$level
)
{
case
"10"
:
$levelName
=
"管理者"
;
break
;
case
"7"
:
$levelName
=
"编辑"
;
break
;
case
"2"
:
$levelName
=
"作者"
;
break
;
case
"1"
:
$levelName
=
"贡献者"
;
break
;
case
"0"
:
$levelName
=
"订阅者"
;
break
;
}
$userLevel
[
"level"
]
=
$level
;
$userLevel
[
"levelName"
]
=
$levelName
;
return
$userLevel
;
}
function
get_post_qq_video
(
$content
)
{
$vcontent
=
''
;
preg_match
(
'/https\:\/\/v.qq.com\/x\/(\S*)\/(\S*)\.html/'
,
$content
,
$matches
);
if
(
$matches
)
{
$vids
=
$matches
[
2
];
//$url='http://vv.video.qq.com/getinfo?vid='.$vids.'&defaultfmt=auto&otype=json&platform=1&defn=fhd&charge=0';
// defaultfmt: 1080P-fhd,超清-shd,高清-hd,标清-sd
$url
=
'http://vv.video.qq.com/getinfo?vid='
.
$vids
.
'&defaultfmt=auto&otype=json&platform=11001&defn=fhd&charge=0'
;
//$res = file_get_contents($url);
$res
=
https_request
(
$url
);
if
(
$res
)
{
$str
=
substr
(
$res
,
13
,
-
1
);
$newStr
=
json_decode
(
$str
,
true
);
//$videoUrl= $newStr['vl']['vi'][0]['ul']['ui'][2]['url'].$newStr['vl']['vi'][0]['fn'].'?vkey='.$newStr['vl']['vi'][0]['fvkey'];
$videoUrl
=
$newStr
[
'vl'
][
'vi'
][
0
][
'ul'
][
'ui'
][
0
][
'url'
]
.
$newStr
[
'vl'
][
'vi'
][
0
][
'fn'
]
.
'?vkey='
.
$newStr
[
'vl'
][
'vi'
][
0
][
'fvkey'
];
$vcontent
=
preg_replace
(
'~<video (.*?)></video>~s'
,
'<video src="'
.
$videoUrl
.
'" controls="controls" width="100%"></video>'
,
$content
);
}
}
return
$vcontent
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录