IPBAccess
Digg this topic · Save to del.icio.us · Slashdot It · Post to Technorati · Post to Furl · Submit to Reddit · Share on Facebook · Fark It · Googlize This Post · Add to ma.gnolia · Tag to Wink · Add to MyWeb · Add to Netscape


 
Reply to this topicStart new topic
link bb kodu
erhn
mesaj 27.10.2008, 13:07:07
İleti #1
Yeni Üye
*
Grup: Grup: Üye
İleti: 11
Açtığı Konu Sayısı:4
Mod Upload: 0
Katılım: 11.09.2008
Skin: IPBAccess v2.5 NJ2
Üye No: 7,257
Sunucu OS: Linux
IPB Sürüm: IPB 2.2.x


Merhaba arkadaşlar,
ben linklerin konulması için bir bbcode tasarladım.. önceden code tagleri içine alıyordum linkleri şimdi [ link ] diye almak istiyorum fakat bir sorun oluştu.. bu kodların içerisine aldığımda url ler otomatik olarak [ url ] taglerine alınıyor.. ben bunu istemiyorum :s nasıl yapabilirim yani aynı code tagi gibi çalışsın otomatik [ url ] tagine almasın istiyorum.. yada otomatik olarak url leri [ url ] tagine alan özelliği kapatmam mümkün müdür?

ipb 2.2.x

bb code link
CODE
<div class='codelinkust'>Linkler</div><div class='codelink'>{content}</div>


css değişikliği
CODE
.codelinkust
{
width:100%;
background: #666666;
background-color: #666666;
font-weight: bold;
font-align: left;
color: #ffffff;
border-left: 4px solid #666666;
border-right: 2px solid #666666;
}
.codelink

{
border-bottom: 2px solid #666666;
color: #000000;
font-align: left;
background-color: #FAFCFE;
border-left: 4px solid #666666;
border-top: 2px solid #666666;
border-right: 2px solid #666666;
background: #ffffff url center left no-repeat;
}
Go to the top of the page
 
+Quote Post
ARieS
mesaj 27.10.2008, 15:14:28
İleti #2
Admin
Grup Simge
Grup: Grup: IPB-Support
İleti: 1,348
Açtığı Konu Sayısı:98
Mod Upload: 52
Katılım: 19.08.2006
Nereden: Trabzon(Mersin/Erdemli)
Skin: IPBAccess v2.5 NJ2
Üye No: 1,575
Sunucu OS: Linux
IPB Sürüm: IPB 2.3.x
Ülke : tr


Yapmak istediğiniz şeyi biraz daha çar mısınız? Hem code tagları içinde olup link haline mi gelmesini istiyorsunuz?
Go to the top of the page
 
+Quote Post
erhn
mesaj 28.10.2008, 10:30:05
İleti #3
Yeni Üye
*
Grup: Grup: Üye
İleti: 11
Açtığı Konu Sayısı:4
Mod Upload: 0
Katılım: 11.09.2008
Skin: IPBAccess v2.5 NJ2
Üye No: 7,257
Sunucu OS: Linux
IPB Sürüm: IPB 2.2.x


hayır tam tersi.. link kodu die bir kod yaptım yukarıda bahsettiğim gibi ve o kodun içine linkleri aldığımda aynı code tagında olduğu gibi otomatik linkleri url tagına almasın istiyorum.. bunu becerebilirmiyim? yada forum için bu linkleri otomatik url taglerine alan özelliği tamamen kapatabilirmiyiz.. sorum bu..
Go to the top of the page
 
+Quote Post
erhn
mesaj 01.11.2008, 00:29:25
Son düzenleme tarihi : 01.11.2008 02:37 (erhn)
İleti #4
Yeni Üye
*
Grup: Grup: Üye
İleti: 11
Açtığı Konu Sayısı:4
Mod Upload: 0
Katılım: 11.09.2008
Skin: IPBAccess v2.5 NJ2
Üye No: 7,257
Sunucu OS: Linux
IPB Sürüm: IPB 2.2.x


evet sonunda becerdim arkadaşlar.. linkleri otomatik url taglerine almayan code tagı ile aynı işlevi gören fakat biraz daha janjanlı bir bbcode yapabildim.. bu işlerde usta değilim onun için yaptığım şeyi sizde yaparken dikkatli olun.. düzenlediğiniz dosyaları yedek almayı unutmayın..

