Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ijianbo
rest Api To Miniprogram
提交
8965ba63
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 搜索 >>
提交
8965ba63
编写于
1月 05, 2020
作者:
J
jianbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
加入视频和插屏广告
上级
7c7cc228
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
3 deletion
+46
-3
includes/api/ram-rest-settings-controller.php
includes/api/ram-rest-settings-controller.php
+26
-0
includes/filter/ram-custom-post-fields.php
includes/filter/ram-custom-post-fields.php
+5
-3
includes/settings/wp-wechat-config.php
includes/settings/wp-wechat-config.php
+15
-0
未找到文件。
includes/api/ram-rest-settings-controller.php
浏览文件 @
8965ba63
...
...
@@ -26,11 +26,37 @@ class RAM_REST_Options_Controller extends WP_REST_Controller{
'schema'
=>
array
(
$this
,
'get_public_item_schema'
),
)
);
register_rest_route
(
$this
->
namespace
,
'/'
.
$this
->
resource_name
,
array
(
// Here we register the readable endpoint for collections.
array
(
'methods'
=>
'GET'
,
'callback'
=>
array
(
$this
,
'get_item'
),
'permission_callback'
=>
array
(
$this
,
'get_item_permissions_check'
)
),
// Register our schema callback.
'schema'
=>
array
(
$this
,
'get_public_item_schema'
),
)
);
}
public
function
get_item
(
$request
)
{
$wf_enable_comment_option
=
empty
(
get_option
(
'wf_enable_comment_option'
))
?
"0"
:
get_option
(
'wf_enable_comment_option'
);
$interstitialAdId
=
empty
(
get_option
(
'wf_interstitial_ad_id'
))
?
""
:
get_option
(
'wf_interstitial_ad_id'
);
$wf_enterprise_minapp
=
empty
(
get_option
(
'wf_enterprise_minapp'
))
?
"0"
:
get_option
(
'wf_enterprise_minapp'
);
$result
[
"wf_enable_comment_option"
]
=
$wf_enable_comment_option
;
$result
[
"interstitialAdId"
]
=
$interstitialAdId
;
$result
[
"wf_enterprise_minapp"
]
=
$wf_enterprise_minapp
;
$response
=
rest_ensure_response
(
$result
);
return
$response
;
}
public
function
getEnableComment
(
$request
)
{
$wf_enable_comment_option
=
get_option
(
'wf_enable_comment_option'
);
$interstitial_ad_id
=
get_option
(
'wf_interstitial_ad_id'
);
if
(
empty
(
$wf_enable_comment_option
))
{
$result
[
"code"
]
=
"success"
;
...
...
includes/filter/ram-custom-post-fields.php
浏览文件 @
8965ba63
...
...
@@ -33,10 +33,14 @@ function custom_post_fields( $data, $post, $request) {
//获取广告参数
$videoAdId
=
empty
(
get_option
(
'wf_video_ad_id'
))
?
''
:
get_option
(
'wf_video_ad_id'
);
$_data
[
'videoAdId'
]
=
$videoAdId
;
$listAdId
=
empty
(
get_option
(
'wf_list_ad_id'
))
?
''
:
get_option
(
'wf_list_ad_id'
);
$listAd
=
empty
(
get_option
(
'wf_list_ad'
))
?
'0'
:
"1"
;
$listAdEvery
=
empty
(
get_option
(
'wf_list_ad_every'
))
?
5
:
(
int
)
get_option
(
'wf_list_ad_every'
);
$_data
[
'listAd'
]
=
$listAd
;
$_data
[
'listAdId'
]
=
$listAdId
;
...
...
@@ -147,13 +151,11 @@ function custom_post_fields( $data, $post, $request) {
add_post_meta
(
$post_id
,
'wl_pageviews'
,
1
,
true
);
}
$_data
[
'avatarurls'
]
=
$avatarurls
;
date_default_timezone_set
(
'Asia/Shanghai'
);
$fristday
=
date
(
"Y-m-d H:i:s"
,
strtotime
(
"-1 year"
));
$today
=
date
(
"Y-m-d H:i:s"
);
//获取今天日期时间
$tags
=
$_data
[
"tags"
];
if
(
count
(
$tags
)
>
0
)
if
(
!
empty
(
$tags
)
)
{
$tags
=
implode
(
","
,
$tags
);
$sql
=
"
...
...
includes/settings/wp-wechat-config.php
浏览文件 @
8965ba63
...
...
@@ -41,6 +41,10 @@ function register_weixinappsettings() {
register_setting
(
'weixinapp-group'
,
'wf_excitation_ad_id'
);
register_setting
(
'weixinapp-group'
,
'wf_video_ad_id'
);
register_setting
(
'weixinapp-group'
,
'wf_interstitial_ad_id'
);
...
...
@@ -238,6 +242,17 @@ if (version_compare(PHP_VERSION, '5.6.0', '<=') )
<td>
<input
type=
"text"
name=
"wf_excitation_ad_id"
style=
"width:300px; height:40px"
value=
"
<?php
echo
esc_attr
(
get_option
(
'wf_excitation_ad_id'
)
);
?>
"
/>
</td>
</tr>
<tr
valign=
"top"
>
<th
scope=
"row"
>
视频广告id
</th>
<td>
<input
type=
"text"
name=
"wf_video_ad_id"
style=
"width:300px; height:40px"
value=
"
<?php
echo
esc_attr
(
get_option
(
'wf_video_ad_id'
)
);
?>
"
/>
</td>
</tr>
<th
scope=
"row"
>
插屏广告id
</th>
<td>
<input
type=
"text"
name=
"wf_interstitial_ad_id"
style=
"width:300px; height:40px"
value=
"
<?php
echo
esc_attr
(
get_option
(
'wf_interstitial_ad_id'
)
);
?>
"
/>
</td>
</tr>
</table>
</div>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录