Example #1
0
 public static function getAll($includePermanent = true)
 {
     $factions = array();
     if (!self::checkMStore(true)) {
         return $factions;
     }
     foreach (scandir(self::$mstore . DIRECTORY_SEPARATOR . "factions_faction") as $key => $factionRaw) {
         if (!in_array($factionRaw, array(".", ".."))) {
             $path = self::$mstore . DIRECTORY_SEPARATOR . "factions_faction" . DIRECTORY_SEPARATOR . $factionRaw;
             if (is_file($path)) {
                 $factionId = basename($factionRaw, ".json");
                 $faction = new Faction($factionId);
                 if (!$includePermanent && $faction->isPermanent()) {
                     continue;
                 }
                 $factions[$factionId] = $faction;
             }
         }
     }
     return $factions;
 }