Skip to content

Commit

Permalink
add banner description
Browse files Browse the repository at this point in the history
  • Loading branch information
lhy0807 committed Feb 18, 2016
1 parent 8e0ea0e commit dd789fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ footer.page-footer {
top:50%;
left:50%;
transform:translate(-50%,-50%);
text-align: center;
}
.size-full{
width: 100%;
Expand Down
6 changes: 6 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
/**
* 获取bing图片简介
*/
$banner_text = get_option('mad')['banner_text'];
if ($banner_text==""&&empty($banner_text)) {
$str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
if(preg_match("/<copyright>(.+?)<\/copyright>/ies",$str,$matches)){
$imgcopyright=$matches[1];
}
}
else {
$imgcopyright = $banner_text;
}
?>
<div class="row" style="text-align: center;" id="searchform">
Expand Down
8 changes: 8 additions & 0 deletions options.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,13 @@ function optionsframework_options() {
'type' => 'text'
);

$options[] = array(
'name' => __( '站点Banner介绍'),
'desc' => __( '留空即为对应Bing每日一图的介绍'),
'id' => 'banner_text',
'std' => '',
'type' => 'text'
);

return $options;
}

0 comments on commit dd789fb

Please sign in to comment.