1 <?php
   2    3    4    5    6    7    8 
   9 
  10 defined('JPATH_PLATFORM') or die;
  11 
  12   13   14   15   16 
  17 abstract class JHtmlBehavior
  18 {
  19       20   21   22   23   24 
  25     protected static $loaded = array();
  26 
  27       28   29   30   31   32   33   34   35   36   37   38   39 
  40     public static function framework($extras = false, $debug = null)
  41     {
  42         $type = $extras ? 'more' : 'core';
  43 
  44         
  45         if (!empty(static::$loaded[__METHOD__][$type]))
  46         {
  47             return;
  48         }
  49 
  50         JLog::add('JHtmlBehavior::framework is deprecated. Update to jquery scripts.', JLog::WARNING, 'deprecated');
  51 
  52         
  53         if ($debug === null)
  54         {
  55             $debug = JDEBUG;
  56         }
  57 
  58         if ($type !== 'core' && empty(static::$loaded[__METHOD__]['core']))
  59         {
  60             static::framework(false, $debug);
  61         }
  62 
  63         JHtml::_('script', 'system/mootools-' . $type . '.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug));
  64 
  65         
  66         static::core();
  67 
  68         static::$loaded[__METHOD__][$type] = true;
  69 
  70         return;
  71     }
  72 
  73       74   75   76   77   78   79   80   81 
  82     public static function core()
  83     {
  84         
  85         if (isset(static::$loaded[__METHOD__]))
  86         {
  87             return;
  88         }
  89 
  90         JHtml::_('script', 'system/core.js', array('version' => 'auto', 'relative' => true));
  91 
  92         
  93         JFactory::getDocument()->addScriptOptions('system.paths', array('root' => JUri::root(true), 'base' => JUri::base(true)));
  94 
  95         static::$loaded[__METHOD__] = true;
  96     }
  97 
  98       99  100  101  102  103  104  105  106 
 107     public static function caption($selector = 'img.caption')
 108     {
 109         
 110         if (isset(static::$loaded[__METHOD__][$selector]))
 111         {
 112             return;
 113         }
 114 
 115         
 116         JHtml::_('jquery.framework');
 117 
 118         JHtml::_('script', 'system/caption.js', array('version' => 'auto', 'relative' => true));
 119 
 120         
 121         JFactory::getDocument()->addScriptDeclaration(
 122             "jQuery(window).on('load',  function() {
 123                 new JCaption('" . $selector . "');
 124             });"
 125         );
 126 
 127         
 128         static::$loaded[__METHOD__][$selector] = true;
 129     }
 130 
 131      132  133  134  135  136  137  138  139  140  141  142  143  144 
 145     public static function formvalidation()
 146     {
 147         JLog::add('The use of formvalidation is deprecated use formvalidator instead.', JLog::WARNING, 'deprecated');
 148 
 149         
 150         if (isset(static::$loaded[__METHOD__]))
 151         {
 152             return;
 153         }
 154 
 155         
 156         static::framework();
 157 
 158         
 159         static::formvalidator();
 160     }
 161 
 162      163  164  165  166  167  168  169  170  171  172  173 
 174     public static function formvalidator()
 175     {
 176         
 177         if (isset(static::$loaded[__METHOD__]))
 178         {
 179             return;
 180         }
 181 
 182         
 183         static::core();
 184 
 185         
 186         JHtml::_('jquery.framework');
 187 
 188         
 189         JText::script('JLIB_FORM_FIELD_INVALID');
 190 
 191         JHtml::_('script', 'system/punycode.js', array('version' => 'auto', 'relative' => true));
 192         JHtml::_('script', 'system/validate.js', array('version' => 'auto', 'relative' => true));
 193         static::$loaded[__METHOD__] = true;
 194     }
 195 
 196      197  198  199  200  201  202 
 203     public static function switcher()
 204     {
 205         
 206         if (isset(static::$loaded[__METHOD__]))
 207         {
 208             return;
 209         }
 210 
 211         
 212         JHtml::_('jquery.framework');
 213 
 214         JHtml::_('script', 'system/switcher.js', array('framework' => true, 'version' => 'auto', 'relative' => true));
 215 
 216         $script = "
 217             document.switcher = null;
 218             jQuery(function($){
 219                 var toggler = document.getElementById('submenu');
 220                 var element = document.getElementById('config-document');
 221                 if (element) {
 222                     document.switcher = new JSwitcher(toggler, element);
 223                 }
 224             });";
 225 
 226         JFactory::getDocument()->addScriptDeclaration($script);
 227         static::$loaded[__METHOD__] = true;
 228     }
 229 
 230      231  232  233  234  235  236  237  238  239 
 240     public static function combobox()
 241     {
 242         if (isset(static::$loaded[__METHOD__]))
 243         {
 244             return;
 245         }
 246         
 247         static::core();
 248 
 249         JHtml::_('script', 'system/combobox.js', array('version' => 'auto', 'relative' => true));
 250         static::$loaded[__METHOD__] = true;
 251     }
 252 
 253      254  255  256  257  258  259  260  261  262  263  264  265  266  267  268  269  270  271  272  273  274  275  276  277  278 
 279     public static function tooltip($selector = '.hasTip', $params = array())
 280     {
 281         $sig = md5(serialize(array($selector, $params)));
 282 
 283         if (isset(static::$loaded[__METHOD__][$sig]))
 284         {
 285             return;
 286         }
 287 
 288         
 289         static::framework(true);
 290 
 291         
 292         $opt['maxTitleChars'] = isset($params['maxTitleChars']) && $params['maxTitleChars'] ? (int) $params['maxTitleChars'] : 50;
 293 
 294         
 295         $opt['offset']    = isset($params['offset']) && is_array($params['offset']) ? $params['offset'] : null;
 296         $opt['showDelay'] = isset($params['showDelay']) ? (int) $params['showDelay'] : null;
 297         $opt['hideDelay'] = isset($params['hideDelay']) ? (int) $params['hideDelay'] : null;
 298         $opt['className'] = isset($params['className']) ? $params['className'] : null;
 299         $opt['fixed']     = isset($params['fixed']) && $params['fixed'];
 300         $opt['onShow']    = isset($params['onShow']) ? '\\' . $params['onShow'] : null;
 301         $opt['onHide']    = isset($params['onHide']) ? '\\' . $params['onHide'] : null;
 302 
 303         $options = JHtml::getJSObject($opt);
 304 
 305         
 306         JHtml::_('jquery.framework');
 307 
 308         
 309         JFactory::getDocument()->addScriptDeclaration(
 310             "jQuery(function($) {
 311              $('$selector').each(function() {
 312                 var title = $(this).attr('title');
 313                 if (title) {
 314                     var parts = title.split('::', 2);
 315                     var mtelement = document.id(this);
 316                     mtelement.store('tip:title', parts[0]);
 317                     mtelement.store('tip:text', parts[1]);
 318                 }
 319             });
 320             var JTooltips = new Tips($('$selector').get(), $options);
 321         });"
 322         );
 323 
 324         
 325         static::$loaded[__METHOD__][$sig] = true;
 326 
 327         return;
 328     }
 329 
 330      331  332  333  334  335  336  337  338  339  340  341  342  343  344  345  346  347  348  349  350  351 
 352     public static function modal($selector = 'a.modal', $params = array())
 353     {
 354         $document = JFactory::getDocument();
 355 
 356         
 357         if (!isset(static::$loaded[__METHOD__]))
 358         {
 359             
 360             static::framework(true);
 361 
 362             
 363             JHtml::_('script', 'system/modal.js', array('framework' => true, 'version' => 'auto', 'relative' => true));
 364             JHtml::_('stylesheet', 'system/modal.css', array('version' => 'auto', 'relative' => true));
 365         }
 366 
 367         $sig = md5(serialize(array($selector, $params)));
 368 
 369         if (isset(static::$loaded[__METHOD__][$sig]))
 370         {
 371             return;
 372         }
 373 
 374         JLog::add('JHtmlBehavior::modal is deprecated. Use the modal equivalent from bootstrap.', JLog::WARNING, 'deprecated');
 375 
 376         
 377         $opt['ajaxOptions']   = isset($params['ajaxOptions']) && is_array($params['ajaxOptions']) ? $params['ajaxOptions'] : null;
 378         $opt['handler']       = isset($params['handler']) ? $params['handler'] : null;
 379         $opt['parseSecure']   = isset($params['parseSecure']) ? (bool) $params['parseSecure'] : null;
 380         $opt['closable']      = isset($params['closable']) ? (bool) $params['closable'] : null;
 381         $opt['closeBtn']      = isset($params['closeBtn']) ? (bool) $params['closeBtn'] : null;
 382         $opt['iframePreload'] = isset($params['iframePreload']) ? (bool) $params['iframePreload'] : null;
 383         $opt['iframeOptions'] = isset($params['iframeOptions']) && is_array($params['iframeOptions']) ? $params['iframeOptions'] : null;
 384         $opt['size']          = isset($params['size']) && is_array($params['size']) ? $params['size'] : null;
 385         $opt['shadow']        = isset($params['shadow']) ? $params['shadow'] : null;
 386         $opt['overlay']       = isset($params['overlay']) ? $params['overlay'] : null;
 387         $opt['onOpen']        = isset($params['onOpen']) ? $params['onOpen'] : null;
 388         $opt['onClose']       = isset($params['onClose']) ? $params['onClose'] : null;
 389         $opt['onUpdate']      = isset($params['onUpdate']) ? $params['onUpdate'] : null;
 390         $opt['onResize']      = isset($params['onResize']) ? $params['onResize'] : null;
 391         $opt['onMove']        = isset($params['onMove']) ? $params['onMove'] : null;
 392         $opt['onShow']        = isset($params['onShow']) ? $params['onShow'] : null;
 393         $opt['onHide']        = isset($params['onHide']) ? $params['onHide'] : null;
 394 
 395         
 396         JHtml::_('jquery.framework');
 397 
 398         if (isset($params['fullScreen']) && (bool) $params['fullScreen'])
 399         {
 400             $opt['size']      = array('x' => '\\jQuery(window).width() - 80', 'y' => '\\jQuery(window).height() - 80');
 401         }
 402 
 403         $options = JHtml::getJSObject($opt);
 404 
 405         
 406         $document
 407             ->addScriptDeclaration(
 408             "
 409         jQuery(function($) {
 410             SqueezeBox.initialize(" . $options . ");
 411             SqueezeBox.assign($('" . $selector . "').get(), {
 412                 parse: 'rel'
 413             });
 414         });
 415 
 416         window.jModalClose = function () {
 417             SqueezeBox.close();
 418         };
 419         
 420         // Add extra modal close functionality for tinyMCE-based editors
 421         document.onreadystatechange = function () {
 422             if (document.readyState == 'interactive' && typeof tinyMCE != 'undefined' && tinyMCE)
 423             {
 424                 if (typeof window.jModalClose_no_tinyMCE === 'undefined')
 425                 {   
 426                     window.jModalClose_no_tinyMCE = typeof(jModalClose) == 'function'  ?  jModalClose  :  false;
 427                     
 428                     jModalClose = function () {
 429                         if (window.jModalClose_no_tinyMCE) window.jModalClose_no_tinyMCE.apply(this, arguments);
 430                         tinyMCE.activeEditor.windowManager.close();
 431                     };
 432                 }
 433         
 434                 if (typeof window.SqueezeBoxClose_no_tinyMCE === 'undefined')
 435                 {
 436                     if (typeof(SqueezeBox) == 'undefined')  SqueezeBox = {};
 437                     window.SqueezeBoxClose_no_tinyMCE = typeof(SqueezeBox.close) == 'function'  ?  SqueezeBox.close  :  false;
 438         
 439                     SqueezeBox.close = function () {
 440                         if (window.SqueezeBoxClose_no_tinyMCE)  window.SqueezeBoxClose_no_tinyMCE.apply(this, arguments);
 441                         tinyMCE.activeEditor.windowManager.close();
 442                     };
 443                 }
 444             }
 445         };
 446         "
 447         );
 448 
 449         
 450         static::$loaded[__METHOD__][$sig] = true;
 451 
 452         return;
 453     }
 454 
 455      456  457  458  459  460  461  462  463 
 464     public static function multiselect($id = 'adminForm')
 465     {
 466         
 467         if (isset(static::$loaded[__METHOD__][$id]))
 468         {
 469             return;
 470         }
 471 
 472         
 473         static::core();
 474 
 475         
 476         JHtml::_('jquery.framework');
 477 
 478         JHtml::_('script', 'system/multiselect.js', array('version' => 'auto', 'relative' => true));
 479 
 480         
 481         JFactory::getDocument()->addScriptDeclaration(
 482             "jQuery(document).ready(function() {
 483                 Joomla.JMultiSelect('" . $id . "');
 484             });"
 485         );
 486 
 487         
 488         static::$loaded[__METHOD__][$id] = true;
 489 
 490         return;
 491     }
 492 
 493      494  495  496  497  498  499  500  501  502  503 
 504     public static function tree($id, $params = array(), $root = array())
 505     {
 506         
 507         static::framework();
 508 
 509         JHtml::_('script', 'system/mootree.js', array('framework' => true, 'version' => 'auto', 'relative' => true));
 510         JHtml::_('stylesheet', 'system/mootree.css', array('version' => 'auto', 'relative' => true));
 511 
 512         if (isset(static::$loaded[__METHOD__][$id]))
 513         {
 514             return;
 515         }
 516 
 517         
 518         JHtml::_('jquery.framework');
 519 
 520         
 521         $opt['div']   = array_key_exists('div', $params) ? $params['div'] : $id . '_tree';
 522         $opt['mode']  = array_key_exists('mode', $params) ? $params['mode'] : 'folders';
 523         $opt['grid']  = array_key_exists('grid', $params) ? '\\' . $params['grid'] : true;
 524         $opt['theme'] = array_key_exists('theme', $params) ? $params['theme'] : JHtml::_('image', 'system/mootree.gif', '', array(), true, true);
 525 
 526         
 527         $opt['onExpand'] = array_key_exists('onExpand', $params) ? '\\' . $params['onExpand'] : null;
 528         $opt['onSelect'] = array_key_exists('onSelect', $params) ? '\\' . $params['onSelect'] : null;
 529         $opt['onClick']  = array_key_exists('onClick', $params) ? '\\' . $params['onClick']
 530         : '\\function(node){  window.open(node.data.url, node.data.target != null ? node.data.target : \'_self\'); }';
 531 
 532         $options = JHtml::getJSObject($opt);
 533 
 534         
 535         $rt['text']     = array_key_exists('text', $root) ? $root['text'] : 'Root';
 536         $rt['id']       = array_key_exists('id', $root) ? $root['id'] : null;
 537         $rt['color']    = array_key_exists('color', $root) ? $root['color'] : null;
 538         $rt['open']     = array_key_exists('open', $root) ? '\\' . $root['open'] : true;
 539         $rt['icon']     = array_key_exists('icon', $root) ? $root['icon'] : null;
 540         $rt['openicon'] = array_key_exists('openicon', $root) ? $root['openicon'] : null;
 541         $rt['data']     = array_key_exists('data', $root) ? $root['data'] : null;
 542         $rootNode = JHtml::getJSObject($rt);
 543 
 544         $treeName = array_key_exists('treeName', $params) ? $params['treeName'] : '';
 545 
 546         $js = '     jQuery(function(){
 547             tree' . $treeName . ' = new MooTreeControl(' . $options . ',' . $rootNode . ');
 548             tree' . $treeName . '.adopt(\'' . $id . '\');})';
 549 
 550         
 551         $document = JFactory::getDocument();
 552         $document->addScriptDeclaration($js);
 553 
 554         
 555         static::$loaded[__METHOD__][$id] = true;
 556 
 557         return;
 558     }
 559 
 560      561  562  563  564  565  566  567  568 
 569     public static function calendar()
 570     {
 571         
 572         if (isset(static::$loaded[__METHOD__]))
 573         {
 574             return;
 575         }
 576 
 577         JLog::add('JHtmlBehavior::calendar is deprecated as the static assets are being loaded in the relative layout.', JLog::WARNING, 'deprecated');
 578 
 579         $document = JFactory::getDocument();
 580         $tag      = JFactory::getLanguage()->getTag();
 581         $attribs  = array('title' => JText::_('JLIB_HTML_BEHAVIOR_GREEN'), 'media' => 'all');
 582 
 583         JHtml::_('stylesheet', 'system/calendar-jos.css', array('version' => 'auto', 'relative' => true), $attribs);
 584         JHtml::_('script', $tag . '/calendar.js', array('version' => 'auto', 'relative' => true));
 585         JHtml::_('script', $tag . '/calendar-setup.js', array('version' => 'auto', 'relative' => true));
 586 
 587         $translation = static::calendartranslation();
 588 
 589         if ($translation)
 590         {
 591             $document->addScriptDeclaration($translation);
 592         }
 593 
 594         static::$loaded[__METHOD__] = true;
 595     }
 596 
 597      598  599  600  601  602  603  604  605 
 606     public static function colorpicker()
 607     {
 608         
 609         if (isset(static::$loaded[__METHOD__]))
 610         {
 611             return;
 612         }
 613 
 614         
 615         JHtml::_('jquery.framework');
 616 
 617         JHtml::_('script', 'jui/jquery.minicolors.min.js', array('version' => 'auto', 'relative' => true));
 618         JHtml::_('stylesheet', 'jui/jquery.minicolors.css', array('version' => 'auto', 'relative' => true));
 619         JFactory::getDocument()->addScriptDeclaration("
 620                 jQuery(document).ready(function (){
 621                     jQuery('.minicolors').each(function() {
 622                         jQuery(this).minicolors({
 623                             control: jQuery(this).attr('data-control') || 'hue',
 624                             format: jQuery(this).attr('data-validate') === 'color'
 625                                 ? 'hex'
 626                                 : (jQuery(this).attr('data-format') === 'rgba'
 627                                     ? 'rgb'
 628                                     : jQuery(this).attr('data-format'))
 629                                 || 'hex',
 630                             keywords: jQuery(this).attr('data-keywords') || '',
 631                             opacity: jQuery(this).attr('data-format') === 'rgba' ? true : false || false,
 632                             position: jQuery(this).attr('data-position') || 'default',
 633                             theme: 'bootstrap'
 634                         });
 635                     });
 636                 });
 637             "
 638         );
 639 
 640         static::$loaded[__METHOD__] = true;
 641     }
 642 
 643      644  645  646  647  648  649  650  651 
 652     public static function simplecolorpicker()
 653     {
 654         
 655         if (isset(static::$loaded[__METHOD__]))
 656         {
 657             return;
 658         }
 659 
 660         
 661         JHtml::_('jquery.framework');
 662 
 663         JHtml::_('script', 'jui/jquery.simplecolors.min.js', array('version' => 'auto', 'relative' => true));
 664         JHtml::_('stylesheet', 'jui/jquery.simplecolors.css', array('version' => 'auto', 'relative' => true));
 665         JFactory::getDocument()->addScriptDeclaration("
 666                 jQuery(document).ready(function (){
 667                     jQuery('select.simplecolors').simplecolors();
 668                 });
 669             "
 670         );
 671 
 672         static::$loaded[__METHOD__] = true;
 673     }
 674 
 675      676  677  678  679  680  681 
 682     public static function keepalive()
 683     {
 684         
 685         if (isset(static::$loaded[__METHOD__]))
 686         {
 687             return;
 688         }
 689 
 690         $session = JFactory::getSession();
 691 
 692         
 693         $refreshTime = 300;
 694 
 695         if ($session->storeName === 'database')
 696         {
 697             $lifeTime    = $session->getExpire();
 698             $refreshTime = $lifeTime <= 60 ? 45 : $lifeTime - 60;
 699 
 700             
 701             if ($refreshTime > 3600 || $refreshTime <= 0)
 702             {
 703                 $refreshTime = 3600;
 704             }
 705         }
 706 
 707         
 708         $uri = 'index.php' . (JFactory::getApplication()->isClient('site') || !JFactory::getUser()->guest ? '?option=com_ajax&format=json' : '');
 709 
 710         
 711         static::core();
 712         static::polyfill('event', 'lt IE 9');
 713 
 714         
 715         JFactory::getDocument()->addScriptOptions('system.keepalive', array('interval' => $refreshTime * 1000, 'uri' => JRoute::_($uri)));
 716 
 717         
 718         JHtml::_('script', 'system/keepalive.js', array('version' => 'auto', 'relative' => true));
 719 
 720         static::$loaded[__METHOD__] = true;
 721 
 722         return;
 723     }
 724 
 725      726  727  728  729  730  731  732  733  734  735  736  737  738  739 
 740     public static function highlighter(array $terms, $start = 'highlighter-start', $end = 'highlighter-end', $className = 'highlight', $tag = 'span')
 741     {
 742         $sig = md5(serialize(array($terms, $start, $end)));
 743 
 744         if (isset(static::$loaded[__METHOD__][$sig]))
 745         {
 746             return;
 747         }
 748 
 749         $terms = array_filter($terms, 'strlen');
 750 
 751         
 752         if (empty($terms))
 753         {
 754             static::$loaded[__METHOD__][$sig] = true;
 755 
 756             return;
 757         }
 758 
 759         
 760         static::core();
 761 
 762         
 763         JHtml::_('jquery.framework');
 764 
 765         JHtml::_('script', 'system/highlighter.js', array('version' => 'auto', 'relative' => true));
 766 
 767         foreach ($terms as $i => $term)
 768         {
 769             $terms[$i] = JFilterOutput::stringJSSafe($term);
 770         }
 771 
 772         $document = JFactory::getDocument();
 773         $document->addScriptDeclaration("
 774             jQuery(function ($) {
 775                 var start = document.getElementById('" . $start . "');
 776                 var end = document.getElementById('" . $end . "');
 777                 if (!start || !end || !Joomla.Highlighter) {
 778                     return true;
 779                 }
 780                 highlighter = new Joomla.Highlighter({
 781                     startElement: start,
 782                     endElement: end,
 783                     className: '" . $className . "',
 784                     onlyWords: false,
 785                     tag: '" . $tag . "'
 786                 }).highlight([\"" . implode('","', $terms) . "\"]);
 787                 $(start).remove();
 788                 $(end).remove();
 789             });
 790         ");
 791 
 792         static::$loaded[__METHOD__][$sig] = true;
 793 
 794         return;
 795     }
 796 
 797      798  799  800  801  802  803  804  805 
 806     public static function noframes()
 807     {
 808         JLog::add(__METHOD__ . ' is deprecated, add a X-Frame-Options HTTP Header with the SAMEORIGIN value instead.', JLog::WARNING, 'deprecated');
 809 
 810         
 811         if (isset(static::$loaded[__METHOD__]))
 812         {
 813             return;
 814         }
 815 
 816         
 817         static::core();
 818 
 819         
 820         JHtml::_('jquery.framework');
 821 
 822         $js = 'jQuery(function () {
 823             if (top == self) {
 824                 document.documentElement.style.display = "block";
 825             }
 826             else
 827             {
 828                 top.location = self.location;
 829             }
 830 
 831             // Firefox fix
 832             jQuery("input[autofocus]").focus();
 833         })';
 834         $document = JFactory::getDocument();
 835         $document->addStyleDeclaration('html { display:none }');
 836         $document->addScriptDeclaration($js);
 837 
 838         JFactory::getApplication()->setHeader('X-Frame-Options', 'SAMEORIGIN');
 839 
 840         static::$loaded[__METHOD__] = true;
 841     }
 842 
 843      844  845  846  847  848  849  850  851  852 
 853     protected static function _getJSObject($array = array())
 854     {
 855         JLog::add('JHtmlBehavior::_getJSObject() is deprecated. JHtml::getJSObject() instead..', JLog::WARNING, 'deprecated');
 856 
 857         return JHtml::getJSObject($array);
 858     }
 859 
 860      861  862  863  864  865  866  867  868  869  870  871  872  873  874  875 
 876     public static function tabstate()
 877     {
 878         if (isset(self::$loaded[__METHOD__]))
 879         {
 880             return;
 881         }
 882         
 883         JHtml::_('jquery.framework');
 884         JHtml::_('behavior.polyfill', array('filter','xpath'));
 885         JHtml::_('script', 'system/tabs-state.js', array('version' => 'auto', 'relative' => true));
 886         self::$loaded[__METHOD__] = true;
 887     }
 888 
 889      890  891  892  893  894  895  896  897  898 
 899     public static function polyfill($polyfillTypes = null, $conditionalBrowser = null)
 900     {
 901         if ($polyfillTypes === null)
 902         {
 903             return;
 904         }
 905 
 906         foreach ((array) $polyfillTypes as $polyfillType)
 907         {
 908             $sig = md5(serialize(array($polyfillType, $conditionalBrowser)));
 909 
 910             
 911             if (isset(static::$loaded[__METHOD__][$sig]))
 912             {
 913                 continue;
 914             }
 915 
 916             
 917             $scriptOptions = array('version' => 'auto', 'relative' => true);
 918             $scriptOptions = $conditionalBrowser !== null ? array_replace($scriptOptions, array('conditional' => $conditionalBrowser)) : $scriptOptions;
 919 
 920             JHtml::_('script', 'system/polyfill.' . $polyfillType . '.js', $scriptOptions);
 921 
 922             
 923             static::$loaded[__METHOD__][$sig] = true;
 924         }
 925     }
 926 
 927      928  929  930  931  932  933 
 934     protected static function calendartranslation()
 935     {
 936         static $jsscript = 0;
 937 
 938         
 939         if ($jsscript)
 940         {
 941             return false;
 942         }
 943 
 944         $jsscript = 1;
 945 
 946         
 947         $callback = array('JText', '_');
 948         $weekdays_full = array_map(
 949             $callback, array(
 950                 'SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY',
 951             )
 952         );
 953         $weekdays_short = array_map(
 954             $callback,
 955             array(
 956                 'SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN',
 957             )
 958         );
 959         $months_long = array_map(
 960             $callback, array(
 961                 'JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE',
 962                 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER',
 963             )
 964         );
 965         $months_short = array_map(
 966             $callback, array(
 967                 'JANUARY_SHORT', 'FEBRUARY_SHORT', 'MARCH_SHORT', 'APRIL_SHORT', 'MAY_SHORT', 'JUNE_SHORT',
 968                 'JULY_SHORT', 'AUGUST_SHORT', 'SEPTEMBER_SHORT', 'OCTOBER_SHORT', 'NOVEMBER_SHORT', 'DECEMBER_SHORT',
 969             )
 970         );
 971 
 972         
 973         $today = " " . JText::_('JLIB_HTML_BEHAVIOR_TODAY') . " ";
 974         $text = array(
 975             'INFO'           => JText::_('JLIB_HTML_BEHAVIOR_ABOUT_THE_CALENDAR'),
 976             'ABOUT'          => "DHTML Date/Time Selector\n"
 977                 . "(c) dynarch.com 20022005 / Author: Mihai Bazon\n"
 978                 . "For latest version visit: http://www.dynarch.com/projects/calendar/\n"
 979                 . "Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details."
 980                 . "\n\n"
 981                 . JText::_('JLIB_HTML_BEHAVIOR_DATE_SELECTION')
 982                 . JText::_('JLIB_HTML_BEHAVIOR_YEAR_SELECT')
 983                 . JText::_('JLIB_HTML_BEHAVIOR_MONTH_SELECT')
 984                 . JText::_('JLIB_HTML_BEHAVIOR_HOLD_MOUSE'),
 985             'ABOUT_TIME'      => "\n\n"
 986                 . "Time selection:\n"
 987                 . " Click on any of the time parts to increase it\n"
 988                 . " or Shiftclick to decrease it\n"
 989                 . " or click and drag for faster selection.",
 990             'PREV_YEAR'       => JText::_('JLIB_HTML_BEHAVIOR_PREV_YEAR_HOLD_FOR_MENU'),
 991             'PREV_MONTH'      => JText::_('JLIB_HTML_BEHAVIOR_PREV_MONTH_HOLD_FOR_MENU'),
 992             'GO_TODAY'        => JText::_('JLIB_HTML_BEHAVIOR_GO_TODAY'),
 993             'NEXT_MONTH'      => JText::_('JLIB_HTML_BEHAVIOR_NEXT_MONTH_HOLD_FOR_MENU'),
 994             'SEL_DATE'        => JText::_('JLIB_HTML_BEHAVIOR_SELECT_DATE'),
 995             'DRAG_TO_MOVE'    => JText::_('JLIB_HTML_BEHAVIOR_DRAG_TO_MOVE'),
 996             'PART_TODAY'      => $today,
 997             'DAY_FIRST'       => JText::_('JLIB_HTML_BEHAVIOR_DISPLAY_S_FIRST'),
 998             'WEEKEND'         => JFactory::getLanguage()->getWeekEnd(),
 999             'CLOSE'           => JText::_('JLIB_HTML_BEHAVIOR_CLOSE'),
1000             'TODAY'           => JText::_('JLIB_HTML_BEHAVIOR_TODAY'),
1001             'TIME_PART'       => JText::_('JLIB_HTML_BEHAVIOR_SHIFT_CLICK_OR_DRAG_TO_CHANGE_VALUE'),
1002             'DEF_DATE_FORMAT' => "%Y%m%d",
1003             'TT_DATE_FORMAT'  => JText::_('JLIB_HTML_BEHAVIOR_TT_DATE_FORMAT'),
1004             'WK'              => JText::_('JLIB_HTML_BEHAVIOR_WK'),
1005             'TIME'            => JText::_('JLIB_HTML_BEHAVIOR_TIME'),
1006         );
1007 
1008         return 'Calendar._DN = ' . json_encode($weekdays_full) . ';'
1009             . ' Calendar._SDN = ' . json_encode($weekdays_short) . ';'
1010             . ' Calendar._FD = 0;'
1011             . ' Calendar._MN = ' . json_encode($months_long) . ';'
1012             . ' Calendar._SMN = ' . json_encode($months_short) . ';'
1013             . ' Calendar._TT = ' . json_encode($text) . ';';
1014     }
1015 }
1016