How to solve the ismozilla function of discuz

Source: Internet
Author: User
The ismozilla function of discuz is so late. I don't know if anyone else is there. The younger brother has encountered a problem in the middle of the night, so I am so grateful to you for passing. Discuz has a function that converts html code into ubb code. see the code functionhtml2bbcode ($ text discuz's ismozilla function
It's so late, I don't know if anyone else is there. The younger brother has encountered a problem in the middle of the night, so I can't explain it. thank you for your thanks.

Discuz has a function that converts html code into ubb code.

Function html2bbcode ($ text ){
$ Text = strip_tags ($ text ,'



    • Script ');

      If (ismozilla ()){
      $ Text = preg_replace ("/(? |
      | \ R) (\ r \ n | \ r)/",'', $ text );
      }
      Only a part of the code is listed.

      The above ismozilla function is used to determine the Firefox browser. the code is as follows:

      Function ismozilla (){
      $ Useragent = strtolower ($ _ SERVER ['http _ USER_AGENT ']);
      If (strpos ($ useragent, 'Gecko ')! = FALSE ){
      Preg_match ("/gecko \/(\ d +)/", $ useragent, $ regs );
      Return $ regs [1];
      }
      Return FALSE;
      }

      We can see the red part of the code. What I don't understand is, why should Firefox destroy all the line breaks? Why?

      I wrote a posting program triggered by a scheduled task. it is estimated that it was triggered by other things. after the function conversion, no line breaks were found in the post.

      This is defined before using the html2bbcode function:
      $ _ SERVER ['http _ USER_AGENT '] = 'mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7 360EE ';
      However, the Post is still not formatted with a line break, and I don't know how to solve it. it's strange to say that discuz defines this function, but there is no place to use it on the whole site, which is very strange.

      ------ Solution --------------------
      More than one person writes code. Now that we have done this, we have changed the number of people we have come. In the end, the code becomes a scum, and the flow is in the center of the code. It is useless to search. it can only be explained. I forgot to remove it during Reconstruction.
      ------ Solution --------------------
      This is a function that converts HTML tags to BBCode. This function is not required in discuz.

      If you suspect it is this function, comment out the red part.
      ------ Solution --------------------
      The problem is: Although you have modified the function, you still find that the problem persists.
      ------ Solution --------------------
      It may be a judgment for css !!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.