예제 #1
0
 public static function unserialize($hash, $lang)
 {
     $directory = ThemeInfo::getReportDirectory($hash);
     $fullfilename = $directory . '/results_' . $lang . '.json';
     if (!file_exists($fullfilename)) {
         return null;
     }
     $json = file_get_contents($fullfilename);
     $obj = json_decode($json);
     $validationResults = new ValidationResults($lang);
     $validationResults->check_critical = $obj->check_critical;
     $validationResults->check_warnings = $obj->check_warnings;
     $validationResults->check_successes = $obj->check_successes;
     $validationResults->check_undefined = $obj->check_undefined;
     if (isset($obj->check_info)) {
         $validationResults->check_info = $obj->check_info;
     }
     $validationResults->check_count = count($validationResults->check_critical) + count($validationResults->check_warnings) + count($validationResults->check_successes) + count($validationResults->check_undefined) + count($validationResults->check_info);
     $validationResults->check_countOK = count($validationResults->check_warnings) + count($validationResults->check_successes) + count($validationResults->check_info);
     $validationResults->score = $obj->score;
     return $validationResults;
 }
예제 #2
0
 /** 
  *		Restore check results from a JSON file.
  **/
 public static function unserialize($hash)
 {
     if (!USE_DB) {
         return null;
     }
     $directory = ThemeInfo::getReportDirectory($hash);
     if (!file_exists($directory)) {
         return null;
     }
     $history = new History();
     $themeInfo = $history->loadThemeFromHash($hash);
     if (empty($themeInfo)) {
         return null;
     }
     $fileValidator = new FileValidator($themeInfo);
     global $ExistingLangs;
     foreach ($ExistingLangs as $l) {
         $_validationResults = ValidationResults::unserialize($hash, $l);
         if (empty($_validationResults)) {
             continue;
         }
         $fileValidator->validationResults[$l] = $_validationResults;
     }
     if (!empty($themeInfo->parentId)) {
         $fewInfo = $history->getFewInfo($themeInfo->parentId);
         if (!empty($fewInfo["id"])) {
             $themeInfo->parentNameSanitized = $fewInfo["namesanitized"];
         }
         $themeInfo->parentThemeType = $fewInfo["themetype"];
     }
     if ($themeInfo->isThemeForest) {
         $fileValidator->generateThemeForestReport();
     }
     return $fileValidator;
 }