コード例 #1
0
 /**
  * Standard language loading method:
  * @todo add to CB API
  *
  * @param  string  $interface   'admin' to force-load admin languages
  */
 public static function loadLang($interface = null)
 {
     global $_CB_framework;
     static $loaded = false;
     static $adminLoaded = false;
     if (!$loaded) {
         $path = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/language';
         $myLanguageFolder = '-' . strtolower($_CB_framework->getCfg('lang_tag'));
         $myLanguageFile = 'language.php';
         $file = $path . '/cbpaidsubscriptions' . $myLanguageFolder . '/' . $myLanguageFile;
         if (!file_exists($file)) {
             // Old method:
             $myLanguageFolder = $_CB_framework->getCfg('lang');
             $myLanguageFile = $myLanguageFolder . '.php';
             $file = $path . '/cbpaidsubscriptions' . $myLanguageFolder . '/' . $myLanguageFile;
         }
         if (file_exists($file)) {
             if (!$interface) {
                 $CBstrings = array();
                 /** @noinspection PhpIncludeInspection */
                 include_once $file;
                 // defines $CBstrings
                 CBPTXT::addStrings($CBstrings);
             }
             if ($_CB_framework->getUi() == 2 || $interface == 'admin') {
                 if (!$adminLoaded) {
                     $file = $path . '/cbpaidsubscriptions' . $myLanguageFolder . '/admin_' . $myLanguageFile;
                     if (file_exists($file)) {
                         $CBstrings = array();
                         /** @noinspection PhpIncludeInspection */
                         include_once $file;
                         // defines $CBstrings
                         CBPTXT::addStrings($CBstrings);
                     }
                     $adminLoaded = true;
                 }
             }
         }
         $loaded = true;
     }
 }