<commit_before><?php
/**
 * Renders link to user's profile.
 * @author m.augustynowicz
 * 
 * @param string $text text to display, default: user's display name
 * @param array $user
 *        1. none: authorized user's data used
 *        2. array:
 *           [login] (or whatever is set in conf[users][ident_field])
 *                   created to build URL
 *           [DisplayName] link label
 *           [email] used to generate gravatar
 *        3. string: used as [login] and [DisplayName]
 * @param string $class additional class names
 * @param integer|boolean $avatar size of awatar or false to hide
 *
 * @return string html code
 */

$login_field = g()->conf['users']['ident_field'];

extract(
    array_merge(
        array(
            'user' => array(
                $login_field => g()->auth->get($login_field),
                'DisplayName' => g()->auth->displayName(),
                'email' => g()->auth->get('email'),
            ),
            'class' => '',
            'text' => '',
            'avatar' => 22,
        ),
        (array) $____local_variables
    ),
    EXTR_REFS|EXTR_PREFIX_INVALID, 'param'
);


if (!is_array($user))
{
    $user = array(
        $login_field  => $user,
        'DisplayName' => $user
    );
}

$login = $user[$login_field];

$label = empty($text) ? $user['DisplayName'] : $text;


ob_start();
?>
<span class="vcard name <?=$class?>">
    <?php if ($avatar && array_key_exists('email', $user)) : ?>
        <img class="photo"
             src="http://gravatar.com/avatar/<?php
                    echo md5(@$user['email']);
                ?>?s=<?php 
                    echo $avatar;
                ?>&amp;d=identicon"
        />
    <?php endif; ?>
    <?=$t->l2c($label, 'User', '', array($login), array('class'=>'fn n url'))?>
</span>
<?php
return ob_get_clean();

<commit_msg>include avatar in user link's <a /> tag<commit_after><?php
/**
 * Renders link to user's profile.
 * @author m.augustynowicz
 * 
 * @param string $text text to display, default: user's display name
 * @param array $user
 *        1. none: authorized user's data used
 *        2. array:
 *           [login] (or whatever is set in conf[users][ident_field])
 *                   created to build URL
 *           [DisplayName] link label
 *           [email] used to generate gravatar
 *        3. string: used as [login] and [DisplayName]
 * @param string $class additional class names
 * @param integer|boolean $avatar size of awatar or false to hide
 *
 * @return string html code
 */

$login_field = g()->conf['users']['ident_field'];

extract(
    array_merge(
        array(
            'user' => array(
                $login_field => g()->auth->get($login_field),
                'DisplayName' => g()->auth->displayName(),
                'email' => g()->auth->get('email'),
            ),
            'class' => '',
            'text' => '',
            'avatar' => 22,
        ),
        (array) $____local_variables
    ),
    EXTR_REFS|EXTR_PREFIX_INVALID, 'param'
);


if (!is_array($user))
{
    $user = array(
        $login_field  => $user,
        'DisplayName' => $user
    );
}

$login = $user[$login_field];

$label = empty($text) ? $user['DisplayName'] : $text;

ob_start();
?>
<span class="vcard name <?=$class?>">
    <?php
    if ($avatar && array_key_exists('email', $user))
    {
        $gravatar = sprintf(
            'http://gravatar.com/avatar/%s?%s',
            md5($user['email']),
            http_build_query(array(
                's' => $avatar,
                'd' => 'identicon'
            ))
        );

        $label = sprintf(
            '%s%s',
            $f->tag(
                'img',
                array(
                    'class' => 'photo',
                    'src'   => $gravatar
                )
            ),
            $label
        );
    }
    ?>

    <?=$t->l2c($label, 'User', '', array($login), array('class'=>'fn n url'))?>
</span>
<?php
return ob_get_clean();


{'fraction_non_alphanumeric': 0.17081135393117308, 'fraction_numerical': 0.0035167043456417984, 'mean_word_length': 1.9044493070751276, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1738508', 'n_tokens_mistral': 1246, 'n_tokens_neox': 1211, 'n_words': 297}