private function isSafari()
  {
    $is = false;
    if ( preg_match( "/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//", $this->ua, $matches ) )
    {
      // These things sometimes surf around acting like they're Safari.
      if ( !preg_match( "/(PhantomJS|Silk|rekonq|OPR|Chrome|Android|Edge|bot)/", $this->ua ) )
      {
        $is = true;
        $major = ( isset( $matches[ 2 ] ) ) ? $matches[ 2 ] : null;
        $minor = ( isset( $matches[ 3 ] ) ) ? $matches[ 3 ] : null;
        $rev = ( isset( $matches[ 4 ] ) ) ? $matches[ 4 ] : null;
        $version = ( isset( $major ) ) ? $major : null;
        $version .= ( isset( $minor ) ) ? '.' . $minor : null;
        $version .= ( isset( $rev ) ) ? '.' . $rev : null;
      }
    }
    // Versions below 3.x doe not have the Version/ in the UA.  Since we can't get the version number, we go with the
    // highest version that didn't have the version number in the UA.  It doesn't really matter, since this would be
    // a 'baseline' browser anyway.
    elseif ( preg_match("/(Safari)\/\d+/", $this->ua, $matches) )
    {
      // These things sometimes surf around acting like they're Safari.
      if ( !preg_match( "/(PhantomJS|Silk|rekonq|OPR|Chrome|Android|Edge|bot)/", $this->ua ) )
      {
        $is = true;
        $version = 2;
        $major = 2;
        $minor = 0;
        $rev = 4;
      }
    }

    if ( $is && isset( $version, $major, $minor ) )
    {
      $this->browser = 'safari';
      $this->version = $version;
      $this->major = $major;
      $this->minor = $minor;
      $this->rev = ( isset( $rev ) ) ? $rev : null;

      return true;
    }

    return false;
  }
private function isSafari()
  {
    $is = false;
    if ( preg_match( "/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//", $this->ua, $matches ) )
    {
      // These things sometimes surf around acting like they're Safari.
      if ( !preg_match( "/(PhantomJS|Silk|rekonq|OPR|Chrome|Android|Edge|bot)/", $this->ua ) )
      {
        $is = true;
        $major = ( isset( $matches[ 2 ] ) ) ? $matches[ 2 ] : null;
        $minor = ( isset( $matches[ 3 ] ) ) ? $matches[ 3 ] : null;
        $rev = ( isset( $matches[ 4 ] ) ) ? $matches[ 4 ] : null;
        $version = ( isset( $major ) ) ? $major : null;
        $version .= ( isset( $minor ) ) ? '.' . $minor : null;
        $version .= ( isset( $rev ) ) ? '.' . $rev : null;
      }
    }
    // Versions below 3.x doe not have the Version/ in the UA.  Since we can't get the version number, we go with the
    // highest version that didn't have the version number in the UA.  It doesn't really matter, since this would be
    // a 'baseline' browser anyway.
    elseif ( preg_match("/(Safari)\/\d+/", $this->ua, $matches) )
    {
      // These things sometimes surf around acting like they're Safari.
      if ( !preg_match( "/(PhantomJS|Silk|rekonq|OPR|Chrome|Android|Edge|bot)/", $this->ua ) )
      {
        $is = true;
        $version = 2;
        $major = 2;
        $minor = 0;
        $rev = 4;
      }
    }

    if ( $is && isset( $version, $major, $minor ) )
    {
      $this->browser = 'safari';
      $this->version = $version;
      $this->major = $major;
      $this->minor = $minor;
      $this->rev = ( isset( $rev ) ) ? $rev : null;

      return true;
    }

    return false;
  }
private function isSafari ( ) { $ is = false ; if ( preg_match ( "/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//" , $ this -> ua , $ matches ) ) { // These things sometimes surf around acting like they're Safari. if ( ! preg_match ( "/(PhantomJS|Silk|rekonq|OPR|Chrome|Android|Edge|bot)/" , $ this -> ua ) ) { $ is = true ; $ major = ( isset ( $ matches [ 2 ] ) ) ? $ matches [ 2 ] : null ; $ minor = ( isset ( $ matches [ 3 ] ) ) ? $ matches [ 3 ] : null ; $ rev = ( isset ( $ matches [ 4 ] ) ) ? $ matches [ 4 ] : null ; $ version = ( isset ( $ major ) ) ? $ major : null ; $ version .= ( isset ( $ minor ) ) ? '.' . $ minor : null ; $ version .= ( isset ( $ rev ) ) ? '.' . $ rev : null ; } } // Versions below 3.x doe not have the Version/ in the UA.  Since we can't get the version number, we go with the // highest version that didn't have the version number in the UA.  It doesn't really matter, since this would be // a 'baseline' browser anyway. elseif ( preg_match ( "/(Safari)\/\d+/" , $ this -> ua , $ matches ) ) { // These things sometimes surf around acting like they're Safari. if ( ! preg_match ( "/(PhantomJS|Silk|rekonq|OPR|Chrome|Android|Edge|bot)/" , $ this -> ua ) ) { $ is = true ; $ version = 2 ; $ major = 2 ; $ minor = 0 ; $ rev = 4 ; } } if ( $ is && isset ( $ version , $ major , $ minor ) ) { $ this -> browser = 'safari' ; $ this -> version = $ version ; $ this -> major = $ major ; $ this -> minor = $ minor ; $ this -> rev = ( isset ( $ rev ) ) ? $ rev : null ; return true ; } return false ; }
Determines if a browser is Safari by the user agent string.

@return bool
Determines if a browser is Safari by the user agent string .