예제 #1
0
파일: I18n.php 프로젝트: ircoco/BlackCatCMS
 /**
  *
  *
  *
  *
  **/
 public function checkFile($file, $check_var, $check_only = false)
 {
     $this->log()->logDebug(sprintf('checking file [%s] for var [%s], check_only [%s]', $file, $check_var, $check_only));
     // require the language file
     require $file;
     // check if the var is defined now
     if (isset(${$check_var})) {
         $this->log()->logDebug('found $check_var');
         $isIndexed = array_values(${$check_var}) === ${$check_var};
         if ($isIndexed) {
             $this->log()->logDebug('indexed, returning false');
             return false;
         }
         if ($check_only) {
             return ${$check_var};
         } else {
             self::$_lang = array_merge(self::$_lang, ${$check_var});
             if (preg_match("/(\\w+)\\.php/", $file, $matches)) {
                 self::$_current_lang = $matches[1];
             }
             $this->_loaded[$file] = 1;
             $this->log()->logDebug('loaded language file: ', $file);
             return true;
         }
     } else {
         $this->log()->logInfo(sprintf('invalid lang file [%s], var [%s] is not set', $file, $check_var));
         return false;
     }
 }