Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter
Support for Vanilla Forums Cloud product

In this Discussion

Follow Us


Transmogrifier

edited March 2007 in Questions
This discussion is related to the Transmogrifier addon.
Transmogrifier
«1

Comments

  • This extension is quite essential to my Esperanto forum. Because many of my users are not able to directly type the Esperanto accented characters (ĉ, ĝ, Ä¥, ĵ, ŝ and Å­), I use Transmogrifier to allow them to type alternative character pairs, which get automatically changed to the appropriate accented letter. It works like a charm, and the users *really* like it.

    The latest upgrade of the "Post Preview" extension makes it also fully compatible with Transmogrifier, which makes it a bonus! :-)

    Ever since I installed it, though, there has been a couple of problems with Transmogrifier, which I keep on hoping will eventually be solved:

    1) Transmogrifier does not apply its 'magic' to the titles of discussions - so when users start a new discussion, if the title has an accented character, I must go in as 'admin' and manually change the title directly. It would, of course, be fantastic if Transmogrifier could also transmogrify those titles.

    2) Transmogrifier does not apply its magic to the content of pages created with the "Page Manager" add on. Again, that would be a wonderful addition to this already excellent extension to Vanilla!

    Please, Bergamot, keep up the good work! - It is very, very much appreciated! :-)

    You can see its magic at work in our forum here. To see how I've got it setup, have a look at the FAQs, under "Typing Esperanto Accents".
  • Uploaded version 1.2 of Transmogrifier.
  • Hi, I've just added the following to my config.txt file: [cut] == <font color="red"><strike> [/cut] == </font></strike> and I've recieved the following error: Warning: preg_replace(): Unknown modifier 'c' in /home/xxx/public_html/xxxxxxxx/forums/extensions/Transmogrifier/default.php on line 56 Everything works fine without this latest piece of custom code I added. Any way to correct this? Thanks
  • I know this isn't a solution to this problem, but you can get this using [s][/s] in BBCodeParser and then just add this to vanilla.css:del {color:red !important;}
  • I thought I might also add that the following works.. +s+ == <strike> +\s+ == </strike> However, +/s+ does not. There seems to be some sort of rejection for the / character
  • @vaz - this isn't what you posted about, and i doubt it's related to the problem, but in the original example, you closed the font/strike tags in the wrong order. sorry, i'm a validation nerd :)
  • An update!!!! GREEEEEEEEEEEEEEEEEEAT!!! :-D Does anyone know what's new?
  • @guazy [cut] == <font color="red"><strike> [/cut] == </font></strike> Let's even try that then. It pops up an error unless you change [/cut] into [\cut] :D
  • @vaz: I think guazy was suggesting you try THIS: [cut] == <font color="red"><strike> [/cut] == </strike></font> Properly formed XML should be nested: "<outertag><innertag></innertag></outertag>"...
  • yes, i was referring to what icouto said:)
  • icouto, sorry, but the new things are just simple fixes suggested by SirNot to convince it to work with PreviewPost.

    Transmogrifier & PreviewPost Extension # 3
    Transmogrifier & PreviewPost Extension # 7
  • @[-Stash-]: thank you for the info! :-)

    Do you know if it would be very difficult to change it, to fix the 2 problems mentioned in the above comment?
  • It would be very difficult for me! I don't really code PHP (or JS) I just hack other people's skilled work around. Someone like Mark, SirNot or Dinoboff may be able to help on those two point. They are certainly very good ideas.
  • Very impressive stuff! And it would be great if this magic could support and replace the 2-byte languages, such as Chinese, Japanese and Korean. I mean I would like to replace any specific word(s) of 2-byte lang with icons. Could you possibly support these languages?
  • Trying to make Google Talk-like emoticons, but I can't get this to work: :) == <span style="color:#0000ff; font-weight:bold">:)</span> It just displays ":)" (unaltered). Any ideas?
  • @kimC, is it a formatter issue? i think all the formatters will accept HTML, but i could be wrong. i'll give it a shot on mine.

    hrm, doing the same thing on my install. not sure why.
  • No idea - maybe the code parses the < or the / chars wrong? But I don't know how to code in php anyway...
  • Can this be made case-insensitive? Or perhaps add an option so that people can choose? I love the extension, though.
  • there is a php function that can convert it to lowercase.
    use that
  • @KimC
    Since Transmogrifier will be skip any line that contain '#'.
    You have two ways to fix it.
    The easiest way, just change '#0000FF' to 'blue' ==> :) == :)
    The second way, change line 39 in default.php
    if($line == "" || $line == "\n" || strstr($line,"#")) by if($line == "" || $line == "\n" || strstr($line,"##")) and add more '#' in the config.txt 's comment (or just remove any comment :P).

    @kaon
    just change line 45 in default.php:
    $this->token[$counter] = '/'.preg_quote($value[0]).'/'; to $this->token[$counter] = '/'.preg_quote($value[0]).'/i';
  • Thanks, SkyBoy. You fixed it!
  • Yes, it rejects a forward slash before the ==... My workaround was to use

    :tag:
    :endtag: instead of anything approaching BBcode or HTML.
  • It would be great if this could be sorted to allow '/' - has anyone figured out how to do this? Ideally what I'd like is to allow people to use a kind of simplified html. So, for example,for an image they can just put <img>http://whatever.com/apicture.jpg</img>; and that would become proper code, which should be straightforward enough, just by adding <img> == <img src=" </img> == " /> to the config file. And with the same idea add in different types of blockquotes, etc. But it's hitting on two problems. One is that HTML Formatter adds in spaces before the '>' most of the time (so '<img>' becomes '<img >'), but Transmogrifier can be used to work around that. The other thing is the '/' character not playing with Transmogrifier at all. If anyone is smart enough to come up with a fix I would be very grateful. I only ask because it is already so very useful and ingenious - thanks Bergamot! And even if it weren't I would still be tempted to install it on the basis that the name makes me think fondly of Calvin and Hobbes, which I always enjoy doing.
  • <img>http://whatever.com/apicture.jpg</img>;

    Why not just use BBCode for that kind of thing?
  • So I have been sitting here all night trying to figure this out, I'm modifying this for use as another extension. This extension would take a random value entered in the text file and display it. Even if the the original value is the same. So the text file is layed out as such: VALUE == NEW VALUE 1 VALUE == NEW VALUE 2 VALUE == NEW VALUE 3 VALUE == NEW VALUE 4 VALUE == NEW VALUE 5 I've tried over and over and still can't figure out how to make it pick a random one from the text file. Once that is done, is there an easier way to make this stay the same as the initial value chosen rather then change on refresh? Rather then have it be added to the database.
  • Alright, got it to work randomally, now what would be the easiest way to make it actually write the changes into the post threw the database?

    This is the code I have atm:
    Class RussianRoulette extends StringFormatter
    {
    var $token;
    var $tokenValue;

    function RussianRoulette()
    {
    $filename = $GLOBALS['Configuration']['EXTENSIONS_PATH'].'RussianRoulette/bullets.txt';
    $config = file($filename); // variable file contains the path above
    $counter = 0; // set the counter value to 0

    reset($config); // rewinds array 's internal pointer to the first element and returns the value of the first array element.

    foreach($config as $line)
    {
    $line = rtrim($line); // strips whitespace from end of line
    $line = ltrim($line); // strips whitespace from start of line

    if($line == "" || $line == "\n" || strstr($line,"$"))
    next($config);
    else
    {
    $value = preg_split("/\s*==\s*/", $line, 2); // strips the line space around the ==
    $bullets = rand(0, (count($value)) - 1);


    $this->token[$counter] = '/'.preg_quote($value[0]).'/i';
    //$this->tokenValue[$counter] = $value[1];
    $this->tokenValue[$counter] = $value[$bullets];

    $counter++;
    }
    }
    }

    function Parse($String, $Object, $FormatPurpose)
    {
    if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY)
    return preg_replace($this->token, $this->tokenValue, $String);
    else
    return $String;
    }

    function CheckProtocol($Check, $Allow, $Extra, $Prefix, $Suffix)
    {
    $sReturn = stripslashes($Prefix);

    if(!in_array($Check, $Allow))
    $sReturn .= ($Extra.'http://');
    else $sReturn .= ($Extra.$Check.':');
    $sReturn .= stripslashes($Suffix);

    return $sReturn;
    }
    }

    // Instantiate the RussianRouletteFormatter class
    $Fortune = $Context->ObjectFactory->NewObject($Context, "Fortune");
    $Context->StringManipulator->AddGlobalManipulator("Fortune", $Fortune);
  • Anyone have any ideas on how to make it stop from changing on refresh?
  • Hi.
    We'd like to setup replacements with the same letters in the beginnig:

    :p and :pee

    first one sticks its tongue out, 2nd pees his pants ;)

    BUT - :pee doesn't work, cause it first renders the ":p" and ignores the "ee"

    Know what i mean?

    love,
    m.
  • Not sure it works, but did you try to place :pee before :p in the conf file?
  • I get the following:
    Undefined offset: 1 in /home/sites/*url*/public_html/f0rum/extensions/Transmogrifier/default.php on line 46

    On line 46:
    $this->tokenValue[$counter] = $value[1];

    Help, please. :)
«1
Sign In or Register to comment.