diff --git a/application/config/autoload.php b/application/config/autoload.php index c366f44..7a8bab8 100755 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -64,7 +64,7 @@ $autoload['libraries'] = array('lang_detect', 'database', 'session'); | $autoload['helper'] = array('url', 'file'); */ -$autoload['helper'] = array('url', 'html', 'script', 'language'); +$autoload['helper'] = array('url', 'html', 'language'); /* diff --git a/application/helpers/MY_html_helper.php b/application/helpers/MY_html_helper.php new file mode 100644 index 0000000..3684b27 --- /dev/null +++ b/application/helpers/MY_html_helper.php @@ -0,0 +1,58 @@ + + */ + +/** + * Generates a script inclusion of a JavaScript file. + * + * Based on the CI's original link_tag. + * + * @access public + * @param mixed $src JavaScript sources or an array + * @param string $language Language + * @param string $type Type + * @param boolean $index_page Should index_page be added to the JavaScript path + * @return string + */ +if (!function_exists('script_tag')) { + function script_tag($src = '', $language = 'javascript', $type = 'text/javascript', $index_page = false) { + $CI =& get_instance(); + + $script = ' $v) { + if ($k == 'src' && strpos($v, '://') === false) { + if ($index_page === true) { + $script .= ' src="' . $CI->config->site_url($v) . '"'; + } else { + $script .= ' src="' . $CI->config->slash_item('base_url') . $v . '"'; + } + } else { + $script .= "$k=\"$v\""; + } + } + + $script .= ">\n"; + } else { + if (strpos($src, '://') !== false) { + $script .= ' src="' . $src . '" '; + } else if ($index_page === true) { + $script .= ' src="' . $CI->config->site_url($src) . '" '; + } else { + $script .= ' src="' . $CI->config->slash_item('base_url') . $src . '" '; + } + + $script .= 'language="' . $language . '" type="' . $type . '"'; + $script .= ">\n"; + } + + return $script; + } +} + +/* End of file MY_html_helper.php */ +/* Location: ./application/helpers/MY_html_helper.php */ diff --git a/application/helpers/script_helper.php b/application/helpers/script_helper.php deleted file mode 100644 index 6ae686a..0000000 --- a/application/helpers/script_helper.php +++ /dev/null @@ -1,53 +0,0 @@ - $v) { - if ($k == 'src' && strpos($v, '://') === false) { - if ($index_page === true) { - $script .= ' src="' . $CI->config->site_url($v) . '"'; - } else { - $script .= ' src="' . $CI->config->slash_item('base_url') . $v . '"'; - } - } else { - $script .= "$k=\"$v\""; - } - } - - $script .= ">\n"; - } else { - if (strpos($src, '://') !== false) { - $script .= ' src="' . $src . '" '; - } else if ($index_page === true) { - $script .= ' src="' . $CI->config->site_url($src) . '" '; - } else { - $script .= ' src="' . $CI->config->slash_item('base_url') . $src . '" '; - } - - $script .= 'language="' . $language . '" type="' . $type . '"'; - $script .= ">\n"; - } - - return $script; - } -} - -/* End of file javascript_helper.php */ -/* Location: ./application/helpers/javascript_helper.php */