Jump to content

DarkAngelBGE

WFG Retired
  • Posts

    7.686
  • Joined

  • Last visited

Posts posted by DarkAngelBGE

  1. Yes of course, but if I used that ONLY it will be a complete mess since it will add thousands of <span color="xxxx"></span> to the code. Now when you edit your code you don't want to see those. :D

    Also it is to make sure that certain control chars are prevented from causing damage.

    I took the highlight_string() part out of the above implementation since it is not need in the matter of this topic. However, here in the forum engine it is there. I couldn't get it to work yet though, something's wrong with the highlighting.

    Perhaps I will manage to get it to work soon.

  2. Well if you really want to store php in your database, make sure to properly convert it before inserting it and then unconverting it.

    Here is something I digged up for you. When you have a form and want to submit some php code, make sure to put [ php ] tags around it (without the spaces):


    function unconvert($txt) {
    preg_match( "#<!--PHP-Head-->(.+?)<!--PHP-EHead-->(.+?)<!--PHP-Foot-->(.+?)<!--PHP-EFoot-->#", $txt, $m);
      $php = str_replace("$", "<!--SDS-->$<!--EDS-->", $m[2]);
      $txt = preg_replace( "#<!--PHP-Head-->(.+?)<!--PHP-EHead-->(.+?)<!--PHP-Foot-->(.+?)<!--PHP-EFoot-->#e", "\$this->unparse_php_tag(\$php)", $txt);
    }

    function unparse_php_tag($txt="")
    {


     $txt = str_replace("<!--SDS-->$<!--EDS-->", "$", $txt);
     $txt = str_replace("<code>" , ""  , $txt);
     $txt = str_replace("</code>", ""  , $txt);
     $txt = str_replace("</font>", ""  , $txt);
     $txt = str_replace("</span>", ""  , $txt);
     $txt = preg_replace("#\<font(.+?)>#", "", $txt);
     $txt = preg_replace("#\<span(.+?)>#", "", $txt);
     $txt = preg_replace("#^<span(.+?)><br />(.+?)#", "\\2", $txt);
     $txt = preg_replace("#(.+?)(?:<br />){1,}$#", "\\1", $txt);
     $txt = str_replace("<br />" , "\n", $txt);
     return "[php]".$txt."[/php]";
    }

    function parse_php_tag($txt="")
    {


     $default = "\[php\]$txt\[/php\]";
     if ($txt == '')
     {
      return;
     }

     if (preg_match("/\[(quote|code|html|sql|php)\].+?\[(quote|code|html|sql|php)\].+?\[(quote|code|html|sql|php)\].+?\[(quote|code|html|sql|php)\].+?\[(quote|code|html|sql|php)\].+?\[(quote|code|html|sql|php)\].+?\[(quote|code|html|sql|php)\]/i", $txt))
     {
      return $default;
     }

     $txt = @html_entity_decode($txt, ENT_QUOTES);
     $txt = str_replace("$", "$", $txt);

     while (preg_match("#\n$#", $txt))
     {
      $txt = preg_replace("#\n$#", "", $txt);
     }

     $txt = preg_replace("#<#"   , "<"  , $txt);
     $txt = preg_replace("#>#"   , ">"  , $txt);
     $txt = preg_replace("#"#" , """  , $txt);
     $txt = preg_replace("#:#"      , ":"  , $txt);
     $txt = preg_replace("#\[#"     , "["  , $txt);
     $txt = preg_replace("#\]#"     , "]"  , $txt);
     $txt = preg_replace("#\)#"     , ")"  , $txt);
     $txt = preg_replace("#\(#"     , "("  , $txt);
     $txt = preg_replace("#\r#"     , "<br />" , $txt);
     $txt = preg_replace("#\n#"     , "<br />" , $txt);
     $txt = preg_replace("#\s{1};#" , ";"  , $txt);
     $txt = preg_replace("#\s{2}#"  , "  ", $txt);

     $txt = preg_replace("#^\<font color=\"\#000000\">\<br />#", "", $txt);
     $txt = preg_replace("#\<br />\</font>$#", "", $txt);
     $txt = preg_replace("#^<span(.+?)><br />(.+?)#", "\\2", $txt);
     $txt = preg_replace("#(.+?)(?:<br />){1,}$#", "\\1", $txt);

     $html = $this->wrap_style('php');
     return "<!--PHP-Head-->{$html['START']}<!--PHP-EHead-->$txt<!--PHP-Foot-->{$html['END']}<!--PHP-EFoot-->";
    }

     function wrap_style( $type='quote', $extra="" )
    {
     $used = array(
            'php'   => array( 'title' => 'PHP'  , 'css_top' => 'phptop'   , 'css_main' => 'phpmain'   ),
         );
     
     
     return array( 'START' => "<div class='{$used[ $type ]['css_top']}'>{$used[ $type ]['title']}{$extra}</div><div class='{$used[ $type ]['css_main']}'>",
          'END'   => "</div>"
        );
    }

    It's the php tag that I have written for our forum engine. Tell me if it works.

  3. Here are some spiritually speaking for you, Ugo:

    1) What season are you currently in regarding your spiritual life?

    2) How certain are you that your current belief about god is correct? What would change that?

    3) What kinds of things do you pray about most frequently?

    Cheers mate. :rock:

  4. @Klaas: Nah I mean the logo on the left, not the small truck one. The company logo there you know. I am not sure, it looks a bit alone. Maybe you move it a bit more down and put it into a box that blends a bit white onto the gradient like you did already on the left there. Does that make sense?

  5. Considering the probable target market...that is production companies that will buy the foot..I would say layout 4 with the big meat photo would be best, since the meat shown there looks like it's of a good quality.

    Also generally, layout 4 appeals best to me. However, I would work on the logo placement..it doesn't look quite right alone there on the wide gradient.

    Good work on these layouts Klaas. :rock:

×
×
  • Create New...