Exemplo n.º 1
0
 function phase_post($post, $id, $wiki_page = true)
 {
     global $wgOut, $wgOut, $wgParser;
     if ($post == '') {
         return $post;
     }
     // for sigs...
     $post = convert_pre($post);
     $post = remove_forum_tag_from_post($post);
     $post = awcf_hide_code2($post);
     if ($this->convert_wTitle == '1') {
         $post = wiki_links($post, $this->wiki_titles);
     }
     if ($this->displaysmiles == '1' and $this->viewing_mem_info['displaysmiles'] == '1') {
         $post = awcf_emotions($post, $this->emotions);
     }
     $post = br_convert($post);
     if ($wiki_page) {
         if (GetWikiPageOK($post)) {
             $post = GetWikiPage($post, $id);
         }
     }
     $post = awcf_unhide_code($post);
     $post = awc_wikipase($post, $wgOut);
     # awc_pdie($post);
     $post = Convert($post);
     // $post = Convert($post);
     # $f = array('&lt;/a&gt;', '&lt;a href', '"&gt;', "<a href=",);
     # $r = array('</a>', '<a href', '">', "<a target='blank' href=", '',);
     #  $post = str_replace($f, $r, $post ) ;
     #$post = str_replace("<a href=", "<a target='blank' href=", $post ) ;
     # $post = str_replace('rel="nofollow"', "", $post ) ;
     if (isset($sw[1])) {
         foreach ($sw as $test) {
             $post = HighLightSearchWord($post, $test);
         }
     } else {
         #$post = HighLightSearchWord($post,$extras['word']);
     }
     // needs to be in the loop to check against each post for other extensions triggered
     if (isset($wgParser->mOutput->mHeadItems)) {
         foreach ($wgParser->mOutput->mHeadItems as $k_ID => $mHeadItems) {
             $wgOut->addHeadItem($k_ID, $mHeadItems);
         }
     }
     return $post;
 }
