Skip to content

Commit

Permalink
add back
Browse files Browse the repository at this point in the history
  • Loading branch information
KotoriK committed Jun 1, 2021
1 parent 2d2b74f commit 0ff8a28
Show file tree
Hide file tree
Showing 16 changed files with 831 additions and 114 deletions.
9 changes: 9 additions & 0 deletions BRANCH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Git分支的说明
* master
雪猫社正在使用的分支
* patches
修复上游一些奇怪的地方,随时可以merge回上游的分支
* latest-upstream
更改所基于的上游的最新版本
* preview
上游分支
12 changes: 1 addition & 11 deletions comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,7 @@ class="bili-bar on-hover">bilibili~</th>';
<span class="emotion-toggle-on">' . __("Woooooow ヾ(≧∇≦*)ゝ", "sakurairo")/*嘿嘿嘿 ヾ(≧∇≦*)ゝ*/ . '</span>
</p>
<div class="emotion-box no-select">
<table class="motion-switcher-table">
<tr>'.$bilibili_smile.'
<th onclick="motionSwitch(\'.menhera\')"
class="menhera-bar">(=・ω・=)</th>
<th onclick="motionSwitch(\'.tieba\')"
class="tieba-bar">Tieba</th>
</tr>
</table>
'.$bilibili_push_smile.push_emoji_panel().'
</div>
<div class="tieba-container motion-container" style="display:none;">' . push_tieba_smilies() . '</div>
</div>
<!--表情面版完-->',
'comment_notes_after' => '',
Expand Down
5 changes: 3 additions & 2 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@
<?php if (iro_opt('footer_sakura_icon', 'true')): ?>
<i class="iconfont icon-sakura rotating" style="color: <?php echo iro_opt('theme_skin_matching'); ?>;display:inline-block;font-size:26px"></i>
<?php endif; ?></p>
<p style="color: #666666;"><?php echo iro_opt('footer_info', ''); ?></p>
<?php echo iro_opt('footer_info', ''); ?>
</div>
<div class="footer-device">
<?php if (iro_opt('footer_random_word', 'true')||iro_opt('footer_load_occupancy', 'true')){ ?>
<p style="font-family: 'Ubuntu', sans-serif;">
<p id="footer_yiyan"></p>
<span style="color: #b9b9b9;">
<?php /* 能保留下面两个链接吗?算是我一个小小的心愿吧~ */ ?>
<?php if (iro_opt('footer_load_occupancy', 'true')): ?>
<?php printf(' 耗时 %.3f 秒 | 查询 %d 次 | 内存 %.2f MB',timer_stop( 0, 3 ),get_num_queries(),memory_get_peak_usage() / 1024 / 1024);?>
<?php endif; ?></p>
Theme <a href="https://github.com/mirai-mamori/Sakurairo" target="_blank" id="site-info" >Sakurairo</a> by <a href="https://iro.tw" target="_blank" id="site-info" >Fuukei</a>
</span>
</p>
<?php } ?>
</div>
</div><!-- .site-info -->
</footer><!-- #colophon -->
Expand Down
16 changes: 14 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ function set_default_admin_color($user_id)
//Stop Users From Switching Admin Color Schemes
//if ( !current_user_can('manage_options') ) remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

// WordPress Custom Font @ Admin
/* // WordPress Custom Font @ Admin
function custom_admin_open_sans_font()
{
echo '<link href="https://fonts.googleapis.com/css?family=Merriweather+Sans|Noto+Serif+SC&display=swap" rel="stylesheet">' . PHP_EOL;
Expand All @@ -1432,7 +1432,7 @@ function custom_admin_open_sans_font_login_page()
echo '<style>body{font-family:"Noto Serif SC","Source Han Serif SC","Source Han Serif","source-han-serif-sc","PT Serif","SongTi SC","MicroSoft Yahei",Georgia,serif !important;}</style>' . PHP_EOL;
}
}
add_action('login_head', 'custom_admin_open_sans_font_login_page');
add_action('login_head', 'custom_admin_open_sans_font_login_page'); */

