Customizing SMF > SMF Coding Discussion

Modifying BBC Code

<< < (4/4)

ChalkCat:
2.0.2

Labradoodle-360:
./Sources/Subs.php

--- Code: (Find) --- array(
'tag' => 'color',
'type' => 'unparsed_equals',
'test' => '(#[\da-fA-F]{3}|#[\da-fA-F]{6}|[A-Za-z]{1,20}|rgb\(\d{1,3}, ?\d{1,3}, ?\d{1,3}\))\]',
'before' => '<span style="color: $1;" class="bbc_color">',
'after' => '</span>',
),
--- End code ---

--- Code: (Replace) --- array(
'tag' => 'color',
'type' => 'unparsed_equals',
'test' => '(#[\da-fA-F]{3}|#[\da-fA-F]{6}|[A-Za-z]{1,20}|rgb\(\d{1,3}, ?\d{1,3}, ?\d{1,3}\))\]',
'before' => '<span style="color: $1;" class="bbc_color">',
'after' => '</span>',
),
array(
'tag' => 'colour',
'type' => 'unparsed_equals',
'test' => '(#[\da-fA-F]{3}|#[\da-fA-F]{6}|[A-Za-z]{1,20}|rgb\(\d{1,3}, ?\d{1,3}, ?\d{1,3}\))\]',
'before' => '<span style="color: $1;" class="bbc_color">',
'after' => '</span>',
),
--- End code ---
./Sources/Subs-Editor.php

--- Code: (Find) --- // What tags do we allow?
$allowed_tags = array('b', 'u', 'i', 's', 'hr', 'list', 'li', 'font', 'size', 'color', 'img', 'left', 'center', 'right', 'url', 'email', 'ftp', 'sub', 'sup');
--- End code ---

--- Code: (Replace) --- // What tags do we allow?
$allowed_tags = array('b', 'u', 'i', 's', 'hr', 'list', 'li', 'font', 'size', 'color', 'colour', 'img', 'left', 'center', 'right', 'url', 'email', 'ftp', 'sub', 'sup');
--- End code ---

--- Code: (Find) --- case 'color':
$curCloseTags .= '[/color]';
$replacement .= '[color=' . $style_value . ']';
break;
--- End code ---

--- Code: (Add After) --- case 'colour':
$curCloseTags .= '[/colour]';
$replacement .= '[colour=' . $style_value . ']';
break;

--- End code ---

--- Code: (Find) --- elseif ($s == 'color')
$tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]');
--- End code ---

--- Code: (Add After) --- elseif ($s == 'colour')
$tags[] = array('[colour=' . trim(strtolower($v)) . ']', '[/color]');
--- End code ---

--- Code: (Find) --- // These inline tags can compete with each other regarding style.
$competing_tags = array(
'color',
'size',
);
--- End code ---

--- Code: (Replace) --- // These inline tags can compete with each other regarding style.
$competing_tags = array(
'color',
'colour',
'size',
);
--- End code ---

ChalkCat:
Wow, that's fantastic, Labradoodle!!!  Thank you!!  :D

I will let you know how I get on :)

Labradoodle-360:
Not a problem, glad to help. Let me know how it goes for sure.

Navigation

[0] Message Index

[*] Previous page

Go to full version