<commit_before><?php
/**
 * Template Name: Pods - Event
 * Description: The template used for Event Pods
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
?>
<?php
/**
 * Pods initialization
 * URI: /media/objects/events/
 */
global $pods;
$BASE_URI = '/media/objects/events/';
$TRACE_ENABLED = is_user_logged_in();
$TRACE_PREFIX = 'pods-events-frontpage';

function people_list($people, $heading_singular, $heading_plural) {
  $output = '';
  $people_count = 0;
  $people_with_blurb_count = 0;
  
  if(is_array($people)) {
    if(count($people) > 1) {
      $output .= "<dt>$heading_plural</dt>\n";
    } else {
      $output .= "<dt>$heading_singular</dt>\n";
    }
    $output .= "<dd>\n<ul>\n";
    
    foreach($people as $person) {
      echo var_trace($person, 'people_list:$person', $TRACE_ENABLED);
      $people_count++;
      if($person['profile_text']) {
        $output .= '<li><a href="#person-profile-' . $person['slug'] . '">' . $person['name'] . ' ' . $person['family_name'] . "</a></li>\n";
        $people_with_blurb_count++;
      } else {
        $output .= "<li>" . $person['name'] . "  " . $person['family_name'] . "</li>\n";
      }
    }
    $output .= "</ul>\n</dd>\n";
  }
  
  return array('count' => $people_count, 'with_blurb' => $people_with_blurb_count, 'output' => $output, 'trace' => var_export($people, true));
}

// check if we are getting called via Pods (pods_url_variable is set)
$pod_slug = pods_url_variable(3);

if($pod_slug) {
  $pod = new Pod('event', $pod_slug);
  $is_conference = false;
} else {
  $pod_slug = get_post_meta($post->ID, 'pod_slug', true);
  $pod = new Pod('conference', $pod_slug);
  $is_conference = true;
}

echo var_trace('pod_slug: ' . $pod_slug, $TRACE_PREFIX, $TRACE_ENABLED);

$button_links = $pod->get_field('links');

echo var_trace('button_links: ' . var_export($button_links, true), $TRACE_PREFIX, $TRACE_ENABLED);

$event_speakers = $pod->get_field('speakers', 'family_name ASC');
$event_respondents = $pod->get_field('respondents', 'family_name ASC');
$event_chairs = $pod->get_field('chairs', 'family_name ASC');
$event_moderators = $pod->get_field('moderators', 'family_name ASC');
$event_all_the_people = array_merge((array)$event_speakers, (array)$event_respondents, (array)$event_chairs, (array)$event_moderators);
echo var_trace($event_all_the_people, $TRACE_PREFIX, $TRACE_ENABLED);
$event_hashtag = ltrim($pod->get_field('hashtag'), '#');

$speakers_output = people_list($event_speakers, "Speaker", "Speakers");
$respondents_output = people_list($event_respondents, "Respondent", "Respondents");
$chairs_output = people_list($event_chairs, "Chair", "Chairs");
$moderators_output = people_list($event_moderators, "Moderator", "Moderators");

$people_with_blurb = $speakers_output['with_blurb'] + $respondents_output['with_blurb'] + $chairs_output['with_blurb'] + $moderators_output['with_blurb'];

$event_blurb = do_shortcode($pod->get_field('blurb'));
$event_blurb_after_event = do_shortcode($pod->get_field('blurb_after_event'));
$event_contact_info = do_shortcode($pod->get_field('contact_info'));

$event_media = $pod->get_field('media_attachments');

$slider = $pod->get_field('slider');
if(!$slider) {
  $featured_image_uri = get_the_post_thumbnail(get_the_ID(), array(960,367));
}

// if this is an event, grab the image URI from the Pod
if(!$is_conference) {
  $featured_image_uri = $pod->get_field('heading_image.guid');
}

$event_date_string = $pod->get_field('date_freeform');
$event_date = new DateTime($pod->get_field('date_start'));
$datetime_now = new DateTime('now');
$is_future_event = ($event_date > $datetime_now) ? true : false;

$event_location = preg_replace('/<p>(.*?)<\/p>/', "$1", $pod->get_field('location'));
$event_series = $pod->get_field('event_series');
          
$poster_pdf = $pod->get_field('poster_pdf');
$poster_pdf = $poster_pdf[0]['guid'];
?>

<?php get_header(); ?>

<div role="main">

<?php if ( have_posts() ) : the_post(); endif; ?>

<div id="post-<?php the_ID(); ?>" <?php post_class('lc-article lc-event'); ?>>

<?php echo var_trace($speakers_output, $TRACE_PREFIX, $TRACE_ENABLED);
      echo var_trace($respondents_output, $TRACE_PREFIX, $TRACE_ENABLED);
      echo var_trace($chairs_output, $TRACE_PREFIX, $TRACE_ENABLED);
      echo var_trace($moderators_output, $TRACE_PREFIX, $TRACE_ENABLED);