// 阻止垃圾注册
add_action('register_post', 'codecheese_register_post', 10, 3);
Expand Down Expand Up @@ -1791,6 +1791,18 @@ function xcollapse($atts, $content = null){
}
add_shortcode('collapse', 'xcollapse');

// 文章增强
require get_template_directory() . '/inc/theme-shortcode.php';

//头像支持


//支持svg
add_filter( 'upload_mimes', function($mimes){
$mimes['svg'] = 'image/svg+xml';
return $mimes;
} );

//code end


Expand Down
7 changes: 7 additions & 0 deletions hackin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
function hack_pv($word="View"){
return '<span class="meta-page-view" data-path="'.parse_url(get_permalink(get_the_ID()))['path'].'">'
.get_post_views(get_the_ID()) . ' '
. _n($word, $word.'s', get_post_views(get_the_ID()), 'sakurairo')/*次阅读*/ .'</span>';
}
?>
4 changes: 2 additions & 2 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
-->
<html <?php language_attributes(); ?>>
<head>
<link rel="stylesheet" href="https://<?php echo iro_opt('google_fonts_api'); ?>/css?family=Noto+SerifMerriweather|Merriweather+Sans|Source+Code+Pro|Ubuntu:400,700|Noto+Serif+SC<?php echo iro_opt('google_fonts_add'); ?>" media="all">
<meta name="theme-color" content="<?php echo iro_opt('theme_skin'); ?>">
<!-- <link rel="stylesheet" href="https://<?php echo iro_opt('google_fonts_api'); ?>/css?family=Noto+SerifMerriweather|Merriweather+Sans|Source+Code+Pro|Ubuntu:400,700|Noto+Serif+SC<?php echo iro_opt('google_fonts_add'); ?>" media="all">
--><meta name="theme-color" content="<?php echo iro_opt('theme_skin'); ?>">
<meta charset="<?php bloginfo( 'charset' ); ?>">
<!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
Expand Down
7 changes: 7 additions & 0 deletions inc/decorate.php
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,13 @@ function customizer_css() { ?>
.post-list-thumb:nth-child(2n) .post-thumb a {
border-radius: 10px 0 0 10px
}
.post-list-thumb:nth-child(2n) div.post-date{
margin-right:0;
margin-left:auto;
}
.post-list-thumb:nth-child(2n){
flex-direction: row-reverse;
}
<?php } ?>