öncelikle
AdminCp/Look&feel/edit stylesheet advanced mode yapıoruz.. css dosyamız geliyor ve en altına şu kodu ekliyoruz..

CODE
.codelinkust
{
    background: #F9EA7D url(style_images/<#IMG_DIR#>/css_img_link.png) no-repeat right;
    border: 1px dotted #F0AB4F;
    border-bottom: 0;
    border-left: 4px solid #F0AB4F;
    color: #000;
    font-weight: bold;
    font-size: 10px;
    margin: 2px auto 0 auto;
    padding: 3px;
}
.codelink

{
    background: #F9F4C1;
    border: 1px dotted #F0AB4F;
    border-left: 4px solid #F0AB4F;
    border-top: 0;
    color: #8A570B;
    padding: 4px;
    margin: 0 auto 0 auto;
}


arkasından /www/forums/sources/classes/bbcode/class_bbcode.php açıyoruz..

BUL
CODE
$txt = preg_replace_callback( "#\[code\](.+?)\[/code\]#is", array( $this, 'regex_code_tag' ), $txt );


ALTINA EKLE
CODE
$txt = preg_replace_callback( "#\[link\](.+?)\[/link\]#is", array( $this, 'regex_link_tag' ), $txt );


BUL
CODE
            //-----------------------------------------
            // CODE
            //-----------------------------------------
            
            $txt = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", '[code]' , $txt );
            $txt = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", '
', $txt );[/code]

ALTINA EKLE
CODE
            //-----------------------------------------
            // LINK
            //-----------------------------------------
            
            $txt = preg_replace( "#<!--c3-->(.+?)<!--ec3-->#", '[link]' , $txt );
            $txt = preg_replace( "#<!--c4-->(.+?)<!--ec4-->#", '[/link]', $txt );


KAPATIN VE KAYDEDİN..

arkasından /www/forums/sources/classes/bbcode/class_bbcode_core.php açıyoruz..

BUL
CODE
        //-----------------------------------------
        // CODE
        //-----------------------------------------
        
        $t = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", '[code]' , $t );
        $t = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", '
', $t );
[/code]

ALTINA EKLE
CODE
        //-----------------------------------------
        // LINK
        //-----------------------------------------
        
        $t = preg_replace( "#<!--c3-->(.+?)<!--ec3-->#", '[link]' , $t );
        $t = preg_replace( "#<!--c4-->(.+?)<!--ec4-->#", '[/link]', $t );


BUL
CODE
        //-----------------------------------------
        // Clean up code tags
        //-----------------------------------------
        
        //$t = preg_replace_callback( "#\[code\](.+?)\[/code\]#is"      , array( $this, 'clean_ipb_html_code_tag' ), $t );
        
        return $t;


ALTINA EKLE
CODE
        //-----------------------------------------
        // Clean up link tags
        //-----------------------------------------
        
        //$t = preg_replace_callback( "#\[link\](.+?)\[/link\]#is"      , array( $this, 'clean_ipb_html_link_tag' ), $t );
        
        return $t;


BUL
CODE
    function clean_ipb_html_code_tag( $matches )
    {
        //-----------------------------------------
        // INIT
        //-----------------------------------------
        
        $txt = $matches[1];
        
        //-----------------------------------------
        // Fix...
        //-----------------------------------------
        
        $txt = str_replace( "<"             , "<"  , $txt );
        $txt = str_replace( ">"             , ">"  , $txt );
        $txt = str_replace( "<"         , "<"  , $txt );
        $txt = str_replace( ">"         , ">"  , $txt );
        $txt = str_replace( "<br>"    , "<br>"  , $txt );
        $txt = str_replace( "<br />"  , "<br>"  , $txt );
        
        return '[code]'.$txt.'
';
}[/code]

ALTINA EKLE
CODE
    /*-------------------------------------------------------------------------*/
    // Clean up link tags for RTE body
    /*-------------------------------------------------------------------------*/
    
    /**
    * Remove quote tags
    *
    * @param    array    Array of matches
    * @return    string    Converted text
    */
    function clean_ipb_html_link_tag( $matches )
    {
        //-----------------------------------------
        // INIT
        //-----------------------------------------
        
        $txt = $matches[1];
        
        //-----------------------------------------
        // Fix...
        //-----------------------------------------
        
        $txt = str_replace( "<"             , "<"  , $txt );
        $txt = str_replace( ">"             , ">"  , $txt );
        $txt = str_replace( "<"         , "<"  , $txt );
        $txt = str_replace( ">"         , ">"  , $txt );
        $txt = str_replace( "<br>"    , "<br>"  , $txt );
        $txt = str_replace( "<br />"  , "<br>"  , $txt );
        
        return '[link]'.$txt.'[/link]';
    }


