Source for file jquery.php

Documentation is available at jquery.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Libraries
  4.  * @subpackage  HTML
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. /**
  13.  * Utility class for jQuery JavaScript behaviors
  14.  *
  15.  * @package     Joomla.Libraries
  16.  * @subpackage  HTML
  17.  * @since       3.0
  18.  */
  19. abstract class JHtmlJquery
  20. {
  21.     /**
  22.      * @var    array  Array containing information for loaded files
  23.      * @since  3.0
  24.      */
  25.     protected static $loaded array();
  26.  
  27.     /**
  28.      * Method to load the jQuery JavaScript framework into the document head
  29.      *
  30.      * If debugging mode is on an uncompressed version of jQuery is included for easier debugging.
  31.      *
  32.      * @param   boolean  $noConflict  True to load jQuery in noConflict mode [optional]
  33.      * @param   mixed    $debug       Is debugging mode on? [optional]
  34.      * @param   boolean  $migrate     True to enable the jQuery Migrate plugin
  35.      *
  36.      * @return  void 
  37.      *
  38.      * @since   3.0
  39.      */
  40.     public static function framework($noConflict true$debug null$migrate true)
  41.     {
  42.         // Only load once
  43.         if (!empty(static::$loaded[__METHOD__]))
  44.         {
  45.             return;
  46.         }
  47.  
  48.         // If no debugging value is set, use the configuration setting
  49.         if ($debug === null)
  50.         {
  51.             $config JFactory::getConfig();
  52.             $debug  = (boolean) $config->get('debug');
  53.         }
  54.  
  55.         JHtml::_('script''jui/jquery.min.js'falsetruefalsefalse$debug);
  56.  
  57.         // Check if we are loading in noConflict
  58.         if ($noConflict)
  59.         {
  60.             JHtml::_('script''jui/jquery-noconflict.js'falsetruefalsefalsefalse);
  61.         }
  62.  
  63.         // Check if we are loading Migrate
  64.         if ($migrate)
  65.         {
  66.             JHtml::_('script''jui/jquery-migrate.min.js'falsetruefalsefalse$debug);
  67.         }
  68.  
  69.         static::$loaded[__METHOD__true;
  70.  
  71.         return;
  72.     }
  73.  
  74.     /**
  75.      * Method to load the jQuery UI JavaScript framework into the document head
  76.      *
  77.      * If debugging mode is on an uncompressed version of jQuery UI is included for easier debugging.
  78.      *
  79.      * @param   array  $components  The jQuery UI components to load [optional]
  80.      * @param   mixed  $debug       Is debugging mode on? [optional]
  81.      *
  82.      * @return  void 
  83.      *
  84.      * @since   3.0
  85.      */
  86.     public static function ui(array $components array('core')$debug null)
  87.     {
  88.         // Set an array containing the supported jQuery UI components handled by this method
  89.         $supported array('core''sortable');
  90.  
  91.         // Include jQuery
  92.         static::framework();
  93.  
  94.         // If no debugging value is set, use the configuration setting
  95.         if ($debug === null)
  96.         {
  97.             $config JFactory::getConfig();
  98.             $debug  = (boolean) $config->get('debug');
  99.         }
  100.  
  101.         // Load each of the requested components
  102.         foreach ($components as $component)
  103.         {
  104.             // Only attempt to load the component if it's supported in core and hasn't already been loaded
  105.             if (in_array($component$supported&& empty(static::$loaded[__METHOD__][$component]))
  106.             {
  107.                 JHtml::_('script''jui/jquery.ui.' $component '.min.js'falsetruefalsefalse$debug);
  108.                 static::$loaded[__METHOD__][$componenttrue;
  109.             }
  110.         }
  111.  
  112.         return;
  113.     }
  114. }

Documentation generated on Tue, 19 Nov 2013 15:06:15 +0100 by phpDocumentor 1.4.3