Add centering (bbcode guide)

  1. 4 years ago

    [deleted]

    5 Jun 2015

    plugin.php (addons/plugins/BBCode):

    Find

    addToArrayString($controls, "link", "<a href='javascript:BBCode.link(\"$id\");void(0)' title='".T("Link")."' class='control-link'><i class='icon-link'></i></a>", 0);

    replace with:

    addToArrayString($controls, "link", "<a href='javascript:BBCode.link(\"$id\");void(0)' title='".T("Link")."' class='control-link'><i class='icon-link'></i></a>", 0);
    	addToArrayString($controls, "center", "<a href='javascript:BBCode.center(\"$id\");void(0)' title='".T("Center")."' class='control-c'><i class='icon-align-center'></i></a>", 0);

    Find

    	$sender->content = preg_replace("/\[h\](.*?)\[\/h\]/", $replacement, $sender->content);
    }

    replace with:

    $sender->content = preg_replace("/\[h\](.*?)\[\/h\]/", $replacement, $sender->content);
    	
    	// Centering: [b]centering text[/b]
    	$sender->content = preg_replace("/\[center\](.*?)\[\/center\]/si", "<center>$1</center>", $sender->content);
    }

    bbcode.js (addons/plugins/BBCode/resources):

    find:

    fixed: function(id) {ETConversation.wrapText($("#"+id+" textarea"), "[code]", "[/code]");},

    replace with:

    fixed: function(id) {ETConversation.wrapText($("#"+id+" textarea"), "[code]", "[/code]");},
    center: function(id) {ETConversation.wrapText($("#"+id+" textarea"), "[center]", "[/center]");},

    definitions.BBCode.php (addons/languages/English):

    find:

    $definitions["Bold"] = "Bold";

    replace with

    $definitions["Bold"] = "Bold";
    $definitions["Center"] = "Center";

    Result:
    -image-
    -image-

    Enjoy it! :)

  2. [deleted]

    5 Jun 2015

    the result will be like?

  3. [deleted]

    5 Jun 2015

    result please...

  4. You should also include screenshots of the finished product (So that everyone knows what this does.)

  5. [deleted]

    5 Jun 2015

    ok, edited

    I did not write explanations because my english isn't good, but feel free to edit the instructions ._.;

  6. [deleted]

    5 Jun 2015

    thanks bruh

  7. I could have sworn I did a guide for this and for colors...maybe they were just responses...

 

or Sign Up to reply!