Announcement

Collapse
No announcement yet.

HTML clean up

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTML clean up

    How to clean up these codes:
    <FONT color=#550000> example </font>
    <P style="MARGIN: 0px"> example </P>
    <font color=#000066 size=5>example</font>

  • #2
    Cleaner.php

    PHP Code:
    $replacer = array(
        
    "<FONT color=#550000>"    => "",
        
    "</font>"    => "",
        
    '<P style="MARGIN: 0px">'    => "",
        
    "</P>"    => "",
        
    "<font color=#000066 size=5>"    => "",
        
    "</font>" => ""
    ); 
    I wrote ImpEx.

    Blog | Me

    Comment


    • #3
      Hello Jerry, please is it possible to use the cleaner.php to match something like that ?

      Code:
      [COLOR=black][COLOR=#dd0000]"<FONT *>"    [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#dd0000]""[/COLOR][/COLOR][COLOR=#007700][COLOR=black],[/COLOR] [/COLOR]
      [COLOR=#007700][COLOR=#dd0000]"<font *>"    [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#dd0000]""[/COLOR][COLOR=#007700][COLOR=black],[/COLOR] [/COLOR][/COLOR]
      Since I can't know how many combinations of font colors and sizes the users could have used in the forum I just want remove them all in one pass.

      Comment


      • #4
        Nope, the cleaner.php array is a straight swap, you would have to use the regular expression on line 103 :

        PHP Code:
        #$text = preg_replace('##siU', '', $text); 
        change that for :

        PHP Code:
        $text preg_replace('#<font(.*)>#siU'''$text); 
        That will take out any font tags regardless of capitalisation.
        I wrote ImpEx.

        Blog | Me

        Comment


        • #5
          Ok Jerry this has worked correctly, now please could I have an example on how to modify the same line to match a more complex Discus formatting tab ?

          Example:

          This is the syntax for a link:
          HTML Code:
          [url="http://www.yahoo.com"]Link to Yahoo[/url]

          Comment


          • #6
            That is valid bbcode in vBulletin, it should be fine.
            I wrote ImpEx.

            Blog | Me

            Comment

            Related Topics

            Collapse

            Working...
            X