title: strpos(): Empty needle WordPress Plugin
body: <p>I've just finished building my first plugin and have tested it with various plugins on my personal site with no errors. However some users are saying the plugin is causing the following errors for them:</p>
  
  <blockquote>
    <p>strpos(): Empty needle in
    /west/XXXXX/public_html/wp-content/plugins/bot-block/bot-plugin.php on
    line 200</p>
  </blockquote>
  
  <p>On line 200 I have this:</p>
  
  <pre><code>            //See if the domain that referred is in the current block url
              $pos = strpos( $referrer, $site );
  </code></pre>
  
  <p>Now I can't see a problem with that line so I'll give you the whole function:</p>
  
  <pre><code>//Check referrer function
  function bot_block_parse()
  {
      //Get the options for the plugin
      $options = get_option( 'bot_block' );
  
      //See if the request was from another site
      if( isset( $_SERVER['HTTP_REFERER'] ) )
      {
          //Split the URL into it's components
          $referrer = parse_url( $_SERVER['HTTP_REFERER'] );
  
          //Trim the components
          $referrer = array_map( 'trim', $referrer );
  
          //Get the domain name
          $referrer = $referrer['host'];
  
          //Get the block list
          $list = $this-&gt;create_block_list();
  
          //Loop through all the blocked domains
          foreach( $list as $site )
          {
              //Trim the domain
              $site = trim( $site );
  
              //Set the prefix for domains that aren't sub domains
              $prefix = 'www';
  
              //Split domain into smaller components
              $domainParts = explode( ".", $referrer );
  
              //See if the domain that referred is in the current block url
              $pos = strpos( $referrer, $site );
  
              //See if block subdomains is checked
              if( isset( $options['subdomains'] ) )
              {
                  //Check to see if the domain was the current blocked site and if the prefix is not www
                  if( $pos !== false &amp;&amp; $domainParts[0] != $prefix )
                  {
                      //Log spam
                      $this-&gt;log_spam( $site );
  
                      //Call the redirect function to see where to send the user
                      $this-&gt;bot_block_redirect();
                      exit;
                  }
              }
  
              //See if the domain was the current site blocked and the prefix is www
              if( $pos !== false &amp;&amp; $domainParts[0] == $prefix )
              {
                  //Log spam
                  $this-&gt;log_spam( $site );
  
                  //Call the redirect function to see where to send the user
                  $this-&gt;bot_block_redirect();
                  exit;
              }
          }
      }
  }
  </code></pre>
  
  <p>If you need to see the full plugin code I have put it on pastebin here: <a href="http://pastebin.com/gw7YbPVa" rel="nofollow">http://pastebin.com/gw7YbPVa</a></p>
  
  <p>Can anybody help me figure this out please?</p>