-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');\r
-/**\r
- * CodeIgniter\r
- *\r
- * An open source application development framework for PHP 4.3.2 or newer\r
- *\r
- * @package CodeIgniter\r
- * @author ExpressionEngine Dev Team\r
- * @copyright Copyright (c) 2008, EllisLab, Inc.\r
- * @license http://codeigniter.com/user_guide/license.html\r
- * @link http://codeigniter.com\r
- * @since Version 1.0\r
- * @filesource\r
- */\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * CodeIgniter HTML Helpers\r
- *\r
- * @package CodeIgniter\r
- * @subpackage Helpers\r
- * @category Helpers\r
- * @author ExpressionEngine Dev Team\r
- * @link http://codeigniter.com/user_guide/helpers/html_helper.html\r
- */\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Heading\r
- *\r
- * Generates an HTML heading tag. First param is the data.\r
- * Second param is the size of the heading tag.\r
- *\r
- * @access public\r
- * @param string\r
- * @param integer\r
- * @return string\r
- */ \r
-if ( ! function_exists('heading'))\r
-{\r
- function heading($data = '', $h = '1')\r
- {\r
- return "<h".$h.">".$data."</h".$h.">";\r
- }\r
-}\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Unordered List\r
- *\r
- * Generates an HTML unordered list from an single or multi-dimensional array.\r
- *\r
- * @access public\r
- * @param array\r
- * @param mixed\r
- * @return string\r
- */ \r
-if ( ! function_exists('ul'))\r
-{\r
- function ul($list, $attributes = '')\r
- {\r
- return _list('ul', $list, $attributes);\r
- }\r
-}\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Ordered List\r
- *\r
- * Generates an HTML ordered list from an single or multi-dimensional array.\r
- *\r
- * @access public\r
- * @param array\r
- * @param mixed\r
- * @return string\r
- */ \r
-if ( ! function_exists('ol'))\r
-{\r
- function ol($list, $attributes = '')\r
- {\r
- return _list('ol', $list, $attributes);\r
- }\r
-}\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Generates the list\r
- *\r
- * Generates an HTML ordered list from an single or multi-dimensional array.\r
- *\r
- * @access private\r
- * @param string\r
- * @param mixed \r
- * @param mixed \r
- * @param intiger \r
- * @return string\r
- */ \r
-if ( ! function_exists('_list'))\r
-{\r
- function _list($type = 'ul', $list, $attributes = '', $depth = 0)\r
- {\r
- // If an array wasn't submitted there's nothing to do...\r
- if ( ! is_array($list))\r
- {\r
- return $list;\r
- }\r
- \r
- // Set the indentation based on the depth\r
- $out = str_repeat(" ", $depth);\r
- \r
- // Were any attributes submitted? If so generate a string\r
- if (is_array($attributes))\r
- {\r
- $atts = '';\r
- foreach ($attributes as $key => $val)\r
- {\r
- $atts .= ' ' . $key . '="' . $val . '"';\r
- }\r
- $attributes = $atts;\r
- }\r
- \r
- // Write the opening list tag\r
- $out .= "<".$type.$attributes.">\n";\r
-\r
- // Cycle through the list elements. If an array is \r
- // encountered we will recursively call _list()\r
-\r
- static $_last_list_item = '';\r
- foreach ($list as $key => $val)\r
- { \r
- $_last_list_item = $key;\r
-\r
- $out .= str_repeat(" ", $depth + 2);\r
- $out .= "<li>";\r
- \r
- if ( ! is_array($val))\r
- {\r
- $out .= $val;\r
- }\r
- else\r
- {\r
- $out .= $_last_list_item."\n";\r
- $out .= _list($type, $val, '', $depth + 4);\r
- $out .= str_repeat(" ", $depth + 2);\r
- }\r
-\r
- $out .= "</li>\n"; \r
- }\r
-\r
- // Set the indentation for the closing tag\r
- $out .= str_repeat(" ", $depth);\r
- \r
- // Write the closing list tag\r
- $out .= "</".$type.">\n";\r
-\r
- return $out;\r
- }\r
-}\r
- \r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Generates HTML BR tags based on number supplied\r
- *\r
- * @access public\r
- * @param integer\r
- * @return string\r
- */ \r
-if ( ! function_exists('br'))\r
-{\r
- function br($num = 1)\r
- {\r
- return str_repeat("<br />", $num);\r
- }\r
-}\r
- \r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Image\r
- *\r
- * Generates an <img /> element\r
- *\r
- * @access public\r
- * @param mixed\r
- * @return string\r
- */ \r
-if ( ! function_exists('img'))\r
-{\r
- function img($src = '', $index_page = FALSE)\r
- {\r
- if ( ! is_array($src) )\r
- {\r
- $src = array('src' => $src);\r
- }\r
-\r
- $img = '<img';\r
- \r
- foreach ($src as $k=>$v)\r
- {\r
-\r
- if ($k == 'src' AND strpos($v, '://') === FALSE)\r
- {\r
- $CI =& get_instance();\r
-\r
- if ($index_page === TRUE)\r
- {\r
- $img .= ' src="'.$CI->config->site_url($v).'" ';\r
- }\r
- else\r
- {\r
- $img .= ' src="'.$CI->config->slash_item('base_url').$v.'" ';\r
- }\r
- }\r
- else\r
- {\r
- $img .= " $k=\"$v\" ";\r
- }\r
- }\r
-\r
- $img .= '/>';\r
-\r
- return $img;\r
- }\r
-}\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Link\r
- *\r
- * Generates link to a CSS file\r
- *\r
- * @access public\r
- * @param mixed stylesheet hrefs or an array\r
- * @param string rel\r
- * @param string type\r
- * @param string title\r
- * @param string media\r
- * @param boolean should index_page be added to the css path \r
- * @return string\r
- */ \r
-if ( ! function_exists('link_tag'))\r
-{\r
- function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)\r
- {\r
- $CI =& get_instance();\r
-\r
- $link = '<link ';\r
-\r
- if (is_array($href))\r
- {\r
- foreach ($href as $k=>$v)\r
- {\r
- if ($k == 'href' AND strpos($v, '://') === FALSE)\r
- {\r
- if ($index_page === TRUE)\r
- {\r
- $link .= ' href="'.$CI->config->site_url($v).'" ';\r
- }\r
- else\r
- {\r
- $link .= ' href="'.$CI->config->slash_item('base_url').$v.'" ';\r
- }\r
- }\r
- else\r
- {\r
- $link .= "$k=\"$v\" ";\r
- }\r
- }\r
- \r
- $link .= "/>";\r
- }\r
- else\r
- {\r
- if ( strpos($href, '://') !== FALSE)\r
- {\r
- $link .= ' href="'.$href.'" ';\r
- }\r
- elseif ($index_page === TRUE)\r
- {\r
- $link .= ' href="'.$CI->config->site_url($href).'" ';\r
- }\r
- else\r
- {\r
- $link .= ' href="'.$CI->config->slash_item('base_url').$href.'" ';\r
- }\r
- \r
- $link .= 'rel="'.$rel.'" type="'.$type.'" ';\r
- \r
- if ($media != '')\r
- {\r
- $link .= 'media="'.$media.'" ';\r
- }\r
-\r
- if ($title != '')\r
- {\r
- $link .= 'title="'.$title.'" ';\r
- }\r
- \r
- $link .= '/>';\r
- }\r
-\r
- \r
- return $link;\r
- }\r
-}\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Generates meta tags from an array of key/values\r
- *\r
- * @access public\r
- * @param array\r
- * @return string\r
- */ \r
-if ( ! function_exists('meta'))\r
-{\r
- function meta($name = '', $content = '', $type = 'name', $newline = "\n")\r
- {\r
- // Since we allow the data to be passes as a string, a simple array\r
- // or a multidimensional one, we need to do a little prepping.\r
- if ( ! is_array($name))\r
- {\r
- $name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline));\r
- }\r
- else\r
- {\r
- // Turn single array into multidimensional\r
- if (isset($name['name']))\r
- {\r
- $name = array($name);\r
- }\r
- }\r
- \r
- $str = '';\r
- foreach ($name as $meta)\r
- {\r
- $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';\r
- $name = ( ! isset($meta['name'])) ? '' : $meta['name'];\r
- $content = ( ! isset($meta['content'])) ? '' : $meta['content'];\r
- $newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline'];\r
- \r
- $str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;\r
- }\r
-\r
- return $str;\r
- }\r
-}\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Generates non-breaking space entities based on number supplied\r
- *\r
- * @access public\r
- * @param integer\r
- * @return string\r
- */ \r
-if ( ! function_exists('nbs'))\r
-{\r
- function nbs($num = 1)\r
- {\r
- return str_repeat(" ", $num);\r
- }\r
-}\r
-\r
-\r
-/* End of file html_helper.php */\r
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter HTML Helpers
+ *
+ * @package CodeIgniter
+ * @subpackage Helpers
+ * @category Helpers
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/helpers/html_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Heading
+ *
+ * Generates an HTML heading tag. First param is the data.
+ * Second param is the size of the heading tag.
+ *
+ * @access public
+ * @param string
+ * @param integer
+ * @return string
+ */
+if ( ! function_exists('heading'))
+{
+ function heading($data = '', $h = '1')
+ {
+ return "<h".$h.">".$data."</h".$h.">";
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Unordered List
+ *
+ * Generates an HTML unordered list from an single or multi-dimensional array.
+ *
+ * @access public
+ * @param array
+ * @param mixed
+ * @return string
+ */
+if ( ! function_exists('ul'))
+{
+ function ul($list, $attributes = '')
+ {
+ return _list('ul', $list, $attributes);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Ordered List
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @access public
+ * @param array
+ * @param mixed
+ * @return string
+ */
+if ( ! function_exists('ol'))
+{
+ function ol($list, $attributes = '')
+ {
+ return _list('ol', $list, $attributes);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates the list
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @access private
+ * @param string
+ * @param mixed
+ * @param mixed
+ * @param intiger
+ * @return string
+ */
+if ( ! function_exists('_list'))
+{
+ function _list($type = 'ul', $list, $attributes = '', $depth = 0)
+ {
+ // If an array wasn't submitted there's nothing to do...
+ if ( ! is_array($list))
+ {
+ return $list;
+ }
+
+ // Set the indentation based on the depth
+ $out = str_repeat(" ", $depth);
+
+ // Were any attributes submitted? If so generate a string
+ if (is_array($attributes))
+ {
+ $atts = '';
+ foreach ($attributes as $key => $val)
+ {
+ $atts .= ' ' . $key . '="' . $val . '"';
+ }
+ $attributes = $atts;
+ }
+
+ // Write the opening list tag
+ $out .= "<".$type.$attributes.">\n";
+
+ // Cycle through the list elements. If an array is
+ // encountered we will recursively call _list()
+
+ static $_last_list_item = '';
+ foreach ($list as $key => $val)
+ {
+ $_last_list_item = $key;
+
+ $out .= str_repeat(" ", $depth + 2);
+ $out .= "<li>";
+
+ if ( ! is_array($val))
+ {
+ $out .= $val;
+ }
+ else
+ {
+ $out .= $_last_list_item."\n";
+ $out .= _list($type, $val, '', $depth + 4);
+ $out .= str_repeat(" ", $depth + 2);
+ }
+
+ $out .= "</li>\n";
+ }
+
+ // Set the indentation for the closing tag
+ $out .= str_repeat(" ", $depth);
+
+ // Write the closing list tag
+ $out .= "</".$type.">\n";
+
+ return $out;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates HTML BR tags based on number supplied
+ *
+ * @access public
+ * @param integer
+ * @return string
+ */
+if ( ! function_exists('br'))
+{
+ function br($num = 1)
+ {
+ return str_repeat("<br />", $num);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Image
+ *
+ * Generates an <img /> element
+ *
+ * @access public
+ * @param mixed
+ * @return string
+ */
+if ( ! function_exists('img'))
+{
+ function img($src = '', $index_page = FALSE)
+ {
+ if ( ! is_array($src) )
+ {
+ $src = array('src' => $src);
+ }
+
+ $img = '<img';
+
+ foreach ($src as $k=>$v)
+ {
+
+ if ($k == 'src' AND strpos($v, '://') === FALSE)
+ {
+ $CI =& get_instance();
+
+ if ($index_page === TRUE)
+ {
+ $img .= ' src="'.$CI->config->site_url($v).'" ';
+ }
+ else
+ {
+ $img .= ' src="'.$CI->config->slash_item('base_url').$v.'" ';
+ }
+ }
+ else
+ {
+ $img .= " $k=\"$v\" ";
+ }
+ }
+
+ $img .= '/>';
+
+ return $img;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Link
+ *
+ * Generates link to a CSS file
+ *
+ * @access public
+ * @param mixed stylesheet hrefs or an array
+ * @param string rel
+ * @param string type
+ * @param string title
+ * @param string media
+ * @param boolean should index_page be added to the css path
+ * @return string
+ */
+if ( ! function_exists('link_tag'))
+{
+ function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
+ {
+ $CI =& get_instance();
+
+ $link = '<link ';
+
+ if (is_array($href))
+ {
+ foreach ($href as $k=>$v)
+ {
+ if ($k == 'href' AND strpos($v, '://') === FALSE)
+ {
+ if ($index_page === TRUE)
+ {
+ $link .= ' href="'.$CI->config->site_url($v).'" ';
+ }
+ else
+ {
+ $link .= ' href="'.$CI->config->slash_item('base_url').$v.'" ';
+ }
+ }
+ else
+ {
+ $link .= "$k=\"$v\" ";
+ }
+ }
+
+ $link .= "/>";
+ }
+ else
+ {
+ if ( strpos($href, '://') !== FALSE)
+ {
+ $link .= ' href="'.$href.'" ';
+ }
+ elseif ($index_page === TRUE)
+ {
+ $link .= ' href="'.$CI->config->site_url($href).'" ';
+ }
+ else
+ {
+ $link .= ' href="'.$CI->config->slash_item('base_url').$href.'" ';
+ }
+
+ $link .= 'rel="'.$rel.'" type="'.$type.'" ';
+
+ if ($media != '')
+ {
+ $link .= 'media="'.$media.'" ';
+ }
+
+ if ($title != '')
+ {
+ $link .= 'title="'.$title.'" ';
+ }
+
+ $link .= '/>';
+ }
+
+
+ return $link;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates meta tags from an array of key/values
+ *
+ * @access public
+ * @param array
+ * @return string
+ */
+if ( ! function_exists('meta'))
+{
+ function meta($name = '', $content = '', $type = 'name', $newline = "\n")
+ {
+ // Since we allow the data to be passes as a string, a simple array
+ // or a multidimensional one, we need to do a little prepping.
+ if ( ! is_array($name))
+ {
+ $name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline));
+ }
+ else
+ {
+ // Turn single array into multidimensional
+ if (isset($name['name']))
+ {
+ $name = array($name);
+ }
+ }
+
+ $str = '';
+ foreach ($name as $meta)
+ {
+ $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
+ $name = ( ! isset($meta['name'])) ? '' : $meta['name'];
+ $content = ( ! isset($meta['content'])) ? '' : $meta['content'];
+ $newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline'];
+
+ $str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
+ }
+
+ return $str;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates non-breaking space entities based on number supplied
+ *
+ * @access public
+ * @param integer
+ * @return string
+ */
+if ( ! function_exists('nbs'))
+{
+ function nbs($num = 1)
+ {
+ return str_repeat(" ", $num);
+ }
+}
+
+
+/* End of file html_helper.php */
/* Location: ./system/helpers/html_helper.php */
\ No newline at end of file