new feature: github cards

This commit is contained in:
root 2019-10-24 14:26:11 +00:00
parent a51ef9077e
commit a74e1c8ec7
3 changed files with 16 additions and 3 deletions

View File

@ -7,7 +7,7 @@
* @package Sakura
*/
define( 'SAKURA_VERSION', '3.2.6' );
define( 'SAKURA_VERSION', '3.2.7' );
define( 'BUILD_VERSION', '3' );
define( 'JSDELIVR_VERSION', '3.6.7' );
@ -183,6 +183,7 @@ function sakura_scripts() {
wp_enqueue_style( 'saukra_css', 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@' . SAKURA_VERSION . '/style.min.css', array(), SAKURA_VERSION );
wp_enqueue_script( 'app', 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@' . SAKURA_VERSION . '/js/sakura-app.min.js', array(), SAKURA_VERSION, true );
}
wp_enqueue_script( 'github_card', 'https://cdn.jsdelivr.net/github-cards/latest/widget.js', array(), SAKURA_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
@ -1548,6 +1549,18 @@ function html_tag_parser($content) {
title="$1"><img src="$2" target="_blank" rel="nofollow" class="fancybox"></a>',
$content
);
//Github cards
$content=preg_replace(
'/\[github repo=[\'"]([^\'"]+)[\'"]\]/i',
'
<iframe frameborder="0" scrolling="0" allowtransparency="true"
src="https://api.2heng.xin/github-card/?repo=$1"
width="400" height="153"
style="margin-left: 50%; transform: translateX(-50%);"></iframe>
',
$content
);
}
return $content;
}

View File

@ -1,5 +1,5 @@
/*
* Sakura application bundle theme ver 3.2.0
* Sakura theme application bundle
* @author Mashiro
* @url https://2heng.xin
* @date 2019.8.3

View File

@ -5,7 +5,7 @@ Theme URI: https://2heng.xin/theme-sakura/
Author: Mashiro, Louie, Fuzzz
Author URI: http://2heng.xin
Description: Akina主题分支原版地址 http://www.akina.pw/themeakina
Version: 3.2.4
Version: 3.2.7
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: akina