Skip to content

Instantly share code, notes, and snippets.

@Repflez
Last active February 3, 2021 11:48
Show Gist options
  • Save Repflez/5861532 to your computer and use it in GitHub Desktop.
Save Repflez/5861532 to your computer and use it in GitHub Desktop.
ABXD Plugin - Blabblerizer Reading trolls' posts has never been funnier! (Breaks BBCodes)
<?php
if ($poster['blabberized'])
$post['text'] = blabberize_text($post['text']);
<?php
if ($loguser['powerlevel'] > 3)
$general['options']['items']['blabberized'] = array(
"caption" => "Blabberize this user posts",
"type" => "checkbox",
);
<?php
$fieldLists["userfields"] .= ",blabberized";
<?php
function &blabberize_text(&$text)
{
$text = preg_replace("/&nbsp;/i", ' ', $text); // No cheating :p
$text = preg_replace("/\b(?<!&)[^.,'\";:?!&\s0-9]{3}\b/i", Settings::pluginGet("blab3"), $text);
$text = preg_replace("/\b(?<!&)\w{4}\b/i", Settings::pluginGet("blab4"), $text);
$text = preg_replace("/\b\w{5}\b/i", Settings::pluginGet("blab5"), $text);
$text = preg_replace("/\b\w{6}\b/i", Settings::pluginGet("blab6"), $text);
$text = preg_replace("/\b\w{7}/i", Settings::pluginGet("blab7"), $text);
$text = preg_replace("/\b\w{8,}/i", Settings::pluginGet("blab8"), $text);
return $text;
}
<?php
$tables["users"]["fields"]["blabberized"] = $bool;
name=Blabberizer
description=Replaces trolls' posts to a (funny) mess.
author=Repflez
<?php
$settings = array(
"blab3" => array(
"type" => "text",
"name" => "Replacement for 3-letter words",
"default" => "bla",
),
"blab4" => array(
"type" => "text",
"name" => "Replacement for 4-letter words",
"default" => "blah",
),
"blab5" => array(
"type" => "text",
"name" => "Replacement for 5-letter words",
"default" => "blub",
),
"blab6" => array(
"type" => "text",
"name" => "Replacement for 6-letter words",
"default" => "blubba",
),
"blab7" => array(
"type" => "text",
"name" => "Replacement for 7-letter words",
"default" => "blabber",
),
"blab8" => array(
"type" => "text",
"name" => "Replacement for 8-letter words",
"default" => "blabba",
),
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment