تبدیل حروف از انگلیسی به فارسی

سلام به دوستان عزیز , من دارم روی یک پلاگین برای mybb کار می کنم که به tagcloud مشهور است , اما برای حروف فارسی مشکل دارد , من نمی دانم با این که از Str_replace برای جابجا کردن حروف استفاده کردم اما چرا جواب نمی گیریم .

کد ::
PHP:
<?php

// ADD HOOK FOR XMLHTTP
$plugins->add_hook("xmlhttp", "tc_split");

// ADD HOOK FOR NEW THREAD [SHOWING TAGBOX]
$plugins->add_hook('newthread_start', 'tc');

// ADD HOOK FOR EDITPOST [SHOWING TAGBOX]
$plugins->add_hook('editpost_start', 'tc_show_edit');

// ADD HOOK FOR EDITPOST [UPDATE THREAD]
$plugins->add_hook('datahandler_post_update_thread', 'tc_edit');

// ADD HOOK FOR NEW THREAD [INSERT NEW THREAD]
$plugins->add_hook('datahandler_post_insert_thread', 'tc_thread');

// ADD HOOK FOR FORUMDISPLAY [THREADLIST]
$plugins->add_hook('forumdisplay_thread', 'tc_threadlist');

// ADD HOOK FOR FORUMDISPLAY [FORUMINDEX]
$plugins->add_hook('forumdisplay_start', 'tc_forum');

// ADD HOOK FOR SHOWTHREAD[FIRSTPOST]
$plugins->add_hook('showthread_start', 'tc_show');


function tc_info()
{
    return array(
        'name'            => 'TagCloud v1.2',
        'description'    => 'Makes It Possible So People Can Add Tags To Their New Thread For A TagCloud.',
        'website'        => 'http://www.thingiej.be/',
        'author'        => 'LeX-',
        'authorsite'    => 'http://www.thingiej.be/',
        'version'        => '1.2',
        'compatibility' => '14*'
    );
}
function tc_is_installed()
{
    global $db;
    
    if($db->field_exists("tags", "threads"))
    {
        return true;
    }
    
    return false;    
}
function tc_install()
{
    global $db, $mybb;

    // SETTINGS
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_status'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_max'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_min'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_what'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_words'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_badwords'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_auto'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_fids'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='tc_options'");
    rebuild_settings();
    // SETTINGS 
    $tc_group = array(
        "name"            => "tc_options",
        "title" =>"TagCloud Settings",
        "description"    => "Settings for the TagCloud Plugin.",
        "disporder"        => "3",
        "isdefault"        => "no",
    );

    $db->insert_query("settinggroups", $tc_group);
    $gid = $db->insert_id();

    $new_setting = array(
        'name'            => 'tc_status',
        'title'            => 'TagCloud__ Status',
        'description'    => 'Make It Possible So People Can Add Tags To Their New Thread For A TagCloud.',
        'optionscode'    => 'onoff',
        'value'            => '1',
        'disporder'        => '1',
        'gid'            => intval($gid),
    );

    $db->insert_query('settings', $new_setting);

    $new_setting2 = array(
        'name'            => 'tc_max',
        'title'            => 'TagCloud__ Max. Tags',
        'description'    => 'Maximum Tags In The TagCloud.',
        'optionscode'    => 'text',
        'value'            => '20',
        'disporder'        => '3',
        'gid'            => intval($gid),
    );

    $db->insert_query('settings', $new_setting2);

    $new_setting3 = array(
        'name'            => 'tc_min',
        'title'            => 'TagCloud__ Min Tag Length',
        'description'    => 'Min.Chars For A Tag To Be Shown So That "The, A, ..." Aint Shown',
        'optionscode'    => 'text',
        'value'            => '3',
        'disporder'        => '4',
        'gid'            => intval($gid),
    );

    $db->insert_query('settings', $new_setting3);

    $new_setting4 = array(
        'name'            => 'tc_what',
        'title'            => 'TagCloud__ How To',
        'description'    => 'How To Gain Tags ? Set To Yes If You Want To Use The Threadtitles Else There Will Be A Box For Entering Tags.',
        'optionscode'    => 'onoff',
        'value'            => '0',
        'disporder'        => '2',
        'gid'            => intval($gid),
    );

    $db->insert_query('settings', $new_setting4);

    $new_setting5 = array(
        'name'            => 'tc_words',
        'title'            => 'TagCloud__ Excluded Words',
        'description'    => 'List Words That Must Be Filtered Out Of The TagCloud (Seperate By Comma)',
        'optionscode'    => 'text',
        'value'            => 'a,the,for,with,of',
        'disporder'        => '5',
        'gid'            => intval($gid),
    );

    $db->insert_query('settings', $new_setting5);

    $new_setting6 = array(
        'name'            => 'tc_badwords',
        'title'            => 'TagCloud__ Filter BadWords',
        'description'    => 'Filter BadWords Out Of TagList?',
        'optionscode'    => 'onoff',
        'value'            => '0',
        'disporder'        => '6',
        'gid'            => intval($gid),
    );

    $db->insert_query('settings', $new_setting6);

    $new_setting7 = array(
        'name'            => 'tc_auto',
        'title'            => 'TagCloud__ AutoCreate Tags',
        'description'    => 'Auto Create Tags When Typing Subject. Works Only If You\\\'ve Selected NO In the How To Gain Setting.',
        'optionscode'    => 'onoff',
        'value'            => '0',
        'disporder'        => '7',
        'gid'            => intval($gid),
    );

    $db->insert_query('settings', $new_setting7);

    $new_setting8 = array(
        'name'            => 'tc_fids',
        'title'            => 'TagCloud__ Fids',
        'description'    => 'In What Forums Can You Use Tags? Seperate By Comma.<br />Leave Blank for All Forums.',
        'optionscode'    => 'text',
        'value'            => '',
        'disporder'        => '8',
        'gid'            => intval($gid),
    );

    $db->insert_query('settings', $new_setting8);

    rebuild_settings();
    // ALTERING
    if($db->field_exists("tags", "threads"))
    {
        $db->query("ALTER TABLE `".TABLE_PREFIX."threads` DROP `tags`;");
    }
    // ALTERING
    $db->query("ALTER TABLE `".TABLE_PREFIX."threads` ADD `tags` TEXT NOT NULL;");
}

function tc_activate()
{
    global $mybb, $db;
    // TEMPLATES
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'newthread_tags'");
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'tagcloud_list'");
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'tagcloud_row'");
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'forumdisplay_cloud'");

    // TEMPLATES
    $tc_template = array(
        "title"        => 'newthread_tags',
        "template"    => $db->escape_string('<tr>
<td class="trow2" width="20%"><script type="text/javascript" src="jscripts/tagcloud.js"></script><strong>TagCloud Tags:</strong></td>
<td class="trow2"><input type="text" class="textbox" id="tags" name="tags" size="40"  value="{$tags}" tabindex="1" /><span style="font-size:8px" >[ Seperate By Comma ]</span> {$auto} <input type="hidden" name="fid" value="{$fid}" /></td>
</tr>'),
        "sid"        => "-1",
        "version"    => "1.0",
        "dateline"    => "1148741714",
    );
    $db->insert_query("templates", $tc_template);

    $tc3_template = array(
        "title"        => 'tagcloud_list',
        "template"    => $db->escape_string('<html>
<head>
<title>{$mybb->settings[\'bbname\']} - TagCloud Search</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder" width="100%">
<tr>
<td class="thead" colspan="3"><strong>SearchResults For {$tag}</strong></td>
</tr>
<tr>
<td width="75%" class="tcat"><span class="smalltext"><strong>Thread</strong></span></td>
<td width="25%" class="tcat" align="center"><span class="smalltext"><strong>Full TagList </strong></span></td>
</tr>
{$tags}
</table>
{$footer}
</body>
</html>'),
        "sid"        => "-1",
        "version"    => "1.0",
        "dateline"    => "1148741714",
    );
    $db->insert_query("templates", $tc3_template);

    $tc4_template = array(
        "title"        => 'tagcloud_row',
        "template"    => $db->escape_string('<tr>
<td class="trow1">{$link}</td>
<td class="trow2" align="center">{$taglist}</td>
</tr>'),
        "sid"        => "-1",
        "version"    => "1.0",
        "dateline"    => "1148741714",
    );
    $db->insert_query("templates", $tc4_template);

    $tc5_template = array(
        "title"        => 'forumdisplay_cloud',
        "template"    => $db->escape_string('<table width="100%" class="tborder">
<tr><td class="thead">Tag Cloud</td></tr>
<tr><td class="trow2" width="100%" valign="top">{$tag}</td></tr>
</table>
<br />'),
        "sid"        => "-1",
        "version"    => "1.0",
        "dateline"    => "1148741714",
    );
    $db->insert_query("templates", $tc5_template);

    require MYBB_ROOT.'/inc/adminfunctions_templates.php';
    // ADD TAGBOX [ NEWTHREAD ]
    find_replace_templatesets("newthread", '#{\$posticons}#', "{\$tags}{\$posticons}");
    // ADD TAGBOX [ EDITPOST ]
    find_replace_templatesets("editpost", '#{\$posticons}#', "{\$tags}{\$posticons}");
    // ADD TAGS [ FORUMDISPLAY - THREADLIST ]
    find_replace_templatesets("forumdisplay_thread", '#'.preg_quote('{$thread[\'profilelink\']}').'#', "{\$thread['profilelink']}{\$tags}");
    // ADD TAGS [ SHOWTHREAD - FIRSTPOST ]
    find_replace_templatesets("showthread", '#{\$multipage}#', "{\$multipage}{\$tags}");
    // ADD CLOUD [ FORUMDISPLAY]
    find_replace_templatesets("forumdisplay", '#{\$subforums}#', "{\$cloud}{\$subforums}");
    // ADD AJAX [ NEWTHREAD ]
    find_replace_templatesets("newthread", '#name="subject"#', "name=\"subject\" id=\"subject\" onblur=\"v_string();\"");
}
function tc_uninstall()
{
    global $db, $mybb;
    
    // SETTINGS
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_status'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_max'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_min'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_what'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_words'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_badwords'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_auto'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tc_fids'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='tc_options'");
    rebuild_settings();
    // ALTERING
    $db->query("ALTER TABLE `".TABLE_PREFIX."threads` DROP `tags`;");
}

function tc_deactivate()
{
    global $db, $mybb;    
    // TEMPLATES
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'newthread_tags'");
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'tagcloud_list'");
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'tagcloud_row'");
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'forumdisplay_cloud'");
    // TEMPLATECHANGES
    require MYBB_ROOT.'/inc/adminfunctions_templates.php';
    // REMOVE TAGBOX [ NEWTHREAD ]
    find_replace_templatesets("newthread", '#'.preg_quote('{$tags}').'#', '',0);
    // REMOVE TAGBOX [ EDITPOST ]
    find_replace_templatesets("editpost", '#'.preg_quote('{$tags}').'#', '',0);
    // REMOVE TAGS [ FORUMDISPLAY - THREADLIST ]
    find_replace_templatesets("forumdisplay_thread", '#'.preg_quote('{$tags}').'#', '',0);
    // REMOVE TAGS [ SHOWTHREAD - FIRSTPOST ]
    find_replace_templatesets("showthread", '#'.preg_quote('{$tags}').'#', '',0);
    // REMOVE CLOUD [ FORUMDISPLAY]
    find_replace_templatesets("forumdisplay", '#'.preg_quote('{$cloud}').'#', '',0);
    // REMOVE AJAX [ NEWTHREAD ]
    find_replace_templatesets("newthread", '#'.preg_quote('id="subject" onblur="v_string();"').'#', '',0);
}

function tc()
{
    global $db, $mybb, $templates, $tags, $status, $thread, $fid;

    if($mybb->settings['tc_status'] != 0)
    {
        if($mybb->settings['tc_what'] == 1)
        {
            $tags = "<tr>
<td class=\"trow2\" width=\"20%\"><strong>TagCloud Tags:</strong></td>
<td class=\"trow2\"><span style=\"font-size:9px;font-style:italic;\">Tags Will Be Generated Based On Your Subject Once You've Posted Your Thread.</span></td>
</tr>";
        }
        else if($mybb->settings['tc_what'] == 0)
        {
            $canenter = check_tags($fid);
            if($canenter)
            {
                if($mybb->settings['tc_auto'] == 0)
                {
                    $status = "<span style=\"color:red\">Off</span>";                
                }
                else
                {
                    $status = "<span style=\"color:green\">On</span>";
                }
                $auto = "<span style=\"font-size:8px\">[ Auto Generate Tags Is {$status} ]</span>";
                eval("\$tags = \"".$templates->get("newthread_tags")."\";");    
            }
        }    
    }
}
function tc_show_edit()
{
    global $db, $mybb, $templates, $tags, $status, $thread;

    if($mybb->settings['tc_status'] != 0)
    {
        $canenter = check_tags($thread['fid']);
        if(!$canenter)
        {
            return;
        }
        if(intval($mybb->input['pid']) == $thread['firstpost'])
        {
            if($mybb->settings['tc_what'] == 1)
            {
                if($thread['tags'])
                {
                    $current = "<br />Current Tags: <em>{$thread['tags']}</em>";
                }
                $tags = "<tr>
<td class=\"trow2\" width=\"20%\"><strong>TagCloud Tags:</strong></td>
<td class=\"trow2\"><span style=\"font-size:9px;font-style:italic;\">Tags Will Be Generated Based On Your Subject Once You've Posted Your Thread.</span>{$current}</td>
</tr>";
            }
            else
            {
                $tags = $thread['tags'];
                eval("\$tags = \"".$templates->get("newthread_tags")."\";");
            }
        }
        
    }
}
function tc_thread($upd)
{
    global $db, $mybb;

    if($mybb->settings['tc_status'] != 0)
    {
        if($mybb->settings['tc_what'] == 0)
        {
            $tag = get_tags(trim($db->escape_string($mybb->input['tags'])), true);
        }
        else
        {
            $tag = get_tags(trim($db->escape_string($mybb->input['subject'])), true);
        }
        if($tag != "")
        {
            $upd->thread_insert_data['tags'] = $tag;
            return $upd;
        }    
    }
}

function tc_edit($edit)
{
    global $db, $mybb;

    if($mybb->settings['tc_status'] != 0)
    {
        if($mybb->settings['tc_what'] == 0)
        {
            $tag = get_tags(trim($db->escape_string($mybb->input['tags'])));
        }
        else
        {
            $tag = get_tags(trim($db->escape_string($mybb->input['subject'])));
        }

        $edit->thread_update_data['tags'] = $tag;
        return $edit;
    }
}
function tc_threadlist()
{
    global $db, $mybb, $templates, $tags, $thread;

    if($mybb->settings['tc_status'] != 0)
    {
        $tags = "";
        $canenter = check_tags($thread['fid']);
        if(!$canenter)
        {
            return;
        }
        if($thread['tags'] != "")
        {
            $ttag = explode(",",$thread['tags']);
            $sep = "";
            foreach($ttag as $str)
            {
                $str = trim($str);
                $tag .= $sep.get_tag_link($str);
                $sep = " | ";
            }
        }
        if($tag)
        {
            $tags = "<br /><span class=\"smalltext\"><strong>[ </strong><em>Tags</em><strong>:</strong> {$tag}<strong> ]</strong></span>";
        }
    }
}
function tc_forum()
{
    global $db, $mybb, $templates, $tag, $cache, $cloud, $theme, $tags;

    if($mybb->settings['tc_status'] != 0)
    {
        $fid = intval($mybb->input['fid']);
        $canenter = check_tags($fid);
        if(!$canenter)
        {
            return;
        }
        $check = array();
        $forums = $cache->read("forums");
        foreach($forums as $forum)
        {
            if($forum['type'] == "f")
            {    
                $plist = explode(",",$forum['parentlist']);
                if(in_array($fid, $plist))
                {
                    foreach($plist as $unique)
                    {
                        if(!in_array($unique, $check))
                        {
                            $check[] = $unique;
                        }
                    }
                }                
            }
        }
        $fids = implode(",", $check);
        if($fids != "")
        {    
            $query = $db->query("
                SELECT *
                FROM ".TABLE_PREFIX."threads
                WHERE fid IN ($fids) AND tags != ''
                ORDER BY dateline DESC $limit
            ");
            if($db->num_rows($query) != 0)
            {
                $tags = array();
                while($threads = $db->fetch_array($query))
                {
                    $tags[] = $threads['tags'];
                }
                $tags = get_tags(implode(',', $tags));
                $tags = explode(",", $tags);
                $maxcount = 0;
                $max = intval($mybb->settings['tc_max']);
                if($max)
                {
                    $ch = 1;
                }
                foreach($tags as $str)
                {
                    if($maxcount == $max && $ch == 1)
                    {
                        break;
                    }
                    $str = trim($str);
                    $size = mt_rand(8,20);
                    $size = $size."px";
                    $style_choose = array(oblique,italic,normal);
                    $style_rand = mt_rand(0,3);
                    $style = $style_choose[$style_rand];
                    $weight_choose = array(100,400,700);
                    $weight_rand = mt_rand(0,3);
                    $weight = $weight_choose[$weight_rand];
                            $tag .= "<span style=\"font-size:$size;font-style:$style;font-weight:$weight;\">".get_tag_link($str)."</span>&nbsp";
                    ++$maxcount;
                }
                if($tag)
                {
                    eval("\$cloud = \"".$templates->get("forumdisplay_cloud")."\";");
                }
            }
        }        
    }
}
function tc_show()
{
    global $db, $mybb, $tags, $thread;

    $canenter = check_tags($thread['fid']);
    if(!$canenter)
    {
        return;
    }
    if($mybb->settings['tc_status'] != 0)
    {
        if($thread['tags'] != "")
        {
            $tags = explode(",", $thread['tags']);
            $sep = "";
            foreach($tags as $str)
            {
                $str = trim($str);
                $tag .= $sep.get_tag_link($str);
                $sep = " | ";
            }
            $tags = "<div style=\"float: left; padding-bottom: 4px;\"><strong>[ </strong><em>Tags</em><strong>:</strong> {$tag}<strong> ]</strong></div>";
        }
    }        
}
function tc_split()
{
    global $mybb, $db;
    if($mybb->input['action'] == "split" && $mybb->settings['tc_auto'] != 0 && $mybb->settings['tc_what'] == 0)
    {
        $canenter = check_tags(intval($mybb->input['fid']));
        if($canenter)
        {
            $string = trim($db->escape_string($mybb->input['string']));
            $tags = get_tags($string);
            print $tags;
        }
    }
    else
    {
        return;
    }
}

if(!function_exists("get_tags"))
{
function get_tags($str, $convert=false)
{
    global $mybb, $db, $cache, $words;
        
    $plugincache = $cache->read("badwords");
    if($convert)
    {
        $str = htmlentities($str);
    }
    /*$str = str_replace("ç","c", $str);
        $str = str_replace("Ç","C", $str);    
        $str = str_replace("ÄŸ","g", $str);
        $str = str_replace("Ð","G", $str);
        $str = str_replace("\xc4\x9c","G", $str);
        $str = str_replace("\xc4\x9e","G", $str);
        $str = str_replace("\xc4\xa0","G", $str);
        $str = str_replace("\xc4\xa2","G", $str);
        $str = str_replace("\xc6\x93","G", $str);
        $str = str_replace("\xc6\x94","G", $str);
        $str = str_replace("\xc7\xa4","G", $str);
        $str = str_replace("\xc7\xa6","G", $str);
        $str = str_replace("\xc7\xb4","G", $str);    
        $str = str_replace("İ","I", $str);    
        $str = str_replace("ö","o", $str);
        $str = str_replace("Ö","O", $str);    
        $str = str_replace("ÅŸ","s", $str);
        $str = str_replace("\xc3\x9f","S", $str);
        $str = str_replace("\xc5\x9a","S", $str);
        $str = str_replace("\xc5\x9c","S", $str);
        $str = str_replace("\xc5\x9e","S", $str);
        $str = str_replace("\xc5\xa0","S", $str);
        $str = str_replace("\xc6\xa7","S", $str);
        $str = str_replace("\xc6\xa9","S", $str);
        $str = str_replace("\xc8\x98","S", $str);    
        $str = str_replace("Ü","U", $str);
        $str = str_replace("ı","i", $str);
        $str = str_replace("ü","u", $str);*/
        $str = str_replace("ش","a", $str);
        $str = str_replace("ش","A", $str);
        $str = str_replace("س","s", $str);
        $str = str_replace("س","S", $str);    
        $str = str_replace("ی","D", $str);
        $str = str_replace("ی","D", $str);
        $str = str_replace("ب","f", $str);
        $str = str_replace("\xc4\x9c","G", $str);
        $str = str_replace("\xc4\x9e","G", $str);
        $str = str_replace("\xc4\xa0","G", $str);
        $str = str_replace("\xc4\xa2","G", $str);
        $str = str_replace("\xc6\x93","G", $str);
        $str = str_replace("\xc6\x94","G", $str);
        $str = str_replace("\xc7\xa4","G", $str);
        $str = str_replace("\xc7\xa6","G", $str);
        $str = str_replace("\xc7\xb4","G", $str);    
        $str = str_replace("ل","g", $str);    
        $str = str_replace("ا","h", $str);
        $str = str_replace("ت","j", $str);    
        $str = str_replace("ن","k", $str);
        $str = str_replace("\xc3\x9f","S", $str);
        $str = str_replace("\xc5\x9a","S", $str);
        $str = str_replace("\xc5\x9c","S", $str);
        $str = str_replace("\xc5\x9e","S", $str);
        $str = str_replace("\xc5\xa0","S", $str);
        $str = str_replace("\xc6\xa7","S", $str);
        $str = str_replace("\xc6\xa9","S", $str);
        $str = str_replace("\xc8\x98","S", $str);    
        $str = str_replace("م","l", $str);
        $str = str_replace("ك",";", $str);
        $str = str_replace("گ","'", $str);
        $str = str_replace("ظ","z", $str);
        $str = str_replace("ط","x", $str);
        $str = str_replace("ز","c", $str);
        $str = str_replace("ر","v", $str);
        $str = str_replace("ذ","b", $str);
        $str = str_replace("د","n", $str);
        $str = str_replace("ض","q", $str);
        $str = str_replace("ص","w", $str);
        $str = str_replace("ث","e", $str);
        $str = str_replace("ق","r", $str);
        $str = str_replace("غ","t", $str);
        $str = str_replace("غ","y", $str);
        $str = str_replace("ع","u", $str);
        $str = str_replace("ه","i", $str);
        $str = str_replace("خ","o", $str);
        $str = str_replace("&"," ", $str);
        $str = str_replace(","," ", $str);
        $str = str_replace("."," ", $str);
        $str = str_replace("("," ", $str);
        $str = str_replace(")"," ", $str);
        $str = str_replace("["," ", $str);
        $str = str_replace("]"," ", $str);
        $str = str_replace("?"," ", $str);
        $str = str_replace("!"," ", $str);
        $str = str_replace("|"," ", $str);
        $str = str_replace("/"," ", $str);
        $str = preg_replace("#\[(.*?)]#esi", "", $str);
        $list = explode(" ", $str);
        $sep = "";
        $tags = array();
    foreach($list as $tag)
    {
        $tag = trim(strtolower($tag));
        if(is_array($tags))
        {
            if(in_array($tag, $tags))
            {
                continue;
            }
        }
        // FILTER SHORT WORDS
        if(intval($mybb->settings['tc_min']) > 0)
        {
            if(strlen($tag) <= intval($mybb->settings['tc_min']))
            {    
                continue;
            }
        }
        // FILTER BADWORDS
        if($mybb->settings['tc_badwords'] != "no")
        {
            foreach($plugincache as $bid => $badword)
            {
                $replacement = $badword['badword'];
                if($tag == $replacement)
                {
                    continue 2;
                }
            }
        }
        // FILTER EXCLUDED WORDS
        if(!$words)
        {
            $words = explode(",", trim($mybb->settings['tc_words']));
        }
        if(in_array($tag, $words))
        {
            continue;
        }
        $tags[] = $tag;
    }
    $tags = implode(", ", $tags);
    return $tags;
}
}

function check_tags($fid=0)
{
    global $mybb, $canenter;
        
    $canenter = true;
    if(trim($mybb->settings['tc_fids']) != "")
    {
        $fids = explode(",", $mybb->settings['tc_fids']);
        if(in_array($fid, $fids))
        {
            $canenter = true;
        }
        else
        {
            $canenter = false;
        }    
        return $canenter;
    }
    else
    {
        $canenter = true;
        return $canenter;
    }
}

function get_tag_link($str="")
{
    global $mybb;
    if(!$str)
    {
        return;
    }
    if($mybb->settings['seourls'] == "yes")
    {
        $tag = $str;
        if(strstr($tag, "."))
        {
            $tag = str_replace(".", "DOT", $tag);
        }
        return "<a style=\"color:#000000;\" href=\"./tags/{$tag}\">{$str}</a>";
    }    
    else
    {
        return "<a style=\"color:#000000;\" href=\"./tagcloud.php?tag={$str}\">{$str}</a>";
    }
}

?>
 

جدیدترین ارسال ها

بالا