BUL
CODE
$used = array(
                       'code'  => array( 'title' => "{$this->ipsclass->lang['bbcode_wrap_code']}" , 'css_top' => 'codetop'  , 'css_main' => 'codemain'  ),


ALTINA EKLE
CODE
'link'  => array( 'title' => "Bağlantılar" , 'css_top' => 'codelinkust'  , 'css_main' => 'codelink'  ),


Buradaki bağlantılar yazan yazıyı siz istediğiniz şekilde değiştirebilirsiniz.. veya {$this->ipsclass->lang['bbcode_wrap_link']} şeklinde belirleyerek lang dosyalarına ekleyebilirsiniz..

BUL
CODE
function regex_code_tag( $matches=array() )
    {
        $txt = trim( $matches[1] );
        
        $default = "\[code\]$txt\[/code\]";
        
        if ( $txt == "" )
        {
            return;
        }
        
        //-----------------------------------------
        // Take a stab at removing most of the common
        // smilie characters.
        //-----------------------------------------
        
        //$txt = str_replace( "&" , "&", $txt );
        $txt = str_replace( "<"         , "<" , $txt );
        $txt = str_replace( ">"         , ">" , $txt );
        $txt = str_replace( "<"      , "<" , $txt );
        $txt = str_replace( ">"      , ">" , $txt );
        $txt = str_replace( """    , """ , $txt );
        $txt = str_replace( ":"         , ":" , $txt );
        $txt = str_replace( "["         , "[" , $txt );
        $txt = str_replace( "]"         , "]" , $txt );
        $txt = str_replace( ")"         , ")" , $txt );
        $txt = str_replace( "("         , "(" , $txt );
        $txt = str_replace( "\r"        , "<br />", $txt );
        $txt = str_replace( "\n"        , "<br />", $txt );
        $txt = preg_replace( "#\s{1};#" , ";" , $txt );
        
        //-----------------------------------------
        // Ensure that spacing is preserved
        //-----------------------------------------
        
        $txt = preg_replace( "#\t#"   , "    ", $txt );
        $txt = preg_replace( "#\s{2}#", "  "            , $txt );
        
        $html = $this->wrap_style( 'code' );
        
        return "<!--c1-->{$html['START']}<!--ec1-->$txt<!--c2-->{$html['END']}<!--ec2-->";
    }


ALTINA EKLE
CODE
    function regex_link_tag( $matches=array() )
    {
        $txt = trim( $matches[1] );
        
        $default = "\[link\]$txt\[/link\]";
        
        if ( $txt == "" )
        {
            return;
        }
        
        //-----------------------------------------
        // Take a stab at removing most of the common
        // smilie characters.
        //-----------------------------------------
        
        //$txt = str_replace( "&" , "&", $txt );
        $txt = str_replace( "<"         , "<" , $txt );
        $txt = str_replace( ">"         , ">" , $txt );
        $txt = str_replace( "<"      , "<" , $txt );
        $txt = str_replace( ">"      , ">" , $txt );
        $txt = str_replace( """    , """ , $txt );
        $txt = str_replace( ":"         , ":" , $txt );
        $txt = str_replace( "["         , "[" , $txt );
        $txt = str_replace( "]"         , "]" , $txt );
        $txt = str_replace( ")"         , ")" , $txt );
        $txt = str_replace( "("         , "(" , $txt );
        $txt = str_replace( "\r"        , "<br />", $txt );
        $txt = str_replace( "\n"        , "<br />", $txt );
        $txt = preg_replace( "#\s{1};#" , ";" , $txt );
        
        //-----------------------------------------
        // Ensure that spacing is preserved
        //-----------------------------------------
        
        $txt = preg_replace( "#\t#"   , "    ", $txt );
        $txt = preg_replace( "#\s{2}#", "  "            , $txt );
        
        $html = $this->wrap_style( 'link' );
        
        return "<!--c3-->{$html['START']}<!--ec3-->$txt<!--c4-->{$html['END']}<!--ec4-->";
    }


BUL
CODE
if ( strstr( $name, '<!--c1-->' ) or strstr( $date, '<!--c1-->' ) )
        {
            //-----------------------------------------
            // Code tag detected...
            //-----------------------------------------
            
            $this->quote_error++;
             return $default;
        }


ALTINA EKLE
CODE
    if ( strstr( $name, '<!--c3-->' ) or strstr( $date, '<!--c3-->' ) )
        {
            //-----------------------------------------
            // link tag detected...
            //-----------------------------------------
            
            $this->quote_error++;
             return $default;
        }


BUL
CODE
if ( preg_match( "/\[\/(html|quote|code|sql)/i", $url['html'] ) )
        {
            return $url['html'];
        }


DEĞİŞTİR
CODE
if ( preg_match( "/\[\/(html|quote|code|sql|link)/i", $url['html'] ) )
        {
            return $url['html'];
        }


KAPATIN VE KAYDEDİN..

arkasından /www/forums/sources/classes/bbcode/class_bbcode_legacy.php açıyoruz..

BUL
CODE
            //-----------------------------------------
            // Do [CODE] tag
            //-----------------------------------------
            
            $txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag( '\\1' )", $txt );


ALTINA EKLE
CODE
            //-----------------------------------------
            // Do [LINK] tag
            //-----------------------------------------
            
            $txt = preg_replace( "#\[link\](.+?)\[/link\]#ies", "\$this->regex_link_tag( '\\1' )", $txt );


BUL
CODE
            //-----------------------------------------
            // CODE
            //-----------------------------------------
            
            $txt = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", '[code]' , $txt );
            $txt = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", '
', $txt );
[/code]

ALTINA EKLE
CODE
            //-----------------------------------------
            // link
            //-----------------------------------------
            
            $txt = preg_replace( "#<!--c3-->(.+?)<!--ec3-->#", '[link]' , $txt );
            $txt = preg_replace( "#<!--c4-->(.+?)<!--ec4-->#", '[/link]', $txt );


KAPATIN ve KAYDEDİN... artık [ link ] diye bi kodunuz olmuş olmalı (IMG:style_emoticons/default/smile.gif)
Yüklenen Dosya(lar)
Yüklenen Dosya  link.jpg ( 13.75k ) İndirilme Sayısı: 8
Yüklenen Dosya  css_img_link.png ( 2.85k ) İndirilme Sayısı: 0
 
Go to the top of the page
 
+Quote Post
erhn
mesaj 01.11.2008, 00:42:13
İleti #5
Yeni Üye
*
Grup: Grup: Üye
İleti: 11
Açtığı Konu Sayısı:4
Mod Upload: 0
Katılım: 11.09.2008
Skin: IPBAccess v2.5 NJ2
Üye No: 7,257
Sunucu OS: Linux
IPB Sürüm: IPB 2.2.x


ekteki resimden neye benzediğini görebilirsiniz ve 2. ekteki resmide /public_html/forums/style_images/{skinin klasörü}/css_img_link.png şeklinde atın..
düzenleyemediğimden ikinci mesajı atıyorum.. umarım işinize yarar..
Go to the top of the page
 
+Quote Post
@LpE®En
mesaj 01.11.2008, 19:56:34
İleti #6
Aktif
Grup Simge
Grup: Grup: IPB-User
İleti: 305
Açtığı Konu Sayısı:59
Mod Upload: 3
Katılım: 10.03.2006
Nereden: FTP Port 21...
Skin: IPBAccess v2.5 NJ2
Üye No: 691
Sunucu OS: Linux
IPB Sürüm: IPB 2.3.x


neden code değilde link veya tersten sorayım neden adres degilde link?
ama güzel çalışma olmuş eline sağlık.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 kullanıcı bu başlığı okuyor (1 Misafir ve 0 Gizli Kullanıcı)
0 Üye:

Collapse

> Benzer Konular

    Konu Başlığı Yanıtlar Başlatan Okunma Son hareket
No New Posts   6 ganja 3,465 24.12.2008 - 19:55:23
Son İleti: vetgenetics
No New Posts 13 uggur 1,060 18.12.2008 - 20:34:20
Son İleti: vetgenetics
No New Posts   2 deliasik 180 15.12.2008 - 12:53:06
Son İleti: deliasik
No New Posts   4 ganja 396 24.11.2008 - 13:09:36
Son İleti: yargıç
No New Posts   0 vetgenetics 185 29.10.2008 - 18:33:31
Son İleti: vetgenetics