Пример #1
0
 static function IncludeJQuery($force = false)
 {
     if (FSS_Helper::$jquery_incl) {
         return;
     }
     FSS_Helper::$jquery_incl = true;
     $document = JFactory::getDocument();
     if (FSSJ3Helper::IsJ3()) {
         JHtml::_('jquery.framework');
         return;
     }
     $include = FSS_Settings::get('jquery_include');
     if ($include == "") {
         $include = "auto";
     }
     $url = JURI::root(true) . '/components/com_fss/assets/js/jquery/jquery-1.10.2.min.js';
     $cpurl = JURI::root(true) . '/components/com_fss/assets/js/jquery/jquery-migrate-1.2.1.min.js';
     $ncurl = JURI::root(true) . '/components/com_fss/assets/js/jquery/jquery.noconflict.js';
     if ($force) {
         $include = "yes";
     }
     if ($include == "yes") {
         $document->addScript($url);
         $document->addScript($cpurl);
         $document->addScript($ncurl);
     } else {
         if ($include == "yesnonc") {
             $document->addScript($url);
             $document->addScript($cpurl);
         } else {
             $found = false;
             foreach ($document->_scripts as $jsurl => $script) {
                 if (strpos(strtolower($jsurl), "jquery") > 0) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 $document->addScript($url);
                 $document->addScript($cpurl);
                 $document->addScript($ncurl);
             }
         }
     }
 }