Skip to content

Instantly share code, notes, and snippets.

@apatton-cnet
Created March 11, 2014 17:50
Show Gist options
  • Save apatton-cnet/9491197 to your computer and use it in GitHub Desktop.
Save apatton-cnet/9491197 to your computer and use it in GitHub Desktop.
Lines 60-64 are looping indefinitely
<? $ebs_seo_cp_hours = array(
'Sunday' => array(
'closed' => $ebs_seo_cp_hours_sunday_check_open,
'shortname' => 'Su',
'open' => $ebs_seo_cp_hours_sunday_open,
'close' => $ebs_seo_cp_hours_sunday_close,
'label' => $ebs_seo_cp_hours_sunday_label
),
'Monday' => array(
'closed' => $ebs_seo_cp_hours_monday_check_open,
'shortname' => 'Mo',
'open' => $ebs_seo_cp_hours_monday_open,
'close' => $ebs_seo_cp_hours_monday_close,
'label' => $ebs_seo_cp_hours_monday_label
),
'Tuesday' => array(
'closed' => $ebs_seo_cp_hours_tuesday_check_open,
'shortname' => 'Tu',
'open' => $ebs_seo_cp_hours_tuesday_open,
'close' => $ebs_seo_cp_hours_tuesday_close,
'label' => $ebs_seo_cp_hours_tuesday_label
),
'Wednesday' => array(
'closed' => $ebs_seo_cp_hours_wednesday_check_open,
'shortname' => 'We',
'open' => $ebs_seo_cp_hours_wednesday_open,
'close' => $ebs_seo_cp_hours_wednesday_close,
'label' => $ebs_seo_cp_hours_wednesday_label
),
'Thursday' => array(
'closed' => $ebs_seo_cp_hours_thursday_check_open,
'shortname' => 'Th',
'open' => $ebs_seo_cp_hours_thursday_open,
'close' => $ebs_seo_cp_hours_thursday_close,
'label' => $ebs_seo_cp_hours_thursday_label
),
'Friday' => array(
'closed' => $ebs_seo_cp_hours_friday_check_open,
'shortname' => 'Fr',
'open' => $ebs_seo_cp_hours_friday_open,
'close' => $ebs_seo_cp_hours_friday_close,
'label' => $ebs_seo_cp_hours_friday_label
),
'Saturday' => array(
'closed' => $ebs_seo_cp_hours_saturday_check_open,
'shortname' => 'Sa',
'open' => $ebs_seo_cp_hours_saturday_open,
'close' => $ebs_seo_cp_hours_saturday_close,
'label' => $ebs_seo_cp_hours_saturday_label
),
);
$hours_blob = '';
if ( $wrap == true ) {
$hours_blob .= ebs_seo_cp_header();
}
if ( $ebs_seo_cp_hours_heading ) {
$hours_blob .= '<span class="ebs-seo-cp-hours">' . $ebs_seo_cp_hours_heading . '</span>' . '<br />';
}
while ( list( $key, $day ) = each( $ebs_seo_cp_hours ) ) {
while ( $key != $ebs_seo_cp_hours_startday ) {
$orphan_day = array_shift( $ebs_seo_cp_hours );
array_push( $ebs_seo_cp_hours, $orphan_day );
reset();
}
if ( !$day['closed'] == 'on' ) {
$shorthours = '00:00-00:00';
$longhours = __( 'Closed', 'ebs_seo_cp' );
$open = '00:00';
$close = '00:00';
} else {
$shorthours = $day['open'] . '-' . $day['close'];
if ( $ebs_seo_cp_hours_24h == 'on' ) {
$longhours = date( 'G:i', strtotime( $day['open'] ) ) . ' - ' . date( 'G:i', strtotime( $day['close'] ) );
} else {
$longhours = date( 'g:i a', strtotime( $day['open'] ) ) . ' - ' . date( 'g:i a', strtotime( $day['close'] ) );
}
$open = $day['open'];
$close = $day['close'];
}
$dayname = $key;
$shortname = $day['shortname'];
$daylabel = $day['label'];
$hours_blob .= '
<span class="ebs-seo-cp-dayname">' . $daylabel. ' :</span> <time itemprop="openinghours" datetime="' . $shortname . ' ' . $shorthours . '">' . $longhours . '</time>
<div itemprop="openingHoursSpecification" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#' . $dayname . '" />
<meta itemprop="opens" content="' . $open . '" />
<meta itemprop="closes" content="' . $close . '" />
</div>';
}
if ( $wrap == true ) {
$hours_blob .= ebs_seo_cp_footer();
}
return $hours_blob; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment