使用方法:
1 .解压文件,放到steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg
目录中。
- 安
~
键(esc下面那个),进入控制台(设置>游戏设置) - 输入下面的代码
exec Plus.cfg
exec Plus_Bottrain.cfg
exec Plus_Throw.cfg
使用方法:
1 .解压文件,放到steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg
目录中。
~
键(esc下面那个),进入控制台(设置>游戏设置)exec Plus.cfg
exec Plus_Bottrain.cfg
exec Plus_Throw.cfg
Typecho 实现短代码功能。
前几天,准备对博客首页大改。在寻找灵感的途中。发现有的博客实现了一些好玩的功能。
这个短代码就是其中之一。
毕竟markdown里没有太明显的提示或警告。
稍微研究了一下。
很简单的一个原理,用正则匹配短代码标签,把他替换成样式就OK了。
在主题的 functions.php
的文件里,新建个函数。
// 短代码测试
function getContentTest($content) {
$pattern = '/\[(info)\](.*?)\[\s*\/\1\s*\]/';
$replacement = '<div class="hint hint-info"><span class="glyphicon glyphicon-info-sign hint-info-icon" aria-hidden="true"></span>$2</div>';
$content = preg_replace($pattern, $replacement, $content);
$pattern = '/\[(warning)\](.*?)\[\s*\/\1\s*\]/';
$replacement = '<div class="hint hint-warning"><span class="glyphicon glyphicon-question-sign hint-warning-icon" aria-hidden="true"></span>$2</div>';
$content = preg_replace($pattern, $replacement, $content);
$pattern = '/\[(danger)\](.*?)\[\s*\/\1\s*\]/';
$replacement = '<div class="hint hint-danger"><span class="glyphicon glyphicon-exclamation-sign hint-danger-icon" aria-hidden="true"></span>$2</div>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
然后把主题里输出文章内容的函数(共三处处:index.php 、page.php 和 articles.php)
<?php $this->content(); ?>
换成你刚刚添加的
<?php echo getContentTest($this->content); ?
原理:对excerpt
函数输出的内容再次正则匹配,来在摘要中剔除 短代码标记 。
// 摘要短代码测试
function getExcerptTest($excerpt,$num,$str) {
$pattern = '/\[(info)\](.*?)\[\s*\/\1\s*\]/';
$replacement = ' $2 ';
$excerpt = preg_replace($pattern, $replacement, $excerpt);
$pattern = '/\[(warning)\](.*?)\[\s*\/\1\s*\]/';
$replacement = ' $2 ';
$excerpt = preg_replace($pattern, $replacement, $excerpt);
$pattern = '/\[(danger)\](.*?)\[\s*\/\1\s*\]/';
$replacement = ' $2 ';
$excerpt = preg_replace($pattern, $replacement, $excerpt);
//使用mb_substr防止中文截取成乱码,需要开启extension=php_mbstring.dll扩展,一般都开了
return mb_substr($excerpt,0,$num,"UTF-8").$str;
}
使用下面的代码替换原有摘要输出(150是截断字数, ' ......' 是需要显示的提示)
<?php echo getExcerptTest($this->text,150,' ......'); ?>
typecho文章内容失效提醒。
用的是上一篇文章的警告提示的样式
修改typecho主题的post.php文件,在需要提醒的位置添加以下内容.
<!--设置需要提醒的时间-->
<?php $halfyear = 3600 * 24 * 30 * 6; ?>
<!--计算文章距离上次修改的时间-->
<?php $lostTime = time() - $this->modified; ?>
<!--判断是否需要提醒-->
<?php if ($lostTime > $halfyear): ?>
<!--提醒样式开始-->
<div class="hint hint-warning">
<span class="glyphicon glyphicon-question-sign hint-warning-icon" aria-hidden="true"></span><span class="sr-only">warning:</span>
这篇文章距离上次修改已过<?php echo floor($lostTime/86400); ?>天,其中的信息可能已经有所发展或是发生改变。
</div>
<!--提醒样式结束-->
<?php endif; ?>
每次更新Maven的pom.xml后自动修改jre为J2SE-1.5。
然后Eclipse提示“构建路径指定执行环境 J2SE-1.5。工作空间中没有与此环境严格兼容的 JRE”和“The compiler compliance specified is 1.5 but a JRE 13 is used”。手动修改后。问题可以解决。但老改也不是个事。
首先编辑 settings.xml
文件
修改第184行左右的 <profile>
部分为你需要的版本,这里以我的JDK1.13为例。
<profile>
<id>jdk-1.13</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.13</jdk>
</activation>
<properties>
<maven.compiler.source>1.13</maven.compiler.source>
<maven.compiler.target>1.13</maven.compiler.target>
<maven.compiler.compilerVersion>1.13</maven.compiler.compilerVersion>
</properties>
</profile>
在项目的pom.xml文件中添加下面设置,jdk版本修改成需要的版本。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.13</source>
<target>1.13</target>
</configuration>
</plugin>
</plugins>
</build>