<?php if(iro_opt('page_style') == 'sakurairo'){ ?>
Expand Down
216 changes: 216 additions & 0 deletions inc/prism_lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
<?php
define('lang_dependencies', array(
"javascript" => "clike",
"actionscript" => "javascript",
"arduino" => "cpp",
"aspnet" => [
"markup",
"csharp"
],
"bison" => "c",
"c" => "clike",
"csharp" => "clike",
"cpp" => "c",
"coffeescript" => "javascript",
"crystal" => "ruby",
"css-extras" => "css",
"d" => "clike",
"dart" => "clike",
"django" => "markup-templating",
"ejs" => [
"javascript",
"markup-templating"
],
"etlua" => [
"lua",
"markup-templating"
],
"erb" => [
"ruby",
"markup-templating"
],
"fsharp" => "clike",
"firestore-security-rules" => "clike",
"flow" => "javascript",
"ftl" => "markup-templating",
"glsl" => "clike",
"gml" => "clike",
"go" => "clike",
"groovy" => "clike",
"haml" => "ruby",
"handlebars" => "markup-templating",
"haxe" => "clike",
"java" => "clike",
"javadoc" => [
"markup",
"java",
"javadoclike"
],
"jolie" => "clike",
"jsdoc" => [
"javascript",
"javadoclike"
],
"js-extras" => "javascript",
"js-templates" => "javascript",
"jsonp" => "json",
"json5" => "json",
"kotlin" => "clike",
"latte" => [
"clike",
"markup-templating",
"php"
],
"less" => "css",
"lilypond" => "scheme",
"markdown" => "markup",
"markup-templating" => "markup",
"n4js" => "javascript",
"nginx" => "clike",
"objectivec" => "c",
"opencl" => "c",
"parser" => "markup",
"php" => [
"clike",
"markup-templating"
],
"phpdoc" => [
"php",
"javadoclike"
],
"php-extras" => "php",
"plsql" => "sql",
"processing" => "clike",
"protobuf" => "clike",
"pug" => [
"markup",
"javascript"
],
"qml" => "javascript",
"qore" => "clike",
"jsx" => [
"markup",
"javascript"
],
"tsx" => [
"jsx",
"typescript"
],
"reason" => "clike",
"ruby" => "clike",
"sass" => "css",
"scss" => "css",
"scala" => "java",
"shell-session" => "bash",
"smarty" => "markup-templating",
"solidity" => "clike",
"soy" => "markup-templating",
"sparql" => "turtle",
"sqf" => "clike",
"swift" => "clike",
"tap" => "yaml",
"textile" => "markup",
"tt2" => [
"clike",
"markup-templating"
],
"twig" => "markup",
"typescript" => "javascript",
"t4-cs" => [
"t4-templating",
"csharp"
],
"t4-vb" => [
"t4-templating",
"visual-basic"
],
"vala" => "clike",
"vbnet" => "basic",
"velocity" => "markup",
"wiki" => "markup",
"xeora" => "markup",
"xquery" => "markup"
));
define('lang_alias', array(
"html" => "markup",
"xml" => "markup",
"svg" => "markup",
"mathml" => "markup",
"js" => "javascript",
"g4" => "antlr4",
"adoc" => "asciidoc",
"shell" => "bash",
"shortcode" => "bbcode",
"rbnf" => "bnf",
"conc" => "concurnas",
"cs" => "csharp",
"dotnet" => "csharp",
"coffee" => "coffeescript",
"jinja2" => "django",
"dns-zone" => "dns-zone-file",
"dockerfile" => "docker",
"xlsx" => "excel-formula",
"xls" => "excel-formula",
"gamemakerlanguage" => "gml",
"hs" => "haskell",
"tex" => "latex",
"context" => "latex",
"ly" => "lilypond",
"emacs" => "lisp",
"elisp" => "lisp",
"emacs-lisp" => "lisp",
"md" => "markdown",
"moon" => "moonscript",
"n4jsd" => "n4js",
"objectpascal" => "pascal",
"px" => "pcaxis",
"pq" => "powerquery",
"mscript" => "powerquery",
"py" => "python",
"robot" => "robotframework",
"rb" => "ruby",
"sln" => "solution-file",
"rq" => "sparql",
"trig" => "turtle",
"ts" => "typescript",
"t4" => "t4-cs",
"vb" => "visual-basic",
"xeoracube" => "xeora",
"yml" => "yaml"
));

function find_dependencies(string $lang_name)
{
$depend = lang_dependencies[$lang_name];
if (isset($depend)) {
if (is_array($depend)) {
return $depend;
} else {
return [$depend];
}
} else {
return array();
}
}
function get_script_handle(string $lang_name)
{
return "prism-lang-$lang_name";
}
function enqueue_lang_script(string $lang_name)
{
$depend = find_dependencies($lang_name);
wp_enqueue_script(
get_script_handle($lang_name),
"https://cdn.jsdelivr.net/npm/[email protected]/components/prism-$lang_name.min.js",
count($depend) > 0 ? array_map(function ($ele) {
enqueue_lang_script($ele);
return get_script_handle($ele);
}, $depend) : array()
);
}
function check_alias(string $lang_name)
{
$alias = lang_alias[$lang_name];
return isset($alias) ? $alias : $lang_name;
}
?>
Loading

0 comments on commit 0ff8a28

Please sign in to comment.