<commit_before><?php

class TimberComment extends TimberCore {

    var $PostClass = 'TimberPost';

    public static $representation = 'comment';

    function __construct($cid) {
        $this->init($cid);
    }

    function author() {
        if ($this->user_id) {
            return new TimberUser($this->user_id);
        } else {
            $author = new TimberUser(0);
            if (isset($this->comment_author) && $this->comment_author){
                $author->name = $this->comment_author;
            } else {
                $author->name = 'Anonymous';
            }
        }
        return $author;
    }

    function date() {
        return $this->comment_date;
    }

    function content() {
        return $this->comment_content;
    }

    function init($cid) {
        $comment_data = $cid;
        if (is_integer($cid)) {
            $comment_data = get_comment($cid);
        }
        $this->import($comment_data);
        $this->ID = $this->comment_ID;
    }

    function avatar($size=92, $default='<path_to_url>'){
        // Fetches the Gravatar
        // use it like this
        // {{comment.avatar(36,template_uri~"/img/dude.jpg")}}

        if ( ! get_option('show_avatars') ) return false;
        if ( !is_numeric($size) ) $size = '32';

        $email = $this->avatar_email();
        if ( !empty($email) ) $email_hash = md5( strtolower( trim( $email ) ) );
        $host = $this->avatar_host($email_hash);

        $default = $this->avatar_default($default,$email, $size);

        if( !empty($email) ) {
            $avatar = $this->avatar_out($email, $default, $host, $email_hash, $size);
        } else {
            $avatar = $default;
        }
        return $avatar;
    }


    private function avatar_email(){
        $email = '';
        $user = get_userdata($this->ID);
        if ( $user ) $email = $user->user_email;

        if($email == "" ){
            $email = $this->comment_author_email;
        }
        return $email;
    }

    private function avatar_host($email_hash){
        if ( is_ssl() ) {
            $host = 'https://secure.gravatar.com';
        } else {
            if ( !empty($email) ){
                $host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash[0] ) % 2 ) );
            } else {
                $host = 'http://0.gravatar.com';
            }
        }
        return $host;
    }

    private function avatar_default($default,$email, $size){
      if (empty($default) ){
        $avatar_default = get_option('avatar_default');
        if ( empty($avatar_default) ){
            $default = 'mystery';        
        }else{
            $default = $avatar_default;           
        } 
      }
    
      if ( 'mystery' == $default )
          $default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; 
          // ad516503a11cd5ca435acc9bb6523536 == md5('<EMAIL>')
      elseif ( 'blank' == $default )
          $default = $email ? 'blank' : includes_url( 'images/blank.gif' );
      elseif ( !empty($email) && 'gravatar_default' == $default )
          $default = '';
      elseif ( 'gravatar_default' == $default )
          $default = "$host/avatar/?s={$size}";
      elseif ( empty($email) )
          $default = "$host/avatar/?d=$default&amp;s={$size}";
      elseif ( strpos($default, 'http://') === 0 )
          $default = add_query_arg( 's', $size, $default );
    }
    
    private function avatar_out($email, $default, $host, $email_hash, $size){
        $out = "$host/avatar/";
        $out .= $email_hash;
        $out .= '?s='.$size;
        $out .= '&amp;d=' . urlencode( $default );
        
        $rating = get_option('avatar_rating');
        if ( !empty( $rating ) ) $out .= "&amp;r={$rating}";
        
        return  str_replace( '&#038;', '&amp;', esc_url( $out ) );          
    }
    
}<commit_msg>removed avatar stuff for now so i can merge user updates<commit_after><?php

class TimberComment extends TimberCore {

    var $PostClass = 'TimberPost';

    public static $representation = 'comment';

    function __construct($cid) {
        $this->init($cid);
    }

    function author() {
        if ($this->user_id) {
            return new TimberUser($this->user_id);
        } else {
            $author = new TimberUser(0);
            if (isset($this->comment_author) && $this->comment_author){
                $author->name = $this->comment_author;
            } else {
                $author->name = 'Anonymous';
            }
        }
        return $author;
    }

    function date() {
        return $this->comment_date;
    }

    function content() {
        return $this->comment_content;
    }

    function init($cid) {
        $comment_data = $cid;
        if (is_integer($cid)) {
            $comment_data = get_comment($cid);
        }
        $this->import($comment_data);
        $this->ID = $this->comment_ID;
    }

}
{'fraction_non_alphanumeric': 0.1609077898180331, 'fraction_numerical': 0.01165405847474954, 'mean_word_length': 1.896388395500296, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 38, 'https://': 1, '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': '5910194', 'n_tokens_mistral': 1584, 'n_tokens_neox': 1524, 'n_words': 285}