1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Search Engine File

Discussion in 'XenForo Questions and Support' started by rotpar, May 17, 2013.

  1. rotpar

    rotpar Member

    Hi,

    I just saw in another post that there is a file in xenforo what regocnizes search engine bots

    Code:
    public static $knownRobots = array
    (
    'avsearch',
    'baiduspider',
    'bingbot',
    'crawler',
    'facebookexternalhit',
    'feedfetcher-google',
    'feedzirra',
    'googlebot',
    'kscrawler',
    'magpie-crawler',
    'nutch',
    'php/',
    'scooter',
    'scoutjet',
    'sogou web spider',
    'twitterbot',
    'xenforo signature generator',
    'yahoo! slurp',
    'yandexbot',
    'zend_http_client',
    );
    where is the location of this file and can I add more bots? I need it for the "first click" plugin.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    That file is library/XenForo/Session.php

    Be weary of making code edits but if you're comfortable with doing so at least keep a note of your changes for reference after upgrading (where the files will be replaced).
     
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    /library/XenForo/Session.php
    Line 96.

    There is also XenForo_Session::isRobot();
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Since its static, he should be able to do:
    PHP:
    XenForo_Session::$knownRobots array_merge(array('my''robots'), XenForo_Session::$knownRobots);
     
    // or... I've seen this used but never used this operator:
    XenForo_Session::$knownRobots += array('my, 'robots');
    It a code event early on.
     
  5. rotpar

    rotpar Member

    Thank you guys, just one question... I have this bot identification file attached, do you know how I could filter the bots name to put in in the xf file?
     

    Attached Files:

  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    This should do most of the work. There may be 1-2 missing commas (PHP should tell you line numbers).
     

    Attached Files:

    rotpar likes this.
  7. rotpar

    rotpar Member

    awesome THX :)
     

Share This Page