Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Transmogrifier

2»

Comments

  • 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&gt;

    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. :)
  • I want to use strtolower on the words transmogrifier checks so that it is case insensitive, but I can't figure out where to put the function. Can someone tell me how to do this?
  • My config file is as follows :) == <img alt=":)" src="http://domain.com/forum/images/emoticons/smile.gif" /> M$ == Microsoft I tried linking like this: :) == <img alt=":)" src="./forum/images/emoticons/smile.gif" /> M$ == Microsoft but then I get an error. Either way neither images replace the :) but the M$ works.
  • does anyone understand the code well enough to know what the string to be checked (before it is checked) is called? i really would like to use strtolower on it so it's case insensitive, but can't figure out what variable.
  • Another problem :( = sad. >:( = angry, but disregards ">" and displays :( sad. Also.. :/ and :\ crashes the extension and removes all forum posts. buggy. Is there any way to bypass the transmogrifier? like <code></code> would be nice if it bypassed it.
  • <3 <3<3<3 <3! these do not transmogrify either
  • I need something like this (pattern with space characters):
    ' - ' == '&nbsp;&mdash; '

    solution: single quotes.

    I replaced this part
    else { $value = preg_split("/\s*==\s*/", $line, 2); $this->token[$counter] = '/'.preg_quote($value[0]).'/'; $this->tokenValue[$counter] = $value[1]; $counter++; }

    by this one:
    else { $value = preg_split("/\s*==\s*/", $line, 2); $value[0]=preg_replace("/^'(.*)'$/","\\1",$value[0]); $value[1]=preg_replace("/^'(.*)'$/","\\1",$value[1]); $this->token[$counter] = '/'.preg_quote($value[0]).'/'; $this->tokenValue[$counter] = $value[1]; $counter++; }


    to make it work.
  • Still haven't figured a way to make this case insensitive...I have, however, managed every possible way to crash the add-on :x I know I need to use strtolower, and I know I want to use it on the text to be checked (the original text from the post), so I only have to put one instance of a word in the config.txt. So I can put: "banana" instead of needing "Banana" or "BaNanA" or "BANaNa" and every combination thereof. I just don't know how to implement in the code. Any ideas?
Sign In or Register to comment.