From f4a4bd8fac188ebc9cda822ffc811c218fd92b45 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Thu, 20 Oct 2011 12:18:42 -0500 Subject: adding new license file (OSL 3.0) and updating readme to ReST added notice of license to all source files. OSL to all except the few files we ship inside of the application folder, those are AFL. Updated license in user guide. incrementing next dev version to 3.0 due to licensing change --- system/libraries/javascript/Jquery.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index baab83d25..4b8f76a10 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -1,27 +1,40 @@ Date: Sun, 25 Dec 2011 19:13:48 +0200 Subject: Improve the Javascript & Jquery libs --- system/libraries/javascript/Jquery.php | 436 ++++++++++++++++----------------- 1 file changed, 205 insertions(+), 231 deletions(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 4b8f76a10..05057bec2 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -1,13 +1,13 @@ -CI =& get_instance(); + $this->CI =& get_instance(); extract($params); if ($autoload === TRUE) { - $this->script(); + $this->script(); } - + log_message('debug', "Jquery Class Initialized"); } - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Event Code - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /** * Blur * * Outputs a jQuery blur event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _blur($element = 'this', $js = '') + protected function _blur($element = 'this', $js = '') { return $this->_add_event($element, $js, 'blur'); } - + // -------------------------------------------------------------------- - + /** * Change * * Outputs a jQuery change event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _change($element = 'this', $js = '') + protected function _change($element = 'this', $js = '') { return $this->_add_event($element, $js, 'change'); } - + // -------------------------------------------------------------------- - + /** * Click * * Outputs a jQuery click event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @param boolean whether or not to return false * @return string */ - function _click($element = 'this', $js = '', $ret_false = TRUE) + protected function _click($element = 'this', $js = '', $ret_false = TRUE) { if ( ! is_array($js)) { @@ -125,70 +125,70 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Double Click * * Outputs a jQuery dblclick event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _dblclick($element = 'this', $js = '') + protected function _dblclick($element = 'this', $js = '') { return $this->_add_event($element, $js, 'dblclick'); } // -------------------------------------------------------------------- - + /** * Error * * Outputs a jQuery error event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _error($element = 'this', $js = '') + protected function _error($element = 'this', $js = '') { return $this->_add_event($element, $js, 'error'); } // -------------------------------------------------------------------- - + /** * Focus * * Outputs a jQuery focus event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _focus($element = 'this', $js = '') + protected function _focus($element = 'this', $js = '') { return $this->_add_event($element, $js, 'focus'); } // -------------------------------------------------------------------- - + /** * Hover * * Outputs a jQuery hover event * - * @access private + * @access protected * @param string - element * @param string - Javascript code for mouse over * @param string - Javascript code for mouse out * @return string */ - function _hover($element = 'this', $over, $out) + protected function _hover($element = 'this', $over, $out) { $event = "\n\t$(" . $this->_prep_element($element) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; @@ -198,103 +198,103 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Keydown * * Outputs a jQuery keydown event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _keydown($element = 'this', $js = '') + protected function _keydown($element = 'this', $js = '') { return $this->_add_event($element, $js, 'keydown'); } // -------------------------------------------------------------------- - + /** * Keyup * * Outputs a jQuery keydown event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _keyup($element = 'this', $js = '') + protected function _keyup($element = 'this', $js = '') { return $this->_add_event($element, $js, 'keyup'); - } + } // -------------------------------------------------------------------- - + /** * Load * * Outputs a jQuery load event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _load($element = 'this', $js = '') + protected function _load($element = 'this', $js = '') { return $this->_add_event($element, $js, 'load'); - } - + } + // -------------------------------------------------------------------- - + /** * Mousedown * * Outputs a jQuery mousedown event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _mousedown($element = 'this', $js = '') + protected function _mousedown($element = 'this', $js = '') { return $this->_add_event($element, $js, 'mousedown'); } // -------------------------------------------------------------------- - + /** * Mouse Out * * Outputs a jQuery mouseout event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _mouseout($element = 'this', $js = '') + protected function _mouseout($element = 'this', $js = '') { return $this->_add_event($element, $js, 'mouseout'); } // -------------------------------------------------------------------- - + /** * Mouse Over * * Outputs a jQuery mouseover event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _mouseover($element = 'this', $js = '') + protected function _mouseover($element = 'this', $js = '') { return $this->_add_event($element, $js, 'mouseover'); } @@ -306,12 +306,12 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery mouseup event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _mouseup($element = 'this', $js = '') + protected function _mouseup($element = 'this', $js = '') { return $this->_add_event($element, $js, 'mouseup'); } @@ -323,18 +323,18 @@ class CI_Jquery extends CI_Javascript { * * Outputs script directly * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _output($array_js = '') + protected function _output($array_js = '') { if ( ! is_array($array_js)) { $array_js = array($array_js); } - + foreach ($array_js as $js) { $this->jquery_code_for_compile[] = "\t$js\n"; @@ -348,12 +348,12 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery resize event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _resize($element = 'this', $js = '') + protected function _resize($element = 'this', $js = '') { return $this->_add_event($element, $js, 'resize'); } @@ -365,16 +365,16 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery scroll event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _scroll($element = 'this', $js = '') + protected function _scroll($element = 'this', $js = '') { return $this->_add_event($element, $js, 'scroll'); } - + // -------------------------------------------------------------------- /** @@ -382,34 +382,33 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery unload event * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string */ - function _unload($element = 'this', $js = '') + protected function _unload($element = 'this', $js = '') { return $this->_add_event($element, $js, 'unload'); } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Effects - // -------------------------------------------------------------------- - + // -------------------------------------------------------------------- + /** * Add Class * * Outputs a jQuery addClass event * - * @access private + * @access protected * @param string - element * @return string */ - function _addClass($element = 'this', $class='') + protected function _addClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).addClass(\"$class\");"; - return $str; + return "$({$element}).addClass(\"$class\");"; } // -------------------------------------------------------------------- @@ -419,19 +418,19 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery animate event * - * @access private + * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ - function _animate($element = 'this', $params = array(), $speed = '', $extra = '') + protected function _animate($element = 'this', $params = array(), $speed = '', $extra = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + $animations = "\t\t\t"; - + foreach ($params as $param=>$value) { $animations .= $param.': \''.$value.'\', '; @@ -443,71 +442,65 @@ class CI_Jquery extends CI_Javascript { { $speed = ', '.$speed; } - + if ($extra != '') { $extra = ', '.$extra; } - - $str = "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; - - return $str; + + return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; } // -------------------------------------------------------------------- - + /** * Fade In * * Outputs a jQuery hide event * - * @access private + * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ - function _fadeIn($element = 'this', $speed = '', $callback = '') + protected function _fadeIn($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).fadeIn({$speed}{$callback});"; - - return $str; + + return "$({$element}).fadeIn({$speed}{$callback});"; } - + // -------------------------------------------------------------------- - + /** * Fade Out * * Outputs a jQuery hide event * - * @access private + * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ - function _fadeOut($element = 'this', $speed = '', $callback = '') + protected function _fadeOut($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).fadeOut({$speed}{$callback});"; - - return $str; + + return "$({$element}).fadeOut({$speed}{$callback});"; } // -------------------------------------------------------------------- @@ -517,27 +510,25 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery hide action * - * @access private + * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ - function _hide($element = 'this', $speed = '', $callback = '') + protected function _hide($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).hide({$speed}{$callback});"; - return $str; + return "$({$element}).hide({$speed}{$callback});"; } - + // -------------------------------------------------------------------- /** @@ -545,75 +536,70 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery remove class event * - * @access private + * @access protected * @param string - element * @return string */ - function _removeClass($element = 'this', $class='') + protected function _removeClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).removeClass(\"$class\");"; - return $str; + return "$({$element}).removeClass(\"$class\");"; } // -------------------------------------------------------------------- - + /** * Slide Up * * Outputs a jQuery slideUp event * - * @access private + * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ - function _slideUp($element = 'this', $speed = '', $callback = '') + protected function _slideUp($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideUp({$speed}{$callback});"; - - return $str; + + return "$({$element}).slideUp({$speed}{$callback});"; } - + // -------------------------------------------------------------------- - + /** * Slide Down * * Outputs a jQuery slideDown event * - * @access private + * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ - function _slideDown($element = 'this', $speed = '', $callback = '') + protected function _slideDown($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideDown({$speed}{$callback});"; - - return $str; + + return "$({$element}).slideDown({$speed}{$callback});"; } // -------------------------------------------------------------------- - + /** * Slide Toggle * @@ -625,83 +611,77 @@ class CI_Jquery extends CI_Javascript { * @param string - Javascript callback function * @return string */ - function _slideToggle($element = 'this', $speed = '', $callback = '') + protected function _slideToggle($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideToggle({$speed}{$callback});"; - - return $str; + + return "$({$element}).slideToggle({$speed}{$callback});"; } - + // -------------------------------------------------------------------- - + /** * Toggle * * Outputs a jQuery toggle event * - * @access private + * @access protected * @param string - element * @return string */ - function _toggle($element = 'this') + protected function _toggle($element = 'this') { $element = $this->_prep_element($element); - $str = "$({$element}).toggle();"; - return $str; + return "$({$element}).toggle();"; } - + // -------------------------------------------------------------------- - + /** * Toggle Class * * Outputs a jQuery toggle class event * - * @access private + * @access protected * @param string - element * @return string */ - function _toggleClass($element = 'this', $class='') + protected function _toggleClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).toggleClass(\"$class\");"; - return $str; + return "$({$element}).toggleClass(\"$class\");"; } - + // -------------------------------------------------------------------- - + /** * Show * * Outputs a jQuery show event * - * @access private + * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ - function _show($element = 'this', $speed = '', $callback = '') + protected function _show($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).show({$speed}{$callback});"; - - return $str; + + return "$({$element}).show({$speed}{$callback});"; } // -------------------------------------------------------------------- @@ -709,22 +689,21 @@ class CI_Jquery extends CI_Javascript { /** * Updater * - * An Ajax call that populates the designated DOM node with + * An Ajax call that populates the designated DOM node with * returned content * - * @access private + * @access protected * @param string The element to attach the event to * @param string the controller to run the call against * @param string optional parameters * @return string */ - - function _updater($container = 'this', $controller, $options = '') - { + + protected function _updater($container = 'this', $controller, $options = '') + { $container = $this->_prep_element($container); - $controller = (strpos('://', $controller) === FALSE) ? $controller : $this->CI->config->site_url($controller); - + // ajaxStart and ajaxStop are better choices here... but this is a stop gap if ($this->CI->config->item('javascript_ajax_img') == '') { @@ -732,41 +711,39 @@ class CI_Jquery extends CI_Javascript { } else { - $loading_notifier = 'CI->config->slash_item('base_url') . $this->CI->config->item('javascript_ajax_img') . '\' alt=\'Loading\' />'; + $loading_notifier = 'CI->config->slash_item('base_url').$this->CI->config->item('javascript_ajax_img').'\' alt=\'Loading\' />'; } - - $updater = "$($container).empty();\n"; // anything that was in... get it out - $updater .= "\t\t$($container).prepend(\"$loading_notifier\");\n"; // to replace with an image + + $updater = "$($container).empty();\n" // anything that was in... get it out + . "\t\t$($container).prepend(\"$loading_notifier\");\n"; // to replace with an image $request_options = ''; if ($options != '') { - $request_options .= ", {"; - $request_options .= (is_array($options)) ? "'".implode("', '", $options)."'" : "'".str_replace(":", "':'", $options)."'"; - $request_options .= "}"; + $request_options .= ', {' + . (is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(":", "':'", $options)."'") + . '}'; } - $updater .= "\t\t$($container).load('$controller'$request_options);"; - return $updater; + return $updater."\t\t$($container).load('$controller'$request_options);"; } // -------------------------------------------------------------------- // Pre-written handy stuff // -------------------------------------------------------------------- - + /** * Zebra tables * - * @access private + * @access protected * @param string table name * @param string plugin location * @return string */ - function _zebraTables($class = '', $odd = 'odd', $hover = '') + protected function _zebraTables($class = '', $odd = 'odd', $hover = '') { $class = ($class != '') ? '.'.$class : ''; - $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; $this->jquery_code_for_compile[] = $zebra; @@ -779,12 +756,10 @@ class CI_Jquery extends CI_Javascript { return $zebra; } - - // -------------------------------------------------------------------- // Plugins // -------------------------------------------------------------------- - + /** * Corner Plugin * @@ -794,7 +769,7 @@ class CI_Jquery extends CI_Javascript { * @param string target * @return string */ - function corner($element = '', $corner_style = '') + public function corner($element = '', $corner_style = '') { // may want to make this configurable down the road $corner_location = '/plugins/jquery.corner.js'; @@ -806,7 +781,7 @@ class CI_Jquery extends CI_Javascript { return "$(" . $this->_prep_element($element) . ").corner(".$corner_style.");"; } - + // -------------------------------------------------------------------- /** @@ -817,8 +792,8 @@ class CI_Jquery extends CI_Javascript { * @access public * @return void */ - function modal($src, $relative = FALSE) - { + public function modal($src, $relative = FALSE) + { $this->jquery_code_for_load[] = $this->external($src, $relative); } @@ -832,7 +807,7 @@ class CI_Jquery extends CI_Javascript { * @access public * @return void */ - function effect($src, $relative = FALSE) + public function effect($src, $relative = FALSE) { $this->jquery_code_for_load[] = $this->external($src, $relative); } @@ -847,7 +822,7 @@ class CI_Jquery extends CI_Javascript { * @access public * @return void */ - function plugin($src, $relative = FALSE) + public function plugin($src, $relative = FALSE) { $this->jquery_code_for_load[] = $this->external($src, $relative); } @@ -862,7 +837,7 @@ class CI_Jquery extends CI_Javascript { * @access public * @return void */ - function ui($src, $relative = FALSE) + public function ui($src, $relative = FALSE) { $this->jquery_code_for_load[] = $this->external($src, $relative); } @@ -876,7 +851,7 @@ class CI_Jquery extends CI_Javascript { * @access public * @return void */ - function sortable($element, $options = array()) + public function sortable($element, $options = array()) { if (count($options) > 0) @@ -906,11 +881,11 @@ class CI_Jquery extends CI_Javascript { * @param string plugin location * @return string */ - function tablesorter($table = '', $options = '') + public function tablesorter($table = '', $options = '') { $this->jquery_code_for_compile[] = "\t$(" . $this->_prep_element($table) . ").tablesorter($options);\n"; } - + // -------------------------------------------------------------------- // Class functions // -------------------------------------------------------------------- @@ -920,13 +895,13 @@ class CI_Jquery extends CI_Javascript { * * Constructs the syntax for an event, and adds to into the array for compilation * - * @access private + * @access protected * @param string The element to attach the event to * @param string The code to execute * @param string The event to pass * @return string - */ - function _add_event($element, $js, $event) + */ + protected function _add_event($element, $js, $event) { if (is_array($js)) { @@ -947,65 +922,64 @@ class CI_Jquery extends CI_Javascript { * As events are specified, they are stored in an array * This funciton compiles them all for output on a page * - * @access private + * @access protected * @return string */ - function _compile($view_var = 'script_foot', $script_tags = TRUE) + protected function _compile($view_var = 'script_foot', $script_tags = TRUE) { // External references $external_scripts = implode('', $this->jquery_code_for_load); $this->CI->load->vars(array('library_src' => $external_scripts)); - if (count($this->jquery_code_for_compile) == 0 ) + if (count($this->jquery_code_for_compile) === 0) { // no inline references, let's just return return; } // Inline references - $script = '$(document).ready(function() {' . "\n"; - $script .= implode('', $this->jquery_code_for_compile); - $script .= '});'; - + $script = '$(document).ready(function() {'."\n" + . implode('', $this->jquery_code_for_compile) + . '});'; + $output = ($script_tags === FALSE) ? $script : $this->inline($script); $this->CI->load->vars(array($view_var => $output)); } - + // -------------------------------------------------------------------- - + /** * Clear Compile * * Clears the array of script events collected for output * - * @access public + * @access protected * @return void */ - function _clear_compile() + protected function _clear_compile() { $this->jquery_code_for_compile = array(); } // -------------------------------------------------------------------- - + /** * Document Ready * * A wrapper for writing document.ready() * - * @access private + * @access protected * @return string */ - function _document_ready($js) + protected function _document_ready($js) { if ( ! is_array($js)) { - $js = array ($js); - + $js = array($js); } - + foreach ($js as $script) { $this->jquery_code_for_compile[] = $script; @@ -1023,13 +997,13 @@ class CI_Jquery extends CI_Javascript { * @param string * @return string */ - function script($library_src = '', $relative = FALSE) + public function script($library_src = '', $relative = FALSE) { $library_src = $this->external($library_src, $relative); $this->jquery_code_for_load[] = $library_src; return $library_src; } - + // -------------------------------------------------------------------- /** @@ -1039,20 +1013,20 @@ class CI_Jquery extends CI_Javascript { * unless the supplied element is the Javascript 'this' * object, in which case no quotes are added * - * @access public + * @access protected * @param string * @return string */ - function _prep_element($element) + protected function _prep_element($element) { if ($element != 'this') { $element = '"'.$element.'"'; } - + return $element; } - + // -------------------------------------------------------------------- /** @@ -1060,25 +1034,25 @@ class CI_Jquery extends CI_Javascript { * * Ensures the speed parameter is valid for jQuery * - * @access private + * @access protected * @param string * @return string - */ - function _validate_speed($speed) + */ + protected function _validate_speed($speed) { if (in_array($speed, array('slow', 'normal', 'fast'))) { - $speed = '"'.$speed.'"'; + return '"'.$speed.'"'; } elseif (preg_match("/[^0-9]/", $speed)) { - $speed = ''; + return ''; } - + return $speed; } } /* End of file Jquery.php */ -/* Location: ./system/libraries/Jquery.php */ \ No newline at end of file +/* Location: ./system/libraries/Jquery.php */ -- cgit v1.2.3-24-g4f1b From 6aac0ba44a8d770aa4e14cb9ac0553c8c4633f81 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 27 Dec 2011 02:34:00 +0200 Subject: Remove @access from method descriptions --- system/libraries/javascript/Jquery.php | 46 ---------------------------------- 1 file changed, 46 deletions(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 05057bec2..888e89b1b 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -69,7 +69,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery blur event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -86,7 +85,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery change event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -103,7 +101,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery click event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @param boolean whether or not to return false @@ -131,7 +128,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery dblclick event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -148,7 +144,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery error event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -165,7 +160,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery focus event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -182,7 +176,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery hover event * - * @access protected * @param string - element * @param string - Javascript code for mouse over * @param string - Javascript code for mouse out @@ -204,7 +197,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery keydown event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -221,7 +213,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery keydown event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -238,7 +229,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery load event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -255,7 +245,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery mousedown event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -272,7 +261,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery mouseout event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -289,7 +277,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery mouseover event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -306,7 +293,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery mouseup event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -323,7 +309,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs script directly * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -348,7 +333,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery resize event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -365,7 +349,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery scroll event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -382,7 +365,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery unload event * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @return string @@ -401,7 +383,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery addClass event * - * @access protected * @param string - element * @return string */ @@ -418,7 +399,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery animate event * - * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function @@ -458,7 +438,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery hide event * - * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function @@ -484,7 +463,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery hide event * - * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function @@ -510,7 +488,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery hide action * - * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function @@ -536,7 +513,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery remove class event * - * @access protected * @param string - element * @return string */ @@ -553,7 +529,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery slideUp event * - * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function @@ -579,7 +554,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery slideDown event * - * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function @@ -605,7 +579,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery slideToggle event * - * @access public * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function @@ -631,7 +604,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery toggle event * - * @access protected * @param string - element * @return string */ @@ -648,7 +620,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery toggle class event * - * @access protected * @param string - element * @return string */ @@ -665,7 +636,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery show event * - * @access protected * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function @@ -692,7 +662,6 @@ class CI_Jquery extends CI_Javascript { * An Ajax call that populates the designated DOM node with * returned content * - * @access protected * @param string The element to attach the event to * @param string the controller to run the call against * @param string optional parameters @@ -736,7 +705,6 @@ class CI_Jquery extends CI_Javascript { /** * Zebra tables * - * @access protected * @param string table name * @param string plugin location * @return string @@ -765,7 +733,6 @@ class CI_Jquery extends CI_Javascript { * * http://www.malsup.com/jquery/corner/ * - * @access public * @param string target * @return string */ @@ -789,7 +756,6 @@ class CI_Jquery extends CI_Javascript { * * Load a thickbox modal window * - * @access public * @return void */ public function modal($src, $relative = FALSE) @@ -804,7 +770,6 @@ class CI_Jquery extends CI_Javascript { * * Load an Effect library * - * @access public * @return void */ public function effect($src, $relative = FALSE) @@ -819,7 +784,6 @@ class CI_Jquery extends CI_Javascript { * * Load a plugin library * - * @access public * @return void */ public function plugin($src, $relative = FALSE) @@ -834,7 +798,6 @@ class CI_Jquery extends CI_Javascript { * * Load a user interface library * - * @access public * @return void */ public function ui($src, $relative = FALSE) @@ -848,7 +811,6 @@ class CI_Jquery extends CI_Javascript { * * Creates a jQuery sortable * - * @access public * @return void */ public function sortable($element, $options = array()) @@ -876,7 +838,6 @@ class CI_Jquery extends CI_Javascript { /** * Table Sorter Plugin * - * @access public * @param string table name * @param string plugin location * @return string @@ -895,7 +856,6 @@ class CI_Jquery extends CI_Javascript { * * Constructs the syntax for an event, and adds to into the array for compilation * - * @access protected * @param string The element to attach the event to * @param string The code to execute * @param string The event to pass @@ -922,7 +882,6 @@ class CI_Jquery extends CI_Javascript { * As events are specified, they are stored in an array * This funciton compiles them all for output on a page * - * @access protected * @return string */ protected function _compile($view_var = 'script_foot', $script_tags = TRUE) @@ -955,7 +914,6 @@ class CI_Jquery extends CI_Javascript { * * Clears the array of script events collected for output * - * @access protected * @return void */ protected function _clear_compile() @@ -970,7 +928,6 @@ class CI_Jquery extends CI_Javascript { * * A wrapper for writing document.ready() * - * @access protected * @return string */ protected function _document_ready($js) @@ -993,7 +950,6 @@ class CI_Jquery extends CI_Javascript { * * Outputs the script tag that loads the jquery.js file into an HTML document * - * @access public * @param string * @return string */ @@ -1013,7 +969,6 @@ class CI_Jquery extends CI_Javascript { * unless the supplied element is the Javascript 'this' * object, in which case no quotes are added * - * @access protected * @param string * @return string */ @@ -1034,7 +989,6 @@ class CI_Jquery extends CI_Javascript { * * Ensures the speed parameter is valid for jQuery * - * @access protected * @param string * @return string */ -- cgit v1.2.3-24-g4f1b From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 1 Jan 2012 18:46:41 -0600 Subject: Updating copyright date to 2012 --- system/libraries/javascript/Jquery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 888e89b1b..03574c66e 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/libraries/javascript/Jquery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 03574c66e..f30d7c639 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From 5645479c622eb36cf9869797896dc0921568c4a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:32:19 +0300 Subject: Clean up the libraries --- system/libraries/javascript/Jquery.php | 66 +++++++++++++++++----------------- 1 file changed, 32 insertions(+), 34 deletions(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index f30d7c639..3c9ae1867 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Jquery Class * @@ -57,7 +55,7 @@ class CI_Jquery extends CI_Javascript { $this->script(); } - log_message('debug', "Jquery Class Initialized"); + log_message('debug', 'Jquery Class Initialized'); } // -------------------------------------------------------------------- @@ -115,7 +113,7 @@ class CI_Jquery extends CI_Javascript { if ($ret_false) { - $js[] = "return false;"; + $js[] = 'return false;'; } return $this->_add_event($element, $js, 'click'); @@ -183,7 +181,7 @@ class CI_Jquery extends CI_Javascript { */ protected function _hover($element = 'this', $over, $out) { - $event = "\n\t$(" . $this->_prep_element($element) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; + $event = "\n\t$(".$this->_prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; $this->jquery_code_for_compile[] = $event; @@ -322,7 +320,7 @@ class CI_Jquery extends CI_Javascript { foreach ($array_js as $js) { - $this->jquery_code_for_compile[] = "\t$js\n"; + $this->jquery_code_for_compile[] = "\t".$js."\n"; } } @@ -389,7 +387,7 @@ class CI_Jquery extends CI_Javascript { protected function _addClass($element = 'this', $class='') { $element = $this->_prep_element($element); - return "$({$element}).addClass(\"$class\");"; + return '$('.$element.').addClass("'.$class.'");'; } // -------------------------------------------------------------------- @@ -411,9 +409,9 @@ class CI_Jquery extends CI_Javascript { $animations = "\t\t\t"; - foreach ($params as $param=>$value) + foreach ($params as $param => $value) { - $animations .= $param.': \''.$value.'\', '; + $animations .= $param.": '".$value."', "; } $animations = substr($animations, 0, -2); // remove the last ", " @@ -428,7 +426,7 @@ class CI_Jquery extends CI_Javascript { $extra = ', '.$extra; } - return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; + return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.');'; } // -------------------------------------------------------------------- @@ -478,7 +476,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).fadeOut({$speed}{$callback});"; + return '$('.$element.').fadeOut('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -519,7 +517,7 @@ class CI_Jquery extends CI_Javascript { protected function _removeClass($element = 'this', $class='') { $element = $this->_prep_element($element); - return "$({$element}).removeClass(\"$class\");"; + return '$('.$element.').removeClass("'.$class.'");'; } // -------------------------------------------------------------------- @@ -544,7 +542,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).slideUp({$speed}{$callback});"; + return '$('.$element.').slideUp('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -569,7 +567,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).slideDown({$speed}{$callback});"; + return '$('.$element.').slideDown('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -594,7 +592,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).slideToggle({$speed}{$callback});"; + return '$('.$element.').slideToggle('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -610,7 +608,7 @@ class CI_Jquery extends CI_Javascript { protected function _toggle($element = 'this') { $element = $this->_prep_element($element); - return "$({$element}).toggle();"; + return '$('.$element.').toggle();'; } // -------------------------------------------------------------------- @@ -626,7 +624,7 @@ class CI_Jquery extends CI_Javascript { protected function _toggleClass($element = 'this', $class='') { $element = $this->_prep_element($element); - return "$({$element}).toggleClass(\"$class\");"; + return '$('.$element.').toggleClass("'.$class.'");'; } // -------------------------------------------------------------------- @@ -651,7 +649,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).show({$speed}{$callback});"; + return '$('.$element.').show('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -676,22 +674,22 @@ class CI_Jquery extends CI_Javascript { // ajaxStart and ajaxStop are better choices here... but this is a stop gap if ($this->CI->config->item('javascript_ajax_img') == '') { - $loading_notifier = "Loading..."; + $loading_notifier = 'Loading...'; } else { - $loading_notifier = 'CI->config->slash_item('base_url').$this->CI->config->item('javascript_ajax_img').'\' alt=\'Loading\' />'; + $loading_notifier = 'Loading'; } - $updater = "$($container).empty();\n" // anything that was in... get it out - . "\t\t$($container).prepend(\"$loading_notifier\");\n"; // to replace with an image + $updater = '$('.$container.").empty();\n" // anything that was in... get it out + ."\t\t$(".$container.').prepend("'.$loading_notifier."\");\n"; // to replace with an image $request_options = ''; if ($options != '') { $request_options .= ', {' - . (is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(":", "':'", $options)."'") - . '}'; + .(is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(':', "':'", $options)."'") + .'}'; } return $updater."\t\t$($container).load('$controller'$request_options);"; @@ -746,7 +744,7 @@ class CI_Jquery extends CI_Javascript { $corner_style = '"'.$corner_style.'"'; } - return "$(" . $this->_prep_element($element) . ").corner(".$corner_style.");"; + return '$('.$this->_prep_element($element).').corner('.$corner_style.');'; } // -------------------------------------------------------------------- @@ -821,16 +819,16 @@ class CI_Jquery extends CI_Javascript { $sort_options = array(); foreach ($options as $k=>$v) { - $sort_options[] = "\n\t\t".$k.': '.$v.""; + $sort_options[] = "\n\t\t".$k.': '.$v; } - $sort_options = implode(",", $sort_options); + $sort_options = implode(',', $sort_options); } else { $sort_options = ''; } - return "$(" . $this->_prep_element($element) . ").sortable({".$sort_options."\n\t});"; + return '$('.$this->_prep_element($element).').sortable({'.$sort_options."\n\t});"; } // -------------------------------------------------------------------- @@ -844,7 +842,7 @@ class CI_Jquery extends CI_Javascript { */ public function tablesorter($table = '', $options = '') { - $this->jquery_code_for_compile[] = "\t$(" . $this->_prep_element($table) . ").tablesorter($options);\n"; + $this->jquery_code_for_compile[] = "\t$(".$this->_prep_element($table).').tablesorter('.$options.");\n"; } // -------------------------------------------------------------------- @@ -869,7 +867,7 @@ class CI_Jquery extends CI_Javascript { } - $event = "\n\t$(" . $this->_prep_element($element) . ").{$event}(function(){\n\t\t{$js}\n\t});\n"; + $event = "\n\t$(".$this->_prep_element($element).').'.$event."(function(){\n\t\t{$js}\n\t});\n"; $this->jquery_code_for_compile[] = $event; return $event; } @@ -898,8 +896,8 @@ class CI_Jquery extends CI_Javascript { // Inline references $script = '$(document).ready(function() {'."\n" - . implode('', $this->jquery_code_for_compile) - . '});'; + .implode('', $this->jquery_code_for_compile) + .'});'; $output = ($script_tags === FALSE) ? $script : $this->inline($script); @@ -998,7 +996,7 @@ class CI_Jquery extends CI_Javascript { { return '"'.$speed.'"'; } - elseif (preg_match("/[^0-9]/", $speed)) + elseif (preg_match('/[^0-9]/', $speed)) { return ''; } @@ -1009,4 +1007,4 @@ class CI_Jquery extends CI_Javascript { } /* End of file Jquery.php */ -/* Location: ./system/libraries/Jquery.php */ +/* Location: ./system/libraries/Jquery.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/javascript/Jquery.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 3c9ae1867..44c16b578 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -416,12 +416,12 @@ class CI_Jquery extends CI_Javascript { $animations = substr($animations, 0, -2); // remove the last ", " - if ($speed != '') + if ($speed !== '') { $speed = ', '.$speed; } - if ($extra != '') + if ($extra !== '') { $extra = ', '.$extra; } @@ -446,7 +446,7 @@ class CI_Jquery extends CI_Javascript { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - if ($callback != '') + if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } @@ -471,7 +471,7 @@ class CI_Jquery extends CI_Javascript { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - if ($callback != '') + if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } @@ -496,7 +496,7 @@ class CI_Jquery extends CI_Javascript { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - if ($callback != '') + if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } @@ -537,7 +537,7 @@ class CI_Jquery extends CI_Javascript { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - if ($callback != '') + if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } @@ -562,7 +562,7 @@ class CI_Jquery extends CI_Javascript { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - if ($callback != '') + if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } @@ -587,7 +587,7 @@ class CI_Jquery extends CI_Javascript { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - if ($callback != '') + if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } @@ -644,7 +644,7 @@ class CI_Jquery extends CI_Javascript { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - if ($callback != '') + if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } @@ -672,7 +672,7 @@ class CI_Jquery extends CI_Javascript { $controller = (strpos('://', $controller) === FALSE) ? $controller : $this->CI->config->site_url($controller); // ajaxStart and ajaxStop are better choices here... but this is a stop gap - if ($this->CI->config->item('javascript_ajax_img') == '') + if ($this->CI->config->item('javascript_ajax_img') === '') { $loading_notifier = 'Loading...'; } @@ -685,7 +685,7 @@ class CI_Jquery extends CI_Javascript { ."\t\t$(".$container.').prepend("'.$loading_notifier."\");\n"; // to replace with an image $request_options = ''; - if ($options != '') + if ($options !== '') { $request_options .= ', {' .(is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(':', "':'", $options)."'") @@ -709,12 +709,12 @@ class CI_Jquery extends CI_Javascript { */ protected function _zebraTables($class = '', $odd = 'odd', $hover = '') { - $class = ($class != '') ? '.'.$class : ''; + $class = ($class !== '') ? '.'.$class : ''; $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; $this->jquery_code_for_compile[] = $zebra; - if ($hover != '') + if ($hover !== '') { $hover = $this->hover("table{$class} tbody tr", "$(this).addClass('hover');", "$(this).removeClass('hover');"); } @@ -739,7 +739,7 @@ class CI_Jquery extends CI_Javascript { // may want to make this configurable down the road $corner_location = '/plugins/jquery.corner.js'; - if ($corner_style != '') + if ($corner_style !== '') { $corner_style = '"'.$corner_style.'"'; } @@ -972,7 +972,7 @@ class CI_Jquery extends CI_Javascript { */ protected function _prep_element($element) { - if ($element != 'this') + if ($element !== 'this') { $element = '"'.$element.'"'; } -- cgit v1.2.3-24-g4f1b From 5fd3ae8d33a4f5d3159b86683b9a670e973a63f5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 24 Oct 2012 14:55:35 +0300 Subject: [ci skip] style and phpdoc-related changes (rel #1295) --- system/libraries/javascript/Jquery.php | 83 ++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 33 deletions(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 44c16b578..8739d141f 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -34,7 +34,6 @@ * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/libraries/javascript.html */ - class CI_Jquery extends CI_Javascript { protected $_javascript_folder = 'js'; @@ -45,6 +44,12 @@ class CI_Jquery extends CI_Javascript { public $jquery_table_sorter_pager_active = FALSE; public $jquery_ajax_img = ''; + /** + * Constructor + * + * @param array $params + * @return void + */ public function __construct($params) { $this->CI =& get_instance(); @@ -101,15 +106,12 @@ class CI_Jquery extends CI_Javascript { * * @param string The element to attach the event to * @param string The code to execute - * @param boolean whether or not to return false + * @param bool whether or not to return false * @return string */ protected function _click($element = 'this', $js = '', $ret_false = TRUE) { - if ( ! is_array($js)) - { - $js = array($js); - } + is_array($js) OR $js = array($js); if ($ret_false) { @@ -307,11 +309,10 @@ class CI_Jquery extends CI_Javascript { * * Outputs script directly * - * @param string The element to attach the event to - * @param string The code to execute - * @return string + * @param array $array_js = array() + * @return void */ - protected function _output($array_js = '') + protected function _output($array_js = array()) { if ( ! is_array($array_js)) { @@ -381,10 +382,11 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery addClass event * - * @param string - element + * @param string $element = 'this' + * @param string $class = '' * @return string */ - protected function _addClass($element = 'this', $class='') + protected function _addClass($element = 'this', $class = '') { $element = $this->_prep_element($element); return '$('.$element.').addClass("'.$class.'");'; @@ -397,9 +399,10 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery animate event * - * @param string - element - * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds - * @param string - Javascript callback function + * @param string $element = 'this' + * @param array $params = array() + * @param string $speed = '' 'slow', 'normal', 'fast', or time in milliseconds + * @param string $extra = '' * @return string */ protected function _animate($element = 'this', $params = array(), $speed = '', $extra = '') @@ -511,10 +514,11 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery remove class event * - * @param string - element + * @param string $element = 'this' + * @param string $class = '' * @return string */ - protected function _removeClass($element = 'this', $class='') + protected function _removeClass($element = 'this', $class = '') { $element = $this->_prep_element($element); return '$('.$element.').removeClass("'.$class.'");'; @@ -618,10 +622,11 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery toggle class event * - * @param string - element + * @param string $element = 'this' + * @param string $class = '' * @return string */ - protected function _toggleClass($element = 'this', $class='') + protected function _toggleClass($element = 'this', $class = '') { $element = $this->_prep_element($element); return '$('.$element.').toggleClass("'.$class.'");'; @@ -703,8 +708,9 @@ class CI_Jquery extends CI_Javascript { /** * Zebra tables * - * @param string table name - * @param string plugin location + * @param string $class = '' + * @param string $odd = 'odd' + * @param string $hover = '' * @return string */ protected function _zebraTables($class = '', $odd = 'odd', $hover = '') @@ -731,7 +737,8 @@ class CI_Jquery extends CI_Javascript { * * http://www.malsup.com/jquery/corner/ * - * @param string target + * @param string $element = '' + * @param string $corner_style = '' * @return string */ public function corner($element = '', $corner_style = '') @@ -750,10 +757,12 @@ class CI_Jquery extends CI_Javascript { // -------------------------------------------------------------------- /** - * modal window + * Modal window * * Load a thickbox modal window * + * @param string $src + * @param bool $relative = FALSE * @return void */ public function modal($src, $relative = FALSE) @@ -768,6 +777,8 @@ class CI_Jquery extends CI_Javascript { * * Load an Effect library * + * @param string $src + * @param bool $relative = FALSE * @return void */ public function effect($src, $relative = FALSE) @@ -782,6 +793,8 @@ class CI_Jquery extends CI_Javascript { * * Load a plugin library * + * @param string $src + * @param bool $relative = FALSE * @return void */ public function plugin($src, $relative = FALSE) @@ -796,12 +809,15 @@ class CI_Jquery extends CI_Javascript { * * Load a user interface library * + * @param string $src + * @param bool $relative = FALSE * @return void */ public function ui($src, $relative = FALSE) { $this->jquery_code_for_load[] = $this->external($src, $relative); } + // -------------------------------------------------------------------- /** @@ -809,11 +825,12 @@ class CI_Jquery extends CI_Javascript { * * Creates a jQuery sortable * - * @return void + * @param string $element + * @param array $options = array() + * @return string */ public function sortable($element, $options = array()) { - if (count($options) > 0) { $sort_options = array(); @@ -880,7 +897,9 @@ class CI_Jquery extends CI_Javascript { * As events are specified, they are stored in an array * This funciton compiles them all for output on a page * - * @return string + * @param string $view_var = 'script_foot' + * @param bool $script_tags = TRUE + * @return void */ protected function _compile($view_var = 'script_foot', $script_tags = TRUE) { @@ -902,7 +921,6 @@ class CI_Jquery extends CI_Javascript { $output = ($script_tags === FALSE) ? $script : $this->inline($script); $this->CI->load->vars(array($view_var => $output)); - } // -------------------------------------------------------------------- @@ -926,14 +944,12 @@ class CI_Jquery extends CI_Javascript { * * A wrapper for writing document.ready() * - * @return string + * @param array $js + * @return void */ protected function _document_ready($js) { - if ( ! is_array($js)) - { - $js = array($js); - } + is_array($js) OR $js = array($js); foreach ($js as $script) { @@ -948,7 +964,8 @@ class CI_Jquery extends CI_Javascript { * * Outputs the script tag that loads the jquery.js file into an HTML document * - * @param string + * @param string $library_src = '' + * @param bool $relative = FALSE * @return string */ public function script($library_src = '', $relative = FALSE) -- cgit v1.2.3-24-g4f1b From bfbe8b2ca47a854686d0ca498686ef1e68124fd8 Mon Sep 17 00:00:00 2001 From: vkeranov Date: Sat, 27 Oct 2012 18:25:08 +0300 Subject: Remove extra new lines --- system/libraries/javascript/Jquery.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 8739d141f..ed02fadb7 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -700,7 +700,6 @@ class CI_Jquery extends CI_Javascript { return $updater."\t\t$($container).load('$controller'$request_options);"; } - // -------------------------------------------------------------------- // Pre-written handy stuff // -------------------------------------------------------------------- @@ -716,7 +715,7 @@ class CI_Jquery extends CI_Javascript { protected function _zebraTables($class = '', $odd = 'odd', $hover = '') { $class = ($class !== '') ? '.'.$class : ''; - $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; + $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; $this->jquery_code_for_compile[] = $zebra; -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/libraries/javascript/Jquery.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index ed02fadb7..13f6c8057 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -1,4 +1,4 @@ - Date: Thu, 1 Nov 2012 23:33:14 +0200 Subject: [ci skip] DocBlocks for Pagination, Session, Trackback, Jquery libraries Partially fixes issue #1295 --- system/libraries/javascript/Jquery.php | 94 ++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 26 deletions(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 13f6c8057..2bf47957f 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -37,14 +37,57 @@ defined('BASEPATH') OR exit('No direct script access allowed'); */ class CI_Jquery extends CI_Javascript { + /** + * JavaScript directory location + * + * @var string + */ protected $_javascript_folder = 'js'; + + /** + * JQuery code for load + * + * @var array + */ public $jquery_code_for_load = array(); + + /** + * JQuery code for compile + * + * @var array + */ public $jquery_code_for_compile = array(); + + /** + * JQuery corner active flag + * + * @var bool + */ public $jquery_corner_active = FALSE; + + /** + * JQuery table sorter active flag + * + * @var bool + */ public $jquery_table_sorter_active = FALSE; + + /** + * JQuery table sorder pager active + * + * @var bool + */ public $jquery_table_sorter_pager_active = FALSE; + + /** + * JQuery AJAX image + * + * @var string + */ public $jquery_ajax_img = ''; + // -------------------------------------------------------------------- + /** * Constructor * @@ -383,8 +426,8 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery addClass event * - * @param string $element = 'this' - * @param string $class = '' + * @param string $element + * @param string $class * @return string */ protected function _addClass($element = 'this', $class = '') @@ -400,10 +443,10 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery animate event * - * @param string $element = 'this' - * @param array $params = array() - * @param string $speed = '' 'slow', 'normal', 'fast', or time in milliseconds - * @param string $extra = '' + * @param string $element + * @param array $params + * @param string $speed 'slow', 'normal', 'fast', or time in milliseconds + * @param string $extra * @return string */ protected function _animate($element = 'this', $params = array(), $speed = '', $extra = '') @@ -515,8 +558,8 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery remove class event * - * @param string $element = 'this' - * @param string $class = '' + * @param string $element + * @param string $class * @return string */ protected function _removeClass($element = 'this', $class = '') @@ -623,8 +666,8 @@ class CI_Jquery extends CI_Javascript { * * Outputs a jQuery toggle class event * - * @param string $element = 'this' - * @param string $class = '' + * @param string $element + * @param string $class * @return string */ protected function _toggleClass($element = 'this', $class = '') @@ -708,9 +751,9 @@ class CI_Jquery extends CI_Javascript { /** * Zebra tables * - * @param string $class = '' - * @param string $odd = 'odd' - * @param string $hover = '' + * @param string $class + * @param string $odd + * @param string $hover * @return string */ protected function _zebraTables($class = '', $odd = 'odd', $hover = '') @@ -735,10 +778,9 @@ class CI_Jquery extends CI_Javascript { /** * Corner Plugin * - * http://www.malsup.com/jquery/corner/ - * - * @param string $element = '' - * @param string $corner_style = '' + * @link http://www.malsup.com/jquery/corner/ + * @param string $element + * @param string $corner_style * @return string */ public function corner($element = '', $corner_style = '') @@ -762,7 +804,7 @@ class CI_Jquery extends CI_Javascript { * Load a thickbox modal window * * @param string $src - * @param bool $relative = FALSE + * @param bool $relative * @return void */ public function modal($src, $relative = FALSE) @@ -778,7 +820,7 @@ class CI_Jquery extends CI_Javascript { * Load an Effect library * * @param string $src - * @param bool $relative = FALSE + * @param bool $relative * @return void */ public function effect($src, $relative = FALSE) @@ -794,7 +836,7 @@ class CI_Jquery extends CI_Javascript { * Load a plugin library * * @param string $src - * @param bool $relative = FALSE + * @param bool $relative * @return void */ public function plugin($src, $relative = FALSE) @@ -810,7 +852,7 @@ class CI_Jquery extends CI_Javascript { * Load a user interface library * * @param string $src - * @param bool $relative = FALSE + * @param bool $relative * @return void */ public function ui($src, $relative = FALSE) @@ -826,7 +868,7 @@ class CI_Jquery extends CI_Javascript { * Creates a jQuery sortable * * @param string $element - * @param array $options = array() + * @param array $options * @return string */ public function sortable($element, $options = array()) @@ -897,8 +939,8 @@ class CI_Jquery extends CI_Javascript { * As events are specified, they are stored in an array * This funciton compiles them all for output on a page * - * @param string $view_var = 'script_foot' - * @param bool $script_tags = TRUE + * @param string $view_var + * @param bool $script_tags * @return void */ protected function _compile($view_var = 'script_foot', $script_tags = TRUE) @@ -964,8 +1006,8 @@ class CI_Jquery extends CI_Javascript { * * Outputs the script tag that loads the jquery.js file into an HTML document * - * @param string $library_src = '' - * @param bool $relative = FALSE + * @param string $library_src + * @param bool $relative * @return string */ public function script($library_src = '', $relative = FALSE) -- cgit v1.2.3-24-g4f1b From 2eaeee5aa3971932e58ffac48554e554d799249f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 21 Nov 2012 14:31:26 +0200 Subject: Change fs permissions and add some missing index.html files (#2017) --- system/libraries/javascript/index.html | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 system/libraries/javascript/index.html (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/index.html b/system/libraries/javascript/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/system/libraries/javascript/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 80500afbd188600212ca913a7bac073009feac73 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 1 Jan 2013 08:16:53 +0200 Subject: [ci skip] Happy new year --- system/libraries/javascript/Jquery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index 2bf47957f..b6e0434b2 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 3608e1a094945631c5b65e1f66460e4486c5b541 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 28 Jan 2013 16:27:30 +0200 Subject: Libraries' filenames must be named in a ucfirst-like manner --- system/libraries/javascript/Jquery.php | 1069 -------------------------------- system/libraries/javascript/index.html | 10 - 2 files changed, 1079 deletions(-) delete mode 100644 system/libraries/javascript/Jquery.php delete mode 100644 system/libraries/javascript/index.html (limited to 'system/libraries/javascript') diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php deleted file mode 100644 index b6e0434b2..000000000 --- a/system/libraries/javascript/Jquery.php +++ /dev/null @@ -1,1069 +0,0 @@ -CI =& get_instance(); - extract($params); - - if ($autoload === TRUE) - { - $this->script(); - } - - log_message('debug', 'Jquery Class Initialized'); - } - - // -------------------------------------------------------------------- - // Event Code - // -------------------------------------------------------------------- - - /** - * Blur - * - * Outputs a jQuery blur event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _blur($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'blur'); - } - - // -------------------------------------------------------------------- - - /** - * Change - * - * Outputs a jQuery change event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _change($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'change'); - } - - // -------------------------------------------------------------------- - - /** - * Click - * - * Outputs a jQuery click event - * - * @param string The element to attach the event to - * @param string The code to execute - * @param bool whether or not to return false - * @return string - */ - protected function _click($element = 'this', $js = '', $ret_false = TRUE) - { - is_array($js) OR $js = array($js); - - if ($ret_false) - { - $js[] = 'return false;'; - } - - return $this->_add_event($element, $js, 'click'); - } - - // -------------------------------------------------------------------- - - /** - * Double Click - * - * Outputs a jQuery dblclick event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _dblclick($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'dblclick'); - } - - // -------------------------------------------------------------------- - - /** - * Error - * - * Outputs a jQuery error event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _error($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'error'); - } - - // -------------------------------------------------------------------- - - /** - * Focus - * - * Outputs a jQuery focus event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _focus($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'focus'); - } - - // -------------------------------------------------------------------- - - /** - * Hover - * - * Outputs a jQuery hover event - * - * @param string - element - * @param string - Javascript code for mouse over - * @param string - Javascript code for mouse out - * @return string - */ - protected function _hover($element = 'this', $over, $out) - { - $event = "\n\t$(".$this->_prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; - - $this->jquery_code_for_compile[] = $event; - - return $event; - } - - // -------------------------------------------------------------------- - - /** - * Keydown - * - * Outputs a jQuery keydown event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _keydown($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'keydown'); - } - - // -------------------------------------------------------------------- - - /** - * Keyup - * - * Outputs a jQuery keydown event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _keyup($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'keyup'); - } - - // -------------------------------------------------------------------- - - /** - * Load - * - * Outputs a jQuery load event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _load($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'load'); - } - - // -------------------------------------------------------------------- - - /** - * Mousedown - * - * Outputs a jQuery mousedown event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _mousedown($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'mousedown'); - } - - // -------------------------------------------------------------------- - - /** - * Mouse Out - * - * Outputs a jQuery mouseout event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _mouseout($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'mouseout'); - } - - // -------------------------------------------------------------------- - - /** - * Mouse Over - * - * Outputs a jQuery mouseover event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _mouseover($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'mouseover'); - } - - // -------------------------------------------------------------------- - - /** - * Mouseup - * - * Outputs a jQuery mouseup event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _mouseup($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'mouseup'); - } - - // -------------------------------------------------------------------- - - /** - * Output - * - * Outputs script directly - * - * @param array $array_js = array() - * @return void - */ - protected function _output($array_js = array()) - { - if ( ! is_array($array_js)) - { - $array_js = array($array_js); - } - - foreach ($array_js as $js) - { - $this->jquery_code_for_compile[] = "\t".$js."\n"; - } - } - - // -------------------------------------------------------------------- - - /** - * Resize - * - * Outputs a jQuery resize event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _resize($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'resize'); - } - - // -------------------------------------------------------------------- - - /** - * Scroll - * - * Outputs a jQuery scroll event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _scroll($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'scroll'); - } - - // -------------------------------------------------------------------- - - /** - * Unload - * - * Outputs a jQuery unload event - * - * @param string The element to attach the event to - * @param string The code to execute - * @return string - */ - protected function _unload($element = 'this', $js = '') - { - return $this->_add_event($element, $js, 'unload'); - } - - // -------------------------------------------------------------------- - // Effects - // -------------------------------------------------------------------- - - /** - * Add Class - * - * Outputs a jQuery addClass event - * - * @param string $element - * @param string $class - * @return string - */ - protected function _addClass($element = 'this', $class = '') - { - $element = $this->_prep_element($element); - return '$('.$element.').addClass("'.$class.'");'; - } - - // -------------------------------------------------------------------- - - /** - * Animate - * - * Outputs a jQuery animate event - * - * @param string $element - * @param array $params - * @param string $speed 'slow', 'normal', 'fast', or time in milliseconds - * @param string $extra - * @return string - */ - protected function _animate($element = 'this', $params = array(), $speed = '', $extra = '') - { - $element = $this->_prep_element($element); - $speed = $this->_validate_speed($speed); - - $animations = "\t\t\t"; - - foreach ($params as $param => $value) - { - $animations .= $param.": '".$value."', "; - } - - $animations = substr($animations, 0, -2); // remove the last ", " - - if ($speed !== '') - { - $speed = ', '.$speed; - } - - if ($extra !== '') - { - $extra = ', '.$extra; - } - - return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.');'; - } - - // -------------------------------------------------------------------- - - /** - * Fade In - * - * Outputs a jQuery hide event - * - * @param string - element - * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds - * @param string - Javascript callback function - * @return string - */ - protected function _fadeIn($element = 'this', $speed = '', $callback = '') - { - $element = $this->_prep_element($element); - $speed = $this->_validate_speed($speed); - - if ($callback !== '') - { - $callback = ", function(){\n{$callback}\n}"; - } - - return "$({$element}).fadeIn({$speed}{$callback});"; - } - - // -------------------------------------------------------------------- - - /** - * Fade Out - * - * Outputs a jQuery hide event - * - * @param string - element - * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds - * @param string - Javascript callback function - * @return string - */ - protected function _fadeOut($element = 'this', $speed = '', $callback = '') - { - $element = $this->_prep_element($element); - $speed = $this->_validate_speed($speed); - - if ($callback !== '') - { - $callback = ", function(){\n{$callback}\n}"; - } - - return '$('.$element.').fadeOut('.$speed.$callback.');'; - } - - // -------------------------------------------------------------------- - - /** - * Hide - * - * Outputs a jQuery hide action - * - * @param string - element - * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds - * @param string - Javascript callback function - * @return string - */ - protected function _hide($element = 'this', $speed = '', $callback = '') - { - $element = $this->_prep_element($element); - $speed = $this->_validate_speed($speed); - - if ($callback !== '') - { - $callback = ", function(){\n{$callback}\n}"; - } - - return "$({$element}).hide({$speed}{$callback});"; - } - - // -------------------------------------------------------------------- - - /** - * Remove Class - * - * Outputs a jQuery remove class event - * - * @param string $element - * @param string $class - * @return string - */ - protected function _removeClass($element = 'this', $class = '') - { - $element = $this->_prep_element($element); - return '$('.$element.').removeClass("'.$class.'");'; - } - - // -------------------------------------------------------------------- - - /** - * Slide Up - * - * Outputs a jQuery slideUp event - * - * @param string - element - * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds - * @param string - Javascript callback function - * @return string - */ - protected function _slideUp($element = 'this', $speed = '', $callback = '') - { - $element = $this->_prep_element($element); - $speed = $this->_validate_speed($speed); - - if ($callback !== '') - { - $callback = ", function(){\n{$callback}\n}"; - } - - return '$('.$element.').slideUp('.$speed.$callback.');'; - } - - // -------------------------------------------------------------------- - - /** - * Slide Down - * - * Outputs a jQuery slideDown event - * - * @param string - element - * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds - * @param string - Javascript callback function - * @return string - */ - protected function _slideDown($element = 'this', $speed = '', $callback = '') - { - $element = $this->_prep_element($element); - $speed = $this->_validate_speed($speed); - - if ($callback !== '') - { - $callback = ", function(){\n{$callback}\n}"; - } - - return '$('.$element.').slideDown('.$speed.$callback.');'; - } - - // -------------------------------------------------------------------- - - /** - * Slide Toggle - * - * Outputs a jQuery slideToggle event - * - * @param string - element - * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds - * @param string - Javascript callback function - * @return string - */ - protected function _slideToggle($element = 'this', $speed = '', $callback = '') - { - $element = $this->_prep_element($element); - $speed = $this->_validate_speed($speed); - - if ($callback !== '') - { - $callback = ", function(){\n{$callback}\n}"; - } - - return '$('.$element.').slideToggle('.$speed.$callback.');'; - } - - // -------------------------------------------------------------------- - - /** - * Toggle - * - * Outputs a jQuery toggle event - * - * @param string - element - * @return string - */ - protected function _toggle($element = 'this') - { - $element = $this->_prep_element($element); - return '$('.$element.').toggle();'; - } - - // -------------------------------------------------------------------- - - /** - * Toggle Class - * - * Outputs a jQuery toggle class event - * - * @param string $element - * @param string $class - * @return string - */ - protected function _toggleClass($element = 'this', $class = '') - { - $element = $this->_prep_element($element); - return '$('.$element.').toggleClass("'.$class.'");'; - } - - // -------------------------------------------------------------------- - - /** - * Show - * - * Outputs a jQuery show event - * - * @param string - element - * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds - * @param string - Javascript callback function - * @return string - */ - protected function _show($element = 'this', $speed = '', $callback = '') - { - $element = $this->_prep_element($element); - $speed = $this->_validate_speed($speed); - - if ($callback !== '') - { - $callback = ", function(){\n{$callback}\n}"; - } - - return '$('.$element.').show('.$speed.$callback.');'; - } - - // -------------------------------------------------------------------- - - /** - * Updater - * - * An Ajax call that populates the designated DOM node with - * returned content - * - * @param string The element to attach the event to - * @param string the controller to run the call against - * @param string optional parameters - * @return string - */ - - protected function _updater($container = 'this', $controller, $options = '') - { - $container = $this->_prep_element($container); - $controller = (strpos('://', $controller) === FALSE) ? $controller : $this->CI->config->site_url($controller); - - // ajaxStart and ajaxStop are better choices here... but this is a stop gap - if ($this->CI->config->item('javascript_ajax_img') === '') - { - $loading_notifier = 'Loading...'; - } - else - { - $loading_notifier = 'Loading'; - } - - $updater = '$('.$container.").empty();\n" // anything that was in... get it out - ."\t\t$(".$container.').prepend("'.$loading_notifier."\");\n"; // to replace with an image - - $request_options = ''; - if ($options !== '') - { - $request_options .= ', {' - .(is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(':', "':'", $options)."'") - .'}'; - } - - return $updater."\t\t$($container).load('$controller'$request_options);"; - } - - // -------------------------------------------------------------------- - // Pre-written handy stuff - // -------------------------------------------------------------------- - - /** - * Zebra tables - * - * @param string $class - * @param string $odd - * @param string $hover - * @return string - */ - protected function _zebraTables($class = '', $odd = 'odd', $hover = '') - { - $class = ($class !== '') ? '.'.$class : ''; - $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; - - $this->jquery_code_for_compile[] = $zebra; - - if ($hover !== '') - { - $hover = $this->hover("table{$class} tbody tr", "$(this).addClass('hover');", "$(this).removeClass('hover');"); - } - - return $zebra; - } - - // -------------------------------------------------------------------- - // Plugins - // -------------------------------------------------------------------- - - /** - * Corner Plugin - * - * @link http://www.malsup.com/jquery/corner/ - * @param string $element - * @param string $corner_style - * @return string - */ - public function corner($element = '', $corner_style = '') - { - // may want to make this configurable down the road - $corner_location = '/plugins/jquery.corner.js'; - - if ($corner_style !== '') - { - $corner_style = '"'.$corner_style.'"'; - } - - return '$('.$this->_prep_element($element).').corner('.$corner_style.');'; - } - - // -------------------------------------------------------------------- - - /** - * Modal window - * - * Load a thickbox modal window - * - * @param string $src - * @param bool $relative - * @return void - */ - public function modal($src, $relative = FALSE) - { - $this->jquery_code_for_load[] = $this->external($src, $relative); - } - - // -------------------------------------------------------------------- - - /** - * Effect - * - * Load an Effect library - * - * @param string $src - * @param bool $relative - * @return void - */ - public function effect($src, $relative = FALSE) - { - $this->jquery_code_for_load[] = $this->external($src, $relative); - } - - // -------------------------------------------------------------------- - - /** - * Plugin - * - * Load a plugin library - * - * @param string $src - * @param bool $relative - * @return void - */ - public function plugin($src, $relative = FALSE) - { - $this->jquery_code_for_load[] = $this->external($src, $relative); - } - - // -------------------------------------------------------------------- - - /** - * UI - * - * Load a user interface library - * - * @param string $src - * @param bool $relative - * @return void - */ - public function ui($src, $relative = FALSE) - { - $this->jquery_code_for_load[] = $this->external($src, $relative); - } - - // -------------------------------------------------------------------- - - /** - * Sortable - * - * Creates a jQuery sortable - * - * @param string $element - * @param array $options - * @return string - */ - public function sortable($element, $options = array()) - { - if (count($options) > 0) - { - $sort_options = array(); - foreach ($options as $k=>$v) - { - $sort_options[] = "\n\t\t".$k.': '.$v; - } - $sort_options = implode(',', $sort_options); - } - else - { - $sort_options = ''; - } - - return '$('.$this->_prep_element($element).').sortable({'.$sort_options."\n\t});"; - } - - // -------------------------------------------------------------------- - - /** - * Table Sorter Plugin - * - * @param string table name - * @param string plugin location - * @return string - */ - public function tablesorter($table = '', $options = '') - { - $this->jquery_code_for_compile[] = "\t$(".$this->_prep_element($table).').tablesorter('.$options.");\n"; - } - - // -------------------------------------------------------------------- - // Class functions - // -------------------------------------------------------------------- - - /** - * Add Event - * - * Constructs the syntax for an event, and adds to into the array for compilation - * - * @param string The element to attach the event to - * @param string The code to execute - * @param string The event to pass - * @return string - */ - protected function _add_event($element, $js, $event) - { - if (is_array($js)) - { - $js = implode("\n\t\t", $js); - - } - - $event = "\n\t$(".$this->_prep_element($element).').'.$event."(function(){\n\t\t{$js}\n\t});\n"; - $this->jquery_code_for_compile[] = $event; - return $event; - } - - // -------------------------------------------------------------------- - - /** - * Compile - * - * As events are specified, they are stored in an array - * This funciton compiles them all for output on a page - * - * @param string $view_var - * @param bool $script_tags - * @return void - */ - protected function _compile($view_var = 'script_foot', $script_tags = TRUE) - { - // External references - $external_scripts = implode('', $this->jquery_code_for_load); - $this->CI->load->vars(array('library_src' => $external_scripts)); - - if (count($this->jquery_code_for_compile) === 0) - { - // no inline references, let's just return - return; - } - - // Inline references - $script = '$(document).ready(function() {'."\n" - .implode('', $this->jquery_code_for_compile) - .'});'; - - $output = ($script_tags === FALSE) ? $script : $this->inline($script); - - $this->CI->load->vars(array($view_var => $output)); - } - - // -------------------------------------------------------------------- - - /** - * Clear Compile - * - * Clears the array of script events collected for output - * - * @return void - */ - protected function _clear_compile() - { - $this->jquery_code_for_compile = array(); - } - - // -------------------------------------------------------------------- - - /** - * Document Ready - * - * A wrapper for writing document.ready() - * - * @param array $js - * @return void - */ - protected function _document_ready($js) - { - is_array($js) OR $js = array($js); - - foreach ($js as $script) - { - $this->jquery_code_for_compile[] = $script; - } - } - - // -------------------------------------------------------------------- - - /** - * Script Tag - * - * Outputs the script tag that loads the jquery.js file into an HTML document - * - * @param string $library_src - * @param bool $relative - * @return string - */ - public function script($library_src = '', $relative = FALSE) - { - $library_src = $this->external($library_src, $relative); - $this->jquery_code_for_load[] = $library_src; - return $library_src; - } - - // -------------------------------------------------------------------- - - /** - * Prep Element - * - * Puts HTML element in quotes for use in jQuery code - * unless the supplied element is the Javascript 'this' - * object, in which case no quotes are added - * - * @param string - * @return string - */ - protected function _prep_element($element) - { - if ($element !== 'this') - { - $element = '"'.$element.'"'; - } - - return $element; - } - - // -------------------------------------------------------------------- - - /** - * Validate Speed - * - * Ensures the speed parameter is valid for jQuery - * - * @param string - * @return string - */ - protected function _validate_speed($speed) - { - if (in_array($speed, array('slow', 'normal', 'fast'))) - { - return '"'.$speed.'"'; - } - elseif (preg_match('/[^0-9]/', $speed)) - { - return ''; - } - - return $speed; - } - -} - -/* End of file Jquery.php */ -/* Location: ./system/libraries/Jquery.php */ \ No newline at end of file diff --git a/system/libraries/javascript/index.html b/system/libraries/javascript/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/libraries/javascript/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file -- cgit v1.2.3-24-g4f1b