original_string: public static function NotificationPreference($ActivityType, $Preferences, $Type = NULL) {
        if (is_numeric($Preferences)) {
           $User = Gdn::UserModel()->GetID($Preferences);
           if (!$User)
              return $Type == 'both' ? array(FALSE, FALSE) : FALSE;
           $Preferences = GetValue('Preferences', $User);
        }
        
        if ($Type === NULL) {
           $Result = self::NotificationPreference($ActivityType, $Preferences, 'Email')
                  || self::NotificationPreference($ActivityType, $Preferences, 'Popup');
           
           return $Result;
        } elseif ($Type === 'both') {
           $Result = array(
              self::NotificationPreference($ActivityType, $Preferences, 'Popup'),
              self::NotificationPreference($ActivityType, $Preferences, 'Email')
              );
           return $Result;
        }
        
        $ConfigPreference = C("Preferences.$Type.$ActivityType", '0');
        if ((int)$ConfigPreference === 2)
           $Preference = TRUE; // This preference is forced on.
        if ($ConfigPreference !== FALSE)
           $Preference = ArrayValue($Type.'.'.$ActivityType, $Preferences, $ConfigPreference);
        else
           $Preference = FALSE;
        
        return $Preference;
     }
code: public static function NotificationPreference($ActivityType, $Preferences, $Type = NULL) {
        if (is_numeric($Preferences)) {
           $User = Gdn::UserModel()->GetID($Preferences);
           if (!$User)
              return $Type == 'both' ? array(FALSE, FALSE) : FALSE;
           $Preferences = GetValue('Preferences', $User);
        }
        
        if ($Type === NULL) {
           $Result = self::NotificationPreference($ActivityType, $Preferences, 'Email')
                  || self::NotificationPreference($ActivityType, $Preferences, 'Popup');
           
           return $Result;
        } elseif ($Type === 'both') {
           $Result = array(
              self::NotificationPreference($ActivityType, $Preferences, 'Popup'),
              self::NotificationPreference($ActivityType, $Preferences, 'Email')
              );
           return $Result;
        }
        
        $ConfigPreference = C("Preferences.$Type.$ActivityType", '0');
        if ((int)$ConfigPreference === 2)
           $Preference = TRUE; // This preference is forced on.
        if ($ConfigPreference !== FALSE)
           $Preference = ArrayValue($Type.'.'.$ActivityType, $Preferences, $ConfigPreference);
        else
           $Preference = FALSE;
        
        return $Preference;
     }
code_tokens: public static function NotificationPreference ( $ ActivityType , $ Preferences , $ Type = NULL ) { if ( is_numeric ( $ Preferences ) ) { $ User = Gdn :: UserModel ( ) -> GetID ( $ Preferences ) ; if ( ! $ User ) return $ Type == 'both' ? array ( FALSE , FALSE ) : FALSE ; $ Preferences = GetValue ( 'Preferences' , $ User ) ; } if ( $ Type === NULL ) { $ Result = self :: NotificationPreference ( $ ActivityType , $ Preferences , 'Email' ) || self :: NotificationPreference ( $ ActivityType , $ Preferences , 'Popup' ) ; return $ Result ; } elseif ( $ Type === 'both' ) { $ Result = array ( self :: NotificationPreference ( $ ActivityType , $ Preferences , 'Popup' ) , self :: NotificationPreference ( $ ActivityType , $ Preferences , 'Email' ) ) ; return $ Result ; } $ ConfigPreference = C ( "Preferences.$Type.$ActivityType" , '0' ) ; if ( ( int ) $ ConfigPreference === 2 ) $ Preference = TRUE ; // This preference is forced on. if ( $ ConfigPreference !== FALSE ) $ Preference = ArrayValue ( $ Type . '.' . $ ActivityType , $ Preferences , $ ConfigPreference ) ; else $ Preference = FALSE ; return $ Preference ; }
docstring: Get default notification preference for an activity type.
  
  @since 2.0.0
  @access public
  @param string $ActivityType
  @param array $Preferences
  @param string $Type One of the following:
  - Popup: Popup a notification.
  - Email: Email the notification.
  - NULL: True if either notification is true.
  - both: Return an array of (Popup, Email).
  @return bool
docstring_tokens: Get default notification preference for an activity type .