diff options
Diffstat (limited to 'system/libraries/Javascript.php')
-rw-r--r-- | system/libraries/Javascript.php | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php index 9ba93000b..baa044117 100644 --- a/system/libraries/Javascript.php +++ b/system/libraries/Javascript.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Javascript Class * @@ -46,7 +44,7 @@ class CI_Javascript { foreach ($defaults as $key => $val) { - if (isset($params[$key]) && $params[$key] !== "") + if (isset($params[$key]) && $params[$key] !== '') { $defaults[$key] = $params[$key]; } @@ -61,7 +59,7 @@ class CI_Javascript { // make js to refer to current library $this->js =& $this->CI->$js_library_driver; - log_message('debug', "Javascript Class Initialized and loaded. Driver used: $js_library_driver"); + log_message('debug', 'Javascript Class Initialized and loaded. Driver used: '.$js_library_driver); } // -------------------------------------------------------------------- @@ -375,7 +373,6 @@ class CI_Javascript { // Effects // -------------------------------------------------------------------- - /** * Add Class * @@ -618,12 +615,9 @@ class CI_Javascript { { $this->_javascript_location = $external_file; } - else + elseif ($this->CI->config->item('javascript_location') != '') { - if ($this->CI->config->item('javascript_location') != '') - { - $this->_javascript_location = $this->CI->config->item('javascript_location'); - } + $this->_javascript_location = $this->CI->config->item('javascript_location'); } if ($relative === TRUE OR strncmp($external_file, 'http://', 7) === 0 OR strncmp($external_file, 'https://', 8) === 0) @@ -656,7 +650,7 @@ class CI_Javascript { public function inline($script, $cdata = TRUE) { return $this->_open_script() - . ($cdata ? "\n// <![CDATA[\n{$script}\n// ]]>\n" : "\n{$script}\n") + . ($cdata ? "\n// <![CDATA[\n".$script."\n// ]]>\n" : "\n".$script."\n") . $this->_close_script(); } @@ -673,7 +667,7 @@ class CI_Javascript { protected function _open_script($src = '') { return '<script type="text/javascript" charset="'.strtolower($this->CI->config->item('charset')).'"' - . ($src == '' ? '>' : ' src="'.$src.'">'); + .($src == '' ? '>' : ' src="'.$src.'">'); } // -------------------------------------------------------------------- @@ -688,15 +682,12 @@ class CI_Javascript { */ protected function _close_script($extra = "\n") { - return "</script>$extra"; + return '</script>'.$extra; } - - // -------------------------------------------------------------------- // -------------------------------------------------------------------- // AJAX-Y STUFF - still a testbed // -------------------------------------------------------------------- - // -------------------------------------------------------------------- /** * Update @@ -751,9 +742,9 @@ class CI_Javascript { $json = array(); $_is_assoc = TRUE; - if ( ! is_array($json_result) AND empty($json_result)) + if ( ! is_array($json_result) && empty($json_result)) { - show_error("Generate JSON Failed - Illegal key, value pair."); + show_error('Generate JSON Failed - Illegal key, value pair.'); } elseif ($match_array_type) { @@ -774,7 +765,7 @@ class CI_Javascript { $json = implode(',', $json); - return $_is_assoc ? "{".$json."}" : "[".$json."]"; + return $_is_assoc ? '{'.$json.'}' : '['.$json.']'; } @@ -785,8 +776,8 @@ class CI_Javascript { * * Checks for an associative array * - * @param type - * @return type + * @param array + * @return bool */ protected function _is_associative_array($arr) { @@ -808,8 +799,8 @@ class CI_Javascript { * * Ensures a standard json value and escapes values * - * @param type - * @return type + * @param mixed + * @return string */ protected function _prep_args($result, $is_key = FALSE) { @@ -831,9 +822,7 @@ class CI_Javascript { } } - // -------------------------------------------------------------------- } -// END Javascript Class /* End of file Javascript.php */ -/* Location: ./system/libraries/Javascript.php */ +/* Location: ./system/libraries/Javascript.php */
\ No newline at end of file |