/** * 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(']]>', ']]>', $content); return $content; }
function bfox_plan_reading_shortcode($atts) { // [bible-reading plan="cbr" intersects="old"] extract(shortcode_atts(array('post_id' => 0, 'reading' => 'latest', 'intersects' => '', 'tool' => ''), $atts)); if (empty($post_id)) { return; } if ($reading == 'latest') { $reading = bfox_plan_latest_reading($post_id); } $reading_id = intval($reading); if ($reading_id >= bfox_plan_reading_count($post_id)) { return; } $ref_str = bfox_plan_reading_ref_str($reading_id, $post_id); if (!empty($intersects)) { $ref = new BfoxRef($ref_str); $sub = new BibleGroupPassage('bible'); $sub->sub_ref(new BibleGroupPassage($intersects)); $ref->sub_ref($sub); $ref_str = $ref->get_string(); } $link = bfox_ref_link($ref_str); $content = $link; if (!empty($tool)) { $passage = bfox_tool_shortcode(array('tool' => $tool, 'ref' => $ref_str)); $content = "{$link} {$passage}"; } 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; }