public static function get_providers_preferences($providers, $userid) {
        $preferences = new \stdClass();

        // Get providers preferences.
        foreach ($providers as $provider) {
            foreach (array('loggedin', 'loggedoff') as $state) {
                $linepref = get_user_preferences('message_provider_' . $provider->component . '_' . $provider->name
                    . '_' . $state, '', $userid);
                if ($linepref == '') {
                    continue;
                }
                $lineprefarray = explode(',', $linepref);
                $preferences->{$provider->component.'_'.$provider->name.'_'.$state} = array();
                foreach ($lineprefarray as $pref) {
                    $preferences->{$provider->component.'_'.$provider->name.'_'.$state}[$pref] = 1;
                }
            }
        }

        return $preferences;
    }
public static function get_providers_preferences($providers, $userid) {
        $preferences = new \stdClass();

        // Get providers preferences.
        foreach ($providers as $provider) {
            foreach (array('loggedin', 'loggedoff') as $state) {
                $linepref = get_user_preferences('message_provider_' . $provider->component . '_' . $provider->name
                    . '_' . $state, '', $userid);
                if ($linepref == '') {
                    continue;
                }
                $lineprefarray = explode(',', $linepref);
                $preferences->{$provider->component.'_'.$provider->name.'_'.$state} = array();
                foreach ($lineprefarray as $pref) {
                    $preferences->{$provider->component.'_'.$provider->name.'_'.$state}[$pref] = 1;
                }
            }
        }

        return $preferences;
    }
public static function get_providers_preferences ( $ providers , $ userid ) { $ preferences = new \ stdClass ( ) ; // Get providers preferences. foreach ( $ providers as $ provider ) { foreach ( array ( 'loggedin' , 'loggedoff' ) as $ state ) { $ linepref = get_user_preferences ( 'message_provider_' . $ provider -> component . '_' . $ provider -> name . '_' . $ state , '' , $ userid ) ; if ( $ linepref == '' ) { continue ; } $ lineprefarray = explode ( ',' , $ linepref ) ; $ preferences -> { $ provider -> component . '_' . $ provider -> name . '_' . $ state } = array ( ) ; foreach ( $ lineprefarray as $ pref ) { $ preferences -> { $ provider -> component . '_' . $ provider -> name . '_' . $ state } [ $ pref ] = 1 ; } } } return $ preferences ; }
Get providers preferences.

@param array $providers
@param int $userid
@return \stdClass
Get providers preferences .