Created
March 30, 2012 15:23
-
-
Save ShinichiNishikawa/2252257 to your computer and use it in GitHub Desktop.
hoshino-goroku.php
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
<?php | |
/* | |
Plugin Name: Hoshino Goroku | |
Description: これはただのプラグインではありません。Kunitoshi Hoshino によって発言/ツイートされた最も有名な二つの言葉、「なんとー」、「なるほどですね」 に要約されたWordPressが好きな人々の希望と情熱を象徴するものです。このプラグインが有効にされると、すべての管理画面の右上に <cite>またお会い出来ますことを楽しみにしています</cite> などの言葉がランダムに表示されます。 | |
Author: Friends of @khoshino | |
Version: 0.1 | |
*/ | |
function hossy_words() { | |
$words = "ほほう。 | |
なるほどですねぇー。 | |
なるほどぉ。 | |
やはり、あれですか。 | |
いやいやいやいや。 | |
というわけで、新宿に来ました。 | |
池袋に着きました。 | |
というわけで、事務所に戻ります。 | |
さすがですね。 | |
趣味でサイトを作ってみました。 | |
なんとー。 | |
おぉ! | |
ですな。 | |
またお会い出来ますことを楽しみにしています! | |
いずれそのうち、また来月にでも! | |
さてさて、自宅に戻ります。 | |
ぜひまた明日! | |
そんなわけで、人生無駄なことは何も無いですね。 | |
おかしいなー。真面目に生きてるだけなんですけどね。 | |
いいっすよ! | |
そんなわけでSkype会議が終わりました。"; | |
// Here we split it into lines | |
$words = explode( "\n", $words ); | |
// And then randomly choose a line | |
return wptexturize( $words[ mt_rand( 0, count( $words ) - 1 ) ] ); | |
} | |
// This just echoes the chosen line, we'll position it later | |
function hossy_hossy() { | |
$chosen = hossy_words(); | |
echo "<p id='dolly'>$chosen</p>"; | |
} | |
// Now we set that function up to execute when the admin_notices action is called | |
add_action( 'admin_notices', 'hossy_hossy' ); | |
// We need some CSS to position the paragraph | |
function hossy_css() { | |
// This makes sure that the positioning is also good for right-to-left languages | |
$x = is_rtl() ? 'left' : 'right'; | |
echo " | |
<style type='text/css'> | |
#dolly { | |
float: $x; | |
padding-$x: 15px; | |
padding-top: 5px; | |
margin: 0; | |
font-size: 11px; | |
} | |
</style> | |
"; | |
} | |
add_action( 'admin_head', 'hossy_css' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment