Typecho去除后台官方日志和版本更新检测

Typecho去除后台官方日志和版本更新检测

删除admin/index.php中官方最新日志显示模块(96-105行)及其相关JavaScript代码(105-147行),移除后台官方信息更新功能。

 次点击
15 分钟阅读

IMG_9190.webp

打开 admin/index.php,找到下面的代码,删除,大概在96-105行。

<div class="col-mb-12 col-tb-4" role="complementary">
	<section class="latest-link">
		<h3><?php _e('官方最新日志'); ?></h3>
		<div id="typecho-message">
			<ul>
				<li><?php _e('读取中...'); ?></li>
			</ul>
		</div>
	</section>
</div>

接着找到下面的代码,删除,大概在105-147行。

<script>
$(document).ready(function () {
	var ul = $('#typecho-message ul'), cache = window.sessionStorage,
		html = cache ? cache.getItem('feed') : '',
		update = cache ? cache.getItem('update') : '';
	if (!!html) {
		ul.html(html);
	} else {
		html = '';
		$.get('<?php $options->index('/action/ajax?do=feed'); ?>', function (o) {
			for (var i = 0; i < o.length; i ++) {
				var item = o[i];
				html += '<li><span>' + item.date + '</span> <a href="' + item.link + '" target="_blank">' + item.title
					+ '</a></li>';
			}
			ul.html(html);
			cache.setItem('feed', html);
		}, 'json');
	}
	function applyUpdate(update) {
		if (update.available) {
			$('<div class="update-check"><p>'
				+ '<?php _e('您当前使用的版本是 %s'); ?>'.replace('%s', update.current) + '<br />'
				+ '<strong><a href="' + update.link + '" target="_blank">'
				+ '<?php _e('官方最新版本是 %s'); ?>'.replace('%s', update.latest) + '</a></strong></p></div>')
			.appendTo('.welcome-board').effect('highlight');
		}
	}
	if (!!update) {
		applyUpdate($.parseJSON(update));
	} else {
		update = '';
		$.get('<?php $options->index('/action/ajax?do=checkVersion'); ?>', function (o, status, resp) {
			applyUpdate(o);
			cache.setItem('update', resp.responseText);
		}, 'json');
	}
});
</script>
© 本文著作权归作者所有,未经许可不得转载使用。