Changeset 1078421
- Timestamp:
- 01/29/2015 06:24:20 PM (11 years ago)
- Location:
- font-emoticons
- Files:
-
- 9 added
- 4 deleted
- 4 edited
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (added)
-
assets/icon-256x256.png (added)
-
trunk/FontEmoticonInfo.php (added)
-
trunk/FontEmoticonsPlugin.php (added)
-
trunk/emoticons.css (modified) (1 diff)
-
trunk/font-emoticons.php (modified) (1 diff)
-
trunk/font/LICENSE.txt (modified) (1 diff)
-
trunk/font/emoticons.eot (deleted)
-
trunk/font/emoticons.svg (deleted)
-
trunk/font/emoticons.ttf (deleted)
-
trunk/font/emoticons.woff (deleted)
-
trunk/font/wp-font-emots.eot (added)
-
trunk/font/wp-font-emots.svg (added)
-
trunk/font/wp-font-emots.ttf (added)
-
trunk/font/wp-font-emots.woff (added)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
font-emoticons/trunk/emoticons.css
r642815 r1078421 1 1 @font-face { 2 font-family: 'emoticons'; 3 src: url("font/emoticons.eot"); 4 src: url("font/emoticons.eot?#iefix") format('embedded-opentype'), 5 url("font/emoticons.woff") format('woff'), 6 url("font/emoticons.ttf") format('truetype'), 7 url("font/emoticons.svg#emoticons") format('svg'); 8 } 9 [class^="icon-emo-"]:before, 10 [class*=" icon-emo-"]:before { 11 font-family: 'emoticons'; 12 font-style: normal; 13 font-weight: normal; 14 speak: none; 15 display: inline-block; 16 text-decoration: inherit; 17 width: 1em; 18 margin-right: 0.2em; 19 text-align: center; 20 opacity: 0.8; 21 /* fix buttons height, for twitter bootstrap */ 22 line-height: 1em; 23 /* Animation center compensation - magrins should be symmetric */ 24 /* remove if not needed */ 25 margin-left: 0.2em; 26 /* you can be more comfortable with increased icons size */ 27 /* font-size: 120%; */ 2 font-family: 'wp-font-emots'; 3 src: url('font/wp-font-emots.eot?73553728'); 4 src: url('font/wp-font-emots.eot?73553728#iefix') format('embedded-opentype'), 5 url('font/wp-font-emots.woff?73553728') format('woff'), 6 url('font/wp-font-emots.ttf?73553728') format('truetype'), 7 url('font/wp-font-emots.svg?73553728#wp-font-emots') format('svg'); 8 font-weight: normal; 9 font-style: normal; 28 10 } 29 11 30 .icon-emo-happy:before { content: '\e800'; } /* '' */ 31 .icon-emo-unhappy:before { content: '\e802'; } /* '' */ 32 .icon-emo-sleep:before { content: '\e803'; } /* '' */ 33 .icon-emo-thumbsup:before { content: '\e804'; } /* '' */ 34 .icon-emo-devil:before { content: '\e805'; } /* '' */ 35 .icon-emo-surprised:before { content: '\e806'; } /* '' */ 36 .icon-emo-tongue:before { content: '\e807'; } /* '' */ 37 .icon-emo-coffee:before { content: '\e808'; } /* '' */ 38 .icon-emo-sunglasses:before { content: '\e809'; } /* '' */ 39 .icon-emo-displeased:before { content: '\e80a'; } /* '' */ 40 .icon-emo-beer:before { content: '\e80b'; } /* '' */ 41 .icon-emo-grin:before { content: '\e80c'; } /* '' */ 42 .icon-emo-angry:before { content: '\e80d'; } /* '' */ 43 .icon-emo-saint:before { content: '\e80e'; } /* '' */ 44 .icon-emo-cry:before { content: '\e80f'; } /* '' */ 45 .icon-emo-shoot:before { content: '\e810'; } /* '' */ 46 .icon-emo-laugh:before { content: '\e812'; } /* '' */ 47 .icon-emo-wink2:before { content: '\e813'; } /* '' */ 12 [class^="wp-font-emots-"]:before, 13 [class*=" wp-font-emots-"]:before { 14 font-family: 'wp-font-emots'; 15 font-style: normal; 16 font-weight: normal; 17 18 display: inline-block; 19 margin-right: 0.2em; 20 margin-left: 0.2em; 21 22 /* For safety - reset parent styles, that can break glyph codes */ 23 font-variant: normal; 24 text-transform: none; 25 } 26 27 .wp-font-emots-emo-happy:before { content: '\e800'; } 28 .wp-font-emots-emo-wink:before { content: '\e801'; } 29 .wp-font-emots-ok:before { content: '\e802'; } 30 .wp-font-emots-emo-unhappy:before { content: '\e803'; } 31 .wp-font-emots-emo-sleep:before { content: '\e804'; } 32 .wp-font-emots-thumbs-up:before { content: '\e805'; } 33 .wp-font-emots-emo-devil:before { content: '\e806'; } 34 .wp-font-emots-emo-surprised:before { content: '\e807'; } 35 .wp-font-emots-emo-tongue:before { content: '\e808'; } 36 .wp-font-emots-emo-coffee:before { content: '\e809'; } 37 .wp-font-emots-emo-sunglasses:before { content: '\e80a'; } 38 .wp-font-emots-emo-displeased:before { content: '\e80b'; } 39 .wp-font-emots-emo-beer:before { content: '\e80c'; } 40 .wp-font-emots-emo-grin:before { content: '\e80d'; } 41 .wp-font-emots-emo-angry:before { content: '\e80e'; } 42 .wp-font-emots-emo-saint:before { content: '\e80f'; } 43 .wp-font-emots-emo-cry:before { content: '\e810'; } 44 .wp-font-emots-emo-shoot:before { content: '\e811'; } 45 .wp-font-emots-emo-squint:before { content: '\e812'; } 46 .wp-font-emots-emo-laugh:before { content: '\e813'; } 47 .wp-font-emots-cancel:before { content: '\e814'; } 48 .wp-font-emots-heart:before { content: '\e815'; } 49 .wp-font-emots-star:before { content: '\e816'; } 50 .wp-font-emots-plus-circled:before { content: '\e817'; } 51 .wp-font-emots-minus-circled:before { content: '\e818'; } 52 .wp-font-emots-help-circled:before { content: '\e819'; } 53 .wp-font-emots-info-circled:before { content: '\e81a'; } 54 .wp-font-emots-thumbs-down:before { content: '\e81b'; } -
font-emoticons/trunk/font-emoticons.php
r671163 r1078421 2 2 /* 3 3 Plugin Name: Font Emoticons 4 Plugin URI: 4 Plugin URI: https://wordpress.org/plugins/font-emoticons/ 5 5 Description: Replace the standard WP Smileys with font icons. 6 Version: 1. 26 Version: 1.3 7 7 Author: Sebastian Krysmanski 8 8 Author URI: http://manski.net 9 9 */ 10 10 11 class FontEmoticonInfo { 12 private $name; 13 private $text_reps; 14 private $regex; 11 require_once(dirname(__FILE__).'/FontEmoticonsPlugin.php'); 15 12 16 public function __construct($name, $text_reps) { 17 $this->name = $name; 18 $this->text_reps = $text_reps; 19 20 $this->regex = ''; 21 $is_first = true; 22 foreach ($text_reps as $smiley) { 23 if ($is_first) { 24 $is_first = false; 25 } 26 else { 27 $this->regex .= '|'; 28 } 29 $this->regex .= preg_quote($smiley, '/'); 30 } 31 32 $this->regex = '/(\s+)(?:'.$this->regex.')(\s+)/U'; 33 } 34 35 public function insert_emots($post_text) { 36 $code = '\\1<span class="icon-emo-'.$this->name.'"/>\\2'; 37 return preg_replace($this->regex, $code, $post_text); 38 } 39 } 40 41 class FontEmoticons { 42 /** 43 * Identifies the beginning of a masked text section. Text sections are masked by surrounding an id with this and 44 * {@link $SECTION_MASKING_END_DELIM}. 45 * @var string 46 * @see encode_placeholder() 47 */ 48 private $SECTION_MASKING_START_DELIM; 49 /** 50 * Identifies the end of a masked text section. Text sections are masked by surrounding an id with this and 51 * {@link $SECTION_MASKING_START_DELIM}. 52 * @var string 53 * @see encode_placeholder() 54 */ 55 private $SECTION_MASKING_END_DELIM; 56 57 private $placeholders; 58 59 private $emots; 60 61 private function __construct() { 62 # Adding some characters (here: "@@") to the delimiters gives us the ability to distinguish them both in the markup 63 # text and also prevents the misinterpretation of real MD5 hashes that might be contained in the markup text. 64 # 65 # NOTE: The additional character(s) (@) must neither have a meaning in BlogText (so that it's not parsed by 66 # accident) nor must it have a meaning in a regular expression (again so that it's not parsed by accident). 67 $this->SECTION_MASKING_START_DELIM = '@@'.md5('%%%'); 68 $this->SECTION_MASKING_END_DELIM = md5('%%%').'@@'; 69 70 # See: http://codex.wordpress.org/Using_Smilies#What_Text_Do_I_Type_to_Make_Smileys.3F 71 $this->emots = array( 72 new FontEmoticonInfo('happy', array(':)', ':-)', ':smile:')), 73 new FontEmoticonInfo('unhappy', array(':(', ':-(', ':sad:')), 74 new FontEmoticonInfo('wink2', array(';)', ';-)', ':wink:')), 75 new FontEmoticonInfo('tongue', array(':P', ':-P', ':razz:')), 76 new FontEmoticonInfo('sleep', array('-.-', '-_-', ':sleep:')), 77 new FontEmoticonInfo('thumbsup', array(':thumbs:', ':thumbsup:')), 78 new FontEmoticonInfo('devil', array(':devil:', ':twisted:')), 79 new FontEmoticonInfo('surprised', array(':o', ':-o', ':eek:', '8O', '8o', '8-O', '8-o', ':shock:')), 80 new FontEmoticonInfo('coffee', array(':coffee:')), 81 new FontEmoticonInfo('sunglasses', array('8)', '8-)', 'B)', 'B-)', ':cool:')), 82 new FontEmoticonInfo('displeased', array(':/', ':-/')), 83 new FontEmoticonInfo('beer', array(':beer:')), 84 new FontEmoticonInfo('grin', array(':D', ':-D', ':grin:')), 85 # No real icon for "mad" available yet. Use the same as angry. 86 new FontEmoticonInfo('angry', array('x(', 'x-(', 'X(', 'X-(', ':angry:', ':x', ':-x', ':mad:')), 87 new FontEmoticonInfo('saint', array('O:)', '0:)', 'o:)', 'O:-)', '0:-)', 'o:-)', ':saint:')), 88 new FontEmoticonInfo('cry', array(":'(", ":'-(", ':cry:')), 89 new FontEmoticonInfo('shoot', array(':shoot:')), 90 new FontEmoticonInfo('laugh', array('^^', '^_^', ':lol:')) 91 ); 92 93 # Disable Wordpress' own smileys 94 update_option('use_smilies', 0); 95 96 add_filter('the_content', array($this, 'replace_emots'), 500); 97 add_filter('the_excerpt', array($this, 'replace_emots'), 500); 98 add_filter('get_comment_text', array($this, 'replace_emots'), 500); 99 add_filter('get_comment_excerpt', array($this, 'replace_emots'), 500); 100 if (!is_admin()) { 101 add_action('wp_print_styles', array($this, 'enqueue_stylesheets_callback')); 102 } 103 104 } 105 106 public static function init() { 107 static $instance = null; 108 if ($instance === null) { 109 $instance = new FontEmoticons(); 110 } 111 } 112 113 public function enqueue_stylesheets_callback() { 114 wp_register_style('emoticons', WP_PLUGIN_URL.'/font-emoticons/emoticons.css'); 115 wp_enqueue_style('emoticons'); 116 } 117 118 public function replace_emots($content) { 119 # surround content with white space so that regexps match emoticons at the beginning and the end 120 # of the content correctly. 121 $content = ' '.$content.' '; 122 123 #echo "<!--$content-->"; 124 125 $content = $this->mask_content($content); 126 127 #echo "<!--$content-->"; 128 129 foreach ($this->emots as $emot) { 130 $content = $emot->insert_emots($content); 131 } 132 133 $content = $this->unmask_content($content); 134 135 # Remove spaces added at the beginning. 136 $content = substr($content, 1, -1); 137 138 return $content; 139 } 140 141 private function mask_content($content) { 142 # Reset placeholders array 143 $this->placeholders = array(); 144 # Mask all code blocks and HTML tags 145 return preg_replace_callback('=<pre(?: .+)?>.*</pre>|<code(?: .+)?>.*</code>|<.+>=isU', array($this, 'mask_content_replace_callback'), $content); 146 } 147 148 public function mask_content_replace_callback($matches) { 149 $matched_text = $matches[0]; 150 $id = count($this->placeholders); 151 $this->placeholders[] = $matched_text; 152 $ret = $this->SECTION_MASKING_START_DELIM.$id.$this->SECTION_MASKING_END_DELIM; 153 154 # At this stage, line break characters have already been replaced with <p> and <br> elements. Surround them with 155 # spaces to enable emoticon detection. Also, surround HTML comments with spaces. 156 # 157 # NOTE: At the moment I can't imagine a reason where adding white space around those element would cause any 158 # trouble. I might be wrong though. 159 # 160 # NOTE 2: The first regexp must match <p>, </p> as well as <br />. 161 if (preg_match('#^<[/]?(?:p|br)\s*(?:/\s*)?>$#iU', $matched_text) || preg_match('/<!--.*-->/sU', $matched_text)) { 162 $ret = ' '.$ret.' '; 163 } 164 return $ret; 165 } 166 167 private function unmask_content($content) { 168 $content = preg_replace_callback('='.$this->SECTION_MASKING_START_DELIM.'(\d+)'.$this->SECTION_MASKING_END_DELIM.'=U', array($this, 'unmask_content_replace_callback'), $content); 169 $this->placeholders = array(); 170 return $content; 171 } 172 173 public function unmask_content_replace_callback($matches) { 174 $id = intval($matches[1]); 175 return $this->placeholders[$id]; 176 } 177 } 178 179 FontEmoticons::init(); 13 FontEmoticonsPlugin::init(); 180 14 181 15 register_deactivation_hook(__FILE__, 'fe_plugin_deactivated'); 182 function fe_plugin_deactivated() { 183 # Re-enable Wordpress smileys 184 update_option('use_smilies', 1); 16 function fe_plugin_deactivated() 17 { 18 # Re-enable Wordpress smileys 19 update_option('use_smilies', 1); 185 20 } -
font-emoticons/trunk/font/LICENSE.txt
r642815 r1078421 11 11 12 12 13 ## Font Awesome 14 15 Copyright (C) 2012 by Dave Gandy 16 17 Author: Dave Gandy 18 License: SIL (http://scripts.sil.org/OFL) 19 Homepage: http://fortawesome.github.com/Font-Awesome/ 20 21 -
font-emoticons/trunk/readme.txt
r671163 r1078421 3 3 Tags: smileys, emoticons 4 4 Requires at least: 3.0.0 5 Tested up to: 3.5.06 Stable tag: 1. 25 Tested up to: 4.1.0 6 Stable tag: 1.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 The following emoticons are supported: 19 19 20 * `:)` `:-)` ` :smile:`20 * `:)` `:-)` `(-:` `(:` `:smile:` 21 21 * `:(` `:-(` `:sad:` 22 22 * `;)` `;-)` `:wink:` 23 23 * `:P` `:-P` `:razz:` 24 24 * `-.-` `-_-` `:sleep:` 25 * `:thumbs:` `:thumbsup:` 26 * `:devil:` `:twisted:` 25 * `>:)` `>:-)` `:devil:` `:twisted:` 27 26 * `:o` `:-o` `:eek:` 28 * `8O` `8o` `8-O` `8-o` `:shock:` 29 (No real icon for "shock" yet. Using "eek" instead.) 27 * `8O` `8o` `8-O` `8-o` `:shock:` (No special icon for "shock" yet. Using "eek" instead.) 30 28 * `:coffee:` 31 29 * `8)` `8-)` `B)` `B-)` `:cool:` … … 34 32 * `:D` `:-D` `:grin:` 35 33 * `x(` `x-(` `X(` `X-(` `:angry:` 36 * `:x` `:-x` `:mad:` 37 (No real icon from "mad" yet. Using "angry" instead.) 34 * `:x` `:-x` `:mad:` (No special icon from "mad" yet. Using "angry" instead.) 38 35 * `O:)` `0:)` `o:)` `O:-)` `0:-)` `o:-)` `:saint:` 39 36 * `:'(` `:'-(` `:cry:` 40 37 * `:shoot:` 38 * `|)` `:squint:` 41 39 * `^^` `^_^` `:lol:` 42 40 41 The following general purpose icons are supported: 42 43 * `:thumbs:` `:thumbsup:` 44 * `:thumbsdown:` 45 * `<3` `:heart:` 46 * `:star:` 47 * `(/)` (ok sign) 48 * `(x)` (cancel) 49 * `(i)` 50 * `(?)` 51 * `(+)` 52 * `(-)` 53 43 54 Notes: 44 * Emoticons must be surrounded with spaces (or other white space characters); e.g. the emoticon in `that:)smile` won't be replaced 45 * Emoticons won't be replaced in HTML tags nor in `<pre>` or `<code>` blocks. 55 56 * Emoticons/Icons must be surrounded with spaces (or other white space characters); e.g. the emoticon in `that:)smile` won't be replaced. 57 * Emoticons/Icons won't be replaced in HTML tags nor inside of `<pre>` or `<code>` blocks. 46 58 47 59 == Installation == … … 59 71 == Changelog == 60 72 73 = 1.3 = 74 * Feature: New emoticon "squint": `|)` or `:squint:` 75 * Feature: Added some general purpose icons like `<3` (heart) or `:thumbsdown:` (`:thumbsup:` got changed to icon from emoticon) 76 * Change: PHP 5.3 is now required 77 * Change: "devil" and "eek" got more text representations; "smile" now also supports the Australian version `(-:` 78 * Change: Made font and css classes more unique so that they don't interfer with other icon fonts (issue #7) 79 * Fix: Multiple consecutive emoticons are now parsed correctly (issue #5); emoticons surrounded by HTML tags (like `<li>:)</li>`) are now parsed correctly. 80 * Fix: Wider emoticons now flow correctly with surrounding text (no longer overlap it) (issue #4) 81 61 82 = 1.2 = 62 * Emoticons are now supported in comments and excerpts. 83 * Emoticons are now supported in comments and excerpts. (issue #1) 63 84 64 85 = 1.1 = … … 69 90 * First release. 70 91 71 == Font License ==72 The emoticons used in this plugin are based on the "Fontelico" font.92 == Font Licenses == 93 The emoticons used in this plugin are based on the fonts "Fontelico" and "Font Awesome". 73 94 74 License: 95 = Fontelico = 75 96 76 Copyright (C) 2012 by Fontello project97 Copyright (C) 2012 by Fontello project 77 98 78 Author: Crowdsourced, for Fontello project 79 License: SIL (http://scripts.sil.org/OFL) 80 Homepage: http://fontello.com 99 Author: Crowdsourced, for Fontello project 100 License: SIL (http://scripts.sil.org/OFL) 101 Homepage: http://fontello.com 102 103 = Font Awesome = 104 105 Copyright (C) 2012 by Dave Gandy 106 107 Author: Dave Gandy 108 License: SIL (http://scripts.sil.org/OFL) 109 Homepage: http://fortawesome.github.com/Font-Awesome/
Note: See TracChangeset
for help on using the changeset viewer.