static function disable_autolink_urls($autolink = false)
 {
     BBCodeParser::$autolinkUrls = $autolink;
 }
 /**
  * Intelligently expand a URL into a link
  *
  * @return  string
  * @access  private
  * @author  Seth Price <*****@*****.**>
  * @author  Lorenzo Alberton <*****@*****.**>
  */
 public function smarterPPLinkExpand($matches)
 {
     $options = SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser', '_options');
     $o = $options['open'];
     $c = $options['close'];
     //If we have an intro tag that is [url], then skip this match
     if ($matches[1] == $o . 'url' . $c) {
         return $matches[0];
     }
     if (!BBCodeParser::autolinkUrls()) {
         return $matches[0];
     }
     $punctuation = '.,;:';
     // Links can't end with these chars
     $trailing = '';
     // Knock off ending punctuation
     $last = substr($matches[2], -1);
     while (strpos($punctuation, $last) !== false) {
         // Last character is punctuation - remove it from the url
         $trailing = $last . $trailing;
         $matches[2] = substr($matches[2], 0, -1);
         $last = substr($matches[2], -1);
     }
     $off = strpos($matches[2], ':');
     //Is a ":" (therefore a scheme) defined?
     if ($off === false) {
         /*
          * Create a link with the default scheme of http. Notice that the
          * text that is viewable to the user is unchanged, but the link
          * itself contains the "http://".
          */
         return $matches[1] . $o . 'url=' . $this->_defaultScheme . '://' . $matches[2] . $c . $matches[2] . $o . '/url' . $c . $trailing;
     }
     $scheme = substr($matches[2], 0, $off);
     /*
      * If protocol is in the approved list than allow it. Note that this
      * check isn't really needed, but the created link will just be deleted
      * later in smarterPPLink() if we create it now and it isn't on the
      * scheme list.
      */
     if (in_array($scheme, $this->_allowedSchemes)) {
         return $matches[1] . $o . 'url' . $c . $matches[2] . $o . '/url' . $c . $trailing;
     }
     return $matches[0];
 }