[ask] cara setting dofollow?

Discussion in 'Programming' started by ziuma, May 26, 2016.

  1. ziuma

    ziuma Well-Known Member

    Joined:
    May 23, 2014
    Messages:
    1,563
    Likes Received:
    240
    Trophy Points:
    63
    selamat malam semua,

    saya ada sedikit pertanyaan, mungkin teman-teman bisa membantu. Jadi begini ceritanya. threads ini adalah kelanjutan dari threads saya belumnya https://www.bersosial.com/threads/ask-nanya-sedikit-tentang-follow-dofollow.33200/

    saya download plugins di mybb namanya --> AddNoFollow.php

    isi pluginnya seperti ini

    Code:
    <?php
    // This plugin is licensed under the GNU GPLv3 license
    if(!defined("IN_MYBB"))
    {
        die("Direct initialization of this file is not allowed.");
    }
    
    $plugins->add_hook("parse_message_end", "AddNoFollow_hook");
    
    function AddNoFollow_info()
    {
        // Inspired by http://mods.mybb.com/view/nofollowexternal
        return array(
            "name" => "AddNoFollow",
            "description" => "This is a simple plugin that puts rel=\"nofollow\" in external links",
            "website" => "",
            "author" => "Nixtren",
            "authorsite" => "https://github.com/Nixtren",
            "version" => "0.0.1",
            "guid"  => "",
            "compatibility" => "18*"
            );
    }
    
    function AddNoFollow_hook($message)
    {
        global $mybb;
        // Thanks to https://stackoverflow.com/questions/14573553/php-file-get-contents-replace-all-urls-in-all-a-href-links
        $match = array();
        $links = array();
        preg_match_all('!https?://[\S]+!', $message, $match);
        foreach ($match as $key => $value) foreach ($value as $key2 => $TheUrl) $links[] = $TheUrl;
        for ($i = 0; $i < count($links); $i++)
        {
            if(parse_url($links[$i])['host'] != parse_url($mybb->settings['bburl'])['host'])
            {
                $message = str_replace("<a href=\"{$links[$i]}", "<a rel=\"nofollow\" href=\"{$links[$i]}", $message);
            }
        }
        return $message;
    }
    ?>

    nah karena saya ingin rubah jadi dofollow maka semua nofollow saya ganti jadi dofollow

    beberapa ada yang muncul dofollow tetapi sebagian malah jadinya dobel seperti ini

    Code:
    <a rel="nofollow" rel="dofollow" href="http
    ada yang bisa membantu? terima kasih atas bantuannya
     
    Last edited: May 26, 2016
    DedyAkas Website likes this.
  2. ncang

    ncang Super Level

    Joined:
    Feb 7, 2013
    Messages:
    4,655
    Likes Received:
    761
    Trophy Points:
    113
    Google+:
    kalau plugins nya dibuang gimana ?
     
    ziuma and DedyAkas Website like this.
  3. ziuma

    ziuma Well-Known Member

    Joined:
    May 23, 2014
    Messages:
    1,563
    Likes Received:
    240
    Trophy Points:
    63
    maksudnya bagaimana den @ncang ?
    kalau ngak pakai plugins kembali default nofollow

    atau
    ngak boleh memasukkan code di threads :D
     
  4. Garett

    Garett Super Level

    Joined:
    Apr 13, 2015
    Messages:
    1,104
    Likes Received:
    1,049
    Trophy Points:
    163
    Google+:
    Ada beberapa cara, yang saya tahu:
    1. Server Side: setting panel, beberapa baris kode, plug-in CMS.
      • Pros: Efensien dan dapat diatur, diproses oleh server.
      • Cons: Mempengaruhu sistem; bila terjadi kesalahan bisa ERROR.
    2. Clienr Side: JavaScript yang dapat memanipulasi anchor rel.
      • Pros: Lebih sederhana dan tidak mempengaruhi sistem.
      • Cons: nggak berfungsi bila client browser pakai JavaScript blocker.
    Sekian.

    Edit:
    Coba google cara ubah dofollow via Javascript. Selain dofollow, dengan JavaScript, kita bisa manipulasi atribut dari tag, misal: buat new tab pada setiap link. Ini berlaku pada Blogger, 'loh!
     
    ziuma likes this.
  5. Qoeple

    Qoeple Member

    Joined:
    Nov 21, 2015
    Messages:
    551
    Likes Received:
    90
    Trophy Points:
    28
    Google+:
    Coba oprek ininya Om :
    Code:
    $message = str_replace("<a href=\"{$links[$i]}", "<a rel=\"nofollow\" href=\"{$links[$i]}", $message);
    
    bagian rel=\"nofollow\"
     
  6. Ganyool

    Ganyool Member

    Joined:
    May 20, 2016
    Messages:
    421
    Likes Received:
    45
    Trophy Points:
    28
    Bukannya kalo gk pakai plugin otomatis link jadi dofollow ya defaultnya?
     
  7. ziuma

    ziuma Well-Known Member

    Joined:
    May 23, 2014
    Messages:
    1,563
    Likes Received:
    240
    Trophy Points:
    63
    bagian itu dihapus ya den @Qoeple ?
    saya ganti jadi dofollow malah keluarnya dobel
     
  8. ziuma

    ziuma Well-Known Member

    Joined:
    May 23, 2014
    Messages:
    1,563
    Likes Received:
    240
    Trophy Points:
    63
    kalau mybb default nya nofollow
     
  9. Qoeple

    Qoeple Member

    Joined:
    Nov 21, 2015
    Messages:
    551
    Likes Received:
    90
    Trophy Points:
    28
    Google+:
    Belum pernah nyoba MyBB :D, kalau PHPBB defaultnya DoFollow
     
  10. Garett

    Garett Super Level

    Joined:
    Apr 13, 2015
    Messages:
    1,104
    Likes Received:
    1,049
    Trophy Points:
    163
    Google+:
    Whew. Bahasa PHP merajarela.
     
  11. Qoeple

    Qoeple Member

    Joined:
    Nov 21, 2015
    Messages:
    551
    Likes Received:
    90
    Trophy Points:
    28
    Google+:
    ia coba dihapus aja, seharusnya gak perlu rel="dofollow" pun jika tanpa ada rel="nofollow" maka mestinya link tersebut DoFollow
     
    ziuma likes this.
  12. ziuma

    ziuma Well-Known Member

    Joined:
    May 23, 2014
    Messages:
    1,563
    Likes Received:
    240
    Trophy Points:
    63
    ya, saya coba dulu
    terima kasih semua
     
  13. Qoeple

    Qoeple Member

    Joined:
    Nov 21, 2015
    Messages:
    551
    Likes Received:
    90
    Trophy Points:
    28
    Google+:
    Ane gak ngerti koding sebenernya, cuma nebak-nebak aja :D
     
  14. Yusup febriansah

    Yusup febriansah Member

    Joined:
    Apr 13, 2016
    Messages:
    571
    Likes Received:
    43
    Trophy Points:
    28
    Kalo bikin thread bertanya ask di forum bersosial gimana sh? saya member baru belum lama gabung di forum ini...
     
  15. KangAndre

    KangAndre Member

    Joined:
    Jan 25, 2014
    Messages:
    10,244
    Likes Received:
    2,714
    Trophy Points:
    413
    Seperti buat thread, cuma di tambah [ask] [tanya] {as} atau lainnya di awal judul, sebagai penanda tanya. Jika tidak, dianggap postingan pendek dan kemungkinan dapat dihapus admin.
     
  16. nelson sitompul

    nelson sitompul Super Level

    Joined:
    May 3, 2014
    Messages:
    2,285
    Likes Received:
    397
    Trophy Points:
    83
    Lah itu khan plugin nofollow. Jadi kalau kamu pasang, maka semua link jadi nofollow.. klo mau dofollow, lepas aja pluginnya.

    Gini aja, coba kamu lepas pluginnya, trus kabari saya biar saya bantu cek.
     
  17. KangAndre

    KangAndre Member

    Joined:
    Jan 25, 2014
    Messages:
    10,244
    Likes Received:
    2,714
    Trophy Points:
    413
    Masih belum fix, yah? Benar kata @Qoeple hapus semua code rel=\"nofollow\" jangan diganti. Kalau link tidak ada tulisan "rel=nofollow" otomatis itu "dofollow" :D
     
  18. Margareth

    Margareth Well-Known Member

    Joined:
    Nov 16, 2014
    Messages:
    1,068
    Likes Received:
    144
    Trophy Points:
    63
    Kalau scripts bisa di download dan di upload kemudian, salah satu function harus dirubah jadi default dofollow. Default dofollow adalah " " (tidak ada tulisan dofollow).

    Nah, function itu yang harus diedit.
    Bisa di download dimana tuh script forum? biar ane coba oprekk....
     
  19. Qoeple

    Qoeple Member

    Joined:
    Nov 21, 2015
    Messages:
    551
    Likes Received:
    90
    Trophy Points:
    28
    Google+:
    Mungkin sedang asyik ngoprek, saipin Kopi ma Rokok yang banyak dah biar konsen :D..

    Ane malah baru tahu kalo MyBB defaultnya NoFollow, kalau gagal lewat pluginnya coba Oprek Theme / Style nya aja langsung @ziuma...

    Biasanya scriptnya sih nempel di Theme / Style, bukan di Core MyBB
     
  20. KangAndre

    KangAndre Member

    Joined:
    Jan 25, 2014
    Messages:
    10,244
    Likes Received:
    2,714
    Trophy Points:
    413
Loading...

Share This Page