/**
 * RSS2 Feed Template for displaying RSS2 Reading Plan Readings feed.
 */
function bfox_plan_reading_content_rss($reading_id, $post_id = 0)
{
    $note = bfox_plan_reading_note($reading_id, $post_id);
    if ($note) {
        $note = '<br/>' . $note;
    }
    $content = sprintf(__('<p>Bible Passage: <a href="%s">%s</a>%s</p>', 'bfox'), bfox_plan_reading_url($reading_id), bfox_plan_reading_ref_str($reading_id), $note);
    $content = str_replace(']]>', ']]&gt;', $content);
    return $content;
}
/**
 * Outputs an HTML list of readings for a reading plan
 *
 * @param array $args
 */
function bfox_plan_reading_list($args = array())
{
    $defaults = array('post_id' => 0, 'user_id' => 0, 'from_reading' => 0, 'to_reading' => -1, 'max_count' => 0, 'column_class' => 'reading-list-3c-h', 'date_format' => 'M j, Y');
    extract(wp_parse_args($args, $defaults));
    $reading_count = bfox_plan_reading_count($post_id);
    if (0 > $from_reading) {
        $from_reading += $reading_count;
    }
    // Adjust the max_count
    if (0 >= $max_count) {
        $max_count = $reading_count;
    }
    $max_count = min($max_count, $reading_count - $from_reading);
    // Adjust the to_reading
    if (0 > $to_reading) {
        $to_reading += $from_reading + $max_count;
    }
    if ($to_reading < $from_reading) {
        $to_reading = $from_reading + $max_count - 1;
    }
    // Adjust the count
    $count = $to_reading - $from_reading + 1;
    if ($count > $max_count) {
        $to_reading = $from_reading + $max_count - 1;
        $count = $max_count;
    }
    if ($count) {
        ?>
	<ol class="reading-list <?php 
        echo $column_class;
        ?>
" start="<?php 
        echo $from_reading + 1;
        ?>
">
	<?php 
        for ($reading_id = $from_reading; $reading_id <= $to_reading; $reading_id++) {
            ?>
		<li>
			<div class="reading-info">
			<?php 
            if (bfox_plan_is_scheduled($post_id)) {
                ?>
				<span class="reading-date"><?php 
                echo bfox_plan_reading_date($reading_id, $date_format, $post_id);
                ?>
</span>
			<?php 
            }
            ?>
				<span class="reading-ref"><?php 
            echo bfox_ref_link(bfox_plan_reading_ref_str($reading_id, $post_id, BibleMeta::name_short));
            ?>
</span>
				<span class="reading-note"><?php 
            echo bfox_plan_reading_note($reading_id, $post_id);
            ?>
</span>
			</div>
		</li>
	<?php 
        }
        ?>
	</ol>
<?php 
    }
    return $count;
}