roundcubemail/program/lib/Roundcube/rcube_addressbook.php
public static function compose_list_name($contact)
    {
        static $compose_mode;

        if (!isset($compose_mode))  // cache this
            $compose_mode = rcube::get_instance()->config->get('addressbook_name_listing', 0);

        if ($compose_mode == 3)
            $fn = join(' ', array($contact['surname'] . ',', $contact['firstname'], $contact['middlename']));
        else if ($compose_mode == 2)
            $fn = join(' ', array($contact['surname'], $contact['firstname'], $contact['middlename']));
        else if ($compose_mode == 1)
            $fn = join(' ', array($contact['firstname'], $contact['middlename'], $contact['surname']));
        else if ($compose_mode == 0)
            $fn = $contact['name'] ?: join(' ', array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix']));
        else {
            $plugin = rcube::get_instance()->plugins->exec_hook('contact_listname', array('contact' => $contact));
            $fn     = $plugin['fn'];
        }

        $fn = trim($fn, ', ');
        $fn = preg_replace('/\s+/u', ' ', $fn);

        // fallbacks...
        if ($fn === '') {
            // ... display name
            if ($name = trim($contact['name'])) {
                $fn = $name;
            }
            // ... organization
            else if ($org = trim($contact['organization'])) {
                $fn = $org;
            }
            // ... email address
            else if (($email = self::get_col_values('email', $contact, true)) && !empty($email)) {
                $fn = $email[0];
            }
        }

        return $fn;
    }
public static function compose_list_name($contact)
    {
        static $compose_mode;

        if (!isset($compose_mode))  // cache this
            $compose_mode = rcube::get_instance()->config->get('addressbook_name_listing', 0);

        if ($compose_mode == 3)
            $fn = join(' ', array($contact['surname'] . ',', $contact['firstname'], $contact['middlename']));
        else if ($compose_mode == 2)
            $fn = join(' ', array($contact['surname'], $contact['firstname'], $contact['middlename']));
        else if ($compose_mode == 1)
            $fn = join(' ', array($contact['firstname'], $contact['middlename'], $contact['surname']));
        else if ($compose_mode == 0)
            $fn = $contact['name'] ?: join(' ', array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix']));
        else {
            $plugin = rcube::get_instance()->plugins->exec_hook('contact_listname', array('contact' => $contact));
            $fn     = $plugin['fn'];
        }

        $fn = trim($fn, ', ');
        $fn = preg_replace('/\s+/u', ' ', $fn);

        // fallbacks...
        if ($fn === '') {
            // ... display name
            if ($name = trim($contact['name'])) {
                $fn = $name;
            }
            // ... organization
            else if ($org = trim($contact['organization'])) {
                $fn = $org;
            }
            // ... email address
            else if (($email = self::get_col_values('email', $contact, true)) && !empty($email)) {
                $fn = $email[0];
            }
        }

        return $fn;
    }
public static function compose_list_name ( $ contact ) { static $ compose_mode ; if ( ! isset ( $ compose_mode ) ) // cache this $ compose_mode = rcube :: get_instance ( ) -> config -> get ( 'addressbook_name_listing' , 0 ) ; if ( $ compose_mode == 3 ) $ fn = join ( ' ' , array ( $ contact [ 'surname' ] . ',' , $ contact [ 'firstname' ] , $ contact [ 'middlename' ] ) ) ; else if ( $ compose_mode == 2 ) $ fn = join ( ' ' , array ( $ contact [ 'surname' ] , $ contact [ 'firstname' ] , $ contact [ 'middlename' ] ) ) ; else if ( $ compose_mode == 1 ) $ fn = join ( ' ' , array ( $ contact [ 'firstname' ] , $ contact [ 'middlename' ] , $ contact [ 'surname' ] ) ) ; else if ( $ compose_mode == 0 ) $ fn = $ contact [ 'name' ] ? : join ( ' ' , array ( $ contact [ 'prefix' ] , $ contact [ 'firstname' ] , $ contact [ 'middlename' ] , $ contact [ 'surname' ] , $ contact [ 'suffix' ] ) ) ; else { $ plugin = rcube :: get_instance ( ) -> plugins -> exec_hook ( 'contact_listname' , array ( 'contact' => $ contact ) ) ; $ fn = $ plugin [ 'fn' ] ; } $ fn = trim ( $ fn , ', ' ) ; $ fn = preg_replace ( '/\s+/u' , ' ' , $ fn ) ; // fallbacks... if ( $ fn === '' ) { // ... display name if ( $ name = trim ( $ contact [ 'name' ] ) ) { $ fn = $ name ; } // ... organization else if ( $ org = trim ( $ contact [ 'organization' ] ) ) { $ fn = $ org ; } // ... email address else if ( ( $ email = self :: get_col_values ( 'email' , $ contact , true ) ) && ! empty ( $ email ) ) { $ fn = $ email [ 0 ] ; } } return $ fn ; }
Compose the name to display in the contacts list for the given contact record.
This respects the settings parameter how to list conacts.

@param array $contact Hash array with contact data as key-value pairs

@return string List name
Compose the name to display in the contacts list for the given contact record . This respects the settings parameter how to list conacts .