<?php
defined('BASEPATH') OR exit('No direct script access allowed');
if ( ! function_exists('safe_anchor'))
{
/**
* Safe Anchor Link
*
* Creates an anchor based on the local URL.
*
* @param string the URL
* @param string append id
* @param string the link title
* @param mixed any attributes
* @return string
*/
function safe_anchor($uri = '', $id = '', $title = '', $attributes = '')
{
$id = (array) $id;
$title = (string) $title;
$ids = array();
if( !empty($id) )
{
foreach($id as $value)
{
if( !empty($value) )
{
$ids[] = urlencode($value);
}
}
}
if( !empty($ids) )
{
$uri .= '/' . implode('/',$ids);
}
if($title !== '')
{
$title = html_escape($title);
}
return anchor($uri, $title, $attributes);
}
}
if ( ! function_exists('icon_anchor'))
{
/**
* Icon Anchor Link
*
* Creates an anchor based on the local URL.
*
* @param string the URL
* @param string append id
* @param string the link title
* @param mixed any attributes
* @return string
*/
function icon_anchor($uri = '', $id = '', $title = '', $attributes = '')
{
$id = (array) $id;
$title = (string) $title;
$ids = array();
if( !empty($id) )
{
foreach($id as $value)
{
if( !empty($value) )
{
$ids[] = urlencode($value);
}
}
}
if( !empty($ids) )
{
$uri .= '/' . implode('/',$ids);
}
return anchor($uri, $title, $attributes);
}
}