This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
* Hexo 新建日志 AppleScript 脚本(hexo_new_post.applescript) | |
* 原作者:https://gist.github.com/roshanca/4118971 | |
* 修改者:林木木 http://immmmm.com/ | |
* 版本:2014.7.10 | |
* 说明:原作者是 Octopress 版本的,捣鼓了一个下午终于成功转到 Hexo ,并去除了不影响功能的代码. | |
*) | |
tell application "Finder" | |
activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wp_iframe_handler_gist( $matches, $attr, $url, $rawattr ) { | |
$iframe = '<iframe width="100%" height="300" src="https://gist.github.com/'. esc_attr($matches[1]) .'/'. esc_attr($matches[2]) . '.pibb" frameborder=0 ></iframe>'; | |
return apply_filters( 'iframe_gist', $iframe, $matches, $attr, $url, $rawattr ); | |
} | |
wp_embed_register_handler( 'gist_iframe', '#https://gist.github.com/(.*?)/([\w]+)#i', 'wp_iframe_handler_gist' ); | |
//七牛云缓存:新建空间,镜像源设置成“https://gist.github.com/”,然后把上面代码中的这句链接改成“https://你的空间项目.qiniudn.com/” |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By ImMmMm.com 七牛云缓存 Gravatar头像(支持头像大小参数) | |
function qiniu_avatar($avatar) { | |
$avatar = preg_replace('/.*\/avatar\/(.*)\?s=([\d]+)&.*/','<img src="http://你的空间名称.qiniudn.com/avatar/$1-$2" class="avatar avatar-$2" height="$2" width="$2">',$avatar); | |
return $avatar; | |
} | |
add_filter( 'get_avatar', 'qiniu_avatar', 10, 3 ); | |
// WordPress 4.0+ 适用 | |
function qiniu_avatar($avatar) { | |
$avatar = preg_replace('/.*\/avatar\/(.*)\?s=([\d]+)&.*.srcset=.*/','<img src="http://你的空间名称.qiniudn.com/avatar/$1-$2" class="avatar avatar-$2" height="$2" width="$2">',$avatar); | |
return $avatar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function duoshuo_avatar($avatar) { | |
$avatar = str_replace(array("www.gravatar.com","0.gravatar.com","1.gravatar.com","2.gravatar.com"),"gravatar.duoshuo.com",$avatar); | |
return $avatar; | |
} | |
add_filter( 'get_avatar', 'duoshuo_avatar', 10, 3 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//允许 Email 登录 WordPress 后台 | |
function allow_email_login($username ) { | |
$user = get_user_by( 'email', $username ); | |
if ( ! empty( $user) ) { | |
$username = $user->user_login; | |
} | |
return $username; | |
} | |
add_filter('sanitize_user', 'allow_email_login'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scp_comment_post( $incoming_comment ) { | |
$pattern = '/[一-龥]/u'; | |
if(!preg_match($pattern, $incoming_comment['comment_content'])) { | |
wp_die( "您的评论中必须包含中文!" ); | |
} | |
return( $incoming_comment ); | |
} | |
add_filter('preprocess_comment', 'scp_comment_post'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_add_quicktags() { | |
if (wp_script_is('quicktags')){ ?> | |
<script type="text/javascript"> | |
//QTags.addButton( id, display, arg1, arg2, access_key, title, priority, instance ); | |
QTags.addButton( 'pre.html4', 'HTML代码', "\n<pre lang='html4strict'>\n", "\n</pre>\n" ); | |
QTags.addButton( 'pre.js', 'JS代码', "\n<pre lang='javascript'>\n", "\n</pre>\n" ); | |
QTags.addButton( 'pre.php', 'PHP代码', "\n<pre lang='php'>\n", "\n</pre>\n" ); | |
QTags.addButton( '[gallery.i2m]', '两列', '\n[gallery link="file" include="," columns="2" size="medium"]\n','' ); | |
QTags.addButton( '[gallery.i3m]', '三列', '\n[gallery link="file" include="," size="medium"]\n','' ); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'preprocess_comment', 'wpb_preprocess_comment' ); | |
function wpb_preprocess_comment($comment) { | |
if ( strlen( $comment['comment_content'] ) > 5000 ) { | |
wp_die('Comment is too long. Please keep your comment under 5000 characters.'); | |
} | |
if ( strlen( $comment['comment_content'] ) < 60 ) { | |
wp_die('Comment is too short. Please use at least 60 characters.'); | |
} | |
return $comment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wpb_alter_comment_form_fields($fields) { | |
unset($fields['author']); | |
unset($fields['email']); | |
unset($fields['url']); | |
return $fields; | |
} | |
add_filter('comment_form_default_fields', 'wpb_alter_comment_form_fields'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert `24dian`(`num1`,`num2`,`num3`,`num4`) values('1','1','1','8'), | |
('1','1','1','8'), | |
('1','1','2','6'), | |
('1','1','2','7'), | |
('1','1','2','8'), | |
('1','1','2','9'), | |
('1','1','2','10'), | |
('1','1','3','4'), | |
('1','1','3','5'), | |
('1','1','3','6'), |
OlderNewer