1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Classic Smilies |
---|
4 | Description: Puts back the original smilies that got replaced with those terribly ugly ones in WordPress 2.9-rare. |
---|
5 | Version: 0.2 |
---|
6 | Author: Otto |
---|
7 | Author URI: http://ottodestruct.com |
---|
8 | |
---|
9 | This program is free software; you can redistribute it and/or modify |
---|
10 | it under the terms of the GNU General Public License as published by |
---|
11 | the Free Software Foundation; version 2 of the License only. |
---|
12 | |
---|
13 | This program is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | GNU General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with this program; if not, write to the Free Software |
---|
20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
21 | */ |
---|
22 | |
---|
23 | function classic_smilies_fixurl($text) { |
---|
24 | $siteurl = get_option('siteurl'); |
---|
25 | $plugurl = plugin_dir_url(__FILE__); |
---|
26 | return preg_replace( |
---|
27 | "#<img src='{$siteurl}/wp-includes/images/smilies/#", |
---|
28 | "<img src='{$plugurl}classic/", |
---|
29 | $text |
---|
30 | ); |
---|
31 | } |
---|
32 | |
---|
33 | function classic_smilies_init() { |
---|
34 | global $wpsmiliestrans; |
---|
35 | |
---|
36 | $wpsmiliestrans = array( |
---|
37 | ':mrgreen:' => 'icon_mrgreen.gif', |
---|
38 | ':neutral:' => 'icon_neutral.gif', |
---|
39 | ':twisted:' => 'icon_twisted.gif', |
---|
40 | ':arrow:' => 'icon_arrow.gif', |
---|
41 | ':shock:' => 'icon_eek.gif', |
---|
42 | ':smile:' => 'icon_smile.gif', |
---|
43 | ':???:' => 'icon_confused.gif', |
---|
44 | ':cool:' => 'icon_cool.gif', |
---|
45 | ':evil:' => 'icon_evil.gif', |
---|
46 | ':grin:' => 'icon_biggrin.gif', |
---|
47 | ':idea:' => 'icon_idea.gif', |
---|
48 | ':oops:' => 'icon_redface.gif', |
---|
49 | ':razz:' => 'icon_razz.gif', |
---|
50 | ':roll:' => 'icon_rolleyes.gif', |
---|
51 | ':wink:' => 'icon_wink.gif', |
---|
52 | ':cry:' => 'icon_cry.gif', |
---|
53 | ':eek:' => 'icon_surprised.gif', |
---|
54 | ':lol:' => 'icon_lol.gif', |
---|
55 | ':mad:' => 'icon_mad.gif', |
---|
56 | ':sad:' => 'icon_sad.gif', |
---|
57 | '8-)' => 'icon_cool.gif', |
---|
58 | '8-O' => 'icon_eek.gif', |
---|
59 | ':-(' => 'icon_sad.gif', |
---|
60 | ':-)' => 'icon_smile.gif', |
---|
61 | ':-?' => 'icon_confused.gif', |
---|
62 | ':-D' => 'icon_biggrin.gif', |
---|
63 | ':-P' => 'icon_razz.gif', |
---|
64 | ':-o' => 'icon_surprised.gif', |
---|
65 | ':-x' => 'icon_mad.gif', |
---|
66 | ':-|' => 'icon_neutral.gif', |
---|
67 | ';-)' => 'icon_wink.gif', |
---|
68 | '8)' => 'icon_cool.gif', |
---|
69 | '8O' => 'icon_eek.gif', |
---|
70 | ':(' => 'icon_sad.gif', |
---|
71 | ':)' => 'icon_smile.gif', |
---|
72 | ':?' => 'icon_confused.gif', |
---|
73 | ':D' => 'icon_biggrin.gif', |
---|
74 | ':P' => 'icon_razz.gif', |
---|
75 | ':o' => 'icon_surprised.gif', |
---|
76 | ':x' => 'icon_mad.gif', |
---|
77 | ':|' => 'icon_neutral.gif', |
---|
78 | ';)' => 'icon_wink.gif', |
---|
79 | ':!:' => 'icon_exclaim.gif', |
---|
80 | ':?:' => 'icon_question.gif', |
---|
81 | ); |
---|
82 | |
---|
83 | // Content filters to fix image URLs |
---|
84 | add_filter('the_content', 'classic_smilies_fixurl', 10); |
---|
85 | add_filter('the_excerpt', 'classic_smilies_fixurl', 10); |
---|
86 | add_filter('comment_text', 'classic_smilies_fixurl', 30); |
---|
87 | } |
---|
88 | |
---|
89 | add_action('init', 'classic_smilies_init', 1); |
---|