function bfox_ref_links(BfoxRef $ref, $options = array()) { $serializer = new BfoxRefSerializer(); $serializer->setCombineNone(); $elements = $serializer->elementsForRef($ref); $str = ''; foreach ($elements as $index => $element) { if ($index % 2 == 0) { $str .= bfox_ref_link($element, $options); } else { $str .= $element; } } return $str; }
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; }
/** * The template for displaying Bible Tool iFrames. * * iFrames are used to display Bible Tool content, while allowing the user to select which tool they want to use. * */ ?> <div class="bfox-tool-iframe"> <div class='passage-nav'> <?php echo bfox_ref_link(bfox_previous_chapter_ref_str(), array('class' => 'ref_prev', 'tooltip' => false)); ?> <?php echo bfox_ref_link(bfox_next_chapter_ref_str(), array('class' => 'ref_next', 'tooltip' => false)); ?> </div> <?php echo bfox_tool_iframe_select(); ?> <?php the_selected_bfox_tool_post(); // Resets post data to the bible tool that is currently selected ?> <iframe class="bfox-iframe bfox-tooltip-iframe" src="<?php echo bfox_tool_source_url(); ?> "></iframe> </div>
/** * Finds any bible references in an array of tag links and adds tooltips to them * * Should be used to filter 'term_links-post_tag', called in get_the_term_list() * * @param array $tag_links * @return array */ function bfox_add_tag_ref_tooltips($tag_links) { if (!empty($tag_links)) { foreach ($tag_links as &$tag_link) { if (preg_match('/<a.*>(.*)<\\/a>/', $tag_link, $matches)) { $tag = $matches[1]; $ref = bfox_ref_from_tag($tag); if ($ref->is_valid()) { $tag_link = bfox_ref_link($ref->get_string(), array('text' => $tag)); } } } } return $tag_links; }
echo bfox_ref_link(bfox_previous_chapter_ref_str()); ?> </div> <div class="nav-next"><?php echo bfox_ref_link(bfox_next_chapter_ref_str()); ?> </div> </nav><!-- #nav-above --> <div class="entry-content"> <?php $tool->echoContentForRef(bfox_ref()); ?> </div><!-- .entry-content --> <nav class='passage-nav'> <div class="nav-previous"><?php echo bfox_ref_link(bfox_previous_chapter_ref_str()); ?> </div> <div class="nav-next"><?php echo bfox_ref_link(bfox_next_chapter_ref_str()); ?> </div> </nav><!-- #nav-above --> </article><!-- #bfox_bible-<?php echo $tool->shortName; ?> -->
function bfox_ref_replace_html_cb($text, $ref) { return bfox_ref_link($ref->get_string(), array('text' => $text)); }