diff --git a/header.php b/header.php
index 28a7ba58..8bcfa557 100644
--- a/header.php
+++ b/header.php
@@ -153,10 +153,12 @@ function gtag() {
-
diff --git a/inc/admin_addcss.php b/inc/admin_addcss.php
index b225b0cc..c212286d 100644
--- a/inc/admin_addcss.php
+++ b/inc/admin_addcss.php
@@ -132,4 +132,9 @@
display: block !important;
}
+.csf-nav {
+ position: -webkit-sticky;
+ position: sticky;
+ top: 125px;
+}
\ No newline at end of file
diff --git a/inc/classes/Images.php b/inc/classes/Images.php
index 139e6a44..a21cdf52 100644
--- a/inc/classes/Images.php
+++ b/inc/classes/Images.php
@@ -28,12 +28,12 @@ public function Chevereto_API($image) {
);
$response = wp_remote_post($upload_url, $args);
- $reply = json_decode($response["body"]);
+ $reply = json_decode($response['body']);
if ($reply->status_txt == 'OK' && $reply->status_code == 200) {
$status = 200;
$success = true;
- $message = "success";
+ $message = 'success';
$link = $reply->image->image->url;
$proxy = iro_opt('comment_image_proxy') . $link;
} else {
@@ -68,12 +68,12 @@ public function Imgur_API($image) {
);
$response = wp_remote_post($upload_url, $args);
- $reply = json_decode($response["body"]);
+ $reply = json_decode($response['body']);
if ($reply->success && $reply->status == 200) {
$status = 200;
$success = true;
- $message = "success";
+ $message = 'success';
$link = $reply->data->link;
$proxy = iro_opt('comment_image_proxy') . $link;
} else {
@@ -98,19 +98,19 @@ public function Imgur_API($image) {
*/
public function SMMS_API($image) {
$client_id = $this->smms_client_id;
- $upload_url = "https://sm.ms/api/v2/upload";
+ $upload_url = 'https://sm.ms/api/v2/upload';
$filename = $image['cmt_img_file']['name'];
$filedata = $image['cmt_img_file']['tmp_name'];
$Boundary = wp_generate_password();
$bits = file_get_contents($filedata);
$args = array(
- "headers" => "Content-Type: multipart/form-data; boundary=$Boundary\r\n\r\nAuthorization: Basic $client_id\r\n\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97",
- "body" => "--$Boundary\r\nContent-Disposition: form-data; name=\"smfile\"; filename=\"$filename\"\r\n\r\n$bits\r\n\r\n--$Boundary--"
+ 'headers' => "Content-Type: multipart/form-data; boundary=$Boundary\r\n\r\nAuthorization: Basic $client_id\r\n\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97",
+ 'body' => "--$Boundary\r\nContent-Disposition: form-data; name=\"smfile\"; filename=\"$filename\"\r\n\r\n$bits\r\n\r\n--$Boundary--"
);
$response = wp_remote_post($upload_url, $args);
- $reply = json_decode($response["body"]);
+ $reply = json_decode($response['body']);
if ($reply->success && $reply->code == 'success') {
$status = 200;
@@ -142,12 +142,12 @@ public function SMMS_API($image) {
}
public static function cover_gallery() {
- if (iro_opt('random_graphs_options') == "local") {
- $img_array = glob(get_template_directory() . "/manifest/gallary/*.{gif,jpg,png}", GLOB_BRACE);
+ if (iro_opt('random_graphs_options') == 'local') {
+ $img_array = glob(get_template_directory() . '/manifest/gallary/*.{gif,jpg,png}', GLOB_BRACE);
$img = array_rand($img_array);
$imgurl = trim($img_array[$img]);
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
- } elseif (iro_opt('random_graphs_options') == "external_api") {
+ } elseif (iro_opt('random_graphs_options') == 'external_api') {
$imgurl = iro_opt('random_graphs_link');
} else {
global $sakura_image_array;
@@ -155,21 +155,21 @@ public static function cover_gallery() {
$img = array_rand($img_array);
$img_domain = iro_opt('random_graphs_link') ? iro_opt('random_graphs_link') : get_template_directory_uri();
if (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false) {
- $imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
+ $imgurl = $img_domain . "/manifest/" . $img_array[$img]['webp'][0];
} else {
- $imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
+ $imgurl = $img_domain . "/manifest/" . $img_array[$img]['jpeg'][0];
}
}
return $imgurl;
}
public static function mobile_cover_gallery() {
- if (iro_opt('random_graphs_options') == "local") {
- $img_array = glob(get_template_directory() . "/manifest/gallary/*.{gif,jpg,png}", GLOB_BRACE);
+ if (iro_opt('random_graphs_options') == 'local') {
+ $img_array = glob(get_template_directory() . '/manifest/gallary/*.{gif,jpg,png}', GLOB_BRACE);
$img = array_rand($img_array);
$imgurl = trim($img_array[$img]);
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
- } elseif (iro_opt('random_graphs_options') == "external_api") {
+ } elseif (iro_opt('random_graphs_options') == 'external_api') {
//$imgurl = iro_opt('random_graphs_link');
$imgurl = iro_opt('random_graphs_link_mobile');
} else {
@@ -178,16 +178,16 @@ public static function mobile_cover_gallery() {
$img = array_rand($img_array);
$img_domain = iro_opt('random_graphs_link') ? iro_opt('random_graphs_link') : get_template_directory_uri();
if (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp')) {
- $imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
+ $imgurl = $img_domain . "/manifest/" . $img_array[$img]['webp'][0];
} else {
- $imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
+ $imgurl = $img_domain . "/manifest/" . $img_array[$img]['jpeg'][0];
}
}
return $imgurl;
}
public static function feature_gallery() {
- if (iro_opt('post_cover_options') == "type_2") {
+ if (iro_opt('post_cover_options') == 'type_2') {
$imgurl = iro_opt('post_cover');
} else {
$imgurl = self::cover_gallery();
diff --git a/inc/theme_plus.php b/inc/theme_plus.php
index df61c26e..366840fc 100644
--- a/inc/theme_plus.php
+++ b/inc/theme_plus.php
@@ -10,6 +10,13 @@
// 去除顶部工具栏
show_admin_bar(false);
+function get_edit_html():string{
+ global $user_ID;
+ if ($user_ID && current_user_can('level_10')) {
+ return '
·'.__("EDIT","sakurairo").'';
+}
+ return '';
+}
/*
* 视频
@@ -293,12 +300,7 @@ function the_headPattern(){
$center = 'single-center';
$header = 'single-header';
//$ava = iro_opt('personal_avatar', '') ? iro_opt('personal_avatar', '') : get_avatar_url(get_the_author_meta('user_email'));
- global $user_ID;
- if($user_ID && current_user_can('level_10')) {
- $edit_this_post_link = '
·EDIT';
- } else {
- $edit_this_post_link = '';
- }
+ $edit_this_post_link = get_edit_html();
$t .= the_title( '
', '
', false);
$t .= '
'.get_avatar(get_the_author_meta('ID'),64) .''. get_the_author() .'·'. poi_time_since(get_post_time('U', true),false,true) .'·'. get_post_views(get_the_ID()) .' '._n("View","Views",get_post_views(get_the_ID()),"sakurairo")/*次阅读*/.$edit_this_post_link.'
';
endwhile; endif;
@@ -326,141 +328,93 @@ function the_headPattern(){
endif;
}
-/*视频封面*/
-function the_video_headPattern_hls(){
- $t = ''; // 标题
- $full_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
- $thubm_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'thumbnail');
-
- $video_cover = get_post_meta(get_the_ID(), 'video_cover', true);
- $video_cover_thumb = get_post_meta(get_the_ID(), 'video_cover_thumb', true);
- // 检查这个字段是否有值
- if (empty ( $video_cover_thumb )) { //如果值为空,输出默认值
- $video_poster_attr = "";
- } else {
- $video_poster_attr = ' poster="' . $video_cover_thumb . '" ';
- }
+/**
+ * 文章封面视频
+ * @param isHls
+ */
+function the_video_headPattern(bool $isHls = false)
+{
+ $t = ''; // 标题
+ $full_image_urls = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
+ $thubm_image_urls = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'thumbnail');
- if(is_single()){
- $full_image_url = !empty($full_image_url) ? $full_image_url[0] : null;
- $thubm_image_url = !empty($thubm_image_url) ? $thubm_image_url[0] : null;
- if (have_posts()) : while (have_posts()) : the_post();
- $center = 'single-center';
- $header = 'single-header';
- //$ava = iro_opt('personal_avatar', '') ? iro_opt('personal_avatar', '') : get_avatar_url(get_the_author_meta('user_email'));
- global $user_ID;
- if($user_ID && current_user_can('level_10')) {
- $edit_this_post_link = '
·EDIT';
- } else {
- $edit_this_post_link = '';
- }
- $t .= the_title( '
', '
', false);
- $t .= '
'.get_avatar(get_the_author_meta('ID'),64) .''. get_the_author() .'·'. poi_time_since(get_post_time('U', true),false,true) .'·'. get_post_views(get_the_ID()) .' '._n("View","Views",get_post_views(get_the_ID()),"sakurairo")/*次阅读*/.$edit_this_post_link.'
';
- endwhile; endif;
- }elseif(is_page()){
- $full_image_url = $full_image_url[0];
- $thubm_image_url = $thubm_image_url[0];
- $t .= the_title( '
', '
', false);
- }elseif(is_archive()){
- $full_image_url = z_taxonomy_image_url();
- $thubm_image_url = iro_opt('load_out_svg');
- $des = category_description() ? category_description() : ''; // 描述
- $t .= '
'.single_cat_title('', false).'
';
- $t .= '
'.$des.'';
- }elseif(is_search()){
- $full_image_url = get_random_bg_url();
- $thubm_image_url = iro_opt('load_out_svg');
- $t .= '
'.sprintf( __( "Search results for \" %s \"","sakurairo" ), get_search_query()) ./*关于“ '.get_search_query().' ”的搜索结果*/'
';
- }
- $thubm_image_url = $thubm_image_url . "#lazyload-blur";
- $thubm_image_url = str_replace(iro_opt('image_cdn'),'https://cdn.2heng.xin/',$thubm_image_url);
- if(!iro_opt('patternimg')) $full_image_url = false;
- if(!is_home() && $full_image_url) : ?>
-
-
-
-
-
-
-
-
-
-
';
- endif;
-}
-//普通视频
-function the_video_headPattern_normal(){
- $t = ''; // 标题
- $full_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
- $thubm_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'thumbnail');
-
$video_cover = get_post_meta(get_the_ID(), 'video_cover', true);
$video_cover_thumb = get_post_meta(get_the_ID(), 'video_cover_thumb', true);
// 检查这个字段是否有值
- if (empty ( $video_cover_thumb )) { //如果值为空,输出默认值
+ if (empty($video_cover_thumb)) { //如果值为空,输出默认值
$video_poster_attr = "";
} else {
$video_poster_attr = ' poster="' . $video_cover_thumb . '" ';
}
-
- if(is_single()){
- $full_image_url = $full_image_url[0];
- $thubm_image_url = $thubm_image_url[0];
- if (have_posts()) : while (have_posts()) : the_post();
- $center = 'single-center';
- $header = 'single-header';
- //$ava = iro_opt('personal_avatar', '') ? iro_opt('personal_avatar', '') : get_avatar_url(get_the_author_meta('user_email'));
- global $user_ID;
- if($user_ID && current_user_can('level_10')) {
- $edit_this_post_link = '