?>

          <div class='ninecol' id='contentarea'>
            <div class='top-content'>
              <?php if($featured_image_uri) : ?>
              <header class='heading-image'>
                <div class='photospread wireframe'>
                  <img src="<?php echo $featured_image_uri; ?>" alt="event photo" />
                </div>
              </header>
              <?php endif; ?>
              <article class='wireframe eightcol'>
                <header>
                  <h1><?php echo $pod->get_field('name'); ?></h1>
                </header>
                <?php if(!$is_future_event): ?>
                  <?php if($event_blurb): ?>
                  <div class="blurb"><?php echo $event_blurb; ?></div>
                  <?php endif; ?>
                <?php else: ?>
                  <?php if($event_blurb_after_event): ?>
                  <div class="blurb"><?php echo $event_blurb_after_event; ?></div>
                  <?php elseif($event_blurb): ?>
                  <div class="blurb"><?php echo $event_blurb; ?></div>
                  <?php endif; ?>
                <?php endif; // !$is_future_event ?>
                <?php if($event_contact_info and $is_future_event): ?>
                  <aside class="booking-and-access"><?php echo $event_contact_info; ?></aside>
                <?php endif; ?>
              </article>
              <aside class='wireframe fourcol last' id='keyfacts'>
                <dl>
                    <?php echo $speakers_output['output'];
                          echo $respondents_output['output'];
                          echo $chairs_output['output'];
                          echo $moderators_output['output'];
                    ?>
                    
                    <?php if($event_date_string): ?>
                      <dt>When</dt>
                      <dd><?php echo $event_date_string; ?></dd>
                    <?php endif; ?>
              
                    <?php if($event_location): ?>
                      <dt>Where</dt>
                      <dd><?php echo $event_location; ?></dd>
                    <?php endif; ?>
              
                    <?php if($event_series): ?>
                      <dt>Event series</dt>
                      <dd><em><?php echo do_shortcode($pod->get_field('event_series')); ?></em></dd>
                    <?php endif; ?>
                    
                    <?php if($event_contact_info and $is_future_event): ?>
                      <dt>Access &amp; booking</dt>
                      <dd><?php echo $event_contact_info; ?></dd>
                    <?php endif; ?>
<commit_msg>disable access info in sidebar<commit_after><?php
/**
 * Template Name: Pods - Event
 * Description: The template used for Event Pods
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
?>
<?php
/**
 * Pods initialization
 * URI: /media/objects/events/
 */
global $pods;
$BASE_URI = '/media/objects/events/';
$TRACE_ENABLED = is_user_logged_in();
$TRACE_PREFIX = 'pods-events-frontpage';

function people_list($people, $heading_singular, $heading_plural) {
  $output = '';
  $people_count = 0;
  $people_with_blurb_count = 0;
  
  if(is_array($people)) {
    if(count($people) > 1) {
      $output .= "<dt>$heading_plural</dt>\n";
    } else {
      $output .= "<dt>$heading_singular</dt>\n";
    }
    $output .= "<dd>\n<ul>\n";
    
    foreach($people as $person) {
      echo var_trace($person, 'people_list:$person', $TRACE_ENABLED);
      $people_count++;
      if($person['profile_text']) {
        $output .= '<li><a href="#person-profile-' . $person['slug'] . '">' . $person['name'] . ' ' . $person['family_name'] . "</a></li>\n";
        $people_with_blurb_count++;
      } else {
        $output .= "<li>" . $person['name'] . "  " . $person['family_name'] . "</li>\n";
      }
    }
    $output .= "</ul>\n</dd>\n";
  }
  
  return array('count' => $people_count, 'with_blurb' => $people_with_blurb_count, 'output' => $output, 'trace' => var_export($people, true));
}

// check if we are getting called via Pods (pods_url_variable is set)
$pod_slug = pods_url_variable(3);

if($pod_slug) {
  $pod = new Pod('event', $pod_slug);
  $is_conference = false;
} else {
  $pod_slug = get_post_meta($post->ID, 'pod_slug', true);
  $pod = new Pod('conference', $pod_slug);
  $is_conference = true;
}

echo var_trace('pod_slug: ' . $pod_slug, $TRACE_PREFIX, $TRACE_ENABLED);

$button_links = $pod->get_field('links');

echo var_trace('button_links: ' . var_export($button_links, true), $TRACE_PREFIX, $TRACE_ENABLED);

$event_speakers = $pod->get_field('speakers', 'family_name ASC');
$event_respondents = $pod->get_field('respondents', 'family_name ASC');
$event_chairs = $pod->get_field('chairs', 'family_name ASC');
$event_moderators = $pod->get_field('moderators', 'family_name ASC');
$event_all_the_people = array_merge((array)$event_speakers, (array)$event_respondents, (array)$event_chairs, (array)$event_moderators);
echo var_trace($event_all_the_people, $TRACE_PREFIX, $TRACE_ENABLED);
$event_hashtag = ltrim($pod->get_field('hashtag'), '#');

