Пример #1
0
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;
}
 /**
  * Returns a string of links for the passed in Bible reference, uses separate links for each individual range of verses
  *
  * Example: Genesis 1-2,4 would become two separate links [Genesis 1-2]; [Genesis 4] because chapters 1-2 are not contiguous with chapter 4
  * For returning [Genesis 1-2,4] use the link() function
  *
  * @param mixed $ref string or BfoxRef
  * @param array $attributes Attributes for the links
  * @return string
  */
 function links($ref, $attributes = array())
 {
     if (!is_a($ref, 'BfoxRef')) {
         $ref = new BfoxRef($ref);
     }
     $serializer = new BfoxRefSerializer();
     $serializer->setCombineNone();
     $elements = $serializer->elementsForRef($ref);
     $linksString = '';
     foreach ($elements as $index => $element) {
         if ($index % 2 == 0) {
             $linksString .= $this->link($element, $attributes);
         } else {
             $linksString .= $element;
         }
     }
     return $linksString;
 }