summaryrefslogtreecommitdiffstats
path: root/system/libraries/javascript/Jquery.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/javascript/Jquery.php')
-rw-r--r--system/libraries/javascript/Jquery.php135
1 files changed, 97 insertions, 38 deletions
diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php
index 44c16b578..2bf47957f 100644
--- a/system/libraries/javascript/Jquery.php
+++ b/system/libraries/javascript/Jquery.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Jquery Class
@@ -34,17 +35,65 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/libraries/javascript.html
*/
-
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
+ *
+ * @param array $params
+ * @return void
+ */
public function __construct($params)
{
$this->CI =& get_instance();
@@ -101,15 +150,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 +353,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 +426,11 @@ class CI_Jquery extends CI_Javascript {
*
* Outputs a jQuery addClass event
*
- * @param string - element
+ * @param string $element
+ * @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 +443,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
+ * @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 = '')
@@ -511,10 +558,11 @@ class CI_Jquery extends CI_Javascript {
*
* Outputs a jQuery remove class event
*
- * @param string - element
+ * @param string $element
+ * @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 +666,11 @@ class CI_Jquery extends CI_Javascript {
*
* Outputs a jQuery toggle class event
*
- * @param string - element
+ * @param string $element
+ * @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.'");';
@@ -695,7 +744,6 @@ class CI_Jquery extends CI_Javascript {
return $updater."\t\t$($container).load('$controller'$request_options);";
}
-
// --------------------------------------------------------------------
// Pre-written handy stuff
// --------------------------------------------------------------------
@@ -703,14 +751,15 @@ class CI_Jquery extends CI_Javascript {
/**
* Zebra tables
*
- * @param string table name
- * @param string plugin location
+ * @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}\");";
+ $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");";
$this->jquery_code_for_compile[] = $zebra;
@@ -729,9 +778,9 @@ class CI_Jquery extends CI_Javascript {
/**
* Corner Plugin
*
- * http://www.malsup.com/jquery/corner/
- *
- * @param string target
+ * @link http://www.malsup.com/jquery/corner/
+ * @param string $element
+ * @param string $corner_style
* @return string
*/
public function corner($element = '', $corner_style = '')
@@ -750,10 +799,12 @@ class CI_Jquery extends CI_Javascript {
// --------------------------------------------------------------------
/**
- * modal window
+ * Modal window
*
* Load a thickbox modal window
*
+ * @param string $src
+ * @param bool $relative
* @return void
*/
public function modal($src, $relative = FALSE)
@@ -768,6 +819,8 @@ class CI_Jquery extends CI_Javascript {
*
* Load an Effect library
*
+ * @param string $src
+ * @param bool $relative
* @return void
*/
public function effect($src, $relative = FALSE)
@@ -782,6 +835,8 @@ class CI_Jquery extends CI_Javascript {
*
* Load a plugin library
*
+ * @param string $src
+ * @param bool $relative
* @return void
*/
public function plugin($src, $relative = FALSE)
@@ -796,12 +851,15 @@ class CI_Jquery extends CI_Javascript {
*
* 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);
}
+
// --------------------------------------------------------------------
/**
@@ -809,11 +867,12 @@ class CI_Jquery extends CI_Javascript {
*
* Creates a jQuery sortable
*
- * @return void
+ * @param string $element
+ * @param array $options
+ * @return string
*/
public function sortable($element, $options = array())
{
-
if (count($options) > 0)
{
$sort_options = array();
@@ -880,7 +939,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
+ * @param bool $script_tags
+ * @return void
*/
protected function _compile($view_var = 'script_foot', $script_tags = TRUE)
{
@@ -902,7 +963,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 +986,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 +1006,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
* @return string
*/
public function script($library_src = '', $relative = FALSE)