/** * @return BfoxRefController */ static function sharedInstance() { if (is_null(self::$_sharedInstance)) { self::$_sharedInstance = new BfoxRefController(); } return self::$_sharedInstance; }
function bfox_ref_link($ref_str, $options = array()) { if (empty($ref_str)) { return false; } $defaults = array('href' => '', 'class' => array(), 'text' => $ref_str); $refController = BfoxRefController::sharedInstance(); $defaults = wp_parse_args($refController->currentDefaults(), $defaults); extract(wp_parse_args($options, $defaults)); // href if (empty($href)) { $href = bfox_ref_url($ref_str); } $attrs['href'] = $href; // class $class = (array) $class; $class[] = $attrs['class']; $attrs['class'] = implode(' ', $class); if (!isset($attrs['data-ref'])) { $attrs['data-ref'] = $ref_str; } // Attribute string $attr_str = ''; foreach ($attrs as $attr => $value) { $attr_str .= " {$attr}='{$value}'"; } return "<a{$attr_str}>{$text}</a>"; }
function pop_bfox_ref_link_defaults() { $refController = BfoxRefController::sharedInstance(); $refController->popLinkDefaults(); }