Exemplo n.º 2
0
function Convert($txt)
{
    static $t = 0;
    $t++;
    if ($t == 1) {
        #die($txt);
    }
    $txt = awcf_hide_code2($txt);
    $txt = preg_replace("#\\[b\\](.+?)\\[/b\\]#is", "<b>\\1</b>", $txt);
    $txt = preg_replace("#\\[i\\](.+?)\\[/i\\]#is", "<i>\\1</i>", $txt);
    $txt = preg_replace("#\\[u\\](.+?)\\[/u\\]#is", "<u>\\1</u>", $txt);
    $txt = preg_replace("#\\[s\\](.+?)\\[/s\\]#is", "<s>\\1</s>", $txt);
    $txt = preg_replace("#\\[search\\](.+?)\\[/search\\]#is", "<a href='" . awc_url . "search/s/?&kw=\\1'>\\1</a>", $txt);
    $txt = preg_replace("#\\[google\\](.+?)\\[/google\\]#is", "<a href='http://www.google.com/search?q=\\1'>\\1</a>", $txt);
    $txt = preg_replace("#\\[yahoo\\](.+?)\\[/yahoo\\]#is", "<a href='http://search.yahoo.com/search?p=\\1'>\\1</a>", $txt);
    $txt = preg_replace("#\\[size\\s*=\\s*(\\S+?)\\s*\\](.*?)\\[\\/size\\]#is", "<font size='\\1'>\\2</font>", $txt);
    $txt = preg_replace("#\\[size\\s*=\\s*(\\S+?)\\s*\\](.*?)\\<\\/font>(.*?)\\[\\/size\\]#is", "</font><font size='\\1'>\\2</font>", $txt);
    $txt = preg_replace("#\\[color\\s*=\\s*(\\S+?)\\s*\\](.*?)\\[\\/color\\]#is", "<font color='\\1'>\\2</font>", $txt);
    $txt = preg_replace("#\\[color\\s*=\\s*(\\S+?)\\s*\\](.*?)\\<\\/font>(.*?)\\[\\/color\\]#i", "</font><font color='\\1'>\\2</font>", $txt);
    $txt = preg_replace("#\\[center\\](.+?)\\[/center\\]#is", "<center>\\1</center>", $txt);
    # needs work...
    $txt = preg_replace("#\\[right\\](.+?)\\[/right\\]#is", "<div align='right'>\\1</div>", $txt);
    $txt = preg_replace("#\\[left\\](.+?)\\[/left\\]#is", "<div align='left'>\\1</div>", $txt);
    # needs work...
    $txt = preg_replace("#\\[[hr]\\]#is", "<hr>", $txt);
    #$txt = preg_replace( "#\[list\](.+?)\[\*\](.+?)\[/list\]#is"   , "<ul>\\1<li>\\2</li></ul>"  , $txt );
    $match = "#\\[list\\](.+?)\\[/list\\]#is";
    if (preg_match_all($match, $txt, $found)) {
        $txt = str_replace($found[0][0], "<ul>" . $found[1][0] . "</ul>", $txt);
        $match2 = "#\\[\\*\\](.+?)#U";
        if (preg_match_all($match2, $txt, $found2)) {
            foreach ($found2[1] as $k => $v) {
                $txt = str_replace($found2[0][$k], "<li>" . $v . "</li>", $txt);
            }
        }
    }
    // cant do this, wiki phases urls before hand...
    #$txt = preg_replace( "#\[url\s*=\s*(\S+?)\s*\](.*?)\[\/url\]#is"   , "[\\1 \\2]"  , $txt );
    #$txt = preg_replace( "#\[URL\s*=\s*(\S+?)\s*\](.*?)\[\/URL\]#is"   , "[\\1 \\2]"  , $txt );
    $txt = preg_replace("#\\[quote\\]#is", "<div class='quote_title'>Quote:<div class='quote'>\\1", $txt);
    $txt = preg_replace("#\\[quote=([^\\]]+?)\\]#is", "<div class='quote_title'>Quote:\\1<div class='quote'>\\2", $txt);
    $txt = preg_replace("#\\[/quote\\]#is", '</div id="quote"></div id="quote">', $txt);
    /*
             2.5 change, no longer needed...
             
                $txt = str_replace("</li><br />", "</li>", $txt);
                $txt = str_replace("<ul><br />", "<ul>", $txt);
                $txt = str_replace("<br /><ul>", "<ul>", $txt);
                $txt = str_replace("</ul><br />", "</ul>", $txt);
                $txt = str_replace("</div><br />", "</div>", $txt);
    $txt = str_replace("<br /><tr>", '<tr>', $txt);
                $txt = str_replace("<br /><td>", '<td>', $txt);
                $txt = str_replace("<br /></p><br />", '<br />', $txt);
                $txt = str_replace("<br /><p>", '<br />', $txt);
    */
    #  die($txt);
    #$txt = preg_replace( "#\|emotion_tag\|(.+?)\|emotion_tag\|_end\|#is", "<img src=\"\\1\" />", $txt );
    $txt = preg_replace("#\\|emotion_tag\\|(.+?)\\|emotion_tag\\|_end\\|#is", "<img src=\"\\1\" />", $txt);
    #  trying to cut done on URL lenths...
    $match = "#<a(.+?)<\\/a>#is";
    if (preg_match_all($match, $txt, $found)) {
        foreach ($found[0] as $url_title) {
            $match = "#\">(.+?)<\\/a>#is";
            if (preg_match_all($match, $url_title, $found2)) {
                $img_match = "#<img(.+?)>#is";
                if (!preg_match_all($img_match, $found2[0][0], $found3)) {
                    $replace = str_replace('">', '', $found2[0][0]);
                    $replace = str_replace('</a>', '', $replace);
                    if (strlen($replace) > 90) {
                        $txt = str_replace($found2[0][0], '">' . awcsforum_funcs::awc_shorten($replace, 90) . '...</a>', $txt);
                    }
                }
            }
        }
    }
    $f = array('&lt;/a&gt;', '&lt;a href', '"&gt;', "<a href=");
    $r = array('</a>', '<a href', '">', "<a target='blank' href=", '');
    $txt = str_replace($f, $r, $txt);
    $txt = awcf_unhide_code($txt);
    return $txt;
}