$speakers_output = people_list($event_speakers, "Speaker", "Speakers");
$respondents_output = people_list($event_respondents, "Respondent", "Respondents");
$chairs_output = people_list($event_chairs, "Chair", "Chairs");
$moderators_output = people_list($event_moderators, "Moderator", "Moderators");

$people_with_blurb = $speakers_output['with_blurb'] + $respondents_output['with_blurb'] + $chairs_output['with_blurb'] + $moderators_output['with_blurb'];

$event_blurb = do_shortcode($pod->get_field('blurb'));
$event_blurb_after_event = do_shortcode($pod->get_field('blurb_after_event'));
echo var_trace('blurb_after_event', $event_blurb_after_event, $TRACE_PREFIX, $TRACE_ENABLED);
$event_contact_info = do_shortcode($pod->get_field('contact_info'));

$event_media = $pod->get_field('media_attachments');

$slider = $pod->get_field('slider');
if(!$slider) {
  $featured_image_uri = get_the_post_thumbnail(get_the_ID(), array(960,367));
}

// if this is an event, grab the image URI from the Pod
if(!$is_conference) {
  $featured_image_uri = $pod->get_field('heading_image.guid');
}

$event_date_string = $pod->get_field('date_freeform');
$event_date = new DateTime($pod->get_field('date_start'));
$datetime_now = new DateTime('now');
$is_future_event = ($event_date > $datetime_now) ? true : false;

$event_location = preg_replace('/<p>(.*?)<\/p>/', "$1", $pod->get_field('location'));
$event_series = $pod->get_field('event_series');
          
$poster_pdf = $pod->get_field('poster_pdf');
$poster_pdf = $poster_pdf[0]['guid'];
?>

<?php get_header(); ?>

<div role="main">

<?php if ( have_posts() ) : the_post(); endif; ?>

<div id="post-<?php the_ID(); ?>" <?php post_class('lc-article lc-event'); ?>>

<?php echo var_trace($speakers_output, $TRACE_PREFIX, $TRACE_ENABLED);
      echo var_trace($respondents_output, $TRACE_PREFIX, $TRACE_ENABLED);
      echo var_trace($chairs_output, $TRACE_PREFIX, $TRACE_ENABLED);
      echo var_trace($moderators_output, $TRACE_PREFIX, $TRACE_ENABLED);
?>

          <div class='ninecol' id='contentarea'>
            <div class='top-content'>
              <?php if($featured_image_uri) : ?>
              <header class='heading-image'>
                <div class='photospread wireframe'>
                  <img src="<?php echo $featured_image_uri; ?>" alt="event photo" />
                </div>
              </header>
              <?php endif; ?>
              <article class='wireframe eightcol'>
                <header>
                  <h1><?php echo $pod->get_field('name'); ?></h1>
                </header>
                <?php if($is_future_event): ?>
                  <?php if($event_blurb): ?>
                  <div class="blurb"><?php echo $event_blurb; ?></div>
                  <?php endif; ?>
                <?php else: ?>
                  <?php if($event_blurb_after_event): ?>
                  <div class="blurb after-event"><?php echo $event_blurb_after_event; ?></div>
                  <?php elseif($event_blurb): ?>
                  <div class="blurb"><?php echo $event_blurb; ?></div>
                  <?php endif; ?>
                <?php endif; // $is_future_event ?>
                <?php if($event_contact_info and $is_future_event): ?>
                  <aside class="booking-and-access"><?php echo $event_contact_info; ?></aside>
                <?php endif; ?>
              </article>
              <aside class='wireframe fourcol last' id='keyfacts'>
                <dl>
                    <?php echo $speakers_output['output'];
                          echo $respondents_output['output'];
                          echo $chairs_output['output'];
                          echo $moderators_output['output'];
                    ?>
                    
                    <?php if($event_date_string): ?>
                      <dt>When</dt>
                      <dd><?php echo $event_date_string; ?></dd>
                    <?php endif; ?>
              
                    <?php if($event_location): ?>
                      <dt>Where</dt>
                      <dd><?php echo $event_location; ?></dd>
                    <?php endif; ?>
              
                    <?php if($event_series): ?>
                      <dt>Event series</dt>
                      <dd><em><?php echo do_shortcode($pod->get_field('event_series')); ?></em></dd>
                    <?php endif; ?>

<!--
                    <?php if(false and $event_contact_info and $is_future_event): ?>
                      <dt>Access &amp; booking</dt>
                      <dd><?php echo $event_contact_info; ?></dd>
                    <?php endif; ?>
-->
{'fraction_non_alphanumeric': 0.1747111772627401, 'fraction_numerical': 0.002268055850875328, 'mean_word_length': 2.818673883626522, 'pattern_counts': {'":': 0, '<': 198, '<?xml version=': 0, '>': 250, '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': '891267', 'n_tokens_mistral': 4612, 'n_tokens_neox': 4547, 'n_words': 800}