summaryrefslogtreecommitdiffstats
path: root/system/libraries/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/javascript')
-rw-r--r--system/libraries/javascript/Jquery.php436
1 files changed, 205 insertions, 231 deletions
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 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* NOTICE OF LICENSE
- *
+ *
* Licensed under the Open Software License version 3.0
- *
+ *
* This source file is subject to the Open Software License (OSL 3.0) that is
* bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
@@ -36,80 +36,80 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/libraries/javascript.html
*/
-
+
class CI_Jquery extends CI_Javascript {
- var $_javascript_folder = 'js';
- var $jquery_code_for_load = array();
- var $jquery_code_for_compile = array();
- var $jquery_corner_active = FALSE;
- var $jquery_table_sorter_active = FALSE;
- var $jquery_table_sorter_pager_active = FALSE;
- var $jquery_ajax_img = '';
+ protected $_javascript_folder = 'js';
+ public $jquery_code_for_load = array();
+ public $jquery_code_for_compile = array();
+ public $jquery_corner_active = FALSE;
+ public $jquery_table_sorter_active = FALSE;
+ public $jquery_table_sorter_pager_active = FALSE;
+ public $jquery_ajax_img = '';
public function __construct($params)
{
- $this->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 = '<img src=\'' . $this->CI->config->slash_item('base_url') . $this->CI->config->item('javascript_ajax_img') . '\' alt=\'Loading\' />';
+ $loading_notifier = '<img src=\''.$this->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 */