<commit_before><?php

/**
 * Retrieve the post thumbnail SRC
 */
function display_post_thumbnail_src( $id = 0, $size = 'thumbnail' ) {
  $post     = get_post( $id );
  $post_id  = isset( $post->ID ) ? $post->ID : 0;

  $attsrc         = '';
  $atturl         = '';
  $featured_src   = '';
  $featured_url   = '';
  $images         = '';

  $images = get_children( array(
    'numberposts'    => 1,
    'post_mime_type' => 'image',
    'post_parent'    => $post_id,
    'post_status'    => null,
    'post_type'      => 'attachment',
  ));

  if ( has_post_thumbnail( $post_id ) ) {  // author set a specific Featured Image
    $featured_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), $size );
    $featured_url = wp_get_attachment_url( get_post_thumbnail_id( $post_id ), $size );

    if ( isset( $featured_src ) ) {
      return array( $featured_src[0], $featured_url );
    }
  } elseif ( $images ) { // author has uploaded various image attachments, and may or may not have put them in the content
    foreach( $images as $image ) {
      $attsrc = wp_get_attachment_image_src( $image->ID, $size ); // Get attachment image src
      $atturl = wp_get_attachment_url( $image->ID );

      if ( isset( $attsrc ) ) {
        return array( $attsrc[0], $atturl );
      }
    }
  } else { // no images uploaded to this post, so a default image is what we need
    return DEFAULT_PHOTO;
  }
}

/**
 * Display the post thumbnail
*/
function display_post_thumbnail( $id = 0, $size = 'thumbnail', $src = 'permalink' ) {
  $post     = get_post( $id );
  $post_id  = isset( $post->ID ) ? $post->ID : 0;

  if ( $src == display_post_thumbnail_src( $post_id, $size ) ) {

    if ( $src == DEFAULT_PHOTO ) {
      $class    = ' default-photo';
      $link     = get_permalink( $post_id );
      $img_src  = $src;
    } else {
      $class    = '';
      $img_src  = $src[0];

      if ( 'imagelink' == $src ) {
        $link = $src[1];
      } else {
        $link = get_permalink( $post_id );
      }
    }

    echo '<a href="' . $link . '" title="Permanent Link to ' . esc_attr( get_the_title( $post_id ) ) . '" class="post-thumb' . $class . '" itemprop="image"><img src="' . $img_src . '" alt="' . esc_attr( get_the_title( $post_id ) ) . '" class="attachment-post-thumbnail wp-post-image"></a>';
  }
}
?><commit_msg>fix display thumbnails function<commit_after><?php

/**
 * Retrieve the post thumbnail SRC
 */
function display_post_thumbnail_src( $id = 0, $size = 'thumbnail' ) {
  $post     = get_post( $id );
  $post_id  = isset( $post->ID ) ? $post->ID : 0;

  $attsrc         = '';
  $atturl         = '';
  $featured_src   = '';
  $featured_url   = '';
  $images         = '';

  $images = get_children( array(
    'numberposts'    => 1,
    'post_mime_type' => 'image',
    'post_parent'    => $post_id,
    'post_status'    => null,
    'post_type'      => 'attachment',
  ));

  if ( has_post_thumbnail( $post_id ) ) {  // author set a specific Featured Image
    $featured_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), $size );
    $featured_url = wp_get_attachment_url( get_post_thumbnail_id( $post_id ), $size );

    if ( isset( $featured_src ) ) {
      return $featured_src[0];
    }
  } elseif ( $images ) { // author has uploaded various image attachments, and may or may not have put them in the content
    foreach( $images as $image ) {
      $attsrc = wp_get_attachment_image_src( $image->ID, $size ); // Get attachment image src
      $atturl = wp_get_attachment_url( $image->ID );

      if ( isset( $attsrc ) ) {
        return $attsrc[0];
      }
    }
  } else { // no images uploaded to this post, so a default image is what we need
    return DEFAULT_PHOTO;
  }
}

/**
 * Display the post thumbnail
*/
function display_post_thumbnail( $id = 0, $size = 'thumbnail' ) {
  $post     = get_post( $id );
  $post_id  = isset( $post->ID ) ? $post->ID : 0;

  if ( display_post_thumbnail_src( $post_id, $size ) ) {

    if ( $src == DEFAULT_PHOTO ) {
      $class    = ' default-photo';
      $link     = get_permalink( $post_id );
      $img_src  = DEFAULT_PHOTO;
    } else {
      $class    = '';
      $img_src  = display_post_thumbnail_src();
    }

    echo '<a href="' . $link . '" title="Permanent Link to ' . esc_attr( get_the_title( $post_id ) ) . '" class="post-thumb' . $class . '" itemprop="image"><img src="' . $img_src . '" alt="' . esc_attr( get_the_title( $post_id ) ) . '" class="attachment-post-thumbnail wp-post-image"></a>';
  }
}
?>
{'fraction_non_alphanumeric': 0.16153334810547307, 'fraction_numerical': 0.0035453135386660757, 'mean_word_length': 2.6909239574816026, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, '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': '2496402', 'n_tokens_mistral': 1643, 'n_tokens_neox': 1606, 'n_words': 369}