Beispiel #1
0
 private static function loadBannedFranchiseCoupling()
 {
     $lines = TextHelper::loadSimpleList(Config::$bannedFranchiseCouplingListPath);
     $lines[] = '---';
     $groups = [];
     $reset = true;
     $key = 0;
     $group = [];
     foreach ($lines as $line) {
         if (preg_match('/^-+$/', $line)) {
             if (!empty($group)) {
                 $groups[$key] = $group;
                 ++$key;
             }
             $group = [];
             continue;
         }
         $group[] = $line;
     }
     $ret = [];
     foreach ($groups as $group) {
         foreach ($group as $key) {
             $ret[$key] = array_combine($group, array_fill(0, count($group), true));
             unset($ret[$key][$key]);
         }
     }
     return $ret;
 }
 private static function addRecsFromStaticRecommendations($media)
 {
     $staticRecIds = TextHelper::loadSimpleList(Config::$staticRecommendationListPath);
     $weights = [];
     foreach ($staticRecIds as $id) {
         $recMedia = substr($id, 0, 1);
         if ($recMedia == $media) {
             $weights[$id] = null;
         }
     }
     return $weights;
 }
Beispiel #3
0
 public static function doInit()
 {
     $list = TextHelper::loadSimpleList(Config::$bannedUsersListPath);
     foreach ($list as $line) {
         $tmp = strpos($line, "\t") === false ? [$line, self::USER_BAN_TOTAL] : explode("\t", $line);
         list($userName, $banType) = $tmp;
         self::$bannedUsers[strtolower($userName)] = $banType;
     }
     self::$bannedGenres = TextHelper::loadSimpleList(Config::$bannedGenresListPath);
     self::$bannedCreators = TextHelper::loadSimpleList(Config::$bannedCreatorsListPath);
     self::$bannedGenresForRecs = TextHelper::loadSimpleList(Config::$bannedGenresForRecsListPath);
     self::$bannedFranchiseCoupling = TextHelper::loadJson(Config::$bannedFranchiseCouplingListPath, true);
 }