Skip to content

Commit

Permalink
🎁新增页脚展示功能
Browse files Browse the repository at this point in the history
  • Loading branch information
yqchilde committed Mar 17, 2020
1 parent 5e43a89 commit db2dff1
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 23 deletions.
47 changes: 27 additions & 20 deletions inc/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package : rebirth
* @Author: Yqchilde
* @Version: 1.0.2
* @Version: 1.0.3
* @link https://yqqy.top
*/

Expand Down Expand Up @@ -270,34 +270,41 @@ function getCategoryBgImg() {
}

// seo优化(文章内容新窗口打开+nofollow)
function autoLinkNoFollow($content) {
function autoLinkNoFollow( $content ) {
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>";
if(preg_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) {
if( !empty($matches) ) {
$srcUrl = get_option('siteurl');
for ($i=0; $i < count($matches); $i++){
$tag = $matches[$i][0];
$tag2 = $matches[$i][0];
$url = $matches[$i][0];
if ( preg_match_all( "/$regexp/siU", $content, $matches, PREG_SET_ORDER ) ) {
if ( ! empty( $matches ) ) {
$srcUrl = get_option( 'siteurl' );
for ( $i = 0; $i < count( $matches ); $i ++ ) {
$tag = $matches[ $i ][0];
$tag2 = $matches[ $i ][0];
$url = $matches[ $i ][0];
$noFollow = '';
$pattern = '/target\s*=\s*"\s*_blank\s*"/';
preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE);
if( count($match) < 1 )
$pattern = '/target\s*=\s*"\s*_blank\s*"/';
preg_match( $pattern, $tag2, $match, PREG_OFFSET_CAPTURE );
if ( count( $match ) < 1 ) {
$noFollow .= ' target="_blank" ';
}
$pattern = '/rel\s*=\s*"\s*[n|d]ofollow\s*"/';
preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE);
if( count($match) < 1 )
preg_match( $pattern, $tag2, $match, PREG_OFFSET_CAPTURE );
if ( count( $match ) < 1 ) {
$noFollow .= ' rel="nofollow" ';
$pos = strpos($url,$srcUrl);
if ($pos === false) {
$tag = rtrim ($tag,'>');
$tag .= $noFollow.'>';
$content = str_replace($tag2,$tag,$content);
}
$pos = strpos( $url, $srcUrl );
if ( $pos === false ) {
$tag = rtrim( $tag, '>' );
$tag .= $noFollow . '>';
$content = str_replace( $tag2, $tag, $content );
}
}
}
}

$content = str_replace(']]>', ']]>', $content);
$content = str_replace( ']]>', ']]>', $content );

return $content;
}

function getSiteNavInfo() {
return json_decode( rebirth_option( 'site_bottom_nav_info' ) );
}
18 changes: 17 additions & 1 deletion options.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function optionsframework_options() {
{
"category_$": "#",
"category_$": "#",
依次添加
依次添加...
}',
'id' => 'site_category_img',
'std' => '{
Expand Down Expand Up @@ -210,6 +210,22 @@ function optionsframework_options() {
'type' => 'text'
);

// 网站底部导航网址
$options[] = array(
'name' => '网站底部导航网址,$name是网站标题,$link是对应链接',
'desc' => '请注意格式,严格的json格式
{
"$name": "$link",
"$name": "$link",
依次添加...
}',
'id' => 'site_bottom_nav_info',
'type' => 'textarea',
'std' => '{
"百度": "https://www.baidu.com",
"Yq小站": "https://yqqy.top"
}');

// 作者信息
$options[] = array(
'name' => '作者信息',
Expand Down
4 changes: 2 additions & 2 deletions style.css

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions tpl/home/home-waves.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* 响应式wordpress主题
*
* @package : rebirth
* @Author: Yqchilde
* @Version: 1.0.3
* @link https://yqqy.top
*/
?>
<section class="main-footer-waves-area waves-area">
<svg class="waves-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
<defs>
<path id="gentle-wave"
d="M -160 44 c 30 0 58 -18 88 -18 s 58 18 88 18 s 58 -18 88 -18 s 58 18 88 18 v 44 h -352 Z"/>
</defs>
<g class="parallax">
<use xlink:href="#gentle-wave" x="48" y="0"/>
<use xlink:href="#gentle-wave" x="48" y="3"/>
<use xlink:href="#gentle-wave" x="48" y="5"/>
<use xlink:href="#gentle-wave" x="48" y="7"/>
</g>
</svg>
</section>
<section class="py-5 main-footer-info">
<div class="container-sm">
<div class="row">
<div class="d-none d-lg-block col main-footer-info-tags">
<h3 class="mb-3 main-footer-info-title main-footer-info-tags-title">标签云</h3>
<div class="d-flex flex-row flex-wrap align-items-start w-100 h-100 main-footer-info-tags-list">
<?php $tags = get_tags();
foreach ( $tags as $v ) : ?>
<a href="<?php echo home_url() . '/tag/' . $v->slug; ?>"
class="tag-item"><?php echo $v->name; ?></a>
<?php endforeach; ?>
</div>
</div>
<div class="d-none d-lg-block col main-footer-info-navigation">
<h3 class="mb-3 main-footer-info-title main-footer-info-navigation-title">导航</h3>
<div class="w-100 h-100 main-footer-info-navigation-list">
<div class="side-navbar-nav list-group list-group-flush">
<?php if (is_array(getSiteNavInfo()) || is_object(getSiteNavInfo())) : ?>
<?php $navInfo = getSiteNavInfo();?>
<?php foreach ( $navInfo as $k => $v ) : ?>
<a href="<?php echo $v ?>"
class="list-group-item list-group-item-action menu-item side-menu-nav-item nav-bai-du nav-current active"><?php echo $k ?></a>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</section>

0 comments on commit db2dff1

Please sign in to comment.