Esempio n. 1
0
 static function matchScript($file, $app)
 {
     $mainframe = JFactory::getApplication();
     $path = JPATH_SITE;
     switch ($app) {
         case 'msc':
             $com = 'com_ose' . $app;
             break;
         default:
             $com = 'com_ose_' . $app;
             break;
     }
     $replace = $mainframe->isSite() == true ? 'components/' . $com . '/' : 'administrator/components/' . $com . '/';
     $rFile = preg_replace('/components\\/com_[\\w\\d]*\\//', "ose/{$app}/", $file);
     $rFile1 = str_replace(array('/', '\\'), DS, $rFile);
     if (JFile::exists($path . DS . $rFile1)) {
         oseHTML2::script($rFile);
     } else {
         if (JFile::exists(JPATH_SITE . DS . $file)) {
             oseHTML2::script($file);
         } elseif ('index' == substr($file, 0, 5)) {
             $document = JFactory::getDocument();
             $document->addScript($file);
         }
     }
 }