Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('BASEPATH') or exit('No direct script access allowed');
- /**
- * Anchor Link
- *
- * Creates an anchor based on the local URL.
- *
- * @access public
- * @param string the URL
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
- if ( ! function_exists('anchor'))
- {
- function anchor($uri = '', $title = '', $attributes = '', $relative = FALSE)
- {
- $title = (string) $title;
- if ( $relative === TRUE)
- {
- $site_url = is_array($uri) ? implode('/', $uri) : $uri;
- }
- elseif ( ! is_array($uri))
- {
- $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
- }
- else
- {
- $site_url = site_url($uri);
- }
- if ($title == '')
- {
- $title = $site_url;
- }
- if ($attributes != '')
- {
- $attributes = _parse_attributes($attributes);
- }
- return '<a href="'.$site_url.'"'.$attributes.'>'.$title.'</a>';
- }
- }
Add Comment
Please, Sign In to add comment