Skip to content

Commit

Permalink
Merge pull request #747 from mirai-mamori/preview
Browse files Browse the repository at this point in the history
Ver 2.6.2
  • Loading branch information
mirai-mamori authored Jun 13, 2023
2 parents d21c577 + 60c27ff commit 64640b9
Show file tree
Hide file tree
Showing 228 changed files with 4,221 additions and 3,821 deletions.
2 changes: 1 addition & 1 deletion 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ function httpGet(theUrl) {
</form>
</div>
</section>
<script src="<?php global $shared_lib_basepath;echo $shared_lib_basepath?>/js/anf.js?>" type="text/javascript"></script>
<script src="<?php global $shared_lib_basepath;echo $shared_lib_basepath?>/js/anf.js" type="text/javascript"></script>
</body>
33 changes: 15 additions & 18 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions css/theme/sakura.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
.entry-content ul {
list-style: disc;
border: 1px solid #E4E4E4;
padding: 15px 10px 15px 50px;
padding: 15px 10px 30px 50px;
color: #616161;
margin-left: 0;
border-radius: 10px
Expand All @@ -40,18 +40,24 @@
padding: 15px 10px 15px 30px;
}

.entry-content li>ul, .entry-content li>ol {
border: none;
padding: 0 0 0 18px;
margin: 0;
}

.entry-content ol {
list-style: decimal;
border: 1px solid #E4E4E4;
padding: 15px 10px 15px 50px;
padding: 15px 10px 30px 50px;
color: #616161;
margin-left: 0;
border-radius: 10px
}

.entry-content ol li,
.entry-content ul li {
padding: 8px 0
padding: 15px 0 0 0;
}

.entry-content {
Expand Down
51 changes: 46 additions & 5 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


define('IRO_VERSION', wp_get_theme()->get('Version'));
define('INT_VERSION', '18.1.1');
define('INT_VERSION', '18.2.0');
define('BUILD_VERSION', '2');

function check_php_version($preset_version) {
Expand Down Expand Up @@ -602,25 +602,49 @@ function visual_resource_updates($specified_version, $option_name, $new_value) {

visual_resource_updates('2.5.6', 'vision_resource_basepath', '2.6/');

function gfonts_updates($specified_version, $option_name) {
$theme = wp_get_theme();
$current_version = $theme->get('Version');

// Check if the function has already been triggered
$function_triggered = get_transient('gfonts_updates_triggered18');
if ($function_triggered) {
return; // Function has already been triggered, do nothing
}

if (version_compare($current_version, $specified_version, '>')) {
$option_value = iro_opt($option_name);
if (empty($option_value) || $option_value !== 'cdn2.tianli0.top/fonts') {
$option_value = 'cdn2.tianli0.top/fonts';
iro_opt_update($option_name, $option_value);
}

// Set transient to indicate that the function has been triggered
set_transient('gfonts_updates_triggered18', true);
}
}

gfonts_updates('2.5.6', 'gfonts_api');

function gravater_updates($specified_version, $option_name) {
$theme = wp_get_theme();
$current_version = $theme->get('Version');

// Check if the function has already been triggered
$function_triggered = get_transient('gravater_updates_triggered18');
$function_triggered = get_transient('gravater_updates_triggered181');
if ($function_triggered) {
return; // Function has already been triggered, do nothing
}

if (version_compare($current_version, $specified_version, '>')) {
$option_value = iro_opt($option_name);
if (empty($option_value) || $option_value !== 'cdn2.tianli0.top/avatar') {
$option_value = 'cdn2.tianli0.top/avatar';
if (empty($option_value) || $option_value !== 'weavatar.com/avatar') {
$option_value = 'weavatar.com/avatar';
iro_opt_update($option_name, $option_value);
}

// Set transient to indicate that the function has been triggered
set_transient('gravater_updates_triggered18', true);
set_transient('gravater_updates_triggered181', true);
}
}

Expand Down Expand Up @@ -2311,3 +2335,20 @@ function should_show_title():bool{
|| !get_post_thumbnail_id($id)
&& $use_as_thumb != 'true' && !get_post_meta($id, 'video_cover', true);
}

/**
* 修复 WordPress 搜索结果为空,返回为 200 的问题。
* @author ivampiresp <im@ivampiresp.com>
*/
function search_404_fix_template_redirect()
{
if (is_search()) {
global $wp_query;

if ($wp_query->found_posts == 0) {
status_header(404);
}
}
}

add_action('template_redirect', 'search_404_fix_template_redirect');
2 changes: 1 addition & 1 deletion inc/classes/BilibiliFavList.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function fetch_folder_api()
return false;
}

function fetch_folder_item_api(int $folder_id, int $page): mixed
function fetch_folder_item_api(int $folder_id, int $page)
{
$url = "https://api.bilibili.com/x/v3/fav/resource/list?media_id=$folder_id&pn=$page&ps=9&platform=web&jsonp=jsonp";
$args = array(
Expand Down
17 changes: 15 additions & 2 deletions inc/swicher.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ function ecs_src($a) {
global $core_lib_basepath;
return $core_lib_basepath.'/css/theme/'.$a.'.css?'.IRO_VERSION.iro_opt('cookie_version', '');
};
/**
* 通过ID获取作者公开显示的昵称
* 在head中无法通过get_the_author()函数获取作者信息,改用通过作者ID获取
*/
function iro_get_the_author_name() {
global $post;
if ($post) {
$author_id = $post->post_author;
$author_name = get_the_author_meta('display_name', $author_id);
return $author_name;
}
return get_the_author_meta( 'display_name', 1 );
};
$vision_resource_basepath = iro_opt('vision_resource_basepath','https://s.nmxc.ltd/sakurairo_vision/@2.6/');
$movies = iro_opt('cover_video') ?
array(
Expand Down Expand Up @@ -48,8 +61,8 @@ function ecs_src($a) {
'ext_shared_lib'=>iro_opt('external_vendor_lib'),
'cookie_version_control' => iro_opt('cookie_version', ''),
'qzone_autocomplete' => false,
'site_name' => iro_opt('site_name', ''),
'author_name' => iro_opt('author_name', ''),
'site_name' => get_bloginfo('name'),
'author_name' => iro_get_the_author_name(),
'template_url' => get_template_directory_uri(),
'site_url' => site_url(),
'qq_api_url' => rest_url('sakura/v1/qqinfo/json'),
Expand Down
2 changes: 0 additions & 2 deletions js/104.js

This file was deleted.

Loading

0 comments on commit 64640b9

Please sign in to comment.