<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	if(!function_exists('find_images'))
	{
		function find_images($string)
		{
			preg_match('/<img.+src=[\'"](?P<src>.+?)[\'"].*>/i', $string, $image);
			
			if($image == TRUE)
			{
				return $image['src'];	
			}
			else
			{
				return base_url('assets/img/no_image_available.jpg');
			}
		}
	}
	
	if(!function_exists('public_url'))
	{
		function public_url($path = NULL) {
		  return base_url() . $path . '.html';
		}	
	}
	
	if (!function_exists('clean')) 
	{
		function clean($string) 
		{
			$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
			$url = pathinfo($string, PATHINFO_FILENAME);
			if($url == TRUE)
			{
				$filename = $url;
			}
			else
			{
				$filename = $string;
			}
			
			return preg_replace('/[^A-Za-z0-9\-]/', '', $filename); // Removes special chars.
		}
	}