Info
- 82 posts
- 34 voices
- Started 5 years ago by Ttech
- Latest reply from hpguru
Emoticons For bbPress?
-
- Posted 4 years ago #
So it filters through the post but not the edit? It appeared to me that some old posts that had text emoticons, like :) , were filtered on display and how display a gif instead of the text. Maybe I imagined that?
In fact, here's a post I made on my forum back in December, and it gets converted to a gif.
http://www.riversideinfo.org/forum/topic.php?id=6&replies=15#post-40
I did not edit that post, and I just installed the bb-emoticons plugin yesterday. I guess I still don't understand how it works.
-
- Posted 4 years ago #
It worked nicely for me. I assumed that since it added smileys everywhere retroactively it filtered the post between the database and the output?
-
- Posted 4 years ago #
To make this work in 1.0 you need to change the first few lines (or it won't be available to activate as a plugin). I modified mine to this, which still has all the credits in there.
<?php /* Plugin Name: bbEmoticons Plugin URI: Description: A Clickable Smilies hack for bbPress. Thanks to <a href="http://www.orioa.com/">kohaku</a> and <a href="http://plasticdreams.org/">aka</a>. Original WP Grins by <a href="http://www.alexking.org/software/wordpress/">Alex King</a>. Author: hiromasa Author URI: http://hiromasa.zone.ne.jp/blog/ Version: 0.72 */ ...Just replace the
<?phpat the start of your .php file with this and it should show up to be activated.Edit: Oh, awesome, a
overflow: autoproperty has been added. Thanks. :) -
- Posted 4 years ago #
How to make is so, that it wont filter between the code tags? Cause we dont want smilies in code parts :)
-
- Posted 4 years ago #
I'd love to have the emoticons available from a pop-up menu, that way you only load them when needed.
Camino hates all the emoticons on my screen at once. :D
-
- Posted 4 years ago #
Unfortunately you'll need someone with some Javascript mojo to do that. It's been done often enough before, but I presume it still requires some knowledge. :P
-
- Posted 4 years ago #
but I presume it still requires some knowledge. :P
:D That's why I posted here! -
- Posted 4 years ago #
One of the co-creators of my forum worked on it for a while (putting the emoticons in an AJAX window) but wasn't successful as yet. Perhaps one day I can look at it if someone else doesn't beat me to it.
-
- Posted 4 years ago #
I used this plugin and the row of smilies show beneath the edit form, but they are unclickable. An even when I just type in :) :( etc, they don't appear in the post.
-
- Posted 4 years ago #
I've now made a smilie plugin here:
http://bbpress.org/plugins/topic/bb-smiliesBy the way, WordPress's default smilie detection code and therefore the code converted here in the earlier post are very flawed when it comes to whitespace issues.
I created a patch awhile back that made it work 99% of the time regardless of spaces before, after or at the end/beginning of a sentence.
add this function:
function prepSmilies($string) {return "/(\s|^)".quotemeta(trim($string))."(\s|$)/";}then add this near the start of function convert_smilies:
$prep_search = array_map('prepSmilies', $wp_smiliessearch);then change the $contenst=str_replace line near the end of function covert_smilies:
$content = preg_replace($prep_search, $wp_smiliesreplace, $content);Now if only it was this easy to tweak wp/bb's search function to be so much more intelligent.
-
- Posted 4 years ago #
i am using 0.8.2.1 i upload the files but in plugins list in admin area it didnt appear!! any one know the reason?
-
- Posted 4 years ago #
It's not a plugin. Add this to the top of the file, after the <?php:
/* Plugin Name: Nerr */ -
- Posted 4 years ago #
i did wht u said
file apear in plugin list but
when i try to actve it i see this error message:
Plugin could not be activated; it produced a Fatal Error. -
- Posted 4 years ago #
Ooooh, I really hate that. What file are you trying to use as a plugin?
-
- Posted 4 years ago #
<?php
/*
Plugin Name: bbEmoticons
Plugin URI:
Description: A Clickable Smilies hack for bbPress. Thanks to kohaku and aka. Original WP Grins by Alex King.
Author: hiromasa
Author URI: http://hiromasa.zone.ne.jp/blog/
Version: 0.72
*/
/******************************************************************************
* bbEmoticons version 0.72
*
* A Clickable Smilies hack for bbPress.
*
* @Author hiromasa (http://hiromasa.zone.ne.jp/blog/)
* @Thanks kohaku (http://www.orioa.com/)
* aka (http://plasticdreams.org/)
* @Original WP Grins By Alex King
* (http://www.alexking.org/software/wordpress/)
* WordPress convert_smilies function and images
* (http://wordpress.org/)
*****************************************************************************//* Copyright 2006 hiromasa (email : webmaster@hiromasa.zone.ne.jp)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*//******************************************************************************
* bbEmoticons
*
* @author hiromasa
* @version 0.72
*
*****************************************************************************/
class bbEmoticons {var $bb_grins;
var $bb_smiliessearch = array();
var $bb_smiliesreplace = array();/**
* The Constructor
*
* @param none
* @return none
*/
function bbEmoticons() {if (isset($_GET['bb_grins_output'])) {
switch ($_GET['bb_grins_output']) {
case "javascript":
$this->outputGringJS();
}
exit(0);
}$bb_smiliestrans = array(
' :)' => 'icon_smile.gif',
' :D' => 'icon_biggrin.gif',
' :-D' => 'icon_biggrin.gif',
':grin:' => 'icon_biggrin.gif',
' :)' => 'icon_smile.gif',
' :-)' => 'icon_smile.gif',
':smile:' => 'icon_smile.gif',
' :(' => 'icon_sad.gif',
' :-(' => 'icon_sad.gif',
':sad:' => 'icon_sad.gif',
' :o' => 'icon_surprised.gif',
' :-o' => 'icon_surprised.gif',
':eek:' => 'icon_surprised.gif',
' 8O' => 'icon_eek.gif',
' 8-O' => 'icon_eek.gif',
':shock:' => 'icon_eek.gif',
' :?' => 'icon_confused.gif',
' :-?' => 'icon_confused.gif',
' :???:' => 'icon_confused.gif',
' 8)' => 'icon_cool.gif',
' 8-)' => 'icon_cool.gif',
':cool:' => 'icon_cool.gif',
':lol:' => 'icon_lol.gif',
' :x' => 'icon_mad.gif',
' :-x' => 'icon_mad.gif',
':mad:' => 'icon_mad.gif',
' :P' => 'icon_razz.gif',
' :-P' => 'icon_razz.gif',
':razz:' => 'icon_razz.gif',
':oops:' => 'icon_redface.gif',
':cry:' => 'icon_cry.gif',
':evil:' => 'icon_evil.gif',
':twisted:' => 'icon_twisted.gif',
':roll:' => 'icon_rolleyes.gif',
':wink:' => 'icon_wink.gif',
' ;)' => 'icon_wink.gif',
' ;-)' => 'icon_wink.gif',
':!:' => 'icon_exclaim.gif',
':?:' => 'icon_question.gif',
':idea:' => 'icon_idea.gif',
':arrow:' => 'icon_arrow.gif',
' :|' => 'icon_neutral.gif',
' :-|' => 'icon_neutral.gif',
':neutral:' => 'icon_neutral.gif',
':mrgreen:' => 'icon_mrgreen.gif',
);foreach($bb_smiliestrans as $smiley => $img) {
$this->bb_smiliessearch[] = $smiley;
$smiley_masked = htmlspecialchars(trim($smiley), ENT_QUOTES);
$this->bb_smiliesreplace[] =
" <img src='" . bb_get_option('uri') .
"bb-images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
}$this->grins = '';
$smiled = array();
foreach ($bb_smiliestrans as $tag => $grin) {
if (!in_array($grin, $smiled)) {
$smiled[] = $grin;
$tag = str_replace(' ', '', $tag);
$this->grins .=
'<img src="'. bb_get_option('uri') .
'bb-images/smilies/'.$grin.'" alt="' .$tag .
'" onclick="grin(\' '.$tag.'\');"/> ';
}
}}
/**
* post_text filter
*
* @param $text
* @return $output
*/
function convert_smilies($text) {$output = '';
$textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$stop = count($textarr);
for($i=0; $i<$stop; $i++) {
$content = $textarr[$i];
if((strlen($content) > 0) && ('<' != $content{0})) {
$content = str_replace(
$this->bb_smiliessearch,
$this->bb_smiliesreplace,
$content);
}
$output .= $content;
}return $output;
}
/**
* bb_grins action
*
* @param none
* @return none
*/
function bb_grins() {echo '<div id="bb_grins">' . $this->grins . '</div>';
}
/**
* bb_head action
*
* @param none
* @return none
*/
function bb_grins_head() {echo
'<script type="text/javascript" src="'. bb_get_option('uri') .
'my-plugins/bb-emoticons.php?bb_grins_output=javascript"></script>' .
"\n";}
/**
* Output Grins JavaScript
*
* @param none
* @return none
*/
function outputGringJS() {function grin(tag) {
var myField;
if (document.getElementById('post_content') && document.getElementById('post_content').type == 'textarea') {
myField = document.getElementById('post_content');
}
else if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
myField = document.getElementById('comment');
}
else {
return false;
}
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = tag;
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ tag
+ myField.value.substring(endPos, myField.value.length);
cursorPos += tag.length;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else {
myField.value += tag;
myField.focus();
}
}}
}
/******************************************************************************
* - Define for bbPress interface
*****************************************************************************/$bbemoticons = & new bbEmoticons();
bb_add_filter('post_text', array(&$bbemoticons, 'convert_smilies'));
//bb_head is not called always. :-)
//bb_add_action('bb_head', array(&$bbemoticons, 'bb_grins_head'));
bb_add_action('bb_feed_head', array(&$bbemoticons, 'bb_grins_head'));
bb_add_action('bb_grins', array(&$bbemoticons, 'bb_grins'));?>
-
- Posted 4 years ago #
i don t know what is the problem
-
- Posted 4 years ago #
Did you modify the plugin? Insert a
?>before line 202 and a<?phpbefore line 237.
In Notepad you can go to a specific line by pressing Ctrl + G. -
- Posted 4 years ago #
<?php
/*
Plugin Name: bbEmoticons
Plugin URI:
Description: A Clickable Smilies hack for bbPress. Thanks to kohaku and aka. Original WP Grins by Alex King.
Author: hiromasa
Author URI: http://hiromasa.zone.ne.jp/blog/
Version: 0.72
*//******************************************************************************
* bbEmoticons version 0.72
*
* A Clickable Smilies hack for bbPress.
*
* @Author hiromasa (http://hiromasa.zone.ne.jp/blog/)
* @Thanks kohaku (http://www.orioa.com/)
* aka (http://plasticdreams.org/)
* @Original WP Grins By Alex King
* (http://www.alexking.org/software/wordpress/)
* WordPress convert_smilies function and images
* (http://wordpress.org/)
*****************************************************************************//* Copyright 2006 hiromasa (email : webmaster@hiromasa.zone.ne.jp)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*//******************************************************************************
* bbEmoticons
*
* @author hiromasa
* @version 0.72
*
*****************************************************************************/
class bbEmoticons {var $bb_grins;
var $bb_smiliessearch = array();
var $bb_smiliesreplace = array();/**
* The Constructor
*
* @param none
* @return none
*/
function bbEmoticons() {if (isset($_GET['bb_grins_output'])) {
switch ($_GET['bb_grins_output']) {
case "javascript":
$this->outputGringJS();
}
exit(0);
}$bb_smiliestrans = array(
' :)' => 'icon_smile.gif',
' :D' => 'icon_biggrin.gif',
' :-D' => 'icon_biggrin.gif',
':grin:' => 'icon_biggrin.gif',
' :)' => 'icon_smile.gif',
' :-)' => 'icon_smile.gif',
':smile:' => 'icon_smile.gif',
' :(' => 'icon_sad.gif',
' :-(' => 'icon_sad.gif',
':sad:' => 'icon_sad.gif',
' :o' => 'icon_surprised.gif',
' :-o' => 'icon_surprised.gif',
':eek:' => 'icon_surprised.gif',
' 8O' => 'icon_eek.gif',
' 8-O' => 'icon_eek.gif',
':shock:' => 'icon_eek.gif',
' :?' => 'icon_confused.gif',
' :-?' => 'icon_confused.gif',
' :???:' => 'icon_confused.gif',
' 8)' => 'icon_cool.gif',
' 8-)' => 'icon_cool.gif',
':cool:' => 'icon_cool.gif',
':lol:' => 'icon_lol.gif',
' :x' => 'icon_mad.gif',
' :-x' => 'icon_mad.gif',
':mad:' => 'icon_mad.gif',
' :P' => 'icon_razz.gif',
' :-P' => 'icon_razz.gif',
':razz:' => 'icon_razz.gif',
':oops:' => 'icon_redface.gif',
':cry:' => 'icon_cry.gif',
':evil:' => 'icon_evil.gif',
':twisted:' => 'icon_twisted.gif',
':roll:' => 'icon_rolleyes.gif',
':wink:' => 'icon_wink.gif',
' ;)' => 'icon_wink.gif',
' ;-)' => 'icon_wink.gif',
':!:' => 'icon_exclaim.gif',
':?:' => 'icon_question.gif',
':idea:' => 'icon_idea.gif',
':arrow:' => 'icon_arrow.gif',
' :|' => 'icon_neutral.gif',
' :-|' => 'icon_neutral.gif',
':neutral:' => 'icon_neutral.gif',
':mrgreen:' => 'icon_mrgreen.gif',
);foreach($bb_smiliestrans as $smiley => $img) {
$this->bb_smiliessearch[] = $smiley;
$smiley_masked = htmlspecialchars(trim($smiley), ENT_QUOTES);
$this->bb_smiliesreplace[] =
" <img src='" . bb_get_option('uri') .
"bb-images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
}$this->grins = '';
$smiled = array();
foreach ($bb_smiliestrans as $tag => $grin) {
if (!in_array($grin, $smiled)) {
$smiled[] = $grin;
$tag = str_replace(' ', '', $tag);
$this->grins .=
'<img src="'. bb_get_option('uri') .
'bb-images/smilies/'.$grin.'" alt="' .$tag .
'" onclick="grin(\' '.$tag.'\');"/> ';
}
}}
/**
* post_text filter
*
* @param $text
* @return $output
*/
function convert_smilies($text) {$output = '';
$textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$stop = count($textarr);
for($i=0; $i<$stop; $i++) {
$content = $textarr[$i];
if((strlen($content) > 0) && ('<' != $content{0})) {
$content = str_replace(
$this->bb_smiliessearch,
$this->bb_smiliesreplace,
$content);
}
$output .= $content;
}return $output;
}
/**
* bb_grins action
*
* @param none
* @return none
*/
function bb_grins() {echo '<div id="bb_grins">' . $this->grins . '</div>';
}
/**
* bb_head action
*
* @param none
* @return none
*/
function bb_grins_head() {echo
'<script type="text/javascript" src="'. bb_get_option('uri') .
'my-plugins/bb-emoticons.php?bb_grins_output=javascript"></script>' .
"\n";}
/**
* Output Grins JavaScript
*
* @param none
* @return none
*/
function outputGringJS() {?>
function grin(tag) {
var myField;
if (document.getElementById('post_content') && document.getElementById('post_content').type == 'textarea') {
myField = document.getElementById('post_content');
}
else if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
myField = document.getElementById('comment');
}
else {
return false;
}
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = tag;
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ tag
+ myField.value.substring(endPos, myField.value.length);
cursorPos += tag.length;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else {
myField.value += tag;
myField.focus();
}
}
<?php}
}
/******************************************************************************
* - Define for bbPress interface
*****************************************************************************/$bbemoticons = & new bbEmoticons();
bb_add_filter('post_text', array(&$bbemoticons, 'convert_smilies'));
//bb_head is not called always. :-)
//bb_add_action('bb_head', array(&$bbemoticons, 'bb_grins_head'));
bb_add_action('bb_feed_head', array(&$bbemoticons, 'bb_grins_head'));
bb_add_action('bb_grins', array(&$bbemoticons, 'bb_grins'));?>
-
- Posted 4 years ago #
yes i thought we don t need them! because before editing it didn't work too. so here are my fresh plugin but it didn't work too i just insert plugin info to the top of file
-
- Posted 4 years ago #
Please stop pasting huge chunks of code on the forums. Use something like http://pastebin.ca/.
That code runs fine for me. What problem are you having?
It might be simplest to start off with the original plugin and fix that because you might have done quite a lot to it.
-
- Posted 4 years ago #
Please stop pasting huge chunks of code on the forums. Use something like http://pastebin.ca/.
ok i will do
listen i want to tell you somthing important :) i downloaded bbEmoticons-0.72 and unpacked it and then send it to my plugin then i go to my admin and try to active it but it show fattal error my bbpress is .8.2.1
so i tried to download 6th and every time it didnt active!
now i come and copy the code form here and open new file in php and save it then try to upload it and active it :O
it get active and work! what is wrong?
do you test bbEmoticons-0.72 from the original download address i think there is somthing wrong in the original file
please try it once for me :) -
- Posted 4 years ago #
hi again i want to know why the function grin(tag) { is out of php code
why it need to be out side? -
- Posted 4 years ago #
It's Javascript. PHP files are just like HTML files, and anything outside the
<?php ... ?>is treated as HTML. Calling the particular function around that makes it go to that place and then go through and output the HTML (which happens to be JS). -
- Posted 4 years ago #
__ck__
i done what you told but i have got error:see my script:
http://pastebin.ca/638062 -
- Posted 4 years ago #
If you'd like emoticons to show up in your private messages here's how. Open up bb-emoticons.php . After line 242 which contains
bb_add_filter('post_text', array(&$bbemoticons, 'convert_smilies'));Add the following.
bb_add_filter('pm_text', array(&$bbemoticons, 'convert_smilies'));This will display the emoticons within your your private messages
-
- Posted 4 years ago #
i see the emoticons but cant click them ;_;
i tried making this but didnt work yet :/
http://bbpress.org/forums/topic/emoticons-for-bbpress?replies=55#post-819
-
- Posted 4 years ago #
Has anyone been able to get this working with the 'bbpress-forum' template (the one that mimics this forum) and bbPress 8.3? I had this working fine in my older install using the default template, but 8.3 seems to break things, and 'bbpress-forum' doesn't have the post-form.php and edit-form.php files.
-
- Posted 4 years ago #
Aye, same here. All worked nice in the version previous to .3 but now nothing......
-
- Posted 3 years ago #
Seems to be broken in 0.9.0.1. Anybody else having trouble?
-
- Posted 3 years ago #
Doesn't work for me in 0.9.x either!!
Its time someone built a plugin here..