HTML clean up

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RFViet
    Senior Member
    • Jan 2006
    • 240
    • 3.5.x

    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>
  • Jerry
    Senior Member
    • Dec 2002
    • 9137
    • 1.1.x

    #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

    • hal65
      New Member
      • Dec 2006
      • 14

      #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

      • Jerry
        Senior Member
        • Dec 2002
        • 9137
        • 1.1.x

        #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

        • hal65
          New Member
          • Dec 2006
          • 14

          #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

          • Jerry
            Senior Member
            • Dec 2002
            • 9137
            • 1.1.x

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

            Blog | Me

            Comment

            Related Topics

            Collapse

            Working...
            😀
            😂
            🥰
            😘
            🤢
            😎
            😞
            😡
            👍
            👎