提交 8965ba63 编写于 作者: J jianbo

加入视频和插屏广告

上级 7c7cc228
......@@ -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";
......
......@@ -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="
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册