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