• 02-11-2023, 23:40:10
    #1
    Üyeliği durduruldu
    selam ustalarım bir fonksiyonum mevcut bu fonksiyonum belirtiğim site uzantılarında ise otomatik href tagı verip link oluşuyor buraya kadar sorun yok
    fakat linkin devamında href olmaktan çıkıyor birleşik ise link olmali görselde gösterdiğim alan link olmaktan çıktı bunu nasıl düzeltebilirim
    yardimci olursanız çok sevinirim

    [PHPR]
    <?php
    function urlDondur($metin)
    {
    $url = '/b((https?://|www.)?S+.(com|net|org|site|tv|online|xyz|ly|me|xy z|sbs|co|dev|live|pro|shop))b/i';
    return preg_replace_callback($url, function($matches) {
    $url = (strpos($matches[0], 'http') === 0) ? $matches[0] : 'http://' . $matches[0];
    return '<a href="' . $url . '" target="_blank" title="' . $url . '">' . $matches[0] . '</a>';
    }, $metin);
    } ?>
    [/PHPR

  • 02-11-2023, 23:58:08
    #2
    <?php
    function urlDondur($metin)
    {
        $url = '/\b((https?:\/\/|www\.)?\S+\.(com|net|org|site|tv|online|xyz|ly|me|xyz|sbs|co|dev|live|pro|shop)(\/\S*)?)\b/i';
        return preg_replace_callback($url, function($matches) {
            $url = (strpos($matches[0], 'http') === 0) ? $matches[0] : 'http://' . $matches[0];
            return '<a href="' . $url . '" target="_blank" title="' . $url . '">' . $matches[0] . '</a>';
        }, $metin);
    }
    ?>
    Dener misin hocam
  • 03-11-2023, 00:01:17
    #3
    Üyeliği durduruldu
    roxxom adlı üyeden alıntı: mesajı görüntüle
    <?php
    function urlDondur($metin)
    {
        $url = '/\b((https?:\/\/|www\.)?\S+\.(com|net|org|site|tv|online|xyz|ly|me|xyz|sbs|co|dev|live|pro|shop)(\/\S*)?)\b/i';
        return preg_replace_callback($url, function($matches) {
            $url = (strpos($matches[0], 'http') === 0) ? $matches[0] : 'http://' . $matches[0];
            return '<a href="' . $url . '" target="_blank" title="' . $url . '">' . $matches[0] . '</a>';
        }, $metin);
    }
    ?>
    Dener misin hocam
    çok teşekkür ederim hocam calisti yanlis hatirlamiyorsam bu fonksiyonu siz yazmıstiniz yaklasik 2 ay sonra böyle bir güncelleme gerekti elinize saglik çok teşekkürler